fix: reject numeric segments after x-ranges#874
Merged
Conversation
owlstronaut
approved these changes
Jun 9, 2026
Merged
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>
This was referenced Jun 10, 2026
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.
Fixes #511.
This keeps x-range parsing from silently broadening ranges that put a numeric segment after an x/wildcard segment. Today
1.x.5and1.*.5are normalized as if the trailing patch segment did not exist, so they become>=1.0.0 <2.0.0-0instead 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.51.*.51.x.5 || 2.xx.1x.1.2x.x.1Verification:
npx tap test/classes/range.jsnpx tap test/ranges/valid.jsnpm test --ignore-scriptsnpm run lint --ignore-scriptsNote: running plain
npm testlocally also runsposttest/postlint; the test and eslint portions pass, whiletemplate-oss-checkreports existing template-managed workflow/settings drift unrelated to this parser change.