Harden compareVersions to strip pre-release suffixes#891
Open
JonahBraun wants to merge 1 commit into
Open
Conversation
The local compareVersions() in MetadataManager used naive split/parseInt parsing that relied on parseInt stopping at hyphens. Replace with extractCoreVersionParts() using an explicit regex, matching the hardened implementation in frontier-authentication's extensionVersionChecker.ts.
Contributor
Author
|
/build |
|
Pre-release: 0.25.0-pr891-efd1294 https://github.com/genesis-ai-dev/codex-editor/releases/tag/0.25.0-pr891-efd1294 |
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.
Align MetadataManager's local
compareVersions()with the hardened implementation shipped in frontier-authentication'sextensionVersionChecker.ts(PR #25).The old implementation used
split(".").map(parseInt)which relied onparseIntsilently stopping at hyphens in pre-release suffixes like-pr123. This worked by accident but was fragile and inconsistent with the explicit regex-based parsing used elsewhere.Changes
extractCoreVersionParts()— regex extracts[major, minor, patch]from version strings, properly ignoring pre-release suffixes (-pr123,-pr123-shorthash) andvprefixescompareVersions()to use it, throwing on unparseable input instead of silently producing wrong resultsTest plan
npm run compilepasses (no new errors)0.24.1,0.24.1-pr123,0.24.1-pr123-abc1234,v0.24.1all compare correctlyensureExtensionVersionsRecordedstill works (callers unchanged)