oliver-zehentleitner / maity
clean-up: G2 cards and releases: bug: merged_closes auto closes a release card without the readiness gate and without releases.close
tsk-esy7rhe9qrta Done Maity Coder Claude 004
From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G2 Cards, tasks, releases and roles), read at 9dfd4b65. Paths are under hub/src/maity_hub/. Line numbers are at 9dfd4b65; check them against current main first.
Likely bug. Found by reading; not reproduced. The first step of the fix is a test that shows it.
1. The hub's own move to done skips what every other close of a release card does
- Kind: bug (a rule implemented twice, and the copies have drifted).
- Files:
merged.py:129-176(_tell) andmerged.py:206-220(_close): undermerged_closes: autowithdone_authorityholderoradmin, a card inreviewwhose reported PR is observed merged is moved todone._closeclearsrelease_in_flightfor a release card (merged.py:218-219), so it knows release cards come through here.- Compare
routes/tasks.py:1156-1158(PATCH to done:_refuse_unready),routes/tasks.py:1261-1267(PATCH:releases.closeandticker.on_release_done),routes/tasks.py:2002and2112-2116(report withdone: the same three). - What is wrong: nothing stops a release card from being reported with a PR. When that PR is merged,
_tellcloses the card although: release_not_readyis never checked (§6.7)._blocked_by(merged.py:112-126) checks only dependencies, children and objection holds. An open checklist item, an unmerged shipped PR or an open shipped card no longer holds the release.releases.closeis never called, sorelease_data.frozenis never written andrelease_readyis never emitted.releases.recheck, whichprobe.observe_reportruns right after (probe.py:531), no longer sees the card, becauserelease_in_flightis already cleared.ticker.on_release_doneis never called, so no ticker entry is written for the release.- Docs:
docs/api.md:7859-7872describes the auto close without saying that it skips the release gate. §6.7 says a release reachesdoneonly when it is ready. - Proposal:
- Have
_telltreat a release card like a blocked one. Either never auto-closekind == "release"(add"release_not_ready"or"release"toblocked_by), or call the readiness check and, when the card closes,releases.closeandticker.on_release_doneasroutes/tasks.pydoes. - Better: one
close_card(conn, card, actor, fg)used by PATCH, report andmerged._close, so the four close paths cannot drift again. This overlaps the_closing/_closeduplication on the sibling G2 card filed at the same time. - Add a test to
hub/tests/test_merged_closes.py: a release card with an open checklist item, reported with a PR that the probe observes merged underauto+holder. It must stay open (or close only when ready, frozen and announced). - Effort: S. Risk: low. Release cards with a report are rare, and
test_merged_closes.pycovers the other paths.
Open question
- Should a release card close by merge at all? Option (a): never. A release is closed by a releaser after the checklist, and
task_mergedstill tells the done authority. Option (b): close only when ready, through the same close path as PATCH. (a) is simpler and keeps §6.7's gate (a release goes todoneonly when ready) in one place.
Covered elsewhere
- None. Searched: merged_closes, release_not_ready, merged.py, releases.close.
Effort sum: S (1 point).