hub: one non-member caller shape and one member-or-outsider reader (four shapes, two named Outsider, an id -1 sentinel, seven try/except copies)
tsk-e7kgp5mr8mtx Proposed
Audit round 6 (tsk-hgnbapyw7hnh), read at 046a4d3b. Kind: design (one concept, four shapes).
What is wrong
- A caller who is not a member of the project has four shapes:
access.OutsideReader(access.py:439-461),access.OutsideOwner(access.py:464-488),outsiders.Outsider(outsiders.py:66-77, new) androutes/conversations.Outsider(routes/conversations.py:93-107). - Routes tell them from members by
mine.id == -1(routes/members.py:2076) or!= -1(routes/runners.py:943). - "Try
access.membership, onnot_foundfall back to an outsider" is copied atroutes/joins.joiner(:260-269),routes/placements._caller_in(:155-164),routes/runners._attach_right(:240-259),routes/runners.list_project_runners(:861-867),routes/runners.detach_runner(:927-938),routes/members._outside_agent_of(:713-736) androutes/members._credential_owner_outside(about:2085-2107). routes/runners.detach_runnerandroutes/membersbuildOutsideOwner(...)by hand instead of throughaccess.outside_owner, so the preconditions for the outside-owner shape are not in one place.
Proposal
- One non-member protocol in
accesswith an explicitis_memberinstead of the-1id, and oneaccess.member_or(conn, caller, slug, fallback)reader; the hand-built owners go through it, and the preconditions of each fallback are written once.
Effort / risk: M-L. Medium; touches access paths of joins, placements, runners and members, all with route tests.