Repository navigation
fix(pipeline): commit sync ingest side effects - #707
Conversation
Problem: the sync ingest path suspended FTS triggers during batch writes, then restored triggers and repaired changed-conversation FTS rows after the main commit without committing that teardown work. It also bypassed search cache invalidation, so same-process cached searches could stay stale after direct ingest writes. What changed: move sync-ingest teardown into a committed side-effect phase that restores FTS triggers, repairs changed message/action FTS rows, commits that work, and invalidates the search cache when conversations changed. Verification: ruff check polylogue/pipeline/services/ingest_batch.py tests/unit/pipeline/test_ingest_batch.py; ruff format --check polylogue/pipeline/services/ingest_batch.py tests/unit/pipeline/test_ingest_batch.py; pytest -q tests/unit/pipeline/test_ingest_batch.py Ref #618
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. 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. Review rate limit: 0/1 reviews remaining, refill in 38 minutes and 38 seconds.Comment |
Polylogue Proof PackRefs: Affected Domains
Focused Gates
Required PR Gates
Optional Confidence Gates
Known Gaps
Oracle / Cost
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1157dbd96
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR fixes correctness gaps in the synchronous ingest write path by ensuring FTS teardown/repair work is committed as an explicit unit and that in-process search result caching is invalidated when conversations change.
Changes:
- Add a committed “sync-ingest side effects” phase that restores FTS triggers, repairs FTS rows for changed conversations, and commits before closing the SQLite connection.
- Invalidate the in-process search cache when sync ingest writes changed conversations.
- Add a regression test that proves FTS repairs/triggers persist across a fresh connection and that cached searches observe newly ingested content after invalidation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| polylogue/pipeline/services/ingest_batch.py | Introduces a committed post-ingest side-effect phase (FTS trigger restore + FTS repair + cache invalidation). |
| tests/unit/pipeline/test_ingest_batch.py | Adds a regression test covering committed FTS teardown/repair persistence and search cache invalidation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary: Commit the sync-ingest FTS teardown phase and invalidate cached search results after changed conversations are written through the direct sqlite batch path. Problem: #618 identified that _process_ingest_batch_sync() committed the main ingest transaction, then restored FTS triggers and repaired message/action FTS rows outside any explicit committed unit. If sqlite opened an implicit transaction for that teardown work, closing the connection could lose the trigger restoration or repaired FTS rows. The same direct write path also bypassed search cache invalidation, so same-process cached searches could stay stale after ingest. Solution: Add a committed sync-ingest side-effect phase that restores FTS triggers after suspended-trigger batch writes, repairs changed-conversation message and action-event FTS rows, commits the teardown DDL/DML before closing the connection, and invalidates the search cache when conversations changed. The regression exercises _process_ingest_batch_sync() with a fake worker result, verifies message/action FTS rows and triggers from a fresh connection, and proves the same cached search query sees the new conversation after ingest. Verification: ruff check polylogue/pipeline/services/ingest_batch.py tests/unit/pipeline/test_ingest_batch.py; ruff format --check polylogue/pipeline/services/ingest_batch.py tests/unit/pipeline/test_ingest_batch.py; pytest -q tests/unit/pipeline/test_ingest_batch.py; git push pre-push hook ran devtools verify --quick and passed. Ref #618
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Commit the sync-ingest FTS teardown phase and invalidate cached search results after changed conversations are written through the direct sqlite batch path.
Problem
#618 identified that
_process_ingest_batch_sync()committed the main ingest transaction, then restored FTS triggers and repaired message/action FTS rows outside any explicit committed unit. If sqlite opened an implicit transaction for that teardown work, closing the connection could lose the trigger restoration or repaired FTS rows. The same direct write path also bypassed search cache invalidation, so a cached empty search could stay stale in the same process after ingest.Solution
Add a committed sync-ingest side-effect phase that:
The regression exercises
_process_ingest_batch_sync()with a fake worker result, verifies message/action FTS rows and triggers from a fresh connection, and proves the same cached search query sees the new conversation after ingest.Verification
ruff check polylogue/pipeline/services/ingest_batch.py tests/unit/pipeline/test_ingest_batch.pyruff format --check polylogue/pipeline/services/ingest_batch.py tests/unit/pipeline/test_ingest_batch.pypytest -q tests/unit/pipeline/test_ingest_batch.pygit pushpre-push hook:devtools verify --quickpassedRef #618