Skip to content

fix(deps-installer): satisfy semver ranges under strict catalog mode - #13716

Merged
zkochan merged 5 commits into
pnpm:mainfrom
ByronDWall:fix/catalog-strict-range-satisfies
Aug 11, 2026
Merged

zkochan merged 5 commits into
pnpm:mainfrom
ByronDWall:fix/catalog-strict-range-satisfies

Conversation

@ByronDWall

@ByronDWall ByronDWall commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

The bug

catalogMode: strict rejects a wanted version whenever the catalog entry for that
dependency is a semver range, even when the requested version falls squarely inside
that range.

The comparison in mutateModules (in pnpm11/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(wantedDep.bareSpecifier) &&
semver.valid(catalogDepSpecifier) &&
semver.eq(wantedDep.bareSpecifier, catalogDepSpecifier)

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: strict and:

catalog:
  is-positive: ^2.0.0
{ "dependencies": { "is-positive": "catalog:" } }

Running:

pnpm update [email protected] --recursive --lockfile-only

throws ERR_PNPM_CATALOG_VERSION_MISMATCH, even though 2.5.0 satisfies ^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: strict with
range-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.

semver.valid(wantedDep.bareSpecifier) && (
  semver.valid(catalogDepSpecifier) && semver.eq(wantedDep.bareSpecifier, catalogDepSpecifier) ||
  semver.validRange(catalogDepSpecifier) && semver.satisfies(wantedDep.bareSpecifier, catalogDepSpecifier)
)

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 "wanted
version 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() threw Invalid Version) but deliberately preserved
the 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.ts right after the existing
catalog specifier as a range does not crash with catalogMode: strict test (which is
left unchanged and still passes, since 1.0.0 correctly does not satisfy ^2.0.0).
The new test uses a wanted version that does satisfy the range (2.0.0 against
^2.0.0) under catalogMode: strict and asserts the update resolves without throwing,
with the correct version recorded in the lockfile.

Verification

cd pnpm11/installing/deps-installer
npx tsgo --build
PNPM_REGISTRY_MOCK_PORT=7769 NODE_OPTIONS="--experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169" npx jest test/catalogs.ts
Test Suites: 1 passed, 1 total
Tests:       50 passed, 50 total
Snapshots:   0 total
Time:        3.913 s

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 on
both this branch and unmodified main) with --runInBand, all 964 tests passing with no
regressions.

Scope note

This only touches the TypeScript pnpm implementation. Per this project's own
pnpm/CONTRIBUTING.md, a corresponding pacquet (Rust) parity port should only be made
after 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).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Strict catalog mode now accepts package versions that satisfy configured semver ranges during additions and updates.
    • Compatible catalog references are preserved in manifests and lockfiles.
    • Versions outside configured ranges continue to be rejected.
    • Non-semver catalog specifications retain their existing behavior.
  • Tests

    • Added coverage for compatible and incompatible catalog ranges across installations, updates, workspaces, and lockfile resolutions.

@ByronDWall
ByronDWall requested a review from zkochan as a code owner August 7, 2026 19:15
Copilot AI lite review requested due to automatic review settings August 7, 2026 19:15
@welcome

welcome Bot commented Aug 7, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 75cd1aa4-c963-49b9-afa8-75dffd07f6f5

📥 Commits

Reviewing files that changed from the base of the PR and between 7d61aa5 and f3afc05.

📒 Files selected for processing (1)
  • pnpm11/installing/deps-installer/test/catalogs.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/installing/deps-installer/test/catalogs.ts

📝 Walkthrough

Walkthrough

Strict 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.

Changes

Strict catalog range satisfaction

Layer / File(s) Summary
Catalog range reconciliation
pnpm/crates/package-manager/src/catalog_mode.rs, pnpm/crates/package-manager/src/catalog_mode/tests.rs
Catalog matching evaluates whether a concrete wanted version satisfies the catalog range. Strict and Prefer modes reuse covered catalog entries, while out-of-range versions return a mismatch.
Installer catalog integration
pnpm11/installing/deps-installer/src/install/index.ts, pnpm11/installing/deps-installer/test/catalogs.ts
installSome reuses catalog specifiers for compatible pinned versions. Tests verify catalog references, updated ranges, project resolutions, and lockfile snapshots.
CLI validation and release metadata
pnpm/crates/cli/tests/suite/update.rs, .changeset/catalog-strict-range-satisfies.md
CLI tests cover strict updates inside and outside catalog ranges. The changeset records patch releases for the affected packages.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • pnpm/pnpm issue 13715: Addresses the same strict catalog range-matching behavior in installSome and catalog reconciliation.
  • pnpm/pnpm issue 11591: Covers related catalog reconciliation for concrete versions that satisfy catalog ranges.

