Skip to content

perf(lockfile): apply patchedDependencies changes without resolving - #13680

Merged
zkochan merged 7 commits into
mainfrom
perf-lockfile4
Aug 6, 2026
Merged

zkochan merged 7 commits into
mainfrom
perf-lockfile4

Conversation

@zkochan

@zkochan zkochan commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Related to #13474 — the patched-dependencies stage of the lockfile fast-path roadmap, following #13477 (catalogs), #13482 (ignored optional dependencies), and #13600 (setting-only updates).

Resolution never reads a patch. It appends the patch file's hash to an already-resolved package id, so a patchedDependencies change leaves the set of packages and versions untouched and moves only the affected keys. Adding, editing, or removing an entry is therefore a rewrite of the loaded lockfile, not a re-resolve.

  • Rewrite the affected snapshots: keys and every reference pointing at them — the importers' resolved versions and dependents' dependency references. packages: is keyed without the patch hash, so it does not move.
  • A patch key that matches no locked package is recorded with no rewrite at all.
  • Implemented in both the TypeScript CLI (tryFastUpdatePatchedDependencies) and pacquet (fast_update_patched_dependencies).
  • Export allPatchKeys from @pnpm/patching.config, which the unused-patch predicate needs and verifyPatches already used internally.

The patched tarball is already in the store, so materialization applies the patch with no network access. Because the rekey gives the package a new depPath, it lands in a fresh virtual-store slot — a patched package with an install script is rebuilt against the patched sources rather than reusing the previous build. There is an integration test for exactly that.

When it still resolves

  • The patched package is reachable as a peer. resolve_peers can emit a peer provider as its full depPath, so a patched provider is embedded in its dependents' peer suffixes and rekeying it would rekey them too.
  • A peer suffix was shortened into a hash. Once the joined segments exceed peersSuffixMaxLength pnpm replaces them with a short hash, which cannot be inspected to rule the above out.
  • The new configuration leaves a patch unused while allowUnusedPatches is off, so ERR_PNPM_UNUSED_PATCH is still raised. The two stacks disagree today about when they run that check — the TypeScript CLI only verifies on a forced or from-empty resolution, pacquet on every non-filtered fresh resolution — so rather than encode that divergence, both fall back under the same condition.
  • A locked package matches more than one configured range, leaving ERR_PNPM_PATCH_KEY_CONFLICT to the resolver, and a patch file that cannot be read or hashed.

Squash Commit Body

Resolution never reads a patch. It appends the patch file's hash to an
already-resolved package id, so a `patchedDependencies` change leaves the
set of packages and versions untouched and moves only the affected keys.
Rewrite those keys and the references pointing at them instead of
re-resolving.

`packages:` is keyed without the patch hash, so only `snapshots:`, the
importers' resolved versions, and dependents' dependency references move.
The patched tarball is already in the store, so materialization applies
the patch with no network access, and the new depPath puts the package in
a fresh virtual-store slot so an install script reruns against the
patched sources.

