Task 9: Operation ordering tests #9
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#9
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 8.
Orderwas written there; this task proves it.Files
internal/sync/ops_test.goSteps
Order— not the test.git commit -s -m "test(sync): operation ordering invariants"Acceptance criteria
Orderdoes not mutate its input slice.Done
What was built
internal/sync/ops_test.gowith the three test functions from the issue body, verbatim.Order's three invariants: non-deletes parent-first, deletes child-first, non-deletes before deletes.Orderitself (internal/sync/ops.go, written in Task 8) required no change — this task only adds coverage.Order(one per invariant), each shown to break only its own test, then reverted (R10).Tests
go test ./internal/sync/... -run TestOrder -v: all three tests pass against Task 8'sOrder.go vet ./...clean,go test -count=1 ./...passes across remote/state/sync/vfs;gofmt -l .empty;go mod tidyleaves go.mod/go.sum unchanged.Acceptance criteria
TestOrderCreatesParentFirst,TestOrderDeletesChildFirst,TestOrderPutsNonDeletesBeforeDeletesall pass; each was independently driven red by a mutation targeting exactly the property it checks.Orderdoes not mutate its input slice. Met by Task 8's implementation (copy(out, ops)beforesort.SliceStable); not one of the issue's three mandated tests, so verified via an uncommitted probe and reproduced independently during review.Rulings
Order(e.g. reversing the depth comparison), observing each test fail, then reverting.git commit -s, carrying theCo-Authored-By: Claude Opus 5 <noreply@anthropic.com>trailer.len(got), butOrder's make+copy+sort.SliceStable cannot drop or duplicate elements, and a shorter result would panic (ago testFAIL), not pass silently; carried to #12/#13 reviewers as a watch item.5f2188d— same pass/fail results as reported.go vet,gofmt -l .,go mod tidyreproduced independently in a scratch clone — all clean, matching the report.5f2188dwas pushed alone since its only unlanded ancestor,6ccb7fb, is alreadyorigin/main.Deferred
Orderdoes not mutate its input" has no committed regression test — true today, checked only by an uncommitted probe; a future in-place-sort refactor wouldn't be caught by CI. Deferred to the final review.len(got)or thatOrderis a full permutation of its input — this is issue text and must stay verbatim; a stronger test can be added at final review if wanted.Implemented and reviewed by Claude (subagent-driven), landed on main after review and green CI.