Skip to content

fix(setup): remove leftover v10-layout shims so self-update stops re-warning - #13140

Merged
zkochan merged 3 commits into
pnpm:mainfrom
aqeelat:fix/12496-legacy-homedir-shims
Jul 19, 2026
Merged

zkochan merged 3 commits into
pnpm:mainfrom
aqeelat:fix/12496-legacy-homedir-shims

Conversation

@aqeelat

@aqeelat aqeelat commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #12496.

pnpm setup migrated PATH to $PNPM_HOME/bin but left the v10-layout shims (pnpm/pn/pnpx/pnx, plus .cmd/.ps1 siblings) at the top of PNPM_HOME. self-update's v10-layout detector keyed off file existence alone, so the warning fired on every self-update — including on dangling shims whose install target had been garbage-collected. Running pnpm setup did not silence it.

This change:

  • Setup cleanup (TS CLI + pacquet): after addDirToEnvPath succeeds, best-effort unlink the 12 legacy shim names at pnpmHomeDir. Fresh v11 installs have nothing to clean up; existing v10→v11 migrations get the leftover shims removed.
  • Dangling-shim hardening (TS CLI only): hasLegacyHomeDirShim reads the # cmd-shim-target=<path> marker on the POSIX pnpm shim; if the marker points at a missing path, the shim was GC'd and is treated as absent. The warning can no longer fire on dead shim files.

Parity

Per the cardinal rule, the user-visible change (setup cleanup) lands in both stacks in this PR. The dangling-shim hardening is TS-only because pacquet's self-update has not yet ported the v10-layout detection branch at all (no hasLegacyHomeDirShim equivalent). When pacquet ports the detection, it should port the dangling-shim check too.

Squash Commit Body

fix(setup): remove leftover v10-layout shims so self-update stops re-warning

pnpm setup migrated PATH to $PNPM_HOME/bin but left the v10 shims
(pnpm/pn/pnpx/pnx and .cmd/.ps1 siblings) at the top of PNPM_HOME.
self-update's v10-layout detector keyed off file existence alone, so
the warning fired on every self-update — even on dangling shims whose
install target had been garbage-collected.

Cleanup: setup unlinks the v10 shim names after PATH migration succeeds
(TS CLI + pacquet). Hardening: hasLegacyHomeDirShim skips a shim whose
cmd-shim-target marker points at a missing path (TS only; pacquet has
no v10-detection branch yet — note in changeset).

Closes pnpm/pnpm#12496.

Checklist

  • Changeset added (.changeset/cleanup-legacy-homedir-shims.md) — patch on pnpm and pacquet.
  • TS CLI tests pass: @pnpm/engine.pm.commands (setup + self-updater suites).
  • pacquet tests pass: cargo nextest run -p pacquet-cli setup (31/31).
  • Lint clean: eslint, cargo clippy --all-targets --workspace -- -D warnings, cargo fmt --check, taplo format --check, cspell, typos.
  • cargo doc --no-deps --workspace --all-features clean.
  • pnpm CLI bundle rebuilt for e2e (run pnpm --filter pnpm run compile before invoking e2e).

Written by an agent (opencode, zai-coding-plan/glm-5.2).


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

Summary by CodeRabbit

  • Bug Fixes
    • Improved pnpm setup / pacquet setup to remove leftover legacy v10 command shims after switching to the v11 PNPM_HOME/bin layout.
    • Updated pnpm self-update to stop warning when legacy shims are dangling (their install targets no longer exist).
    • Made legacy shim cleanup more tolerant when shim files are missing or can’t be deleted.
  • Tests
    • Added regression coverage for legacy shim cleanup and for self-update correctly ignoring dangling legacy shims (including Windows variants).

…warning

pnpm setup migrated PATH to $PNPM_HOME/bin but left the v10 shims
(pnpm/pn/pnpx/pnx and .cmd/.ps1 siblings) at the top of PNPM_HOME.
self-update's v10-layout detector keyed off file existence alone, so
the warning fired on every self-update — even on dangling shims whose
install target had been garbage-collected.

