Repository navigation
fix(deps-installer): satisfy semver ranges under strict catalog mode - #13716
Conversation
|
💖 Thanks for opening this pull request! 💖 |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughStrict catalog matching now accepts pinned dependency versions that satisfy range-based catalog entries. Package-manager, installer, and CLI tests cover in-range and out-of-range behavior. A changeset records patch releases for the affected packages. ChangesStrict catalog range satisfaction
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (4): Last reviewed commit: "test(deps-installer): reattach the issue..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Fixes strict catalog reconciliation so catalogMode: strict accepts a concrete wanted version when it satisfies a range-based catalog entry (instead of rejecting whenever the catalog entry is a semver range), addressing Renovate-style targeted updates and similar workflows.
Changes:
- Extend the strict catalog “match” condition to accept
wanted@<exact>when it satisfies a catalog semver range. - Add a regression test covering the “wanted satisfies catalog range” case under
catalogMode: strict. - Add a changeset documenting the user-visible behavior change.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pnpm11/installing/deps-installer/src/install/index.ts | Updates the strict catalog match logic to allow semver.satisfies(wanted, catalogRange) when the wanted spec is a concrete version. |
| pnpm11/installing/deps-installer/test/catalogs.ts | Adds a test proving strict mode no longer errors when the wanted version satisfies a ranged catalog entry. |
| .changeset/catalog-strict-range-satisfies.md | Adds release note entry for the strict-mode catalog range satisfaction behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The catalogMode strict comparison rejected a wanted version whenever the catalog entry was a semver range, even when that version fell squarely inside the range. semver.valid() returns false for a range like ^7.22.17, so the existing check (both sides valid and equal) could never succeed for range-based catalog entries, no matter what version was requested. Every comparison fell through to CatalogVersionMismatchError. This blocked pnpm update <pkg>@<version> --recursive --lockfile-only against any workspace using catalogMode: strict with range-based catalog entries, which is the common, documented, recommended way to declare a catalog entry. Renovate's pnpm artifact-update flow runs exactly that command, so this broke automated dependency updates on such workspaces. The fix adds a second branch: when the catalog specifier is a valid range and the wanted version satisfies it, the comparison now accepts the dependency instead of throwing. Concrete-vs-concrete comparisons and a wanted specifier that is itself a range still correctly fall through to rejection, since semver.valid() on a range is still false. This behavior was introduced by pnpm#11706, which fixed a crash in this same comparison (passing a range to semver.eq() threw Invalid Version) but deliberately preserved the reject-on-range behavior without addressing whether range satisfaction should succeed. That question was raised in pnpm#11570's own Expected Behavior section and never addressed. Closes pnpm#11570 Written by an agent (Claude Code, claude-sonnet-5).
Accepting a wanted version that satisfies a range-based catalog entry is not enough on its own. The catalog-mode gate in installSome only sets saveCatalogName, and the cataloging decision is made two packages later in resolveDependencyTree, which builds a catalogLookup only when the catalog has no entry for the alias yet. With an entry already present it warns and lets the resolved version be written to package.json, so the project silently stops using the catalog — under `pnpm update --recursive <pkg>@<version>` that rewrites every manifest from `catalog:` to a pinned version, which is what catalogMode: strict exists to prevent. Rewrite the wanted specifier to `catalog:` when the catalog range covers it, so the dependency resolves through the catalog: the manifest keeps its `catalog:` reference, the catalog stays the single place the version is declared, and only a version outside the range is still rejected with ERR_PNPM_CATALOG_VERSION_MISMATCH. pacquet's decide_catalog gets the same acceptance rule: the catalog entry is parsed as a range and the wanted concrete version must satisfy it, which yields its existing "used from the catalog" decision. The pacquet end-to-end test that asserted the rejection was passing a version inside the catalog range, so it now uses one outside it. The two stacks still differ in one field for a saving `update <pkg>@<version>`: pnpm re-renders the workspace catalog entry to the range's newest satisfying version, pacquet leaves the entry and moves only the locked version. The pacquet test deliberately does not assert that field until the intended behavior is settled. Refs pnpm#13715 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
dac8d86 to
4ae907a
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased onto Why the original fix needed more than widening the comparison. Accepting the wanted version in What it does now. When the catalog range covers the wanted version, the wanted specifier is rewritten to pacquet parity. Ported in the same commit (details in the resolved review thread). Tests. Open question for review. The two stacks now agree on the essentials (no error, dependency stays on Written by an agent (Claude Code, claude-opus-5). |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm11/installing/deps-installer/test/catalogs.ts (1)
1537-1537: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove historical-only regression notes.
pnpm11/installing/deps-installer/test/catalogs.ts#L1537-L1537: Remove the issue-only regression comment.pnpm11/installing/deps-installer/test/catalogs.ts#L1766-L1766: Remove the issue-only regression comment.pnpm/crates/cli/tests/suite/update.rs#L1055-L1057: Remove the prior failure description and retain the current strict mismatch contract.As per coding guidelines, comments must describe current behavior rather than historical implementation details.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm11/installing/deps-installer/test/catalogs.ts` at line 1537, Remove the historical issue-only regression comments in pnpm11/installing/deps-installer/test/catalogs.ts at lines 1537 and 1766. In pnpm/crates/cli/tests/suite/update.rs at lines 1055-1057, remove the prior failure description while preserving the current strict mismatch contract and its behavior.Source: Coding guidelines
pnpm/crates/cli/tests/suite/update.rs (1)
1097-1101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the parsed catalog and importer resolution.
A raw substring can match a package snapshot while the catalog snapshot or importer entry is wrong. Parse
pnpm-lock.yamlaspacquet_lockfile::Lockfileand assert the default catalog entry hasspecifier == "^100.0.0"andversion == "100.1.0". Also assert importer"."recordsspecifier == "catalog:"andversion == "100.1.0"forDEP.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/suite/update.rs` around lines 1097 - 1101, Replace the raw lockfile substring assertion in the update test with parsed validation using pacquet_lockfile::Lockfile. Assert the default catalog entry for DEP has specifier "^100.0.0" and version "100.1.0", and importer "." records DEP with specifier "catalog:" and version "100.1.0".Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/crates/cli/tests/suite/update.rs`:
- Around line 1097-1101: Replace the raw lockfile substring assertion in the
update test with parsed validation using pacquet_lockfile::Lockfile. Assert the
default catalog entry for DEP has specifier "^100.0.0" and version "100.1.0",
and importer "." records DEP with specifier "catalog:" and version "100.1.0".
In `@pnpm11/installing/deps-installer/test/catalogs.ts`:
- Line 1537: Remove the historical issue-only regression comments in
pnpm11/installing/deps-installer/test/catalogs.ts at lines 1537 and 1766. In
pnpm/crates/cli/tests/suite/update.rs at lines 1055-1057, remove the prior
failure description while preserving the current strict mismatch contract and
its behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 033305bc-3c0e-4cb3-b90c-9356042b0c6f
📒 Files selected for processing (6)
.changeset/catalog-strict-range-satisfies.mdpnpm/crates/cli/tests/suite/update.rspnpm/crates/package-manager/src/catalog_mode.rspnpm/crates/package-manager/src/catalog_mode/tests.rspnpm11/installing/deps-installer/src/install/index.tspnpm11/installing/deps-installer/test/catalogs.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- pnpm11/installing/deps-installer/src/install/index.ts
- .changeset/catalog-strict-range-satisfies.md
Code Review by Qodo
1. addDependenciesToPackage missing trailing comma
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13716 +/- ##
=======================================
Coverage 88.23% 88.23%
=======================================
Files 625 625
Lines 102801 102839 +38
=======================================
+ Hits 90710 90744 +34
- Misses 12091 12095 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.49283585518,
"stddev": 0.1571316024109152,
"median": 2.43993137428,
"user": 1.52990158,
"system": 1.3185516600000002,
"min": 2.33701374228,
"max": 2.73047011028,
"times": [
2.51962085128,
2.50638199428,
2.33701374228,
2.3651128522800002,
2.3686456162800003,
2.35474442128,
2.66998223128,
2.73047011028,
2.70290597828,
2.37348075428
]
},
{
"command": "pacquet@main",
"mean": 2.4863007351799995,
"stddev": 0.14564355663351533,
"median": 2.4466287067800003,
"user": 1.4892081799999999,
"system": 1.25870186,
"min": 2.33869878628,
"max": 2.75376289028,
"times": [
2.46633614528,
2.36226564628,
2.54187640528,
2.59651226728,
2.75376289028,
2.42692126828,
2.33869878628,
2.66018102128,
2.35901100428,
2.35744191728
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4652807505799998,
"stddev": 0.09590005211674921,
"median": 1.46693921228,
"user": 1.0263780799999997,
"system": 1.13985256,
"min": 1.35083320728,
"max": 1.64698636228,
"times": [
1.46590415228,
1.4742699032800002,
1.64698636228,
1.35083320728,
1.3649474482800001,
1.4375948462800001,
1.5850706032800002,
1.36312822128,
1.46797427228,
1.49609848928
]
},
{
"command": "pnpr@main",
"mean": 1.47332094838,
"stddev": 0.153346356583421,
"median": 1.41171079128,
"user": 1.03479988,
"system": 1.10267576,
"min": 1.3453081982800001,
"max": 1.7899118762800001,
"times": [
1.51446150428,
1.3453081982800001,
1.4169208372800002,
1.34634720628,
1.40650074528,
1.49207215228,
1.3694364752800001,
1.68866431428,
1.36358617428,
1.7899118762800001
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24542668362000003,
"stddev": 0.006894607954854606,
"median": 0.24506187412000002,
"user": 0.21058673999999997,
"system": 0.47914512,
"min": 0.23620864462000002,
"max": 0.25536035662,
"times": [
0.24541611162000002,
0.23620864462000002,
0.23903504962000002,
0.24041495962,
0.25536035662,
0.23897879362000002,
0.24706266462,
0.24470763662000003,
0.25447322562,
0.25260939362
]
},
{
"command": "pacquet@main",
"mean": 0.25373063522,
"stddev": 0.005041238963180383,
"median": 0.25228566412,
"user": 0.20731083999999997,
"system": 0.5293282199999999,
"min": 0.24713310662000001,
"max": 0.26085827462,
"times": [
0.25300021062,
0.25649185862,
0.24713310662000001,
0.26085827462,
0.25984693962,
0.25157111762,
0.24868666262000003,
0.25943522362000004,
0.24968456362000002,
0.25059839462
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26574605862000006,
"stddev": 0.005283784953140758,
"median": 0.26609136912000003,
"user": 0.20587974,
"system": 0.5331404199999998,
"min": 0.25894224562,
"max": 0.27360768462,
"times": [
0.27055752862000004,
0.27229824862,
0.26605249062,
0.26613024762000004,
0.26014831762,
0.25894224562,
0.27360768462,
0.26617592362000003,
0.25914995562000004,
0.26439794362
]
},
{
"command": "pnpr@main",
"mean": 0.26016792792,
"stddev": 0.0065367197601588056,
"median": 0.25831105112,
"user": 0.22585574000000003,
"system": 0.48433892,
"min": 0.25022741562,
"max": 0.27202458262,
"times": [
0.27202458262,
0.26622497462,
0.25022741562,
0.25514436962000003,
0.25546861962,
0.25726312162000003,
0.25935898062,
0.26478324962,
0.26449093862,
0.25669302662000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5866714366800005,
"stddev": 0.022202431715404848,
"median": 2.58129700248,
"user": 1.51581624,
"system": 1.2896008399999999,
"min": 2.56853551298,
"max": 2.64365980098,
"times": [
2.59474086098,
2.56853551298,
2.56922980098,
2.59156519398,
2.64365980098,
2.57393739398,
2.58060836498,
2.58198563998,
2.59088224698,
2.57156955098
]
},
{
"command": "pacquet@main",
"mean": 2.5854691163799997,
"stddev": 0.020020449219913018,
"median": 2.58911512198,
"user": 1.5115265399999998,
"system": 1.28767754,
"min": 2.54850887998,
"max": 2.61607164898,
"times": [
2.58761928798,
2.60393687898,
2.54850887998,
2.57154306998,
2.60079539898,
2.59061095598,
2.61607164898,
2.59356746798,
2.56780674898,
2.57423082598
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6309778095800003,
"stddev": 0.1732082396967217,
"median": 1.60530198198,
"user": 1.0188276399999998,
"system": 1.1463801399999998,
"min": 1.41566257298,
"max": 1.86975661998,
"times": [
1.5618933509800002,
1.42387518398,
1.44297275298,
1.41566257298,
1.86975661998,
1.76568307898,
1.79743918898,
1.60640353398,
1.6042004299800001,
1.82189138298
]
},
{
"command": "pnpr@main",
"mean": 1.6125542948800002,
"stddev": 0.13426692921312625,
"median": 1.5763077069800002,
"user": 0.99232454,
"system": 1.12002464,
"min": 1.43912041198,
"max": 1.80819565598,
"times": [
1.46677517098,
1.77287862298,
1.7684743099800002,
1.58256944498,
1.50460294698,
1.67044340998,
1.5700459689800002,
1.80819565598,
1.54243700598,
1.43912041198
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.40916125446,
"stddev": 0.012304340598491779,
"median": 0.41066442406000003,
"user": 0.5389866799999999,
"system": 0.66502124,
"min": 0.38637566806,
"max": 0.42448290406000005,
"times": [
0.42118466006000005,
0.41301029106000003,
0.40831855706000003,
0.41562855606000004,
0.40292810606,
0.39421210706000004,
0.42044419406000005,
0.40502750106,
0.42448290406000005,
0.38637566806
]
},
{
"command": "pacquet@main",
"mean": 0.41043227656000003,
"stddev": 0.02740895505667415,
"median": 0.40145052656,
"user": 0.5472514799999999,
"system": 0.64325794,
"min": 0.37222207606,
"max": 0.46445736006000005,
"times": [
0.40146871106000004,
0.40143234206000006,
0.39283865706000004,
0.38790832806000003,
0.37222207606,
0.39504450706000005,
0.43230305106000005,
0.43327301006,
0.46445736006000005,
0.42337472306
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3135790663600001,
"stddev": 0.017823642114529893,
"median": 0.30998973056,
"user": 0.21021228,
"system": 0.5392439400000001,
"min": 0.29251169406000005,
"max": 0.34489060406000005,
"times": [
0.30519399106000006,
0.29521675506000006,
0.29251169406000005,
0.30173264406000005,
0.30056586306000005,
0.31977764506000006,
0.31478547006,
0.33767425406,
0.34489060406000005,
0.32344174306
]
},
{
"command": "pnpr@main",
"mean": 0.3300302029600001,
"stddev": 0.022329091665748552,
"median": 0.32931741056,
"user": 0.22811547999999998,
"system": 0.5836996400000001,
"min": 0.30189068206,
"max": 0.36548132406000006,
"times": [
0.33021933606000003,
0.34386702406,
0.34666207306,
0.36548132406000006,
0.35556088606,
0.32841548506,
0.30889149406000005,
0.30189068206,
0.31408144106,
0.30523228406
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.78483867296,
"stddev": 0.03947966926092899,
"median": 1.78599411016,
"user": 0.8816205199999999,
"system": 0.8324649999999998,
"min": 1.72939506816,
"max": 1.84578376016,
"times": [
1.7372696381600001,
1.72939506816,
1.7738517561600002,
1.82456037416,
1.8210793801600003,
1.74367052916,
1.78345378416,
1.7885344361600002,
1.84578376016,
1.80078800316
]
},
{
"command": "pacquet@main",
"mean": 1.73929355066,
"stddev": 0.02239393821473936,
"median": 1.72871886766,
"user": 0.79499502,
"system": 0.7733049,
"min": 1.71685546516,
"max": 1.78157967716,
"times": [
1.7258410441600003,
1.7236530591600001,
1.71685546516,
1.72354767416,
1.7476587901600003,
1.73013221316,
1.7273055221600002,
1.78157967716,
1.74179215416,
1.7745699071600003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.33017297656000005,
"stddev": 0.023968550750507474,
"median": 0.32066948766000003,
"user": 0.22951612,
"system": 0.5543614999999998,
"min": 0.29821986016,
"max": 0.37201394216,
"times": [
0.31852238316000003,
0.32281659216,
0.30979197616,
0.31836355316000003,
0.31823189416000003,
0.32891119616000003,
0.29821986016,
0.36089841716,
0.35395995116,
0.37201394216
]
},
{
"command": "pnpr@main",
"mean": 0.38175875746,
"stddev": 0.048545940191175425,
"median": 0.38271504016,
"user": 0.28314562,
"system": 0.6190319999999999,
"min": 0.30741583416,
"max": 0.45519079016,
"times": [
0.45519079016,
0.42915081616,
0.40202380316,
0.38230608416,
0.42397368316,
0.38312399616000004,
0.35984229516,
0.31069751416,
0.30741583416,
0.36386275816
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24405831043384618,
"stddev": 0.04038999522065767,
"median": 0.24169381428000003,
"user": 0.23473511846153847,
"system": 0.07837122307692307,
"min": 0.18787233228000003,
"max": 0.32826189728,
"times": [
0.22193699028000002,
0.22345281928000002,
0.25751057428,
0.24169381428000003,
0.24528436528000003,
0.22854212828,
0.27308529028,
0.21021646328000002,
0.18787233228000003,
0.20211499328000002,
0.32826189728,
0.24361973528000003,
0.30916663228
]
},
{
"command": "pacquet@main",
"mean": 0.25302147898000005,
"stddev": 0.03454046493340752,
"median": 0.24657125778,
"user": 0.23875427999999999,
"system": 0.0675286,
"min": 0.21412217128000002,
"max": 0.32615919128,
"times": [
0.32615919128,
0.25804901028,
0.29774054228,
0.24058844728000003,
0.22111985828000003,
0.22906488428000002,
0.21412217128000002,
0.24910268728,
0.24403982828,
0.25022816927999997
]
},
{
"command": "pnpr@HEAD",
"mean": 0.0950723679251613,
"stddev": 0.003937626485563272,
"median": 0.09416009228000001,
"user": 0.023295257419354832,
"system": 0.013430138709677419,
"min": 0.08882237528000002,
"max": 0.10549816628000001,
"times": [
0.09052737128,
0.09287475728000001,
0.09130687128000001,
0.09236428628000001,
0.09424145628000001,
0.09416009228000001,
0.09119756528000002,
0.09028232828000002,
0.09740094628000001,
0.09317597628000002,
0.09212621628,
0.08882237528000002,
0.09305509828000001,
0.09495495128,
0.09363502228000001,
0.09836157628000002,
0.09741832728000001,
0.09260622228000001,
0.09413960328000001,
0.09086038828000001,
0.10277310728000001,
0.10216793628000001,
0.09838393928000001,
0.10114112928,
0.09678416228000002,
0.10549816628000001,
0.09339452928000001,
0.09586383628000002,
0.09609845728000001,
0.09561748028000001,
0.09600923028000001
]
},
{
"command": "pnpr@main",
"mean": 0.09490999644129033,
"stddev": 0.0030578595306809866,
"median": 0.09479349728000001,
"user": 0.024196870322580645,
"system": 0.012873396774193547,
"min": 0.09019478328000001,
"max": 0.10150898228,
"times": [
0.09077910528000001,
0.09372776728000001,
0.09761574028000002,
0.09376525728000001,
0.09550275528000002,
0.09122023728,
0.09604204228000002,
0.09521254728000002,
0.09725505928000001,
0.09544963528000001,
0.09447220028000002,
0.10062712928000002,
0.10019066728,
0.10150898228,
0.09639373528000002,
0.09810128628,
0.09197359928000001,
0.09264001528000002,
0.09241194528,
0.09030230528000001,
0.09467251928,
0.09296383728000002,
0.09822057028000002,
0.09019478328000001,
0.09547012228000001,
0.09703728928000001,
0.09197010228000001,
0.09306566828000001,
0.09745385428000002,
0.09117563328000002,
0.09479349728000001
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.0633517300955555,
"stddev": 0.25358508849296724,
"median": 1.05031307054,
"user": 1.0477121377777776,
"system": 0.17134886222222223,
"min": 0.73593385454,
"max": 1.4933392135399999,
"times": [
1.23549970654,
1.34620633954,
0.91900036354,
1.0712297115399998,
0.7945764205400001,
0.92406689054,
0.73593385454,
1.05031307054,
1.4933392135399999
]
},
{
"command": "pacquet@main",
"mean": 0.9257559373177777,
"stddev": 0.15621785864309845,
"median": 0.92349836754,
"user": 0.8898018044444443,
"system": 0.15564908444444445,
"min": 0.7252812045400001,
"max": 1.18445252954,
"times": [
1.0280805895399998,
0.9905290535400001,
1.07680015754,
1.18445252954,
0.7497469495400001,
0.83072807554,
0.82268650854,
0.92349836754,
0.7252812045400001
]
},
{
"command": "pnpm@HEAD",
"mean": 2.999092020428889,
"stddev": 0.08714488098724284,
"median": 3.00279062154,
"user": 4.587599804444444,
"system": 0.27870319555555556,
"min": 2.91312136754,
"max": 3.17063853054,
"times": [
2.9271470975400002,
2.91312136754,
3.0375159165400003,
3.0426123945400003,
2.92105967154,
3.17063853054,
2.9211665135400002,
3.00279062154,
3.0557760705400003
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.67981176342,
"stddev": 0.16315028673177276,
"median": 4.63881750172,
"user": 2.13996782,
"system": 1.64087424,
"min": 4.46658541972,
"max": 4.9582558607200005,
"times": [
4.46658541972,
4.86072474372,
4.60671750672,
4.5155195707199995,
4.85391066472,
4.66368670572,
4.70523653072,
4.55353233372,
4.9582558607200005,
4.61394829772
]
},
{
"command": "pacquet@main",
"mean": 4.59188737842,
"stddev": 0.13850112032433692,
"median": 4.54931888772,
"user": 1.9663864200000003,
"system": 1.55714494,
"min": 4.46698340372,
"max": 4.93801106172,
"times": [
4.93801106172,
4.52373913972,
4.61600701672,
4.64504743372,
4.49935841472,
4.48154523972,
4.46698340372,
4.57489863572,
4.52297125072,
4.65031218772
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5536482069199997,
"stddev": 0.08523496386799231,
"median": 3.5394611632200004,
"user": 1.3166015199999999,
"system": 1.32861364,
"min": 3.44438396472,
"max": 3.73677901772,
"times": [
3.61194269472,
3.51992130072,
3.62680964572,
3.73677901772,
3.53548623572,
3.54343609072,
3.47670633672,
3.44438396472,
3.54762282272,
3.49339395972
]
},
{
"command": "pnpr@main",
"mean": 3.68838921382,
"stddev": 0.1965584898523472,
"median": 3.6952928062200003,
"user": 1.2481752199999998,
"system": 1.4678503399999996,
"min": 3.45791535972,
"max": 4.04502669572,
"times": [
3.6330996727200002,
3.45856877072,
3.62924420572,
4.04502669572,
3.81075916072,
3.45856869072,
3.78064059172,
3.45791535972,
3.85258305072,
3.75748593972
]
}
]
} |
The catalog-mode gate in installSome inlined the semver predicate twice. Naming it says what the comparison means — the catalog entry covers the wanted specifier — and states in one place why a wanted range never matches: only the catalog decides which version a `catalog:` reference resolves to. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Follow-up on the open question from my previous comment — I tried to implement the "move the catalog entry to the requested version, in the entry's own range style" behavior and it does not survive contact with the catalog model. Recording the measurements so the decision is made on facts. What I built and reverted. Keep the wanted version as the specifier (so resolution pins exactly it) and, in That makes the behavior on this branch — the catalog governs, the entry is left to the catalog's own resolution — the right one to ship here. Two things this turned up, both worth their own issue rather than this PR:
Also pushed: 1ca373b, extracting the gate's semver predicate into a named Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 1ca373b |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Collapsing the catalog-mode gate onto `catalogCovers` removed the `semver.eq` arm, which accepted an exactly-matching entry without redirecting the specifier to `catalog:`. For the default catalog that arm was already unreachable — parseWantedDependencies rewrites the specifier first — but a named catalog with an exact entry did reach it, and nothing in the suite pinned the outcome. The end state is unchanged: the manifest keeps its `catalog:<name>` reference and the importer entry resolves through the catalog. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
The named-catalog test landed directly under the comment naming the issue the range test regresses on, leaving the reference on the wrong test and the range test undocumented. Refs pnpm#13715 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Code review by qodo was updated up to the latest commit f3afc05 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
| Project | pnpm's project |
| Branch | pr/13716 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,415.66 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 298.22 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 292.51 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 88.82 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,350.83 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,444.38 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 258.94 ms |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
The bug
catalogMode: strictrejects a wanted version whenever the catalog entry for thatdependency is a semver range, even when the requested version falls squarely inside
that range.
The comparison in
mutateModules(inpnpm11/installing/deps-installer/src/install/index.ts)accepts a wanted dependency only when both the wanted specifier and the catalog specifier
are individually "valid" exact versions and equal to each other:
semver.valid()returns false for a range such as^7.22.17, which is the common,documented, recommended way to declare a catalog entry. So whenever the catalog entry
is a range, this condition can never succeed, regardless of whether the wanted version
actually satisfies that range. Every such comparison falls through to
CatalogVersionMismatchError.Minimal repro
Workspace with
catalogMode: strictand:{ "dependencies": { "is-positive": "catalog:" } }Running:
throws
ERR_PNPM_CATALOG_VERSION_MISMATCH, even though2.5.0satisfies^2.0.0.This blocks Renovate's pnpm artifact-update flow, which runs exactly this kind of
targeted update command, on every workspace using
catalogMode: strictwithrange-based catalog entries.
The fix
Add a second acceptance branch: when the catalog specifier is a valid range and the
wanted version satisfies it, accept the dependency instead of throwing.
This preserves all existing behavior for concrete-vs-concrete comparisons and for a
wanted specifier that is itself a range (both still correctly fall through to rejection,
since
semver.valid()on a range is still false). It only adds the missing "wantedversion satisfies the catalog range" case.
This behavior was introduced by #11706, which fixed a crash in this same comparison
(passing a range to
semver.eq()threwInvalid Version) but deliberately preservedthe reject-on-range behavior without addressing whether range satisfaction should
succeed. That question was raised in #11570's own "Expected Behavior" section and never
addressed. This PR closes that gap.
Tests
Added a test in
test/catalogs.tsright after the existingcatalog specifier as a range does not crash with catalogMode: stricttest (which isleft unchanged and still passes, since
1.0.0correctly does not satisfy^2.0.0).The new test uses a wanted version that does satisfy the range (
2.0.0against^2.0.0) undercatalogMode: strictand asserts the update resolves without throwing,with the correct version recorded in the lockfile.
Verification
Also ran the package's full test suite (excluding the network-dependent
test/install/deepRecursive.ts, which needs a real npm registry and fails offline onboth this branch and unmodified main) with
--runInBand, all 964 tests passing with noregressions.
Scope note
This only touches the TypeScript pnpm implementation. Per this project's own
pnpm/CONTRIBUTING.md, a correspondingpacquet(Rust) parity port should only be madeafter the TypeScript fix has landed and shipped, so that port is intentionally deferred
to a follow-up PR.
Written by an agent (Claude Code, claude-sonnet-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
Tests