Skip to content

fix(semver): handle major wildcards in <= and bounded wildcards in greater/lessThanRange - #7394

Open
helmipradita wants to merge 1 commit into
denoland:mainfrom
helmipradita:fix/semver-wildcards-range
Open

helmipradita wants to merge 1 commit into
denoland:mainfrom
helmipradita:fix/semver-wildcards-range

Conversation

@helmipradita

Copy link
Copy Markdown

Refs #7385

Description

In @std/semver:

  1. In semver/parse_range.ts, handleLessThanOrEqualOperator was missing a majorIsWildcard check (unlike handleGreaterOrEqualOperator and other handlers). As a result, parsing <=*, <=x, or <=X computed major + 1 on NaN, returning <NaN.0.0 which caused subsequent comparisons like satisfies() to fail with SyntaxError: Cannot compare against non-numbers. This adds if (majorIsWildcard) return [ALL];.
  2. In semver/greater_than_range.ts and semver/less_than_range.ts, comparatorSet.some(isWildcardComparator) caused both functions to immediately return false whenever any wildcard was present in a comparator set, even if another comparator explicitly bounded the set (e.g. greaterThanRange("2.0.3", "* <1.2.1") and lessThanRange("0.2.1", "* >2.1.0")). This filters wildcards out of the boundary check and returns false only if the set is purely wildcards.

@github-actions github-actions Bot added the semver label Nov 8, 2026
@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (f834d02) to head (4e914ab).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7394      +/-   ##
==========================================
- Coverage   95.04%   95.03%   -0.02%     
==========================================
  Files         619      618       -1     
  Lines       52012    51762     -250     
  Branches     9450     9403      -47     
==========================================
- Hits        49434    49190     -244     
+ Misses       2031     2022       -9     
- Partials      547      550       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant