Skip to content

fix: remove a dependency whose manifest is malformed - #17828

Merged
zkochan merged 2 commits into
mainfrom
fix-v11-malformed-manifest-removal
Nov 7, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-v11-malformed-manifest-removal

Conversation

@zkochan

@zkochan zkochan commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes pnpm/tasks#295.

In v11, removeBinsOfDependency threw ERR_PNPM_BAD_PACKAGE_JSON on a removed dependency's malformed package.json. Three paths go through it, so the install failed before the dependency was removed:

  • the isolated linker's prune;
  • the hoisted stale-link pass, when the project has a real .bin;
  • the hoisted orphan cleanup.

v12 skips the bins and removes the dependency (remove_dep_bins_with_version). v11 now does the same. A new safeReadDependencyManifest in @pnpm/bins.remover returns undefined for a missing or malformed manifest, or one under a path that is not a directory, and rethrows other errors. removeBinsOfDependency and the hoisted stale-link pass both use it, so the reader that #17820 added to the hoisted pass is gone.

v12 needs no code change. Its test now also covers a real .bin, to match v11's.

The test a removed link: dependency with a malformed manifest is unlinked now runs under each linker, with and without a real .bin, in both stacks. Without the fix, the v11 isolated cases and the hoisted case with a real .bin fail. The hoisted case without one already passed through the reader from #17820. It now covers the shared reader that replaces that one.

Squash Commit Body

`removeBinsOfDependency` read the removed dependency's manifest with
`safeReadPackageJsonFromDir`, which throws on a malformed
`package.json`. The isolated linker's prune, the hoisted stale-link
pass with a real `.bin`, and the hoisted orphan cleanup all go through
it, so a malformed manifest failed the install before the dependency
was removed. v12 skips the bins and removes the dependency.

A new `safeReadDependencyManifest` returns `undefined` for a missing or
malformed manifest, or one under a path that is not a directory, and
rethrows other errors, as v12 does. `removeBinsOfDependency` and the
hoisted stale-link pass both use it. Both stacks' tests now cover the
removal under each linker, with and without a real `.bin`.

Closes pnpm/tasks#295

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • 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.

🤖 Generated with Claude Code


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

Summary by CodeRabbit

  • Bug Fixes
    • Removing a dependency with a malformed package manifest no longer fails.
    • Associated command-line binaries are preserved when the manifest cannot be read.
    • Dependency removal and reporting now behave consistently with both isolated and hoisted installation layouts, whether or not the dependency declares a binary.
    • Removal results correctly reflect that the dependency is no longer linked, even when its manifest is malformed.

`removeBinsOfDependency` read the removed dependency's manifest with
`safeReadPackageJsonFromDir`, which throws on a malformed
`package.json`. The isolated linker's prune, the hoisted stale-link
pass with a real `.bin`, and the hoisted orphan cleanup all go through
it, so a malformed manifest failed the install before the dependency
was removed. v12 skips the bins and removes the dependency.

`safeReadDependencyManifest` now returns `undefined` for a missing or
malformed manifest, or one under a path that is not a directory, and
rethrows other errors, as v12 does. `removeBinsOfDependency` and the
hoisted stale-link pass both use it. Both stacks' tests now cover the
removal under each linker, with and without a real `.bin`.

Closes pnpm/tasks#295

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Dependency removal now handles malformed manifests without failing. The changes add a shared safe manifest reader, use it in stale-link removal, and extend tests to cover isolated and hoisted linkers with and without dependency bins.

Changes: Malformed manifest removal

