Repository navigation
fix(storage): move entity file back when write after rename fails - #984
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.
updateNote/updateSnippetmutated runtime fields, moved or renamed the file and updated the state index before writing frontmatter. If the write failed after the move (EACCES/ENOSPC), runtime and the deferred state index pointed to the new path while disk kept old frontmatter there.persistNote/persistSnippet: on write failure, move the file back and restorefilePathand the state index (a failedcreateNoteno longer leaves an index entry without a file). If moving back fails, runtime stays on the actual path.updateNote/updateSnippetand folder deletion: restore entity fields viapersistOrRestore.applyEntityUpdateFields: validate the target folder before any mutation and return a snapshot of previous values instead ofpreviousIsDeleted.vi.spyOn(fs, 'writeFileSync')for notes, snippets andapplyEntityUpdateFields.