Skip to content

fix: preserve notes when link rewrites fail - #140

Merged
Yakitrak merged 3 commits into
mainfrom
codex/preserve-notes-on-rewrite-failure
Oct 13, 2026
Merged

Yakitrak merged 3 commits into
mainfrom
codex/preserve-notes-on-rewrite-failure

Conversation

@Yakitrak

@Yakitrak Yakitrak commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

When move rewrites a linking note, a failed write or interrupted process can truncate its existing content. Stage each replacement in a temporary file beside the target, preserve its permissions, sync and close it, then rename it over the original. Preserve symlinks and reject read-only notes.

Errors now identify the affected file and explain when the note has already moved but link updates are incomplete. Document that moving a note and updating all links is not a single transaction. This protects against failed staging writes and termination before replacement; it does not promise whole-vault rollback or power-loss durability, and replacement semantics remain platform-dependent.

Validation:

  • go.mod now requires Go 1.26.1, which fixes GO-2026-4602 reported by the shared Security check on Go 1.26.0.
  • go test -race ./... passes, including partial-write failures, abrupt subprocess termination, and the zero file-size limit reproduction through UpdateLinks.
  • Permission preservation and symlink behavior are covered.
  • CI-pinned golangci-lint v2.10.1 reports no issues.
  • go mod verify passes.

Fixes #137.

@Yakitrak
Yakitrak merged commit 78561a8 into main Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move leaves notes that link to the moved note empty if their rewrite fails or the process is killed

1 participant