Skip to content

Fix SemVer prerelease comparison - #173

Open
dipeshbabu wants to merge 1 commit into
openai:mainfrom
dipeshbabu:agent/fix-prerelease-version-comparison
Open

Fix SemVer prerelease comparison#173
dipeshbabu wants to merge 1 commit into
openai:mainfrom
dipeshbabu:agent/fix-prerelease-version-comparison

Conversation

@dipeshbabu

Copy link
Copy Markdown
Contributor

Summary

  • compare prerelease versions identifier by identifier according to SemVer precedence
  • compare numeric identifiers numerically and below nonnumeric identifiers
  • account for differing prerelease identifier counts and ASCII ordering
  • add the standard SemVer precedence sequence and the previously misordered alpha.1/alpha-1 case as regression coverage

Root cause

The update notifier compared each complete prerelease string with Intl.Collator. Locale-aware comparison does not implement SemVer's identifier boundaries or precedence rules, so valid versions such as 1.0.0-alpha-1 and 1.0.0-alpha.1 could be ordered incorrectly.

Impact

Prerelease users receive update notices only when the registry version has higher SemVer precedence. Stable-version behavior is unchanged.

Overlap check

Before publishing, open issues and pull requests were reviewed and repository-wide searches were run for semver, prerelease, update notice, and version comparison. No active issue or pull request overlaps this fix. The only related search hits were already-merged work that introduced the broader update-notice and release features.

Validation

  • pnpm dlx bun test --timeout 30000 ./tests-ts/update-notice.test.ts — 10 passed
  • pnpm exec tsc --noEmit
  • pnpm exec prettier --check src/version.ts tests-ts/update-notice.test.ts
  • git diff --check

@dipeshbabu
dipeshbabu marked this pull request as ready for review July 31, 2026 08:21
@dipeshbabu
dipeshbabu force-pushed the agent/fix-prerelease-version-comparison branch from fed2e02 to 3eda73f Compare July 31, 2026 17:54
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