Skip to content

fix: reject empty range intersections with wildcards - #914

Open
FanWu-ai wants to merge 1 commit into
npm:mainfrom
FanWu-ai:fix/empty-wildcard-intersections-20261006
Open

FanWu-ai wants to merge 1 commit into
npm:mainfrom
FanWu-ai:fix/empty-wildcard-intersections-20261006

Conversation

@FanWu-ai

@FanWu-ai FanWu-ai commented Oct 6, 2026

Copy link
Copy Markdown

References

Fixes #909.

What / Why

intersects('>*', '*'), intersects('<*', '*'), and intersects('<0.0.0', '*') currently return true. The wildcard shortcut in Comparator.intersects returns before the existing empty-range checks.

Move the wildcard success case after those checks, while retaining exact-version comparisons first. This also makes an exact prerelease intersect a wildcard consistently in both argument orders: false by default, true with includePrerelease.

Add comparator and range fixtures covering both argument orders, loose mode, public and Comparator entry points, includePrerelease, nonempty boundary controls, and OR ranges. The existing lower-bound and general prerelease-intersection algorithms are unchanged.

Validation: regressions fail on the unchanged base; full npm test passes all 51 files with 100% statement, branch, function and line coverage, plus ESLint and template checks. Tested on Linux/Node24.19.0. The remote CI platform/version matrix has not been run locally.

Prepared with OpenAI Codex assistance.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 6, 2026 04:25
@FanWu-ai
FanWu-ai requested a review from a team as a code owner October 6, 2026 04:25
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] intersects() still returns true for an empty range against "*" (follow-up to #521)

1 participant