Task 11: Rename detection via FileID #11
Labels
No labels
data-integrity
engine
platform
procurement
remote
scaffold
ui
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Cordy/cairn-desktop#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on Task 10.
Goal
Collapse a
(OpDeleteRemote, OpUpload)pair into a singleOpMoveRemotewhen both refer to the same underlying file.Why
Without this, renaming a 2 GB folder deletes 2 GB from the server and re-uploads 2 GB. With it, the same rename is one MOVE request.
Files
internal/sync/rename.go,internal/sync/rename_test.goProduces
currentIDs— currently-present local path →vfs.FileInfo.FileIDpriorIDs— last-synced path →state.Entry.LocalFileIDrecorded at that timeIdentity comes from the filesystem's
FileID(inode on Unix, file index on Windows), which survives a rename. An emptyFileIDmeans "unknown" and must never match — otherwise two unrelated unknown files would be mistaken for a move.Steps
OpDeleteRemotelook up the prior FileID and check for a matching upload. Emit the move and drop both originals. Handlenilmaps.git commit -s -m "feat(sync): collapse delete+upload into move via FileID"Acceptance criteria
OpMoveRemotewithFromandPathset.Done
What was built
DetectRenames(ops []Operation, currentIDs, priorIDs map[string]string) []Operationininternal/sync/rename.go, collapsing a matched(OpDeleteRemote, OpUpload)pair into oneOpMoveRemote."") never matches on either side.Tests
internal/sync/rename_test.go(4 verbatim issue tests + 2 Task-5/CV4 nil-map tests + 2 fix-round regression tests for F1/F2), all passing.go vet ./...andgo test -count=1 ./...clean across all 4 packages;gofmt -l .empty;go mod tidyno diff.Acceptance criteria
OpMoveRemotewithFromandPathset" — met;TestDetectLocalRenameByFileIDplus F1'sTestDetectRenameWhenUploadPrecedesDelete(order no longer matters).TestNoRenameWhenFileIDDiffers,TestNoRenameWhenFileIDEmpty, plus nil/missing-key variants.TestUnrelatedOpsPassThroughplus F2'sTestSharedFileIDUploadConsumedByAtMostOneDelete(leftover delete keeps its position/value).Rulings
git commit -s, and carryCo-Authored-By: Claude Opus 5 <noreply@anthropic.com>— DCO is non-negotiable.DetectRenamesstands as-is (no hash in this signature) — carried into #12: afterOpMoveRemote, compare local hash to theFromrow'sContentHashand re-upload on mismatch, with defined fallbacks ifMove/Putfail.7ef654a— compile fails withundefined: DetectRenamesat the exact report lines, green after restoring the file.Deferred
Implemented and reviewed by Claude (subagent-driven), landed on main after review and green CI.