Repository navigation
fix(ci): release checks refuse a patch release that carries a breaking change - #8392
Conversation
vanceingalls
left a comment
There was a problem hiding this comment.
Changes requested at fcd2e79, for one dead end. The check itself is right: BREAKING_SUBJECT, next minor below 1.0 and next major from 1.0, allowsBreaking's compare, and the old version taken from the bumped manifests.
"Revert the change first" doesn't clear the check. commitsSinceLastRelease is git log --no-merges <last>..<base>, so after a revert both commits are in commits. The revert's subject is Revert "fix(cli)!: needs Node 22 (#2)", which BREAKING_SUBJECT doesn't match, but verifyRelease still finds the original fix(cli)!: commit and refuses. So the error's own remedy can't pass, and it's the live case right now: if #8311 is reverted to ship v0.9.78 as a patch, --verify still says to release v0.10.0.
Fix: drop breaking commits that a later commit in the range reverts. Matching the subject is enough here, Revert "<subject>", or read This reverts commit <sha> from the body if you'd rather key on the sha. One test covers it: repoWithBreakingChange("0.8.2") plus a Revert "fix(cli)!: needs Node 22 (#2)" commit should pass --verify.
Nits:
from = [...previous][0]takes whichever manifest came first. If two manifests had different old versions, the check would silently use one.verifyReleasealready refuses mismatched new versions, so a matching guard onprevious.size > 1would be consistent.- Only the subject
!counts. ABREAKING CHANGE:footer without!slips through. That's fine if the repo only uses!, but worth one line in the docstring.
vanceingalls
left a comment
There was a problem hiding this comment.
Changes requested at e132e09, for the quality gate only. The code is right: inEffect closes the revert dead end, and the mismatched-versions guard is in.
Fallow audit fails because of this PR: fallow/high-crap-score at scripts/ci/release-only-diff.mjs:88, "'verifyRelease' has CRAP score 49.5 (threshold: 30.0, cyclomatic 13)". The new breaking-change and previous branches pushed verifyRelease over. Splitting the breaking check into its own function would bring it back under. Something like breakingProblem({ previous, version }, commits), returning the message or null, holding the previous.size > 1 guard, inEffect(...).find(...) and allowsBreaking. verifyRelease would then push what it returns. The existing tests cover it unchanged.
Studio and player captures was cancelled at "Require Before and After captures". This PR has no UI, so if that check is required here, it needs the no-UI path.
The approval follows a green run.
vanceingalls
left a comment
There was a problem hiding this comment.
Approved at 1bda4c6. This clears my changes-requested (the Fallow gate: 1bda4c6 splits verifyRelease into breakingBumpProblems, notesProblems and changelogProblems, with the same checks in the same order).
- The revert now clears the check.
inEffectwalks the commits newest first. A commit still in effect that saysThis reverts commit <sha>takes out the one it names, and a commit already taken out is never scanned. So a revert clears the breaking commit, and a revert of the revert brings it back. Both are tested. - It matches how this repo merges. Squash merges keep the commit messages (
squash_merge_commit_message: COMMIT_MESSAGES), sogit revert's line survives into main. Two of the last three reverts on main carry it (#8174, #7978). - Mismatched old versions now refuse ("manifests move from different versions"), with a test.
commitsSinceLastReleasesplits records on\x1e/\x1f, so a body holding tabs or newlines can't break the parse.
Nit: a hand-written undo that says it in prose ("Reverts the … (#7265)", as #7383 did) won't count. The error's "revert the change first" could say "with git revert".
jrusso1020
left a comment
There was a problem hiding this comment.
Approve. The check now refuses a release that is too small a bump for a breaking change it carries, and it matches the PR description.
Need ✅ (#8311 nearly shipped in a patch) · Size ✅ (+89/−37 plus tests) · Reuse ✅ (extends the existing --verify path and commit walk) · Simpler ✅ (split into one function per check) · Structure ✅
Risk: low. This is a CI-only script, and on doubt it refuses the release, which fails closed.
What I checked at 1bda4c6
versionBumpnow returns{ from, to }, andclassifycollects the starting versions.verifyReleaserefuses manifests that start from different versions before it runs the breaking check, sofromalways has a single value.- In
inEffect, the newest commits come first, and a commit that is in effect removes the commits it names as reverted. A reverted revert is skipped, so its body is never read, which correctly puts the original change back. The commit walk now uses\x1f/\x1eseparators, so multi-line bodies parse. - I probed
verifyReleasedirectly:
| case | result |
|---|---|
0.9.78 → 0.9.79 with a ! change |
refuses |
| → 0.10.0 | passes |
| → 1.0.0 | passes |
| → 0.10.0-rc.1 | passes |
| 1.2.3 → 1.3.0 | refuses |
| 1.2.3 → 2.0.0 | passes |
! change reverted (This reverts commit <sha>) |
passes |
| revert of that revert | refuses |
a Revert "feat!: …" subject |
not counted as breaking |
- Against real history: the revert commit for #8311 on main (66156bf) carries
This reverts commit 2960319749, and that prefix matches the #8311 commit.node --test scripts/ci/release-only-diff.test.mjspasses 19/19. CI is green.
Nit (non-blocking)
- A few reverts here are written as
Reverts #NNNNwith no sha (a3ff1c4, 4d9a4e4). That form is not recognized, so a breaking change reverted that way still refuses a patch release. It fails closed, and since June 15 reverts use the sha line against 2 that use the PR form. Still, a one-line hint in the error ("the revert must sayThis reverts commit <sha>") would save someone the debugging.
— Rames (hf-review)
What
scripts/ci/release-only-diff.mjs --verifynow fails a release that is too small a bump for a breaking change it carries.A breaking change is any commit since the last release whose subject has the conventional
!(fix(cli)!: …). Below 1.0 such a commit needs the next minor (0.9.x → 0.10.0); from 1.0 on, the next major. Each release's old version comes from the manifests the release bumps. If those manifests start from different versions, the check refuses that too.A breaking change that a later commit reverts doesn't count. A commit is reverted when a later commit in effect says
This reverts commit <sha>, the linegit revertwrites and GitHub keeps in a squash body. A revert of that revert brings the breaking change back. Only the subject's!is read; this repo doesn't useBREAKING CHANGE:footers on their own.The error names the commit and the version to use:
Why
The publish workflow releases from main. So a breaking change that merges while a patch release is open ships in that patch, and nothing checked for it. That happened today: #8311 raised the CLI's Node floor and merged while the v0.9.78 release PR was open.
The existing notes check catches this only by accident, when the notes don't happen to list the commit. A redraft that lists it would have passed.
Checks
fails without the fix:
scripts/ci/release-only-diff.test.mjs"--verify refuses a patch release that carries a breaking change".All on the devbox: