Task 13: Property test — convergence and no data loss #13
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#13
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 12. This is the most valuable test in the repo. Expect it to find real bugs.
Goal
Generate random divergence on both sides and assert the two invariants that define a correct sync engine:
Files
internal/sync/property_test.goShape of the test
Collect non-directory entries from
fs.Walk()andrem.List()into two maps, compare key sets and values, then assert every surviving value exists inwritten.Steps
go test ./internal/sync/ -run TestConvergence -vgit commit -s -m "test(sync): property test for convergence and data preservation"Acceptance criteria
Done
What was built
internal/sync/property_test.gowithTestConvergence: random divergence over 50 seeds (500 locally), fresh MemFS + MemRemote + in-memory state store, Now pinned, per the issue's shape.dir/, onto an existing name, self-renames, rename-then-write — with a missing source ignored viaignoreMissing(onlyio/fs.ErrNotExist, per R2).Tests
TestConvergence: 50/50 seeds pass; 500/500 passed locally once, both before and after the F1/F3 fix.a0015bd; D/E/F (the three "never lose bytes" truth-table rows) atd1278e7— each caught by the invariant it targets.go vet ./...andgo test ./...across remote, state, sync, vfs.d1278e7— green, linux/arm64, Go 1.25.5.Acceptance criteria
d1278e7,go test -run TestConvergence50/50.a0015bdand again after the F1/F3 fix atd1278e7(bound bumped locally, never committed).Rulings
io/fs.ErrNotExistfor a missing path; the engine treats it as already-done on delete.git commit -s, with theCo-Authored-By: Claude Opus 5 <noreply@anthropic.com>trailer.d1278e7.Deferred
t.Fatalfpredate this task and come from the issue's own sketch.Implemented and reviewed by Claude (subagent-driven), landed on main after review and green CI.