Layer / File(s) Summary
Safe dependency manifest reader
pnpm11/bins/remover/src/removeBins.ts, pnpm11/bins/remover/src/index.ts, pnpm11/bins/remover/package.json, pnpm11/bins/remover/tsconfig.json
safeReadDependencyManifest returns undefined for malformed JSON and ENOTDIR errors. removeBinsOfDependency uses the helper and leaves bins in place when it returns undefined.
Stale-link removal and coverage
pnpm11/installing/deps-restorer/src/unlinkStaleDirectLinks.ts, pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts, pnpm/crates/cli/tests/suite/stale_link_prune.rs, .changeset/remove-dependency-with-malformed-manifest.md
Stale direct-link removal uses the helper to read the linked package version. Tests cover malformed manifests with and without bins under both linkers. The changeset adds patch release entries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Handle malformed manifests during direct dependency removal, including isolated pruning and hoisted stale-link removal with a real .bin directory [#295] ✅
Extend malformed-manifest removal coverage to isolated and hoisted linkers, with and without a dependency bin [#295] ✅

Possibly related PRs

  • pnpm/pnpm#17820: Handles malformed manifests in the hoisted stale-link pass when no real .bin directory exists.

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

Merge Risk: Minimal · up to 78262

The change permits removal of dependencies with malformed manifests. No material merge-blocking risk was established.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1c1739d and 782622d.

Files selected for processing: 2

  • pnpm/crates/cli/tests/suite/stale_link_prune.rs
  • pnpm11/bins/remover/src/removeBins.ts
Files skipped from review as they are similar to previous changes: 1

  • pnpm11/bins/remover/src/removeBins.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@garnet-runtime-review

garnet-runtime-review Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Nothing new recorded

1 job recorded · compared with the last 10 runs on main

TS CI / Test / ubuntu (24.0.0, 2) / Node 24 / chunk 2/3
 ↳ nothing new

Workload · last 10 runs on main → 782622d

  bash
  ├─ rustup
  │  └─ dualstack.k.sni.global.fastly[.]net
  ├─ MainThread › pn
  │  ├─ dash › node › pn
  │  │  ├─ dash › node
  │  │  │  └─ registry.npmjs[.]org
  │  │  └─ node
  │  │     ├─ git
  │  │     │  ├─ git › git › git-remote-http
  │  │     │  │  └─ github[.]com
  │  │     │  └─ 192.168.127[.]1
  │  │     ├─ node
  │  │     │  ├─ git › git › git-remote-http
  │  │     │  │  └─ github[.]com
  │  │     │  ├─ node
  │  │     │  │  └─ registry.npmjs[.]org
  │  │     │  ├─ codeload.github[.]com
  │  │     │  ├─ github[.]com
  │  │     │  ├─ nodejs[.]org
  │  │     │  ├─ registry.npmjs[.]org
  │  │     │  └─ unofficial-builds.nodejs[.]org
  │  │     ├─ pnpr
  │  │     │  └─ registry.npmjs[.]org
  │  │     ├─ codeload.github[.]com
  │  │     ├─ github[.]com
  │  │     └─ pnpm[.]io (9 of the last 10 main runs)
  │  └─ nodejs[.]org
  ├─ gh
  │  └─ api.github[.]com
  └─ node
     ├─ git
     │  ├─ git › git › git-remote-http
     │  │  └─ github[.]com
     │  └─ 192.168.127[.]1
     └─ pn
        ├─ dash › node › pn
        │  ├─ dash › pn › dash › pnpm › dash › node
        │  │  ├─ codeload.github[.]com
        │  │  └─ registry.npmjs[.]org
        │  └─ node
        │     ├─ node
        │     │  └─ registry.npmjs[.]org
        │     ├─ pnpr
        │     │  └─ registry.npmjs[.]org
        │     └─ registry.npmjs[.]org
        └─ nodejs[.]org

  node
  ├─ pnpm
  │  ├─ dualstack.k.sni.global.fastly[.]net
  │  ├─ nodejs[.]org
  │  ├─ registry.npmjs[.]org
  │  └─ unofficial-builds.nodejs[.]org
  ├─ blacksmith.blob.core.windows[.]net
  └─ registry.npmjs[.]org

  systemd › bash
  ├─ bash › bash › bash › bash › bash › bash › bash › bash › dash › node › node › node
  │  ├─ dash › node
  │  │  └─ registry.npmjs[.]org
  │  ├─ codeload.github[.]com
  │  ├─ github[.]com
  │  ├─ nodejs[.]org
  │  ├─ registry.npmjs[.]org
  │  └─ unofficial-builds.nodejs[.]org
  └─ blacksmithd
     └─ 192.168.127[.]1

  MainThread › pnpm
  ├─ dash › node › dash › node
  │  └─ nodejs[.]org
  ├─ git
  │  ├─ git › git › git-remote-http
  │  │  └─ github[.]com
  │  └─ 192.168.127[.]1
  ├─ nodejs[.]org
  └─ unofficial-builds.nodejs[.]org

Runner & GitHub's own traffic · blacksmith-8vcpu-ubuntu-2404 · Linux x86_64

  systemd
  ├─ chronyd
  │  ├─ 137.190.2[.]4
  │  ├─ 163.123.152[.]14
  │  ├─ 169[.]254[.]169[.]123
  │  ├─ 172.233.189[.]68
  │  ├─ 185.125.190[.]56
  │  ├─ 185.125.190[.]57
  │  ├─ 185.125.190[.]58
  │  ├─ 23.157.160[.]168
  │  ├─ 45.63.54[.]13
  │  ├─ 45.83.234[.]123
  │  ├─ 51.81.226[.]229
  │  ├─ 72.14.186[.]59
  │  └─ 91.189.91[.]157
  ├─ nginx › nginx
  │  ├─ 140.82.112[.]22
  │  ├─ 140.82.113[.]21
  │  ├─ 140.82.113[.]22
  │  ├─ 140.82.114[.]21
  │  ├─ 140.82.114[.]22
  │  ├─ 192.168.127[.]1
  │  ├─ 8.8.8[.]8
  │  └─ results-receiver.actions[.]githubusercontent (github infra)
  ├─ snapd
  │  └─ api.snapcraft[.]io
  ├─ sudo › blacksmithd
  │  └─ 192.168.127[.]1
  ├─ systemd-resolve
  │  └─ 8.8.8[.]8
  └─ gh
     └─ results-receiver.actions[.]githubusercontent (github infra)

  node
  └─ productionresultssa11.blob.core[.]windows (github infra)

  MainThread
  └─ productionresultssa31.blob.core[.]windows (github infra)

Job log · Full record in Garnet ↗

How to read this
bash › curl                 ← ancestry as captured, then the process that acted
└─ example[.]com            ← what it reached

Read down: what ran, then what it reached. + only in this commit · − only in the compared run · unmarked in both. Runner & GitHub's own traffic is activity outside your steps and never counts. Recorded at the kernel, best-effort capture. · Docs ↗

Recorded by Garnet · Add it to your CI ↗

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     12.9±0.61ms    29.0 MB/sec    1.10     14.2±0.86ms    26.4 MB/sec
packument/parse                                  1.00     39.2±0.33µs  1693.5 MB/sec    1.04     40.8±1.56µs  1626.7 MB/sec
tarball/download_dependency                      1.00   670.0±31.98µs     6.3 MB/sec    1.16  776.6±128.40µs     5.5 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    163.9±1.31ms 97.6 KElem/sec    1.12   183.7±14.80ms 87.1 KElem/sec
version_pick/repeated_ranges_file                1.03      4.6±0.18ms  6.7 KElem/sec    1.00      4.5±0.07ms  6.9 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.5±0.03ms  6.9 KElem/sec    1.01      4.5±0.18ms  6.9 KElem/sec
version_pick/wildcard_lowest                     1.00     36.2±0.94µs 27.0 KElem/sec    1.01     36.4±0.35µs 26.8 KElem/sec
workspace_resolution/hoist_heavy                 1.01   242.1±13.39ms        ? ?/sec    1.00    240.7±9.48ms        ? ?/sec
workspace_sort/chained_projects                  1.00     12.6±1.13ms        ? ?/sec    1.02     12.8±1.42ms        ? ?/sec

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2543.31 ms 2593.57 ms 2.0% 127.17 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1477.10 ms 1382.24 ms -6.4% 73.85 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 292.44 ms 265.60 ms -9.2% 14.62 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 293.93 ms 337.33 ms 14.8% 14.70 ms Inconclusive (overlapping samples)
isolated-repeat-install-hot-cache-hot-store pacquet 11.06 ms 12.03 ms 8.8% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.89 ms 11.23 ms 3.1% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 10.49 ms 10.59 ms 0.9% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 10.99 ms 10.89 ms -1.0% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2522.60 ms 2523.96 ms 0.1% 126.13 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1448.05 ms 1452.10 ms 0.3% 72.40 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 554.93 ms 587.87 ms 5.9% 27.75 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pnpr 346.45 ms 334.89 ms -3.3% 17.32 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1634.66 ms 1629.47 ms -0.3% 81.73 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 267.26 ms 281.43 ms 5.3% 13.36 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pacquet 249.41 ms 236.52 ms -5.2% 12.47 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 83.53 ms 83.62 ms 0.1% 4.18 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 219.72 ms 218.65 ms -0.5% 10.99 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 98.04 ms 100.74 ms 2.7% 4.90 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 136.16 ms 139.81 ms 2.7% 6.81 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4547.81 ms 4651.56 ms 2.3% 227.39 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3645.86 ms 3578.99 ms -1.8% 182.29 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 149.95 ms 148.27 ms -1.1% 7.50 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 160.34 ms 159.42 ms -0.6% 8.02 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1202.91 ms 1211.15 ms 0.7% 60.15 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 34.10 ms 36.90 ms 8.2% 2.00 ms Inconclusive (overlapping samples)

Same-run syscall check

Each install runs 2 more times per revision, untimed, under strace --follow-forks --summary-only. A file syscall regresses when HEAD's fewest calls exceed main's most by more than 2% of main or 50 calls, whichever is larger. mkdir and mkdirat count only the calls that created a directory, since concurrent installs fail a varying number with EEXIST. A syscall whose identical runs differ by more than that tolerance is reported unstable and not gated, unless HEAD's fewest calls also exceed main's most by more than the tolerance plus that difference. Each scenario lists its largest change relative to its tolerance and every row that is not within tolerance.

Scenario Engine Syscall main calls (max) HEAD calls (min) Change Tolerance Identical-run spread Result
isolated-fresh-restore-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr readlink 15321 15337 +0.1% 306 37 Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet statx 52565 52610 +0.1% 1051 33 Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet readlink 16920 16476 -2.6% 338 406 Unstable (identical runs differ by 406, not gated)
isolated-fresh-install-cold-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet fstat 1380 1386 +0.4% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet symlink 1151 1152 +0.1% 50 12 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet newfstatat 176 190 +8.0% 50 6 Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet access 22 22 +0.0% 50 0 Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 782622dddace

Compared against main at: 492ef479b67d

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.551 ± 0.102 2.403 2.685 1.77 ± 0.18
pacquet@main 2.560 ± 0.072 2.465 2.706 1.78 ± 0.17
pnpr@HEAD 1.439 ± 0.135 1.295 1.715 1.00
pnpr@main 1.482 ± 0.105 1.302 1.651 1.03 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.55136567548,
      "stddev": 0.10205155898484135,
      "median": 2.59357014418,
      "user": 2.6285966,
      "system": 1.7231125999999999,
      "min": 2.40276215618,
      "max": 2.6853666021800002
    },
    {
      "command": "pacquet@main",
      "mean": 2.55973069888,
      "stddev": 0.07227449411608763,
      "median": 2.54331261618,
      "user": 2.4289506999999997,
      "system": 1.5803882999999996,
      "min": 2.4654669831800002,
      "max": 2.70556114718
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4386795702799997,
      "stddev": 0.1348274823236386,
      "median": 1.3822416941800002,
      "user": 2.1271884,
      "system": 1.5091907999999998,
      "min": 1.29455706218,
      "max": 1.71500753318
    },
    {
      "command": "pnpr@main",
      "mean": 1.48192620918,
      "stddev": 0.10521111200965715,
      "median": 1.4770988201800002,
      "user": 2.2090141,
      "system": 1.5050063999999996,
      "min": 1.30211001618,
      "max": 1.65143571418
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 266.5 ± 11.8 252.2 295.3 1.00
pacquet@main 299.4 ± 32.6 272.5 387.9 1.12 ± 0.13
pnpr@HEAD 342.4 ± 49.5 288.1 431.6 1.29 ± 0.19
pnpr@main 297.1 ± 10.2 283.7 313.2 1.11 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2664716403400001,
      "stddev": 0.011817191376332765,
      "median": 0.26559553494000004,
      "user": 0.33473949999999997,
      "system": 0.59045272,
      "min": 0.25216590894,
      "max": 0.29534483694
    },
    {
      "command": "pacquet@main",
      "mean": 0.29944402574000006,
      "stddev": 0.03261648052551954,
      "median": 0.29243572294000003,
      "user": 0.36248080000000005,
      "system": 0.6750769199999999,
      "min": 0.27245814294000004,
      "max": 0.38788114194000006
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3424452754400001,
      "stddev": 0.049531887760141696,
      "median": 0.33732917994,
      "user": 0.36717599999999995,
      "system": 0.74111662,
      "min": 0.28812721694000004,
      "max": 0.43155211494000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.29708740974000003,
      "stddev": 0.010235560260458153,
      "median": 0.29392960644000005,
      "user": 0.32677589999999995,
      "system": 0.64411272,
      "min": 0.28372684194000003,
      "max": 0.31324599594
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.4 ± 1.5 9.4 18.7 1.12 ± 0.16
pacquet@main 11.3 ± 1.3 8.8 14.9 1.02 ± 0.15
pnpr@HEAD 11.6 ± 1.7 9.3 18.8 1.05 ± 0.18
pnpr@main 11.1 ± 0.9 9.2 14.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.012375241928167535,
      "stddev": 0.0014739397209250682,
      "median": 0.01202701008,
      "user": 0.007305412670157066,
      "system": 0.0062001193717277515,
      "min": 0.00936167708,
      "max": 0.01867881408
    },
    {
      "command": "pacquet@main",
      "mean": 0.011275161075238085,
      "stddev": 0.0013239054185020095,
      "median": 0.01105674358,
      "user": 0.0067359342857142845,
      "system": 0.005598867809523809,
      "min": 0.00881126508,
      "max": 0.01494126908
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011617836952222222,
      "stddev": 0.0016956118099360922,
      "median": 0.01122761908,
      "user": 0.006913836666666663,
      "system": 0.005786678000000001,
      "min": 0.00925961608,
      "max": 0.018802585080000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.011088240171666663,
      "stddev": 0.0009489719536096452,
      "median": 0.01089118358,
      "user": 0.006798411666666669,
      "system": 0.0053954300000000005,
      "min": 0.00918628808,
      "max": 0.01470074708
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.7 ± 0.9 8.7 15.0 1.00 ± 0.14
pacquet@main 10.7 ± 1.1 9.1 14.4 1.00
pnpr@HEAD 11.0 ± 1.0 8.7 13.9 1.03 ± 0.14
pnpr@main 11.1 ± 1.0 9.1 13.7 1.04 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010712074069644674,
      "stddev": 0.0009175593333950442,
      "median": 0.010585597759999999,
      "user": 0.0063541152284263954,
      "system": 0.005296214822335025,
      "min": 0.008654369759999999,
      "max": 0.014984244760000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.01069161576,
      "stddev": 0.0011124868967270771,
      "median": 0.01049214776,
      "user": 0.006413974439461884,
      "system": 0.005286861704035875,
      "min": 0.00907753776,
      "max": 0.01437454576
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.010985293395135137,
      "stddev": 0.0009778539999601202,
      "median": 0.01088769776,
      "user": 0.0063977936936936925,
      "system": 0.005598932072072074,
      "min": 0.00873289876,
      "max": 0.013924794760000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.011111680111464425,
      "stddev": 0.0009529471926054579,
      "median": 0.01099443776,
      "user": 0.006548146025104603,
      "system": 0.005579893054393303,
      "min": 0.00910444576,
      "max": 0.01366720176
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.519 ± 0.020 2.487 2.543 1.70 ± 0.11
pacquet@main 2.516 ± 0.022 2.475 2.541 1.70 ± 0.11
pnpr@HEAD 1.513 ± 0.131 1.384 1.727 1.02 ± 0.11
pnpr@main 1.483 ± 0.099 1.387 1.662 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.51911103728,
      "stddev": 0.01994398289356339,
      "median": 2.52395970528,
      "user": 2.2759947,
      "system": 1.41115896,
      "min": 2.48667020528,
      "max": 2.54349563928
    },
    {
      "command": "pacquet@main",
      "mean": 2.51566026128,
      "stddev": 0.022404185777442805,
      "median": 2.5226018002800004,
      "user": 2.280374,
      "system": 1.42384256,
      "min": 2.47456158528,
      "max": 2.54135465128
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5132431813799998,
      "stddev": 0.13132984070207818,
      "median": 1.45210223178,
      "user": 1.7776443999999998,
      "system": 1.3090216600000002,
      "min": 1.3839287222799999,
      "max": 1.72739532228
    },
    {
      "command": "pnpr@main",
      "mean": 1.48271822748,
      "stddev": 0.09881623288982098,
      "median": 1.4480516892800002,
      "user": 1.8208474,
      "system": 1.28505656,
      "min": 1.38664559128,
      "max": 1.66245144028
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 590.4 ± 41.3 532.8 665.2 1.73 ± 0.17
pacquet@main 564.5 ± 31.1 529.4 610.5 1.66 ± 0.15
pnpr@HEAD 340.7 ± 24.3 312.7 377.2 1.00
pnpr@main 358.1 ± 39.4 320.6 444.5 1.05 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.59037848004,
      "stddev": 0.041296763589182585,
      "median": 0.58787247304,
      "user": 0.88669598,
      "system": 1.3041199799999998,
      "min": 0.53282232404,
      "max": 0.66522849704
    },
    {
      "command": "pacquet@main",
      "mean": 0.5644887850400001,
      "stddev": 0.03107462883911022,
      "median": 0.55492851454,
      "user": 0.8351909799999999,
      "system": 1.2242045799999999,
      "min": 0.52938956604,
      "max": 0.61046676804
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34070155864000007,
      "stddev": 0.024344129558520583,
      "median": 0.33488953954000006,
      "user": 0.34710918,
      "system": 0.63015668,
      "min": 0.31269275704000005,
      "max": 0.37717743204000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.35808291904000006,
      "stddev": 0.039430430837757095,
      "median": 0.34644527354000004,
      "user": 0.36430777999999997,
      "system": 0.6570532800000002,
      "min": 0.32059885404000005,
      "max": 0.44448631304
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.628 ± 0.020 1.605 1.665 6.12 ± 0.17
pacquet@main 1.636 ± 0.012 1.622 1.654 6.15 ± 0.16
pnpr@HEAD 0.281 ± 0.005 0.273 0.290 1.06 ± 0.03
pnpr@main 0.266 ± 0.007 0.255 0.275 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.62843098416,
      "stddev": 0.02044523179216358,
      "median": 1.62946712046,
      "user": 0.81752308,
      "system": 0.8123552799999999,
      "min": 1.60518528246,
      "max": 1.66475546446
    },
    {
      "command": "pacquet@main",
      "mean": 1.6363781664600001,
      "stddev": 0.011731226992965008,
      "median": 1.6346610989600001,
      "user": 0.83046708,
      "system": 0.8105653800000001,
      "min": 1.62188563546,
      "max": 1.6542374734599998
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28116944126000004,
      "stddev": 0.005299258976241755,
      "median": 0.28142888846,
      "user": 0.25912248,
      "system": 0.50185198,
      "min": 0.27278139546,
      "max": 0.28985109046
    },
    {
      "command": "pnpr@main",
      "mean": 0.26611004656000004,
      "stddev": 0.006524779853391681,
      "median": 0.26726315346,
      "user": 0.25453788,
      "system": 0.48913898000000006,
      "min": 0.25492410346,
      "max": 0.27530106946
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 238.3 ± 14.0 216.5 262.7 2.81 ± 0.18
pacquet@main 243.9 ± 17.1 215.7 264.8 2.88 ± 0.22
pnpr@HEAD 84.8 ± 2.2 82.3 88.2 1.00 ± 0.04
pnpr@main 84.7 ± 2.2 82.1 89.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2383195987733334,
      "stddev": 0.014007639764198727,
      "median": 0.23652393644000003,
      "user": 0.22626849666666668,
      "system": 0.24792791999999997,
      "min": 0.21647522044000003,
      "max": 0.26269529144
    },
    {
      "command": "pacquet@main",
      "mean": 0.24385120089454543,
      "stddev": 0.01713300956708002,
      "median": 0.24940518944000004,
      "user": 0.2142821709090909,
      "system": 0.24984142,
      "min": 0.21566512944000002,
      "max": 0.26476707244
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.0848471336521212,
      "stddev": 0.0021780696439672198,
      "median": 0.08362345944,
      "user": 0.027764110303030307,
      "system": 0.02006903090909091,
      "min": 0.08230443244,
      "max": 0.08815676444000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.08468394692484851,
      "stddev": 0.002156151129198496,
      "median": 0.08353188744000001,
      "user": 0.028822504242424246,
      "system": 0.019093091515151508,
      "min": 0.08209951744,
      "max": 0.08954661444
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 215.8 ± 17.6 189.5 244.9 1.00
pacquet@main 219.7 ± 15.2 199.9 238.1 1.02 ± 0.11
pnpm@HEAD 4154.9 ± 149.9 3861.8 4418.3 19.25 ± 1.72
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21582303346888893,
      "stddev": 0.017636055812125333,
      "median": 0.21864721258,
      "user": 0.22330066888888891,
      "system": 0.05331855555555555,
      "min": 0.18952061358,
      "max": 0.24492953758000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.21970012002444447,
      "stddev": 0.015175504953893302,
      "median": 0.21971971558,
      "user": 0.23308122444444443,
      "system": 0.042678888888888884,
      "min": 0.19988999758,
      "max": 0.23808034558000002
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.154938486357778,
      "stddev": 0.14993810800002477,
      "median": 4.167819643580001,
      "user": 6.341226668888889,
      "system": 0.38264977777777776,
      "min": 3.86179621258,
      "max": 4.41833829958
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 99.5 ± 8.4 86.2 116.7 1.01 ± 0.11
pacquet@main 98.5 ± 7.1 87.0 113.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.09953103364666667,
      "stddev": 0.00840034738815393,
      "median": 0.10074003038000001,
      "user": 0.09261682000000002,
      "system": 0.05175725333333333,
      "min": 0.08620509238000001,
      "max": 0.11669190638000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.09853731765586207,
      "stddev": 0.0071125178626781065,
      "median": 0.09804433038000002,
      "user": 0.09667106137931034,
      "system": 0.04827660275862069,
      "min": 0.08702188838000001,
      "max": 0.11353562338
    }
  ]
}

Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 137.9 ± 7.9 116.9 148.2 1.03 ± 0.09
pacquet@main 133.7 ± 9.2 106.9 144.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.13791470238761905,
      "stddev": 0.007920075237871006,
      "median": 0.13981377434,
      "user": 0.054966966666666665,
      "system": 0.09551516190476188,
      "min": 0.11687182734000001,
      "max": 0.14823596734
    },
    {
      "command": "pacquet@main",
      "mean": 0.13370249579000001,
      "stddev": 0.00916392329007162,
      "median": 0.13615632334,
      "user": 0.05637249999999999,
      "system": 0.08881165,
      "min": 0.10692157334,
      "max": 0.14409673534
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.671 ± 0.135 4.535 5.012 1.29 ± 0.06
pacquet@main 4.604 ± 0.143 4.451 4.891 1.27 ± 0.07
pnpr@HEAD 3.631 ± 0.149 3.491 3.932 1.00
pnpr@main 3.678 ± 0.130 3.496 3.927 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.67094528714,
      "stddev": 0.13515889396564812,
      "median": 4.651556858039999,
      "user": 2.6329899199999995,
      "system": 1.74552578,
      "min": 4.53534462854,
      "max": 5.01173746254
    },
    {
      "command": "pacquet@main",
      "mean": 4.60354734864,
      "stddev": 0.1426666836297505,
      "median": 4.54781341104,
      "user": 2.49658182,
      "system": 1.7480606799999996,
      "min": 4.45122344454,
      "max": 4.89144224254
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6314262411399993,
      "stddev": 0.14872099202766587,
      "median": 3.57898838154,
      "user": 2.3112161199999997,
      "system": 1.57193408,
      "min": 3.49136281954,
      "max": 3.9321064875399996
    },
    {
      "command": "pnpr@main",
      "mean": 3.6775299343399994,
      "stddev": 0.12963017205683572,
      "median": 3.64586417804,
      "user": 2.3416290199999996,
      "system": 1.5891051800000002,
      "min": 3.49550552254,
      "max": 3.92735915954
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 150.4 ± 4.9 144.6 162.9 1.00
pacquet@main 150.4 ± 6.9 140.8 166.7 1.00 ± 0.06
pnpr@HEAD 161.4 ± 6.5 153.5 179.6 1.07 ± 0.06
pnpr@main 161.9 ± 5.6 152.3 172.1 1.08 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.15036092230444442,
      "stddev": 0.004854097484682148,
      "median": 0.14826639536,
      "user": 0.1851489444444444,
      "system": 0.1493749,
      "min": 0.14460785286,
      "max": 0.16287486386
    },
    {
      "command": "pacquet@main",
      "mean": 0.15037264838941178,
      "stddev": 0.006937521358585548,
      "median": 0.14995349286,
      "user": 0.19180326470588238,
      "system": 0.1396298117647059,
      "min": 0.14078666286,
      "max": 0.16669571286
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.16137284886000003,
      "stddev": 0.006538339033057739,
      "median": 0.15942444636000003,
      "user": 0.1911320625,
      "system": 0.14460602499999997,
      "min": 0.15350900986,
      "max": 0.17961042286
    },
    {
      "command": "pnpr@main",
      "mean": 0.16185544436000004,
      "stddev": 0.005646945357635103,
      "median": 0.16033710786,
      "user": 0.1930625,
      "system": 0.14697658749999998,
      "min": 0.15234038186,
      "max": 0.17206419386
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.223 ± 0.046 1.175 1.306 1.00
pacquet@main 1.225 ± 0.048 1.182 1.331 1.00 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.2227214487600002,
      "stddev": 0.04588619635824387,
      "median": 1.21115004346,
      "user": 0.5006839200000001,
      "system": 0.20242907999999998,
      "min": 1.17540221396,
      "max": 1.30621369196
    },
    {
      "command": "pacquet@main",
      "mean": 1.22514044446,
      "stddev": 0.04823206108663259,
      "median": 1.20290965796,
      "user": 0.48999062000000004,
      "system": 0.19883858000000001,
      "min": 1.18163390396,
      "max": 1.33086259396
    }
  ]
}

