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
Open
Fix #1454: hyparquet-floor-pin: dedupe check reddens on compound/OR/x-range declarations npm would dedupe cleanly#1463philcunliffe wants to merge 5 commits into
philcunliffe wants to merge 5 commits into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature or issue
test/core/hyparquet-floor-pin.test.jsjudges whether a read-path dependency'sdeclared hyparquet range dedupes onto the root pin, and
src/core/semver.jsonly read single comparators (
^ ~ >= > <= < = *on a fullX.Y.Z). Adependency 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) failedisValidRangeand reddened the suite with "a range shape this check cannotjudge", the residue of the false-red class issue #1446 removed.
Solution
matchesSemverRangenow 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.29starts at 1.30.0 and1.2.3 - 2.0ends after 2.0.x.isValidRangereads 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 answersfalserather than guessing, keeping every gating caller conservative. No new runtime dependency.semver.jsand passing with it;npm testis green (6149 pass, 1 skipped, 0 fail), as arenpm run typecheckandnpm run build:types.Code: +160 / -60 lines
Fixes #1454