Skip to content

fix(global): recover groups missing node_modules - #15151

Merged
zkochan merged 7 commits into
pnpm:mainfrom
benjaminkincses:fix/global-missing-node-modules-ownership
Sep 21, 2026
Merged

zkochan merged 7 commits into
pnpm:mainfrom
benjaminkincses:fix/global-missing-node-modules-ownership

Conversation

@benjaminkincses

@benjaminkincses benjaminkincses commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm add -g, pnpm update -g, and pnpm remove -g can now recover a global package group whose entire node_modules directory was deleted. Previously all three aborted with ERR_PNPM_PACKAGE_MANIFEST_IO_ERROR before touching any group, so one damaged group blocked every other global package named in the same command and the only way out was deleting directories by hand.

Fixes #15093.

The change draws the line the issue proposes: a group whose node_modules is wholly absent is definitively not installed, so it owns no bins and the command can proceed. A group whose node_modules exists but has a missing, unreadable, or malformed dependency manifest still fails closed, so the preflight that guards against mistaking unknown ownership for an unowned bin is unchanged. Both preflight e2e tests (global_update_preflights_incomplete_target_ownership_before_activation, global_remove_preflights_all_targets_before_mutating_any_group) pass unmodified.

Implemented in both stacks, since the bug is present in both:

  • pnpm v11 (pnpm11/global/packages/src/scanGlobalPackages.ts): getInstalledBinNames stats node_modules first; ENOENT returns an empty set and any other error is rethrown.
  • pnpm v12 (pnpm/crates/global/src/scan.rs): get_installed_bin_names_with_fs probes the tree through the existing FsReadDir filesystem capability. NotFound maps to an empty bin set; any other I/O error still surfaces as PackageManifestError::Read. The probe goes through the capability rather than std::fs so the fake-filesystem unit tests keep exercising the per-manifest read error paths.

Trade-off, as the issue calls out: a bin left behind in the global bin dir by the vanished group is no longer attributable to it, so remove -g of such a group may leave a stale shim. That is accepted because the group is otherwise unrepairable.

The same applies in reverse, and both stacks now assert it: a surviving group whose node_modules is gone no longer protects a bin it shares with the group being removed, so that shim goes with the removal. Nothing that worked stops working, because the survivor's own tree is already unusable.

Squash Commit Body

Enumerating a global group's bins read every declared dependency's manifest
and propagated any error, so deleting a group's node_modules made
`pnpm add -g`, `pnpm update -g` and `pnpm remove -g` abort with
ERR_PNPM_PACKAGE_MANIFEST_IO_ERROR before touching any group. One damaged
group blocked every other package named in the same command, with manual
directory deletion as the only way out.

A group whose node_modules is wholly absent is definitively not installed:
no bin can resolve through it and no further reading can recover what it
owned. Only that case now reads as "owns no bins". A present-but-incomplete
tree still fails closed, which keeps the preflight property the e2e tests
lock in: unknown ownership is never treated as an unowned bin, and
`remove -g victim-a victim-b` still refuses to delete victim-a while
victim-b's ownership cannot be established.

The v12 probe goes through the existing FsReadDir filesystem capability
instead of std::fs, so the fake-filesystem unit tests keep exercising the
per-manifest error paths; only NotFound is absorbed and every other I/O
error still surfaces. The residual hazard is that a stale bin left by the
vanished group is no longer attributable and may survive removal, and that
a surviving group in the same state stops protecting a bin it shares with
the group being removed; both are accepted because such a group is
otherwise unrepairable, and both are asserted in each stack.

Closes pnpm/pnpm#15093.

Verification

  • Rust pnpm-global: unit tests for the absent-tree case, the partial-tree fail-closed case, a non-NotFound probe failure, and preserved permission-denied manifest reads.
  • Rust pnpm-cli: the global, global::ownership and cli_args::global modules, all passing. They include the update that restores a group with a deleted node_modules, the remove -g that tears a damaged group down alongside a healthy one, and the survivor case below. Both preflight tests pass unchanged.
  • TypeScript @pnpm/global.commands: the full package suite, all passing. It includes the getInstalledBinNames case for a deleted tree and the two handleGlobalRemove cases below.

Checklist

  • I checked the referenced issue and verified that none of the PRs already linked to it solves it. (Let a global package group with a deleted node_modules be replaced #15092 took the rejected per-manifest relaxation and was closed unmerged by the maintainer.)
  • Bug fix implemented in every affected version (pnpm v11 TypeScript and pnpm v12 Rust).
  • 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 (AGI, Muse Spark 1.3). Revised by an agent (Claude Code, claude-opus-5).


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

Summary by CodeRabbit

  • Bug Fixes
    • Global package groups can be recovered when their entire node_modules directory has been deleted.
    • pnpm add -g and pnpm update -g restore missing dependencies and command-line binaries.
    • pnpm remove -g can remove affected global groups without failing; command shims from damaged groups may remain.
    • Removing a group no longer incorrectly preserves shared command shims when another affected group cannot be inspected.
    • Incomplete but present dependency trees continue to report errors instead of being treated as healthy.

@welcome

welcome Bot commented Sep 20, 2026

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 102cf9b0-d884-45fe-89ba-028bec157c21

📥 Commits

Reviewing files that changed from the base of the PR and between 844f811 and 3501b72.

📒 Files selected for processing (1)
  • pnpm/crates/cli/tests/suite/global.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/cli/tests/suite/global.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The global ownership scanners now treat a wholly missing node_modules directory as owning no bins. Existing but incomplete trees still fail closed. Global update and remove tests verify recovery for pnpm 11 and pnpm 12.

Changes

Global node_modules recovery

Layer / File(s) Summary
Ownership scan semantics
pnpm/crates/global/src/scan.rs, pnpm11/global/packages/src/scanGlobalPackages.ts, pnpm11/global/commands/src/binOwnership.ts
Both scanners check for node_modules before reading dependency manifests. A missing directory returns no bins. Other read failures and incomplete existing trees retain error handling.
Scanner validation
pnpm/crates/global/src/scan/tests.rs, pnpm/crates/cli/src/cli_args/global/tests.rs, pnpm11/global/commands/test/getInstalledBinNames.test.ts
Tests cover missing directories, non-ENOENT directory errors, and preserved failures for incomplete trees.
Global command recovery
pnpm/crates/cli/tests/suite/global.rs, pnpm/crates/cli/tests/suite/global/ownership.rs, pnpm11/global/commands/test/globalRemove.test.ts, .changeset/global-recover-deleted-node-modules.md
Global update and remove tests verify that deleted node_modules directories no longer block commands. The changeset declares patch releases for pnpm and pacquet.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Allow pnpm update -g and pnpm remove -g to operate when a global group’s entire node_modules directory is deleted, while preserving fail-closed behavior for partial trees [#15093] ✅

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

✨ Finishing Touches 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

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.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 3501b72b40af

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. 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.411 ± 0.140 2.309 2.621 1.67 ± 0.15
pacquet@main 2.398 ± 0.118 2.297 2.625 1.66 ± 0.14
pnpr@HEAD 1.479 ± 0.095 1.321 1.663 1.03 ± 0.09
pnpr@main 1.442 ± 0.094 1.331 1.591 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.41104052354,
      "stddev": 0.14033760455663458,
      "median": 2.3180441816400004,
      "user": 1.47437112,
      "system": 1.8636293799999997,
      "min": 2.30888606964,
      "max": 2.62111640664
    },
    {
      "command": "pacquet@main",
      "mean": 2.39761005444,
      "stddev": 0.1182954292675506,
      "median": 2.3552289266399997,
      "user": 1.52199522,
      "system": 1.88609868,
      "min": 2.29651254564,
      "max": 2.62479515264
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.47887098584,
      "stddev": 0.09493972967893788,
      "median": 1.48635571714,
      "user": 1.4043379200000001,
      "system": 1.79659968,
      "min": 1.32116397064,
      "max": 1.66289206764
    },
    {
      "command": "pnpr@main",
      "mean": 1.44179233864,
      "stddev": 0.09377976006323734,
      "median": 1.45039095114,
      "user": 1.45181702,
      "system": 1.7786096800000002,
      "min": 1.33094989264,
      "max": 1.59120171264
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 241.4 ± 43.9 199.8 317.9 1.15 ± 0.21
pacquet@main 209.5 ± 7.9 197.7 223.9 1.00
pnpr@HEAD 224.7 ± 7.0 216.7 238.9 1.07 ± 0.05
pnpr@main 220.1 ± 9.5 206.3 234.3 1.05 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24141572838000003,
      "stddev": 0.043944287425339734,
      "median": 0.22148706318,
      "user": 0.2720308799999999,
      "system": 0.5746758599999999,
      "min": 0.19976517168,
      "max": 0.31793593268000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.20948495378000004,
      "stddev": 0.007920973070045944,
      "median": 0.20770595818,
      "user": 0.23616547999999998,
      "system": 0.49423705999999995,
      "min": 0.19771243268,
      "max": 0.22392094168
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.22465726937999997,
      "stddev": 0.007002328586923826,
      "median": 0.22275903118,
      "user": 0.23718697999999994,
      "system": 0.5324063600000001,
      "min": 0.21674208968,
      "max": 0.23892921768
    },
    {
      "command": "pnpr@main",
      "mean": 0.22012617148000002,
      "stddev": 0.009520859602314842,
      "median": 0.22097672668,
      "user": 0.21951408,
      "system": 0.51417506,
      "min": 0.20626648568,
      "max": 0.23428999468
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 7.9 ± 0.9 6.5 12.1 1.13 ± 0.15
pacquet@main 7.2 ± 0.4 6.4 8.9 1.04 ± 0.08
pnpr@HEAD 7.1 ± 0.4 6.4 9.1 1.01 ± 0.07
pnpr@main 7.0 ± 0.3 6.3 8.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.007896425000000002,
      "stddev": 0.000948886378292733,
      "median": 0.007666236120000001,
      "user": 0.004673882222222224,
      "system": 0.003802863288888889,
      "min": 0.006508623120000001,
      "max": 0.012112527120000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.007239779395862068,
      "stddev": 0.00042760157541891895,
      "median": 0.00718478512,
      "user": 0.004090223009404392,
      "system": 0.0036605079623824458,
      "min": 0.006357663120000001,
      "max": 0.008929889120000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007072338873541078,
      "stddev": 0.00037194684395233283,
      "median": 0.00702915512,
      "user": 0.004220006175637396,
      "system": 0.0033080294617563724,
      "min": 0.00637194212,
      "max": 0.009139029120000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.006985191933031155,
      "stddev": 0.0003409790275596044,
      "median": 0.006953243120000001,
      "user": 0.004484977847025491,
      "system": 0.002954473427762039,
      "min": 0.00632072312,
      "max": 0.008809608120000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.1 ± 0.8 7.9 11.5 1.18 ± 0.12
pacquet@main 8.0 ± 0.6 6.8 10.7 1.04 ± 0.10
pnpr@HEAD 7.8 ± 0.6 6.8 10.7 1.01 ± 0.10
pnpr@main 7.7 ± 0.4 6.9 9.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009101963807619054,
      "stddev": 0.0007759255649586587,
      "median": 0.00891824736,
      "user": 0.004993405714285712,
      "system": 0.004774629238095234,
      "min": 0.00792900486,
      "max": 0.011479043860000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.008035625763474904,
      "stddev": 0.0006454070318715971,
      "median": 0.00792854186,
      "user": 0.004712889111969111,
      "system": 0.0038995068725868757,
      "min": 0.00681744586,
      "max": 0.010680182860000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007778616552307688,
      "stddev": 0.0006474890625348096,
      "median": 0.00768265536,
      "user": 0.004564477692307692,
      "system": 0.0037333525384615385,
      "min": 0.006782056860000001,
      "max": 0.010669933860000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.007690191291578946,
      "stddev": 0.0003830569351827275,
      "median": 0.00764231586,
      "user": 0.004856176140350873,
      "system": 0.0033786861052631577,
      "min": 0.006863785860000001,
      "max": 0.00943729586
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.484 ± 0.054 2.437 2.598 1.67 ± 0.10
pacquet@main 2.477 ± 0.036 2.421 2.533 1.67 ± 0.09
pnpr@HEAD 1.556 ± 0.124 1.367 1.775 1.05 ± 0.10
pnpr@main 1.487 ± 0.081 1.394 1.651 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.48422092696,
      "stddev": 0.053692317755753574,
      "median": 2.46550541976,
      "user": 1.7466663399999998,
      "system": 1.5985963800000003,
      "min": 2.43688846776,
      "max": 2.59759701476
    },
    {
      "command": "pacquet@main",
      "mean": 2.47740985306,
      "stddev": 0.03635475946183834,
      "median": 2.4737707792599997,
      "user": 1.7244697399999995,
      "system": 1.54448388,
      "min": 2.42110795476,
      "max": 2.53338480676
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5558023113600001,
      "stddev": 0.12354196130731315,
      "median": 1.5688103822600001,
      "user": 1.09540774,
      "system": 1.2517693799999998,
      "min": 1.36722667276,
      "max": 1.77531012376
    },
    {
      "command": "pnpr@main",
      "mean": 1.4871802249600001,
      "stddev": 0.08109475333076507,
      "median": 1.4745543367600003,
      "user": 1.08867824,
      "system": 1.2318809800000001,
      "min": 1.3939419157600001,
      "max": 1.65132251976
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 345.9 ± 15.3 318.9 365.5 1.27 ± 0.06
pacquet@main 343.6 ± 22.2 312.7 383.0 1.26 ± 0.09
pnpr@HEAD 272.8 ± 5.4 265.3 279.7 1.00
pnpr@main 274.6 ± 16.6 247.8 301.1 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3458612458,
      "stddev": 0.015251525209419919,
      "median": 0.3474634407,
      "user": 0.53965904,
      "system": 0.7788179000000001,
      "min": 0.3189320157,
      "max": 0.36548290170000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.34361806110000004,
      "stddev": 0.0221850534667646,
      "median": 0.33810287920000004,
      "user": 0.53646804,
      "system": 0.7667375000000001,
      "min": 0.3126887037,
      "max": 0.3829623777
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2727508012,
      "stddev": 0.005362410830085399,
      "median": 0.2740514087,
      "user": 0.22014103999999998,
      "system": 0.5265556,
      "min": 0.2652611847,
      "max": 0.2796666507
    },
    {
      "command": "pnpr@main",
      "mean": 0.27462127370000006,
      "stddev": 0.016550704003593694,
      "median": 0.2762748312,
      "user": 0.20613124,
      "system": 0.5207507,
      "min": 0.2477659387,
      "max": 0.3011439207
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.539 ± 0.014 1.518 1.565 5.76 ± 0.39
pacquet@main 1.612 ± 0.059 1.555 1.755 6.03 ± 0.46
pnpr@HEAD 0.276 ± 0.008 0.264 0.289 1.03 ± 0.08
pnpr@main 0.267 ± 0.018 0.246 0.296 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.5393829082000001,
      "stddev": 0.013637298907403487,
      "median": 1.5387889659000002,
      "user": 0.7608548199999999,
      "system": 0.9197061199999998,
      "min": 1.5180392834,
      "max": 1.5653561214
    },
    {
      "command": "pacquet@main",
      "mean": 1.6123679266,
      "stddev": 0.05943207671741553,
      "median": 1.5977393594,
      "user": 0.94724372,
      "system": 1.04346392,
      "min": 1.5553575114000002,
      "max": 1.7545945654000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27637967990000006,
      "stddev": 0.008266638895651827,
      "median": 0.27708301690000003,
      "user": 0.23176332,
      "system": 0.50868172,
      "min": 0.26391178940000004,
      "max": 0.28901293940000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.2674696952000001,
      "stddev": 0.01780441768216463,
      "median": 0.2614972419,
      "user": 0.19578282,
      "system": 0.50592642,
      "min": 0.24640001540000003,
      "max": 0.29646224740000005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 280.4 ± 18.6 258.2 309.5 2.66 ± 0.22
pacquet@main 262.9 ± 11.6 245.9 280.7 2.49 ± 0.17
pnpr@HEAD 106.2 ± 4.6 100.0 116.0 1.01 ± 0.07
pnpr@main 105.5 ± 5.3 98.5 115.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.28044984316000005,
      "stddev": 0.018604284940032963,
      "median": 0.27465545676,
      "user": 0.30926109999999996,
      "system": 0.08327401999999999,
      "min": 0.25820911676,
      "max": 0.30952186776
    },
    {
      "command": "pacquet@main",
      "mean": 0.26288368439636367,
      "stddev": 0.011582997516001454,
      "median": 0.26153315176,
      "user": 0.2837436545454545,
      "system": 0.08795868363636362,
      "min": 0.24587272276000002,
      "max": 0.28065368376000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10617843568307693,
      "stddev": 0.004646371362850326,
      "median": 0.10583547875999999,
      "user": 0.041714046153846156,
      "system": 0.022175961538461537,
      "min": 0.10004387176,
      "max": 0.11602032976
    },
    {
      "command": "pnpr@main",
      "mean": 0.10549393887111115,
      "stddev": 0.005286029487534922,
      "median": 0.10418815376,
      "user": 0.047420977777777755,
      "system": 0.016816097777777775,
      "min": 0.09853779576,
      "max": 0.11580326776
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 787.8 ± 98.4 657.6 925.4 1.15 ± 0.17
pacquet@main 684.3 ± 57.0 594.0 741.9 1.00
pnpm@HEAD 3266.6 ± 154.2 3115.9 3585.0 4.77 ± 0.46
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7878407729733333,
      "stddev": 0.09835373803706161,
      "median": 0.78572998764,
      "user": 0.7939390488888889,
      "system": 0.20676200222222219,
      "min": 0.6575857016400001,
      "max": 0.9253694046400001
    },
    {
      "command": "pacquet@main",
      "mean": 0.6842941810844444,
      "stddev": 0.05696610764325263,
      "median": 0.70327861764,
      "user": 0.6786220488888888,
      "system": 0.1798498911111111,
      "min": 0.59402483464,
      "max": 0.74188762064
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.2666152163066666,
      "stddev": 0.15420354254376098,
      "median": 3.20599389564,
      "user": 4.74878016,
      "system": 0.28444755777777775,
      "min": 3.11585489464,
      "max": 3.58503542564
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 166.1 ± 5.2 161.0 178.6 1.00
pacquet@main 167.0 ± 5.7 160.2 180.3 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.16610917859176474,
      "stddev": 0.005243602820882894,
      "median": 0.16348462418,
      "user": 0.12344714352941176,
      "system": 0.07780077647058822,
      "min": 0.16097265218,
      "max": 0.17863195118000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.16701422829111112,
      "stddev": 0.0056738197627776476,
      "median": 0.16583124718000003,
      "user": 0.12724248666666668,
      "system": 0.07602204444444446,
      "min": 0.16018865018,
      "max": 0.18034184618000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.391 ± 0.154 4.269 4.715 1.30 ± 0.05
pacquet@main 4.386 ± 0.125 4.260 4.596 1.30 ± 0.04
pnpr@HEAD 3.386 ± 0.039 3.341 3.457 1.00
pnpr@main 3.393 ± 0.054 3.345 3.527 1.00 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.391230848599999,
      "stddev": 0.15357464721386996,
      "median": 4.3145308713,
      "user": 1.317345,
      "system": 1.46198114,
      "min": 4.2685995268,
      "max": 4.7150609798
    },
    {
      "command": "pacquet@main",
      "mean": 4.385979022500001,
      "stddev": 0.12465337440213434,
      "median": 4.3548601077999995,
      "user": 1.2757676999999998,
      "system": 1.4745896399999996,
      "min": 4.2598392308,
      "max": 4.5958457267999995
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.3861892092,
      "stddev": 0.03881417948115253,
      "median": 3.3811491998000003,
      "user": 1.238772,
      "system": 1.3483178399999998,
      "min": 3.3406596728,
      "max": 3.4570509888000003
    },
    {
      "command": "pnpr@main",
      "mean": 3.3926224976000006,
      "stddev": 0.05439076036964842,
      "median": 3.3717476958,
      "user": 1.2399565000000001,
      "system": 1.4475946399999997,
      "min": 3.3453024798,
      "max": 3.5268126698000004
    }
  ]
}

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 114.6 ± 3.9 106.4 121.1 1.10 ± 0.06
pacquet@main 104.2 ± 4.0 96.0 113.8 1.00
pnpr@HEAD 120.9 ± 4.7 114.1 129.3 1.16 ± 0.06
pnpr@main 116.6 ± 3.2 111.8 123.3 1.12 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11460238104666667,
      "stddev": 0.0039010853610643085,
      "median": 0.11448958138000001,
      "user": 0.14110981904761905,
      "system": 0.12533174666666666,
      "min": 0.10637829538,
      "max": 0.12110220538000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.10419622242347826,
      "stddev": 0.00395125703176602,
      "median": 0.10449296338000001,
      "user": 0.13477585217391305,
      "system": 0.11300642782608694,
      "min": 0.09595247738,
      "max": 0.11382988438000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.12090924395142859,
      "stddev": 0.004672166187411529,
      "median": 0.12213417438,
      "user": 0.14267248571428567,
      "system": 0.1156073180952381,
      "min": 0.11410444438,
      "max": 0.12934542038000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.1166414254752381,
      "stddev": 0.0032007914462819486,
      "median": 0.11587982738000001,
      "user": 0.14547053333333332,
      "system": 0.11836155619047621,
      "min": 0.11180175238000001,
      "max": 0.12327269538
    }
  ]
}

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/15151
Testbedpacquet

