fix: Order child deletion before parent move - #2454
Merged
Merged
Conversation
shepilov
marked this pull request as ready for review
July 7, 2026 13:02
shepilov
commented
Jul 9, 2026
shepilov
commented
Jul 9, 2026
taratatach
approved these changes
Jul 9, 2026
shepilov
force-pushed
the
fix/stopped-dir-move-replaced-child
branch
from
July 9, 2026 12:59
ef41d9b to
a3a392e
Compare
Fixes #2450. Ensure child deletions inside a moved directory source are ordered before the parent directory move, so a replaced child keeps the destination path instead of being turned into a conflict.
shepilov
force-pushed
the
fix/stopped-dir-move-replaced-child
branch
from
July 9, 2026 13:26
a3a392e to
4ba1a9e
Compare
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.
Problem
Fixes #2450.
The stopped-client scenario
test/scenarios/move_dir_and_replace_subfile/local/stoppedcan createdst/file-conflict-...instead of preserving the replaced child atdst/file.The scenario starts with
src/andsrc/file. While Twake Desktop is stopped, the user movessrctodst, replacesdst/filewith a new file, then starts sync. The final state should keep the new child asdst/fileand trash the old child identity.Root cause
The sync dependency graph knew how to order some parent/child moves and additions, but it did not express that a deleted child from a directory move source must be applied before the parent directory move.
Without that dependency, sync could move the old remote child from
src/filetodst/fileas part of the parent directory move. The later upload of the newdst/filethen saw an active file at the same path and was resolved as a conflict.Changes
compareChanges: when a child deletion is inside a directory move source path, the deletion must run before the parent move.ADD(dst/file), MOVE(src -> dst), DEL(src/file)is expanded asDEL(src/file), MOVE(src -> dst), ADD(dst/file).