Skip to content

Commit 488c6e3

Browse files
committed
fix(SyncProcess): Fix concurrentOriginTargetRemoval
Only inject moves whose old position is itself swept up by the same target removal Assisted-by: ClaudeCode:claude-opus-4-7 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 0fec11b commit 488c6e3

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/lib/strategies/Default.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,24 @@ export default class SyncProcess {
934934
})
935935
}
936936

937-
const pendingMoves = sourceMoves.filter(move => move !== action)
937+
// Only inject moves whose old position is itself swept up by the same
938+
// target removal — those items lose their existing target counterpart
939+
// and need to be recreated alongside us. Moves with an intact old
940+
// counterpart must NOT be injected, otherwise the bulk-import below
941+
// would create a duplicate on the target and the sub-scanner's
942+
// addMapping would silently evict the existing mapping.
943+
const pendingMoveChainCache = {}
944+
const pendingMoves = sourceMoves.filter(move =>
945+
move !== action &&
946+
Diff.findChain(
947+
mappingsSnapshot,
948+
allCreateAndMoveActions,
949+
sourceTree,
950+
move.oldItem,
951+
concurrentTargetOriginRemoval,
952+
pendingMoveChainCache
953+
)
954+
)
938955

939956
let insertedMove = true
940957
while (insertedMove) {

0 commit comments

Comments
 (0)