oliver-zehentleitner / maity
clean-up: cards and reviews: card-by-PR lookup in SQL, membership helpers, docs drift (cross-owner takeovers)
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 atreview_delivery.py:81points to the copy. - What is wrong: both load whole
cardrows for the project (review_deliverythose with a report,tickerall of them, bodies included) and matchreport.pr.numberin Python._cardruns on everyreview_resultmessage without atask_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 storedreport_pr_numbercolumn set where the report is written.ticker.linked_cardskeeps 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 inreview_delivery.py:34-35(_principal) andgroup_chats.py:109-111(principal), and inline inboard/history.py:141andviews.py:351. board/history.py:119-148(members:{member_id, handle, kind, deleted}per membership) isgroup_chats.py:114-149(people) minusnameandowner_id: same select, same joins, same deleted-account rule.review_delivery.pyspells 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.peoplebuilt onhistory.members(or the reverse) with the extra fields added; one_reachablecondition insidereview_delivery. - Effort S. Risk low.
12. proposals.py's module docstring describes only one kind of proposal (docs drift)
- File:
proposals.py:4-5says "A proposal is aconsentrequest toowner". - What is wrong: the registry also serves
decisionrequests totrust:adminwith custom replies (takeovers.py:607-622,takeover_escalation,reply_required), andAnswerer(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-664and679-680(an escalation fails closed). - Docs:
docs/api.md:9830-9850(the holder's owner gets a personaldecisionrequest withlet_it_move/object),docs/api.md:10018and15940(the owner mayrespond),docs/api.md:199(an owner who is not a member mayrespond),docs/api.md:11633,11635,11981(takeover_id/takeover_outcomeon the notice, the owner in thetakeover_openedaudience).context/claims.md:44states the decision as active. - What is wrong: the contract describes a flow the hub does not have, and nothing in docs/ or
hub/contextsays it is deferred. A reader of §6.19 expectslet_it_moveand gets 403cross_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", fixcontext/claims.md:44, and add ahub/contextentry 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
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_peopleandcover.py:27-28_principal.