v0.6.7: graceful state-lock release (#190) + gated share-viewer download #191
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ship-v0.6.7"
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?
What
Two changes, batched into one release to avoid two redeploy stalls.
1. Release the state-backend instance lock on graceful shutdown, even when draining errors (#190)
Lock.Release()already existed and was wired into the SIGTERM path, but it ran aftersrv.Shutdown(...)and was skipped by theos.Exit(1)on a drain error — so a long-lived connection that outlasts the 15s drain deadline would leave the lock held, forcing the Recreate-rollout replacement pod to wait out the full 5m stale window (exactly the v0.6.6 dogfood incident). The heartbeat goroutine also ran on an uncancellablecontext.Background(), so it could re-Save()the lock right afterRelease()deleted it.Fix, all in
cmd/cairnd/main.go:releaseStateLock()closure that stops the heartbeat first (so it cannot re-create the lock) then best-effort deletes it.os.Exit), and on the serve-error (errCh) path too.Abnormal exits (crash,
SIGKILL, config-erroros.Exitduring boot) still fall back to the 5m stale timeout by design — this only makes the graceful path deterministic.New guard test
TestLockReleaseAllowsForeignAcquire: afterRelease(), a different-ID instance acquires immediately (no stale wait) — the property the shutdown wiring depends on. The main.go wiring itself is integration-verified on the dogfood redeploy.2. Encrypted share links no longer auto-download for the recipient (item 3)
internal/share/viewer.go, fragment mode only: instead of firing the download on page load, the viewer now renders a Download button the recipient clicks. Cleaner UX and more robust (browsers increasingly block gesture-less programmatic downloads). The post-download control keeps its "Download again" label (now accurate). Password mode (already gated behind "Open") is unchanged.Validation
The branch commit was produced by a one-shot workflow that ran
gofmt,go vet ./...,go test ./...(all green), a dual-archgo build, andnode --checkon the rendered viewer script before committing. This PR re-runs CI on the pull_request event.Closes #190.