Skip to content

fix: make ^* match any version - #319

Open
TastyHeadphones wants to merge 1 commit into
Masterminds:masterfrom
TastyHeadphones:fix/caret-wildcard-any
Open

TastyHeadphones wants to merge 1 commit into
Masterminds:masterfrom
TastyHeadphones:fix/caret-wildcard-any

Conversation

@TastyHeadphones

Copy link
Copy Markdown

The comment on constraintCaret says ^* --> (any), but ^* only matched 0.0.0.

Parsing turns ^* into dirty 0.0.0 with neither minor nor patch dirty, then the caret logic fell through to a patch equality check. This treats that fully-wildcard form as "any", which matches the docs. Exact ^0.0.0 is still not dirty, so it keeps meaning >=0.0.0 <0.0.1.

Fixes #317

The caret docs say ^* means any, but parsing rewrote it to dirty 0.0.0
and constraintCaret fell through to patch equality, so only 0.0.0 matched.
Treat a fully-wildcard caret the same as the documented "any" case.
Exact ^0.0.0 is unchanged.

Fixes Masterminds#317
@shumoku88-bit

Copy link
Copy Markdown

Thanks for picking this up.

I ran an independent follow-up check against this PR at 43e5010ceb23aa60e025a32302d54d36949b9cbb.

Besides the original stable ^* cases, I checked one option-sensitive boundary: with the default prerelease policy, ^* still rejects 0.0.0-alpha, while with IncludePrerelease = true it accepts it. That seems consistent with treating ^* as “any” while preserving the library’s default prerelease behavior.

I recorded the small CI-backed check here in case it is useful:
https://github.com/shumoku88-bit/semverifier/blob/main/docs/MASTERMINDS_CARET_WILDCARD_PATCH_AUDIT.md

Just sharing this as supporting validation for the patch.

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.

Caret wildcard ^* is documented as matching any version but only matches 0.0.0

2 participants