oliver-zehentleitner / maity
hub: takeovers: 'takes no new work' and 'may hold a card' as domain predicates, not by catching routes.tasks._refuse_paused; one owner-side rule
tsk-sw6gscwccp8t Open
Audit round 3b (tsk-hgnbapyw7hnh), read at 80fef076. Kind: design / duplication / broad except (new since 19ed029a).
What is wrong
hub/src/maity_hub/takeovers.py:169-173imports the privateroutes.tasks._refuse_paused(routes/tasks.py:415-450);_paused(takeovers.py:176-182) turns anyApiErrorfrom it into True. The pause/suspension rule lives in a route and is reused through exception handling.- "Who may hold a card" three ways with different subsets:
takeovers._receiverinline (:153-158: expert, guest, isolated),_takes_cards(:185-194: addsactive),routes/tasks.py:232-247_target_id(guest and expert only, no isolation check). _same_owner(takeovers.py:566-584) next to_owner/is_cross_owner(:587-602), both called back to back at:700-704.
Proposal
availability.paused_reason(conn, membership_id, instance) -> dict | None: the route raises from it, takeovers tests it.- One
cards.may_hold(row) -> reason | Nonefor_target_id,_receiverandtransfer. _same_ownerwritten through_owner. The route import also extends tsk-dwrtrhdgzezs.
Effort / risk: S-M. Low-medium; test_takeovers, test_tasks. Note _target_id gaining the isolation check is a behaviour change to confirm against §6.2.