Skip to content

fix(install): honor removal overrides for optional peers - #15199

Merged
zkochan merged 3 commits into
pnpm:mainfrom
JoyceLeo326:codex/fix-optional-peer-removal
Sep 22, 2026
Merged

zkochan merged 3 commits into
pnpm:mainfrom
JoyceLeo326:codex/fix-optional-peer-removal

Conversation

@JoyceLeo326

@JoyceLeo326 JoyceLeo326 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An optional peer removed by "ws>utf-8-validate": "-" can reappear when a sibling workspace supplies it. The override deletes the peer dependency but leaves optional metadata that recreates it.

Both TypeScript and Rust now remove the matching metadata. TypeScript clones the metadata container to preserve cached manifests. Regressions cover selectors, legitimate metadata-only peers and sibling dependencies.

Closes #15008.

The 22-file scope includes prerequisite repairs for existing documentation and lint violations exposed by the required checks on Windows. A separate commit isolates the additional lint repairs. They preserve runtime behavior and check settings; the concurrent junction test still starts all 32 workers before joining.

Validation

On the rebased source, Windows validation passed:

  • Full TypeScript compile and lint, including validation of 346 pending change intents.
  • TypeScript hooks: 64/64; focused integration: 2/2.
  • Focused Rust regressions: 7/7, including the updated upstream junction-race scenario.
  • Workspace/all-targets check and Clippy, full strict Dylint, pinned formatting, spelling and TOML checks.

New unit regressions failed before the fix and passed afterward. Before rebasing, broader selections were 792/793 Rust (one unchanged fixture blocked by independently reproduced Windows OS 1314) and 27/28 TypeScript (upstream HTTP 503/504). These are not full-suite passes.

The original push hook completed successfully, including strict full-workspace documentation checks, Dylint, spelling and TOML formatting.

Squash Commit Body

Remove optional peer metadata when a removal override deletes the peer,
preventing a sibling workspace dependency from reintroducing it.

Fix both affected implementations, preserve cached TypeScript manifests,
and add unit and workspace regressions.

Repair violations exposed by required checks without relaxing them or
changing runtime behavior.

Closes pnpm/pnpm#15008.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

Written by an agent (Codex, GPT-6).


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
    • Removal overrides ("-") now remove optional peer dependency metadata as well as the dependency itself. This prevents an optional peer removed by an override from being supplied by another package in the workspace.
    • Other workspace packages retain their own dependencies when an optional peer is removed from a package’s dependency context.

@welcome

welcome Bot commented Sep 21, 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 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 769a0006-88e9-48b2-b2d4-31d7bc9a6c64

📥 Commits

Reviewing files that changed from the base of the PR and between c443628 and f79b4e5.

📒 Files selected for processing (2)
  • pnpm/crates/cmd-shim/src/link_bins/executable.rs
  • pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/cmd-shim/src/link_bins/executable.rs

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


📝 Walkthrough

Walkthrough

Removal overrides now delete matching entries from optional peer metadata in the TypeScript and Rust implementations. Workspace tests verify that a removed optional peer is not resolved from a sibling package. Other Rust changes update names, imports, literals, formatting, and comments without changing behavior.

Changes

Optional peer removal

Layer / File(s) Summary
Remove peer metadata with overrides
pnpm/crates/package-manager/src/overrides.rs, pnpm/crates/package-manager/src/overrides/tests.rs, pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts, pnpm11/hooks/read-package-hook/test/createVersionOverrider.test.ts, .changeset/fix-optional-peer-removal.md
Both override implementations remove the deleted peer’s metadata. Tests cover direct and parent-qualified selectors and confirm the original manifest remains unchanged.
Validate sibling workspace resolution
pnpm/crates/cli/tests/suite/workspace_install.rs, pnpm11/installing/deps-installer/test/install/autoInstallPeers.ts
Workspace tests verify that the override prevents a sibling package from supplying the removed optional peer while retaining that package’s own dependency.

Rust and Windows maintenance

Layer / File(s) Summary
Update Rust and Windows code
pnpm/crates/cli/..., pnpm/crates/config/..., pnpm/crates/deps-restorer/..., pnpm/crates/executor/..., pnpm/crates/fs/..., pnpm/crates/workspace-state/..., pnpm/crates/cmd-shim/...
Rust sources and tests update import paths, parameter names, Windows path literals, formatting, comments, and test structure. These edits do not change the described behavior.

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
[ #15008 ] Apply a "parent>peer": "-" override to an optional peer even when another workspace package provides it. ✅

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

Merge Risk: ⚪ Minimal · up to f79b4

This change should prevent a removed optional peer from being reintroduced through a sibling workspace dependency. The reported latency alert has no established repeatable impact, so no actionable merge risk is demonstrated.

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

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

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

pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.56%. Comparing base (0cbb014) to head (f79b4e5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15199   +/-   ##
=======================================
  Coverage   91.56%   91.56%           
=======================================
  Files        1387     1387           
  Lines      186702   186705    +3     
=======================================
+ Hits       170953   170957    +4     
+ Misses      15749    15748    -1     

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

Copy link
Copy Markdown
Contributor

Same-run regression check

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

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

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2491.98 ms 2466.60 ms -1.0% 124.60 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1320.19 ms 1517.95 ms 15.0% 66.01 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 282.00 ms 322.57 ms 14.4% 14.10 ms Inconclusive (not reproduced)
isolated-fresh-restore-hot-cache-hot-store pnpr 302.38 ms 298.89 ms -1.2% 15.12 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 7.73 ms 8.72 ms 12.8% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 7.58 ms 7.53 ms -0.7% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 12.22 ms 8.82 ms -27.8% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 10.03 ms 11.13 ms 11.0% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2485.18 ms 2500.25 ms 0.6% 124.26 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1495.79 ms 1453.71 ms -2.8% 74.79 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 461.56 ms 461.15 ms -0.1% 23.08 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 288.49 ms 276.48 ms -4.2% 14.42 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1734.75 ms 1671.18 ms -3.7% 86.74 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 330.78 ms 321.88 ms -2.7% 16.54 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 192.63 ms 209.79 ms 8.9% 9.63 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 89.43 ms 88.50 ms -1.0% 4.47 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 635.88 ms 722.29 ms 13.6% 31.79 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 176.13 ms 182.35 ms 3.5% 8.81 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4340.83 ms 4627.29 ms 6.6% 217.04 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3484.43 ms 3472.21 ms -0.4% 174.22 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 189.96 ms 142.32 ms -25.1% 9.50 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 142.92 ms 207.09 ms 44.9% 7.15 ms Inconclusive (not reproduced)

Integrated-Benchmark Report (Linux)

Commit: f79b4e5bec65

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 tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.460 ± 0.151 2.282 2.724 1.77 ± 0.20
pacquet@main 2.491 ± 0.146 2.307 2.718 1.80 ± 0.21
pnpr@HEAD 1.500 ± 0.144 1.300 1.680 1.08 ± 0.15
pnpr@main 1.387 ± 0.136 1.292 1.703 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.45955312124,
      "stddev": 0.15070628848007334,
      "median": 2.46659966794,
      "user": 1.5964066399999999,
      "system": 1.7566002600000001,
      "min": 2.2818583284400002,
      "max": 2.7238514414400004
    },
    {
      "command": "pacquet@main",
      "mean": 2.49149325864,
      "stddev": 0.14608119755036503,
      "median": 2.49198207294,
      "user": 1.4142243399999999,
      "system": 1.5489536599999996,
      "min": 2.30702176744,
      "max": 2.71842397544
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4999828120400003,
      "stddev": 0.14397642826128348,
      "median": 1.5179508424400003,
      "user": 1.3090546399999998,
      "system": 1.47549476,
      "min": 1.30002728244,
      "max": 1.6797078934400003
    },
    {
      "command": "pnpr@main",
      "mean": 1.3868435995400001,
      "stddev": 0.13583425045385905,
      "median": 1.32018713244,
      "user": 1.2605203399999998,
      "system": 1.36795136,
      "min": 1.29220058744,
      "max": 1.70305388244
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 345.3 ± 48.6 272.3 413.0 1.25 ± 0.19
pacquet@main 276.8 ± 13.7 251.3 290.5 1.00
pnpr@HEAD 296.4 ± 12.4 277.4 315.2 1.07 ± 0.07
pnpr@main 300.5 ± 16.5 274.1 320.3 1.09 ± 0.08

Confirmation (reversed target order)

Command Mean [ms] Min [ms] Max [ms] Relative
pnpr@main 344.8 ± 36.6 306.9 402.1 1.15 ± 0.14
pnpr@HEAD 300.0 ± 25.3 263.7 345.8 1.00 ± 0.11
pacquet@main 313.2 ± 35.8 260.0 378.8 1.05 ± 0.14
pacquet@HEAD 299.5 ± 19.1 273.8 339.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.34530758502,
      "stddev": 0.04861199071069593,
      "median": 0.32257207402,
      "user": 0.36959632,
      "system": 0.76804784,
      "min": 0.27226021952,
      "max": 0.41304333152
    },
    {
      "command": "pacquet@main",
      "mean": 0.27682838742000004,
      "stddev": 0.01367312868264414,
      "median": 0.28199580602,
      "user": 0.31463001999999995,
      "system": 0.64109044,
      "min": 0.25126064252,
      "max": 0.29048202352
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29643894542,
      "stddev": 0.012362242272034692,
      "median": 0.29889170152,
      "user": 0.30817752,
      "system": 0.63070134,
      "min": 0.27738943452,
      "max": 0.31515990652
    },
    {
      "command": "pnpr@main",
      "mean": 0.30050868791999996,
      "stddev": 0.01650156062705543,
      "median": 0.30237836302,
      "user": 0.31766651999999995,
      "system": 0.63382114,
      "min": 0.27405342152,
      "max": 0.32026495552
    }
  ],
  "confirmation": {
    "results": [
      {
        "command": "pnpr@main",
        "mean": 0.34476869258000004,
        "stddev": 0.03664307339427342,
        "median": 0.33269812528000003,
        "user": 0.38853396,
        "system": 0.7214579999999999,
        "min": 0.30692080528000004,
        "max": 0.40206307028000005
      },
      {
        "command": "pnpr@HEAD",
        "mean": 0.30003272918000007,
        "stddev": 0.02534098130211673,
        "median": 0.30282029978,
        "user": 0.31929646,
        "system": 0.6505124,
        "min": 0.26366532328000003,
        "max": 0.34579576228000003
      },
      {
        "command": "pacquet@main",
        "mean": 0.31322724668,
        "stddev": 0.03577807487391683,
        "median": 0.30028409778,
        "user": 0.35990776,
        "system": 0.6757132999999999,
        "min": 0.26002437328000005,
        "max": 0.37880580828000004
      },
      {
        "command": "pacquet@HEAD",
        "mean": 0.29947258208000005,
        "stddev": 0.019089481100911923,
        "median": 0.29596474078,
        "user": 0.34148806,
        "system": 0.6829476999999999,
        "min": 0.27377449428,
        "max": 0.33960987928
      }
    ]
  }
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.8 ± 1.2 6.7 14.1 1.12 ± 0.21
pacquet@main 8.0 ± 1.1 6.6 12.9 1.02 ± 0.19
pnpr@HEAD 7.9 ± 1.0 6.6 12.7 1.00
pnpr@main 7.9 ± 1.0 6.5 12.7 1.01 ± 0.18
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.008830175709638557,
      "stddev": 0.001246030434472137,
      "median": 0.008721518300000002,
      "user": 0.005216464819277108,
      "system": 0.004187371084337351,
      "min": 0.006745738300000001,
      "max": 0.014126149300000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.008038777701215801,
      "stddev": 0.0011055817003817177,
      "median": 0.007729795300000002,
      "user": 0.004315199209726442,
      "system": 0.004300408389057747,
      "min": 0.006563619300000001,
      "max": 0.012870538300000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007859731992737441,
      "stddev": 0.0009786671047786082,
      "median": 0.007528925800000001,
      "user": 0.004463614748603349,
      "system": 0.003950227932960897,
      "min": 0.006643697300000001,
      "max": 0.0127449793
    },
    {
      "command": "pnpr@main",
      "mean": 0.007938601914457832,
      "stddev": 0.0010410414499875396,
      "median": 0.0075798658,
      "user": 0.004479359397590362,
      "system": 0.0040049755421686754,
      "min": 0.0065094453000000005,
      "max": 0.012656109300000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.4 ± 1.9 6.7 17.1 1.00
pacquet@main 12.7 ± 2.4 9.1 20.1 1.36 ± 0.38
pnpr@HEAD 11.3 ± 1.3 8.9 15.3 1.21 ± 0.28
pnpr@main 10.3 ± 1.2 7.7 16.3 1.10 ± 0.26
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00936180154765958,
      "stddev": 0.001904894696834323,
      "median": 0.00881660542,
      "user": 0.0055752017021276565,
      "system": 0.00432569680851064,
      "min": 0.00668392292,
      "max": 0.017110429920000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.012727823214117655,
      "stddev": 0.0024248174036169403,
      "median": 0.01221933492,
      "user": 0.007711124278074869,
      "system": 0.005762502673796793,
      "min": 0.00908032992,
      "max": 0.02013887992
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011297327410196076,
      "stddev": 0.0013097595485336083,
      "median": 0.011130395920000001,
      "user": 0.006190433137254903,
      "system": 0.005805583333333331,
      "min": 0.00888825992,
      "max": 0.01532736192
    },
    {
      "command": "pnpr@main",
      "mean": 0.010262856627964594,
      "stddev": 0.0012366328115597071,
      "median": 0.01002907142,
      "user": 0.00619595132743363,
      "system": 0.004692668141592918,
      "min": 0.00772693292,
      "max": 0.016272025920000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.515 ± 0.052 2.450 2.615 1.68 ± 0.13
pacquet@main 2.500 ± 0.043 2.447 2.574 1.67 ± 0.13
pnpr@HEAD 1.494 ± 0.109 1.368 1.711 1.00
pnpr@main 1.527 ± 0.115 1.388 1.720 1.02 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5153214927,
      "stddev": 0.052466681360747724,
      "median": 2.5002486949,
      "user": 1.9197682599999997,
      "system": 1.6094347800000002,
      "min": 2.4495881669,
      "max": 2.6154705929
    },
    {
      "command": "pacquet@main",
      "mean": 2.4997711466999997,
      "stddev": 0.042590493308160185,
      "median": 2.4851849999,
      "user": 1.8737521599999998,
      "system": 1.6480835800000002,
      "min": 2.4467140479,
      "max": 2.5737059779
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4941264257,
      "stddev": 0.10937054480017411,
      "median": 1.4537100754,
      "user": 1.1790454599999998,
      "system": 1.34365398,
      "min": 1.3684692109,
      "max": 1.7108705089
    },
    {
      "command": "pnpr@main",
      "mean": 1.5270819339000001,
      "stddev": 0.11538507649012308,
      "median": 1.4957886204,
      "user": 1.1771369600000001,
      "system": 1.29200178,
      "min": 1.3879399849,
      "max": 1.7202741279
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 463.5 ± 38.7 414.7 519.7 1.69 ± 0.15
pacquet@main 467.3 ± 22.2 433.4 504.2 1.70 ± 0.10
pnpr@HEAD 274.5 ± 9.3 261.3 287.9 1.00
pnpr@main 290.6 ± 6.1 284.9 301.8 1.06 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.46350872146000005,
      "stddev": 0.0387268673298308,
      "median": 0.46115014086000006,
      "user": 0.67877032,
      "system": 0.85171826,
      "min": 0.41468393786,
      "max": 0.51973263086
    },
    {
      "command": "pacquet@main",
      "mean": 0.46729597526000005,
      "stddev": 0.02224179098212125,
      "median": 0.4615631478600001,
      "user": 0.68352762,
      "system": 0.8413543599999999,
      "min": 0.43344227286000003,
      "max": 0.5042038988599999
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27447539586,
      "stddev": 0.009253336465290902,
      "median": 0.27648007786000006,
      "user": 0.22435352000000003,
      "system": 0.51645186,
      "min": 0.26130463386,
      "max": 0.28787026886000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.29063895326,
      "stddev": 0.006055647273179718,
      "median": 0.28849141636000003,
      "user": 0.23912351999999998,
      "system": 0.5591940599999999,
      "min": 0.28493172386000004,
      "max": 0.30181630286000005
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.675 ± 0.046 1.620 1.772 5.15 ± 0.23
pacquet@main 1.736 ± 0.048 1.650 1.836 5.34 ± 0.24
pnpr@HEAD 0.325 ± 0.012 0.311 0.342 1.00
pnpr@main 0.326 ± 0.014 0.301 0.341 1.00 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.67465984176,
      "stddev": 0.045658969979070194,
      "median": 1.6711840425600002,
      "user": 0.93861122,
      "system": 1.06004436,
      "min": 1.61983229956,
      "max": 1.7722621065600002
    },
    {
      "command": "pacquet@main",
      "mean": 1.73624739736,
      "stddev": 0.048178758353573235,
      "median": 1.73474528156,
      "user": 1.07460082,
      "system": 1.1048547599999998,
      "min": 1.64985883756,
      "max": 1.8361435105600001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32524919186,
      "stddev": 0.011552017593259457,
      "median": 0.32188191756000006,
      "user": 0.29058222,
      "system": 0.6285566599999999,
      "min": 0.31139645356000006,
      "max": 0.34216436356
    },
    {
      "command": "pnpr@main",
      "mean": 0.32577774186,
      "stddev": 0.013648952636884142,
      "median": 0.33077838006000004,
      "user": 0.28446982000000004,
      "system": 0.62633016,
      "min": 0.30076787356,
      "max": 0.34078408456000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 206.9 ± 11.6 187.3 222.9 2.33 ± 0.14
pacquet@main 194.4 ± 15.3 174.9 231.3 2.19 ± 0.18
pnpr@HEAD 88.8 ± 2.1 85.6 94.5 1.00
pnpr@main 92.0 ± 6.2 85.7 109.0 1.04 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2069265418866667,
      "stddev": 0.011589198709424556,
      "median": 0.20978564782000003,
      "user": 0.20861047333333332,
      "system": 0.07587548666666666,
      "min": 0.18734694382000003,
      "max": 0.22294305282000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.19442403032000005,
      "stddev": 0.015267645167921002,
      "median": 0.19262862182,
      "user": 0.19117748285714284,
      "system": 0.06783666285714285,
      "min": 0.17487769382,
      "max": 0.23129940482000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08883547041375002,
      "stddev": 0.002119328126824325,
      "median": 0.08849539682,
      "user": 0.029346058750000004,
      "system": 0.014775862499999995,
      "min": 0.08559911582,
      "max": 0.09454230482
    },
    {
      "command": "pnpr@main",
      "mean": 0.09195050188249998,
      "stddev": 0.006205267170443149,
      "median": 0.08942901832,
      "user": 0.030901683749999995,
      "system": 0.015049551250000001,
      "min": 0.08573681482,
      "max": 0.10899654782
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 679.2 ± 107.1 451.4 790.2 1.08 ± 0.25
pacquet@main 627.4 ± 104.5 432.8 780.1 1.00
pnpm@HEAD 3016.3 ± 104.4 2835.5 3158.7 4.81 ± 0.82
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6791575846466666,
      "stddev": 0.10708893155251353,
      "median": 0.72229272598,
      "user": 0.7036477622222221,
      "system": 0.1650382777777778,
      "min": 0.45142525898,
      "max": 0.7902154829800001
    },
    {
      "command": "pacquet@main",
      "mean": 0.627377199868889,
      "stddev": 0.10453442822414177,
      "median": 0.6358820379800001,
      "user": 0.6475965399999999,
      "system": 0.16138949999999996,
      "min": 0.43277716598000004,
      "max": 0.7800914559800001
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.016318548757778,
      "stddev": 0.10440777836202715,
      "median": 3.02954701798,
      "user": 4.670372873333334,
      "system": 0.20029083333333333,
      "min": 2.83551939698,
      "max": 3.1587443789800003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 181.3 ± 8.5 163.0 192.0 1.04 ± 0.07
pacquet@main 174.2 ± 7.7 161.3 185.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1813219997466667,
      "stddev": 0.008499421085818328,
      "median": 0.18235138588000002,
      "user": 0.13704463999999997,
      "system": 0.08876544,
      "min": 0.16297118888,
      "max": 0.19199498088000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.17423585029176472,
      "stddev": 0.007669259686344121,
      "median": 0.17613231888000003,
      "user": 0.13015581647058821,
      "system": 0.08600099294117647,
      "min": 0.16126846188000002,
      "max": 0.18594502288
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.609 ± 0.207 4.341 4.892 1.31 ± 0.08
pacquet@main 4.403 ± 0.153 4.295 4.693 1.26 ± 0.07
pnpr@HEAD 3.508 ± 0.137 3.366 3.741 1.00
pnpr@main 3.548 ± 0.152 3.378 3.842 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6090722023,
      "stddev": 0.20714421262346575,
      "median": 4.6272929524,
      "user": 1.7804235799999997,
      "system": 1.8642856600000002,
      "min": 4.3411937249,
      "max": 4.8915884809
    },
    {
      "command": "pacquet@main",
      "mean": 4.4028672377,
      "stddev": 0.1534115867417098,
      "median": 4.3408293789000005,
      "user": 1.42418818,
      "system": 1.54703626,
      "min": 4.294823693900001,
      "max": 4.6929760679
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5078769275,
      "stddev": 0.13653003947931144,
      "median": 3.4722079728999997,
      "user": 1.4230134799999998,
      "system": 1.46879676,
      "min": 3.3661373569,
      "max": 3.7409464959
    },
    {
      "command": "pnpr@main",
      "mean": 3.5476980027,
      "stddev": 0.15206735413451478,
      "median": 3.4844331929,
      "user": 1.5778860799999999,
      "system": 1.61978426,
      "min": 3.3781054209,
      "max": 3.8416383149
    }
  ]
}

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 144.1 ± 15.5 125.4 174.1 1.00
pacquet@main 193.9 ± 15.6 172.6 223.8 1.35 ± 0.18
pnpr@HEAD 193.4 ± 25.0 142.8 219.2 1.34 ± 0.23
pnpr@main 144.2 ± 4.4 137.3 155.2 1.00 ± 0.11

