fix(desktop): repair action item FTS without catalog writes#9271
fix(desktop): repair action item FTS without catalog writes#9271ZachL111 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for cleaning up the macOS 26 recovery path and removing the direct writable_schema / sqlite_master writes. The implementation direction looks much safer than the old catalog-delete fallback, and the skip-ratchet cleanup is appreciated.
I do need one fix before this is ready: the final regression test no longer exercises the broken-shadow-table repair path that this PR is intended to cover. testRepairRebuildsActionItemsFTSFromDurableRows now removes a row from the FTS index via INSERT INTO action_items_fts(action_items_fts, ...) VALUES ('delete', ...), then calls repairActionItemsFTS; that validates a normal rebuild/backfill, but it does not make DROP TABLE action_items_fts fail and therefore does not cover restoreMissingActionItemsFTSShadowTables(...).
Could you add/restore a targeted test that actually simulates a missing FTS5 shadow table using public SQLite DDL only, and proves the fallback can restore the missing shadow table, retry the drop, recreate the FTS table, and preserve/backfill durable action_items rows? That coverage is important because this PR removes the old catalog-write escape hatch.
I did not formally approve because this touches SQLite recovery/catalog-adjacent behavior and the monitor policy requires human maintainer review for this risk surface, even though the current direction looks good.
kodjima33
left a comment
There was a problem hiding this comment.
Desktop bug fix: FTS repair via public-DDL path (no writable_schema catalog writes) for macOS 26. Approve; not merging over open change-request.
# Conflicts: # desktop/macos/e2e/flows/tasks.yaml
…epair paths Extract actionItemsFTSCreateSQL(tableName:) so the normal install and the shadow-table repair template use byte-identical FTS5 config (columns, content mapping, tokenizer), removing the risk of a future schema change drifting the two and building a mismatched shadow table during recovery.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the update here. The implementation direction still looks right to me: replacing the previous writable_schema / direct sqlite_master catalog writes with a public-DDL repair flow is a much safer approach for the macOS 26 SQLite behavior.
I still need to request changes because the regression test on the current head does not cover the specific failure path this PR is meant to protect. testRepairRebuildsActionItemsFTSFromDurableRows uses the FTS5 special delete command to remove an indexed row, then verifies repairActionItemsFTS can rebuild/backfill. That is useful coverage for rebuild behavior, but it does not simulate a missing FTS5 shadow table, does not make DROP TABLE action_items_fts fail, and therefore does not exercise restoreMissingActionItemsFTSShadowTables(...).
Could you add/restore a targeted test that corrupts the FTS setup using public SQLite DDL only, proves a missing shadow table is restored, verifies the retrying drop/recreate path succeeds, and confirms durable action_items rows are preserved/backfilled? Since this is SQLite recovery/catalog-adjacent behavior, I’m also leaving this for human maintainer review before merge.
1f6beb0 to
a9bd7fb
Compare
|
Thanks for the detailed guidance. I tried to add exactly that test (drop a single FTS5 shadow table with DDL, then prove repair restores it, retries the drop, and backfills), but the macOS/CI SQLite rejects the setup: So I could not simulate a genuinely-missing shadow table through public DDL alone in the test harness. Two options, whichever you prefer:
I reverted the non-working test so the branch is back at your reviewed head (a9bd7fb). Let me know which direction you prefer and I will push it. |
Why
Issue #9032 tracks that the action item FTS repair path still falls back to
writable_schemaand directsqlite_masterdeletes when a shadow table is missing. macOS 26 rejects that catalog write, so the recovery test had to stay skipped.What changed
DROP TABLE action_items_ftsaction_itemsDROP TABLE action_items_fts_datainstead of editingsqlite_master.Verification
python3 scripts/swift-test-skip-ratchet.py --checkgit diff --check origin/main...HEADPRAGMA writable_schemaorDELETE FROM sqlite_masterremains in the changed FTS repair code/test.I could not run
xcrun swift test --package-path Desktop --filter ActionItemsFTSRepairTests/from this WSL environment becausexcrunandswiftare not installed here.Fixes #9032