Cleanup: setup unlinks the v10 shim names after PATH migration succeeds
(TS CLI + pacquet). Hardening: hasLegacyHomeDirShim skips a shim whose
cmd-shim-target marker points at a missing path (TS only; pacquet has
no v10-detection branch yet — note in changeset).

Closes pnpm#12496.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e76c900c-eb04-4987-b44d-c7ef01738082

📥 Commits

Reviewing files that changed from the base of the PR and between ec05abc and baaf86e.

📒 Files selected for processing (2)
  • pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts
  • pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts

📝 Walkthrough

Walkthrough

pnpm setup and pacquet setup now remove legacy v10 homedir shims after PATH migration. TypeScript self-update ignores dangling legacy shims, with tests covering cleanup, failure tolerance, and v11 bin resolution.

Changes

Legacy shim cleanup and detection

Layer / File(s) Summary
Setup cleanup across CLI implementations
.changeset/cleanup-legacy-homedir-shims.md, pnpm/crates/cli/src/cli_args/setup.rs, pnpm/crates/cli/src/cli_args/setup/tests.rs, pnpm11/engine/pm/commands/src/setup/*, pnpm11/engine/pm/commands/src/index.ts, pnpm11/engine/pm/commands/test/setup/setup.test.ts
Both setup handlers remove defined v10 shim names after PATH migration, with exports and tests covering complete removal and tolerated failures.
Dangling shim detection in self-update
pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts, pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts
Self-update parses legacy shim targets and ignores dangling targets while retaining detection for active or unreadable legacy shims; regression coverage verifies relative target handling and v11 bin resolution.

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

Assessment against linked issues

Objective Addressed Explanation
Remove legacy top-level v10 shims during pnpm setup and pacquet setup after PATH migration [#12496] ✅
Treat dangling legacy shims as absent during self-update detection [#12496] ✅
Avoid recurring inaccurate v10-layout warnings after migration [#12496] ✅

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant setup_handler
  participant PNPM_HOME
  participant selfUpdate_handler
  User->>setup_handler: run setup
  setup_handler->>PNPM_HOME: migrate PATH and remove legacy shims
  User->>selfUpdate_handler: run self-update
  selfUpdate_handler->>PNPM_HOME: inspect legacy shim target
  PNPM_HOME-->>selfUpdate_handler: active or dangling target
  selfUpdate_handler-->>User: continue without false legacy-layout warning
Loading

Possibly related issues

  • pnpm/action-setup#278 — Addresses the same dangling or leftover shim detection behavior.

Possibly related PRs

  • pnpm/pnpm#13096 — Modifies the same setup handler near environment-path handling.

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

Suggested reviewers: copilot, zkochan

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

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.

@codecov-commenter

codecov-commenter commented Jul 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.66%. Comparing base (32a30c4) to head (baaf86e).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/setup.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #13140    +/-   ##
========================================
  Coverage   85.65%   85.66%            
========================================
  Files         505      505            
  Lines       83565    83720   +155     
========================================
+ Hits        71580    71717   +137     
- Misses      11985    12003    +18     

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

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: baaf86e30171

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.444 ± 0.135 2.330 2.756 1.67 ± 0.18
pacquet@main 2.482 ± 0.154 2.344 2.763 1.70 ± 0.19
pnpr@HEAD 1.461 ± 0.138 1.331 1.647 1.00
pnpr@main 1.551 ± 0.145 1.379 1.784 1.06 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4435627886800004,
      "stddev": 0.13496556588816375,
      "median": 2.39366418748,
      "user": 1.4881593599999998,
      "system": 1.2366663,
      "min": 2.3301299349800004,
      "max": 2.7558966279800003,
      "times": [
        2.4216307189800004,
        2.36569765598,
        2.55513536598,
        2.7558966279800003,
        2.5026700549800003,
        2.33424752198,
        2.4722042349800004,
        2.3351447439800004,
        2.3301299349800004,
        2.36287102698
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.4816294795800005,
      "stddev": 0.1539082227694789,
      "median": 2.42734622798,
      "user": 1.5081439600000002,
      "system": 1.2465327,
      "min": 2.34354442898,
      "max": 2.76250281698,
      "times": [
        2.76250281698,
        2.55531663598,
        2.37079629898,
        2.7050562509800002,
        2.3598818979800003,
        2.34354442898,
        2.35570909698,
        2.5216959819800002,
        2.48389615698,
        2.3578952299800005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.46067369288,
      "stddev": 0.13806814406836143,
      "median": 1.37844176698,
      "user": 1.0473896600000001,
      "system": 1.1028663,
      "min": 1.33132321698,
      "max": 1.64676874098,
      "times": [
        1.35037959998,
        1.35093624398,
        1.33132321698,
        1.64676874098,
        1.34797727998,
        1.34646228798,
        1.58267880298,
        1.63292419598,
        1.61133926998,
        1.40594728998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.55088388348,
      "stddev": 0.14464708286638012,
      "median": 1.50874535198,
      "user": 1.03991486,
      "system": 1.1041351000000001,
      "min": 1.37927172798,
      "max": 1.78431856498,
      "times": [
        1.45895058298,
        1.46560695098,
        1.78431856498,
        1.40492779798,
        1.7826502639800001,
        1.37927172798,
        1.53507722998,
        1.4824134739800001,
        1.57464234198,
        1.64097989998
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 250.3 ± 5.3 242.8 259.8 1.02 ± 0.05
pacquet@main 244.5 ± 10.8 224.6 254.6 1.00
pnpr@HEAD 262.3 ± 5.8 254.7 271.8 1.07 ± 0.05
pnpr@main 259.4 ± 6.6 254.4 273.1 1.06 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25027581896,
      "stddev": 0.0053007386228003375,
      "median": 0.24923084066,
      "user": 0.192318,
      "system": 0.5278281,
      "min": 0.24281993966,
      "max": 0.25977116566,
      "times": [
        0.25977116566,
        0.25219305766000005,
        0.25325855766000005,
        0.24493352766,
        0.24792134766,
        0.25025867566000004,
        0.24820300566,
        0.24659444666000002,
        0.24281993966,
        0.25680446566000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24454590966000006,
      "stddev": 0.01084907623638518,
      "median": 0.24902188966,
      "user": 0.2027628,
      "system": 0.5080446,
      "min": 0.22462480866,
      "max": 0.25463636566000003,
      "times": [
        0.25005216866,
        0.25463636566000003,
        0.24646097566000003,
        0.24212996566,
        0.24913896466000002,
        0.25393510866,
        0.24890481466,
        0.25006066366,
        0.22551526066000002,
        0.22462480866
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26230677416,
      "stddev": 0.005781213346467913,
      "median": 0.26231119466,
      "user": 0.1999743,
      "system": 0.5339712999999999,
      "min": 0.25470619666000005,
      "max": 0.27179162366000004,
      "times": [
        0.25756983366,
        0.25625573466000007,
        0.26603558666000005,
        0.26078799466,
        0.27179162366000004,
        0.25470619666000005,
        0.26383439466,
        0.25813562566000003,
        0.26428441866,
        0.26966633266000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.25944016016000004,
      "stddev": 0.006572019666336615,
      "median": 0.25552016416,
      "user": 0.21419479999999996,
      "system": 0.5294831999999999,
      "min": 0.25440001166000004,
      "max": 0.27314615766000006,
      "times": [
        0.27314615766000006,
        0.25551225966,
        0.25440001166000004,
        0.25490727366000004,
        0.25493351266000003,
        0.26816018566000005,
        0.26249599166000004,
        0.25519389166000006,
        0.26012424866000006,
        0.25552806866000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.671 ± 0.018 2.631 2.693 1.72 ± 0.17
pacquet@main 2.685 ± 0.021 2.655 2.730 1.73 ± 0.17
pnpr@HEAD 1.553 ± 0.153 1.379 1.762 1.00
pnpr@main 1.599 ± 0.167 1.374 1.797 1.03 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6706211369600004,
      "stddev": 0.01803069848576222,
      "median": 2.66909642296,
      "user": 1.60174656,
      "system": 1.24297194,
      "min": 2.63116564296,
      "max": 2.69344930996,
      "times": [
        2.6690904569600002,
        2.65569657896,
        2.69344930996,
        2.66760976596,
        2.6691023889600003,
        2.63116564296,
        2.6888084459600003,
        2.6858956069600004,
        2.66828465296,
        2.67710851996
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6853937011599998,
      "stddev": 0.02088337105914983,
      "median": 2.6794656254600002,
      "user": 1.56146026,
      "system": 1.29280314,
      "min": 2.65496444396,
      "max": 2.72962452996,
      "times": [
        2.67960193096,
        2.67655498096,
        2.68431599096,
        2.6792060389600003,
        2.7093329709600003,
        2.6913181879600003,
        2.72962452996,
        2.6793293199600003,
        2.6696886169600003,
        2.65496444396
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.55276850626,
      "stddev": 0.15332714500389588,
      "median": 1.51736129796,
      "user": 0.9569843599999999,
      "system": 1.13411484,
      "min": 1.37902990096,
      "max": 1.76185560196,
      "times": [
        1.52435302396,
        1.76185560196,
        1.69803786296,
        1.5103695719599999,
        1.38727753096,
        1.7531852699600001,
        1.38695197996,
        1.66000887396,
        1.37902990096,
        1.46661544596
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5988327364600001,
      "stddev": 0.16682383270736764,
      "median": 1.64624481196,
      "user": 1.00821046,
      "system": 1.0927831399999999,
      "min": 1.37434622196,
      "max": 1.79722887796,
      "times": [
        1.3949917569599999,
        1.42099409796,
        1.79722887796,
        1.37434622196,
        1.62808392896,
        1.47900443796,
        1.68557167896,
        1.78960816596,
        1.66440569496,
        1.75409250296
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 538.8 ± 5.6 530.8 547.8 1.91 ± 0.04
pacquet@main 535.5 ± 11.7 519.6 552.5 1.90 ± 0.05
pnpr@HEAD 291.6 ± 5.1 281.9 299.5 1.03 ± 0.03
pnpr@main 281.9 ± 5.0 277.1 292.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.53882348536,
      "stddev": 0.005594996456020315,
      "median": 0.5397302932600001,
      "user": 0.6458452400000001,
      "system": 0.6512298,
      "min": 0.53079416526,
      "max": 0.54778416726,
      "times": [
        0.5349238122600001,
        0.54261529026,
        0.53998179026,
        0.54778416726,
        0.54206211226,
        0.54412872026,
        0.53173726426,
        0.53472873526,
        0.5394787962600001,
        0.53079416526
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.53545582916,
      "stddev": 0.011690687112880505,
      "median": 0.53415953876,
      "user": 0.64141954,
      "system": 0.6607841999999999,
      "min": 0.5195932332600001,
      "max": 0.55247718026,
      "times": [
        0.5195932332600001,
        0.52209864226,
        0.52691426726,
        0.53334452026,
        0.54900610926,
        0.53497455726,
        0.54254592126,
        0.54667957426,
        0.55247718026,
        0.52692428626
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29157208816,
      "stddev": 0.005109286110618197,
      "median": 0.29311249476,
      "user": 0.17057394,
      "system": 0.5242343999999999,
      "min": 0.28188211826000004,
      "max": 0.29950581826,
      "times": [
        0.28906257726,
        0.29419368326,
        0.29425306426000003,
        0.29222673226,
        0.29399825726,
        0.29528647326,
        0.28579008826,
        0.28188211826000004,
        0.28952206926,
        0.29950581826
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.28187516256,
      "stddev": 0.004982894959559012,
      "median": 0.28080630426,
      "user": 0.18573434,
      "system": 0.49471049999999994,
      "min": 0.27710195126000003,
      "max": 0.29221500126,
      "times": [
        0.27860256526,
        0.29221500126,
        0.27717650026,
        0.28181805726000003,
        0.28095002926,
        0.28901136126,
        0.28210807126000004,
        0.27910550926,
        0.27710195126000003,
        0.28066257926
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.837 ± 0.013 1.820 1.862 6.50 ± 0.23
pacquet@main 1.827 ± 0.009 1.808 1.836 6.46 ± 0.23
pnpr@HEAD 0.286 ± 0.003 0.282 0.290 1.01 ± 0.04
pnpr@main 0.283 ± 0.010 0.268 0.298 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8365592000200004,
      "stddev": 0.012953410987122427,
      "median": 1.83618859862,
      "user": 0.84848882,
      "system": 0.71971064,
      "min": 1.82045049962,
      "max": 1.86156352062,
      "times": [
        1.84210221262,
        1.83538635462,
        1.84246842862,
        1.83567236062,
        1.86156352062,
        1.8475673736199998,
        1.82061570562,
        1.8367048366199998,
        1.82045049962,
        1.82306070762
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8270758607200002,
      "stddev": 0.008717821698615928,
      "median": 1.8278109706199999,
      "user": 0.8468211200000001,
      "system": 0.71559634,
      "min": 1.80756424862,
      "max": 1.8364045166199998,
      "times": [
        1.8256356696199998,
        1.8239297986199998,
        1.80756424862,
        1.8364045166199998,
        1.83062143562,
        1.82782425562,
        1.83598943762,
        1.83494051962,
        1.82779768562,
        1.8200510396199998
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28563397812,
      "stddev": 0.0031928073454845353,
      "median": 0.28563474262,
      "user": 0.18173762,
      "system": 0.4985007399999999,
      "min": 0.28179924062,
      "max": 0.29016094162,
      "times": [
        0.28196253662000004,
        0.28614766962000004,
        0.28179924062,
        0.28340173762000004,
        0.28556246162000004,
        0.28884157462000004,
        0.29016094162,
        0.29001245162,
        0.28274414362000005,
        0.28570702362
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.28270979312000005,
      "stddev": 0.009963477877680206,
      "median": 0.28260047912,
      "user": 0.16727782,
      "system": 0.49370383999999995,
      "min": 0.26804105362,
      "max": 0.29815091462000004,
      "times": [
        0.28320152162,
        0.29815091462000004,
        0.26878464862,
        0.26804105362,
        0.28199943662000004,
        0.27584864462,
        0.28884281662000005,
        0.29501572062000003,
        0.28167680062,
        0.28553637362
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 320.1 ± 9.6 306.5 340.1 3.86 ± 0.14
pacquet@main 317.1 ± 6.6 310.5 328.5 3.82 ± 0.11
pnpr@HEAD 83.5 ± 2.0 80.3 87.8 1.01 ± 0.03
pnpr@main 82.9 ± 1.7 81.1 87.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.32013433622,
      "stddev": 0.00956752456981565,
      "median": 0.32223865512000005,
      "user": 0.32419172,
      "system": 0.041995879999999985,
      "min": 0.30647737462,
      "max": 0.34010859262000004,
      "times": [
        0.34010859262000004,
        0.32004267862,
        0.30647737462,
        0.32287242862000004,
        0.32229391362000004,
        0.30850737362,
        0.31207460762,
        0.32218339662,
        0.32394941962,
        0.32283357662
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3171206274200001,
      "stddev": 0.006553866765432177,
      "median": 0.31440630712,
      "user": 0.31162772,
      "system": 0.05233858,
      "min": 0.31045704962000004,
      "max": 0.32849458662000003,
      "times": [
        0.32554847062000003,
        0.31131457162000004,
        0.32449413162,
        0.31517744962,
        0.31304072062,
        0.31256939562,
        0.31363516462,
        0.31647473362,
        0.31045704962000004,
        0.32849458662000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.0834984736825,
      "stddev": 0.0019856067092504136,
      "median": 0.08279890412,
      "user": 0.020716451249999993,
      "system": 0.007193418749999999,
      "min": 0.08029236862,
      "max": 0.08784966162,
      "times": [
        0.08784966162,
        0.08419917262,
        0.08252881662,
        0.08232704862,
        0.08221666162,
        0.08387159562,
        0.08656487162,
        0.08255804162000001,
        0.08068457662,
        0.08234960162,
        0.08243189562,
        0.08271609862,
        0.08229158162,
        0.08196201362,
        0.08578759262,
        0.08369215062,
        0.08325801562,
        0.08029236862,
        0.08303386562000001,
        0.08213841462,
        0.08461011362,
        0.08772799362,
        0.08459545562,
        0.08375665162,
        0.08695688762,
        0.08149885462,
        0.08328479562,
        0.08211651362,
        0.08260277462,
        0.08723673262000001,
        0.08192862962,
        0.08288170962000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08292653485529414,
      "stddev": 0.0017489845675834398,
      "median": 0.08255329812000001,
      "user": 0.01939133176470588,
      "system": 0.008240367058823528,
      "min": 0.08108740162,
      "max": 0.08741355262,
      "times": [
        0.08384711162,
        0.08589225862000001,
        0.08108740162,
        0.08261437762,
        0.08280940362,
        0.08709282262,
        0.08184115562000001,
        0.08187092262000001,
        0.08281634662000001,
        0.08196491862000001,
        0.08224500462,
        0.08123496862,
        0.08185925062,
        0.08357337762,
        0.08111516262,
        0.08196648162,
        0.08353752062,
        0.08143084662,
        0.08314014462000001,
        0.08741355262,
        0.08162200562000001,
        0.08249221862,
        0.08221776262,
        0.08295897462,
        0.08126518562,
        0.08358425862,
        0.08564897262,
        0.08354536562,
        0.08689035162,
        0.08172217362,
        0.08268151362000001,
        0.08148311362,
        0.08272943362,
        0.08130782562
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.528 ± 0.133 4.421 4.733 1.29 ± 0.05
pacquet@main 4.618 ± 0.134 4.408 4.858 1.31 ± 0.05
pnpr@HEAD 3.552 ± 0.129 3.440 3.803 1.01 ± 0.05
pnpr@main 3.515 ± 0.099 3.442 3.744 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.52753808132,
      "stddev": 0.13316691728101782,
      "median": 4.450046909019999,
      "user": 1.6840373000000004,
      "system": 1.30592724,
      "min": 4.4208486230199995,
      "max": 4.7334547980199995,
      "times": [
        4.71335711202,
        4.45798245602,
        4.4421113620199995,
        4.43999407902,
        4.7334547980199995,
        4.42701419102,
        4.70569648602,
        4.43264616002,
        4.50227554602,
        4.4208486230199995
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.617542483319999,
      "stddev": 0.13449148073124578,
      "median": 4.623088194019999,
      "user": 1.6344138000000001,
      "system": 1.3453456400000001,
      "min": 4.40822414902,
      "max": 4.858067474019999,
      "times": [
        4.6903006740199995,
        4.858067474019999,
        4.74843406402,
        4.40822414902,
        4.6024556380199995,
        4.61408669902,
        4.63208968902,
        4.646411920019999,
        4.44475723702,
        4.53059728902
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5519719301199997,
      "stddev": 0.12877354253588713,
      "median": 3.5016038380200003,
      "user": 1.1682046,
      "system": 1.22211864,
      "min": 3.4397556540200003,
      "max": 3.80301669502,
      "times": [
        3.5550357050200003,
        3.46409624102,
        3.51167446502,
        3.4506093360200003,
        3.49153321102,
        3.4397556540200003,
        3.4537911990200003,
        3.60305180202,
        3.80301669502,
        3.74715499302
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.51466243762,
      "stddev": 0.09900665874095785,
      "median": 3.4631618905200003,
      "user": 1.1404139000000002,
      "system": 1.2413449399999998,
      "min": 3.4420629440200003,
      "max": 3.7438662510200005,
      "times": [
        3.5988936160200002,
        3.4591473720200003,
        3.7438662510200005,
        3.4420629440200003,
        3.4560938070200002,
        3.4430395120200004,
        3.4666497830200003,
        3.45967399802,
        3.4875885880200004,
        3.58960850502
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13140
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,631.17 ms
(-5.15%)Baseline: 2,774.16 ms
3,328.99 ms
(79.04%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,820.45 ms
(-6.27%)Baseline: 1,942.13 ms
2,330.56 ms
(78.11%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
530.79 ms
(-10.98%)Baseline: 596.29 ms
715.55 ms
(74.18%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
306.48 ms
(-16.30%)Baseline: 366.18 ms
439.41 ms
(69.75%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,330.13 ms
(-5.96%)Baseline: 2,477.77 ms
2,973.33 ms
(78.37%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,420.85 ms
(-2.58%)Baseline: 4,537.74 ms
5,445.29 ms
(81.19%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
242.82 ms
(-10.23%)Baseline: 270.50 ms
324.60 ms
(74.81%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13140
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,379.03 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
281.80 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
281.88 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
80.29 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,331.32 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,439.76 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
254.71 ms
🐰 View full continuous benchmarking report in Bencher

@aqeelat
aqeelat marked this pull request as ready for review July 19, 2026 10:44
@aqeelat
aqeelat requested a review from zkochan as a code owner July 19, 2026 10:44
Copilot AI review requested due to automatic review settings July 19, 2026 10:44
@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 →

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@greptile-apps

greptile-apps Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the changes are narrowly scoped to setup cleanup and a detection heuristic, both guarded by tests that exercise the key edge cases.

The cleanup path runs only after a successful addDirToEnvPath call, so a failed PATH migration cannot leave the home directory in a partially-cleaned state. The dangling-shim detector correctly handles both absolute and relative cmd-shim-target values, as confirmed by the two new test cases. The Rust and TypeScript implementations agree on the same 12 shim names, using the same constant imported directly in both test suites. No existing behavior is removed — the cleanup is best-effort, and the detection logic is strictly more conservative (fewer false positives) than the previous file-existence check.

No files require special attention.

Reviews (3): Last reviewed commit: "fix(self-update): resolve relative legac..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts`:
- Line 294: Update the shim target existence check in the surrounding
self-update logic to resolve relative target paths against pnpmHomeDir before
calling fs.existsSync. Preserve absolute targets and the existing dangling-shim
behavior while ensuring relative cmd-shim targets are evaluated from the shim’s
directory rather than the current working directory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c43a5410-9716-430e-9b50-b20dea06ed10

📥 Commits

Reviewing files that changed from the base of the PR and between 1166108 and 12f4771.

📒 Files selected for processing (7)
  • .changeset/cleanup-legacy-homedir-shims.md
  • pnpm/crates/cli/src/cli_args/setup.rs
  • pnpm/crates/cli/src/cli_args/setup/tests.rs
  • pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts
  • pnpm11/engine/pm/commands/src/setup/setup.ts
  • pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts
  • pnpm11/engine/pm/commands/test/setup/setup.test.ts

Per PR review: the duplicated list in setup.test.ts would silently drift
if a new alias were added to the source const. Import the const directly,
matching the Rust test's pattern.
Copilot AI review requested due to automatic review settings July 19, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

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 →

1 similar comment
@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 →

Copilot AI review requested due to automatic review settings July 19, 2026 11:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 19, 2026
@zkochan
zkochan merged commit a3478cf into pnpm:main Jul 19, 2026
36 checks passed
@aqeelat
aqeelat deleted the fix/12496-legacy-homedir-shims branch July 19, 2026 13:00
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.

pnpm self-update keeps warning about v10 layout even after pnpm setup — legacy shim at PNPM_HOME is never cleaned up and can become dangling

4 participants