roster: say what the contended clock check compares against
Review on oficina/home #158 (Claude Fable): the contended accessor checks the clock against the last PUBLISHED observation, not the holder's newer one. Over that longer span: - a wall-clock excursion that nets to zero can defer a fence by one lock hold, but never skips it; - two sub-tolerance backward slews can sum past the tolerance and refuse one read, which is the safe direction. The Lease comment no longer claims contention "never skips a clock fence" outright; the bounds are written where the check is made. Comments only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+16
−4
roster/cache.go+16 −4
CI passed — run details
CI log
amadan: .amadan/timeout: this job's budget is 20m0s (this runner allows up to 30m0s) === vet === CGO_ENABLED=0 go vet ./... CGO_ENABLED=0 go vet -tags browser ./internal/home/ cd handoff && CGO_ENABLED=0 go vet ./... cd roster && CGO_ENABLED=0 go vet ./... cd dashboard && CGO_ENABLED=0 go vet ./... cd connect && CGO_ENABLED=0 go vet ./... cd teammode && CGO_ENABLED=0 go vet ./... === fmt === === build === CGO_ENABLED=0 go build ./... CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/home ./cmd/oficina ./internal/operatorlaunch cd handoff && CGO_ENABLED=0 go build ./... cd roster && CGO_ENABLED=0 go build ./... cd dashboard && CGO_ENABLED=0 go build ./... cd connect && CGO_ENABLED=0 go build ./... cd teammode && CGO_ENABLED=0 go build ./... === go-test === CGO_ENABLED=0 go test -count=1 ./... ? amadan.net/oficina/home/cmd/home [no test files] ok amadan.net/oficina/home/cmd/home-placeholder 0.728s ? amadan.net/oficina/home/cmd/oficina [no test files] ok amadan.net/oficina/home/internal/guardstest 0.148s ok amadan.net/oficina/home/internal/home 56.965s ok amadan.net/oficina/home/internal/home/directorydata 1.393s ok amadan.net/oficina/home/internal/home/logtest 0.004s ok amadan.net/oficina/home/internal/home/seal 0.002s ok amadan.net/oficina/home/internal/home/sealtest 0.004s ok amadan.net/oficina/home/internal/home/wisp 0.050s ok amadan.net/oficina/home/internal/operator 6.421s ok amadan.net/oficina/home/internal/operatorlaunch 4.115s ok amadan.net/oficina/home/internal/provisioner 49.104s cd handoff && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/handoff 0.652s ok amadan.net/oficina/home/handoff/seal 0.002s cd roster && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/roster 5.127s cd dashboard && CGO_ENABLED=0 go test ./... ok amadan.net/oficina/home/dashboard (cached) cd connect && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/connect 1.390s ok amadan.net/oficina/home/connect/linkstore 0.424s cd teammode && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/teammode 0.097s ? amadan.net/oficina/home/teammode/teammodetest [no test files] === race === go test -race -count=1 ./internal/home/ ./internal/operator/ ./internal/operatorlaunch/ ./internal/home/directorydata/ ok amadan.net/oficina/home/internal/home 335.187s ok amadan.net/oficina/home/internal/operator 82.564s ok amadan.net/oficina/home/internal/operatorlaunch 22.385s ok amadan.net/oficina/home/internal/home/directorydata 23.321s ok amadan.net/oficina/home/internal/provisioner 396.107s cd handoff && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/handoff 12.705s ok amadan.net/oficina/home/handoff/seal 1.014s cd roster && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/roster 6.986s cd dashboard && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/dashboard 1.062s cd connect && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/connect 6.141s ok amadan.net/oficina/home/connect/linkstore 6.259s cd teammode && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/teammode 1.911s ? amadan.net/oficina/home/teammode/teammodetest [no test files]
diff --git a/roster/cache.go b/roster/cache.go| index c768cb9..1ed632f 100644 |
| --- a/roster/cache.go |
| +++ b/roster/cache.go |
| @@ -75,9 +75,11 @@ type Decision struct { |
| // When the lock is held, they answer from the state the cache last published |
| // on releasing it (see view), checked against the clock read now — so a live |
| // lease stays live while a concurrent Check holds the lock for a moment |
| -// (oficina/docs #175), and contention never extends a deadline, revives a |
| -// removal, or skips a clock fence. An answer from the published state is one |
| -// the locked path would have given just before the holder's change. |
| +// (oficina/docs #175), and contention never extends a deadline or revives a |
| +// published removal or fence. An answer from the published state is one the |
| +// locked path would have given just before the holder's change. The clock |
| +// check is against the last published observation, not the holder's newer |
| +// one, so it differs from observe's in two bounded ways (see left). |
| // |
| // A lease names the subject and role it was decided for. A later successful |
| // publication does not end it while every publication since the lease has |
| @@ -131,7 +133,17 @@ func (l Lease) left() time.Duration { |
| } |
| v = *p |
| // Read the clock after loading the view, so the view's observation |
| - // precedes this one. |
| + // precedes this one. The discrepancy is measured from the last |
| + // PUBLISHED observation, which may be older than the one the holder |
| + // just made, so over that longer span: |
| + // - a wall-clock excursion that nets to zero (back past the |
| + // tolerance, then forward) can go unseen here, deferring its |
| + // fence by at most one lock hold: any fence observe makes is |
| + // still made, by the holder or the next locked read, and |
| + // published on release. Deferred, never skipped. |
| + // - two backward slews, each under the tolerance, can sum past it |
| + // and refuse this one read where observe would not: the safe |
| + // direction, and nothing is fenced. |
| w, m := c.clock.Now() |
| if v.discrepant(w, m) { |
| return 0 |