Skip to content

fix(version): compare SemVer prereleases correctly - #173

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

fix(version): compare SemVer prereleases correctly#173
dipeshbabu wants to merge 4 commits 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
@dipeshbabu
dipeshbabu force-pushed the agent/fix-prerelease-version-comparison branch from 3eda73f to 2800b40 Compare August 1, 2026 14:24
@mldangelo-oai mldangelo-oai added the bug Something isn't working label Aug 3, 2026
@mldangelo-oai mldangelo-oai changed the title Fix SemVer prerelease comparison fix(version): compare SemVer prereleases correctly Aug 3, 2026
@mldangelo-oai

Copy link
Copy Markdown
Collaborator

@codex review Please review exact head 9d27268, focusing on SemVer prerelease precedence, numeric versus lexical identifiers, oversized identifiers, stable releases, and compatibility with the current-main merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d2726817f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/version.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9d2726817f

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator

@codex review Please review exact contributor-updated head dd681cc, focusing on strict SemVer syntax, leading-zero numeric identifiers, empty prerelease or build segments, and overflow-safe numeric precedence.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: dd681ccdfb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: dd681ccdfb

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants