Skip to content

fix: reject intersections between adjacent prereleases - #920

Open
FanWu-ai wants to merge 1 commit into
npm:mainfrom
FanWu-ai:fix-adjacent-prerelease-intersections-20261011
Open

FanWu-ai wants to merge 1 commit into
npm:mainfrom
FanWu-ai:fix-adjacent-prerelease-intersections-20261011

Conversation

@FanWu-ai

Copy link
Copy Markdown

Summary

intersects('>1.0.0-alpha', '<1.0.0-alpha.0') returns true, even though no version can fall strictly between those bounds. Appending .0 to a prerelease gives its immediate successor under SemVer precedence.

Reject this pair of exclusive bounds in either order in Comparator.intersects. Use already normalized versions so build metadata and loose numeric normalization retain their existing behavior. Add regressions and controls for the public range API, Range/Comparator objects, inclusive endpoints, wider gaps, numeric/nested identifiers, build metadata, loose parsing, and OR branches.

This is separate from wildcard handling in #914 and the shared-prerelease-excluded paths in #901. It does not attempt to resolve the known below-zero (#885) or large-numeric-precision (#880) issues.

Validation

  • Pristine and final npm test: all 51 test files pass, with 100% statements, branches, functions and lines; posttest ESLint and template-oss-check pass.
  • Final regressions against pristine production code: 82 failing leaf assertions across three test modules.
  • 62,322 independent checks, including 2,880 adjacent-gap scenarios; another 288 endpoint/wider-gap checks pass.
  • Packed package files match the checkout; a clean installed package passes 140 assertions.
  • Executed on Node 24.19.0. Other runtime versions were not executed locally.

AI assistance: OpenAI Codex was used for investigation, implementation, tests and automated validation. No human review is claimed. Hosted CI has not run yet.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 11, 2026 19:10
@FanWu-ai
FanWu-ai requested a review from a team as a code owner October 11, 2026 19:10
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.

1 participant