Repository navigation
Stop deleting a group's copies once the kept copy changes mid-run [patch] - #203
Merged
Merged
Conversation
…tch] DeleteDuplicates re-hashed the kept copy once per group, before the delete loop. The loop re-hashes and deletes each other copy, which takes seconds apiece for large files, and nothing looked at the kept copy again. A sync client or editor rewriting it after the first deletion left the remaining copies to be deleted anyway, and the original content existed nowhere. The kept copy's size, last write time and file identity are now recorded after the pre-loop re-hash and compared before each deletion. Once they differ, every copy still to go is kept and reported as skipped with a reason naming the kept copy. After a group's last deletion the kept copy is re-hashed once more, and a rewrite the quick check could not see (same size, timestamp put back) is reported as an error. DeleteDuplicates takes an optional afterDelete callback, which the tests use to rewrite the kept copy between two deletions. Fixes #201 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5MMN2e4Pk8UWLnvp9
…patch] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5MMN2e4Pk8UWLnvp9
|
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.



DeleteDuplicatesre-hashed the kept copy once per group, before the delete loop. If a sync client or editor rewrote it after the first deletion, the remaining copies were still deleted and the original content was lost.Changes
KeeperSnapshot), and compare them before each deletion. Once they differ, keep every copy still to go and report each as skipped, with a reason that names the kept copy.DeleteDuplicatestakes an optionalafterDeletecallback. Production code passes nothing.Tests
AKeeperChangedDuringTheDeleteLoopPreservesTheRemainingCopies: rewrites the kept copy after the first of three deletions, then asserts the other two survive and are skipped with the kept copy named.AKeeperRewrittenWithoutChangingSizeOrTimeIsReportedAfterTheGroup: asserts the final re-hash reports the change.Fixes #201
Generated by Claude Code