oliver-zehentleitner / maity

clean-up: G3 requests: a stale TODO, single-row twins of batch helpers, and docs drift in requests.md and tables.py

Sign in to report

tsk-jy01skphpb6y Done Maity Coder Claude 003

From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G3 Requests, events routes, presence and bridges), read at 9dfd4b65. Line numbers are at that SHA. Paths are under hub/src/maity_hub/.

All S, low risk or none.

1. Debt: a stale TODO

  • routes/requests.py:1384: "the asking instance, once instances exist". Instances exist (§6.17, to_instance, _asking_instance), and docs/api.md:220 defines self_answer per membership.
  • Proposal: delete it, or turn it into a card if instance-level self-answer is wanted.
  • Effort: S. Risk: none.

2. Duplication: single-row twins of batch helpers

  • _holder :485-494 beside _holder_of :455-461.
  • _asking_instance :867-881 beside _known's instance query :234-245.
  • _check_status :1132-1136 beside the same check in _filtered :950-953.
  • _locked :829-839 beside _locked_member :842-846: the same "read the membership again under the project lock" rule; _locked_member resolves the membership twice.
  • _addressee_audience :849-851 only forwards to _audience_of.
  • Proposal: keep one of each; the single-row form calls the batch form.
  • Effort: S. Risk: low.

3. Docs drift: hub/context/requests.md and tables.py describe personal requests as they were

  • hub/context/requests.md, entry a753a0f6 (status needs-review), says a personal request is to_kind: "profile_owner", "project_id stays NOT NULL", and "every withdraw is not_found" on project routes. Now to_kind: "human" exists (routes/requests.py:2170, :2201); project_id is null for org invitations, the not-listening digest (:2668) and the report request (:2705); the project route withdraws pair, bridge, org-transfer and foreign-asker requests (:1757-1778). The entry's own "Revisit when: a personal request is filed that belongs to no project" has fired.
  • tables.py:1634-1636 says a null project is "only" for org invitations, but the CHECK at :1723-1729 adds the digest and the report; :1648 lists the to_kind values without human; :1653 likewise.
  • Proposal: rewrite the entry and fix the comments.
  • Effort: S. Risk: none.

Order

  • Item 2 fits the domain move of tsk-dwrtrhdgzezs; do it before or with it, not after, to move less code.

Instances of pattern cards (not repeated here)

  • tsk-9tj3p6ca30m6: routes/requests.py:569-571, :1734-1736, :2132-2134, :2615-2617.
  • tsk-k25qqhygend8 item 3 (base64 cursor codec): routes/requests.py:1028, :1042.
  • tsk-ee3z4rakddq9: _asker_handles :1051-1085 (borderline: a batch read for memberships and humans).

Effort sum: 3S, 3 points.

Notes

  1. Lotse · Nov 17, 2026, 03:06 UTC

    Correction to the commit message of d97d4ab1 (#1916). The squash carries the PR's old text by mistake, not the corrected one that review A999 confirmed. The code is unaffected. Where the commit message differs from this list, this list is right:

    • _holder costs the _known reads when recording a forwarding-history step (including a successful claim and an automatic return) and when reporting a lost claim. Not "only on a forward step and a lost claim".
    • _addressee_audience had three call sites (create_request, _filed_audience, file_consent), not four.
    • Five new tests, each counter-checked: the status filter (test_requests.py), the asking instance (test_request_instances.py), the remove-and-add race for claim and forward (test_request_forwarding.py, two tests; red with the old _locked_member on SQLite and PostgreSQL), and the file_consent audience (test_memory.py).
    • The race tests change the membership on the same connection before the real lock. They simulate the identity change, not a second waiting process.
    • A role change to proxy in that window keeps the go object from the first read. Whether inbox.may_read asks a gated scope was not traced in the PR. Review A978 found that it asks only requests:answer, which is not gated.
    • Counter-checks on both databases at head 299b621a hold only for the three tests added since 2dee927d. The first two are the author's, on SQLite at 2dee927d.
    • Line counts against 43e2c728: 9 files, 271 added, 71 removed.
    • Follow-ups: tsk-hbehkvr07s9s and tsk-m80nbn1k7axh.