Skip to content

fix(pacquet): close the Resolution / verification install-parity gaps - #13172

Merged
zkochan merged 9 commits into
mainfrom
install-parity
Jul 20, 2026
Merged

zkochan merged 9 commits into
mainfrom
install-parity

Conversation

@zkochan

@zkochan zkochan commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes every item in the Resolution / verification section of #13167 (related to that tracking issue; the other sections remain open). All six items are pacquet-side parity work — the TypeScript CLI already implements these behaviors, so no TS changes are needed.

  1. Semver strictness edge cases — pacquet-package-is-installable now implements npm-semver's includePrerelease: true semantics exactly instead of a strip-the-prerelease approximation: a fully specified comparator keeps pure semver ordering, so 9.0.0-alpha.1 no longer satisfies >=9.0.0 (upstream checkEngine.ts:34) while still satisfying 9, >=9, ^9.0.0, and now also <9.0.0. The known_failures boundary became a real unit test plus sibling pins.
  2. minimumReleaseAge non-strict fallback — the resolver fallback (highest mature pick, else lowest match regardless of maturity) and the non-strict proceed path already existed; the stub predated them. It is now the real port of minimumReleaseAge.ts:68: a non-strict pnpm add @pnpm.e2e/[email protected] under an all-immature cutoff completes and pins the lowest matching version.
  3. Catalog cleanup — ported cleanupUnusedCatalogs: a new (workspace-yaml-only, default false) setting; the workspace-manifest writer drops catalog entries no importer references (default catalog via bare catalog:, named catalogs via catalog:<name> or bare catalog:, catalog:-valued overrides: count as references, emptied blocks and files are removed); add, update, and remove run the pass in the same write that persists updated catalog entries. The removeCatalogs.test.ts suite is ported at the writer level and the CLI stub became an end-to-end test.
  4. engineStrict per-edge optionality (pacquet: engineStrict does not fail on an incompatible regular dependency inside an optional subtree #13143) — installability now dispatches per inbound lockfile edge instead of the propagated snapshot-level optional flag: an incompatible package with a regular edge from an installed parent fails under engineStrict (warns and materializes without it) even when it is also optionally reachable; packages reachable only through optional edges or skipped parents are still skipped. Ports optionalDependencies.ts:552.
  5. Peer resolution gaps — (a) auto-installed peers wanted under distinct but compatible ranges now resolve through their semver intersection (2 + ^2.2.0 → >=2.2.0 <3.0.0-0, the upstream mergePkgsDeps/safeIntersect policy); (b) resolve_peers carries the upstream lockedPeerContext / resolvedPeerProviderPaths machinery (tree-node fields, resolved_peer_provider_paths option, paths_by_node_id output, the full reuse guard chain including must-win), ported with the two-pass unit tests from resolvePeers.ts's locked-provider suite. All three pacquet-cli::peer_resolution stubs are converted; that file is gone.
  6. Peer-hoisting fixtures — added local [email protected] + [email protected] fixtures to the registry mock (and claimed both names in REGISTRY_MOCK_LOCAL_PATTERNS so they stop proxying to npm), then ported hoist.ts:320 and :327. The peer-variant private hoist itself already worked — the stubs only recorded the fixture gap.

Still needs porting (follow-ups called out in code and TEST_PORTING.md)

  • The install-path wiring for locked peer providers: capturing lockedPeerContext / previousDepPath from the wanted lockfile, computing dependencyNamesWhoseCurrentProviderMustWin from the lockfile-vs-resolved child diff, and running the gated second resolve_peers pass. The must-win sibling cases from upstream's locked-provider suite port together with that wiring.
  • The hoisted-linker walker still keys its own skip decision on the snapshot flag; under engineStrict the compute pass errors first, but a non-strict hoisted install still skips rather than materializes a required-incompatible package.

Squash Commit Body

Close the Resolution / verification section of pnpm/pnpm#13167
(related to pnpm/pnpm#13167; other sections remain open).

- package-is-installable: implement npm-semver includePrerelease
  semantics exactly — per-||-alternative evaluation with pure ordering
  at fully specified comparators, the stripped-prerelease fallback for
  expanded ranges. >=9.0.0 now rejects 9.0.0-alpha.1 (checkEngine.ts:34).
- cli: port the non-strict minimumReleaseAge immature-version fallback
  test (minimumReleaseAge.ts:68); the resolver fallback already existed.
- config/workspace-manifest-writer/package-manager: port
  cleanupUnusedCatalogs — new workspace-yaml setting (default false),
  writer-side unused-entry removal mirroring
  removePackagesFromWorkspaceCatalog (dep + overrides references,
  emptied blocks and files dropped), wired into add/update/remove via a
  shared catalog_cleanup helper that loads the workspace projects and
  substitutes in-memory manifests.
- package-manager: dispatch engineStrict per inbound lockfile edge
  (pnpm/pnpm#13143) — a walk from the importers classifies skip
  candidates by whether a non-optional edge from an installed source
  reaches them; required incompatible snapshots fail under engineStrict
  and warn+materialize without it; optional-only and
  behind-skipped-parent snapshots keep skipping; unreachable snapshots
  keep the propagated-flag dispatch. Ports optionalDependencies.ts:552.
- resolving-deps-resolver: intersect distinct compatible auto-install
  peer ranges via node-semver Range::intersect (mergePkgsDeps policy),
  and port the lockedPeerContext / resolvedPeerProviderPaths machinery
  into resolve_peers (tree-node fields, resolved_peer_provider_paths
  option, paths_by_node_id output, reuse guards incl. must-win) with
  the two-pass locked-provider unit tests. Install-path wiring
  (lockfile capture + gated second pass) is a follow-up.
- pnpr/cli: add local [email protected] + [email protected] fixtures, claim
  the names in REGISTRY_MOCK_LOCAL_PATTERNS, and port hoist.ts:320/:327
  (peer-variant private hoist + uninstall).

All eight known-failure stubs of the section are converted into real
ports and TEST_PORTING.md is updated. Four changesets target pacquet.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting. (Pacquet-side parity work; the TypeScript CLI already implements all six behaviors. Remaining pacquet follow-ups are listed above.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note. (Four changesets, all targeting pacquet.)
  • Added or updated tests.
  • Updated the documentation if needed. (No docs changes: cleanupUnusedCatalogs and the other behaviors are already documented on pnpm.io.)

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


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Peer auto-installation now resolves compatible version ranges using their semver intersection.
    • Added optional cleanup of unused workspace catalog entries during add, update, and remove.
    • Improved reuse and hoisting of compatible peer providers.
  • Bug Fixes

    • Engine checks now handle prerelease versions consistently with npm semver behavior.
    • Strict engine validation correctly reports incompatible regular dependencies, including through optional dependency paths.
    • Non-strict minimum release-age checks now fall back to matching immature versions when necessary.

zkochan added 8 commits July 20, 2026 11:05
…nge bounds

Port npm-semver's `includePrerelease: true` semantics instead of
approximating them with a strip-the-prerelease fallback. A fully
specified comparator (`>=9.0.0`, `<9.0.0`, a bare exact, or a
`^`/`~` spec that itself carries a prerelease) keeps pure semver
ordering, so `9.0.0-alpha.1` no longer satisfies `>=9.0.0` while
still satisfying `9`, `>=9`, `^9.0.0`, and now also `<9.0.0`.

For prerelease versions the range is evaluated per `||` alternative:
the strict check first, then either a pure-ordering interval check
(when a comparator pins the version's own base triple) or the
stripped-prerelease fallback. Release versions keep the byte-for-byte
strict path.

Converts the `known_failures` boundary
`pnpm_is_a_prerelease_version_strict_ge_full_version_does_not_satisfy`
into a real unit test (upstream `checkEngine.ts:34`) and pins the
newly exact behaviors with sibling tests.
…lback

The resolver-side fallback (highest mature pick, else lowest match
regardless of maturity) and the non-strict proceed path already exist;
the known-failure boundary predated them. Replace the stub with the
real port of `minimumReleaseAge.ts:68`: under a cutoff that makes
every version immature, a non-strict `pnpm add @pnpm.e2e/[email protected]`
completes and pins the lowest matching version (1.0.0), which normal
resolution would never pick.
Port pnpm's `cleanupUnusedCatalogs`: when the setting is enabled,
`add`, `update`, and `remove` run an unused-catalog cleanup pass in
the same workspace-manifest write that persists updated catalog
entries. The writer drops default-catalog entries no importer
references with `catalog:`, named-catalog entries referenced by
neither `catalog:<name>` nor `catalog:`, entries referenced only
through removed dependencies, and whole blocks (or the file) once they
empty — while keeping entries referenced by `catalog:`-valued
`overrides:`.

The setting is read from `pnpm-workspace.yaml` only, mirroring the
TypeScript CLI (it is not part of pnpm's npmrc types). The writer-level
port covers the `removeCatalogs.test.ts` suite; the CLI flow replaces
the `cleanup_unused_catalogs` known-failure stub.
…oviders

Two peer-resolution parity gaps:

- merge_ranges now reduces distinct compatible wanted ranges to their
  semver intersection through node-semver's Range::intersect (the
  upstream mergePkgsDeps / safeIntersect policy), falling back to the
  or-join only under autoInstallPeersFromHighestMatch and dropping the
  peer only when no intersection exists.

- resolve_peers carries the upstream lockedPeerContext /
  resolvedPeerProviderPaths machinery: tree nodes gained
  previous_dep_path, locked_peer_context, and
  dependency_names_whose_current_provider_must_win; the options gained
  resolved_peer_provider_paths plus the must-win guard inputs; results
  expose paths_by_node_id. A second pass re-pins a locked provider
  when it is still reachable, resolved to the same path, unsuffixed,
  inside the current peer range, and not overridden by a current
  provider that must win. The install-path wiring (capturing the
  locked context from the wanted lockfile and running the second pass)
  is a follow-up.

Converts the three pacquet-cli peer_resolution known-failure stubs
into real ports: the resolvePeers.ts intersection case and the two
locked-peer-provider preference cases.
Port hoist.ts:320 (should hoist correctly peer dependencies) and
hoist.ts:327 (should uninstall correctly peer dependencies): local
[email protected] and [email protected] fixtures give the registry mock
upstream's peer-variant shape, and REGISTRY_MOCK_LOCAL_PATTERNS now
claims both names so the proxy no longer forwards them to npm. The
peer-variant private hoist itself already worked; the stubs only
recorded the fixture gap. Both tests pin enableGlobalVirtualStore
off because write_workspace_yaml drops the harness default.
Installability now classifies each snapshot by its inbound edges over
the lockfile graph instead of the propagated snapshot-level optional
flag, mirroring pnpm's resolve-time packageIsInstallable dispatch
(#13143):

- an incompatible snapshot whose every inbound edge is an
  optionalDependencies edge, or comes from a skipped parent, is
  skipped as before;
- an incompatible snapshot with at least one regular edge from an
  installed importer or non-skipped snapshot fails the install under
  engineStrict — and without engineStrict warns and materializes
  instead of being silently skipped — even when it is also optionally
  reachable;
- unreachable snapshots keep the propagated-flag dispatch.

Converts the edge_aware_engine_strict known-failure stub into the real
port of optionalDependencies.ts:552 (fail on unsupported dependency of
optional dependency) and adds edge-aware unit coverage for the fail,
skip, and multi-edge shapes.
Copilot AI review requested due to automatic review settings July 20, 2026 11:27

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 Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@zkochan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b2b77185-2550-4ec5-9128-df796e582c52

📥 Commits

Reviewing files that changed from the base of the PR and between c1da235 and 7b86dfa.

📒 Files selected for processing (5)
  • pnpm/crates/package-manager/src/installability.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
  • pnpm/crates/workspace-manifest-writer/src/edit.rs
  • pnpm/crates/workspace-manifest-writer/src/tests.rs
📝 Walkthrough

Walkthrough

Changes

Workspace catalog cleanup

Layer / File(s) Summary
Configuration and manifest writer
pnpm/crates/config/..., pnpm/crates/workspace-manifest-writer/...
Adds cleanupUnusedCatalogs, collects catalog references, and removes unused default or named entries.
Package-manager integration
pnpm/crates/package-manager/...
Routes add, update, and remove operations through shared catalog-writing helpers.
Validation and release notes
pnpm/crates/cli/tests/catalog.rs, pnpm/crates/workspace-manifest-writer/src/tests.rs, .changeset/...
Converts catalog cleanup coverage to passing tests and documents the behavior.

Installability and engine checks

Layer / File(s) Summary
Prerelease engine semantics
pnpm/crates/package-is-installable/...
Implements npm-semver-compatible prerelease handling and adds boundary tests.
Edge-aware installability
pnpm/crates/package-manager/src/installability.rs, pnpm/crates/package-manager/src/install_*
Classifies snapshots by lockfile reachability and required versus optional edges.
Integration coverage
pnpm/crates/package-manager/src/installability/tests.rs, pnpm/crates/cli/tests/...
Adds engine-strict edge tests and activates minimum-release-age fallback coverage.

Peer resolution and hoisting

Layer / File(s) Summary
Peer range intersection
pnpm/crates/resolving-deps-resolver/src/resolve_importer*
Resolves compatible peer requests using their semver intersection.
Locked provider reuse
pnpm/crates/resolving-deps-resolver/src/resolve_peers*, resolved_tree.rs
Carries provider paths and locked contexts through peer resolution with current-provider precedence.
Hoisting and fixtures
pnpm/crates/cli/tests/hoist.rs, pnpr/.fixtures/...
Adds peer-variant hoisting and uninstall tests with AJV fixtures.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#12202 — Overlaps the workspace manifest writer and catalog update path.
  • pnpm/pnpm#13109 — Overlaps locked peer-provider reuse and provider precedence logic.
  • pnpm/pnpm#13141 — Overlaps optional-dependency installability and skipped-snapshot reachability.

Suggested labels: product: pacquet, product: pnpr

Suggested reviewers: copilot

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch install-parity

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

fix(pacquet): close Resolution/verification install-parity gaps with pnpm

🐞 Bug fix ✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Ports six pnpm behaviors pacquet previously stubbed as known failures: prerelease engine-check
 semantics, minimumReleaseAge non-strict fallback, cleanupUnusedCatalogs, edge-aware
 engineStrict, auto-installed peer range intersection, and
 lockedPeerContext/resolvedPeerProviderPaths peer reuse.
• Reimplements satisfies_with_prerelease to match npm-semver's includePrerelease: true exactly,
 rejecting prereleases at fully-specified range bounds (e.g. 9.0.0-alpha.1 no longer satisfies
 >=9.0.0).
• Adds a cleanupUnusedCatalogs config setting and workspace-manifest writer pass that drops
 unreferenced catalog entries during add/update/remove.
• Reworks compute_skipped_snapshots to walk the lockfile dependency graph and dispatch
 engineStrict per inbound edge (regular vs. optional) instead of per snapshot's propagated
 optional flag.
• Extends resolve_peers with semver-range intersection for auto-installed peers and
 locked-peer-provider reuse machinery (locked_peer_context, resolved_peer_provider_paths,
 paths_by_node_id).
• Converts several known_failures test stubs into real unit/integration tests, and removes the
 now-obsolete known_failures.rs/peer_resolution.rs stub files.
Diagram

graph TD
    A["pnpm add / update / remove"] --> B["catalog_cleanup writer"] --> C["pnpm-workspace.yaml"]
    A --> D["resolve_peers"] --> E["locked-peer-provider reuse"]
    D --> F["merge_ranges: semver intersection"]
    A --> G["compute_skipped_snapshots"] --> H["walk_lockfile_edges"] --> I["engineStrict per-edge dispatch"]
    G --> J["check_engine: includePrerelease"]

    subgraph Legend
      direction LR
      _svc([Service]) ~~~ _db[(Data file)]
    end
Loading
High-Level Assessment

The PR is a faithful, incremental port of well-defined upstream pnpm behaviors, each backed by an existing TS reference implementation and a corresponding test; there's no meaningfully different architectural approach to consider since the goal is byte-for-byte parity with pnpm's existing semantics.

Files changed (42) +2058 / -353

Enhancement (12) +739 / -54
add.rsWire cleanupUnusedCatalogs into add command +21/-12

Wire cleanupUnusedCatalogs into add command

• Switches 'add' to use the new 'write_workspace_catalogs'/'write_workspace_catalogs_selected' helpers that also run the cleanup pass on write.

pnpm/crates/package-manager/src/add.rs

catalog_cleanup.rsNew shared catalog-cleanup write helpers +150/-0

New shared catalog-cleanup write helpers

• Adds 'write_workspace_catalogs'/'write_workspace_catalogs_selected' which merge updated catalogs and run the 'cleanupUnusedCatalogs' pass in a single manifest write, shared across add/update/remove.

pnpm/crates/package-manager/src/catalog_cleanup.rs

install_frozen_lockfile.rsPass importers into compute_skipped_snapshots +1/-0

Pass importers into compute_skipped_snapshots

• Updates the call site to pass the lockfile importers map required by the new edge-aware installability walk.

pnpm/crates/package-manager/src/install_frozen_lockfile.rs

install_with_fresh_lockfile.rsPass importers into compute_skipped_snapshots +1/-0

Pass importers into compute_skipped_snapshots

• Updates the fresh-lockfile install path call site to pass importers to the new edge-aware installability check.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

lib.rsRegister new catalog_cleanup module +1/-0

Register new catalog_cleanup module

• Adds the 'catalog_cleanup' module declaration.

pnpm/crates/package-manager/src/lib.rs

remove.rsWire cleanupUnusedCatalogs into remove command +19/-2

Wire cleanupUnusedCatalogs into remove command

• Runs the catalog-cleanup write pass after persisting the manifest during 'remove', for both single-project and workspace-selected flows.

pnpm/crates/package-manager/src/remove.rs

update.rsWire cleanupUnusedCatalogs into update command +26/-16

Wire cleanupUnusedCatalogs into update command

• Switches 'update' to the shared 'write_workspace_catalogs' helpers so cleanup always runs on save regardless of whether catalogs changed.

pnpm/crates/package-manager/src/update.rs

resolve_importer.rsSemver intersection for compatible peer ranges +26/-14

Semver intersection for compatible peer ranges

• Adds 'intersect_ranges' using node-semver's 'Range::intersect' and wires it into 'merge_ranges' so distinct compatible peer ranges resolve through their intersection instead of only exact matches.

pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs

resolve_peers.rsAdd locked-peer-provider reuse machinery +269/-5

Add locked-peer-provider reuse machinery

• Adds 'resolved_peer_provider_paths'/'paths_by_node_id' options and output, a reverse index over previous dep paths, and 'apply_locked_peer_context'/'has_current_peer_provider_that_must_win' implementing upstream's locked-peer-provider reuse and must-win guard logic.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs

resolved_tree.rsAdd locked-peer-context fields to DependenciesTreeNode +46/-0

Add locked-peer-context fields to DependenciesTreeNode

• Adds 'previous_dep_path', 'locked_peer_context', and 'dependency_names_whose_current_provider_must_win' fields plus a 'new' constructor for 'DependenciesTreeNode'.

pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs

edit.rsImplement remove_unused_catalogs editing pass +114/-0

Implement remove_unused_catalogs editing pass

• Adds 'remove_unused_catalogs'/'remove_unused_default_catalog'/'remove_unused_named_catalogs' that format-preservingly drop catalog entries and blocks with no remaining references.

pnpm/crates/workspace-manifest-writer/src/edit.rs

lib.rsAdd UpdateWorkspaceManifestOptions and cleanup wiring +65/-5

Add UpdateWorkspaceManifestOptions and cleanup wiring

• Replaces the flat 'updated_catalogs' argument with an options struct, adds 'collect_catalog_references' to build the reference map from project manifests and overrides, and runs the cleanup pass in 'update_workspace_manifest'.

pnpm/crates/workspace-manifest-writer/src/lib.rs

Bug fix (2) +349 / -92
check_engine.rsReimplement npm-semver includePrerelease semantics for engine checks +118/-30

Reimplement npm-semver includePrerelease semantics for engine checks

• Replaces the strip-prerelease approximation with a per-comparator pure-ordering evaluation that matches npm-semver's 'includePrerelease: true', fixing prerelease acceptance at fully specified bounds.

pnpm/crates/package-is-installable/src/check_engine.rs

installability.rsEdge-aware engineStrict dispatch over the lockfile graph +231/-62

Edge-aware engineStrict dispatch over the lockfile graph

• Reworks 'compute_skipped_snapshots' to walk lockfile edges from importers, classify each snapshot's inbound edges as optional/required, and dispatch engineStrict per edge rather than per snapshot's propagated optional flag.

pnpm/crates/package-manager/src/installability.rs

Refactor (2) +3 / -12
resolve_dependency_tree.rsUse DependenciesTreeNode::new constructor +2/-12

Use DependenciesTreeNode::new constructor

• Replaces struct-literal node construction with the new 'DependenciesTreeNode::new' helper in two call sites.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

resolve_workspace.rsUse ResolvePeersOptions default for new fields +1/-0

Use ResolvePeersOptions default for new fields

• Spreads 'ResolvePeersOptions::default()' to pick up the new locked-peer-provider fields without needing to specify them explicitly.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs

Tests (16) +920 / -185
catalog.rsPort cleanupUnusedCatalogs CLI test +26/-12

Port cleanupUnusedCatalogs CLI test

• Replaces the known-failure stub with a real end-to-end test asserting unused catalog entries are removed from pnpm-workspace.yaml during 'pnpm add'.

pnpm/crates/cli/tests/catalog.rs

hoist.rsPort peer-variant hoisting tests +77/-27

Port peer-variant hoisting tests

• Adds real 'should_hoist_correctly_peer_dependencies' and 'should_uninstall_correctly_peer_dependencies' tests using new ajv/ajv-keywords fixtures, replacing the previous known-failure stubs.

pnpm/crates/cli/tests/hoist.rs

lockfile_verification.rsPort non-strict minimumReleaseAge fallback test +39/-12

Port non-strict minimumReleaseAge fallback test

• Replaces the known-failure stub with a real end-to-end test verifying the resolver falls back to the lowest matching immature version under non-strict minimumReleaseAge.

pnpm/crates/cli/tests/lockfile_verification.rs

optional_dependencies.rsPort engineStrict edge-aware failure test +24/-20

Port engineStrict edge-aware failure test

• Moves the 'fail_on_unsupported_dependency_of_optional_dependency' test out of known_failures into a real passing test now that engineStrict dispatches per edge.

pnpm/crates/cli/tests/optional_dependencies.rs

peer_resolution.rsRemove obsolete peer resolution known-failure stub file +0/-31

Remove obsolete peer resolution known-failure stub file

• Deletes the file entirely since its known-failure tests are now implemented and ported elsewhere.

pnpm/crates/cli/tests/peer_resolution.rs

tests.rsTest cleanupUnusedCatalogs config loading +11/-0

Test cleanupUnusedCatalogs config loading

• Adds a unit test confirming 'cleanupUnusedCatalogs' loads from pnpm-workspace.yaml and defaults to false.

pnpm/crates/config/src/tests.rs

check_engine.rsAdd unit tests for prerelease engine-range semantics +63/-7

Add unit tests for prerelease engine-range semantics

• Adds tests pinning the strict '>='/'<'/'^' prerelease boundary behaviors, converting the former known-failure case into a real test.

pnpm/crates/package-is-installable/src/tests/check_engine.rs

known_failures.rsRemove obsolete known-failures integration test file +0/-61

Remove obsolete known-failures integration test file

• Deletes the file since its boundary test is now a real passing unit test elsewhere.

pnpm/crates/package-is-installable/tests/known_failures.rs

tests.rsUpdate test to use DependenciesTreeNode::new constructor +6/-6

Update test to use DependenciesTreeNode::new constructor

• Adjusts a test fixture to use the new 'DependenciesTreeNode::new' constructor instead of struct literal construction.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

tests.rsAdd cleanup_unused_catalogs field to test config fixture +1/-0

Add cleanup_unused_catalogs field to test config fixture

• Updates the test config constructor to include the new 'cleanup_unused_catalogs' field.

pnpm/crates/package-manager/src/install_package_from_registry/tests.rs

tests.rsAdd tests for edge-aware installability dispatch +259/-1

Add tests for edge-aware installability dispatch

• Adds importer/snapshot graph test fixtures and new tests covering regular-edge-wins-over-optional-reachability and skipped-parent scenarios for engineStrict.

pnpm/crates/package-manager/src/installability/tests.rs

tests.rsTest peer range intersection resolution +62/-0

Test peer range intersection resolution

• Adds a test proving auto-installed peers wanted under '2' and '^2.2.0' resolve through their intersected range.

pnpm/crates/resolving-deps-resolver/src/resolve_importer/tests.rs

tests.rsPort locked-peer-provider reuse tests +160/-6

Port locked-peer-provider reuse tests

• Adds a 'locked_peer_provider_preferences' test module porting upstream's locked-provider reuse and out-of-range rejection scenarios across two resolution passes.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs

tests.rsPort removeCatalogs.test.ts suite at the writer level +181/-2

Port removeCatalogs.test.ts suite at the writer level

• Adds a 'remove_unused_catalogs' test module porting the upstream 'removeCatalogs.test.ts' cases against the format-preserving writer output.

pnpm/crates/workspace-manifest-writer/src/tests.rs

package.jsonAdd ajv-keywords registry-mock fixture +7/-0

Add ajv-keywords registry-mock fixture

• New fixture package.json for [email protected] declaring a peer dependency on ajv, used by the ported hoist peer-dependency tests.

pnpr/.fixtures/packages/ajv-keywords/1.5.0/package.json

package.jsonAdd ajv registry-mock fixture +4/-0

Add ajv registry-mock fixture

• New fixture package.json for [email protected] used as the peer-resolved sibling in the hoist tests.

pnpr/.fixtures/packages/ajv/4.10.4/package.json

Documentation (5) +27 / -7
pacquet-auto-install-peer-intersection.mdChangeset: peer range intersection for auto-installed peers +5/-0

Changeset: peer range intersection for auto-installed peers

• Adds a patch changeset describing the new semver-intersection behavior for auto-installed peers under distinct compatible ranges.

.changeset/pacquet-auto-install-peer-intersection.md

pacquet-cleanup-unused-catalogs.mdChangeset: cleanupUnusedCatalogs setting +5/-0

Changeset: cleanupUnusedCatalogs setting

• Adds a minor changeset documenting the new 'cleanupUnusedCatalogs' setting for add/update/remove.

.changeset/pacquet-cleanup-unused-catalogs.md

pacquet-edge-aware-engine-strict.mdChangeset: edge-aware engineStrict +5/-0

Changeset: edge-aware engineStrict

• Adds a patch changeset documenting the edge-aware engineStrict dispatch behavior.

.changeset/pacquet-edge-aware-engine-strict.md

pacquet-engine-prerelease-bounds.mdChangeset: engine prerelease bound semantics +5/-0

Changeset: engine prerelease bound semantics

• Adds a patch changeset documenting the corrected prerelease/engine-range semantics.

.changeset/pacquet-engine-prerelease-bounds.md

TEST_PORTING.mdUpdate test-porting tracker for closed known-failures +7/-7

Update test-porting tracker for closed known-failures

• Marks the six ported Resolution/verification items as done, replacing known-failure boundary references with pointers to the real tests.

pnpm/plans/TEST_PORTING.md

Other (5) +20 / -3
Cargo.lockAdd new crate dependencies to lockfile +2/-0

Add new crate dependencies to lockfile

• Adds 'pacquet-config-parse-overrides' and 'pacquet-package-manifest' as dependencies of the workspace-manifest-writer crate.

Cargo.lock

lib.rsAdd cleanup_unused_catalogs config field +6/-0

Add cleanup_unused_catalogs config field

• Introduces the 'cleanup_unused_catalogs' boolean field on 'Config', defaulting to false.

pnpm/crates/config/src/lib.rs

workspace_yaml.rsParse cleanupUnusedCatalogs from workspace yaml +6/-1

Parse cleanupUnusedCatalogs from workspace yaml

• Adds the 'cleanup_unused_catalogs' field to 'WorkspaceSettings' and wires it into the settings-merge destructuring.

pnpm/crates/config/src/workspace_yaml.rs

Cargo.tomlAdd new crate dependencies for catalog reference parsing +3/-1

Add new crate dependencies for catalog reference parsing

• Adds 'pacquet-config-parse-overrides' and 'pacquet-package-manifest' dependencies needed by the cleanup-unused-catalogs pass.

pnpm/crates/workspace-manifest-writer/Cargo.toml

config.rsRegister ajv/ajv-keywords in local registry-mock patterns +3/-1

Register ajv/ajv-keywords in local registry-mock patterns

• Adds 'ajv' and 'ajv-keywords' to the list of package names resolved from the local registry mock instead of upstream npm.

pnpr/crates/pnpr/src/config.rs

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.00     11.4±0.30ms    32.8 MB/sec    1.00     11.4±0.07ms    32.7 MB/sec
packument/parse                1.03     38.9±0.23µs  1706.9 MB/sec    1.00     37.6±0.25µs  1764.5 MB/sec
tarball/download_dependency    1.00      2.3±0.07ms  1913.7 KB/sec    1.03      2.3±0.10ms  1861.2 KB/sec

@qodo-code-review

qodo-code-review Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Catalog refs over-allocated 🐞 Bug ➹ Performance ⭐ New
Description
collect_catalog_references() stores every dependency specifier string for every project even
though catalog cleanup only checks for membership of catalog: / catalog:<name>. This causes
unnecessary string allocations and set growth during cleanupUnusedCatalogs runs in large
workspaces.
Code

pnpm/crates/workspace-manifest-writer/src/lib.rs[R166-180]

+fn collect_catalog_references(
+    all_projects: &[&PackageManifest],
+    manifest: &Manifest,
+) -> edit::CatalogReferences {
+    const GROUPS: [DependencyGroup; 4] = [
+        DependencyGroup::Prod,
+        DependencyGroup::Dev,
+        DependencyGroup::Optional,
+        DependencyGroup::Peer,
+    ];
+    let mut references = edit::CatalogReferences::new();
+    for project in all_projects {
+        for (name, specifier) in project.dependencies(GROUPS) {
+            references.entry(name.to_string()).or_default().insert(specifier.to_string());
+        }
Evidence
The reference collector inserts every specifier, but the cleanup code only tests for catalog
specifiers (catalog: and catalog:<name>). Therefore non-catalog specifiers do not contribute to
any cleanup decision and are wasted allocations.

pnpm/crates/workspace-manifest-writer/src/lib.rs[166-190]
pnpm/crates/workspace-manifest-writer/src/edit.rs[223-234]
pnpm/crates/workspace-manifest-writer/src/edit.rs[252-263]

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

### Issue description
`collect_catalog_references()` currently inserts *all* dependency specifiers into `CatalogReferences`, but the cleanup phase only needs to know whether a package has a `catalog:` or `catalog:<name>` reference.

### Issue Context
`remove_unused_catalogs()` checks `refs.contains("catalog:")` or `refs.contains("catalog:<name>")` only.

### Fix Focus Areas
- pnpm/crates/workspace-manifest-writer/src/lib.rs[166-190]
- pnpm/crates/workspace-manifest-writer/src/edit.rs[223-233]

### Proposed fix
In the `for (name, specifier)` loop, only insert `specifier` into `references` when `specifier.starts_with("catalog:")`. (Workspace `overrides` are already filtered this way.) This preserves behavior while cutting allocations and memory use.

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


2. Duplicate semver intersection helper 📘 Rule violation ⚙ Maintainability ⭐ New
Description
intersect_ranges() duplicates existing safe_intersect() range-intersection logic, increasing
maintenance burden and risking behavioral drift. This violates the requirement to reuse or extract
shared utilities instead of reimplementing similar logic in multiple places.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[R668-680]

+/// Semver intersection of every range, rendered in `node-semver`'s
+/// canonical form (`2` ∩ `^2.2.0` → `>=2.2.0 <3.0.0-0`, the same shape
+/// the `semver-range-intersect` npm package emits upstream). `None`
+/// when a range fails to parse or the ranges share no versions,
+/// mirroring `safeIntersect`'s caught-throw `null`.
+fn intersect_ranges(ranges: &[&str]) -> Option<String> {
+    let mut iter = ranges.iter();
+    let first = Range::parse(iter.next()?).ok()?;
+    iter.try_fold(first, |acc, range| {
+        Range::parse(range).ok().and_then(|range| acc.intersect(&range))
+    })
+    .map(|range| range.to_string())
+}
Evidence
PR Compliance ID 3 requires reusing or extracting shared utilities instead of duplicating logic. The
newly added intersect_ranges() performs the same parse-and-fold intersection as the existing
safe_intersect() helper, indicating avoidable duplication.

CLAUDE.md: Avoid Code Duplication by Reusing or Extracting Shared Utilities and Prefer Established Dependencies
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[668-680]
pnpm/crates/napi/src/install.rs[888-902]

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

## Issue description
`pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs` introduces `intersect_ranges()` which duplicates the existing semver-range intersection helper `safe_intersect()` in `pnpm/crates/napi/src/install.rs`.

## Issue Context
The repo already has a helper that parses semver ranges and folds intersections, returning `None` on parse failure or empty intersection. Duplicating this logic increases the risk that one copy diverges from the other.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[668-680]
- pnpm/crates/napi/src/install.rs[888-902]

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


3. Unneeded workspace scan 🐞 Bug ➹ Performance ⭐ New
Description
With cleanupUnusedCatalogs enabled, load_cleanup_projects() always enumerates workspace projects
via find_workspace_projects() even when pnpm-workspace.yaml has no catalog/catalogs blocks,
making cleanup a no-op but still paying the full discovery cost. This adds avoidable filesystem and
manifest parsing overhead to hot commands on large monorepos.
Code

pnpm/crates/package-manager/src/catalog_cleanup.rs[R112-128]

+/// Every project manifest under `workspace_dir`, read from disk. An
+/// absent `pnpm-workspace.yaml` yields no projects, which disables the
+/// cleanup pass — there is no workspace manifest to clean either.
+fn load_cleanup_projects(
+    workspace_dir: &Path,
+) -> Result<Vec<Project>, WriteWorkspaceCatalogsError> {
+    let Some(workspace_manifest) = read_workspace_manifest(workspace_dir)
+        .map_err(WriteWorkspaceCatalogsError::ReadWorkspaceManifest)?
+    else {
+        return Ok(Vec::new());
+    };
+    let opts = FindWorkspaceProjectsOpts {
+        patterns: Some(workspace_package_patterns(&workspace_manifest)),
+    };
+    find_workspace_projects(workspace_dir, &opts)
+        .map_err(WriteWorkspaceCatalogsError::FindWorkspaceProjects)
+}
Evidence
load_cleanup_projects() unconditionally discovers projects once pnpm-workspace.yaml exists,
regardless of whether it has any catalogs to clean. The workspace manifest type already carries
catalog/catalogs, and the cleanup implementation only acts when those sections exist, so the
scan is wasted when both are absent.

pnpm/crates/package-manager/src/catalog_cleanup.rs[112-128]
pnpm/crates/workspace/src/manifest.rs[49-58]
pnpm/crates/workspace-manifest-writer/src/edit.rs[227-255]

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

### Issue description
When `cleanupUnusedCatalogs` is enabled, `load_cleanup_projects()` always calls `find_workspace_projects()`. If the workspace manifest exists but contains neither `catalog` nor `catalogs`, the writer cleanup cannot remove anything, so scanning projects is pure overhead.

### Issue Context
`WorkspaceManifest` exposes `catalog`/`catalogs` presence. The cleanup logic in `workspace-manifest-writer` only removes entries when those blocks exist.

### Fix Focus Areas
- pnpm/crates/package-manager/src/catalog_cleanup.rs[112-128]

### Proposed fix
After reading `workspace_manifest`, short-circuit `Ok(Vec::new())` when `workspace_manifest.catalog.is_none() && workspace_manifest.catalogs.is_none()` (and keep existing `None`-file behavior). This avoids `find_workspace_projects()` when cleanup is guaranteed to be a no-op.

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


View more (3)
4. Redundant upstream counterpart comment ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new doc comment on CurrentProviderSource only states it matches an upstream type, which is
history/restatement rather than non-obvious rationale. This adds maintenance noise and violates the
repo’s comment requirements.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R599-602]

+/// One importer whose direct dependencies count as "current" peer
+/// providers for the must-win guard of locked-peer-provider reuse.
+/// Same name and shape as its upstream counterpart.
+struct CurrentProviderSource {
Evidence
PR Compliance ID 5 requires comments to add non-obvious rationale and forbids history/restatement.
The added comment explicitly says the struct has the same name/shape as upstream without documenting
a contract or rationale.

AGENTS.md: Comments Must Add Non-Obvious Rationale (Do Not Restate Code or History)
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[599-606]

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 newly-added doc comment only says a type is the same as an upstream counterpart, which is historical context and doesn’t add non-obvious rationale.

## Issue Context
Compliance requires comments to add rationale/contracts, not restate history.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[599-602]

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


5. Edge walk repeats node work ✓ Resolved 🐞 Bug ➹ Performance
Description
walk_lockfile_edges() computes skip_candidate (including without_peer() key construction and
cached lookups) before checking whether the node is already installed, so nodes reached by many
inbound edges still pay repeated per-queue-item overhead. This can add measurable install-time
overhead on large lockfiles with shared dependencies.
Code

pnpm/crates/package-manager/src/installability.rs[R658-683]

+    while let Some((key, edge_optional)) = pending.pop_front() {
+        let metadata_key = key.without_peer();
+        let skip_candidate = match packages.get(&metadata_key) {
+            Some(metadata) => {
+                cached_check(check_cache, &metadata_key, metadata, true, base_options)?.is_some()
+            }
+            None => false,
+        };
+        let newly_installed = if skip_candidate {
+            if edge_optional {
+                false
+            } else {
+                required.insert(key);
+                installed.insert(key)
+            }
+        } else {
+            installed.insert(key)
+        };
+        if newly_installed {
+            for (target, child_edge_optional) in snapshot_edges(&snapshots[key]) {
+                if let Some((child, _)) = snapshots.get_key_value(&target) {
+                    pending.push_back((child, child_edge_optional));
+                }
+            }
+        }
+    }
Evidence
The loop computes metadata_key and calls cached_check(...) to determine skip_candidate before
installed.insert(key) decides whether this node is newly installed; repeated queue entries for the
same node therefore still do this work even when installed already contains the node.

pnpm/crates/package-manager/src/installability.rs[651-683]

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

### Issue description
In `walk_lockfile_edges()`, the loop computes `skip_candidate` (via `cached_check`) before determining whether the `key` is already in `installed`. For graphs where the same snapshot is reached from multiple installed parents, later queue entries still perform `without_peer()` cloning and cache/hash lookups even though the node is already installed.

### Issue Context
The expensive part (`check_installability`) is cached, but the remaining per-entry work (key derivation, hash lookups, branching) still occurs for every queued inbound edge.

### Fix Focus Areas
- pnpm/crates/package-manager/src/installability.rs[651-683]

### Suggested fix
- Add an early guard after popping `pending` to skip processing when `installed.contains(key)` is already true.
- Ensure semantics are preserved for the one important state transition: a skip-candidate first seen via optional edges must still be able to become `required` (and installed/expanded) when a later non-optional edge is encountered; once a node is in `installed`, later edges cannot change that classification, so skipping is safe.
- (Optional) Consider deduping `pending` entries by tracking a per-node state (e.g., unseen/seen_optional/installed) to reduce queue churn on very large graphs.

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


6. paths_by_node_id always computed ✓ Resolved 📘 Rule violation ➹ Performance
Description
Peer resolution now always builds paths_by_node_id (an O(n) map allocation/iteration over walked
nodes) even when callers don’t need locked-peer-provider reuse output, adding overhead on a hot
path. In-repo usage is currently only in tests, suggesting this work should be gated behind an
explicit option or made lazy/optional.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R544-546]

    let mut graph = walker.build_final_graph(&final_dep_paths);
+    let paths_by_node_id = walker.final_paths_by_node_id(&final_dep_paths);
Evidence
PR Compliance ID 13 requires performance-conscious looping practices and avoiding unnecessary
repeated work. The new code always computes paths_by_node_id, and the only shown consumer is in
tests where it’s fed into resolved_peer_provider_paths for a second pass.

AGENTS.md: Async and Looping Practices: Prefer async/await and Parallelize Independent Work
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[544-565]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[854-886]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs[2119-2146]

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

## Issue description
`paths_by_node_id` is computed unconditionally during peer resolution, adding extra allocation and iteration even when no caller consumes it.

## Issue Context
Peer resolution is a hot path; avoid work that’s not required for the current invocation.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[544-565]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[854-886]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs[2119-2146]

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



Informational

7. Prerelease range parsed twice 🐞 Bug ➹ Performance
Description
For prerelease host versions, satisfies_with_prerelease() parses the full range string and then
ignores that Range, reparsing each || alternative again. This adds redundant CPU work during
engine checks on prerelease hosts.
Code

pnpm/crates/package-is-installable/src/check_engine.rs[R163-177]

fn satisfies_with_prerelease(version: &Version, wanted_range: &str) -> bool {
    let Ok(range) = Range::parse(wanted_range) else {
        // Match upstream `semver.satisfies` returning `false` for
        // an unparsable range rather than throwing.
        return false;
    };
+    if version.pre_release.is_empty() {
+        // The strict check only diverges from `includePrerelease: true`
+        // on prerelease versions.
+        return range.satisfies(version);
+    }
+    wanted_range
+        .split("||")
+        .any(|alternative| alternative_satisfies_prerelease(version, alternative.trim()))
+}
Evidence
The function parses wanted_range into range, but for prerelease versions returns early into a
split("||") path that never uses range, meaning the full parse is redundant work.

pnpm/crates/package-is-installable/src/check_engine.rs[163-177]

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

### Issue description
`satisfies_with_prerelease()` calls `Range::parse(wanted_range)` unconditionally, but when `version` is a prerelease it does not use the parsed `Range` and instead parses each `||` alternative again. This is unnecessary extra parsing work.

### Issue Context
This function runs for every package with an `engines` constraint during installability checks; the prerelease branch is only taken when the current engine version is a prerelease.

### Fix Focus Areas
- pnpm/crates/package-is-installable/src/check_engine.rs[163-177]

### Suggested fix
- Move the `Range::parse(wanted_range)` call inside the `if version.pre_release.is_empty()` branch.
- In the prerelease branch, skip parsing the full range string and rely on per-alternative parsing (or otherwise restructure to reuse parsing without requiring the discarded full-range parse).

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


Grey Divider

Previous review results

Review updated until commit 7b86dfa

Results up to commit c1da235 ⚖️ Balanced


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


Remediation recommended
1. Redundant upstream counterpart comment ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new doc comment on CurrentProviderSource only states it matches an upstream type, which is
history/restatement rather than non-obvious rationale. This adds maintenance noise and violates the
repo’s comment requirements.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R599-602]

+/// One importer whose direct dependencies count as "current" peer
+/// providers for the must-win guard of locked-peer-provider reuse.
+/// Same name and shape as its upstream counterpart.
+struct CurrentProviderSource {
Evidence
PR Compliance ID 5 requires comments to add non-obvious rationale and forbids history/restatement.
The added comment explicitly says the struct has the same name/shape as upstream without documenting
a contract or rationale.

AGENTS.md: Comments Must Add Non-Obvious Rationale (Do Not Restate Code or History)
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[599-606]

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 newly-added doc comment only says a type is the same as an upstream counterpart, which is historical context and doesn’t add non-obvious rationale.

## Issue Context
Compliance requires comments to add rationale/contracts, not restate history.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[599-602]

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


2. Edge walk repeats node work ✓ Resolved 🐞 Bug ➹ Performance
Description
walk_lockfile_edges() computes skip_candidate (including without_peer() key construction and
cached lookups) before checking whether the node is already installed, so nodes reached by many
inbound edges still pay repeated per-queue-item overhead. This can add measurable install-time
overhead on large lockfiles with shared dependencies.
Code

pnpm/crates/package-manager/src/installability.rs[R658-683]

+    while let Some((key, edge_optional)) = pending.pop_front() {
+        let metadata_key = key.without_peer();
+        let skip_candidate = match packages.get(&metadata_key) {
+            Some(metadata) => {
+                cached_check(check_cache, &metadata_key, metadata, true, base_options)?.is_some()
+            }
+            None => false,
+        };
+        let newly_installed = if skip_candidate {
+            if edge_optional {
+                false
+            } else {
+                required.insert(key);
+                installed.insert(key)
+            }
+        } else {
+            installed.insert(key)
+        };
+        if newly_installed {
+            for (target, child_edge_optional) in snapshot_edges(&snapshots[key]) {
+                if let Some((child, _)) = snapshots.get_key_value(&target) {
+                    pending.push_back((child, child_edge_optional));
+                }
+            }
+        }
+    }
Evidence
The loop computes metadata_key and calls cached_check(...) to determine skip_candidate before
installed.insert(key) decides whether this node is newly installed; repeated queue entries for the
same node therefore still do this work even when installed already contains the node.

pnpm/crates/package-manager/src/installability.rs[651-683]

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

### Issue description
In `walk_lockfile_edges()`, the loop computes `skip_candidate` (via `cached_check`) before determining whether the `key` is already in `installed`. For graphs where the same snapshot is reached from multiple installed parents, later queue entries still perform `without_peer()` cloning and cache/hash lookups even though the node is already installed.

### Issue Context
The expensive part (`check_installability`) is cached, but the remaining per-entry work (key derivation, hash lookups, branching) still occurs for every queued inbound edge.

### Fix Focus Areas
- pnpm/crates/package-manager/src/installability.rs[651-683]

### Suggested fix
- Add an early guard after popping `pending` to skip processing when `installed.contains(key)` is already true.
- Ensure semantics are preserved for the one important state transition: a skip-candidate first seen via optional edges must still be able to become `required` (and installed/expanded) when a later non-optional edge is encountered; once a node is in `installed`, later edges cannot change that classification, so skipping is safe.
- (Optional) Consider deduping `pending` entries by tracking a per-node state (e.g., unseen/seen_optional/installed) to reduce queue churn on very large graphs.

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


3. paths_by_node_id always computed ✓ Resolved 📘 Rule violation ➹ Performance
Description
Peer resolution now always builds paths_by_node_id (an O(n) map allocation/iteration over walked
nodes) even when callers don’t need locked-peer-provider reuse output, adding overhead on a hot
path. In-repo usage is currently only in tests, suggesting this work should be gated behind an
explicit option or made lazy/optional.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R544-546]

    let mut graph = walker.build_final_graph(&final_dep_paths);
+    let paths_by_node_id = walker.final_paths_by_node_id(&final_dep_paths);
Evidence
PR Compliance ID 13 requires performance-conscious looping practices and avoiding unnecessary
repeated work. The new code always computes paths_by_node_id, and the only shown consumer is in
tests where it’s fed into resolved_peer_provider_paths for a second pass.

AGENTS.md: Async and Looping Practices: Prefer async/await and Parallelize Independent Work
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[544-565]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[854-886]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs[2119-2146]

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

## Issue description
`paths_by_node_id` is computed unconditionally during peer resolution, adding extra allocation and iteration even when no caller consumes it.

## Issue Context
Peer resolution is a hot path; avoid work that’s not required for the current invocation.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[544-565]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[854-886]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs[2119-2146]

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



Informational
4. Prerelease range parsed twice 🐞 Bug ➹ Performance
Description
For prerelease host versions, satisfies_with_prerelease() parses the full range string and then
ignores that Range, reparsing each || alternative again. This adds redundant CPU work during
engine checks on prerelease hosts.
Code

pnpm/crates/package-is-installable/src/check_engine.rs[R163-177]

fn satisfies_with_prerelease(version: &Version, wanted_range: &str) -> bool {
    let Ok(range) = Range::parse(wanted_range) else {
        // Match upstream `semver.satisfies` returning `false` for
        // an unparsable range rather than throwing.
        return false;
    };
+    if version.pre_release.is_empty() {
+        // The strict check only diverges from `includePrerelease: true`
+        // on prerelease versions.
+        return range.satisfies(version);
+    }
+    wanted_range
+        .split("||")
+        .any(|alternative| alternative_satisfies_prerelease(version, alternative.trim()))
+}
Evidence
The function parses wanted_range into range, but for prerelease versions returns early into a
split("||") path that never uses range, meaning the full parse is redundant work.

pnpm/crates/package-is-installable/src/check_engine.rs[163-177]

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

### Issue description
`satisfies_with_prerelease()` calls `Range::parse(wanted_range)` unconditionally, but when `version` is a prerelease it does not use the parsed `Range` and instead parses each `||` alternative again. This is unnecessary extra parsing work.

### Issue Context
This function runs for every package with an `engines` constraint during installability checks; the prerelease branch is only taken when the current engine version is a prerelease.

### Fix Focus Areas
- pnpm/crates/package-is-installable/src/check_engine.rs[163-177]

### Suggested fix
- Move the `Range::parse(wanted_range)` call inside the `if version.pre_release.is_empty()` branch.
- In the prerelease branch, skip parsing the full range string and rely on per-alternative parsing (or otherwise restructure to reuse parsing without requiring the discarded full-range parse).

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


Qodo Logo

@codecov-commenter

codecov-commenter commented Jul 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.56911% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.46%. Comparing base (331c26a) to head (7b86dfa).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/package-manager/src/catalog_cleanup.rs 68.18% 28 Missing ⚠️
...rates/resolving-deps-resolver/src/resolve_peers.rs 88.02% 20 Missing ⚠️
pnpm/crates/package-manager/src/installability.rs 97.63% 3 Missing ⚠️
.../crates/package-is-installable/src/check_engine.rs 96.29% 2 Missing ⚠️
pnpm/crates/package-manager/src/remove.rs 71.42% 2 Missing ⚠️
pnpm/crates/workspace-manifest-writer/src/lib.rs 92.59% 2 Missing ⚠️
pnpm/crates/workspace-manifest-writer/src/edit.rs 98.80% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13172      +/-   ##
==========================================
+ Coverage   86.44%   86.46%   +0.02%     
==========================================
  Files         508      509       +1     
  Lines       85078    85644     +566     
==========================================
+ Hits        73542    74056     +514     
- Misses      11536    11588      +52     

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

@qodo-code-review

qodo-code-review Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Scope named catalog references correctly

Scope named catalog references strictly to catalog:. Remove the bare catalog:
check for named catalogs to ensure unused entries are correctly cleaned up.

pnpm/crates/workspace-manifest-writer/src/edit.rs [258-263]

 let scoped = format!("catalog:{name}");
 let to_remove: Vec<String> = entries
     .keys()
-    .filter(|pkg| !is_referenced(references, pkg, &[scoped.as_str(), "catalog:"]))
+    .filter(|pkg| !is_referenced(references, pkg, &[scoped.as_str()]))
     .cloned()
     .collect();

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: This suggestion fixes a bug where bare catalog: references incorrectly prevent the removal of unused named catalog entries during the cleanup process.

Medium
  • Update

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs (1)

651-666: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Prefer iterator checks over heap allocation for uniqueness.

Collecting the ranges into a BTreeSet just to check if they are all identical incurs an unnecessary heap allocation and tree traversal. You can achieve the exact same fast-path validation using iterators with zero allocations.

♻️ Proposed refactor
 fn merge_ranges(ranges: &[&str], auto_install_peers_from_highest_match: bool) -> Option<String> {
-    if ranges.len() == 1 {
-        return Some(ranges[0].to_string());
-    }
-    let unique: BTreeSet<&&str> = ranges.iter().collect();
-    if unique.len() == 1 {
-        return Some(ranges[0].to_string());
+    let first = ranges.first()?;
+    if ranges.iter().all(|r| r == first) {
+        return Some(first.to_string());
     }
     if let Some(intersection) = intersect_ranges(ranges) {
🤖 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/resolving-deps-resolver/src/resolve_importer.rs` around lines 651
- 666, Update merge_ranges to replace the BTreeSet allocation and uniqueness
check with an iterator-based all-equal validation against the first range,
preserving the existing single-range and subsequent intersection/fallback
behavior.
🤖 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.

Inline comments:
In `@pnpm/crates/workspace-manifest-writer/src/edit.rs`:
- Around line 271-304: Guard the partial named-catalog removal in
remove_unused_named_catalogs with has_line_entries(manifest.text(), &[BLOCK])
before calling remove_mapping_entries or mutating manifest.catalogs. If the
top-level catalogs mapping has no line entries, skip the removal and leave the
decoded model unchanged; preserve the existing full-block removal and line-style
partial-removal behavior.

---

Nitpick comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs`:
- Around line 651-666: Update merge_ranges to replace the BTreeSet allocation
and uniqueness check with an iterator-based all-equal validation against the
first range, preserving the existing single-range and subsequent
intersection/fallback behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ef0217f5-b7fc-4778-bfdd-309483559364

📥 Commits

Reviewing files that changed from the base of the PR and between b92edcb and c1da235.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (41)
  • .changeset/pacquet-auto-install-peer-intersection.md
  • .changeset/pacquet-cleanup-unused-catalogs.md
  • .changeset/pacquet-edge-aware-engine-strict.md
  • .changeset/pacquet-engine-prerelease-bounds.md
  • pnpm/crates/cli/tests/catalog.rs
  • pnpm/crates/cli/tests/hoist.rs
  • pnpm/crates/cli/tests/lockfile_verification.rs
  • pnpm/crates/cli/tests/optional_dependencies.rs
  • pnpm/crates/cli/tests/peer_resolution.rs
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/tests.rs
  • pnpm/crates/config/src/workspace_yaml.rs
  • pnpm/crates/package-is-installable/src/check_engine.rs
  • pnpm/crates/package-is-installable/src/tests/check_engine.rs
  • pnpm/crates/package-is-installable/tests/known_failures.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/catalog_cleanup.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/package-manager/src/install_frozen_lockfile.rs
  • pnpm/crates/package-manager/src/install_package_from_registry/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/installability.rs
  • pnpm/crates/package-manager/src/installability/tests.rs
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm/crates/package-manager/src/remove.rs
  • pnpm/crates/package-manager/src/update.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs
  • pnpm/crates/workspace-manifest-writer/Cargo.toml
  • pnpm/crates/workspace-manifest-writer/src/edit.rs
  • pnpm/crates/workspace-manifest-writer/src/lib.rs
  • pnpm/crates/workspace-manifest-writer/src/tests.rs
  • pnpm/plans/TEST_PORTING.md
  • pnpr/.fixtures/packages/ajv-keywords/1.5.0/package.json
  • pnpr/.fixtures/packages/ajv/4.10.4/package.json
  • pnpr/crates/pnpr/src/config.rs
💤 Files with no reviewable changes (2)
  • pnpm/crates/cli/tests/peer_resolution.rs
  • pnpm/crates/package-is-installable/tests/known_failures.rs

@greptile-apps

greptile-apps Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge; all six ported behaviors have unit tests, the graph-walk edge classification is correct, and the follow-up gaps are clearly documented with TODO markers.

Each of the six changes faithfully replicates the upstream TypeScript logic: the semver rewrite handles all edge cases tested by the ported suite, the installability graph walk correctly classifies required vs. optional-only snapshots, and the catalog cleanup pass correctly bifurcates partial vs. full catalog removal. No data-loss or incorrect-skipping paths were found.

No files require special attention; the TODO-marked incomplete paths in resolved_tree.rs fields and importer_provider_sources are correctly inert until the follow-up install-path wiring lands.

Reviews (2): Last reviewed commit: "fix(pacquet): address automated review f..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: c1da235c8163

Each scenario reports direct installs and pnpr installs. 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.505 ± 0.140 2.395 2.794 1.63 ± 0.17
pacquet@main 2.458 ± 0.143 2.354 2.717 1.60 ± 0.17
pnpr@HEAD 1.535 ± 0.135 1.373 1.771 1.00
pnpr@main 1.540 ± 0.173 1.346 1.792 1.00 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5053254963200002,
      "stddev": 0.14046047364723224,
      "median": 2.4466754346200004,
      "user": 1.6099251400000003,
      "system": 1.2890645799999998,
      "min": 2.39469560162,
      "max": 2.7941786206200003,
      "times": [
        2.5540549186200003,
        2.39797358862,
        2.44051286562,
        2.4130796506200003,
        2.4855178166200003,
        2.7941786206200003,
        2.71203756362,
        2.45283800362,
        2.39469560162,
        2.40836633362
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.4577474004200006,
      "stddev": 0.1431331203377652,
      "median": 2.3836612541200006,
      "user": 1.58790824,
      "system": 1.32887418,
      "min": 2.3539670316200003,
      "max": 2.71728407362,
      "times": [
        2.54165053962,
        2.35796997562,
        2.3771907926200004,
        2.4073678986200004,
        2.70012441162,
        2.3614915996200003,
        2.3539670316200003,
        2.3702959656200004,
        2.3901317156200004,
        2.71728407362
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.53453219742,
      "stddev": 0.13507729760460405,
      "median": 1.49899908862,
      "user": 1.08669914,
      "system": 1.1741667799999997,
      "min": 1.37259052862,
      "max": 1.77109269562,
      "times": [
        1.4653026876200002,
        1.46480918262,
        1.67250537962,
        1.48704684562,
        1.53156529962,
        1.51095133162,
        1.3758005766199999,
        1.77109269562,
        1.37259052862,
        1.69365744662
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5403046237200002,
      "stddev": 0.173178533229495,
      "median": 1.5418067046200001,
      "user": 1.08001094,
      "system": 1.1714841799999998,
      "min": 1.34633700562,
      "max": 1.7916276956200001,
      "times": [
        1.36892793062,
        1.5674100936200002,
        1.51620331562,
        1.7319137736199999,
        1.7459022796199999,
        1.58919259562,
        1.34633700562,
        1.7916276956200001,
        1.3943520736200001,
        1.35117947362
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 265.2 ± 22.0 246.3 315.2 1.02 ± 0.09
pacquet@main 259.9 ± 6.6 248.9 273.9 1.00
pnpr@HEAD 275.7 ± 5.8 266.8 284.0 1.06 ± 0.03
pnpr@main 265.7 ± 12.5 247.6 284.6 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.26521059188,
      "stddev": 0.02200857789254783,
      "median": 0.25604557658000004,
      "user": 0.20890734000000002,
      "system": 0.5330733,
      "min": 0.24632326508000002,
      "max": 0.31524855708000005,
      "times": [
        0.29039116408000004,
        0.27328361008,
        0.31524855708000005,
        0.24632326508000002,
        0.25206306508000004,
        0.24972788808000002,
        0.26227265708,
        0.25611822708000004,
        0.25070455908,
        0.25597292608
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25991954588,
      "stddev": 0.006569763323414971,
      "median": 0.26047632408,
      "user": 0.21323264000000003,
      "system": 0.5256284,
      "min": 0.24886367708,
      "max": 0.27394119308000003,
      "times": [
        0.26125911708,
        0.27394119308000003,
        0.25560480508,
        0.24886367708,
        0.26021171308,
        0.25860137408,
        0.26366242108000004,
        0.25451693508,
        0.26074093508,
        0.26179328808
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27565409948,
      "stddev": 0.005797638291701841,
      "median": 0.27565960458000005,
      "user": 0.21708794,
      "system": 0.5441265000000001,
      "min": 0.26680715708,
      "max": 0.28403153108,
      "times": [
        0.27178689408,
        0.27904071408000003,
        0.27349077908,
        0.26680715708,
        0.27387858508,
        0.28249953908000003,
        0.27744062408000003,
        0.26818124408,
        0.27938392708000004,
        0.28403153108
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26571780378000004,
      "stddev": 0.012548829077037558,
      "median": 0.26325736758000007,
      "user": 0.21008683999999994,
      "system": 0.515796,
      "min": 0.24758129308000001,
      "max": 0.28458688108,
      "times": [
        0.27995548808000004,
        0.28458688108,
        0.26145887108000004,
        0.25559611008,
        0.27865504108,
        0.27174106908,
        0.24758129308000001,
        0.25991460608,
        0.26505586408000004,
        0.25263281408
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.785 ± 0.012 2.767 2.802 1.76 ± 0.14
pacquet@main 2.732 ± 0.016 2.702 2.754 1.72 ± 0.14
pnpr@HEAD 1.586 ± 0.127 1.445 1.834 1.00
pnpr@main 1.625 ± 0.155 1.430 1.831 1.02 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7851395274600006,
      "stddev": 0.012334942373460361,
      "median": 2.7843258310600003,
      "user": 1.76014208,
      "system": 1.3545740399999997,
      "min": 2.76744687056,
      "max": 2.8017377475600003,
      "times": [
        2.7868508915600003,
        2.76744687056,
        2.7807365665600003,
        2.8009143345600003,
        2.7892775375600003,
        2.77692347656,
        2.76865069756,
        2.79705638156,
        2.7818007705600003,
        2.8017377475600003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7322622332599997,
      "stddev": 0.016074552301182158,
      "median": 2.73209181256,
      "user": 1.7056403799999997,
      "system": 1.3335892399999998,
      "min": 2.7016454695600003,
      "max": 2.75436939256,
      "times": [
        2.7488622785600003,
        2.75436939256,
        2.73211518156,
        2.7255727655600004,
        2.7186144905600003,
        2.72196959056,
        2.74724399356,
        2.7320684435600002,
        2.74016072656,
        2.7016454695600003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.58622702366,
      "stddev": 0.12718196243451307,
      "median": 1.55855291056,
      "user": 1.05359518,
      "system": 1.24968664,
      "min": 1.44517604456,
      "max": 1.83355951656,
      "times": [
        1.44517604456,
        1.56323641956,
        1.83355951656,
        1.57735074756,
        1.48437711756,
        1.54327751756,
        1.78068714556,
        1.5538694015599999,
        1.60600077256,
        1.47473555356
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6245479511599998,
      "stddev": 0.15529839333636197,
      "median": 1.5965582985599998,
      "user": 1.08844368,
      "system": 1.18997904,
      "min": 1.4299687885599999,
      "max": 1.8312804945599999,
      "times": [
        1.8312804945599999,
        1.49429761356,
        1.4299687885599999,
        1.52761217156,
        1.72047706056,
        1.43918696756,
        1.59829811456,
        1.5948184825599998,
        1.8060614605599998,
        1.80347835756
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 634.0 ± 18.1 611.8 669.4 2.06 ± 0.08
pacquet@main 570.8 ± 25.5 526.9 613.6 1.86 ± 0.10
pnpr@HEAD 320.3 ± 10.3 305.0 337.9 1.04 ± 0.04
pnpr@main 307.1 ± 7.9 301.0 326.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.63400493254,
      "stddev": 0.01814903995285125,
      "median": 0.63037099754,
      "user": 0.7622448599999999,
      "system": 0.7191572799999999,
      "min": 0.6118396660400001,
      "max": 0.66939445304,
      "times": [
        0.63640619604,
        0.6118396660400001,
        0.61499777504,
        0.64495547204,
        0.63125468904,
        0.65484839504,
        0.61854127804,
        0.66939445304,
        0.62832409504,
        0.62948730604
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.57084907274,
      "stddev": 0.025450474546728812,
      "median": 0.57867774804,
      "user": 0.70497316,
      "system": 0.66269198,
      "min": 0.52686150204,
      "max": 0.61361359104,
      "times": [
        0.58681484604,
        0.61361359104,
        0.58804915004,
        0.54655961704,
        0.55770426704,
        0.57778757504,
        0.57956792104,
        0.52686150204,
        0.54878844404,
        0.58274381404
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32031521343999997,
      "stddev": 0.0103347297538154,
      "median": 0.31892390954,
      "user": 0.19592595999999998,
      "system": 0.5781951800000001,
      "min": 0.30499430804,
      "max": 0.33790804604,
      "times": [
        0.31593937404,
        0.31965857704,
        0.31101298004,
        0.30499430804,
        0.33258348404,
        0.33790804604,
        0.32470469604,
        0.32725278204,
        0.31090864504,
        0.31818924204
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30705467214000004,
      "stddev": 0.007937634548867548,
      "median": 0.30457269304,
      "user": 0.20037026,
      "system": 0.52767648,
      "min": 0.30102277304,
      "max": 0.32688360904,
      "times": [
        0.30240275004,
        0.30139721504,
        0.30103173004,
        0.30655276004,
        0.31173357004,
        0.30259262604000003,
        0.30102277304,
        0.32688360904,
        0.30933942304,
        0.30759026504000003
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.935 ± 0.027 1.899 1.996 6.51 ± 0.21
pacquet@main 1.843 ± 0.024 1.816 1.893 6.20 ± 0.20
pnpr@HEAD 0.314 ± 0.010 0.303 0.330 1.06 ± 0.05
pnpr@main 0.297 ± 0.009 0.284 0.309 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9349341828799997,
      "stddev": 0.027334596183386885,
      "median": 1.93919189698,
      "user": 0.99066118,
      "system": 0.7497235599999998,
      "min": 1.89850159348,
      "max": 1.9959207964799999,
      "times": [
        1.9959207964799999,
        1.94261544548,
        1.94912537748,
        1.94255195548,
        1.93839182748,
        1.9399919664799998,
        1.91629744048,
        1.91073424248,
        1.89850159348,
        1.91521118348
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.84270291248,
      "stddev": 0.024027722822130265,
      "median": 1.83252717498,
      "user": 0.8890826800000001,
      "system": 0.7194135599999999,
      "min": 1.81576277048,
      "max": 1.89285173648,
      "times": [
        1.8580502104799999,
        1.86881695548,
        1.89285173648,
        1.84739222848,
        1.82815016448,
        1.81576277048,
        1.83270219848,
        1.82418648348,
        1.83235215148,
        1.82676422548
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31438962068000004,
      "stddev": 0.010402414959622965,
      "median": 0.31116023648,
      "user": 0.19746117999999996,
      "system": 0.56405856,
      "min": 0.30311598448000004,
      "max": 0.33007687148000003,
      "times": [
        0.32983094048000006,
        0.33007687148000003,
        0.30726976248000004,
        0.30864892748,
        0.30311598448000004,
        0.30376009248,
        0.32172791848000004,
        0.32020518248,
        0.31367154548000004,
        0.30558898148
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29733772758,
      "stddev": 0.008579911831761348,
      "median": 0.29700565898000003,
      "user": 0.19176058,
      "system": 0.5191104599999999,
      "min": 0.28425743948000004,
      "max": 0.30855839848000005,
      "times": [
        0.29834429848000005,
        0.28600952248,
        0.28425743948000004,
        0.29144946248000003,
        0.30346807448,
        0.30855839848000005,
        0.30440611348,
        0.29566701948,
        0.29390797148000003,
        0.30730897548
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 368.2 ± 12.3 357.2 396.5 4.28 ± 0.18
pacquet@main 328.1 ± 9.2 315.3 339.2 3.81 ± 0.14
pnpr@HEAD 86.4 ± 1.7 81.9 89.5 1.00 ± 0.03
pnpr@main 86.0 ± 2.1 81.3 88.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36823350574,
      "stddev": 0.012271540415186757,
      "median": 0.36272046994,
      "user": 0.35696118,
      "system": 0.06080054,
      "min": 0.35717225794,
      "max": 0.39651828294,
      "times": [
        0.39651828294,
        0.36246253594,
        0.35871009194000003,
        0.37813217394,
        0.37709648194,
        0.35717225794,
        0.36109907094,
        0.36297840394,
        0.36096603994,
        0.36719971794
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.32808558694,
      "stddev": 0.009212260976996949,
      "median": 0.32724783144,
      "user": 0.32178527999999995,
      "system": 0.053748340000000006,
      "min": 0.31525691594,
      "max": 0.33920897094,
      "times": [
        0.33829284394000003,
        0.33920897094,
        0.32966541894,
        0.32310455794,
        0.32483024394,
        0.33575563694,
        0.31525691594,
        0.32060921894,
        0.31665952594,
        0.33747253594
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08639251103375001,
      "stddev": 0.0016840019617023947,
      "median": 0.08640324794000001,
      "user": 0.019746898750000002,
      "system": 0.009597614375,
      "min": 0.08187363094,
      "max": 0.08953978294,
      "times": [
        0.08931768694,
        0.08815618894,
        0.08582501994,
        0.08561931294,
        0.08429947894,
        0.08745280094,
        0.08614132194,
        0.08748120494,
        0.08601474394,
        0.08187363094,
        0.08601958394,
        0.08705726894,
        0.08634511394000001,
        0.08510157294000001,
        0.08886995794000001,
        0.08763604394,
        0.08606650194,
        0.08776050794000001,
        0.08586473294000001,
        0.08362705894,
        0.08953978294,
        0.08707946194,
        0.08706888094000001,
        0.08539272794,
        0.08796779594000001,
        0.08554086694,
        0.08702096994,
        0.08646138194,
        0.08325540194,
        0.08701214494000001,
        0.08682183694000001,
        0.08486936694
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08601747184625,
      "stddev": 0.0021399324502387146,
      "median": 0.08666178844,
      "user": 0.0192082425,
      "system": 0.009469040000000001,
      "min": 0.08130186994000001,
      "max": 0.08872722094,
      "times": [
        0.08847463694,
        0.08562656694000001,
        0.08765636194,
        0.08722499294000001,
        0.08748776694,
        0.08640901294,
        0.08743932494000001,
        0.08662725394000001,
        0.08130186994000001,
        0.08240709094,
        0.08352862394,
        0.08157161494000001,
        0.08341048194,
        0.08838975794000001,
        0.08567357594,
        0.08758648194,
        0.08725504094,
        0.08623353494000001,
        0.08791619894000001,
        0.08731530394,
        0.08597421794,
        0.08209722994,
        0.08348236794,
        0.08782132194,
        0.08654054994,
        0.08770780894,
        0.08872722094,
        0.08787745694,
        0.08669632294,
        0.08463932594000001,
        0.08465696894000001,
        0.08680281294
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.521 ± 0.123 4.431 4.843 1.27 ± 0.05
pacquet@main 4.557 ± 0.152 4.423 4.895 1.28 ± 0.05
pnpr@HEAD 3.578 ± 0.109 3.443 3.813 1.01 ± 0.04
pnpr@main 3.555 ± 0.094 3.450 3.692 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.520630444460001,
      "stddev": 0.12258248408751303,
      "median": 4.487543478859999,
      "user": 1.7190954400000003,
      "system": 1.39275874,
      "min": 4.43082612536,
      "max": 4.84255186536,
      "times": [
        4.44050623336,
        4.55344200436,
        4.84255186536,
        4.54508854336,
        4.50128792636,
        4.5361222443599996,
        4.43082612536,
        4.47379903136,
        4.44700154136,
        4.43567892936
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.55677380296,
      "stddev": 0.15196931347573414,
      "median": 4.490592170359999,
      "user": 1.7115894400000002,
      "system": 1.4151326400000002,
      "min": 4.42322456636,
      "max": 4.89499366236,
      "times": [
        4.4762544773599995,
        4.89499366236,
        4.60009743336,
        4.72049839436,
        4.4384009423599995,
        4.43282294336,
        4.47617520836,
        4.42322456636,
        4.50492986336,
        4.60034053836
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.57772353056,
      "stddev": 0.10880817562308834,
      "median": 3.55582356736,
      "user": 1.20816174,
      "system": 1.22958424,
      "min": 3.4432621603599998,
      "max": 3.81280753636,
      "times": [
        3.51685159936,
        3.45076288336,
        3.55800013336,
        3.55364700136,
        3.53729313736,
        3.62201411936,
        3.66047829936,
        3.81280753636,
        3.4432621603599998,
        3.62211843536
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.55535641126,
      "stddev": 0.09413260996359371,
      "median": 3.55505384936,
      "user": 1.2127647400000001,
      "system": 1.2412066400000001,
      "min": 3.45042028736,
      "max": 3.69225378836,
      "times": [
        3.51562472936,
        3.59546192436,
        3.59448296936,
        3.65181902636,
        3.69225378836,
        3.45471775536,
        3.47816731336,
        3.65990166936,
        3.46071464936,
        3.45042028736
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13172
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,767.45 ms
(+4.03%)Baseline: 2,660.16 ms
3,192.20 ms
(86.69%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,898.50 ms
(+3.85%)Baseline: 1,828.17 ms
2,193.80 ms
(86.54%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
611.84 ms
(+15.65%)Baseline: 529.05 ms
634.86 ms
(96.37%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
357.17 ms
(+12.19%)Baseline: 318.38 ms
382.05 ms
(93.49%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,394.70 ms
(+2.12%)Baseline: 2,344.94 ms
2,813.93 ms
(85.10%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,430.83 ms
(+0.30%)Baseline: 4,417.70 ms
5,301.24 ms
(83.58%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
246.32 ms
(+2.42%)Baseline: 240.49 ms
288.59 ms
(85.35%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13172
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,445.18 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
303.12 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
304.99 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
81.87 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,372.59 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,443.26 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
266.81 ms
🐰 View full continuous benchmarking report in Bencher

- workspace-manifest-writer: guard the partial named-catalog drop with
  the same block-style check the other removal splices use, so a
  flow-style catalogs mapping is left untouched instead of desyncing
  the decoded model while claiming a change (CodeRabbit); regression
  test added.
- resolving-deps-resolver: pin locked peer providers with occurrence 0,
  matching the fresh ref upstream's toPkgByName builds (Greptile), and
  gate the paths_by_node_id build behind an explicit
  collect_paths_by_node_id option so the hoist loop's hot path skips
  the extra per-node pass (Qodo); drop a history-restating doc
  sentence (Qodo).
- package-manager: short-circuit the lockfile edge walk for nodes
  whose classification is already final, avoiding repeated candidate
  checks on many-inbound-edge graphs (Qodo).
Copilot AI review requested due to automatic review settings July 20, 2026 11:58

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 Jul 20, 2026

Copy link
Copy Markdown
Member Author

Addressed the Qodo findings in 7b86dfa:

  1. Redundant upstream-counterpart comment — dropped the sentence from the CurrentProviderSource doc.
  2. paths_by_node_id always computed — gated behind a new ResolvePeersOptions::collect_paths_by_node_id flag (default off), so the hoist loop's hot path skips the extra per-node pass; only a locked-peer-provider reuse pass opts in.
  3. Edge walk repeats node work — added an early installed.contains(key) guard after the queue pop; a node's classification is final once installed, so later inbound edges skip the candidate check.
  4. Prerelease range parsed twice — skipped intentionally: the up-front whole-range parse implements the semver.satisfies-returns-false-on-unparsable-range contract (a range with one malformed || alternative must reject as a whole, so per-alternative parsing alone would over-accept). The double parse only occurs for prerelease host versions, which are rare on the engine-check path.

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

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 20, 2026
@qodo-code-review qodo-code-review Bot mentioned this pull request Nov 4, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpr reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants