oliver-zehentleitner / maity

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)

Sign in to report

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) and routes/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, on not_found fall back to an outsider" is copied at routes/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) and routes/members._credential_owner_outside (about :2085-2107).
  • routes/runners.detach_runner and routes/members build OutsideOwner(...) by hand instead of through access.outside_owner, so the preconditions for the outside-owner shape are not in one place.

Proposal

  • One non-member protocol in access with an explicit is_member instead of the -1 id, and one access.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.