Task 10: Conflict copy naming #10
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#10
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 9.
Goal
Derive the filename for a conflict copy. Policy from
docs/design-spec.md§4: on conflict the remote version keeps the canonical path and the local version is renamed to this — so no bytes are ever discarded.Files
internal/sync/conflict.go,internal/sync/conflict_test.goProduces
Format:
name (conflicted copy YYYY-MM-DD HH-MM-SS).extTwo subtleties
15:04:05would generate a name that cannot be written on Windows. There is a test for exactly this..gitignorehas no extension — the suffix goes at the end, not in the middle.Steps
strings.LastIndex(base, ".")and require the index to be > 0 so dotfiles are handled correctly.git commit -s -m "feat(sync): conflict copy naming"Acceptance criteria
IllegalOn(..., PlatformWindows).Done
35e7696feat(sync): conflict copy namingWhat was built
internal/sync/conflict.go:ConflictName(path string, at time.Time) string, derivingname (conflicted copy YYYY-MM-DD HH-MM-SS).extper spec §4 (remote keeps the canonical path, local is renamed).strings.LastIndex(base, ".")requiring index> 0, so a leading dot (.gitignore) stays part of the stem.15-04-05), not colons, so the result is legal on Windows.internal/sync/conflict_test.gois byte-identical to the test in issue #10's body (no comments existed to amend it).Tests
TestConflictName— all four issue cases pass verbatim (a/report.pdf,notes,a/archive.tar.gz,.gitignore).TestConflictNameIsLegalOnWindows— output passesIllegalOn(..., PlatformWindows).go vet,gofmt -l,go mod tidyclean; independently re-verified in a scratch clone during review (see progress.md CV1/CV2).35e7696— green,linux/arm64(Go 1.25.5).go test -count=1 ./...all packages ok; no coverage instrumentation configured (nototal:line to report).Acceptance criteria
TestConflictNameasserts all four issue cases byte-for-byte.IllegalOn(..., PlatformWindows)." — Met:TestConflictNameIsLegalOnWindows, since the hyphenated time format and space/paren suffix introduce no Windows-illegal characters.Rulings
git commit -s, and carryCo-Authored-By: Claude Opus 5 <noreply@anthropic.com>— both trailers present in35e7696.35e7696— all confirmed, including mutation probes that catch a wrong time layout or a wrong>= 0guard.35e7696— fails to compile withundefined: ConflictNameat the exact reported positions.Deferred
NAME_MAX255 on ext4/APFS/NTFS.IllegalOnhas no length check. Carried to #12/#13, which perform the actual move/rename.Implemented and reviewed by Claude (subagent-driven), landed on main after review and green CI.