Masterminds / Masterminds/semver

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

Open Beginner friendly
#317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.4k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

Hi,

I noticed a possible inconsistency in caret wildcard handling on the current master branch.

The comment above constraintCaret documents:

^* --> (any)

but ^* does not appear to match versions other than 0.0.0.

Minimal reproduction

package main

import (
    "fmt"

    semver "github.com/Masterminds/semver/v3"
)

func main() {
    c, err := semver.NewConstraint("^*")
    if err != nil {
        panic(err)
    }

    for _, raw := range []string{"0.0.0", "0.0.1", "1.0.0"} {
        v := semver.MustParse(raw)
        fmt.Printf("%s: %v\n", raw, c.Check(v))
    }
}

On the current master checkpoint
dd2b995c61c39ddd668b23ac919b04d607be35ab, I get behavior equivalent to:

0.0.0: true
0.0.1: false
1.0.0: false

I traced this far enough to see a possible explanation:

  • parsing ^* rewrites the wildcard version to 0.0.0;
  • dirty becomes true, while minorDirty and patchDirty remain false;
  • constraintCaret then falls through to the final patch-equality check.

That seems inconsistent with the documented ^* --> (any) behavior.

Is ^* intended to mean "any version" here?

I originally found this through an independent differential conformance audit
against a small Lean 4 SemVer model. The larger audit is available here if it
is useful:

https://github.com/shumoku88-bit/semverifier/blob/main/docs/MASTERMINDS_SEMVER_CONFORMANCE_AUDIT.md

The report and analysis were prepared with substantial AI assistance, but the
minimal reproduction above is independent of the Lean model and can be checked
directly against Masterminds/semver.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal Go reproduction against the current master branch, then inspect the constraintCaret implementation and the parsing path that handles wildcard versions. Confirm the intended meaning of ^* from the documented comment, and consider the issue done when behavior and regression coverage agree with that meaning.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.