Scenario: Cargo: repeat install, hot cache + hot store

Frozen repeat install of a Cargo workspace (cargo.enabled: true) whose crates are already materialized in <storeDir>/v11/crates/ and linked into .pnpm/crates/crates-io. Direct installs only.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 37.2 ± 3.7 31.3 60.7 1.10 ± 0.13
pacquet@main 33.9 ± 2.4 28.1 40.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.03718746201971831,
      "stddev": 0.003671119553655769,
      "median": 0.036896923400000003,
      "user": 0.026819016338028183,
      "system": 0.019776664788732398,
      "min": 0.031258308400000004,
      "max": 0.0606652754
    },
    {
      "command": "pacquet@main",
      "mean": 0.033853590928735626,
      "stddev": 0.0024275824447832816,
      "median": 0.0340988214,
      "user": 0.025586523218390816,
      "system": 0.017335113103448277,
      "min": 0.0281168154,
      "max": 0.0402794664
    }
  ]
}

@codecov-commenter

codecov-commenter commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.06%. Comparing base (ac6e638) to head (782622d).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17828   +/-   ##
=======================================
  Coverage   93.05%   93.06%           
=======================================
  Files        2166     2166           
  Lines      275870   275911   +41     
=======================================
+ Hits       256717   256766   +49     
+ Misses      19153    19145    -8     

