Reviewer: Claude Fable 5.1 (claude-fable-5-1) — review @ 764041d
APPROVED.
Read: the diff, team_answers.go, team_access.go, handlers_stream.go, grants.go (roleFor/mayRead), the pinned teammode.Access and roster.Lease (67c12e3), Home's implementation/teammode-package.md §3/§4, Sheets' AGENTS.md, Slides #33, Home #97. make test is green in a scratch worktree at 764041d (vet, fmt, build, migration check, go test, race). Worktrees removed.
1. The new order is correct. Within one decision every reading is monotone stricter: state() is read first; actor() re-reads State() through Role(), and roleFor reads it again through teamRole and the orphan rule. A lapse after state() said Member can only turn the actor into a guest (shares only, own grant ignored), and Remaining() then returns 0, which the floor turns into a 1 s timer. So a Member answer always carries a timer; a non-Member answer rests on a share or closes. The old failure (true, 0 on a team-rung sheet) has no path left. Contention (TryLock) reads as Unknown and takes the guest branch, which on a team-rung sheet closes the stream with access-changed; the client's reconnect then meets notFound's Unknown 503 with Retry-After. That is pre-existing and the right shape: close, and let the door retry.
2. Fresh standing per re-check is what teammode prescribes. Access's own doc: "Never store an Access beyond its request; a stream asks for a new one before each delivery and at Remaining." §3 inv. 11 (latching) is per Access, and the fix honours it inside each decision; it never carries a latched Unknown across decisions, which is the author's point about the renewal test. Safe against removal: a fresh Access comes from Cache.decision over the current members map, so after a publication that drops the subject it is NotMember; with the directory down the cache is unusable at c.start + MaximumAge, so nothing renews past 60 s of the last good publication. With #97's lease rules, a removal or role change ends the old lease for good and the fresh one cannot revive it. Meanwhile every delivery re-decides, so nothing is delivered past removal; the stream merely sits silent until its timer.
3. Team mode off is untouched: the a.team == nil branch and streamAuthorized are not in the diff.
4. The tests reproduce the window. I re-ran the sweep three times (deterministic) and six hand mutations in a second worktree:
- M1 old order (origin/main): killed, k=3. M2 no 1 s floor: killed, k=4. M9 Member branch skips
mayRead: killed byTestTeamMemberStreamEndsWithItsSheet. M10 guest branch ignores shares (sheetExists): killed at k=1 and byTestTeamStreamClosesAtLeaseExpiry. - M7
t.actor()forasGuestin the non-Member branch: survived, and I agree it is equivalent (after a non-Memberstate(),Role()is "" and the actor is already a guest).asGuestis the clearer spelling. - M8
state() == roster.Unknown(NotMember falls into the Member branch): survived. It is not a safety gap, only a 1 s polling timer on a guest's share-only stream. Nothing asserts "a share holds with no timer". Optional, not required: a one-linerenew != 0check on the shared case of the sweep would pin it.
The two questions.
- Shares only, no timer, under Unknown is right for a stream. It matches the list ruling (§4: Unknown withholds the team rung, never adds), the write guard, and
roleForitself. Keeping a team-rung stream open under Unknown would need a decision that cannot deliver and cannot be resumed without a resync; closing and letting the 503 door retry is cheaper and already built. - Keep the 1 s floor. A lapse after standing was read means the fresh Access is most likely Unknown anyway; the timer gives the next decision a chance at a fresh lease (a publication that just landed), and an immediate guest re-decide would only close one second sooner. It cannot busy-loop: each cycle is a fresh lease (full Remaining) or Unknown (no timer, or close).
Notes, none blocking: the two survivors above are recorded; the Slides-side fix (#33, grantedTo) and this one now agree in shape.