Repository navigation
fix(search): repair FTS during live ingest - #1502
Conversation
Problem: exact startup readiness from #1500 proved the archive could start ready, then live catch-up still left message and action-event FTS rows missing before the next restart. The live paths opted out of conversation-scoped repair unless triggers were suspended, and write effects ignored explicit repair requests when triggers were present. What changed: live full and append ingest now request message/action FTS repair for changed conversations, write effects honor explicit repair requests unconditionally, stale startup rebuild refreshes trigger definitions before rebuilding, and exact invariant snapshots use a single read transaction. Verification: pytest tests/unit/archive/test_write_gateway.py tests/unit/daemon/test_daemon_cli.py tests/unit/sources/test_live_batch_support.py tests/unit/storage/test_retrieval_readiness_laws.py tests/unit/storage/test_perf_rescue_1314.py tests/unit/pipeline/test_ingest_batch.py tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py tests/unit/storage/test_fts_trigger_lifecycle.py -q; devtools verify --quick; live archive targeted FTS repair reported all surfaces ready with zero missing/excess/duplicates. Closes #1501
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 32 minutes and 55 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
polylogue-gibn1, decisive: instrumented the sole consumer of summary.fts_repair_session_ids (_commit_sync_ingest_side_effects) and it never printed across five sessions and sixty messages in the failing convergence-evidence test. The repair is nested inside `if transaction_started`, so a route with an externally managed transaction skips FTS repair along with every other post-write side effect. Eliminated: repair_message_fts (defaults True everywhere, no daemon override), the repair queue itself (content_changed appends unconditionally), the invariant reader, and the triggers. Three independent places each assume another will populate the index: replay defers the reinsert, ingest-side repair never runs, and the path-scoped convergence check is a hardcoded `return False`. Read the #1498 cascade retro as CLAUDE.md requires; its closed list names the adjacent history (#1462, #1469, #1472, #1500, #1502), several of which narrowed FTS repair to avoid redundant work. Those PR bodies are the place to start. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWcPJJJvuF25CqVwTFgSQC
Summary
Make live ingest maintain FTS freshness as a hard write-side contract instead of relying on trigger timing alone.
Problem
#1500 fixed daemon startup readiness, but live catch-up on the production archive still drifted while the daemon was running. With the daemon stopped, exact invariant evidence showed:
The missing message rows were block-only messages whose searchable content lives in
content_blocks; missing action rows were normalaction_events. Live full/append ingest had been opting out of conversation-scoped repair unless triggers were explicitly suspended, and write effects ignored an explicit repair request when triggers were present.Closes #1501.
Solution
commit_archive_write_effectsnow treatsrepair_message_fts=Trueandrepair_action_fts=Trueliterally: changed conversations are repaired even when triggers exist.Verification
pytest tests/unit/archive/test_write_gateway.py tests/unit/daemon/test_daemon_cli.py tests/unit/sources/test_live_batch_support.py tests/unit/storage/test_retrieval_readiness_laws.py tests/unit/storage/test_perf_rescue_1314.py tests/unit/pipeline/test_ingest_batch.py tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py tests/unit/storage/test_fts_trigger_lifecycle.py -q87 passed in 1.93sdevtools verify --quickexit_code: 0,total_duration_s: 35.97devtools verify --quickexit_code: 0,total_duration_s: 34.78missing_message_conversations=11 missing_action_conversations=10 union=11ready=Truemessages_fts 986362 986362 0 0 0 Trueaction_events_fts 354184 354184 0 0 0 Truesession_work_events_fts 10192 10192 0 0 0 Truework_threads_fts 1922 1922 0 0 0 True