fix(db): keep FTS repair out of search reads#435
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0654bf74a
ℹ️ 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".
| async fn primary_nodes_intact(&self) -> Result<bool> { | ||
| let mut rows = self | ||
| .conn() | ||
| .query("PRAGMA quick_check('nodes')", ()) |
There was a problem hiding this comment.
Check more than nodes before treating corruption as FTS-only
When an FTS MATCH fails with a corruption error, this table-scoped quick_check only validates nodes. If the same crash also damaged another table/page such as edges or unresolved_refs, primary_nodes_intact can still return true, causing search_nodes to fall through to the LIKE path and return successful partial results instead of the recovery-required error promised for whole-database corruption. Classify corruption as FTS-only only after validating the rest of the store, or at least all non-FTS tables read by later graph workflows.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5e028b4. The corruption fallback now enumerates every non-FTS table from sqlite_schema, safely quotes each identifier, and runs table-scoped PRAGMA quick_check so its associated indexes are validated too. Any missing required schema, non-FTS damage, or check error propagates the original corruption error. The regression now corrupts both the FTS segment and the unrelated edges table while nodes remains intact, and proves search returns the recovery-required error without writes. All 19 corruption tests and cargo fmt pass.
a0654bf to
5e028b4
Compare
Summary
Tests
Live dogfood: prevents the generic corruption misclassification observed during the v0.0.52 recovery incident.