☔ 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

Copy link
Copy Markdown

PR Summary by Qodo

Remove dependencies with malformed manifests without failing install

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Prevent malformed dependency manifests from blocking removal in pnpm v11.
• Skip bin removal when a manifest cannot be read, while still reporting and removing the
 dependency.
• Cover both linkers, with and without a real .bin, in v11 and v12 tests.
Diagram

graph TD
  A["Isolated prune"] --> D["Bins remover"] --> E["Safe manifest reader"] --> F{"Manifest valid?"} -->|yes| G["Remove bins"] --> H["Remove dependency"]
  B["Hoisted cleanup"] --> D
  C["Stale link pass"] -->|real bin directory| D
  C -->|no real bin directory| E
  F -->|no| H
Loading
High-Level Assessment

Share the narrowly scoped manifest reader between bin removal and stale-link cleanup. Keeping the tolerance at these removal call sites avoids changing manifest validation elsewhere, while preserving errors other than malformed JSON and non-directory paths.

Files changed (9) +68 / -33

Bug fix (3) +21 / -19
index.tsExport shared safe manifest reader +2/-1

Export shared safe manifest reader

• Exposes 'safeReadDependencyManifest' for use by dependency restoration cleanup.

pnpm11/bins/remover/src/index.ts

removeBins.tsSkip bins when a removed dependency's manifest is unreadable +17/-2

