Skip to content

Match version prefixes only at component boundaries - #988

Merged
eregon merged 2 commits into
masterfrom
claude/sharp-mendel-8ef60a
Nov 28, 2026
Merged

eregon merged 2 commits into
masterfrom
claude/sharp-mendel-8ef60a

Conversation

@hsbt

@hsbt hsbt commented Nov 27, 2026

Copy link
Copy Markdown
Member

A version that does not exist resolved to a different release sharing its leading characters: mswin-3.4.1 installed 3.4.13, mswin-4.0.1 installed 4.0.10, and jruby-9.4.1 installed 9.4.16.0 instead of 9.4.1.0, as reported in #979 (comment).

A partial version now matches only when it ends between version components, so 3.4.1 no longer matches 3.4.13. Engine-only and short versions such as ruby, jruby, 3.4 and 9.4 still resolve to the latest release, and 3.4.0-preview style prefixes are unchanged. A plain parsedVersion + '.' check would have broken the engine-only case, because the empty version would then match nothing.

Across every version list, only these inputs change: mswin-3.4.1, mswin-4.0.1, jruby-9.3.1, jruby-9.4.1, and 2.2.1 on Linux, which now fails instead of installing 2.2.10.

Generated with Claude Code

A partial version such as mswin-3.4.1 resolved to 3.4.13 and jruby-9.4.1 to 9.4.16.0, because any version starting with the input string was accepted. Require the prefix to end between components, so these fail as unknown or pick 9.4.1.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Require the partial version to be followed by a . or - separator instead of
checking for a digit on both sides of the prefix end. A prefix ending inside a
component, such as 3.0.0-preview, no longer matches.

Co-Authored-By: Claude <noreply@anthropic.com>

@eregon eregon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I tweaked the condition for readability.

Another idea would be to use /\b/:

const prefix = new RegExp(`^${RegExp.escape(parsedVersion)}\\b`)
const matches = v => prefix.test(v)

which seems nice but RegExp.escape is Node 24+ and I'm not sure all usages of the action use node 24 yet.

@eregon
eregon enabled auto-merge (rebase) November 28, 2026 09:40
@eregon
eregon merged commit 4a4d86c into master Nov 28, 2026
485 checks passed
@eregon
eregon deleted the claude/sharp-mendel-8ef60a branch November 28, 2026 09:41
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.

2 participants