oficina / home Public

Re-pin roster in the root module and teammode to main's lease fix (7e149ef)

roster v0.0.0-20261126180605-7e149ef7b08e answers a contended lease read
from its last published state instead of reading it as lapsed (#158). In
teammode that changes one test's expectation and two comments:

- TestGuardUnderTheWriterNeverWaitsOnAPublication: a Guard inside the
  writer transaction, with a publication queued on that writer, still
  answers at once, and now answers Member and commits; the contended
  Remaining is the live 29 s; neither contended request latches Unknown.
- access.go: Access and Guard comments say a contended lease is answered
  from the published state, and that Unknown latches on a real lapse
  (expiry, removal, role change, fence), no longer on contention.

go get only (no tidy), so go.sum keeps its other entries unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 5cab98894cc9c02af09820f1d7773e5ecfbba0c6 parent 7e149ef
6 files changed, +30 −20
  • go.mod +1 −1
  • go.sum +2 −0
  • teammode/access.go +11 −8
  • teammode/go.mod +1 −1
  • teammode/go.sum +2 −0
  • teammode/runtime_test.go +13 −10

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.997s
?   	amadan.net/oficina/home/cmd/oficina	[no test files]
ok  	amadan.net/oficina/home/internal/guardstest	0.284s
ok  	amadan.net/oficina/home/internal/home	59.664s
ok  	amadan.net/oficina/home/internal/home/directorydata	1.441s
ok  	amadan.net/oficina/home/internal/home/logtest	0.006s
ok  	amadan.net/oficina/home/internal/home/seal	0.003s
ok  	amadan.net/oficina/home/internal/home/sealtest	0.004s
ok  	amadan.net/oficina/home/internal/home/wisp	0.041s
ok  	amadan.net/oficina/home/internal/operator	6.584s
ok  	amadan.net/oficina/home/internal/operatorlaunch	4.131s
ok  	amadan.net/oficina/home/internal/provisioner	49.688s
cd handoff && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/handoff	0.680s
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	0.011s
cd connect && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/connect	1.425s
ok  	amadan.net/oficina/home/connect/linkstore	0.429s
cd teammode && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/teammode	0.108s
?   	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	345.888s
ok  	amadan.net/oficina/home/internal/operator	83.359s
ok  	amadan.net/oficina/home/internal/operatorlaunch	22.396s
ok  	amadan.net/oficina/home/internal/home/directorydata	24.256s
ok  	amadan.net/oficina/home/internal/provisioner	400.567s
cd handoff && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/handoff	12.751s
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.983s
cd dashboard && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/dashboard	1.059s
cd connect && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/connect	6.135s
ok  	amadan.net/oficina/home/connect/linkstore	6.211s
cd teammode && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/teammode	1.974s
?   	amadan.net/oficina/home/teammode/teammodetest	[no test files]
diff --git a/go.mod b/go.mod
index 810bc9c..656a251 100644
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816
amadan.net/oficina/home/handoff v0.0.0-20261120140933-17cdcaff3345
- amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4
+ amadan.net/oficina/home/roster v0.0.0-20261126180605-7e149ef7b08e
amadan.net/rastrillo/rastrillo v0.38.0
filippo.io/age v1.3.2
github.com/chromedp/cdproto v0.158.6
diff --git a/go.sum b/go.sum
index dbc4063..63b44cc 100644
--- a/go.sum
+++ b/go.sum
@@ -12,6 +12,8 @@ amadan.net/oficina/home/handoff v0.0.0-20261120140933-17cdcaff3345 h1:3fR/a8Mqiw
amadan.net/oficina/home/handoff v0.0.0-20261120140933-17cdcaff3345/go.mod h1:Mn5Rsm7Vcd6VZArBKMawza2yO+Fjo8KB1Ii6UcjcJHQ=
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4 h1:jg3sS7hy8Qaewrv/7CZ4kjIYE62FaIG4KMlfNs918dY=
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4/go.mod h1:gqshuXyDtFZUCYbhuZyV3Epc51pUcsLbpqAqiA5UiXg=
+amadan.net/oficina/home/roster v0.0.0-20261126180605-7e149ef7b08e h1:PCGEmjVF55j7adZ8eFEeXrSBZlG/kVL/Px2C5FteSms=
+amadan.net/oficina/home/roster v0.0.0-20261126180605-7e149ef7b08e/go.mod h1:xmSzAVbHHfLcuQO7QnvwuXOQe4rCrA1xRyNIBiHTBqw=
amadan.net/rastrillo/fiesta v1.5.0 h1:wKfTsL5zRMofJBAqOxNlCY7aCtgHCtfwvTPBMA+ZA20=
amadan.net/rastrillo/fiesta v1.5.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
amadan.net/rastrillo/fiesta v1.6.0 h1:ntdiZ/rvKd8wVxnlwkbaB8n0Fop9tIFL7bgJ3MUN3E4=
diff --git a/teammode/access.go b/teammode/access.go
index f93a3dc..caf802b 100644
--- a/teammode/access.go
+++ b/teammode/access.go
@@ -18,11 +18,13 @@ import (
// retryable 503, never a 404 that would claim the item is not theirs.
//
// A Member answer carries a lease. State checks it every time it is asked,
-// without waiting (roster.Lease.Valid refuses on contention instead of
-// queueing behind a publication), and latches Unknown the first time it
-// finds the lease expired or contended, so one request can never see Member
-// again after it has seen Unknown. A held decision therefore ends within
-// roster.MaximumAge, existing sessions included.
+// without waiting (roster.Lease.Valid never queues behind a publication: on
+// contention it answers from the roster's last published state), and
+// latches Unknown the first time it finds the lease lapsed (expired, the
+// subject removed or their role changed, or the cache fenced), so one
+// request can never see Member again after it has seen Unknown. A held
+// decision therefore ends within roster.MaximumAge, existing sessions
+// included.
//
// Never store an Access beyond its request; a stream asks for a new one
// before each delivery and at Remaining.
@@ -118,9 +120,10 @@ func Standing(ctx context.Context) roster.State {
//
// authorize is the app's own rule over the standing — Unknown may still
// reach a share — so Guard decides nothing itself. It never asks the roster
-// and never waits on it: a contended or lapsed lease reads as Unknown, so a
-// refresh publication queued behind this transaction's writer cannot
-// deadlock it, and a decision that lapses mid-write fails the commit.
+// and never waits on it: a lapsed lease reads as Unknown, and a contended one
+// is answered from the roster's last published state, so a refresh
+// publication queued behind this transaction's writer cannot deadlock it, and
+// a decision that lapses mid-write fails the commit.
func Guard(ctx context.Context, authorize func(roster.State) error, write func() error) error {
if err := authorize(Standing(ctx)); err != nil {
return err
diff --git a/teammode/go.mod b/teammode/go.mod
index 57157fc..b66cb3d 100644
--- a/teammode/go.mod
+++ b/teammode/go.mod
@@ -5,7 +5,7 @@ go 1.26.0
require (
amadan.net/oficina/home/connect v0.0.0-20261028165624-d942439ac4e4
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489
- amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4
+ amadan.net/oficina/home/roster v0.0.0-20261126180605-7e149ef7b08e
amadan.net/rastrillo/rastrillo v0.38.0
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3
)
diff --git a/teammode/go.sum b/teammode/go.sum
index b6867cc..b81f163 100644
--- a/teammode/go.sum
+++ b/teammode/go.sum
@@ -6,6 +6,8 @@ amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 h1:RPKtyry/71
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k=
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4 h1:jg3sS7hy8Qaewrv/7CZ4kjIYE62FaIG4KMlfNs918dY=
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4/go.mod h1:gqshuXyDtFZUCYbhuZyV3Epc51pUcsLbpqAqiA5UiXg=
+amadan.net/oficina/home/roster v0.0.0-20261126180605-7e149ef7b08e h1:PCGEmjVF55j7adZ8eFEeXrSBZlG/kVL/Px2C5FteSms=
+amadan.net/oficina/home/roster v0.0.0-20261126180605-7e149ef7b08e/go.mod h1:xmSzAVbHHfLcuQO7QnvwuXOQe4rCrA1xRyNIBiHTBqw=
amadan.net/rastrillo/fiesta v1.5.0 h1:wKfTsL5zRMofJBAqOxNlCY7aCtgHCtfwvTPBMA+ZA20=
amadan.net/rastrillo/fiesta v1.5.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
amadan.net/rastrillo/rastrillo v0.38.0 h1:q8aPnVtKt4q+uNjfxBRCTizhVvj+HdjDJh1MhlkBPOc=
diff --git a/teammode/runtime_test.go b/teammode/runtime_test.go
index 6ce66e0..110aeb3 100644
--- a/teammode/runtime_test.go
+++ b/teammode/runtime_test.go
@@ -294,7 +294,9 @@ func TestGuardChecksBeforeAndAfterTheWrite(t *testing.T) {
// The lease check is safe inside the writer transaction: with a refresh's
// publication waiting on the one SQLite writer this transaction holds, Guard
-// answers at once (contention reads as Unknown) instead of deadlocking.
+// answers at once instead of deadlocking. The roster answers a contended lease
+// from its last published state (oficina/home #158), so the standing that
+// admitted the write still holds and nothing latches Unknown.
func TestGuardUnderTheWriterNeverWaitsOnAPublication(t *testing.T) {
f := newFixture(t)
f.dir.Set(alice, "member")
@@ -339,27 +341,28 @@ func TestGuardUnderTheWriterNeverWaitsOnAPublication(t *testing.T) {
_ = tx.Rollback()
t.Fatal("Guard waited on the publication")
}
- if left := streamed.Remaining(); left != 0 {
+ // 31 s into the lease's 60, during the publication.
+ if left := streamed.Remaining(); left != roster.MaximumAge-roster.RefreshAfter-time.Second {
t.Fatalf("contended lease has %v left", left)
}
_ = tx.Rollback()
- if !errors.Is(err, teammode.ErrUnavailable) {
- t.Fatalf("contended lease granted standing: %v", err)
+ if err != nil {
+ t.Fatalf("contended lease refused a live standing: %v", err)
}
if e := <-refreshed; e != nil {
t.Fatal(e)
}
// The publication listed alice unchanged, so her lease survived it
- // (#97): a request that was never contended is still Member. The two
- // that saw the contention latched Unknown and stay there.
+ // (#97), and the two requests that were asked during the contention
+ // latched nothing: all three are still Member.
if untouched.State() != roster.Member {
t.Fatal("an unchanged publication ended an uncontended request's lease")
}
- if a, _ := teammode.FromContext(ctx); a.State() != roster.Unknown {
- t.Fatal("State did not latch the contention")
+ if a, _ := teammode.FromContext(ctx); a.State() != roster.Member {
+ t.Fatal("State latched Unknown on contention")
}
- if streamed.State() != roster.Unknown {
- t.Fatal("Remaining did not latch the contention")
+ if streamed.State() != roster.Member {
+ t.Fatal("Remaining latched Unknown on contention")
}
}