Repository navigation
fix(release): verify the release PR in promote validate, before publishing - #1490
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1487
Problem
Devkit's own
promote-release.ymlchecked the release PR's draft status,approvals and CI only in the
mergejob — which runs afterpromotehasalready moved GHCR
:latestand published the draft GitHub Release. Anunapproved PR therefore failed the promote from an already-published state:
the release is public,
maindoes not contain the release commit, and therelease 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 PRcheck invalidate(fail-fast) and repeats itin
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.ymlrun'sfinalizejob always pushes to the release branchand 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 PRstep now runs invalidate, and themergecopystays — 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 existingsmoke-check-tokenis scopedrepositories: devkit-smoke-testand cannot readthis repository's PRs, and
github.tokenthere carries onlycontents: write, packages: read. Rather than guess at aGITHUB_TOKENpermission 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
mergejob 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
mergemeans finding out after thepublish), 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.pyis parametrized over both copies (devkit,scaffold) instead of pinning the scaffold alone — the divergence this issueis about was invisible precisely because the shape suite only ever looked at
the template. RED before the fix on all four
[devkit]cases:Green after:
17 passed. Full suite1307 passed, 20 skipped(
tests/test_image.pyexcluded — it checks a locally-pulled 1.8.0 imageagainst dev's CHANGELOG and fails identically on clean
dev; CI builds theimage from the branch).
prek run --all-filesgreen.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 —
validatepassing the new step is the proof it does not false-positive.Refs: #1487, #1474, #1132