Repository navigation
Restore trashed notes to where their folder moved - #258
Merged
Merged
Conversation
Before: renaming or moving a workspace, project or folder rewrote the index paths of live notes only. A note trashed earlier, or deleted outside Modex, kept its old original path, so restoring it made the old folder again (for example Personal/Notes as a project with no marker, outside the linked Modex project). Now the trashed and deleted originals under the moved folder are rewritten too: in place() for renames and tree moves, in rebase() for folder moves, and after a folder is renamed through its folder note. Coven-Harness: Claude Code / claude-opus-5-5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coven-Harness: Claude Code / claude-opus-5-5
# Conflicts: # 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 3: trashed notes keep stale original paths after moves).
What was wrong
Renaming or moving a workspace, project or folder rewrote the index paths of live notes only. A note trashed earlier (its
trash.original), or deleted outside Modex (itsoriginal), still pointed at the old place. Restoring it made the old folder again. The reviewer's probe: trash a note inPersonal/Notes, rename the project, restore. The note came back in a newPersonal/Notes, a project with no marker, outside the linked Modex project. A note in a folder did the same: it came back in a copy of the folder at its old path.What changed
notes-store.tshas a newrebaseOriginals(index, from, to). It rewrites the trashed and deleted originals under a moved folder. It is called from:place(), for renames and tree moves of workspaces, projects and folders;rebase(), for folder moves, including a folder note moved to a new parent page throughsave();settle(), after a folder with a folder note is renamed. That rename goes through the settlement journal and calls neitherplace()norrebase().Trashed children of a live folder note were already placed by their parent page. They are unchanged.
Regression tests
notes-tree.test.ts:notes trashed before a {project rename, workspace rename, project move, folder rename, folder move} are restored where it went, without making the old place again. Each case trashes one note in the project and one in a folder, makes the change, and restores both. It then checks that both notes are in the new place, now and after a reopen, that no workspace, project or folder appears, and that the old folder path is not made again.notes-store.test.ts:a file deleted outside Modex before its project is renamed is restored in the renamed project.notes-store.test.ts:a note trashed from a plain folder inside a folder note is restored after the folder note's {move, rename}. This covers therebase()path throughsave()and thesettle()path.All 8 failed on unmodified
main, each restoring to the old path (for examplePersonal/Notes/Loose.mdinstead ofPersonal/Journal/Loose.md). With the fix they pass.Verification
main: 8 of 8 failed. With the fix, every notes test file (notes-tree,notes-store,notes-projects,notes-files,notes-migration) passed: 80/80.pnpm build && pnpm testfrom the worktree root, on top of5efafc4(Make Analytics look like the rest of Modex and fit the window #248): build passed. Unit tests: 1,445 total, 1,428 passed, 0 failed, 16 skipped, 1 timed out. The timeout was the unrelateddemo waits for a slow turn to reach approval before auto-answering, which has a 5 s limit. The Mac's load average was in the hundreds, with other agents building. Rerun alone,demo.test.jspassed 3/3.f17608d, timed out a different unrelated test instead:runner-durable-admission's "a script completed before Store failure…", which has a 10 s limit. Rerun alone, that file passed: 16 passed, 1 skipped, 0 failed..mjstests thatpnpm testruns last were skipped because of the timeout, so they were run on their own: 21/21 passed.Coven-Harness: Claude Code / claude-opus-5-5