Repository navigation
fix(markdown): preserve index when vault inventory is unsafe - #496
Merged
EyJunge1 merged 1 commit intoNov 6, 2026
Merged
Conversation
13 tasks done
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #495.
Removing the Markdown vault while the service is running currently produces an empty inventory and can permanently delete every indexed memory. This change skips inferred deletion when the vault has no Markdown files or when scanning, reading, parsing, or processing a file fails, and logs the reason. Readable files can still be indexed during an incomplete scan.
Watcher-triggered deletions use the same safeguards and only remove the requested path. Full reconciliation reads each file once so its indexed content and deletion identity come from the same snapshot. The README and its five translations document the behavior.
Tradeoff: deliberately deleting the final Markdown file preserves its indexed memory. Delete that memory explicitly through the tool or Web UI when removal is intentional. A healthy, nonempty vault still permits permanent deletion of missing memories; these safeguards cannot detect an incomplete sync that looks like a complete, nonempty vault and do not replace backups. The existing delete-before-insert behavior for replacement writes is unchanged.
Test plan
Checklist
main.bun test --timeout 30000: 1,182 passed, 4 platform-specific skips, 0 failed across 157 files (Bun 1.3.14, Linux).bun run typecheckpasses (viabun run check).bun run checkpasses (formatting, lint and TypeScript).bun run buildpasses.