Repository navigation
Keep the source when it changes during a cross-Library move - #140
Merged
Orkas-AI merged 1 commit intoOct 31, 2026
Merged
Conversation
A move between Libraries copies the entry and then deletes the source. An edit saved after the copy was written but before the delete was lost: the move succeeded and only the old contents remained at the destination. Fingerprint the source (path, size and mtime of every entry) before the copy and compare it again just before the delete. If it changed, skip the delete and roll the destination copy back, reporting source_delete_failed like any other source that could not be removed. Fixes #131
Owner
|
Thanks for the contribution! We'll review how this handles concurrent edits and rollback before deciding whether to merge it. |
Orkas-AI
pushed a commit
that referenced
this pull request
Oct 31, 2026
Build on the source-change protection in PR #140. Capture bounded revisions without following symlinks, fail closed when metadata cannot be read, and verify the source immediately before native removal after awaited validation. Include inode and nanosecond change timestamps to detect replaced files whose size and modification time remain unchanged. Retain the completed copy after a partial source deletion so recovery cannot discard the remaining full data. Verification: 171 existing affected tests passed before the changes. Seven filesystem regressions fail with the original transfer module and pass with this change; final affected selection passes all 183 cases under Electron with clean log analysis. Main and core-agent typechecks pass. For 1000 files, median revision capture was 9.83 ms asynchronously and final synchronous verification was 2.99 ms; collection/verification and snapshot sizes have explicit bounds.
Owner
|
Thank you for your contribution to Orkas! We really appreciate your time and effort. |
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.
Fixes #131.
Problem
Moving an entry between Libraries copies it to the destination and then deletes the source. If the source is edited after the copy was written but before the delete, the edit is lost: the move reports success and only the old contents remain at the destination.
Change
transferLibraryEntriesnow fingerprints the source (path, size and mtime of every entry) before the copy and checks it again just before the delete. If it changed, the source is kept and the destination copy is rolled back, the same way as when the source cannot be removed. The result uses the existingsource_delete_failederror, so no new text is needed.The check happens immediately before the delete, which closes the window described in the issue but not the instant between the check and the delete itself.
Tests
test/main/features/library_transfer_source_changed.test.tscovers a file edited during the copy, a file added to a moved folder during the copy, and an unchanged source that is still deleted. The first two fail without the change.I ran the three library transfer test files with vitest on Node 22 (25 tests pass) and
tsc --noEmit. I did not run the full suite under Electron.