Repository navigation
fix(core): exclude Emacs autosaves from local indexing - #1547
Merged
Merged
Conversation
Signed-off-by: phernandez <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Why
Emacs writes
#note.md#autosaves beside the real note. Local indexing currently admits these scratch copies as resources. Closes #1537.What Changed
Exclude Emacs
#…#basenames in the existing local scratch-file filter shared by watcher event normalization and full-project scans. This applies with existing/custom.bmignorefiles and leaves other resource suffixes and legitimate hash-containing note names alone.Implementation Details
The baseline regression reproduced resource ingestion with both identical note bytes and different draft bytes: the watcher created a second entity at
notes/#note.md#. It did not reproduce the reported takeover ofnotes/note.mdon current main. The actual watcher path is event normalization → regular-file indexing →BatchIndexer._upsert_regular_file; its initial lookup and uniqueness-conflict recovery both resolve the exact project-relative file path. Markdown accepted-content reconciliation belongs to the separate note path. No evidence justified changing that persistence protocol or adding locks.Filtering before watcher move detection and project-scan change planning prevents autosaves from entering either resource persistence or checksum move reconciliation. The regression exercises autosave create/modify/delete and a forced full scan, checking real-note identity, permalink, observations/relations, accepted Markdown/version, and disk bytes. No ignore parser changes or historical corruption repair are included.
Testing
Indexed regular file: notes/#note.md#and two entities.uv run pytest tests/index/test_emacs_autosave.py tests/index/test_filesystem_events.py tests/index/test_local_watch_ignore_parity.py tests/index/test_local_project_scan_parity.py tests/index/test_local_watch_regular_file_parity.py -q --no-cov— 28 passed.just fast-check— passed (ruff check/format and fulltytypecheck).just doctor— passed the isolated API/file/index/search/status loop.Risks / Follow-ups
Files whose basenames are wrapped in
#are treated as local editor scratch, consistently with the existing built-in temporary-file exclusions. This prevents future autosave ingestion; it does not claim to diagnose or repair the historical row takeover reported in #1537. Related reconciliation/ignore-parser work remains separate.