Skip to content

fix(release): verify the release PR in promote validate, before publishing - #1490

Merged
c-vigo merged 2 commits into
devfrom
bugfix/1487-verify-release-pr-in-validate
Aug 13, 2026
Merged

c-vigo merged 2 commits into
devfrom
bugfix/1487-verify-release-pr-in-validate

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #1487

Problem

Devkit's own promote-release.yml checked the release PR's draft status,
approvals and CI only in the merge job — which runs after promote has
already moved GHCR :latest and published the draft GitHub Release. An
unapproved PR therefore failed the promote from an already-published state:
the release is public, main does not contain the release commit, and the
release PR is still open. Published releases are immutable org-wide, so that
state cannot be walked back — only fixed forward.

The scaffolded consumer template does not have this shape. It runs the same
Find and verify release PR check in validate (fail-fast) and repeats it
in merge. Only the upstream workflow was missing the early gate.

Latent, not fired. Every promote to date succeeded, because the maintainer
re-approves the release PR before dispatching. But #1474 established that a
final release.yml run's finalize job always pushes to the release branch
and so always dismisses the approval under the org-wide stale-review
dismissal. The trigger condition is the default state of every final
release
— the only thing standing between it and a half-promoted release was
an undocumented habit, documented only last commit in #1486.

Change

Mirror the consumer template rather than invent a third shape: the same
Find and verify release PR step now runs in validate, and the merge copy
stays — PR state can change between the two jobs, which is why the template
keeps both deliberately.

The check needs a repo-scoped App token: validate's existing
smoke-check-token is scoped repositories: devkit-smoke-test and cannot read
this repository's PRs, and github.token there carries only
contents: write, packages: read. Rather than guess at a GITHUB_TOKEN
permission set that has never been exercised (a wrong guess fails closed and
breaks the next promote), the new step mints the App token exactly as the
merge job does — an identity proven on every promote run to date.

One thing worth flagging

Mirroring the template's step wholesale also brings the mergeability gate
(#1132 — BEHIND / BLOCKED / DIRTY), which devkit's upstream workflow had never
carried in either job. This is slightly beyond the literal title of #1487,
and deliberate: it is the same defect class (approved + CI-green is not the
same as mergeable, and finding out during merge means finding out after the
publish), and carving those lines out of the step would produce exactly the
divergent third variant the issue asks to avoid. It is fail-earlier, not
fail-more: a BEHIND PR already failed the merge, just from a published state.

Tests

tests/test_promote_release.py is parametrized over both copies (devkit,
scaffold) instead of pinning the scaffold alone — the divergence this issue
is about was invisible precisely because the shape suite only ever looked at
the template. RED before the fix on all four [devkit] cases:

FAILED test_validate_gates_release_pr_before_promote[devkit]
FAILED test_validate_queries_pr_mergeability[devkit]
FAILED test_validate_rejects_behind_pr[devkit]
FAILED test_validate_requeries_unknown_mergeability[devkit]
4 failed, 13 passed

Green after: 17 passed. Full suite 1307 passed, 20 skipped
(tests/test_image.py excluded — it checks a locally-pulled 1.8.0 image
against dev's CHANGELOG and fails identically on clean dev; CI builds the
image from the branch). prek run --all-files green.

Verification owed

The gate cannot be live-proven without deliberately dispatching a promote
against an unapproved PR. The next 1.8.1 promote exercises the happy path —
validate passing the new step is the proof it does not false-positive.

Refs: #1487, #1474, #1132

c-vigo added 2 commits August 13, 2026 10:54
Parametrize the promote-release shape suite over both copies (devkit's own
workflow and the scaffold template) and assert the draft/approval/CI gate
runs in validate, before the irreversible publish, while the merge copy
stays as defence in depth.

RED on the devkit copy: its validate job has no release-PR check at all.

Refs: #1487
…shing

Devkit's own promote-release.yml checked the release PR's draft status,
approvals and CI only in the merge job, which runs after promote has moved
GHCR :latest and published the draft Release. An unapproved PR therefore
failed the promote from an already-published state, leaving the release
public while main lacked the release commit — and published releases are
immutable org-wide, so it cannot be walked back.

The trigger is the default state of every final release, not an edge case:
finalize always pushes to the release branch and so always dismisses the
approval under org-wide stale-review dismissal (#1474). Only operator
discipline kept it latent.

Mirror the scaffold template rather than invent a third shape: the same
Find and verify release PR step now runs in validate, and the merge copy
stays (PR state can change between the two jobs). Mirroring also brings the
mergeability gate (#1132) that the upstream copy never carried in either
job. The check needs a repo-scoped App token — validate's existing token is
scoped to devkit-smoke-test and cannot read this repo's PRs.

Refs: #1487
@c-vigo
c-vigo merged commit 7c25287 into dev Aug 13, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/1487-verify-release-pr-in-validate branch August 13, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant