Problem
Explorer.commitParsedFileOwnedOutline updates word_index, trigram_index, and outlines in sequence with no atomic rollback. word_index.indexFile calls removeFile first (destructive) before building new entries. If trigram_index.indexFile subsequently fails with OOM, the indexes are left in a split state:
word_index: has the new content (removeFile + indexFile completed)
trigram_index: has the old content removed, new content never inserted
outlines: restored by errdefer to the previous outline
Results: content searches via word_index return results for the new file version, but trigram searches miss the file entirely.
// src/explore.zig — commitParsedFileOwnedOutline
try self.word_index.indexFile(stable_path, content); // ← removes old first, succeeds
try self.trigram_index.indexFile(stable_path, content); // ← fails OOM: word and trigram now diverged
Fix
Either:
- Re-index word_index on trigram failure (errdefer that re-runs word_index.indexFile with old content)
- Or stage all mutations before committing: compute new trigrams and words without modifying indexes, then apply atomically under lock
Problem
Explorer.commitParsedFileOwnedOutlineupdatesword_index,trigram_index, andoutlinesin sequence with no atomic rollback.word_index.indexFilecallsremoveFilefirst (destructive) before building new entries. Iftrigram_index.indexFilesubsequently fails with OOM, the indexes are left in a split state:word_index: has the new content (removeFile + indexFile completed)trigram_index: has the old content removed, new content never insertedoutlines: restored by errdefer to the previous outlineResults: content searches via
word_indexreturn results for the new file version, but trigram searches miss the file entirely.Fix
Either: