Skip to content

fix: seed a ring from the topic's own keyword index, strongest first - #199

Merged
ralyodio merged 1 commit into
mainfrom
fix/ring-candidates-order
Sep 13, 2026
Merged

fix: seed a ring from the topic's own keyword index, strongest first#199
ralyodio merged 1 commit into
mainfrom
fix/ring-candidates-order

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Seed a ring from the topic's own keyword index, strongest first

Follow-up to #198. The poller deployed the category ranking and created seven rings with zero members: every candidate query timed out. Timed read-only against production (packages/db/scripts/time-ring-queries.mjs, 580,383 feeds, 3,530,106 keyword rows): the planner drove both the exists walk and the join from feeds_status_success_idx, probing and sorting every active feed, 85 s and 80 s on the largest topic; the title lookup 7.4 s; the capped size probe 86 ms.

  • topicRingCandidates: from feed_keywords indexed by feed_keywords_slug_idx cross join feeds, order by k.count desc limit ?. The index is already in that order for a slug, so the scan stops at the hundredth feed that can link. Ring order is now the topic's own (strongest first); positions are still written once and new members append. Fixture given distinct strengths so the ordering test still discriminates.
  • Ring title from topics.keyword (the rollup already holds it), recomputed only for a topic the rollup lacks.
  • topRingTopics: category count with the same pinned join; pool is 5x the rings wanted.

db suite passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XYae2mH3khdwiXUVzcVMDw

Measured against production (580,383 feeds, 3.5M keyword rows): every
candidate query so far was driven by the planner from feeds by status, a
probe and sort over every active feed, 80 seconds on the largest topic
against a 30-second deadline; the title lookup grouped the slug's rows for
seven more. Now the candidates come from feed_keywords_slug_idx (slug,
count desc) with the join order pinned, so the statement stops at the
hundredth feed that can link; the title is read from the topics rollup that
already holds it; the category ranking pool is five times the rings wanted.
Ring order is the topic's own, strongest first, still assigned once.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYae2mH3khdwiXUVzcVMDw
@ralyodio
ralyodio merged commit 372aab9 into main Sep 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant