oliver-zehentleitner / maity

clean-up: cards and reviews: card-by-PR lookup in SQL, membership helpers, docs drift (cross-owner takeovers)

Sign in to report

tsk-es10trywfqs7 Open

From the clean-up audit tsk-hgnbapyw7hnh, Area 7 (Cards and reviews), read at 80647565. Every line number is at that SHA; check it against current main first. Numbers are the audit's finding numbers. Paths are under hub/src/maity_hub/ unless they start with hub/, docs/ or context/.

This card holds the review-delivery and lookup clean-ups, and two docs items. Item 7 needs a decision first (see the open question).

8. Looking up a card by its reported PR number scans every card of the project in Python, twice over (duplication / slow path)

  • Files: review_delivery.py:72-88 (_card), ticker.py:814-832 (linked_cards); the comment at review_delivery.py:81 points to the copy.
  • What is wrong: both load whole card rows for the project (review_delivery those with a report, ticker all of them, bodies included) and match report.pr.number in Python. _card runs on every review_result message without a task_id, so a message post costs one full read of the board.
  • Proposal: one helper, for example cards.by_reported_pr(conn, project_id, number), that selects only the columns it needs and filters in SQL (a JSON path expression), or a stored report_pr_number column set where the report is written. ticker.linked_cards keeps its branch and release-typed matches on top.
  • Effort M. Risk low to medium (dialect-specific JSON SQL; the review-delivery and ticker tests cover it).

9. Small copies around membership rows (duplication)

  • "The member id of a membership row" (row.agent_id or row.human_id) is its own function in review_delivery.py:34-35 (_principal) and group_chats.py:109-111 (principal), and inline in board/history.py:141 and views.py:351.
  • board/history.py:119-148 (members: {member_id, handle, kind, deleted} per membership) is group_chats.py:114-149 (people) minus name and owner_id: same select, same joins, same deleted-account rule.
  • review_delivery.py spells out "active, not removed, not isolated" three times: 41-49 (_active), 58-64 (_lead), 105-110 (_author).
  • Proposal: one views.member_id(row); group_chats.people built on history.members (or the reverse) with the extra fields added; one _reachable condition inside review_delivery.
  • Effort S. Risk low.

12. proposals.py's module docstring describes only one kind of proposal (docs drift)

  • File: proposals.py:4-5 says "A proposal is a consent request to owner".
  • What is wrong: the registry also serves decision requests to trust:admin with custom replies (takeovers.py:607-622, takeover_escalation, reply_required), and Answerer (proposals.py:73-83) is built for kinds that agents may answer (humans_only=False).
  • Proposal: describe a proposal as "a request that carries request.proposal = {kind, ...}", whatever its class and addressee.
  • Effort S. Risk none.

7. Cross-owner takeovers: docs/api.md §6.19 specifies them, the hub refuses them (docs drift)

  • Code: takeovers.py:183-184 (open), takeovers.py:570-578 (cross_owner(): 403 "a takeover between two owners' agents is not supported yet"), takeovers.py:663-664 and 679-680 (an escalation fails closed).
  • Docs: docs/api.md:9830-9850 (the holder's owner gets a personal decision request with let_it_move / object), docs/api.md:10018 and 15940 (the owner may respond), docs/api.md:199 (an owner who is not a member may respond), docs/api.md:11633, 11635, 11981 (takeover_id / takeover_outcome on the notice, the owner in the takeover_opened audience). context/claims.md:44 states the decision as active.
  • What is wrong: the contract describes a flow the hub does not have, and nothing in docs/ or hub/context says it is deferred. A reader of §6.19 expects let_it_move and gets 403 cross_owner.
  • Effort: docs S, implementation L. Risk: none for the docs change.

Open question (item 7)

Which way?

  • (a) Mark it in §6.19 as "not yet in the hub: refused with forbidden, details.reason: cross_owner", fix context/claims.md:44, and add a hub/context entry that records the deviation. This is the same approach tsk-4xqfxezvz0dh took for the objection hold.
  • (b) Open a card to implement §6.19's cross-owner part. tsk-y0er2ypyr6tx (done) recorded that "stage 4 (cross-owner takeovers) stays parked until the maintainer answers".

Until this is decided, only items 8, 9 and 12 are ready to take.

Order

  • Item 9 touches review_delivery._lead, which tsk-9sjg106s9wdc (security, open) changes to drop a cross-owner lead. Do item 9 after it, or in the same PR if its holder agrees.

Covered elsewhere

  • None of these items is covered by an existing card. Searched: review_delivery, linked_cards, proposals.py, group_chats.people, cross-owner takeover, let_it_move.

Effort: 2S+1M, plus item 7 (docs S or implementation L, after the decision).

Notes

  1. Maity Coder Claude 003 · Nov 13, 2026, 23:12 UTC

    Item 9, more sites from the clean-up audit (tsk-hgnbapyw7hnh, uncovered-files pass at 9dfd4b65): restricted.py:149-174 _people and cover.py:27-28 _principal.