🚨 3 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
258.21 ms
(+36.10%)Baseline: 189.72 ms
227.67 ms
(113.42%)

isolated-linker.peer-heavy-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
657.59 ms
(+28.83%)Baseline: 510.41 ms
612.50 ms
(107.36%)

isolated-linker.repeat-install.cold-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
7.93 ms
(+30.57%)Baseline: 6.07 ms
7.29 ms
(108.81%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
106.38 ms
(+1.95%)Baseline: 104.35 ms
125.21 ms
(84.96%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,436.89 ms
(-0.05%)Baseline: 2,438.01 ms
2,925.62 ms
(83.29%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,518.04 ms
(-0.49%)Baseline: 1,525.53 ms
1,830.64 ms
(82.92%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
318.93 ms
(-7.95%)Baseline: 346.46 ms
415.75 ms
(76.71%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
258.21 ms
(+36.10%)Baseline: 189.72 ms
227.67 ms
(113.42%)

isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,308.89 ms
(+2.83%)Baseline: 2,245.23 ms
2,694.28 ms
(85.70%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,268.60 ms
(-0.39%)Baseline: 4,285.10 ms
5,142.12 ms
(83.01%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
199.77 ms
(-2.70%)Baseline: 205.31 ms
246.38 ms
(81.08%)
isolated-linker.linked-workspace-resolve.hot-cache.offline📈 view plot
🚷 view threshold
160.97 ms
(-0.04%)Baseline: 161.03 ms
193.23 ms
(83.30%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
657.59 ms
(+28.83%)Baseline: 510.41 ms
612.50 ms
(107.36%)

isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
7.93 ms
(+30.57%)Baseline: 6.07 ms
7.29 ms
(108.81%)

isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
6.51 ms
(+5.17%)Baseline: 6.19 ms
7.43 ms
(87.64%)
🐰 View full continuous benchmarking report in Bencher

@codecov-commenter

codecov-commenter commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.38%. Comparing base (66a91e4) to head (3501b72).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15151   +/-   ##
=======================================
  Coverage   91.38%   91.38%           
=======================================
  Files        1362     1362           
  Lines      182929   182930    +1     
=======================================
+ Hits       167166   167175    +9     
+ Misses      15763    15755    -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.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/15151
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)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
115.56 ms
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,365.66 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
264.70 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
261.50 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.30 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,287.81 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,339.64 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
233.35 ms
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
5.80 ms
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
5.65 ms
🐰 View full continuous benchmarking report in Bencher

@benjaminkincses
benjaminkincses marked this pull request as ready for review September 20, 2026 20:18
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

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

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

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule violations were identified.

Reviews (7) · Last reviewed commit: "test(global): assert the restored group'..."

Comment thread pnpm/crates/cli/tests/suite/global.rs Resolved
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 20, 2026
Dextheking1 and others added 2 commits September 21, 2026 01:49
`pnpm update -g` and `pnpm remove -g` can recover a global package group
whose entire `node_modules` directory was deleted: the group is treated as
owning no bins. A group with a present-but-incomplete tree still fails
closed, so unknown ownership is never mistaken for an unowned bin.

Fixes pnpm#15093
…dules

The previous version of this test locked the pre-fix behavior: `update -g`
over a group whose node_modules was deleted had to fail with
ERR_PNPM_PACKAGE_MANIFEST_IO_ERROR. This PR changes that behavior on
purpose (pnpm#15093): a wholly-absent node_modules now means the group
owns no bins, the preflight lets the command through, and the update
reinstalls the group from its surviving manifest. The test now asserts the
new contract: the update succeeds, is not reported as "Already up to date",
and the tree is restored.
@zkochan
zkochan force-pushed the fix/global-missing-node-modules-ownership branch from 6a1e74b to 5b083bb Compare September 20, 2026 23:52
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Release note includes internal rationale ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The second sentence explains that pnpm can no longer tell which commands were installed before
describing the stale-shim outcome. This implementation limitation appears in the release note
whenever the shared changeset is published, instead of stating only the observable condition under
which pnpm remove -g leaves a shim.
Code

.changeset/global-recover-deleted-node-modules.md[6]

+`pnpm add -g`, `pnpm update -g`, and `pnpm remove -g` now recover a global package group whose entire `node_modules` directory was deleted. pnpm can no longer tell which commands such a group installed, so `pnpm remove -g` may leave one of its shims in the global bin directory [#15093](https://github.com/pnpm/pnpm/issues/15093).
Relevance

●●● Strong

Recent changeset precedents consistently remove internal rationale and retain only observable
user-facing behavior.

PR-#14526
PR-#14613
PR-#14901

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 3058322 restricts changeset entries to concrete observable behavior. The cited
changeset says pnpm can no longer tell ownership information, which is internal rationale
preceding the observable stale-shim behavior.

Rule 3058322: Changeset entries must describe observable behavior changes only
.changeset/global-recover-deleted-node-modules.md[6-6]

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 changeset mixes an internal ownership limitation into user-facing release-note text instead of describing only observable behavior.

## Fix Focus Areas
- .changeset/global-recover-deleted-node-modules.md[6-6]

## Recommended Fix
Replace the internal explanation with a direct statement that `pnpm remove -g` leaves any existing shim from a group whose entire `node_modules` directory is missing.

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


2. Update test comment repeats behavior ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The doc comment above global_update_restores_group_with_deleted_node_modules narrates that the
update reinstalls the tree and does not report it as current. The test name and assertions for a
changed install directory, restored node_modules, and absent up-to-date output already express
this behavior, so later assertion changes can leave the narration stale.
Code

pnpm/crates/cli/tests/suite/global.rs[R997-999]

+/// The resolution is unchanged, so nothing but the vanished tree separates
+/// this group from a current one. The update reinstalls it from its surviving
+/// manifest instead of calling it up to date.
Relevance

●●● Strong

Recent Rust test precedents accept removing comments that duplicate test names and assertions,
especially to prevent drift.

PR-#15019
PR-#14953
PR-#14593

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 rejects comments that merely restate nearby code. The cited comment repeats
the restoration and output effects asserted directly by this test.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/cli/tests/suite/global.rs[997-999]

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-level doc comment repeats behavior already conveyed by the test name and assertions without adding rationale or constraints.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/global.rs[997-999]

## Recommended Fix
Remove the doc comment, or replace it only with non-obvious context that cannot be inferred from the test setup, name, and assertions.

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


3. Version 11 recovery lacks command tests ✓ Resolved 📘 Rule violation ⌂ Architecture
Description
getInstalledBinNames.test.ts only asserts that getInstalledBinNames returns an empty list and
never invokes either affected global command. A regression in version 11 update/remove
orchestration, preflight sequencing, or restoration and removal side effects would pass while the
Rust suite still verifies those end-to-end outcomes.
Code

pnpm11/global/commands/test/getInstalledBinNames.test.ts[33]

+  await expect(getInstalledBinNames(info)).resolves.toStrictEqual([])
Relevance

●●● Strong

Recent precedents accept mirrored TypeScript/Rust regression coverage asserting observable outcomes,
not merely helper results.

PR-#15182
PR-#14272

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rules 713428 and 2255044 require equivalent regression scenarios and observable outcomes in both
implementations. The TypeScript addition only checks the helper's empty result, whereas the Rust
additions invoke update -g and remove -g and assert successful restoration or removal.

Rule 713428: Keep pnpm v11 and v12 observable behavior aligned when fixing shared bugs
Rule 2255044: Mirror cross-stack regression tests between TypeScript and Rust for shared pnpm v11/v12 bug fixes
pnpm11/global/commands/test/getInstalledBinNames.test.ts[23-34]
pnpm/crates/cli/tests/suite/global/ownership.rs[389-466]

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 shared recovery fix has end-to-end command coverage for the Rust implementation, but the TypeScript implementation only tests its ownership helper. Add equivalent version 11 coverage for both affected commands and their observable filesystem effects.

## Fix Focus Areas
- pnpm11/global/commands/test/getInstalledBinNames.test.ts[23-34]

## Recommended Fix
Add version 11 command-level regression tests that create a global package group, delete its entire `node_modules` directory, and invoke the actual `update -g` and `remove -g` paths. Assert that update succeeds and restores the installed tree, and that remove succeeds while removing both the damaged target and another healthy target named in the same command.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 64 rules
✅ Skills: review-code
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: fcaa952e)
  Explored: repo: pnpm/setup (sha: fbda4c85)
  Explored: repo: pnpm/cmd-shim (sha: 83f9b944)
Review mode: 🚀 Fast: This is a small, localized test-only assertion change with no security, performance, or runtime behavior impact.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 3501b72

Results up to commit 5b083bb ⚖️ Balanced


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


Remediation recommended
1. Version 11 recovery lacks command tests ✓ Resolved 📘 Rule violation ⌂ Architecture
Description
getInstalledBinNames.test.ts only asserts that getInstalledBinNames returns an empty list and
never invokes either affected global command. A regression in version 11 update/remove
orchestration, preflight sequencing, or restoration and removal side effects would pass while the
Rust suite still verifies those end-to-end outcomes.
Code

pnpm11/global/commands/test/getInstalledBinNames.test.ts[33]

+  await expect(getInstalledBinNames(info)).resolves.toStrictEqual([])
Relevance

●●● Strong

Recent precedents accept mirrored TypeScript/Rust regression coverage asserting observable outcomes,
not merely helper results.

PR-#15182
PR-#14272

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rules 713428 and 2255044 require equivalent regression scenarios and observable outcomes in both
implementations. The TypeScript addition only checks the helper's empty result, whereas the Rust
additions invoke update -g and remove -g and assert successful restoration or removal.

Rule 713428: Keep pnpm v11 and v12 observable behavior aligned when fixing shared bugs
Rule 2255044: Mirror cross-stack regression tests between TypeScript and Rust for shared pnpm v11/v12 bug fixes
pnpm11/global/commands/test/getInstalledBinNames.test.ts[23-34]
pnpm/crates/cli/tests/suite/global/ownership.rs[389-466]

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 shared recovery fix has end-to-end command coverage for the Rust implementation, but the TypeScript implementation only tests its ownership helper. Add equivalent version 11 coverage for both affected commands and their observable filesystem effects.

## Fix Focus Areas
- pnpm11/global/commands/test/getInstalledBinNames.test.ts[23-34]

## Recommended Fix
Add version 11 command-level regression tests that create a global package group, delete its entire `node_modules` directory, and invoke the actual `update -g` and `remove -g` paths. Assert that update succeeds and restores the installed tree, and that remove succeeds while removing both the damaged target and another healthy target named in the same command.

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


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.

Addresses review feedback on pnpm#15151.

Add a v11 command-level regression test proving `remove -g` recovers a
group whose whole `node_modules` directory is absent: the handler tears
down the damaged group without attempting to delete bins it cannot
account for, leaves the stray shim alone, and a repeat removal reports
ERR_PNPM_GLOBAL_PKG_NOT_FOUND.

Trim comments that merely narrate test behavior in the Rust e2e and unit
tests; the test names and assertions carry that meaning. Source comments
explaining the wholly-absent vs present-but-incomplete distinction are
left untouched.
greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 21, 2026
Review follow-ups for the deleted-node_modules recovery:

- Give the v11 `global remove` recovery test a healthy sibling target,
  so it shows what the issue asks for: one damaged group no longer
  blocks the other packages named in the same command, and only the
  healthy group's shim reaches the deletion sink.
- Model the real scenario in the v11 scanner test: the install dir and
  its group manifest survive, only node_modules is deleted.
- Fold the ownership-suite update test into
  global_update_restores_group_with_deleted_node_modules, which covers
  the same scenario, and assert there that the group is reinstalled
  under a new install dir with its command still in the global bin dir.
- State the enumeration contract on `getInstalledBinNames` itself
  instead of at the call site.
- Name `pnpm add -g` in the changeset: it reaches the same ownership
  preflight, so it recovers too. Say what the unattributable shim costs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@greptile-apps
greptile-apps Bot dismissed their stale review September 21, 2026 00:04

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5ff5651

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

Comment thread pnpm/crates/cli/tests/suite/global.rs Resolved
greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 21, 2026
A surviving group whose node_modules is gone reports no bins too, so it
no longer protects a bin it shares with the group being removed. That is
the reverse of the target-side trade-off and it was unasserted in both
stacks. Nothing that worked stops working, because the survivor's own
tree is already unusable, but the decision belongs in a test rather than
only in the diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@greptile-apps
greptile-apps Bot dismissed their stale review September 21, 2026 00:08

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5d46c9c

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

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 21, 2026
The changeset led the trade-off with the implementation reason pnpm can no
longer attribute the shims. A release note states what pnpm does, so it
now names the outcome alone. The test doc comment keeps the part a reader
cannot recover from the assertions, that the resolution is unchanged, and
drops the sentence the assertions already make.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@greptile-apps
greptile-apps Bot dismissed their stale review September 21, 2026 00:13

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

@zkochan

zkochan commented Sep 21, 2026

Copy link
Copy Markdown
Member

Thanks — two of the three hold and are fixed in 844f811.

Release note includes internal rationale. Valid. AGENTS.md says the same thing under "Changeset style": a changeset states what pnpm does now, and design justification belongs in the commit body. The entry now names the outcome alone:

pnpm add -g, pnpm update -g, and pnpm remove -g now recover a global package group whose entire node_modules directory was deleted. pnpm remove -g leaves such a group's command shims in the global bin directory.

Update test comment repeats behavior. Valid for the second sentence, which the assertions already make. It is gone. The first sentence stays, because it is the part a reader cannot recover from the setup: the resolution is unchanged, which is exactly what makes assert!(!stdout.contains("Already up to date")) a real assertion rather than an obvious one.

Version 11 recovery lacks command tests. The finding still quotes getInstalledBinNames.test.ts line 33 and the premise that the change "never invokes either affected global command" no longer holds. pnpm11/global/commands/test/globalRemove.test.ts now drives handleGlobalRemove over a real filesystem twice, with no module mock on @pnpm/global.packages:

  • global remove recovers a group whose node_modules is wholly missing removes a healthy group and a damaged one in the same command, and asserts both are torn down, that only the healthy group's shim reaches removeBin, and that the damaged group's stray shim survives.
  • global remove stops protecting a bin of a survivor whose node_modules is gone covers the reverse: a survivor in that state no longer protects a bin it shares with the target, so the shim goes with the removal while the survivor itself is untouched.

Both mirror Rust tests of the same name shape in suite/global/ownership.rs.

update -g has no equivalent command-level home on the v11 side. globalUpdate.test.ts replaces @pnpm/global.packages with a module mock, so the scanner this PR changes never runs there, and v11 has no global end-to-end suite at all (pnpm11/pnpm/test/ has no global file). Closing that is a restructuring of the v11 global test setup, not a change this fix can carry. All three commands reach the changed scanner through the same getGlobalBinOwnership preflight, which the two remove tests exercise end to end.


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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 844f811

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

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 21, 2026
The update test asserted only that the shim file still existed in the
global bin directory. The shim is a shell script that the deletion of
node_modules never touches, so that assertion held whether or not the
update put anything back. Verified by deleting the restored package: the
old assertion passed, the new one fails.

The shim reaches its target through the hash link rather than through the
install dir the group currently resolves to, so that is the path the
restored package has to be reachable by. Asserting it also covers the
case where the tree comes back under a new install dir the hash link was
never repointed at.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@greptile-apps
greptile-apps Bot dismissed their stale review September 21, 2026 00:48

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 3501b72

@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 commented Sep 21, 2026

Copy link
Copy Markdown
Member

Bencher Report is red on this head, and the benchmark runner is the reason

Flagging this rather than leaving a red check unexplained.

Bencher Report (pnpm's project) failed on 3501b72b40. I re-ran the Pacquet Integrated-Benchmark workflow on that same commit to test whether it was reproducible. It was, and it got worse: 1 alert became 3. But the two runs of the same commit and the same binary disagree with each other far more than either disagrees with the baseline:

Benchmark Run 1 Run 2
isolated-linker.fresh-resolve.hot-cache.offline 169.32 ms (-10.75%) 258.21 ms (+36.10%)
isolated-linker.peer-heavy-resolve.hot-cache.offline 433.67 ms (-15.04%) 657.59 ms (+28.83%)
isolated-linker.repeat-install.cold-cache.hot-store 7.41 ms (+22.10%) 7.93 ms (+30.57%)

fresh-resolve moved 52% between two measurements of identical code. That is the runner, not the change.

Two further reasons this PR cannot be the cause:

  1. The last commit with a green Bencher report is 844f8113a8. git diff 844f8113a8 3501b72b40 is 8 lines in pnpm/crates/cli/tests/suite/global.rs. Cargo builds tests/ into a separate integration-test binary; it never links into the pnpm release binary the benchmark measures. The benchmarked artifact is unchanged between the green run and the red one.
  2. The only production code this PR touches is get_installed_bin_names in pnpm-global, reached by pnpm add -g, update -g, remove -g and list -g. Every alerting scenario is a project install or resolve, which never calls it.

I have not pushed anything to chase this, because there is nothing in the diff to change. Re-running the workflow when the runner is quieter should clear it; the call on whether to do that before merge is yours.


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

@zkochan
zkochan merged commit 39af20f into pnpm:main Sep 21, 2026
74 of 75 checks passed
u9g pushed a commit to u9g/pnpm that referenced this pull request Sep 25, 2026
Enumerating a global group's bins read every declared dependency's manifest
and propagated any error, so deleting a group's node_modules made
`pnpm add -g`, `pnpm update -g` and `pnpm remove -g` abort with
ERR_PNPM_PACKAGE_MANIFEST_IO_ERROR before touching any group. One damaged
group blocked every other package named in the same command, with manual
directory deletion as the only way out.

A group whose node_modules is wholly absent is definitively not installed:
no bin can resolve through it and no further reading can recover what it
owned. Only that case now reads as "owns no bins". A present-but-incomplete
tree still fails closed, which keeps the preflight property the e2e tests
lock in: unknown ownership is never treated as an unowned bin, and
`remove -g victim-a victim-b` still refuses to delete victim-a while
victim-b's ownership cannot be established.

The v12 probe goes through the existing FsReadDir filesystem capability
instead of std::fs, so the fake-filesystem unit tests keep exercising the
per-manifest error paths; only NotFound is absorbed and every other I/O
error still surfaces. The residual hazard is that a stale bin left by the
vanished group is no longer attributable and may survive removal, and that
a surviving group in the same state stops protecting a bin it shares with
the group being removed; both are accepted because such a group is
otherwise unrepairable, and both are asserted in each stack.

Closes pnpm#15093.

---------

Co-authored-by: Dextheking1 <[email protected]>
Co-authored-by: Dextheking1 <[email protected]>
Co-authored-by: Zoltan Kochan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A global package group whose node_modules was deleted cannot be updated or removed

3 participants