fix(index): rebuild state.db atomically so a bad file can't wipe it#258
fix(index): rebuild state.db atomically so a bad file can't wipe it#258abyssumining wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughFixes a critical bug where ChangesAtomic Index Rebuild and Blown-Index Detection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
@abyssumining Thanks for the contribution. Would you fix the conflict on health.py? |
734d141 to
805555f
Compare
|
thanks @plind-junior, rebased onto |
rebuild_index reset state.db before reading any artifact, so one unreadable file (bad YAML, a truncated write, a half-validated bundle import) aborted the whole rebuild and left the search index empty for the healthy claims too, with no way back until the next clean rebuild. Build into a temp DB next to state.db and rename it into place only after everything is written, so a failure leaves the existing index untouched. Unreadable artifacts are skipped with a warning instead of taking the index down. doctor() also grows an index_blown check so a KB damaged before this fix is easy to spot. Closes vouchdev#159
805555f to
1fa4735
Compare
rebuild_index reset state.db before reading any artifact, so one unreadable
file (bad YAML, a truncated write, a half-validated bundle import) aborted the
whole rebuild and left the search index empty for the healthy claims too, with
no way back until the next clean rebuild.
Build into a temp DB next to state.db and rename it into place only after
everything is written, so a failure leaves the existing index untouched.
Unreadable artifacts are skipped with a warning instead of taking the index
down. doctor() also grows an index_blown check so a KB damaged before this fix
is easy to spot.
Closes #159
Summary by CodeRabbit
Release Notes
Bug Fixes
vouch doctornow includes anindex_blowncheck for damaged knowledge basesNew Features