fix: Reject beta versions older than the latest beta tag - #45
Closed
davseve wants to merge 2 commits into
Closed
Conversation
validateNextBeta only required beta1 on a new version line, so a regression like 4.1.0-beta1 after 4.2.0-beta2 was accepted. Require semver.gt against the latest beta tag before the sequencing checks. Ref: ED-24452 Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
We added this functionality already |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens beta tag progression validation in the release-tag-creation action by ensuring a candidate beta version is strictly greater than the latest published beta tag before applying existing same-line sequencing and next-line rules.
Changes:
- Add an early guard in
validateNextBetato reject candidate versions that are not> latestBeta. - Update/add unit test expectations to cover same-or-older betas and older version-line regressions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/release-tag-creation/current-version-validation.ts | Adds a semver.gt(candidate, latestBeta) guard to prevent cross-version beta regressions from being accepted. |
| actions/release-tag-creation/current-version-validation.test.ts | Adjusts/adds beta validation test cases to assert the new “must be greater than the latest beta tag” behavior. |
Suppressed comments (1)
actions/release-tag-creation/current-version-validation.test.ts:116
- With the new
semver.gtguard, older version-line candidates (like 4.1.0-beta1) now throw the new "must be greater than the latest beta tag" error. There is an existing earlier table entry for 4.1.0-beta1 that still expects the old "Expected next beta line..." message, which will make the suite fail unless updated.
'4.1.0-beta1',
false,
'must be greater than the latest beta tag 4.2.0-beta2',
],
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+109
to
+116
| // beta — older version line must be rejected (regression) | ||
| [ | ||
| 'beta', | ||
| ['4.2.0-beta1', '4.2.0-beta2'], | ||
| '4.1.0-beta1', | ||
| false, | ||
| 'must be greater than the latest beta tag 4.2.0-beta2', | ||
| ], |
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.
Summary
validateNextBetaaccepted any*-beta1on a different version line, including regressions like4.1.0-beta1after latest4.2.0-beta2.semver.gt(candidate, latestBeta)before the existing same-line / beta1 sequencing checks.Test plan
npm testinactions/release-tag-creation(15 passed)4.1.0-beta1when latest beta is4.2.0-beta2and confirm it fails with the new error4.2.0-beta3,4.3.0-beta1Ref: ED-24452
Made with Cursor
✨ PR Description
1. Problem & Context
Beta version validation was allowing regressions by accepting older beta versions as valid. ED-24452 adds a version comparison guard to ensure new beta releases are always greater than the latest existing beta tag.
2. What Changed (Where)
current-version-validation.ts: Added upfrontsemver.gt()check rejecting any beta version not greater than latest beta tagcurrent-version-validation.test.ts: Updated error message expectations and added regression test for older version line scenario3. How It Works
The new validation runs first in
validateNextBeta(), comparing the proposed versionnagainst the latest betalusing semver. Ifnis not strictly greater, it fails immediately with a clear message before attempting subsequent beta number/line validations. This prevents acceptance of versions like4.1.0-beta1when4.2.0-beta2exists.4. Risks
None identified. Change is defensive and properly tested with explicit regression case.
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how