Fall back to the resolver when the patched package is reachable as a peer
(its depPath is embedded in dependents' peer suffixes), when a peer suffix
was shortened into a hash and cannot be inspected, when the new
configuration would leave a patch unused while `allowUnusedPatches` is
off, and when a patch file cannot be read.

Implemented in both the TypeScript CLI and pacquet.

Related to pnpm/pnpm#13474.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • 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.
  • Added or updated tests.

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

Summary by CodeRabbit

  • Performance

    • Install and lockfile updates are faster when adding, changing, or removing patches, without unnecessary dependency resolution.
    • Safe patch changes update lockfile references and patched packages directly.
  • Bug Fixes

    • Improved handling of unused patches, including clear errors when unused patches are disallowed.
    • Correctly handles edited, removed, range-based, and bare-name patches.
    • Re-runs install scripts when patched package contents change.
    • Uses full resolution for unsupported or unsafe dependency relationships.
  • Tests

    • Expanded coverage for patched dependency updates, lockfile behavior, peer dependencies, and resolution fallbacks.

zkochan added 2 commits August 6, 2026 15:41
…lving

A patch that matches a locked package contributes a `(patch_hash=...)`
segment to that package's key, so adding, removing, or editing it rekeys
the graph. A patch key that matches nothing contributes nothing, which
leaves the recorded map as the only thing the change touches.

Detect that case and record the new `patchedDependencies` on the loaded
lockfile instead of resolving. Keys that match a locked package, and
patch files that cannot be read, stay on the full-resolution path.

Fall back whenever the new configuration would leave a patch unused and
`allowUnusedPatches` is off, so the resolver still raises
ERR_PNPM_UNUSED_PATCH. Removing a key that matched nothing leaves no
unused patch behind, so it takes the fast path either way.

Implemented in both the TypeScript CLI and pacquet. Matching against the
lockfile reuses the same key handling the frozen-install path uses to
apply patches, so the two agree on which patches are in play.

Related to #13474.
Copilot AI lite review requested due to automatic review settings August 6, 2026 13:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 13220e93-6240-4af6-ab77-f81e86b181da

📥 Commits

Reviewing files that changed from the base of the PR and between 8f983b7 and 09ed5fc.

📒 Files selected for processing (4)
  • pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs
  • pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs
  • pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts
  • pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts
  • pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs
  • pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts
  • pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs

📝 Walkthrough

Walkthrough

Adds TypeScript and Rust fast-update paths for patchedDependencies. Safe changes rewrite lockfile patch hashes and references without full resolution. Unsafe peer cases, invalid matches, and disallowed unused patches fall back to resolution or report an error.

Changes

Patched dependency updates

Layer / File(s) Summary
TypeScript fast-update path
pnpm11/patching/config/src/index.ts, pnpm11/installing/deps-installer/src/install/..., pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts
Adds patch matching, lockfile rekeying, unused-patch handling, installer wiring, and tests.
Rust fast-update path and freshness integration
pnpm/crates/package-manager/src/...
Adds Rust lockfile rekeying, patch matching, freshness integration, and tests.
Installer integration validation
pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
Covers patch application, removal, materialization, unused patches, and install-script reruns.
Release metadata
.changeset/inert-patched-dependencies-updates.md
Documents the updated patched-dependency installation flow and package releases.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#13139 — Changes patched-dependency handling and allowUnusedPatches behavior.
  • pnpm/pnpm#13677 — Threads allowUnusedPatches into patched-dependency handling.
  • pnpm/pnpm#13640 — Modifies lockfile freshness and fast-update handling.

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

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf-lockfile4

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

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

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

Both previously reported failures are fixed at current HEAD, and no blocking failure remains.

Reviews (5): Last reviewed commit: "fix(lockfile): leave non-semver package ..." | Re-trigger Greptile

@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: 4

🤖 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 @.changeset/inert-patched-dependencies-updates.md:
- Around line 2-5: Update the changeset bump declarations so
`@pnpm/installing.deps-installer` and pnpm use patch rather than minor, while
preserving `@pnpm/patching.config` at minor because it exports allPatchKeys; leave
pacquet unchanged.

In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs`:
- Around line 897-902: Update the fallback install assertion in the test around
pacquet_at to require a successful exit status by chaining success() before
inspecting stdout. Preserve the existing check that patching a locked package
must not emit the lockfile skip message, ensuring resolver or patch-application
failures cannot pass the regression test.

In `@pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs`:
- Around line 36-38: Update the fast-path logic around
patched_dependency_hashes() and resolved_patched_dependencies() so each
configured patch file is read only once. Reuse the metadata produced by
patched_dependency_hashes(), or derive the matching patch groups from that
metadata, before deciding whether to fall back; preserve the existing
drift-detection behavior while eliminating the second filesystem read.

In
`@pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts`:
- Around line 35-37: Ensure tryFastUpdatePatchedDependencies.ts matches affected
patch keys against both recorded and current patch configurations before
accepting the fast path, falling back when a removed patch was previously
applied. Apply the same rule in
pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs:38-46. Add
regression coverage for removing a previously applied patch and expecting
fallback in
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts:64-73
and
pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs:121-131,
preserving TypeScript/pacquet parity.
🪄 Autofix

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: 8d98941a-8202-4358-af14-f24ec437558b

📥 Commits

Reviewing files that changed from the base of the PR and between dd0e058 and 94af311.

📒 Files selected for processing (10)
  • .changeset/inert-patched-dependencies-updates.md
  • pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
  • pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs
  • pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs
  • pnpm/crates/package-manager/src/install/lockfile_freshness.rs
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts
  • pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts
  • pnpm11/patching/config/src/index.ts

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.04     11.9±0.07ms    31.4 MB/sec    1.00     11.4±0.21ms    32.7 MB/sec
packument/parse                                  1.00     38.9±0.31µs  1703.4 MB/sec    1.04     40.3±0.18µs  1644.0 MB/sec
tarball/download_dependency                      1.00      2.2±0.08ms  1948.9 KB/sec    1.03      2.3±0.08ms  1899.0 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    169.5±3.51ms 94.4 KElem/sec    1.03    174.6±0.83ms 91.6 KElem/sec
workspace_resolution/hoist_heavy                 1.00    246.7±0.56ms        ? ?/sec    1.00    247.1±1.24ms        ? ?/sec

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

perf(lockfile): fast-path patchedDependencies changes that touch no locked package

✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Skip full dependency resolution when a patchedDependencies change adds, removes, or edits a
 patch that matches no package the lockfile already records.
• Fall back to full resolution when a changed patch key matches a locked package, the patch file
 cannot be read/hashed, a locked package matches more than one configured range, or the new config
 would leave an unused patch while allowUnusedPatches is off.
• Implements the fast path in both the TypeScript CLI (tryFastUpdatePatchedDependencies) and
 pacquet (try_fast_update_patched_dependencies).
• Exports allPatchKeys from @pnpm/patching.config for shared unused-patch detection.
• Adds unit tests (TS + Rust) and a pacquet CLI integration test proving both fast-path and fallback
 behavior.
Diagram

graph TD
    Config["Config /\npatchedDependencies"] --> FastPath{"Patch key matches\na locked package?"}
    FastPath -- "No match, hashable,\nno unused patch" --> Candidate["Candidate Lockfile\n(record patched deps)"]
    FastPath -- "Match / unreadable /\nunused patch" --> Resolver["Full Resolver"]
    Candidate --> Freshness["Freshness Check"]
    Freshness --> Lockfile[("pnpm-lock.yaml")]
    Resolver --> Lockfile
    subgraph Legend
        direction LR
        _svc([Process/Decision]) ~~~ _db[(Lockfile)]
    end
Loading
High-Level Assessment

This is the right approach for the lockfile fast-path roadmap: it reuses the same patch-key matching semantics as the resolver/materializer and preserves existing diagnostics by falling back when ambiguity or policy checks are involved (unused patches, conflicts, unreadable patch files). Alternative “always fast-update patchedDependencies” strategies would risk silently skipping required graph rekeying or swallowing ERR_PNPM_UNUSED_PATCH.

Files changed (10) +582 / -2

Enhancement (5) +196 / -2
fast_update_patched_dependencies.rsImplement pacquet fast update for inert patchedDependencies drift +93/-0

Implement pacquet fast update for inert patchedDependencies drift

• Adds 'try_fast_update_patched_dependencies' that stages a lockfile update when only the recorded patchedDependencies map changes and no locked package is affected. Falls back on patch-key matches, unreadable/unhashable patches, key conflicts, or disallowed unused patches.

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

lockfile_freshness.rsWire patchedDependencies fast update into pacquet lockfile fast-update pipeline +7/-2

Wire patchedDependencies fast update into pacquet lockfile fast-update pipeline

• Extends 'try_fast_update_lockfile' to consider patchedDependencies drift as a fast-update candidate, and updates documentation to include this new safe-to-absorb drift type.

pnpm/crates/package-manager/src/install/lockfile_freshness.rs

index.tsDispatch patchedDependencies setting drift to fast-update handler +9/-0

Dispatch patchedDependencies setting drift to fast-update handler

• Treats 'patchedDependencies' as an eligible changed lockfile setting for the lockfile fast-update coordinator and calls 'tryFastUpdatePatchedDependencies' with patch groups and allowUnusedPatches.

pnpm11/installing/deps-installer/src/install/index.ts

tryFastUpdatePatchedDependencies.tsImplement TypeScript fast update for inert patchedDependencies drift +86/-0

Implement TypeScript fast update for inert patchedDependencies drift

• Adds a TS-side fast-update predicate that detects which patchedDependencies keys changed, determines which configured patches actually apply to locked packages, and mutates the lockfile map only when safe.

pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts

index.tsExport allPatchKeys from @pnpm/patching.config +1/-0

Export allPatchKeys from @pnpm/patching.config

• Exposes 'allPatchKeys' publicly so fast-update logic can enumerate configured patch keys consistently with existing patch verification logic.

pnpm11/patching/config/src/index.ts

Tests (3) +377 / -0
lockfile_resolution_reuse.rsAdd e2e test for patchedDependencies fast-path vs resolver fallback +88/-0

Add e2e test for patchedDependencies fast-path vs resolver fallback

• Introduces an integration test that proves a non-matching patch is recorded without resolution (using a dead registry to enforce no network), while a patch matching a locked package forces resolution.

pnpm/crates/cli/tests/lockfile_resolution_reuse.rs

tests.rsAdd unit tests for pacquet patchedDependencies fast-update handler +173/-0

Add unit tests for pacquet patchedDependencies fast-update handler

• Covers safe recording, forced fallback when matching locked packages (including bare-name keys), unused-patch policy behavior, removal behavior, unchanged config, and missing patch files.

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

patchedDependenciesFastUpdate.tsAdd Jest coverage for TypeScript patchedDependencies fast update +116/-0

Add Jest coverage for TypeScript patchedDependencies fast update

• Validates fast-path recording for non-matching patches and fallbacks for matching keys, bare-name/range keys, edited patches, unused-patch policy, removal, and no-op changes.

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts

Documentation (1) +8 / -0
inert-patched-dependencies-updates.mdAdd changeset for inert patchedDependencies fast path +8/-0

Add changeset for inert patchedDependencies fast path

• Adds release notes explaining that patchedDependencies changes targeting no locked package no longer trigger resolution, while matching patches still do.

.changeset/inert-patched-dependencies-updates.md

Other (1) +1 / -0
lib.rsRegister fast_update_patched_dependencies module +1/-0

Register fast_update_patched_dependencies module

• Adds the new module to the package-manager crate module list so it participates in the build.

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

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. TS removal treated inert ✓ Resolved 🐞 Bug ⛨ Security
Description
The fast-update path for patched dependencies can incorrectly proceed when patchedDependencies is
removed from config because it computes “applied” only from the current (now-empty) patch groups,
treating the removal as safe even if the removed patch previously matched a locked package. This can
drop patchedDependencies from the lockfile while leaving depPaths/snapshots still keyed with
(patch_hash=...), risking stale patched identities/contents after patch removal.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[R35-38]

+  const applied = appliedPatchKeys(lockfile, opts.patchGroups)
+  if (applied == null) return false
+  if (affected.some((key) => applied.has(key))) return false
+  if (!opts.allowUnusedPatches && opts.patchGroups != null) {
Relevance

●●● Strong

Team historically accepts conservative fast-path fallbacks to avoid unsafe lockfile reuse/graph
mismatch.

PR-#13482
PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In the fast-path implementations, the set of “applied” patch keys is derived solely from the current
configuration’s patch groups (opts.patchGroups in TS / config.resolved_patched_dependencies() in
Rust), so when the user removes patchedDependencies those groups become empty/None,
applied_patch_keys() becomes an empty set, and removals can be treated as inert (allowing deletion
of lockfile.patchedDependencies). However, pnpm’s resolver rekeys patched packages by appending
(patch_hash=...) to the package/snapshot identity (and this suffix is also reflected in
virtual-store directory naming / identity hashing), so deleting only the lockfile’s
patchedDependencies without forcing a full resolution leaves the lockfile graph still referring to
patched identities/paths that should be rekeyed back to unpatched forms.

pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[26-49]
pnpm11/installing/deps-installer/src/install/index.ts[655-672]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2120-2125]
pnpm11/releasing/commands/test/deploy/shared-lockfile.test.ts[935-947]
pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[28-60]
pnpm/crates/config/src/lib.rs[2157-2165]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest.rs[18-30]
pnpm/crates/deps-restorer/src/virtual_store_layout.rs[528-573]

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

## Issue description
The fast-update logic for `patchedDependencies` decides whether a changed/removed patch key affects the lockfile by computing the “applied” set only from the *current* config patch groups. When the user removes `patchedDependencies`, those patch groups become empty/`None`, so removals of previously-applied patches can be misclassified as safe, allowing the fast-path to drop `lockfile.patchedDependencies` while leaving snapshots/depPaths still keyed with `(patch_hash=...)`.

## Issue Context
In pnpm, when a patch matches a locked package, the resolver appends `(patch_hash=...)` to the package identity / snapshot key (and that patch hash is incorporated into virtual-store paths / identity hashing). Therefore, removing an applied patch must force a full resolution to rekey the dependency graph back to unpatched identities; the fast-path needs to detect removals of patches that were applied historically (recorded in the lockfile), not just patches that are applied under the current config.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[26-49]
- pnpm11/installing/deps-installer/src/install/index.ts[655-784]
- pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[28-60]
- pnpm/crates/config/src/lib.rs[2157-2165]

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



Remediation recommended

2. Unneeded patch lookup 🐞 Bug ➹ Performance ⭐ New
Description
In Rust plan_rekeys(), get_patch_info() is called before the non-semver guard, so snapshot keys
with non-semver versions (tarball/git/registry-qualified) still pay patch lookup work even though
the function either continues or immediately falls back to full resolution for those keys.
Code

pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[R79-82]

+        let (name, version) = pacquet_deps_restorer::parse_name_version_from_key(base);
+        let patch = get_patch_info(Some(groups), &name, &version).ok()?;
+        // The resolver matches patches against a package's plain semver
+        // version, while this reads the version out of the key, where a
Relevance

●●● Strong

Small, local perf win; team often accepts eliminating redundant work in hot paths.

PR-#13288
PR-#13482

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added code calls get_patch_info() (patch lookup + potential parsing) before checking whether
the snapshot key version is semver; but the subsequent non-semver branch returns/continues without
using patch, making the lookup redundant for that branch.

pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[75-96]
pnpm/crates/patching/src/get_patch_info.rs[36-66]

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

### Issue description
`plan_rekeys()` calls `get_patch_info()` before checking `key.suffix.version_semver()`. For non-semver snapshot keys, the fast-path never uses the returned patch info (it either continues if the patch cannot matter, or returns `None` to fall back), so this lookup is avoidable work in the fast-update hot path.

### Issue Context
`get_patch_info()` can parse versions and semver ranges during lookup. Even when it exits early for missing groups, the call is still unnecessary on the non-semver branch, and the TS implementation already performs the non-semver check before patch lookup.

### Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[79-95]

### Suggested change
- Move `let patch = get_patch_info(...)` to *after* the `version_semver().is_none()` block.
- In the non-semver branch, rely only on `groups.contains_key(name)` and `suffix.patch_hash_index` to decide `continue` vs `return None`, without computing `patch`.

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


3. trackRequestedPackages declared too early 📘 Rule violation ⚙ Maintainability
Description
trackRequestedPackages() is declared before its first usage in the same TypeScript file, violating
the required declaration order. This makes the file harder to scan because helper definitions appear
before the tests that motivate them.
Code

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[R21-24]

+function trackRequestedPackages (storeController: StoreController): string[] {
+  const requestedPackages: string[] = []
+  const requestPackage = storeController.requestPackage
+  storeController.requestPackage = async (wantedDependency, requestOptions) => {
Relevance

●●● Strong

Maintainability/compliance-style changes in tests are usually accepted; easy reorder with no
behavior impact.

PR-#13383

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713432 requires TypeScript function declarations to come after at least one usage
in the same file. trackRequestedPackages() is declared near the top of the file but first used
later when capturing requestedPackages.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-29]
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[160-176]

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

## Issue description
The helper `trackRequestedPackages()` is declared before its first usage, which violates the repo rule that TypeScript function declarations should appear only after they are first used.

## Issue Context
This rule applies to `function foo(...) {}` declarations in `.ts` files. The function is used later in the test `adding a patch for a locked package rekeys it without resolution`.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-29]
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[160-176]

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


4. Double suffix scan (Rust) 🐞 Bug ➹ Performance
Description
plan_rekeys()/planRekeys() computes base via remove_suffix()/removeSuffix() and then
immediately calls index_of_dep_path_suffix()/indexOfDepPathSuffix() again on the same rendered
depPath string, causing two full suffix scans per snapshot/package key. This redundant work adds
avoidable CPU overhead on large lockfiles in the new patchedDependencies fast-update path (Rust and
TS).
Code

pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[R75-78]

+        let rendered = key.to_string();
+        let base = remove_suffix(&rendered);
+        let peers =
+            index_of_dep_path_suffix(&rendered).peers_index.map_or("", |index| &rendered[index..]);
Relevance

●●● Strong

Team often accepts small, concrete perf fixes eliminating redundant work; especially in fast-update
paths.

PR-#13170
PR-#13482
PR-#13600

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In plan_rekeys, the code calls remove_suffix(&rendered) and then separately invokes
index_of_dep_path_suffix(&rendered), meaning the suffix parser is run twice for the same key; this
duplication is concrete because remove_suffix is implemented internally by calling
index_of_dep_path_suffix. The same pattern exists in the TS fast-update path where planRekeys()
calls removeSuffix(depPath) and then indexOfDepPathSuffix(depPath), and in @pnpm/deps.path
removeSuffix() is implemented by calling indexOfDepPathSuffix(), proving two full suffix scans
per entry.

pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[74-78]
pnpm/crates/deps-path/src/suffix_index.rs[10-56]
pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[86-90]
pnpm11/deps/path/src/index.ts[66-118]

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

## Issue description
The patchedDependencies fast-update path (both Rust and TS) redundantly scans depPath suffixes inside `plan_rekeys()`/`planRekeys()`: `remove_suffix()`/`removeSuffix()` already performs a full `index_of_dep_path_suffix()`/`indexOfDepPathSuffix()` scan, and the caller immediately scans again to locate indexes such as `peers_index`/`peersIndex` (and potentially `patchHashIndex`). This causes two full suffix scans per snapshot/package key, adding avoidable CPU overhead on large lockfiles.

## Issue Context
This fast-update path runs across many (potentially all) `lockfile.packages`/snapshot entries when a patchedDependencies change is detected and is intended to be faster than full resolution; repeated per-entry string scans reduce the intended performance benefit.

## Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[74-78]
- pnpm/crates/deps-path/src/suffix_index.rs[10-56]
- pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[86-90]
- pnpm11/deps/path/src/index.ts[66-118]

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


View more (1)
5. Alias assumed always present 🐞 Bug ☼ Reliability
Description
trackRequestedPackages() records wantedDependency.alias! even though resolver-base WantedDependency
allows alias to be absent, so alias-less requests can crash the test harness and mask the real
behavior under test.
Code

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[R23-26]

+  const requestPackage = storeController.requestPackage
+  storeController.requestPackage = async (wantedDependency, requestOptions) => {
+    requestedPackages.push(wantedDependency.alias!)
+    return requestPackage(wantedDependency, requestOptions)
Relevance

●● Moderate

Repo test helpers often use non-null assertions on optional fields; may keep alias! if invariant
holds.

PR-#12876

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test helper dereferences wantedDependency.alias with a non-null assertion, but resolver-base
defines WantedDependency as a union where alias is optional in one branch.

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-27]
pnpm11/resolving/resolver-base/src/index.ts[423-432]

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

### Issue description
`trackRequestedPackages()` pushes `wantedDependency.alias!` into an array. `WantedDependency` permits `alias` to be absent, so if `requestPackage` is invoked with an alias-less wantedDependency (e.g. tarball/git/local forms), this test instrumentation can throw and hide the actual install behavior.

### Issue Context
This is test-only, but it impacts CI reliability and can produce misleading failures as resolver/store behavior evolves.

### Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-29]

### Suggested change
Record a safe identifier, e.g.:
- `requestedPackages.push(wantedDependency.alias ?? wantedDependency.bareSpecifier ?? '<unknown>')`

Optionally, restore the original function after the tracked install if this helper is reused elsewhere.

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



Informational

6. Tarball test under-asserts 🐞 Bug ⚙ Maintainability ⭐ New
Description
The tarball-edge-case Rust test asserts only that snapshot keys changed, but it does not assert that
the importer’s bar dependency version was rewritten to the new (...patch_hash=...) key, reducing
regression detection for this specific scenario.
Code

pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs[R352-354]

+    assert!(snapshot_keys(&updated).iter().any(|key| key.starts_with("[email protected](patch_hash=")));
+    assert!(snapshot_keys(&updated).contains(&"foo@https://example.test/foo.tgz".to_string()));
+}
Relevance

●●● Strong

Team frequently accepts strengthening tests with more specific assertions for regression detection.

PR-#13536
PR-#13291

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test only checks that the patched snapshot key exists and the tarball snapshot remains, but
never checks that the importer reference was updated to point at the rekeyed snapshot in this mixed
graph.

pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs[342-354]

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

### Issue description
`rekeys_around_a_tarball_resolution_no_patch_reaches()` only asserts snapshot keys. If a future change regresses importer rewriting specifically in the presence of unrelated non-semver entries (tarball keys), this test could still pass.

### Issue Context
Other tests already assert importer rewriting in the simple case; this is an edge-case coverage gap for the tarball-mixed graph.

### Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs[342-354]

### Suggested change
- Capture the config in a variable and compute the expected patch hash via `patched_dependency_hashes()` (like earlier tests do).
- Add an assertion that `importer_version(&updated, "bar")` equals `format!("2.0.0(patch_hash={hash})")` (or at least starts with `2.0.0(patch_hash=`).

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


7. Indirect resolution-skip signal 🐞 Bug ⚙ Maintainability
Description
The integration test asserts requestedPackages is empty, but requestPackage calls are not a
stable/unique signal for whether resolution ran, reducing the assertion’s long-term diagnostic
value.
Code

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[R175-178]

+  // pacquet's `lockfile_resolution_reuse` is what proves resolution is skipped.
+  expect(requestedPackages).toStrictEqual([])
+  const lockfile = project.readLockfile()
+  expect(lockfile.patchedDependencies).toStrictEqual({ '[email protected]': patchFileHash })
Relevance

●●● Strong

Team has accepted strengthening regression tests to assert stable, diagnostic signals rather than
weak proxies.

PR-#13636

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test’s own comment states the empty-request assertion is 'necessary but not sufficient', and the
codebase uses requestPackage in contexts unrelated to a full dependency-graph resolution step
(e.g. warnings/validation with skipFetch: true).

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[171-178]
pnpm11/installing/deps-installer/src/install/warnOnStaleConvergenceOverrides.ts[36-55]

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

### Issue description
The test uses `expect(requestedPackages).toStrictEqual([])` as a proxy for “resolution was skipped.” This is not a stable or unique indicator (the test itself notes it is not sufficient), so the assertion can become brittle or misleading if internal implementation changes.

### Issue Context
There is already complementary coverage elsewhere (e.g. pacquet integration test asserting the explicit “resolution step is skipped” output). This suggestion is only to improve the TS test’s signal quality.

### Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[146-213]

### Suggested change
Prefer asserting an explicit, stable signal (e.g. capture and assert the log/output that indicates fast-path/no-resolution), or drop the `requestedPackages === []` assertion and rely on the end-state assertions (lockfile snapshot key + patched file contents).

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


Grey Divider

Context used
✅ Compliance rules (platform): 24 rules

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit 09ed5fc

Results up to commit 94af311 ⚖️ Balanced


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


Action required
1. TS removal treated inert ✓ Resolved 🐞 Bug ⛨ Security
Description
The fast-update path for patched dependencies can incorrectly proceed when patchedDependencies is
removed from config because it computes “applied” only from the current (now-empty) patch groups,
treating the removal as safe even if the removed patch previously matched a locked package. This can
drop patchedDependencies from the lockfile while leaving depPaths/snapshots still keyed with
(patch_hash=...), risking stale patched identities/contents after patch removal.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[R35-38]

+  const applied = appliedPatchKeys(lockfile, opts.patchGroups)
+  if (applied == null) return false
+  if (affected.some((key) => applied.has(key))) return false
+  if (!opts.allowUnusedPatches && opts.patchGroups != null) {
Relevance

●●● Strong

Team historically accepts conservative fast-path fallbacks to avoid unsafe lockfile reuse/graph
mismatch.

PR-#13482
PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In the fast-path implementations, the set of “applied” patch keys is derived solely from the current
configuration’s patch groups (opts.patchGroups in TS / config.resolved_patched_dependencies() in
Rust), so when the user removes patchedDependencies those groups become empty/None,
applied_patch_keys() becomes an empty set, and removals can be treated as inert (allowing deletion
of lockfile.patchedDependencies). However, pnpm’s resolver rekeys patched packages by appending
(patch_hash=...) to the package/snapshot identity (and this suffix is also reflected in
virtual-store directory naming / identity hashing), so deleting only the lockfile’s
patchedDependencies without forcing a full resolution leaves the lockfile graph still referring to
patched identities/paths that should be rekeyed back to unpatched forms.

pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[26-49]
pnpm11/installing/deps-installer/src/install/index.ts[655-672]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2120-2125]
pnpm11/releasing/commands/test/deploy/shared-lockfile.test.ts[935-947]
pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[28-60]
pnpm/crates/config/src/lib.rs[2157-2165]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest.rs[18-30]
pnpm/crates/deps-restorer/src/virtual_store_layout.rs[528-573]

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

## Issue description
The fast-update logic for `patchedDependencies` decides whether a changed/removed patch key affects the lockfile by computing the “applied” set only from the *current* config patch groups. When the user removes `patchedDependencies`, those patch groups become empty/`None`, so removals of previously-applied patches can be misclassified as safe, allowing the fast-path to drop `lockfile.patchedDependencies` while leaving snapshots/depPaths still keyed with `(patch_hash=...)`.

## Issue Context
In pnpm, when a patch matches a locked package, the resolver appends `(patch_hash=...)` to the package identity / snapshot key (and that patch hash is incorporated into virtual-store paths / identity hashing). Therefore, removing an applied patch must force a full resolution to rekey the dependency graph back to unpatched identities; the fast-path needs to detect removals of patches that were applied historically (recorded in the lockfile), not just patches that are applied under the current config.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[26-49]
- pnpm11/installing/deps-installer/src/install/index.ts[655-784]
- pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[28-60]
- pnpm/crates/config/src/lib.rs[2157-2165]

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


Results up to commit b7b80ff ⚖️ Balanced


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


Remediation recommended
1. Double suffix scan (Rust) 🐞 Bug ➹ Performance
Description
plan_rekeys()/planRekeys() computes base via remove_suffix()/removeSuffix() and then
immediately calls index_of_dep_path_suffix()/indexOfDepPathSuffix() again on the same rendered
depPath string, causing two full suffix scans per snapshot/package key. This redundant work adds
avoidable CPU overhead on large lockfiles in the new patchedDependencies fast-update path (Rust and
TS).
Code

pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[R75-78]

+        let rendered = key.to_string();
+        let base = remove_suffix(&rendered);
+        let peers =
+            index_of_dep_path_suffix(&rendered).peers_index.map_or("", |index| &rendered[index..]);
Relevance

●●● Strong

Team often accepts small, concrete perf fixes eliminating redundant work; especially in fast-update
paths.

PR-#13170
PR-#13482
PR-#13600

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In plan_rekeys, the code calls remove_suffix(&rendered) and then separately invokes
index_of_dep_path_suffix(&rendered), meaning the suffix parser is run twice for the same key; this
duplication is concrete because remove_suffix is implemented internally by calling
index_of_dep_path_suffix. The same pattern exists in the TS fast-update path where planRekeys()
calls removeSuffix(depPath) and then indexOfDepPathSuffix(depPath), and in @pnpm/deps.path
removeSuffix() is implemented by calling indexOfDepPathSuffix(), proving two full suffix scans
per entry.

pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[74-78]
pnpm/crates/deps-path/src/suffix_index.rs[10-56]
pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[86-90]
pnpm11/deps/path/src/index.ts[66-118]

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

## Issue description
The patchedDependencies fast-update path (both Rust and TS) redundantly scans depPath suffixes inside `plan_rekeys()`/`planRekeys()`: `remove_suffix()`/`removeSuffix()` already performs a full `index_of_dep_path_suffix()`/`indexOfDepPathSuffix()` scan, and the caller immediately scans again to locate indexes such as `peers_index`/`peersIndex` (and potentially `patchHashIndex`). This causes two full suffix scans per snapshot/package key, adding avoidable CPU overhead on large lockfiles.

## Issue Context
This fast-update path runs across many (potentially all) `lockfile.packages`/snapshot entries when a patchedDependencies change is detected and is intended to be faster than full resolution; repeated per-entry string scans reduce the intended performance benefit.

## Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs[74-78]
- pnpm/crates/deps-path/src/suffix_index.rs[10-56]
- pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts[86-90]
- pnpm11/deps/path/src/index.ts[66-118]

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


Results up to commit 8f983b7 ⚖️ Balanced


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


Remediation recommended
1. trackRequestedPackages declared too early 📘 Rule violation ⚙ Maintainability
Description
trackRequestedPackages() is declared before its first usage in the same TypeScript file, violating
the required declaration order. This makes the file harder to scan because helper definitions appear
before the tests that motivate them.
Code

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[R21-24]

+function trackRequestedPackages (storeController: StoreController): string[] {
+  const requestedPackages: string[] = []
+  const requestPackage = storeController.requestPackage
+  storeController.requestPackage = async (wantedDependency, requestOptions) => {
Relevance

●●● Strong

Maintainability/compliance-style changes in tests are usually accepted; easy reorder with no
behavior impact.

PR-#13383

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713432 requires TypeScript function declarations to come after at least one usage
in the same file. trackRequestedPackages() is declared near the top of the file but first used
later when capturing requestedPackages.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-29]
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[160-176]

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

## Issue description
The helper `trackRequestedPackages()` is declared before its first usage, which violates the repo rule that TypeScript function declarations should appear only after they are first used.

## Issue Context
This rule applies to `function foo(...) {}` declarations in `.ts` files. The function is used later in the test `adding a patch for a locked package rekeys it without resolution`.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-29]
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[160-176]

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


2. Alias assumed always present 🐞 Bug ☼ Reliability
Description
trackRequestedPackages() records wantedDependency.alias! even though resolver-base WantedDependency
allows alias to be absent, so alias-less requests can crash the test harness and mask the real
behavior under test.
Code

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[R23-26]

+  const requestPackage = storeController.requestPackage
+  storeController.requestPackage = async (wantedDependency, requestOptions) => {
+    requestedPackages.push(wantedDependency.alias!)
+    return requestPackage(wantedDependency, requestOptions)
Relevance

●● Moderate

Repo test helpers often use non-null assertions on optional fields; may keep alias! if invariant
holds.

PR-#12876

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test helper dereferences wantedDependency.alias with a non-null assertion, but resolver-base
defines WantedDependency as a union where alias is optional in one branch.

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-27]
pnpm11/resolving/resolver-base/src/index.ts[423-432]

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

### Issue description
`trackRequestedPackages()` pushes `wantedDependency.alias!` into an array. `WantedDependency` permits `alias` to be absent, so if `requestPackage` is invoked with an alias-less wantedDependency (e.g. tarball/git/local forms), this test instrumentation can throw and hide the actual install behavior.

### Issue Context
This is test-only, but it impacts CI reliability and can produce misleading failures as resolver/store behavior evolves.

### Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[21-29]

### Suggested change
Record a safe identifier, e.g.:
- `requestedPackages.push(wantedDependency.alias ?? wantedDependency.bareSpecifier ?? '<unknown>')`

Optionally, restore the original function after the tracked install if this helper is reused elsewhere.

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



Informational
3. Indirect resolution-skip signal 🐞 Bug ⚙ Maintainability
Description
The integration test asserts requestedPackages is empty, but requestPackage calls are not a
stable/unique signal for whether resolution ran, reducing the assertion’s long-term diagnostic
value.
Code

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[R175-178]

+  // pacquet's `lockfile_resolution_reuse` is what proves resolution is skipped.
+  expect(requestedPackages).toStrictEqual([])
+  const lockfile = project.readLockfile()
+  expect(lockfile.patchedDependencies).toStrictEqual({ '[email protected]': patchFileHash })
Relevance

●●● Strong

Team has accepted strengthening regression tests to assert stable, diagnostic signals rather than
weak proxies.

PR-#13636

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test’s own comment states the empty-request assertion is 'necessary but not sufficient', and the
codebase uses requestPackage in contexts unrelated to a full dependency-graph resolution step
(e.g. warnings/validation with skipFetch: true).

pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[171-178]
pnpm11/installing/deps-installer/src/install/warnOnStaleConvergenceOverrides.ts[36-55]

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

### Issue description
The test uses `expect(requestedPackages).toStrictEqual([])` as a proxy for “resolution was skipped.” This is not a stable or unique indicator (the test itself notes it is not sufficient), so the assertion can become brittle or misleading if internal implementation changes.

### Issue Context
There is already complementary coverage elsewhere (e.g. pacquet integration test asserting the explicit “resolution step is skipped” output). This suggestion is only to improve the TS test’s signal quality.

### Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts[146-213]

### Suggested change
Prefer asserting an explicit, stable signal (e.g. capture and assert the log/output that indicates fast-path/no-resolution), or drop the `requestedPackages === []` assertion and rely on the end-state assertions (lockfile snapshot key + patched file contents).

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


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@codecov-commenter

codecov-commenter commented Aug 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.26174% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.16%. Comparing base (dd0e058) to head (b7b80ff).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ge-manager/src/fast_update_patched_dependencies.rs 88.96% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13680      +/-   ##
==========================================
- Coverage   88.16%   88.16%   -0.01%     
==========================================
  Files         612      613       +1     
  Lines       99579    99728     +149     
==========================================
+ Hits        87791    87921     +130     
- Misses      11788    11807      +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 09ed5fc11aa8

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.987 ± 0.197 2.714 3.238 1.79 ± 0.19
pacquet@main 2.959 ± 0.113 2.789 3.122 1.77 ± 0.16
pnpr@HEAD 1.673 ± 0.141 1.558 2.038 1.00
pnpr@main 1.725 ± 0.223 1.479 2.052 1.03 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.98655473914,
      "stddev": 0.19689262273970085,
      "median": 2.97490988994,
      "user": 2.78986716,
      "system": 2.1213043999999996,
      "min": 2.71371167844,
      "max": 3.23834964844,
      "times": [
        3.22803736944,
        2.80906720644,
        2.71371167844,
        2.89380408844,
        2.78848146144,
        2.84950750744,
        3.1487382244399997,
        3.23834964844,
        3.13983451544,
        3.05601569144
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.9594388256400004,
      "stddev": 0.11332373373721624,
      "median": 2.97573183744,
      "user": 2.82785296,
      "system": 2.1305707000000003,
      "min": 2.7892830694399997,
      "max": 3.1220550124399997,
      "times": [
        3.04369269444,
        3.05340012444,
        2.85478474944,
        2.86907811944,
        2.98294967144,
        2.7892830694399997,
        2.84470501944,
        3.1220550124399997,
        3.06592579244,
        2.96851400344
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6729514143400004,
      "stddev": 0.141409320098122,
      "median": 1.6430119629400002,
      "user": 1.79148496,
      "system": 1.9851126999999997,
      "min": 1.55796731244,
      "max": 2.03828006644,
      "times": [
        1.7057966244400002,
        1.68543398244,
        1.5896137594400002,
        1.55796731244,
        1.61123894544,
        1.7169988734400001,
        1.5794156454400001,
        2.03828006644,
        1.6747849804400001,
        1.5699839534400002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.72472466394,
      "stddev": 0.22261365034165684,
      "median": 1.63700275044,
      "user": 1.7093665599999999,
      "system": 1.8041220999999996,
      "min": 1.4793826434400001,
      "max": 2.0521790964399997,
      "times": [
        1.9350811814400002,
        2.00180161744,
        1.57229066044,
        2.0521790964399997,
        1.56298258244,
        1.70171484044,
        1.8904454964400002,
        1.5474475754400001,
        1.5039209454400002,
        1.4793826434400001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 322.4 ± 19.5 299.2 354.2 1.01 ± 0.08
pacquet@main 317.7 ± 16.5 295.0 343.6 1.00
pnpr@HEAD 326.6 ± 11.4 301.4 337.1 1.03 ± 0.06
pnpr@main 329.1 ± 10.5 311.0 344.9 1.04 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.32243324398,
      "stddev": 0.019536920730483562,
      "median": 0.31892041568,
      "user": 0.27133869999999993,
      "system": 0.60992252,
      "min": 0.29916227918,
      "max": 0.35415194318000004,
      "times": [
        0.35415194318000004,
        0.32537424918,
        0.34548633118,
        0.33597912718,
        0.33524884418,
        0.30446324518,
        0.30167445218,
        0.31246658218,
        0.29916227918,
        0.31032538618
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.31774295098,
      "stddev": 0.01647502117885753,
      "median": 0.32155523918,
      "user": 0.27896319999999997,
      "system": 0.59765622,
      "min": 0.29504299418,
      "max": 0.34364324618000003,
      "times": [
        0.33256228318000003,
        0.32753989118000004,
        0.32510195718,
        0.32847253418,
        0.31800852118,
        0.29630198118,
        0.30715072818,
        0.30360537318,
        0.29504299418,
        0.34364324618000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32661121888,
      "stddev": 0.0113815610859151,
      "median": 0.33097018968,
      "user": 0.2765383,
      "system": 0.5895803199999999,
      "min": 0.30139744118,
      "max": 0.33705302718,
      "times": [
        0.33064437718,
        0.33705302718,
        0.30139744118,
        0.33132964518,
        0.31921433818,
        0.33027020418,
        0.33692474518000004,
        0.33129600218,
        0.33327604518000004,
        0.31470636318
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.32905240178,
      "stddev": 0.010467955090177424,
      "median": 0.32805221868,
      "user": 0.28887029999999997,
      "system": 0.60817162,
      "min": 0.31100643718000004,
      "max": 0.34487096518000004,
      "times": [
        0.33731105218,
        0.33838423018,
        0.32366509518000003,
        0.33243934218000004,
        0.32197290418,
        0.33696698418000004,
        0.31100643718000004,
        0.32265621018,
        0.32125079718,
        0.34487096518000004
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.625 ± 0.033 2.576 2.676 1.69 ± 0.09
pacquet@main 2.611 ± 0.067 2.570 2.789 1.68 ± 0.10
pnpr@HEAD 1.552 ± 0.081 1.458 1.667 1.00
pnpr@main 1.610 ± 0.152 1.421 1.825 1.04 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.62547049438,
      "stddev": 0.03341081313528463,
      "median": 2.6163272073800004,
      "user": 1.55875896,
      "system": 1.3368941199999995,
      "min": 2.57620020988,
      "max": 2.67606171688,
      "times": [
        2.65919372288,
        2.67606171688,
        2.60448956488,
        2.67209201388,
        2.59833553588,
        2.6137752738800004,
        2.6188791408800003,
        2.60610273188,
        2.62957503288,
        2.57620020988
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.61131910398,
      "stddev": 0.06653287744473943,
      "median": 2.58565638488,
      "user": 1.5369955599999998,
      "system": 1.3229833199999996,
      "min": 2.5698363148800003,
      "max": 2.78876128588,
      "times": [
        2.5698363148800003,
        2.58171459888,
        2.56990270088,
        2.78876128588,
        2.64226735588,
        2.61752345388,
        2.5802547828800004,
        2.58959817088,
        2.57265356188,
        2.60067881388
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5517221248800002,
      "stddev": 0.08112354205581428,
      "median": 1.52559178088,
      "user": 1.0197216599999999,
      "system": 1.1549502200000001,
      "min": 1.45839538188,
      "max": 1.66731232688,
      "times": [
        1.66731232688,
        1.5233712558799999,
        1.5305828558799999,
        1.66467470788,
        1.52781230588,
        1.51006406588,
        1.6578933328799998,
        1.51675700288,
        1.46035801288,
        1.45839538188
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6097731664800001,
      "stddev": 0.15195422051086385,
      "median": 1.59654539538,
      "user": 0.9920238600000001,
      "system": 1.2022848199999998,
      "min": 1.42111637388,
      "max": 1.82511328788,
      "times": [
        1.81542271788,
        1.57492275688,
        1.42111637388,
        1.7709039928799999,
        1.54254180888,
        1.4521176568799998,
        1.82511328788,
        1.63045552888,
        1.61816803388,
        1.44696950688
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 442.3 ± 54.0 394.0 564.4 1.39 ± 0.20
pacquet@main 398.2 ± 8.4 386.1 413.2 1.25 ± 0.11
pnpr@HEAD 321.1 ± 14.2 297.6 344.5 1.01 ± 0.09
pnpr@main 319.3 ± 26.2 293.7 365.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.44228022092,
      "stddev": 0.054034396612353625,
      "median": 0.41985324972000004,
      "user": 0.58428028,
      "system": 0.72665288,
      "min": 0.39395641872000003,
      "max": 0.56443850872,
      "times": [
        0.41728722972000004,
        0.56443850872,
        0.5054472737200001,
        0.46452400272000005,
        0.42241926972000005,
        0.40391528572,
        0.42575255772000004,
        0.39395641872000003,
        0.41200482772,
        0.41305683472000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.39821466322,
      "stddev": 0.008449578412591313,
      "median": 0.39761125172,
      "user": 0.5262163799999999,
      "system": 0.6703492799999999,
      "min": 0.38606201372000004,
      "max": 0.41323239572000003,
      "times": [
        0.38606201372000004,
        0.39366658472000005,
        0.41323239572000003,
        0.39619805472,
        0.40532132872000004,
        0.40490772172000006,
        0.40112386672000006,
        0.39824174772000004,
        0.38641216272000006,
        0.39698075572
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32107623782000005,
      "stddev": 0.014242170708658308,
      "median": 0.32199038572000005,
      "user": 0.21953358,
      "system": 0.5336686799999999,
      "min": 0.29757932472000004,
      "max": 0.34448480372,
      "times": [
        0.31909163572000004,
        0.32182120772000006,
        0.32215956372000004,
        0.30570933172000003,
        0.34448480372,
        0.33196190672000003,
        0.32841137872000004,
        0.33218075772000005,
        0.29757932472000004,
        0.30736246772000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3193141655200001,
      "stddev": 0.026238446315244822,
      "median": 0.30963091022,
      "user": 0.20592908,
      "system": 0.5480708799999999,
      "min": 0.29374370972,
      "max": 0.36498122972,
      "times": [
        0.30958325572,
        0.32477753972,
        0.36498122972,
        0.36456840272,
        0.30671388772,
        0.32514001072000004,
        0.30967856472000005,
        0.29631138972000004,
        0.29764366472000003,
        0.29374370972
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.751 ± 0.037 1.723 1.846 5.88 ± 0.23
pacquet@main 1.724 ± 0.015 1.706 1.747 5.79 ± 0.20
pnpr@HEAD 0.317 ± 0.018 0.291 0.347 1.06 ± 0.07
pnpr@main 0.298 ± 0.010 0.287 0.313 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7506052355600001,
      "stddev": 0.03684619860647993,
      "median": 1.73733047756,
      "user": 0.7368338999999999,
      "system": 0.77909064,
      "min": 1.7231678595600002,
      "max": 1.84633918656,
      "times": [
        1.73744359556,
        1.7372173595600002,
        1.74933894256,
        1.7758689305600002,
        1.73515309656,
        1.7250053165600001,
        1.7231678595600002,
        1.84633918656,
        1.73085367856,
        1.7456643895600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.72390987106,
      "stddev": 0.01477589018385558,
      "median": 1.72176447506,
      "user": 0.7155805999999999,
      "system": 0.7238598399999999,
      "min": 1.70571434756,
      "max": 1.74695680156,
      "times": [
        1.74675836756,
        1.7289375045600002,
        1.72388845556,
        1.7083968935600002,
        1.7196404945600001,
        1.71325455056,
        1.7322725975600002,
        1.70571434756,
        1.71327869756,
        1.74695680156
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31659637446000005,
      "stddev": 0.01811515992059268,
      "median": 0.31503839506000003,
      "user": 0.21705959999999996,
      "system": 0.53446904,
      "min": 0.29129653856000004,
      "max": 0.34744832756,
      "times": [
        0.32909004156000005,
        0.31623270356,
        0.30618306856,
        0.31527361856,
        0.30373282456,
        0.34744832756,
        0.34202862256,
        0.31480317156000004,
        0.29987482756,
        0.29129653856000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29782897676,
      "stddev": 0.009766531726856993,
      "median": 0.29396826556,
      "user": 0.19865019999999997,
      "system": 0.50107814,
      "min": 0.28731320556,
      "max": 0.31346343156,
      "times": [
        0.29200338956,
        0.29132312856000003,
        0.28731320556,
        0.29335812756,
        0.29499750256,
        0.31215266556000004,
        0.30897125056,
        0.29012866256000003,
        0.29457840356000004,
        0.31346343156
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 181.7 ± 10.4 174.5 215.4 2.10 ± 0.13
pacquet@main 181.2 ± 3.9 176.1 188.6 2.10 ± 0.07
pnpr@HEAD 90.7 ± 7.2 85.2 108.5 1.05 ± 0.09
pnpr@main 86.4 ± 2.1 82.4 89.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18174033030923076,
      "stddev": 0.01039676586042233,
      "median": 0.17953966554,
      "user": 0.16466606307692308,
      "system": 0.07121639692307691,
      "min": 0.17450430354000002,
      "max": 0.21543377354,
      "times": [
        0.21543377354,
        0.18068944854,
        0.17529526054,
        0.17450430354000002,
        0.17614722354,
        0.18045953554,
        0.18150614454,
        0.18245514954,
        0.17953966554,
        0.18005207954,
        0.17928685054000001,
        0.17825370654,
        0.17900115254
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.18123667197749999,
      "stddev": 0.003853363726148486,
      "median": 0.18108186704,
      "user": 0.1660418275,
      "system": 0.070510195,
      "min": 0.17613081354000001,
      "max": 0.18860502054,
      "times": [
        0.17835483654,
        0.17613081354000001,
        0.17634873254,
        0.18379420954,
        0.18346048254,
        0.18171411654,
        0.17760480554,
        0.18373341454,
        0.18699864754,
        0.17804569454,
        0.18860502054,
        0.18044961754,
        0.18522511154000001,
        0.18214447654000002,
        0.18004915454,
        0.17712761754
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09065137254,
      "stddev": 0.007185842313509198,
      "median": 0.08759453954000002,
      "user": 0.02272435875,
      "system": 0.010595528750000003,
      "min": 0.08520510354000001,
      "max": 0.10845466354000001,
      "times": [
        0.08892529354,
        0.08893761654000001,
        0.08646901254000001,
        0.08749141654,
        0.08789280954,
        0.08520510354000001,
        0.08741944054000002,
        0.08820903554000001,
        0.08665721554000001,
        0.08915865254000001,
        0.08676791354,
        0.08659553054,
        0.08768025054,
        0.08795385554000001,
        0.08538830854000001,
        0.08672040454000002,
        0.09396614654000002,
        0.10799779354000001,
        0.10375555254000002,
        0.10801892354,
        0.10451715654000002,
        0.10845466354000001,
        0.09089963854000001,
        0.08628062754000002,
        0.08929502854000002,
        0.08651063054000001,
        0.08626550854000001,
        0.08702877554,
        0.08682823854,
        0.08750882854000001,
        0.08718527054000001,
        0.08885927854000002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08636130542235297,
      "stddev": 0.0020775832727040096,
      "median": 0.08684656654000002,
      "user": 0.02043743411764706,
      "system": 0.008430722352941174,
      "min": 0.08237061154000001,
      "max": 0.08985540254000002,
      "times": [
        0.08341116954000001,
        0.08781308054,
        0.08776273654000001,
        0.08635713154,
        0.08985540254000002,
        0.08644648954,
        0.08492064854,
        0.08684604054000002,
        0.08814747954000002,
        0.08659988754000002,
        0.08290809254,
        0.08763735954000001,
        0.08834458054000001,
        0.08565611354000001,
        0.08721117754000002,
        0.08791853954,
        0.08704745954000001,
        0.08789710854,
        0.08684938854000002,
        0.08887788354000001,
        0.08605639554000001,
        0.08777479854000002,
        0.08671225954000002,
        0.08237061154000001,
        0.08253377854,
        0.08263355554000001,
        0.08756648654000002,
        0.08766403954000002,
        0.08678252254000002,
        0.08254655254000001,
        0.08858537354000001,
        0.08672945154000002,
        0.08684709254000002,
        0.08297369654000002
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 864.4 ± 217.3 598.6 1268.3 1.07 ± 0.43
pacquet@main 808.0 ± 252.0 510.9 1302.0 1.00
pnpm@HEAD 2988.4 ± 123.2 2845.4 3274.0 3.70 ± 1.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8643754634266667,
      "stddev": 0.21725496526603966,
      "median": 0.7899146707600001,
      "user": 0.8159385688888887,
      "system": 0.16616445555555556,
      "min": 0.59861785576,
      "max": 1.2683412137599999,
      "times": [
        0.7078670957600001,
        0.8847484627600001,
        0.6790406347600001,
        0.59861785576,
        1.06013648876,
        1.03452709076,
        0.75618565776,
        0.7899146707600001,
        1.2683412137599999
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.8080175896488889,
      "stddev": 0.25197947989142055,
      "median": 0.7173593127600001,
      "user": 0.74224468,
      "system": 0.17792245555555553,
      "min": 0.51085656976,
      "max": 1.30198311476,
      "times": [
        0.70874068976,
        0.92821992476,
        1.30198311476,
        0.51085656976,
        1.08634879276,
        0.6547199407600001,
        0.75397983676,
        0.6099501247600001,
        0.7173593127600001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.9884445406488886,
      "stddev": 0.12322563462489618,
      "median": 2.96584520476,
      "user": 4.609799124444444,
      "system": 0.2531579,
      "min": 2.84535024776,
      "max": 3.27399349276,
      "times": [
        3.05420230076,
        3.27399349276,
        2.9589941457599997,
        2.98666307876,
        2.96584520476,
        2.84535024776,
        2.8967016547599997,
        2.99822540176,
        2.91602533876
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.542 ± 0.109 4.403 4.731 1.29 ± 0.06
pacquet@main 4.601 ± 0.145 4.443 4.871 1.31 ± 0.06
pnpr@HEAD 3.524 ± 0.129 3.442 3.872 1.00
pnpr@main 3.558 ± 0.077 3.459 3.650 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.542137179519999,
      "stddev": 0.10927244877499483,
      "median": 4.5062066208200005,
      "user": 1.6346000799999998,
      "system": 1.36913126,
      "min": 4.40334034182,
      "max": 4.73095544382,
      "times": [
        4.4857249688200005,
        4.46106688082,
        4.5776840858200005,
        4.73095544382,
        4.54268931382,
        4.50773483882,
        4.40334034182,
        4.72894868082,
        4.50467840282,
        4.47854883782
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.6012791140200004,
      "stddev": 0.14490919861183774,
      "median": 4.60141030782,
      "user": 1.6572648800000003,
      "system": 1.39017906,
      "min": 4.44316308082,
      "max": 4.87132605582,
      "times": [
        4.64735297682,
        4.45004357682,
        4.69072168182,
        4.46357082882,
        4.87132605582,
        4.44316308082,
        4.48061591382,
        4.725503492820001,
        4.68502589382,
        4.55546763882
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.52387779612,
      "stddev": 0.12900626999576142,
      "median": 3.48240830732,
      "user": 1.17202428,
      "system": 1.2547211600000001,
      "min": 3.44181455082,
      "max": 3.8721232798200003,
      "times": [
        3.52109995282,
        3.44181455082,
        3.45452704082,
        3.44824453782,
        3.44396953082,
        3.47681002282,
        3.55955061482,
        3.53263183882,
        3.8721232798200003,
        3.48800659182
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.558218664020001,
      "stddev": 0.07735982026538342,
      "median": 3.53098385532,
      "user": 1.2962533799999998,
      "system": 1.31434426,
      "min": 3.4587188808200002,
      "max": 3.64951726382,
      "times": [
        3.4587188808200002,
        3.54970009682,
        3.51226761382,
        3.50927757182,
        3.6490153218200003,
        3.63410848582,
        3.50134357582,
        3.47603388382,
        3.64951726382,
        3.64220394582
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13680
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,576.20 ms
(-4.96%)Baseline: 2,710.57 ms
3,252.69 ms
(79.20%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,723.17 ms
(-4.40%)Baseline: 1,802.50 ms
2,163.00 ms
(79.67%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
393.96 ms
(-13.30%)Baseline: 454.40 ms
545.28 ms
(72.25%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
174.50 ms
(-17.46%)Baseline: 211.42 ms
253.70 ms
(68.78%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,713.71 ms
(+10.11%)Baseline: 2,464.49 ms
2,957.39 ms
(91.76%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,403.34 ms
(-2.35%)Baseline: 4,509.23 ms
5,411.08 ms
(81.38%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
299.16 ms
(-1.04%)Baseline: 302.30 ms
362.75 ms
(82.47%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
598.62 ms
(-17.27%)Baseline: 723.58 ms
868.30 ms
(68.94%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13680
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,458.40 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
291.30 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
297.58 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.21 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,557.97 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,441.81 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
301.40 ms
🐰 View full continuous benchmarking report in Bencher

Applicability was decided from the current configuration alone, so
removing a patch key looked inert: the key is gone from the new groups,
nothing matches it, and the fast path dropped `patchedDependencies`
while the recorded graph kept its `(patch_hash=...)` keys.

Decide it from the recorded map as well. Both directions of a change now
run through the same matching, since a key the previous install applied
owns a patch-hash segment just as a newly added one would.

Group the affected keys directly instead of asking the config to resolve
and hash the patch files a second time. Only the key decides what a
patch matches, so the grouping needs no payload and no filesystem read;
`patched_dependency_hashes` had already read every file.

Give the fallback install in the integration test a real patch fixture
and assert it succeeds. The placeholder diff made it fail with
ERR_PNPM_INVALID_PATCH, which an unchecked exit status hid.

Reported by CodeRabbit, Greptile, and Qodo on #13680.
Copilot AI review requested due to automatic review settings August 6, 2026 14:29

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.

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7a0d8ef

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Resolution never reads a patch. It appends the patch file's hash to an
already-resolved package id, so a `patchedDependencies` change leaves the
set of packages and versions untouched and moves only the affected keys.
Rewrite those keys and the references pointing at them, rather than
falling back to the resolver whenever a patch matches a locked package.

`packages:` is keyed without the patch hash, so only `snapshots:`, the
importers' resolved versions, and dependents' dependency references move.
The patched tarball is already in the store, so materialization applies
the patch with no network access at all.

Two cases still need the resolver. A patched package that some snapshot
reaches as a peer is embedded in that dependent's peer suffix, so it
would rekey the dependent too; and a peer suffix that pnpm shortened into
a hash cannot be inspected to rule that out.
Copilot AI review requested due to automatic review settings August 6, 2026 15:11
The rekey gives the package a new depPath, so it lands in a fresh
virtual-store slot and its install script runs against the patched
sources rather than reusing the previous build.
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8f983b7

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

The resolver matches a patch against a package's plain semver version,
while this path reads the version out of the lockfile key, where a named
registry (`name@registry:version`) or a git / tarball reference occupies
the same slot. The two only agree on plain semver, so an exact-version
patch key for a named-registry package matched during a resolve but not
here, and the rewrite recorded the new configuration while dropping the
patch hash from the key.

Reproducing the resolver's matching from the key is not possible, so the
question is only whether it could matter: any configured patch naming the
package, or a patch hash already on its key, now hands the decision back
to the resolver. A key nothing could reach is left alone, so one git or
tarball dependency does not disable the rewrite for the whole lockfile.

Reported by Greptile on #13680.
Copilot AI review requested due to automatic review settings August 6, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 09ed5fc

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan merged commit ffc51c8 into main Aug 6, 2026
22 of 43 checks passed
@zkochan
zkochan deleted the perf-lockfile4 branch August 6, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants