Skip to content

fix(daemon): keep FTS triggers active during ingest - #1437

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/live-fts-trigger-safety
May 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/live-fts-trigger-safety

Conversation

@Sinity

@Sinity Sinity commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

Remove the steady-state dropped-trigger window from daemon ingest writes. Normal archive write effects now ensure missing FTS triggers without dropping existing triggers, and default ingest keeps FTS triggers active instead of suspending them globally.

Problem

After #1435 restored the production FTS index and #1436 bounded status health counts, restarting through Sinnix exposed the deeper recurrence source: the daemon was still using global FTS trigger suspension during live ingest, and write effects called restore_fts_triggers_sync, which drops and recreates triggers. A restart or kill inside that window leaves all six FTS triggers missing, forcing an expensive startup rebuild and making search freshness fragile.

Solution

  • Add ensure_fts_triggers_sync, which creates missing canonical FTS triggers without dropping live triggers.
  • Use that non-destructive trigger ensure path in normal archive write effects.
  • Make _process_ingest_batch_sync keep FTS triggers active by default; the old suspend/restore behavior is now explicit opt-in only.
  • Keep destructive restore_fts_triggers_sync for explicit startup repair and full rebuild paths.

Verification

  • pytest tests/unit/archive/test_write_gateway.py::test_write_gateway_normal_commit_does_not_drop_fts_triggers tests/unit/pipeline/test_ingest_batch.py::test_process_ingest_batch_sync_commits_fts_repair_and_invalidates_search_cache -q → 2 passed
  • python -m ruff format --check polylogue/storage/fts/fts_lifecycle.py polylogue/archive/write_effects.py polylogue/pipeline/services/ingest_batch/_core.py tests/unit/archive/test_write_gateway.py tests/unit/pipeline/test_ingest_batch.py → 5 files already formatted
  • python -m ruff check polylogue/storage/fts/fts_lifecycle.py polylogue/archive/write_effects.py polylogue/pipeline/services/ingest_batch/_core.py tests/unit/archive/test_write_gateway.py tests/unit/pipeline/test_ingest_batch.py → All checks passed
  • python -m mypy polylogue/storage/fts/fts_lifecycle.py polylogue/archive/write_effects.py polylogue/pipeline/services/ingest_batch/_core.py tests/unit/archive/test_write_gateway.py tests/unit/pipeline/test_ingest_batch.py → Success
  • pre-push devtools verify --quick → exit_code 0, total_duration_s 37.18

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 9 minutes and 9 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 337da63b-3ca1-485c-90ae-40cba4ac49e6

📥 Commits

Reviewing files that changed from the base of the PR and between b1c386e and 039abd3.

📒 Files selected for processing (5)
  • polylogue/archive/write_effects.py
  • polylogue/pipeline/services/ingest_batch/_core.py
  • polylogue/storage/fts/fts_lifecycle.py
  • tests/unit/archive/test_write_gateway.py
  • tests/unit/pipeline/test_ingest_batch.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/live-fts-trigger-safety

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit 5692050 into master May 23, 2026
6 checks passed
@Sinity
Sinity deleted the feature/fix/live-fts-trigger-safety branch May 23, 2026 12:35
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