fix(cli): correctly compare prerelease versions in update check - #38
Merged
Conversation
Update check stripped the prerelease suffix from both the local and remote versions before comparing with System.Version, so a prerelease (e.g. 2.2.0-alpha.1) was treated as equal to the same-numbered stable release (2.2.0) and no update was reported. Replace this with a minimal SemVer precedence comparison (SemVer 11): equal cores rank a prerelease below the stable release, with dot-separated identifier comparison for two prereleases.
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.
Problem
The update check stripped the prerelease suffix from both the local and remote versions before comparing with
System.Version. As a result, a prerelease such as2.2.0-alpha.1was reduced to2.2.0and treated as equal to the same-numbered stable release2.2.0— so users on a prerelease were never told the stable release was out.Fix
Replace
System.Version+StripPrereleaseSuffixwith a minimalSemVersiontype andComparePrecedencefollowing SemVer §11:major.minor.patchcore → a version with a prerelease label ranks below one without.+...) is discarded (does not affect precedence).null, preserving the "update check must never break a run" contract.Tests
Added 4 cases to
UpdateCheckerTests(prerelease→stable reports update, stable→prerelease does not, alpha.1→alpha.2 reports, same prerelease does not). All 7 tests green.🤖 Generated with Claude Code