Repository navigation
fix(storage): drop threads_fts, a maintained FTS index with zero consumers - #3699
Conversation
…umers Problem: polylogue-eizc's producer/consumer audit (2026-07-31) flagged threads_fts and blocks_command_trigram as trigger-maintained FTS surfaces with zero application-layer search consumers. Re-verified against present source: threads_fts's only MATCH reader (session_insight_thread_queries.list_threads) still has zero production callers -- the live "analyze threads" search path (archive_tiers/archive.py:list_thread_insights) already does a manual LIKE substring scan and never touches threads_fts. blocks_command_trigram was NOT dropped: devtools/affordance_usage.py's _cli_action_rows (wired via `devtools workspace affordance-usage`, PR #2622) is a real, functional consumer the original zero-consumer finding missed -- kept in full. Solution: drop threads_fts (table, 3 triggers, rebuild/repair/freshness plumbing) across archive_tiers/index.py, fts/sql.py, fts/fts_lifecycle.py, fts/dangling_repair.py, fts/freshness.py, daemon/fts_startup.py, daemon/fts_automerge.py, daemon/fts_status.py, daemon/status.py, daemon/convergence_stages.py, insights/session/{status,runtime, repair_assessment}.py, derived/{insights,derived_status}.py, repair.py, maintenance/preview.py, devtools/synthetic_benchmark_runtime.py. list_threads' text-query path now does a plain LIKE scan over threads.search_text instead of an FTS5 MATCH, mirroring the already-live analyze-threads search shape -- no behavior loss, just no longer backed by a redundant index. INDEX_SCHEMA_VERSION bumped 60->61; lifecycle.py declares the v61 delta as CACHE_REMOVAL (same class as v37/v41): a clone-safe fast-forward drops the table and its triggers via a new DROP_TABLE-with-trigger-objects executor path (no `polylogue ops reset --index && polylogued run` required). Verification: devtools test across the touched surface (fts_lifecycle, fts_status, dangling_repair, derived_status, repair, schema_policy_contracts, pl_fold, index_fast_forward_executor, convergence_stages, daemon_cli, metrics_endpoint, benchmark_campaigns) -- 337 passed, 1 pre-existing unrelated failure (test_embedding_backlog_and_latest_catchup_state, a CHECK-constraint mismatch on embed catchup run status="cancelled", fails identically in isolation with no threads_fts/trigram involvement). `ruff format`/`mypy --strict`/`render all` all clean via devtools verify --quick (the only other failure, lab policy demo-tour-freshness, is an unrelated nondeterministic sample-manifest hash drift with no FTS content). Ref polylogue-eizc Co-Authored-By: Claude <[email protected]>
Problem: the v62 IndexDeltaDeclaration (threads_fts removal) exercises a new executor capability -- DROP_TABLE operations that bundle trigger objects ahead of the table object, since dropping the threads_fts FTS5 virtual table does not implicitly drop the AFTER INSERT/DELETE/UPDATE ON threads triggers that feed it. That capability had only generic DROP_TABLE coverage (an already-absent table) before this change. Solution: test_v62_drop_table_removes_threads_fts_and_its_triggers builds a v61-shaped fixture with threads/threads_fts/its three triggers plus an unrelated sibling FTS surface (blocks_command_trigram, kept), applies the real v62 declaration through apply_index_fast_forward, and asserts the table and all three triggers are gone while the sibling survives and user_version reaches 62. Verification: devtools test tests/unit/storage/test_index_fast_forward_executor.py -- 9 passed. devtools verify --quick clean except the pre-existing unrelated demo-tour-freshness nondeterministic sample-manifest drift. Ref polylogue-eizc Co-Authored-By: Claude <[email protected]>
Problem: devtools lab policy demo-tour-freshness compares a live-run `polylogue demo tour` against the committed docs/examples/demo-tour/ evidence. The completion-claim experiment's sample manifest hash embeds `PRAGMA user_version` (polylogue/demo/receipts.py:_archive_cursor), so bumping INDEX_SCHEMA_VERSION 61->62 for the threads_fts removal deterministically shifts that hash -- confirmed deterministic by running the tour twice back-to-back and getting an identical fresh hash both times, so this is not a flaky/nondeterministic gate, just a fixture that needed regenerating for the new schema version (same remediation path already used by prior schema-version-bumping PRs, e.g. the resk pricing column removal this branch was rebased onto). Solution: `polylogue demo tour --out-dir polylogue-demo-tour --force`, copied the regenerated command-output/report.json/report.md/ transcript.txt/recording.tape into docs/examples/demo-tour/. Verification: devtools lab policy demo-tour-freshness now reports "fresh tour output matches committed docs/examples/demo-tour/ (masked)". Ref polylogue-eizc Co-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 14 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (38)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem: PR #3699 was interrupted by concurrent index schema changes, leaving the dead threads_fts removal on an obsolete version boundary.\n\nWhat changed: Reconcile the branch with current master at v62, retain the live blocks_command_trigram consumer, and apply threads_fts removal as clone-safe index v63. Regenerate the deterministic demo report and preserve generated scratch artifacts outside the commit.\n\nCompatibility/migration: Existing index generations fast-forward from v62 to v63 by dropping threads_fts and its triggers. No raw replay is required.
Regenerate the committed demo-tour evidence after reconciling the index schema version. The generated tour passes, and obsolete generated files are removed by the current renderer.
Keep the documentation-linked uvx proof and the canonical recording tape path while retaining the regenerated schema-v63 evidence.
Summary\nRecord the two recovered bootstrap lanes as closed in Beads after their code PRs landed.\n\nProblem\nThe durable task records remained open after PR #3699 and PR #3701 merged.\n\nSolution\nClose polylogue-eizc with the v63 threads_fts removal evidence and polylogue-lyv4 with the async targeted rebuild evidence.\n\nVerification\nThe Beads pre-push hook validated the JSONL and dependency graph with zero unhandled findings.
Summary
Drops
threads_fts(table, 3 triggers, and all rebuild/repair/freshness plumbing), a trigger-maintained FTS5 index with zero application-layer search consumers.blocks_command_trigram, flagged in the same original audit, is investigated separately below and kept in full — it has a real consumer.Problem
polylogue-eizc asked me to re-verify a 2026-07-31 producer/consumer audit's finding that
threads_ftsandblocks_command_trigramare maintained FTS surfaces with zero search consumers, and to remove them if the finding still holds (or document why not).Re-verification against present source confirmed
threads_ftsis still dead: its only MATCH reader,session_insight_thread_queries.list_threads, has zero production callers anywhere in the codebase (only the storage-layer mixin and tests reference it), and the live "analyze threads" search path (archive_tiers/archive.py:list_thread_insights) already does a manual LIKE substring scan overthread_id/session title/repo/branch, never touchingthreads_fts.blocks_command_trigramis a different story: the original audit'srg tool_detail_textcheck misseddevtools/affordance_usage.py's_cli_action_rows, which drives its substring test offblocks_command_trigramvia the exactblocks.rowid IN (SELECT rowid FROM blocks_command_trigram WHERE tool_detail_text LIKE ...)shape the table's own DDL header comment prescribes, for the documented 900x speedup. This is wired into a real command (devtools workspace affordance-usage, introduced in PR #2622). It is a genuine consumer the audit missed, not one that appeared since — so it is kept, with a comment explaining why.Solution
threads_fts, its 3 triggers, and every piece of rebuild/repair/freshness machinery that referenced it, acrossarchive_tiers/index.py,fts/sql.py,fts/fts_lifecycle.py,fts/dangling_repair.py,fts/freshness.py,daemon/fts_startup.py,daemon/fts_automerge.py,daemon/fts_status.py,daemon/status.py,daemon/convergence_stages.py,insights/session/{status,runtime,repair_assessment}.py,derived/{insights,derived_status}.py,repair.py,maintenance/preview.py,devtools/synthetic_benchmark_runtime.py.list_threads's text-query path now does a plainLIKEscan overthreads.search_textinstead of an FTS5MATCH, mirroring the shape the live analyze-threads search path already uses — no behavior loss, just no longer backed by a redundant index nobody read.INDEX_SCHEMA_VERSIONbumped 61->62 (rebased on top of a concurrent PR that had already taken v61).lifecycle.pydeclares the v62 delta asCACHE_REMOVAL(same class as v37/v41's precedent): a clone-safe fast-forward drops the orphaned table and its triggers in place. This needed a small executor extension —DROP_TABLEoperations can now bundle("trigger", name)objects ahead of the("table", name)object, since dropping the FTS5 virtual table does not implicitly drop theAFTER INSERT/DELETE/UPDATE ON threadstriggers that feed it (they'd otherwise fail on their next fire against a table that no longer exists). Covered by a new integration test that runs the realapply_index_fast_forwardplan against a v61-shaped fixture.docs/examples/demo-tour/— its completion-claim sample-manifest hash embedsPRAGMA user_version, so the schema bump deterministically shifted it (confirmed deterministic by running the tour twice back-to-back with an identical fresh hash both times, not a flaky gate).Alternatives rejected
Dropping both flagged surfaces uniformly, per the original audit, was the starting assumption — rejected once
devtools/affordance_usage.pyturned up as a realblocks_command_trigramconsumer during re-verification. Reimplementingblocks_command_trigram's search as a LIKE scan (likethreads_fts) was considered and rejected: unlikethreads_fts's zero-caller path, this one is a real, currently-used command with a documented 900x measured speedup from the trigram index, so replacing it would be a real regression, not a cleanup.Verification
devtools test tests/unit/storage/test_fts_escape_in_insights.py tests/unit/storage/test_derived_status.py tests/unit/storage/test_dangling_fts_derived_surfaces.py tests/unit/storage/test_index_fast_forward_executor.py tests/unit/storage/test_schema_policy_contracts.py tests/unit/storage/test_repair.py tests/unit/storage/test_pl_fold.py tests/unit/daemon/test_convergence_stages.py tests/unit/daemon/test_daemon_cli.py tests/unit/devtools/test_benchmark_campaigns.py— 310 passed.devtools test tests/unit/daemon/test_metrics_endpoint.pysurfaces one pre-existing, unrelated failure (test_embedding_backlog_and_latest_catchup_state, aCHECK constraint failed: status IN (...)on embed-catchup run status"cancelled") that reproduces identically in isolation with zero threads_fts/trigram involvement — not caused by this change.devtools verify --quick— fully green (ruff format/check, mypy --strict, render all, layering, all lab policy gates includingdemo-tour-freshness).test_v62_drop_table_removes_threads_fts_and_its_triggers: builds a real v61-shaped fixture (threads/threads_fts/3 triggers + a kept siblingblocks_command_trigram), runs the actualapply_index_fast_forwardplan, asserts the table+triggers are gone, the sibling survives, anduser_versionreaches 62.Ref polylogue-eizc
🤖 Generated with Claude Code