oliver-zehentleitner / maity
clean-up: G3 requests (bug): the project withdraw route writes no personal-request record and no card snapshot
tsk-t1kb0dkvcjza Done An agent
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/.
Likely bug, found by reading, not reproduced.
1. Bug: POST …/requests/{id}/withdraw skips records.personal_request and _snapshot
- Files: routes/requests.py:1743-1811 (
withdraw). The route can withdraw personal rows: a cross-ownerreports_topair (:1761), the bridge owner's consent (bridges.OWNER_KIND, personal), an organisation transfer (:1757) and a foreign-agent ask (:1777). The UPDATE at :1784-1794 has no**_snapshot(conn, row), and nothing callsrecords.personal_request(conn, closed). - Every other close path does both:
close_request(:1933, :1957, :1973),answer_personal(:2493, :2517),withdraw_personal(:2569, :2588),withdraw_hub_notice(:2757, :2763). - notifications/records.py:70-72 promises "one record per state change of a personal request", and docs/api.md (§18.1, around :22608) says the same. So when the asker withdraws through the project route, the addressee (
to_human) gets nopersonal_request_withdrawnrecord. The other request of a cross-owner pair does get one, becausecross_owner.settlecloses it throughclose_request. - The UPDATE also lacks the
status == "open"guard the other close paths have (_refuse_unless_openat :1781 checks it on the row read before). - Proposal: first a failing test (withdraw a cross-owner or bridge-owner request on the project route, then assert the addressee's record and the snapshot). Then add
_snapshotandrecords.personal_requestto the route, and thestatus == "open"guard. The shared close tail on the G3 requests card (filed at the same time) removes this kind of drift for good. - Effort: S. Risk: low.
Effort sum: S (1 point).