Priority 5 of the 2026-09-17 review asks for the journey to be proved
with an editor and a reporter account. The live two-account walk still
needs two real sign-ins and is NOT what this does — see below. This is
the half that needs no accounts, and it turned out to be missing
entirely.
`getProjectAccess` is the one authorization decision every project
surface reads, and the rule inside it —
canEdit: member.role === "editor",
canManageMembers: false,
— lived in a function that cannot be imported without a DATABASE_URL. So
it had no test. The only way to find out that a viewer could edit, or
that an editor could add members, was to sign in as one and look. A
boundary whose only proof is a manual walk regains a hole the first time
someone adds a role.
The rule is now its own pure module and the query reads it. Behaviour is
unchanged — same two expressions, one place — and it is a Record over
ProjectRole, so adding a role without deciding its capabilities is a
type error rather than a silent `false` or, worse, a copy of another
role's answer.
Six checks, including two that hold for EVERY declared role rather than
the two that exist today: nobody but the owner can manage members, and
no collaborator role is silently as powerful as the owner. That is the
part a future role would break.
Proved by mutation: granting `viewer` canEdit fails with "a reporter
must not be able to dispatch work" — a viewer is the role a reporter
gets on the project they filed against, so that assertion is the
tenancy boundary itself.
WHAT THIS DOES NOT DO: it does not prove the end-to-end journey with two
real accounts. That needs credentials I do not have, and creating
accounts is not something to do unasked. Priority 5 stays open for the
live walk; this makes the rule it would be checking impossible to break
silently in the meantime.
tsc clean, lint 0 errors, test:unit 205/205.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>