Skip bins when a removed dependency's manifest is unreadable

• Adds a reader that returns no manifest for missing or malformed manifests and non-directory paths, while rethrowing other errors. Bin removal now uses it instead of failing the install.

pnpm11/bins/remover/src/removeBins.ts

unlinkStaleDirectLinks.tsReuse safe manifest reading during stale-link cleanup +2/-16

Reuse safe manifest reading during stale-link cleanup

• Replaces the local version-reading helper with the shared reader when there is no real bin directory. The real-bin path continues through bin removal, which now uses the same tolerant reader.

pnpm11/installing/deps-restorer/src/unlinkStaleDirectLinks.ts

Tests (2) +33 / -14
stale_link_prune.rsExpand v12 stale-link removal coverage +24/-9

Expand v12 stale-link removal coverage

• Runs the malformed-manifest removal scenario under both linkers, with and without a real '.bin' directory. Checks that removal is reported and the link is gone.

pnpm/crates/cli/tests/suite/stale_link_prune.rs

staleLinkPrune.tsTest v11 malformed-manifest removal across linker paths +9/-5

Test v11 malformed-manifest removal across linker paths

• Expands the stale-link test to both linkers, with and without a real '.bin'. Verifies that the link is removed and its removal is reported without a manifest version.

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

Documentation (1) +7 / -0
remove-dependency-with-malformed-manifest.mdDocument malformed-manifest removal fix +7/-0

