Repository navigation
fix(daemon): repair FTS overcount drift - #1432
Conversation
Detect FTS docsize overcounts as corruption, not readiness. Startup and periodic convergence now rebuild when indexed counts differ from source counts in either direction, and daemon status reports real FTS coverage fields instead of making the CLI infer a missing percentage.\n\nAlso keeps the focused mypy slice clean for the journald optional binding import.\n\nVerification:\npytest tests/unit/daemon/test_daemon_cli.py::test_ensure_fts_startup_readiness_uses_bounded_probes tests/unit/daemon/test_daemon_cli.py::test_ensure_fts_startup_readiness_rebuilds_empty_fts tests/unit/daemon/test_daemon_cli.py::test_ensure_fts_startup_readiness_rebuilds_when_triggers_missing tests/unit/daemon/test_fts_global_repair.py tests/unit/daemon/test_convergence_stages.py tests/unit/cli/test_status.py::TestNoArchiveStatus::test_daemon_status_uses_reported_fts_coverage_pct -q --tb=short\nmypy polylogue/daemon/convergence_stages.py polylogue/daemon/cli.py polylogue/daemon/status.py polylogue/daemon/notification_backends/journald.py polylogue/cli/commands/status.py tests/unit/daemon/test_daemon_cli.py tests/unit/daemon/test_fts_global_repair.py tests/unit/cli/test_status.py\nruff format --check polylogue/daemon/convergence_stages.py polylogue/daemon/cli.py polylogue/daemon/status.py polylogue/daemon/notification_backends/journald.py polylogue/cli/commands/status.py tests/unit/daemon/test_daemon_cli.py tests/unit/daemon/test_fts_global_repair.py tests/unit/cli/test_status.py\nruff check polylogue/daemon/convergence_stages.py polylogue/daemon/cli.py polylogue/daemon/status.py polylogue/daemon/notification_backends/journald.py polylogue/cli/commands/status.py tests/unit/daemon/test_daemon_cli.py tests/unit/daemon/test_fts_global_repair.py tests/unit/cli/test_status.py
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 29 minutes and 10 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 (12)
✨ 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 |
Summary
Fixes daemon FTS readiness and repair when the FTS docsize shadow tables contain orphan rows, not only missing rows. The live archive showed triggers restored after startup repair but
messages_fts_docsizeandaction_events_fts_docsizestill exceeded their source tables, so the existing undercount-only predicates treated corrupted FTS state as healthy.Problem
After deploying #1431, the real archive had all six FTS triggers restored but still reported:
messages: 3,668,083 vsmessages_fts_docsize: 3,794,513action_events: 1,734,882 vsaction_events_fts_docsize: 1,813,973The daemon's global FTS repair only rebuilt when indexed count was lower than source count. Interrupted rebuild/delete paths can leave overcounts, which are just as invalid and keep status/search readiness misleading.
Solution
text IS NOT NULL) rather than all messages.polylogue.daemon.fts_statusand expose explicit count/coverage fields.Verification
pytest tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli.py::test_ensure_fts_startup_readiness_uses_bounded_probes tests/unit/daemon/test_daemon_cli.py::test_ensure_fts_startup_readiness_rebuilds_empty_fts tests/unit/daemon/test_daemon_cli.py::test_ensure_fts_startup_readiness_rebuilds_when_triggers_missing tests/unit/daemon/test_fts_global_repair.py tests/unit/daemon/test_convergence_stages.py tests/unit/cli/test_status.py::TestNoArchiveStatus::test_daemon_status_uses_reported_fts_coverage_pct -q --tb=short→ 27 passedmypy --no-incremental polylogue/daemon/convergence_stages.py polylogue/daemon/cli.py polylogue/daemon/status.py polylogue/daemon/fts_status.py polylogue/daemon/notification_backends/journald.py polylogue/cli/commands/status.py tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli.py tests/unit/daemon/test_fts_global_repair.py tests/unit/cli/test_status.py→ successruff format --check ...→ passedruff check ...→ passeddevtools verify-file-budgets→ cleandevtools render-all --check→ passeddevtools verify-topology→ passeddevtools verify --quick→ passed, 36.52s