oliver-zehentleitner / maity

hub: small copies: _holder's full page load, pickup profile defaults twice, paging._bindable vs jcs, register_page HANDLE_PATTERN, replay reader helper

Sign in to report

tsk-xrd360df64gt Open

Audit round 3 (tsk-hgnbapyw7hnh), read at 588f911b. Kind: duplication / debt (slow path). All S.

  • hub/src/maity_hub/routes/requests.py:499-501: _holder now builds a full _known(conn, [row]) (about 7 reads plus avatars) to return one principal id; it was one query before. Callers at :1631 and :1826.
  • hub/src/maity_hub/routes/runner.py:801-806 and :814-815: the trust/role defaults of new_profile ("member"/"coder") are written twice in one function, around a SimpleNamespace stand-in for invitations.issuer_holds.
  • hub/src/maity_hub/paging.py:134-145 (_bindable) re-implements jcs.has_lone_surrogate (hub/src/maity_hub/jcs.py:32) through an encode attempt.
  • hub/src/maity_hub/routes/register_page.py:61 HANDLE_PATTERN is a hand copy of hub/src/maity_hub/models.py:12.
  • hub/src/maity_hub/routes/board.py:160-168 (_reader) and routes/events.py (~100-107) hold the same "membership or None for a replay" try/except.

Proposal: _holder reads the principal id with one query; one defaults constant in the pickup; _bindable calls jcs.has_lone_surrogate; register_page derives its pattern from models.HANDLE_PATTERN; one replay-reader helper.

Effort / risk: S. Low risk.