Repository navigation
Keep notes readable after moving a folder with a backslash in its name - #259
Merged
Merged
Conversation
Before: moving or renaming a folder that has a folder note and a backslash in its path (Finder allows one) wrote .modex/settlement.json, then the reader refused it as "Invalid folder rename intent". The journal stayed, so every later read of the notes threw, even after a restart. After: the journal is checked with the same rules before it is written. A move of such a folder is refused with a message to move it in Finder, and a rename keeps the folder's name while its note carries the new title. A journal that fails the checks (left by an earlier version, or unreadable) is set aside as .modex/settlement.invalid-<id>.json with the folders left as they are, instead of failing every read. Coven-Harness: Claude Code / claude-opus-5-5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…date # Conflicts: # apps/desktop/src/main/engine/notes-store.ts # docs/status.md
This branch was successfully deployed
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.
Part of #241 (finding 1: "A settlement journal can wedge every read").
What was wrong
Moving or renaming a folder that has a folder note goes through a journal,
.modex/settlement.json.moveNodes()andsettle()wrote that journal first. OnlyfinishSettlement()checked it. Those checks refuse any path part that contains\, which Finder allows on macOS. Take a folderPersonal/Notes/R\Dwith its noteR\D.md:Probe on
main(f17608d):Renaming the folder takes the same path. So does editing its page's title and then opening another page, because that settles the old page. The renderer ignores settle errors, so in that case the notes became unreadable with no visible cause.
What changed
The fix is in
apps/desktop/src/main/engine/notes-store.ts.validSettlement(). The writer and the reader both call it.startSettlement()runs the checks first. If they fail, it writes nothing.finishSettlement()used to throw on every read in that case. Now it renames the file to.modex/settlement.invalid-<uuid>.json, logs that it did, and carries on with the folders as they are. This is safe: a reader refuses a journal before renaming anything, so no rename is half done. Read errors that carry an errno code other thanENOENTstill throw.Same probe after the fix:
Regression tests
notes-tree.test.ts, "a move/rename of a folder with a backslash in its name leaves notes readable" (one test each):R\D/R\D.mdand a child note the way Finder would, then moves or renames the folder throughNotesStore.notes-store.test.ts, "a folder rename journal with … is set aside instead of failing every read":All four tests failed on unmodified
mainand pass with the fix.What I ran
5efafc4(Make Analytics look like the rest of Modex and fit the window #248).pnpm build: passed.pnpm test:demo.test.js"demo waits for a slow turn to reach approval before auto-answering", which reached its 5 s timeout while the machine was under heavy load. Run alone, it passed (3/3, 2.3 s). It does not touch notes.notes-tree,notes-store,notes-files,notes-projects,notes-migration): 76/76 pass.pnpm --filter @modex/desktop typecheck: clean.There is one new line in
docs/status.md, under "On main, unreleased".Coven-Harness: Claude Code / claude-opus-5-5