Make minor-freeze version bump idempotent for already-completed bumps#3073
Make minor-freeze version bump idempotent for already-completed bumps#3073edsavage wants to merge 2 commits into
Conversation
The centralized version-bump pipeline may re-trigger a minor bump after it has already completed (to unblock other services). Leg A validation (validate_minor_freeze_params) hard-failed in that case because main had already advanced past NEW_VERSION, which broke other pipelines. Accept main being at either NEW_VERSION (freeze not yet applied) or the derived MAIN_NEW_VERSION (freeze already completed) when the release branch has been cut, so re-runs no-op instead of failing. main advancing without the branch being cut is still rejected as inconsistent. Leg B (validate_main_minor_bump) was already idempotent. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Pinging @elastic/ml-core (Team:ML) |
There was a problem hiding this comment.
Pull request overview
This PR makes the minor-freeze (feature-freeze) version bump validation idempotent so that re-triggering the centralized version bump pipeline does not fail after a freeze has already completed (i.e., the release branch exists at NEW_VERSION and main has already advanced to the derived MAIN_NEW_VERSION).
Changes:
- Relax
validate_minor_freeze_paramsto acceptmainbeing atMAIN_NEW_VERSIONwhen (and only when) the release branch already exists, preserving detection of inconsistent states. - Add CLI logging to clearly indicate the “already completed (idempotent no-op)” case.
- Add regression tests covering completed-freeze re-runs and key intermediate/invalid states.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dev-tools/version_bump_validation.py | Updates minor-freeze validation to allow idempotent re-runs when the release branch already exists and main is already bumped. |
| dev-tools/unittest/test_version_bump_validation.py | Adds unit tests for the new idempotent and intermediate-state behaviors, plus preserved rejection cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ninalee12
left a comment
There was a problem hiding this comment.
Looks good to me
Ran function locally and works as expected:
python3 dev-tools/version_bump_validation.py validate-minor-freeze \
--main-version 9.6.0 \
--new 9.5.0 \
--branch 9.5 \
--release-branch-exists \
--release-branch-version 9.5.0
OK: minor freeze NEW_VERSION=9.5.0 on branch 9.5
OK: main already bumped to 9.6.0 and branch 9.5 exists — minor freeze already completed (idempotent no-op).
OK: main bump target MAIN_NEW_VERSION=9.6.0
Summary
When the Centralized Version Bump pipeline re-triggered the
9.5.0minor bump (to unblock another service) ml-cpp'sml-cpp-version-bumpbuild #59 failed because the bump had already completed. Release engineering asked that the version-bump logic be idempotent: it should not fail if the minor branch has already been cut andmainhas already been bumped to the next expected version.Root cause (Leg A):
validate_minor_freeze_params(used bycreate_minor_branch.sh) hard-requiredmain == NEW_VERSION. After a completed freeze,mainis atMAIN_NEW_VERSION(e.g.9.6.0) whileNEW_VERSIONis still9.5.0, so validation raised and the step failed. Leg B (validate_main_minor_bump) was already idempotent (no-ops whencurrent == MAIN_NEW_VERSION).Changes
dev-tools/version_bump_validation.py:validate_minor_freeze_paramsnow acceptsmainbeing at either:NEW_VERSION— freeze not yet applied (normal pre-freeze), orMAIN_NEW_VERSION— freeze already completed, only when the release branch already exists (idempotent re-run).mainadvancing toMAIN_NEW_VERSIONwithout the release branch being cut is still rejected as a genuinely inconsistent state. The validator also logs a clear "minor freeze already completed (idempotent no-op)" line for the Buildkite log.dev-tools/unittest/test_version_bump_validation.py: added regression tests for the completed-freeze re-run, the branch-cut-but-main-not-yet-bumped intermediate state, and the two states that must still be rejected.Effect on the pipeline
With this fix, a re-run after a completed freeze no-ops cleanly:
create_minor_branch.shvalidates OK, sees the branch already exists, setsml_cpp_minor_branch_needed=false, and exits 0.bump_main_minor_freeze.shvalidates OK (no-op), finds nogradle.properties/.backportrc.jsondiff, prints "nothing to do", setsml_cpp_main_bump_needed=false, and exits 0.Test plan
python3 -m pytest dev-tools/unittest/test_version_bump_validation.py -qpasses (26 passed, 2 git-integration skipped)validate-minor-freeze --main-version 9.6.0 --new 9.5.0 --branch 9.5 --release-branch-exists --release-branch-version 9.5.0returns 0validate-main-minor-bump --current 9.6.0 --main-new-version 9.6.0 --release-branch-version 9.5.0returns 0ml-cpp-version-bumpagainst the completed9.5.0freeze confirms both legs no-opRelated
Made with Cursor