Repository navigation
fix: preserve notes when link rewrites fail - #140
Merged
Merged
Conversation
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.
When
moverewrites 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.modnow 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 throughUpdateLinks.golangci-lintv2.10.1 reports no issues.go mod verifypasses.Fixes #137.