fix(release): read the version after checking out the base - #30
Merged
Conversation
`cmd_prepare` read the current version before switching to the base branch, so the bump was computed from whatever branch the script happened to be on. Running it from any other branch cuts a release numbered off unrelated history. `scripts/release.sh` in hotdata-ibis already has this ordering; this brings the rest in line.
anoop-narang
requested review from
shefeek-jinnah
and removed request for
a team
September 10, 2026 14:27
Moving the version read below the checkout also moved the bump-kind validation, which lives inside bump_version. A typo then switched the caller to the base branch before failing. Check the argument next to the existing emptiness check, using the same pattern the explicit-version branch already accepts, so an argument error exits without side effects as it did before.
The explicit-version regex appeared in both the argument check and the branch that takes the argument verbatim, so a change to the accepted format had to be made twice. Hoist it to VERSION_RE, alongside BUMP_KIND_RE. Also narrow the comment above the check: an unchanged version and a pre-release suffix are found from the base branch version, so those necessarily fail after the checkout and the comment should not imply otherwise.
Contributor
Author
|
Two follow-ups from review applied across all seven repos in this family, so they stay identical:
Accept/reject behaviour is unchanged: |
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.
The bug
scripts/release.sh cmd_preparereads the current version before it switches to the base branch:So the bump is computed from the branch the script happened to be invoked on, not from the branch being released.
How it shows up
Hit for real while releasing another repo in this family. On a stale branch at
0.10.0,prepare minorcomputed0.11.0, then checked out main at0.16.0:That failure was luck. It only errored because the version tool refuses downgrades and the branch happened to be behind. From a branch that is ahead of the base, the computed version is higher, nothing refuses it, and a release is cut under the wrong number with no error at all.
The fix
Move the version read below the checkout, so it reads the base branch.
hotdata-ibisalready orders it this way; this brings the rest of the family in line. Pure block move plus a comment — no behaviour change when the script is run from an already-current base branch, which is the documented path.Scope
The same defect is in seven repos sharing this script. Companion PRs are open in each.