Skip to content

fix: align caret includePrerelease lower bounds#872

Merged
owlstronaut merged 1 commit into
npm:mainfrom
wayyoungboy:fix-caret-include-prerelease-557
Jun 8, 2026
Merged

fix: align caret includePrerelease lower bounds#872
owlstronaut merged 1 commit into
npm:mainfrom
wayyoungboy:fix-caret-include-prerelease-557

Conversation

@wayyoungboy

Copy link
Copy Markdown
Contributor

Summary

  • keep exact caret lower bounds at the release version when includePrerelease is enabled
  • add regression fixtures for ^0.0.3 and ^0.2.3 prerelease versions matching the existing ^1.0.0 behavior

Root Cause

For exact 0.x caret ranges without an explicit prerelease, replaceCaret appended -0 to the lower bound when includePrerelease was enabled. That turned ^0.0.3 into >=0.0.3-0 <0.0.4-0, allowing 0.0.3-alpha while exact 1.x caret ranges kept >=1.2.3 and rejected 1.2.3-alpha.

Test Plan

  • RED: Node assert script confirmed satisfies('0.0.3-alpha', '^0.0.3', { includePrerelease: true }) returned true before the fix
  • GREEN: Node assert script for 0.0.3-alpha, 0.2.3-alpha, and 1.2.3-alpha all returning false
  • node fixture script covering range include/exclude fixtures: 121 include and 98 exclude cases
  • broader node range verification script: 1348 checks across range parsing, intersects, outside/gtr/ltr, min/max satisfying, and toComparators
  • git diff --check HEAD^ HEAD

Fixes #557

@wayyoungboy wayyoungboy requested a review from a team as a code owner June 6, 2026 21:53

@mbtools mbtools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix! LGTM 👍

@owlstronaut owlstronaut merged commit 046da7f into npm:main Jun 8, 2026
35 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 8, 2026
owlstronaut pushed a commit that referenced this pull request Jun 8, 2026
🤖 I have created a release *beep* *boop*
---


## [7.8.3](v7.8.2...v7.8.3)
(2026-06-08)
### Bug Fixes
*
[`046da7f`](046da7f)
[#872](#872) align caret
includePrerelease lower bounds (#872) (@wayyoungboy)
### Chores
*
[`3485dda`](3485dda)
[#866](#866) bump
@npmcli/eslint-config from 6.0.1 to 7.0.0 (#866) (@dependabot[bot])

---
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] Inconsistent behaviour of caret versions with includePrerelease

3 participants