Skip to content

fix: reject numeric segments after x-ranges#874

Merged
owlstronaut merged 1 commit into
npm:mainfrom
pupuking723:fix/invalid-xrange-order
Jun 9, 2026
Merged

fix: reject numeric segments after x-ranges#874
owlstronaut merged 1 commit into
npm:mainfrom
pupuking723:fix/invalid-xrange-order

Conversation

@pupuking723

Copy link
Copy Markdown
Contributor

Fixes #511.

This keeps x-range parsing from silently broadening ranges that put a numeric segment after an x/wildcard segment. Today 1.x.5 and 1.*.5 are normalized as if the trailing patch segment did not exist, so they become >=1.0.0 <2.0.0-0 instead of being rejected.

The change leaves invalid x-range components unchanged when a numeric segment appears after an x/wildcard segment, which lets the existing comparator validation reject them instead of converting them to a broader range.

Added range parse fixtures for:

  • 1.x.5
  • 1.*.5
  • 1.x.5 || 2.x
  • x.1
  • x.1.2
  • x.x.1

Verification:

  • npx tap test/classes/range.js
  • npx tap test/ranges/valid.js
  • npm test --ignore-scripts
  • npm run lint --ignore-scripts

Note: running plain npm test locally also runs posttest/postlint; the test and eslint portions pass, while template-oss-check reports existing template-managed workflow/settings drift unrelated to this parser change.

@pupuking723 pupuking723 requested a review from a team as a code owner June 9, 2026 13:03
@owlstronaut owlstronaut merged commit e583226 into npm:main Jun 9, 2026
35 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 9, 2026
owlstronaut pushed a commit that referenced this pull request Jun 9, 2026
🤖 I have created a release *beep* *boop*
---


## [7.8.4](v7.8.3...v7.8.4)
(2026-06-09)
### Bug Fixes
*
[`e583226`](e583226)
[#874](#874) reject numeric
segments after x-ranges (@pupuking723)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

[BUG] Numerical Versions After X-Ranges Are Ignored

2 participants