Confirmation (reversed target order)

Command Mean [ms] Min [ms] Max [ms] Relative
pnpr@main 144.8 ± 10.2 134.8 169.8 1.16 ± 0.13
pnpr@HEAD 146.2 ± 9.2 131.6 162.1 1.17 ± 0.13
pacquet@main 124.6 ± 10.7 113.2 158.7 1.00
pacquet@HEAD 164.4 ± 35.7 123.9 256.4 1.32 ± 0.31
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.14406283370947368,
      "stddev": 0.015496606726918993,
      "median": 0.14232163492,
      "user": 0.17674082210526318,
      "system": 0.14750711894736837,
      "min": 0.12541554092,
      "max": 0.17409170992
    },
    {
      "command": "pacquet@main",
      "mean": 0.19392830468923078,
      "stddev": 0.01563947512509944,
      "median": 0.18995896592,
      "user": 0.23704182615384614,
      "system": 0.20077607846153844,
      "min": 0.17257087792,
      "max": 0.22380657092
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1933676935866667,
      "stddev": 0.02499020833733006,
      "median": 0.20709366442,
      "user": 0.22238431333333333,
      "system": 0.1929752066666666,
      "min": 0.14277916292,
      "max": 0.21922033492
    },
    {
      "command": "pnpr@main",
      "mean": 0.14421772842000002,
      "stddev": 0.0044367754172184954,
      "median": 0.14292174042,
      "user": 0.16973397999999998,
      "system": 0.14020348444444444,
      "min": 0.13731937792,
      "max": 0.15522811492
    }
  ],
  "confirmation": {
    "results": [
      {
        "command": "pnpr@main",
        "mean": 0.14478990767764705,
        "stddev": 0.010235084090853254,
        "median": 0.13957159156,
        "user": 0.17279693529411763,
        "system": 0.14584308588235295,
        "min": 0.13482950356,
        "max": 0.16975694356
      },
      {
        "command": "pnpr@HEAD",
        "mean": 0.14622896122666662,
        "stddev": 0.009191183262322912,
        "median": 0.14531770406,
        "user": 0.18647225555555558,
        "system": 0.13659265777777777,
        "min": 0.13155663156,
        "max": 0.16208847456
      },
      {
        "command": "pacquet@main",
        "mean": 0.12458752986000002,
        "stddev": 0.010720069555308345,
        "median": 0.12242507106,
        "user": 0.15697645000000005,
        "system": 0.13460478,
        "min": 0.11320461356,
        "max": 0.15871766856
      },
      {
        "command": "pacquet@HEAD",
        "mean": 0.16443208056,
        "stddev": 0.03568322628629298,
        "median": 0.15127260356,
        "user": 0.20072629999999997,
        "system": 0.15854753000000002,
        "min": 0.12391556356,
        "max": 0.25644690756000005
      }
    ]
  }
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/15199
Testbedpacquet

