Skip to content

fix: handle pre-release versions in compareVersions#357

Merged
tejaskash merged 1 commit intoaws:mainfrom
notgitika:fix/compare-versions-prerelease
Feb 20, 2026
Merged

fix: handle pre-release versions in compareVersions#357
tejaskash merged 1 commit intoaws:mainfrom
notgitika:fix/compare-versions-prerelease

Conversation

@notgitika
Copy link
Contributor

@notgitika notgitika commented Feb 19, 2026

Description

This commit fixes the update command implementation on preview releases.

The old implementation split on . and mapped all parts to Number, producing NaN for segments like "0-preview", and only compared the first 3 segments.

This caused all pre-release versions to appear equal, so agentcore update would report "already on the latest version" even when a newer pre-release was available.

The new implementation splits core version from pre-release at the first -, compares major.minor.patch numerically, then compares pre-release segments per semver precedence rules.

Related Issue

Closes #356

Documentation PR

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@notgitika notgitika requested a review from a team February 19, 2026 23:34
@github-actions github-actions bot added the size/s PR size: S label Feb 19, 2026
@tejaskash tejaskash merged commit 6bf7a92 into aws:main Feb 20, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: compareVersions fails for pre-release versions

2 participants