Document malformed-manifest removal fix

• Adds patch changesets for bins.remover, deps-restorer, and pnpm, describing successful dependency removal when its manifest is malformed.

.changeset/remove-dependency-with-malformed-manifest.md

Other (3) +7 / -0
package.jsonDeclare error utility dependency +1/-0

Declare error utility dependency

• Adds '@pnpm/error' for checking manifest-reader errors.

pnpm11/bins/remover/package.json

tsconfig.jsonReference the error utility project +3/-0

Reference the error utility project

• Adds the TypeScript project reference needed for the new '@pnpm/error' import.

pnpm11/bins/remover/tsconfig.json

pnpm-lock.yamlLock the bins remover's error utility dependency +3/-0

Lock the bins remover's error utility dependency

• Records the new workspace dependency on '@pnpm/error'.

pnpm-lock.yaml

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Reviews (4) · Last reviewed commit: "test: name the bin cases of the malforme..." · Reviewed by Greptile

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

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. A regression case passes without the fix 📜 Skill insight ▣ Testability
Description
The new hoisted / withBin: false case in staleLinkPrune.ts does not fail when the fix is
removed, because the no-bin branch of unlinkDirectLink already tolerates malformed manifests
through readManifestVersion, which this diff removes. The PR description says all four v11 cases
fail without the fix, so only the isolated and bin-bearing hoisted cases actually guard the
regression.
Code

pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts[R70-73]

+test.each(LINKERS.flatMap((nodeLinker) => [
+  { nodeLinker, withBin: false },
+  { nodeLinker, withBin: true },
+]))('a removed link: dependency with a malformed manifest is unlinked (nodeLinker: $nodeLinker, withBin: $withBin)', async ({ nodeLinker, withBin }) => {
Relevance

●●● Strong

Multiple accepted suggestions to add or strengthen regression coverage; no rejections of this type
found.

PR-#14903
PR-#15305
PR-#15182

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule requires a regression test that fails without the production fix. The hoisted no-bin row
passes on the pre-fix code because unlinkStaleDirectLinks.ts already swallows the
malformed-manifest error on that branch.

pnpm11/installing/deps-restorer/src/unlinkStaleDirectLinks.ts[93-111]
pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts[70-73]
Skill: review-code

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

## Issue description
The new `test.each` row for `nodeLinker: hoisted, withBin: false` in `staleLinkPrune.ts` passes on the pre-fix code. The hoisted no-bin path in `unlinkDirectLink` uses `readManifestVersion`, which already tolerated malformed manifests. The PR description states that all four v11 cases fail without the fix, which is wrong for this case.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts[70-80]
- pnpm11/installing/deps-restorer/src/unlinkStaleDirectLinks.ts[93-111]

## Recommended Fix
Either drop the `withBin: false` hoisted row if it adds no regression value, or keep it as a no-regression guard and correct the PR description so it no longer claims all four v11 cases fail without the fix. Confirm by reverting the production change locally and running the test matrix.

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

Dismiss ↗ | View ↗


2. Docstring hides which manifest errors are rethrown ✓ Resolved

Resolving commit: 782622d

Resolution reason
Expanded the safeReadDependencyManifest docstring to document the ENOTDIR case returning undefined
and that all other read errors are rethrown.
Description
The JSDoc on safeReadDependencyManifest says only that undefined is returned when the manifest
is missing or malformed. It omits that a path which is not a directory (ENOTDIR) also returns
undefined, and that every other error is rethrown. Callers in removeBinsOfDependency and
unlinkStaleDirectLinks rely on that split, so a reader who trusts the comment could assume all
failures are swallowed or miss that an unexpected error still aborts the removal.

Grey Divider

Context sources
✅ Compliance rules (platform): 60 rules
✅ Cross-repo context — repo relationships
Review mode: Auto: 🚀 Fast: Localized test refactor plus one small error-tolerant manifest reader; no high-risk areas.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 782622d

Results up to commit 1c1739d ⚖️ Balanced


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


Remediation recommended
1. A regression case passes without the fix 📜 Skill insight ▣ Testability
Description
The new hoisted / withBin: false case in staleLinkPrune.ts does not fail when the fix is
removed, because the no-bin branch of unlinkDirectLink already tolerates malformed manifests
through readManifestVersion, which this diff removes. The PR description says all four v11 cases
fail without the fix, so only the isolated and bin-bearing hoisted cases actually guard the
regression.
Code

pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts[R70-73]

+test.each(LINKERS.flatMap((nodeLinker) => [
+  { nodeLinker, withBin: false },
+  { nodeLinker, withBin: true },
+]))('a removed link: dependency with a malformed manifest is unlinked (nodeLinker: $nodeLinker, withBin: $withBin)', async ({ nodeLinker, withBin }) => {
Relevance

●●● Strong

Multiple accepted suggestions to add or strengthen regression coverage; no rejections of this type
found.

PR-#14903
PR-#15305
PR-#15182

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule requires a regression test that fails without the production fix. The hoisted no-bin row
passes on the pre-fix code because unlinkStaleDirectLinks.ts already swallows the
malformed-manifest error on that branch.

pnpm11/installing/deps-restorer/src/unlinkStaleDirectLinks.ts[93-111]
pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts[70-73]
Skill: review-code

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

## Issue description
The new `test.each` row for `nodeLinker: hoisted, withBin: false` in `staleLinkPrune.ts` passes on the pre-fix code. The hoisted no-bin path in `unlinkDirectLink` uses `readManifestVersion`, which already tolerated malformed manifests. The PR description states that all four v11 cases fail without the fix, which is wrong for this case.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/staleLinkPrune.ts[70-80]
- pnpm11/installing/deps-restorer/src/unlinkStaleDirectLinks.ts[93-111]

## Recommended Fix
Either drop the `withBin: false` hoisted row if it adds no regression value, or keep it as a no-regression guard and correct the PR description so it no longer claims all four v11 cases fail without the fix. Confirm by reverting the production change locally and running the test matrix.

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

Dismiss ↗ | View ↗


2. Docstring hides which manifest errors are rethrown ✓ Resolved

Resolving commit: 782622d

Resolution reason
Expanded the safeReadDependencyManifest docstring to document the ENOTDIR case returning undefined
and that all other read errors are rethrown.
Description
The JSDoc on safeReadDependencyManifest says only that undefined is returned when the manifest
is missing or malformed. It omits that a path which is not a directory (ENOTDIR) also returns
undefined, and that every other error is rethrown. Callers in removeBinsOfDependency and
unlinkStaleDirectLinks rely on that split, so a reader who trusts the comment could assume all
failures are swallowed or miss that an unexpected error still aborts the removal.

Grey Divider

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.

The v12 test takes a `LinkedBins` enum in place of a `bool` and reports
what it saw in a named struct. `safeReadDependencyManifest`'s doc
comment now names the not-a-directory case and says that other read
errors are rethrown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan

zkochan commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review of 1c1739d.

  1. A regression case passes without the fix: right, and the PR description overstated it. My mutation check removed the tolerance from the shared reader, which the hoisted no-.bin branch now uses too. Reverting the whole PR instead leaves that case passing, through the reader fix: report a deduped link removal once and give link removals their package version #17820 added. The description now says which cases guard the fix: the isolated ones and the hoisted one with a real .bin. I kept the hoisted no-.bin case because it covers the shared reader's use on that branch.
  2. Docstring hides which manifest errors are rethrown: fixed in 782622d. The comment now names the not-a-directory case and says every other read error is rethrown.

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 782622d

@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 3600b05 into main Nov 7, 2026
77 checks passed
@zkochan
zkochan deleted the fix-v11-malformed-manifest-removal branch November 7, 2026 01:21
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.

v11 stops on a malformed manifest while removing a direct dependency; v12 removes it

2 participants