🚨 3 Alerts

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

isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
259.74 ms
(+26.51%)Baseline: 205.31 ms
246.38 ms
(105.42%)

isolated-linker.repeat-install.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
7.96 ms
(+28.60%)Baseline: 6.19 ms
7.43 ms
(107.17%)

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
111.89 ms
(+7.23%)Baseline: 104.35 ms
125.21 ms
(89.36%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,418.89 ms
(-0.78%)Baseline: 2,438.01 ms
2,925.62 ms
(82.68%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,605.81 ms
(+5.26%)Baseline: 1,525.53 ms
1,830.64 ms
(87.72%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
327.56 ms
(-5.46%)Baseline: 346.46 ms
415.75 ms
(78.79%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
229.70 ms
(+21.07%)Baseline: 189.72 ms
227.67 ms
(100.89%)

isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,237.69 ms
(-0.34%)Baseline: 2,245.23 ms
2,694.28 ms
(83.05%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,360.25 ms
(+1.75%)Baseline: 4,285.10 ms
5,142.12 ms
(84.79%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
259.74 ms
(+26.51%)Baseline: 205.31 ms
246.38 ms
(105.42%)

isolated-linker.linked-workspace-resolve.hot-cache.offline📈 view plot
🚷 view threshold
175.65 ms
(+9.08%)Baseline: 161.03 ms
193.23 ms
(90.90%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
534.23 ms
(+4.67%)Baseline: 510.41 ms
612.50 ms
(87.22%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
5.96 ms
(-1.92%)Baseline: 6.07 ms
7.29 ms
(81.73%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
7.96 ms
(+28.60%)Baseline: 6.19 ms
7.43 ms
(107.17%)

🐰 View full continuous benchmarking report in Bencher

@JoyceLeo326

Copy link
Copy Markdown
Contributor Author

Draft status: performance check under investigation

The original local push checks, TypeScript CI matrix and Rust CI on Windows, Linux and macOS passed on c443628. The PR remains a draft because the Bencher report raised three latency alerts.

The same-run artifact gives these minimum latencies (HEAD / main):

  • Fresh resolve, hot cache/offline: 229.699 / 224.967 ms.
  • Fresh restore, hot cache/hot store: 259.740 / 260.399 ms.
  • Repeat install, hot cache/hot store: 7.959 / 5.367 ms. Means are 12.105 / 6.456 ms over 238 / 247 successful samples, so this difference needs investigation.

The same HEAD client through pnpr measured 5.275 ms minimum in the hot-repeat scenario; direct cold-cache repeats measured 5.956 / 5.917 ms. Those controls do not establish the cause of the hot-repeat difference. The Bencher thresholds use historical main results, not just this run's main comparison.

Both revisions were built with the same release command after binary cache misses. The benchmark merge tree matches the PR head exactly. I have not classified the alerts as noise or changed any thresholds. A controlled same-revision benchmark repeat is still needed before this performance gate can be considered clear; this account has no upstream write permission, which GitHub requires for reruns.


Written by an agent (Codex, GPT-6).

@zkochan
zkochan marked this pull request as ready for review September 21, 2026 22:14
@zkochan
zkochan self-requested a review as a code owner September 21, 2026 22:14
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Honor removal overrides for optional peer metadata

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Remove optional-peer metadata alongside peer dependencies targeted by removal overrides.
• Prevent sibling workspace packages from reintroducing explicitly removed optional peers.
• Cover TypeScript and Rust implementations while repairing Windows validation diagnostics.
Diagram

graph TD
  A["Removal override"] --> B{"Implementation"} --> C["TypeScript hook"] --> E["Manifest cleanup"] --> F["Peer resolution"] --> G["Workspace lockfile"]
  B --> D["Rust package manager"] --> E
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Filter stale metadata during peer resolution
  • ➕ Centralizes protection where optional peers are resolved.
  • ➕ Could defensively handle malformed third-party manifests. payloads.
  • ➖ Loses the explicit removal intent before resolution begins.
  • ➖ Risks rejecting legitimate metadata-only peer declarations.
  • ➖ Would require duplicated downstream checks across resolution paths.
2. Represent removals as explicit tombstones
  • ➕ Preserves removal intent throughout the entire resolution pipeline.
  • ➕ Could support additional override-aware diagnostics later.
  • ➖ Introduces a new intermediate manifest representation.
  • ➖ Expands the change across consumers and serialization boundaries.
  • ➖ Is disproportionate to the narrowly scoped bug.

Recommendation: Keep the PR's manifest-level cleanup. Removing peerDependenciesMeta at the same point as peerDependencies restores a clear invariant without changing legitimate metadata-only peers, and cloning the TypeScript metadata container preserves cached-manifest immutability. Downstream filtering or tombstones would add complexity and broaden behavioral risk.

Files changed (22) +225 / -65

Bug fix (2) +12 / -5
overrides.rsRemove optional metadata with overridden peers +4/-2

Remove optional metadata with overridden peers

• Extends Rust peer removal to delete the matching key from both peerDependencies and peerDependenciesMeta.

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

createVersionsOverrider.tsDelete cloned optional-peer metadata on removal +8/-3

Delete cloned optional-peer metadata on removal

• Clones peerDependenciesMeta to avoid mutating cached manifests, then removes matching metadata whenever a peer removal override applies.

pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts

Refactor (5) +35 / -26
cargo_deps.rsMove Windows helper import to test scope +0/-2

Move Windows helper import to test scope

• Removes a Windows test-only helper from the production module imports, avoiding an unused-import diagnostic.

pnpm/crates/cli/src/cargo_deps.rs

executable.rsClarify Windows same-file helper names +17/-12

Clarify Windows same-file helper names

• Renames ambiguous path parameters and reformats fallback comparison logic. Expands documentation while preserving hard-link identity and content-comparison behavior.

pnpm/crates/cmd-shim/src/link_bins/executable.rs

job_control.rsUse standard-library imports in Windows job control +12/-6

Use standard-library imports in Windows job control

• Switches memory and pointer imports from core to std in Windows job-object helpers without changing process cleanup behavior.

pnpm/crates/executor/src/job_control.rs

relative_path.rsClarify relative-path root parameters +3/-3

Clarify relative-path root parameters

• Renames generic same-root parameters to path and base and aligns their documentation. Root comparison behavior remains unchanged.

pnpm/crates/fs/src/relative_path.rs

symlink_dir.rsRepair Windows symlink lint and documentation +3/-3

Repair Windows symlink lint and documentation

• Uses a raw backslash literal during separator conversion and links writer-state constants in rustdoc. Runtime path conversion remains equivalent.

pnpm/crates/fs/src/symlink_dir.rs

Tests (9) +163 / -27
tests.rsImport Windows helper directly in tests +1/-1

Import Windows helper directly in tests

• Imports the Windows workspace-directory helper from its defining test-accessible module.

pnpm/crates/cli/src/cargo_deps/tests.rs

tests.rsUse raw strings for Windows deploy paths +4/-4

Use raw strings for Windows deploy paths

• Rewrites Windows path fixtures as raw string literals without changing test behavior.

pnpm/crates/cli/src/cli_args/deploy/tests.rs

workspace_install.rsTest optional-peer removal across sibling workspaces +46/-0

Test optional-peer removal across sibling workspaces

• Adds a Rust CLI workspace regression proving a sibling dependency remains installed for its owner but cannot supply a peer removed from another package. Verifies the resulting lockfile peer suffix.

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

tests.rsClean up Windows store-path tests +6/-6

Clean up Windows store-path tests

• Uses raw literals for Windows test paths and replaces a private rustdoc test link with plain descriptive text.

pnpm/crates/config/src/defaults/tests.rs

windows.rsFormat Windows privilege assertions +3/-3

Format Windows privilege assertions

• Adds trailing commas to Windows retry-test assertion arguments to satisfy formatting checks.

pnpm/crates/fs/src/retry/tests/windows.rs

tests.rsSimplify concurrent junction worker creation +13/-13

Simplify concurrent junction worker creation

• Extracts the junction worker closure and spawns all 32 scoped threads before joining them. Preserves barrier synchronization, concurrency, and assertions.

pnpm/crates/fs/src/symlink_dir/tests.rs

tests.rsTest Rust optional-peer metadata removal +25/-0

Test Rust optional-peer metadata removal

• Covers generic and parent-scoped removal selectors. Confirms the targeted metadata is deleted while unrelated optional peer metadata remains.

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

createVersionOverrider.test.tsTest TypeScript metadata removal and immutability +26/-0

Test TypeScript metadata removal and immutability

• Covers generic and parent-scoped selectors against frozen metadata. Verifies only targeted entries are removed and the source manifest remains unchanged.

pnpm11/hooks/read-package-hook/test/createVersionOverrider.test.ts

autoInstallPeers.tsTest sibling workspace optional-peer isolation +39/-0

Test sibling workspace optional-peer isolation

• Adds an installer regression proving a sibling workspace dependency cannot reintroduce an optional peer removed by override. Validates importer versions and the complete lockfile snapshot set.

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

Documentation (6) +15 / -7
fix-optional-peer-removal.mdDocument optional-peer removal override fix +7/-0

Document optional-peer removal override fix

• Adds patch release notes for pnpm, pacquet, and the read-package hook. Explains that removal overrides now prevent optional peers from being supplied by another workspace package.

.changeset/fix-optional-peer-removal.md

links.rsQualify link-file rustdoc reference +1/-1

Qualify link-file rustdoc reference

• Updates test documentation to use an explicit function link that passes strict rustdoc validation.

pnpm/crates/deps-restorer/src/link_file/tests/links.rs

ensure_file.rsExplain Windows-only unused mode parameters +4/-2

Explain Windows-only unused mode parameters

• Adds reasons to lint allowances for POSIX mode parameters that are intentionally unused on Windows.

pnpm/crates/fs/src/ensure_file.rs

file_mode.rsExplain Windows executable-mode allowance +1/-1

Explain Windows executable-mode allowance

• Documents why the executable-bit helper is unused on Windows through a reasoned lint allowance.

pnpm/crates/fs/src/file_mode.rs

test_support.rsRemove private retry-module rustdoc link +1/-2

Remove private retry-module rustdoc link

• Rewords module documentation to avoid a strict documentation failure involving a private target.

pnpm/crates/fs/src/test_support.rs

tests.rsFix workspace-state rustdoc link +1/-1

Fix workspace-state rustdoc link

• Qualifies the load_workspace_state reference so strict documentation checks resolve it correctly.

pnpm/crates/workspace-state/src/tests.rs

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. The fix includes unrelated lint churn 📘 Rule violation ⚙ Maintainability
Description
is_same_file renames its path parameters and reformats its metadata branch without changing
optional-peer override behavior. The same out-of-scope cleanup reaches CLI imports, Windows path
literals, job-control imports, filesystem comments, and junction-test structure, forcing reviewers
and later backports to separate validation cleanup from the actual fix.
Code

pnpm/crates/cmd-shim/src/link_bins/executable.rs[R287-289]

+fn is_same_file(first_path: &Path, second_path: &Path) -> bool {
    if let (Ok(handle_a), Ok(handle_b)) =
-        (same_file::Handle::from_path(a), same_file::Handle::from_path(b))
+        (same_file::Handle::from_path(first_path), same_file::Handle::from_path(second_path))
Relevance

●●● Strong

A recent review explicitly required removing unrelated test and lint hardening from a focused
bug-fix PR.

PR-#15082
PR-#13416

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2255067 limits bug-fix PRs to changes necessary for the defect. The actual behavior change is
confined to optional-peer metadata removal, while the cited command-shim, job-control,
configuration-test, and junction-test edits only rename or reformat unrelated code.

Rule 2255067: Bug fix changes must not include unrelated refactors or reformatting
pnpm/crates/package-manager/src/overrides.rs[512-518]
pnpm/crates/cmd-shim/src/link_bins/executable.rs[279-309]
pnpm/crates/executor/src/job_control.rs[54-166]
pnpm/crates/fs/src/symlink_dir/tests.rs[390-408]

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 optional-peer bug fix includes unrelated Rust renaming, import, documentation, literal-formatting, and test-structure cleanup across multiple modules.

## Fix Focus Areas
- pnpm/crates/cmd-shim/src/link_bins/executable.rs[279-309]
- pnpm/crates/executor/src/job_control.rs[54-166]
- pnpm/crates/config/src/defaults/tests.rs[386-424]
- pnpm/crates/fs/src/symlink_dir/tests.rs[390-408]

## Recommended Fix
Remove these behavior-neutral cleanup changes from this bug-fix PR and submit them separately. Retain only modifications needed to implement or test optional-peer metadata removal.

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



Informational

2. One changeset mixes release lines 📘 Rule violation § Compliance
Description
fix-optional-peer-removal.md places the TypeScript pnpm and Rust pacquet bumps in the same
front matter instead of version-specific changeset files. A maintainer changing or releasing one
implementation must disentangle its target from the other release line.
Code

.changeset/fix-optional-peer-removal.md[R2-4]

+"@pnpm/hooks.read-package-hook": patch
+"pnpm": patch
+"pacquet": patch
Relevance

● Weak

Recent reviews rejected splitting coordinated pnpm and pacquet changesets into separate files.

PR-#15183
PR-#15124

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713436 requires separate changesets when one PR modifies both the TypeScript v11 and
Rust v12 implementations. The new changeset lists pnpm, its TypeScript hook package, and pacquet
together.

Rule 713436: Changesets for pnpm v11 vs v12 (pacquet) must target the correct package and bump type
.changeset/fix-optional-peer-removal.md[1-7]

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 combines TypeScript pnpm v11 package bumps and the Rust pacquet v12 bump even though cross-stack changes require independently targeted changesets.

## Fix Focus Areas
- .changeset/fix-optional-peer-removal.md[1-7]

## Recommended Fix
Split this entry into two changeset files. Keep `@pnpm/hooks.read-package-hook` and `pnpm` with patch bumps in the v11 changeset, and put only `pacquet` in the v12 changeset, using accurate user-visible wording in each.

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


3. A new type member lacks its comma ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
overrideDeps adds peerDependenciesMeta as the final member of a multi-line parameter type
without a trailing comma. A later field addition must touch this line again, creating unnecessary
diff churn around the newly modified signature.
Code

pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts[234]

+    peerDependenciesMeta: PackageManifest['peerDependenciesMeta']
Relevance

● Weak

Recent reviews rejected trailing-comma findings for similar multi-line TypeScript signatures in this
directory.

PR-#14234
PR-#12876

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713434 requires trailing commas in multi-line TypeScript structures. The newly added
peerDependenciesMeta member is the last item in the multi-line inline object type and has no
comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts[229-234]

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 newly added final member of the multi-line options type lacks the required TypeScript trailing comma.

## Fix Focus Areas
- pnpm11/hooks/read-package-hook/src/createVersionsOverrider.ts[229-234]

## Recommended Fix
Add a comma after `PackageManifest['peerDependenciesMeta']` on the final member of the inline parameter type.

ⓘ 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/pnpm.io (sha: 36ba7496)
Review mode: ⚖️ Balanced: This changes dependency override behavior across TypeScript and Rust, affecting workspace resolution and lockfile outcomes, so it carries real correctness and compatibility risk despite added regressions.

Grey Divider

Tip of the day
💡 Did you know, you can route each action level your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

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.

@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the override behavior is consistently fixed in both implementations and covered at unit and workspace-integration levels.

Reviews (2) · Last reviewed commit: "style: add trailing comma and format tes..."

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 21, 2026
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 21, 2026
JoyceLeo326 and others added 3 commits September 23, 2026 00:21
Remove matching peer metadata with an explicit removal override so a
sibling workspace dependency cannot recreate the removed optional peer.
Apply the fix to both affected implementations and preserve cached
TypeScript manifests by cloning the metadata container before editing it.

Add unit and workspace regression coverage. Replace a private rustdoc
link with plain text so strict Windows documentation checks can run.

Closes pnpm#15008.
Address the existing diagnostics exposed by the required checks on
Windows. Keep the filesystem helpers, process cleanup and test behavior
unchanged while clarifying names, literals, imports and documentation.
Move a test-only import into its external test module and reduce the
junction test's closure nesting. Spawn all workers before joining them,
preserving its barrier synchronization and assertions.

Correct the new regressions' trailing commas and remove their temporary
debugging output. Keep these validation corrections separate from the
optional-peer removal implementation for review.
@zkochan
zkochan force-pushed the codex/fix-optional-peer-removal branch from c443628 to f79b4e5 Compare September 22, 2026 22:45
@greptile-apps
greptile-apps Bot dismissed their stale review September 22, 2026 22:45

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 f79b4e5

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan merged commit 7d7caba into pnpm:main Sep 22, 2026
57 checks passed
@welcome

welcome Bot commented Sep 22, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

u9g pushed a commit to u9g/pnpm that referenced this pull request Sep 25, 2026
Remove optional peer metadata when a removal override deletes the peer,
preventing a sibling workspace dependency from reintroducing it.

Fix both affected implementations, preserve cached TypeScript manifests,
and add unit and workspace regressions.

Repair violations exposed by required checks without relaxing them or
changing runtime behavior.

Closes pnpm#15008.

---------

Co-authored-by: JoyceLeo326 <[email protected]>
Co-authored-by: Zoltan Kochan <[email protected]>
zkochan added a commit that referenced this pull request Oct 7, 2026
…ly in peerDependenciesMeta (#16682)

The resolver treats a peerDependenciesMeta entry with optional: true
and no peerDependencies entry as an optional "*" peer. The versions
overrider only iterated peerDependencies, so a removal override never
reached such a peer and a sibling workspace project could still
satisfy it.

Both overriders now also match each peerDependenciesMeta name that
peerDependencies does not declare against the overrides as "*", and
drop the meta entry when the chosen override is "-". In pacquet the
apply_to_arc fast path checks the same entries, so the manifest is
cloned and rewritten.

The workspace regression tests from #15199 now also run
against @pnpm.e2e/abc-optional-peers-meta-only.

Fixes #16681

---------

Co-authored-by: Zoltan Kochan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[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.

Removal override ("parent>peer": "-") ignored for optional peers since 11.15.0

3 participants