Skip to content

Fix #1454: hyparquet-floor-pin: dedupe check reddens on compound/OR/x-range declarations npm would dedupe cleanly - #1463

Open
philcunliffe wants to merge 5 commits into
masterfrom
fix/issue-1454
Open

Fix #1454: hyparquet-floor-pin: dedupe check reddens on compound/OR/x-range declarations npm would dedupe cleanly#1463
philcunliffe wants to merge 5 commits into
masterfrom
fix/issue-1454

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Feature or issue

test/core/hyparquet-floor-pin.test.js judges whether a read-path dependency's
declared hyparquet range dedupes onto the root pin, and src/core/semver.js
only read single comparators (^ ~ >= > <= < = * on a full X.Y.Z). A
dependency declaring an ordinary npm shape npm dedupes cleanly onto the pin
(>=1.28.0 <2.0.0, ^1.29.0 || ^2.0.0, 1.29.x, 1.28.0 - 1.30.0) failed
isValidRange and reddened the suite with "a range shape this check cannot
judge", the residue of the false-red class issue #1446 removed.

Solution

  • matchesSemverRange now expands a range into comparators: || alternatives, space-separated compound ranges, x-ranges and omitted positions (1.29.x, 1.29, 1.x), and hyphen ranges, with partial versions bounding the whole span they name so >1.29 starts at 1.30.0 and 1.2.3 - 2.0 ends after 2.0.x.
  • isValidRange reads the same grammar, so "cannot judge" is reported for exactly the shapes the matcher cannot read (npm:/github: specs, >=1.28.0 <garbage) and nothing else. A shape outside the grammar still answers false rather than guessing, keeping every gating caller conservative. No new runtime dependency.
  • The floor-pin check now asserts those shapes dedupe when the pin satisfies them and name a remedy when it does not; new unit tests cover the matcher and the validity check directly. Verified failing on master's semver.js and passing with it; npm test is green (6149 pass, 1 skipped, 0 fail), as are npm run typecheck and npm run build:types.

Code: +160 / -60 lines

Fixes #1454

philcunliffe and others added 5 commits September 6, 2026 06:20
…e grammar

`matchesSemverRange` and `isValidRange` read only a single comparator on a
full X.Y.Z, so a read-path dependency declaring a shape npm dedupes cleanly
onto the root pin (`>=1.28.0 <2.0.0`, `^1.29.0 || ^2.0.0`, `1.29.x`) failed
`isValidRange` and reddened the floor-pin suite as "a range shape this check
cannot judge".

Teach the kernel matcher the range set around the operators it already knew:
`||` alternatives, space-separated compound ranges, x-ranges and hyphen
ranges, expanded into primitive comparators. A shape outside the grammar
still answers false, so an unreadable declaration reddens rather than
passing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The `||`-free and space-free short circuits reran the general path's own
logic for the same answer. Splitting unconditionally is the same behavior
on a validation path that runs per manifest, not per record.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.

hyparquet-floor-pin: dedupe check reddens on compound/OR/x-range declarations npm would dedupe cleanly

1 participant