Repository navigation
fix(daemon): skip redundant write FTS repairs - #1472
Conversation
Live deployment after the append-stats fix still showed multi-GB physical reads during tiny append batches. The write gateway was still repairing message and action FTS for every changed conversation after every write, even when live sync triggers were already present and therefore had maintained the rows.\n\nRecord whether message/action FTS triggers were live before the commit side effects run. If they were present, trust the triggers and skip the delete/reinsert repair. If any trigger was missing or suspended, keep the existing targeted repair path after ensuring triggers are restored, preserving the FTS freshness contract.\n\nFocused verification:\n- pytest -q tests/unit/archive/test_write_gateway.py tests/unit/pipeline/test_ingest_append_replay.py -> 9 passed\n- mypy polylogue/archive/write_effects.py tests/unit/archive/test_write_gateway.py -> success\n- devtools verify --quick -> exit_code 0\n\nRef #1447
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 44 minutes and 31 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 (2)
✨ 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
Skip post-write message/action FTS repair when live FTS triggers were already present for the write.
Problem
After #1470 and #1471 were deployed, live validation still showed
polyloguedreading about2.34 GBover 10 seconds with IO full avg10 around20%, while logs showed hot insight rebuilds were deferred and append writes were small.The remaining broad path was
commit_archive_write_effects: it always calledrepair_message_fts_index_syncandrepair_action_fts_index_syncfor changed conversations. On normal live writes the FTS triggers already maintain those rows, so the repair did a redundant delete/reinsert of the whole conversation FTS surface after every append.Solution
ensure_fts_triggers_syncto restore missing triggers.This keeps the hard FTS freshness contract: live-triggered writes stay fresh immediately, and missing/suspended triggers still force repair.
Ref #1447
Verification
pytest -q tests/unit/archive/test_write_gateway.py tests/unit/pipeline/test_ingest_append_replay.py->9 passed in 0.20smypy polylogue/archive/write_effects.py tests/unit/archive/test_write_gateway.py->Success: no issues found in 2 source filesdevtools verify --quick->exit_code 0,total_duration_s 39.71devtools verify --quick->exit_code 0,total_duration_s 34.62