Possibly related PRs

  • pnpm/pnpm#13723: Modifies the same catalog-matching logic and adds similar strict-mode tests.
  • pnpm/pnpm#13172: Modifies Rust catalog reconciliation and related strict-catalog tests.
  • pnpm/pnpm#13477: Modifies catalog range compatibility checks and catalog update logic.

Suggested labels: product: pacquet, product: pnpm@11

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (4): Last reviewed commit: "test(deps-installer): reattach the issue..." | Re-trigger Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

ByronDWall and others added 2 commits August 11, 2026 14:41
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]>
Copilot AI review requested due to automatic review settings August 11, 2026 13:15
@zkochan
zkochan force-pushed the fix/catalog-strict-range-satisfies branch from dac8d86 to 4ae907a Compare August 11, 2026 13:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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.

@zkochan

zkochan commented Aug 11, 2026

Copy link
Copy Markdown
Member

Rebased onto main and revised in 4ae907a. The PR description above still describes the original one-line fix; this comment supersedes its "The fix" section.

Why the original fix needed more than widening the comparison. Accepting the wanted version in installSome's catalog-mode gate only sets saveCatalogName. 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 Skip adding <pkg> to the default catalog because it already exists as <spec> and lets the resolved version be written to package.json. So the accepted dependency silently stopped using the catalog: pnpm add [email protected] against catalog: is-positive: ^2.0.0 ended with "is-positive": "2.0.0" in the manifest (the behavior the original test asserted), and pnpm update --recursive <pkg>@<version> would have rewritten every workspace manifest from catalog: to a pinned version — the outcome catalogMode: strict exists to prevent.

What it does now. When the catalog range covers the wanted version, the wanted specifier is rewritten to catalog: so the dependency resolves through the catalog. The manifest keeps its catalog: reference, the catalog stays the single place the version is declared, and a version outside the range is still rejected with ERR_PNPM_CATALOG_VERSION_MISMATCH. Verified end state for pnpm update <pkg>@<version> --recursive --lockfile-only under catalogMode: strict with a ^ catalog entry: manifests keep catalog:, the catalog entry and the lockfile catalogs/importers sections stay consistent, and a following frozen install passes.

pacquet parity. Ported in the same commit (details in the resolved review thread).

Tests. deps-installer/test/catalogs.ts 51/51 — the add-path test now asserts the catalog is used, and a new update-path test simulates the command from the linked issue. Both fail when the new branch is disabled. pacquet: catalog_mode units, pacquet-package-manager (578), cli catalog:: (15) and update:: (49) all pass.

Open question for review. The two stacks now agree on the essentials (no error, dependency stays on catalog:, resolution moves within the range) but differ in one field for a saving update <pkg>@<version>: pnpm re-renders the workspace catalog entry to the range's newest satisfying version (^1.0.0 → ^1.3.0, so an explicitly requested non-latest in-range version is not honored), while pacquet leaves the entry and moves only the locked version. --no-save leaves the entry alone in both. Worth settling before this lands; the pacquet test does not assert that field yet.


Written by an agent (Claude Code, claude-opus-5).

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pnpm11/installing/deps-installer/test/catalogs.ts (1)

1537-1537: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove 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 win

Assert 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.yaml as pacquet_lockfile::Lockfile and assert the default catalog entry has specifier == "^100.0.0" and version == "100.1.0". Also assert importer "." records specifier == "catalog:" and version == "100.1.0" for DEP.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between d25c634 and 4ae907a.

📒 Files selected for processing (6)
  • .changeset/catalog-strict-range-satisfies.md
  • pnpm/crates/cli/tests/suite/update.rs
  • pnpm/crates/package-manager/src/catalog_mode.rs
  • pnpm/crates/package-manager/src/catalog_mode/tests.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/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

@qodo-code-review

qodo-code-review Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2) 📜 Skill insights (0)

Grey Divider


Informational

1. addDependenciesToPackage missing trailing comma 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The new multi-line calls in the added test omit trailing commas, increasing diff noise and violating
the repo’s TypeScript trailing-comma requirement.
Code

pnpm11/installing/deps-installer/test/catalogs.ts[R1556-1557]

+        catalogMode: 'strict',
+      })
Relevance

● Weak

Similar trailing-comma request in multi-line addDependenciesToPackage test call was previously
rejected by reviewers.

