Fix release finish metadata-only promotion#4700
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| def collapse_changelog_to_stable | ||
| section "Collapse rc CHANGELOG sections into the final ### [#{@options.fetch(:version)}] section" | ||
| def non_runtime_only_commit?(sha) |
There was a problem hiding this comment.
Duplicate/diverging classification logic vs. rakelib/release.rake.
non_runtime_only_commit? re-implements almost exactly what rakelib/release.rake's commit_non_runtime_only? (around line 5654) already does: spin up a temp GITHUB_OUTPUT file, shell out to script/ci-changes-detector "sha^" sha, and parse the trailing non_runtime_only= line. The two copies already differ in small ways — this version short-circuits to false when changed_paths is empty (an explicit pre-check before ever calling the detector), while the rake version has no such pre-check and instead relies on release_finalization_metadata_touched returning nil for an empty diff further up its call chain. That's a fragile way for the two gates to agree.
Since promote only exists to give the operator an early, friendlier version of a check the rake task performs authoritatively anyway (per the comment at the top of the file: "the rake guards enforce the dangerous tag/version safety; this script does not re-implement it"), consider extracting the shared "does this commit classify as non-runtime-only per script/ci-changes-detector" helper into script/lib/ so both rakelib/release.rake and script/release-finish call the same implementation instead of maintaining two hand-synced copies that can silently drift out of agreement (e.g. one script blocking something the rake task would actually accept, or vice versa).
| # local tip to equal the freshly fetched remote tip so a changelog PR merged | ||
| # after checkout cannot be omitted, and so the later version-bump push cannot | ||
| # fail after release work has already started. | ||
| def ensure_local_release_matches_remote!(release_branch, remote) |
There was a problem hiding this comment.
Minor UX nit: the remediation always says git pull --ff-only #{remote} #{release_branch}, but that's only the right fix when local is behind remote. If local is instead ahead of (or has diverged from) the fetched remote tip — e.g. an operator committed the changelog collapse locally before pushing/merging the PR — git pull --ff-only is effectively a no-op (or fails outright on divergence) and won't resolve the mismatch this check just reported, leaving the operator to re-discover that they actually need to git push instead. Not a new pattern (mirrors ensure_local_main_matches_remote! above), but since this check is new, it's worth branching the message on git merge-base --is-ancestor <local> <remote> vs. the reverse to give accurate guidance either way.
Review summaryWhat this PR doesCloses a real gap in the release-train tooling: Strengths
Issues raised inline
Other observations (no action needed)
Overall this is a solid, well-tested fix for a real process gap; the main suggestion is de-duplicating the classification helper so the script-level and rake-level gates can't drift out of sync. |
Why
The release train intentionally commits the stable changelog after the accepted RC. The release rake task already permits non-runtime-only descendants of that RC, but
script/release-finishand the runbook still requiredHEADto equal the RC tag. That contradiction would either block the helper or encourage placing the tooling fix on the active release branch.The helper also needs to reject a stale local release branch after the changelog PR merges, before the release task mutates the checkout and encounters a non-fast-forward push.
What changed
script/ci-changes-detectormain; an already-cut release line uses the compatible direct rake promotion pathWhy this is not backported to
release/17.0.0script/**is release-process code, not metadata-only content. Backporting this helper change after the accepted RC would itself invalidate RC-to-final promotion unless another RC were cut. For 17.0.0, merge the changelog PR intorelease/17.0.0, fast-forward the local release checkout, then runbundle exec rake "release[17.0.0]"directly.Validation
bash script/release-finish-test.bash— 28 tests, 0 failuresv17.0.0.rc.12, accepted the one metadata-only changelog commit, and printed the release command without mutationruby -c script/release-finishbundle exec rubocop script/release-finishshellcheck script/release-finish-test.bashgit diff --check.agents/bin/validate --changedcompleted dependency setup, docs sidebar, RuboCop, package build, ESLint, Prettier, and TypeScript checks successfully. Its expanded unrelated gem/generator suite was manually interrupted after roughly 15 minutes with no assertion failures; the focused release-helper checks above were rerun afterward and passed.