Disk→backend state migration with refuse-on-conflict #154
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Cordy/Cairn#154
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 #153. For existing s3-driver instances (the dogfood included) whose state lives at
/data/.cairn/today.On boot, per state name:
<name>.migrated(kept as a fallback for one release cycle, ignored by the store).holds.jsonan automatic pick could silently release a legal hold, and a refusing boot is a support ticket while a wrong merge is an incident.Migration runs before anything consumes state (slot between statestore construction and the first Load in the #153 boot order). Idempotent by construction — a crash mid-migration re-runs safely because upload-then-rename is per name.
Acceptance: dogfood upgrade path — deploy on the existing enc instance and verify its license, settings, shares, holds, peering and watermarks all appear under
.cairn-state/in the Garage bucket (ciphertext), the pod restarts clean, and the.migratedfiles sit untouched on the PVC.Shipped in v0.5.2–v0.5.4 with #153 and executed live on the dogfood 2026-08-09.
statestore.MigrateFileimplements the policy exactly as specced: local-only → upload + retire to.migrated; backend-only/fresh → no-op; identical (byte compare) → retire; differing → refuse to start with both SHA-256 digests and the exact operator instruction (rename local to prefer backend, delete object to prefer local). Newest-wins rejected as designed — holds. Idempotent per name; runs in the bind loop before anything consumes state. All four cases unit-tested.The acceptance run happened for real: the dogfood's live state — license, settings, shares, holds, peering trust, watermarks — migrated into the Garage bucket on the v0.5.4 boot. Evidence:
instance peering … enabled=truein the boot log (that flag only exists in the migratedsettings.json, read back from the bucket and decrypted). Two crashlooped deploy attempts before it (the s3 not-exist sentinel, see #153's record) were both clean refusals with zero partial state — the refuse-first posture this issue mandated proved itself before it was even fully in play..migratedfiles remain on the PVC as the one-release fallback.