PR-#13289
PR-#13803

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript constructs. In the new
test, the multi-line preparePackagesAndReturnObjects([{ ... }]) and `addDependenciesToPackage(...,
{ ... })` calls do not include a trailing comma after the final element/argument.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/test/catalogs.ts[1538-1543]
pnpm11/installing/deps-installer/test/catalogs.ts[1545-1557]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new test adds multi-line constructs that are missing trailing commas (e.g., multi-line function call argument list / multi-line array argument), which violates the trailing-comma compliance rule.

## Issue Context
This is in newly added test code under `pnpm11/installing/deps-installer/test/catalogs.ts`.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/catalogs.ts[1538-1557]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Historical phrasing in comment 📘 Rule violation ⚙ Maintainability
Description
A modified doc comment includes historical phrasing (before that fix) describing past behavior.
Inline comments must describe current behavior only; historical context should live in PR/commit
history or external docs.
Code

pnpm/crates/cli/tests/suite/update.rs[R1055-1057]

+/// ([pnpm#11706](https://github.com/pnpm/pnpm/pull/11706): before that
+/// fix, passing a range to the exact-version comparison threw `Invalid
+/// Version`).
Relevance

● Weak

Same repo/file precedent rejected removing “before the fix” historical phrasing in update.rs
comments.

PR-#13234

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The updated doc comment explicitly describes a previous implementation using the phrase `before that
fix`, which is disallowed by the checklist rule requiring comments to describe current behavior
only.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/cli/tests/suite/update.rs[1051-1057]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A modified doc comment includes historical phrasing (e.g., `before that fix`) describing prior behavior, which violates the rule that comments must describe current behavior rather than historical implementations.

## Issue Context
This is a test doc comment; the link/reference can be kept, but the wording should be reframed to describe the current contract (e.g., what is being asserted and why) without temporal language.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/update.rs[1051-1057]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Duplicate range processing 🐞 Bug ➹ Performance
Description
In mutateModules(), the new strict-catalog acceptance branch validates catalogDepSpecifier with
semver.validRange() and then separately calls semver.satisfies() with the original range string,
causing the range to be processed twice for each matching dependency. This is low-impact but
avoidable extra CPU work inside the per-dependency loop used by install/update flows.
Code

pnpm11/installing/deps-installer/src/install/index.ts[R1177-1180]

