oliver-zehentleitner / maity
hub: events wait: one caller-liveness rule (live_column vs gone) outside the route; longpoll.end_keys_after asks events.in_transaction
tsk-1mqmn02ggdet Open
Audit round 3 (tsk-hgnbapyw7hnh), read at 588f911b. Kind: duplication / design.
What is wrong
hub/src/maity_hub/routes/events.py:220-242live_column()(SQL EXISTS: credential not revoked, session not ended) androutes/events.py:244-264gone()(Python reads of the same two rows) state one rule in two forms, nested inside the route._IN_EVENTS_PROJECT(routes/events.py:135) is defined, then the samein_project(column_of(t.event, by="seq", key=int), …)is built again inline at:137-140.hub/src/maity_hub/longpoll.py:121-131(end_keys_after) catchesRuntimeErrorfromevents.on_committo fall back tosqlalchemy.event.listen(conn, "commit", once=True);events.in_transaction(conn)(hub/src/maity_hub/events.py:210) answers exactly that question.
Proposal: one liveness helper (in auth/ or longpoll.py) that returns the SQL column, with gone() reading that column; reuse _IN_EVENTS_PROJECT; if events.in_transaction(conn): on_commit(...) else: listen(...).
Effort / risk: S. Low risk.