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

Sign in to report

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) and merged.py:206-220 (_close): under merged_closes: auto with done_authority holder or admin, a card in review whose reported PR is observed merged is moved to done. _close clears release_in_flight for 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.close and ticker.on_release_done), routes/tasks.py:2002 and 2112-2116 (report with done: the same three).
  • What is wrong: nothing stops a release card from being reported with a PR. When that PR is merged, _tell closes the card although:
  • release_not_ready is 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.close is never called, so release_data.frozen is never written and release_ready is never emitted. releases.recheck, which probe.observe_report runs right after (probe.py:531), no longer sees the card, because release_in_flight is already cleared.
  • ticker.on_release_done is never called, so no ticker entry is written for the release.
  • Docs: docs/api.md:7859-7872 describes the auto close without saying that it skips the release gate. §6.7 says a release reaches done only when it is ready.
  • Proposal:
  • Have _tell treat a release card like a blocked one. Either never auto-close kind == "release" (add "release_not_ready" or "release" to blocked_by), or call the readiness check and, when the card closes, releases.close and ticker.on_release_done as routes/tasks.py does.
  • Better: one close_card(conn, card, actor, fg) used by PATCH, report and merged._close, so the four close paths cannot drift again. This overlaps the _closing / _close duplication 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 under auto + 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.py covers 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_merged still 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 to done only when ready) in one place.

Covered elsewhere

  • None. Searched: merged_closes, release_not_ready, merged.py, releases.close.

Effort sum: S (1 point).