+          if (wantedVersion != null && semver.validRange(catalogDepSpecifier) != null && semver.satisfies(wantedVersion, catalogDepSpecifier)) {
+            // The catalog range covers the wanted version, so the dependency resolves through
+            // the catalog. Keeping the wanted version as the specifier would pin it in the
+            // manifest instead, dropping the project out of the catalog.
Relevance

● Weak

Repo has rejected similar semver micro-optimizations (avoid extra parsing/allocations) as low-value
churn.

PR-#13779

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new branch checks semver.validRange(catalogDepSpecifier) != null but then passes
catalogDepSpecifier again into semver.satisfies(...), meaning the semver library must interpret
the range twice in this path. This is inside the wantedDeps loop in mutateModules().

pnpm11/installing/deps-installer/src/install/index.ts[1154-1185]
REVIEW_GUIDE.md[18-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The new catalog acceptance branch does `validRange(...) != null` and then calls `satisfies(...)` with the original range string, which re-processes the range.

### Issue Context
This runs inside the `for (const wantedDep of wantedDeps)` loop in `mutateModules()`. Even if the overhead is small, it is easy to avoid and keeps the hot path lean.

### Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/index.ts[1167-1184]

### Suggested fix
Parse/normalize the catalog range once and reuse it for the satisfaction check.

One option (no try/catch):
- compute `const catalogRange = semver.validRange(catalogDepSpecifier)` once
- use that in the condition (and in `satisfies`)

If you want to truly avoid double parsing, use `new semver.Range(...)` once and `range.test(wantedVersion)` (and handle invalid ranges by skipping the branch).

Keep behavior the same (only accept when `wantedVersion` is a concrete version and the catalog specifier is a valid range that covers it).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit f3afc05

Results up to commit 4ae907a ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Informational
1. Historical phrasing in comment 📘 Rule violation ⚙ Maintainability
Description
A modified doc comment includes historical phrasing (before that fix) describing past behavior.
Inline comments must describe current behavior only; historical context should live in PR/commit
history or external docs.
Code

pnpm/crates/cli/tests/suite/update.rs[R1055-1057]

+/// ([pnpm#11706](https://github.com/pnpm/pnpm/pull/11706): before that
+/// fix, passing a range to the exact-version comparison threw `Invalid
+/// Version`).
Relevance

● Weak

Same repo/file precedent rejected removing “before the fix” historical phrasing in update.rs
comments.

PR-#13234

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The updated doc comment explicitly describes a previous implementation using the phrase `before that
fix`, which is disallowed by the checklist rule requiring comments to describe current behavior
only.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/cli/tests/suite/update.rs[1051-1057]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A modified doc comment includes historical phrasing (e.g., `before that fix`) describing prior behavior, which violates the rule that comments must describe current behavior rather than historical implementations.

## Issue Context
This is a test doc comment; the link/reference can be kept, but the wording should be reframed to describe the current contract (e.g., what is being asserted and why) without temporal language.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/update.rs[1051-1057]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Duplicate range processing 🐞 Bug ➹ Performance
Description
In mutateModules(), the new strict-catalog acceptance branch validates catalogDepSpecifier with
semver.validRange() and then separately calls semver.satisfies() with the original range string,
causing the range to be processed twice for each matching dependency. This is low-impact but
avoidable extra CPU work inside the per-dependency loop used by install/update flows.
Code

pnpm11/installing/deps-installer/src/install/index.ts[R1177-1180]

+          if (wantedVersion != null && semver.validRange(catalogDepSpecifier) != null && semver.satisfies(wantedVersion, catalogDepSpecifier)) {
+            // The catalog range covers the wanted version, so the dependency resolves through
+            // the catalog. Keeping the wanted version as the specifier would pin it in the
+            // manifest instead, dropping the project out of the catalog.
Relevance

● Weak

Repo has rejected similar semver micro-optimizations (avoid extra parsing/allocations) as low-value
churn.

PR-#13779

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new branch checks semver.validRange(catalogDepSpecifier) != null but then passes
catalogDepSpecifier again into semver.satisfies(...), meaning the semver library must interpret
the range twice in this path. This is inside the wantedDeps loop in mutateModules().

pnpm11/installing/deps-installer/src/install/index.ts[1154-1185]
REVIEW_GUIDE.md[18-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The new catalog acceptance branch does `validRange(...) != null` and then calls `satisfies(...)` with the original range string, which re-processes the range.

### Issue Context
This runs inside the `for (const wantedDep of wantedDeps)` loop in `mutateModules()`. Even if the overhead is small, it is easy to avoid and keeps the hot path lean.

### Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/index.ts[1167-1184]

### Suggested fix
Parse/normalize the catalog range once and reuse it for the satisfaction check.

One option (no try/catch):
- compute `const catalogRange = semver.validRange(catalogDepSpecifier)` once
- use that in the condition (and in `satisfies`)

If you want to truly avoid double parsing, use `new semver.Range(...)` once and `range.test(wantedVersion)` (and handle invalid ranges by skipping the branch).

Keep behavior the same (only accept when `wantedVersion` is a concrete version and the catalog specifier is a valid range that covers it).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@codecov-commenter

codecov-commenter commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.23%. Comparing base (d25c634) to head (f3afc05).
⚠️ Report is 2 commits behind head on main.

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.
📢 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.

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: f3afc05eb779

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.493 ± 0.157 2.337 2.730 1.70 ± 0.15
pacquet@main 2.486 ± 0.146 2.339 2.754 1.70 ± 0.15
pnpr@HEAD 1.465 ± 0.096 1.351 1.647 1.00
pnpr@main 1.473 ± 0.153 1.345 1.790 1.01 ± 0.12
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 245.4 ± 6.9 236.2 255.4 1.00
pacquet@main 253.7 ± 5.0 247.1 260.9 1.03 ± 0.04
pnpr@HEAD 265.7 ± 5.3 258.9 273.6 1.08 ± 0.04
pnpr@main 260.2 ± 6.5 250.2 272.0 1.06 ± 0.04
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.587 ± 0.022 2.569 2.644 1.60 ± 0.13
pacquet@main 2.585 ± 0.020 2.549 2.616 1.60 ± 0.13
pnpr@HEAD 1.631 ± 0.173 1.416 1.870 1.01 ± 0.14
pnpr@main 1.613 ± 0.134 1.439 1.808 1.00
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 409.2 ± 12.3 386.4 424.5 1.30 ± 0.08
pacquet@main 410.4 ± 27.4 372.2 464.5 1.31 ± 0.11
pnpr@HEAD 313.6 ± 17.8 292.5 344.9 1.00
pnpr@main 330.0 ± 22.3 301.9 365.5 1.05 ± 0.09
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.785 ± 0.039 1.729 1.846 5.41 ± 0.41
pacquet@main 1.739 ± 0.022 1.717 1.782 5.27 ± 0.39
pnpr@HEAD 0.330 ± 0.024 0.298 0.372 1.00
pnpr@main 0.382 ± 0.049 0.307 0.455 1.16 ± 0.17
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 244.1 ± 40.4 187.9 328.3 2.57 ± 0.43
pacquet@main 253.0 ± 34.5 214.1 326.2 2.67 ± 0.37
pnpr@HEAD 95.1 ± 3.9 88.8 105.5 1.00 ± 0.05
pnpr@main 94.9 ± 3.1 90.2 101.5 1.00
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.063 ± 0.254 0.736 1.493 1.15 ± 0.34
pacquet@main 0.926 ± 0.156 0.725 1.184 1.00
pnpm@HEAD 2.999 ± 0.087 2.913 3.171 3.24 ± 0.55
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.680 ± 0.163 4.467 4.958 1.32 ± 0.06
pacquet@main 4.592 ± 0.139 4.467 4.938 1.29 ± 0.05
pnpr@HEAD 3.554 ± 0.085 3.444 3.737 1.00
pnpr@main 3.688 ± 0.197 3.458 4.045 1.04 ± 0.06
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
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13716
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,568.54 ms
(-5.03%)Baseline: 2,704.51 ms
3,245.41 ms
(79.14%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,729.40 ms
(-4.52%)Baseline: 1,811.21 ms
2,173.45 ms
(79.57%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
386.38 ms
(-16.46%)Baseline: 462.51 ms
555.02 ms
(69.61%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
187.87 ms
(-20.35%)Baseline: 235.89 ms
283.06 ms
(66.37%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,337.01 ms
(-5.14%)Baseline: 2,463.69 ms
2,956.43 ms
(79.05%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,466.59 ms
(-1.50%)Baseline: 4,534.69 ms
5,441.62 ms
(82.08%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
236.21 ms
(-21.48%)Baseline: 300.81 ms
360.97 ms
(65.44%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
735.93 ms
(-0.66%)Baseline: 740.82 ms
888.99 ms
(82.78%)
🐰 View full continuous benchmarking report in Bencher

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]>
Copilot AI review requested due to automatic review settings August 11, 2026 14:00
@greptile-apps
greptile-apps Bot dismissed their stale review August 11, 2026 14:00

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 11, 2026

Copy link
Copy Markdown
Member

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 resolveDependencyTree, re-render a covering catalog entry to the resolved version with calcVersionRange. It produces the intended result for the targeted project — manifest catalog:, entry ^1.0.0 → ^1.1.0, lockfile version 1.1.0 — but on a two-project workspace whose catalog was locked at 1.0.0, the sibling project keeps its locked 1.0.0, which no longer satisfies the new entry. Siblings are not re-resolved because forgetResolutionsOfPrevWantedDeps compares against the catalogs config as it stands before resolution changes it. Narrowing the entry to the exact version instead keeps every importer consistent, but silently turns a workspace's ^ range into a pin. So a per-project request for a specific in-range version is not expressible while the entry stays a range: the entry declares one range and resolves to one version for every importer.

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:

  1. Under catalogMode: strict, pnpm add <pkg>@<in-range version> against a catalog entry already locked at an older version is a silent no-op: nothing re-resolves, so the requested version is neither installed nor rejected. Measured on catalog ^1.0.0 locked at 1.0.0 with add @pnpm.e2e/[email protected] — lockfile and pnpm-workspace.yaml both unchanged. Arguably it should re-resolve the entry, or say it cannot honor the request.
  2. The stacks differ on when a catalog entry is rewritten, and it is not specific to this fix: pnpm re-renders the entry on a saving add/update of a cataloged dependency, while pacquet only does so for update --latest — a plain pacquet update <pkg> leaves ^100.0.0 in place and moves only the locked version. Which policy wins is a parity decision that spans the whole catalog-update path.

Also pushed: 1ca373b, extracting the gate's semver predicate into a named catalogCovers helper (no behavior change).


Written by an agent (Claude Code, claude-opus-5).

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 11, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1ca373b

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

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]>
Copilot AI review requested due to automatic review settings August 11, 2026 14:22
@greptile-apps
greptile-apps Bot dismissed their stale review August 11, 2026 14:22

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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]>
Copilot AI review requested due to automatic review settings August 11, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit f3afc05

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13716
Testbedpnpr

⚠️ 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-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,415.66 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
298.22 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.51 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
88.82 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,350.83 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,444.38 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
258.94 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 676324f into pnpm:main Aug 11, 2026
35 of 37 checks passed
@welcome

welcome Bot commented Aug 11, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants