oliver-zehentleitner / maity

clean-up: G3 requests (bug): the project withdraw route writes no personal-request record and no card snapshot

Sign in to report

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-owner reports_to pair (: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 calls records.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 no personal_request_withdrawn record. The other request of a cross-owner pair does get one, because cross_owner.settle closes it through close_request.
  • The UPDATE also lacks the status == "open" guard the other close paths have (_refuse_unless_open at :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 _snapshot and records.personal_request to the route, and the status == "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).