Skip to content

fix(cli): correctly compare prerelease versions in update check - #38

Merged
coldhighsun merged 1 commit into
mainfrom
fix/update-check-prerelease
Jul 28, 2026
Merged

fix(cli): correctly compare prerelease versions in update check#38
coldhighsun merged 1 commit into
mainfrom
fix/update-check-prerelease

Conversation

@coldhighsun

Copy link
Copy Markdown
Owner

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 as 2.2.0-alpha.1 was reduced to 2.2.0 and treated as equal to the same-numbered stable release 2.2.0 — so users on a prerelease were never told the stable release was out.

Fix

Replace System.Version + StripPrereleaseSuffix with a minimal SemVersion type and ComparePrecedence following SemVer §11:

  • Equal major.minor.patch core → a version with a prerelease label ranks below one without.
  • Two prereleases → compared by dot-separated identifiers (numeric compared numerically, numeric ranks below alphanumeric, otherwise ASCII order, more identifiers wins).
  • Build metadata (+...) is discarded (does not affect precedence).
  • Any parse failure still returns 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

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.
@coldhighsun
coldhighsun merged commit 2194f91 into main Jul 28, 2026
6 checks passed
@coldhighsun
coldhighsun deleted the fix/update-check-prerelease branch July 28, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant