Repository navigation
fix(core): normalize file paths to NFC at the ingest boundary on macOS - #1766
Merged
Merged
Conversation
macOS filesystems resolve the NFC and NFD spellings of a name to one file but report whichever form is on disk, and Syncthing keeps NFD names on macOS. Paths are identity keys, so a name flipped to NFD rewrote an entity's key or minted a -1 twin, after which edit_note failed on the permalink constraint (#1275). Normalize where relative paths enter the index: scanner, watcher, /index-file, title and directory to path (before sanitizing, which drops combining marks), move destination, document import, and generate_permalink. Linux and Windows keep byte-exact paths, since their filesystems store NFC and NFD names as distinct files. Migration 0042 (macOS only) merges existing twins into the oldest row, keeps an accepted write that has not reached disk, redirects references, drops edges that would duplicate one into the kept row, keeps the vacate marker whose checksum matches the file on disk, and stores every path in NFC. Two unwritten writes for one file stop the upgrade instead of dropping one. Fixes #1275 Signed-off-by: Sergey Sinyugin <13364190+sergi039@users.noreply.github.com>
The 0042 migration moved a twin's unwritten note_content row to the kept entity by entity_id only, leaving external_id naming the deleted twin. Reads look note content up by external_id, so the accepted write looked missing until a later edit realigned it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjnYzcPoFtqTK5yNphjLS4 Signed-off-by: phernandez <paul@basicmachines.co>
The NFC tests and the 0042 migration tests skipped off macOS, and CI runs the full suite only on Linux and Windows, so none of that code ran in CI. Pin sys.platform to darwin instead: both filesystems can hold an NFD name, and nfc_path and the migration decide by sys.platform alone. Also fix the test docstring that said Windows resolves both spellings to one file, and sort the utils imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjnYzcPoFtqTK5yNphjLS4 Signed-off-by: phernandez <paul@basicmachines.co>
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e99e1ada8
ℹ️ 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".
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.
Supersedes #1765 by @sergi039. Fixes #1275.
The first commit is @sergi039's change, cherry-picked unchanged with authorship and sign-off intact. It moves to an in-repo branch so the full CI matrix runs (fork PRs skip it). Please rebase-merge so their commit lands on main as their own.
See #1765 for the full design: NFC normalization at the ingest boundary (scanner, watcher,
/index-file, title → path, move destination,generate_permalink), byte-exact paths on Linux and Windows, and migration0042, which merges existing NFC/NFD twin entities on macOS.Maintainer follow-ups
note_contentrow to the kept entity, it now updatesexternal_idalong withentity_id. Reads look note content up byexternal_id(note_content_reads.py), so the accepted write would otherwise look missing until the next edit. The regression test fails without the fix.sys.platformtodarwin. Both filesystems can hold an NFD name, andnfc_pathand the migration decide bysys.platformalone.utilsimports are sorted.Verification
just fast-teston the new suites plustests/test_migration_graph.py: 36 passed (macOS)just typecheck: clean🤖 Generated with Claude Code
https://claude.ai/code/session_01QjnYzcPoFtqTK5yNphjLS4