Skip to content

fix(prepare-package): prepare a lockfile-less pnpm workspace with pnpm - #16301

Merged
zkochan merged 2 commits into
mainfrom
fix-14011
Sep 27, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-14011

Conversation

@zkochan

@zkochan zkochan commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Bumps preferred-pm to 5.0.1 (zkochan/packages#238), which detects pnpm by pnpm-workspace.yaml when the package directory has no lockfile. @pnpm/exec.prepare-package uses it to pick the package manager that prepares a git-hosted dependency, so a pnpm workspace without a committed lockfile was prepared with npm. npm then honoured the dependency's .npmrc (for example ignore-scripts) and could skip the build.

This is the v11 half of the issue. The v12 half landed in #15660, and both now use the same order: a lockfile in the package directory wins, and pnpm-workspace.yaml breaks the no-lockfile tie. The CLI override flag the issue also floats is a new feature and is not part of this PR.

The regression test asserts which lockfile the prepare step leaves behind. preferred-pm searches parent directories for pnpm-lock.yaml, so the test only fails without the fix when no ancestor of the test directory holds one, which is the case in CI. I confirmed the unfixed behaviour (npm, package-lock.json) and the fixed one (pnpm, pnpm-lock.yaml) in a directory under /var/tmp.

Closes #14011

Squash Commit Body

preferred-pm recognized pnpm only by a pnpm-lock.yaml, so a git-hosted
dependency that is a pnpm workspace without a committed lockfile fell
back to npm. npm then honoured the dependency's own .npmrc settings,
such as ignore-scripts, and could skip the build.

preferred-pm 5.0.1 also looks for pnpm-workspace.yaml once no lockfile
in the package directory names a package manager. That matches the
order the v12 git fetcher uses since pnpm/pnpm#15660, where a lockfile
still wins over the workspace file.

The test asserts which lockfile the prepare step leaves behind. It only
fails without the fix when no ancestor of the test directory holds a
pnpm-lock.yaml, because preferred-pm searches parent directories for
one.

Closes pnpm/pnpm#14011

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.

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

🤖 Generated with Claude Code


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
    • Preparing a Git-hosted pnpm workspace dependency without a committed lockfile now uses pnpm and creates a pnpm-lock.yaml instead of an npm package-lock.json. This ensures the dependency’s build is not skipped during preparation and avoids adding an npm lockfile to the workspace. The workspace’s preferred package manager version has also been updated.

preferred-pm recognized pnpm only by a pnpm-lock.yaml, so a git-hosted
dependency that is a pnpm workspace without a committed lockfile fell
back to npm. npm then honoured the dependency's own .npmrc settings,
such as ignore-scripts, and could skip the build.

preferred-pm 5.0.1 also looks for pnpm-workspace.yaml once no lockfile
in the package directory names a package manager. That matches the
order the v12 git fetcher uses since #15660, where a lockfile
still wins over the workspace file.

The test asserts which lockfile the prepare step leaves behind. It only
fails without the fix when no ancestor of the test directory holds a
pnpm-lock.yaml, because preferred-pm searches parent directories for
one.

Closes #14011

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

coderabbitai Bot commented Sep 27, 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: 4187b426-f12e-4a72-a828-b5d89489dad9

📥 Commits

Reviewing files that changed from the base of the PR and between 3a71a64 and 6126ef7.

📒 Files selected for processing (1)
  • .changeset/prepare-lockfile-less-pnpm-workspace.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/prepare-lockfile-less-pnpm-workspace.md

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


📝 Walkthrough

Walkthrough

The preferred-pm catalog version changes from ^5.0.0 to ^5.0.1. A test covers preparing a workspace without a lockfile, and patch changeset entries are added for @pnpm/exec.prepare-package and pnpm.

Changes

Workspace package manager selection

Layer / File(s) Summary
Update preferred-pm and verify workspace preparation
pnpm-workspace.yaml, pnpm11/exec/prepare-package/test/index.ts, .changeset/prepare-lockfile-less-pnpm-workspace.md
The preferred-pm catalog requirement changes to ^5.0.1. A test checks that preparation creates pnpm-lock.yaml and does not create package-lock.json. Patch changeset entries are added for @pnpm/exec.prepare-package and pnpm.

Priority: ➖ Normal

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

Change: Bug fix

Assessment against linked issues

Objective Addressed Explanation
Use pnpm when a repository has pnpm-workspace.yaml but no pnpm-lock.yaml while preparing a Git dependency [#14011] ✅

Suggested labels: product: pnpm@11

Merge Risk: ⚪ Minimal · up to 6126e

The change is mergeable after normal checks. The added test targets the reported workspace preparation behavior, and no actionable issue remains.

Architecture Summary

Architecture risk: 🔵 Low · up to 3a71a

The change affects 2 systems.

Changed systems: pnpm-workspace.yaml, pnpm11

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — pnpm-workspace.yaml (service) was modified; 1 changed file maps to changed impact.
  • observed — pnpm11 (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in pnpm-workspace.yaml: The catalog requirement for preferred-pm changed from ^5.0.0 to ^5.0.1.
  • observed — Modified behavior in pnpm11/exec/prepare-package/test/index.ts: Adds coverage for preparing a lockfile-free workspace with pnpm and checking that the resulting directory contains pnpm-lock.yaml but not package-lock.json.
  • observed — Modified behavior in .changeset/prepare-lockfile-less-pnpm-workspace.md: Adds patch release entries for @pnpm/exec.prepare-package and pnpm, with a description of the lockfile-less pnpm workspace dependency change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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.

@zkochan
zkochan marked this pull request as ready for review September 27, 2026 22:11
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Prepare lockfile-less pnpm workspaces with pnpm in v11

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Upgrade preferred-pm so git-hosted pnpm workspaces without lockfiles are prepared with pnpm, not
 npm.
• Add a regression test that checks which lockfile the preparation step creates.
• Add patch release notes for pnpm and @pnpm/exec.prepare-package.
Diagram

graph TD
  A["Git checkout"] --> B["Prepare package"] --> C["preferred-pm 5.0.1"] --> D{"Lockfile found?"} -->|Yes| E["Matching install"]
  D -->|No| F{"Workspace file?"} -->|Yes| G["pnpm install"]
  F -->|No| H["npm fallback"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Detect workspace files in preparePackage
  • ➕ Avoids relying on a new preferred-pm release for this case.
  • ➖ Duplicates package-manager selection logic and its precedence rules.
  • ➖ Could diverge from other preferred-pm consumers.

Recommendation: Keep the dependency upgrade. It fixes detection at the existing selection point without adding a second policy in preparePackage; the regression test covers the resulting install choice.

Files changed (4) +27 / -7

Tests (1) +14 / -0
index.tsTest preparation without a committed lockfile +14/-0

Test preparation without a committed lockfile

• Adds a temporary pnpm workspace with a prepare script but no lockfile. After preparation, the test requires pnpm-lock.yaml and rejects package-lock.json to verify the selected installer.

pnpm11/exec/prepare-package/test/index.ts

Documentation (1) +6 / -0
prepare-lockfile-less-pnpm-workspace.mdDocument the workspace preparation fix +6/-0

Document the workspace preparation fix

• Adds patch changesets for @pnpm/exec.prepare-package and pnpm. The release note explains that lockfile-less git-hosted pnpm workspaces are now prepared with pnpm.

.changeset/prepare-lockfile-less-pnpm-workspace.md

Other (2) +7 / -7
pnpm-lock.yamlResolve preferred-pm 5.0.1 +6/-6

Resolve preferred-pm 5.0.1

• Updates the catalog resolution, prepare-package importer, package integrity, and snapshot from preferred-pm 5.0.0 to 5.0.1.

pnpm-lock.yaml

pnpm-workspace.yamlBump the preferred-pm catalog requirement +1/-1

Bump the preferred-pm catalog requirement

• Raises the workspace catalog range to ^5.0.1 so prepare-package receives workspace-aware package-manager detection.

pnpm-workspace.yaml

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 27, 2026
@github-actions

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 2399.16 ms 2320.87 ms -3.3% 119.96 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1405.75 ms 1426.51 ms 1.5% 70.29 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 261.99 ms 260.77 ms -0.5% 13.10 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 295.95 ms 258.83 ms -12.5% 14.80 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 10.29 ms 10.47 ms 1.7% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.48 ms 10.27 ms -1.9% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.90 ms 9.26 ms 4.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 9.02 ms 7.60 ms -15.7% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2533.36 ms 2593.91 ms 2.4% 126.67 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1590.83 ms 1553.06 ms -2.4% 79.54 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 471.10 ms 472.46 ms 0.3% 23.55 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 298.93 ms 291.73 ms -2.4% 14.95 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1639.96 ms 1608.51 ms -1.9% 82.00 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 278.22 ms 281.56 ms 1.2% 13.91 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 321.06 ms 237.35 ms -26.1% 16.05 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 103.78 ms 114.89 ms 10.7% 5.19 ms Inconclusive (overlapping samples)
isolated-peer-heavy-resolve-hot-cache-offline pacquet 1252.17 ms 1204.62 ms -3.8% 62.61 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 196.35 ms 199.88 ms 1.8% 9.82 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4515.60 ms 4549.14 ms 0.7% 225.78 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3541.15 ms 3532.89 ms -0.2% 177.06 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 122.28 ms 121.40 ms -0.7% 6.11 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 153.37 ms 136.21 ms -11.2% 7.67 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 3a71a649bb25

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.389 ± 0.161 2.275 2.741 1.68 ± 0.15
pacquet@main 2.410 ± 0.129 2.261 2.581 1.70 ± 0.13
pnpr@HEAD 1.452 ± 0.123 1.298 1.667 1.02 ± 0.10
pnpr@main 1.421 ± 0.082 1.305 1.587 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.3888323523599997,
      "stddev": 0.16136487123354443,
      "median": 2.32086506316,
      "user": 1.5034650600000001,
      "system": 1.5380710199999998,
      "min": 2.2749504316599998,
      "max": 2.74110381766
    },
    {
      "command": "pacquet@main",
      "mean": 2.41013395256,
      "stddev": 0.12875999852607037,
      "median": 2.39915635366,
      "user": 1.44000216,
      "system": 1.4210045199999999,
      "min": 2.2605380026599997,
      "max": 2.5811306096599997
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4519922513599999,
      "stddev": 0.12278990808443561,
      "median": 1.42650785866,
      "user": 1.3924083600000001,
      "system": 1.38226512,
      "min": 1.2975095216599999,
      "max": 1.66725035866
    },
    {
      "command": "pnpr@main",
      "mean": 1.42106685336,
      "stddev": 0.08243045543202458,
      "median": 1.40574570466,
      "user": 1.37311136,
      "system": 1.4157351200000001,
      "min": 1.3046304546599998,
      "max": 1.5871707876599999
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 273.7 ± 46.1 235.5 393.4 1.05 ± 0.19
pacquet@main 259.4 ± 13.7 236.5 281.7 1.00
pnpr@HEAD 261.4 ± 21.6 239.3 311.1 1.01 ± 0.10
pnpr@main 291.3 ± 19.6 260.2 321.4 1.12 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.27365718992,
      "stddev": 0.046148561786443006,
      "median": 0.26077392212000006,
      "user": 0.29549566,
      "system": 0.634702,
      "min": 0.23553727712,
      "max": 0.39336483712000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.25943226752000004,
      "stddev": 0.0136800863944649,
      "median": 0.26199354362000005,
      "user": 0.28981236000000005,
      "system": 0.5917378,
      "min": 0.23647268012,
      "max": 0.28165160312000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26137693062000006,
      "stddev": 0.021595612357155222,
      "median": 0.25882990062,
      "user": 0.26792485999999993,
      "system": 0.5760691999999998,
      "min": 0.23931190512,
      "max": 0.31113778212000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.29128700422000003,
      "stddev": 0.019550661133043244,
      "median": 0.29594512962,
      "user": 0.31245016000000003,
      "system": 0.6254181000000001,
      "min": 0.26022295312000004,
      "max": 0.32138395912
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.5 ± 0.8 8.9 14.3 1.02 ± 0.11
pacquet@main 10.3 ± 0.7 8.3 12.7 1.00
pnpr@HEAD 10.4 ± 1.0 8.3 13.5 1.01 ± 0.12
pnpr@main 10.5 ± 0.9 8.3 13.7 1.02 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010543715723649634,
      "stddev": 0.000796424602110384,
      "median": 0.01047186622,
      "user": 0.00606887591240876,
      "system": 0.005140745693430657,
      "min": 0.00890033522,
      "max": 0.01434080022
    },
    {
      "command": "pacquet@main",
      "mean": 0.010320031882790699,
      "stddev": 0.0007220810899068019,
      "median": 0.01029246172,
      "user": 0.005803732558139539,
      "system": 0.005207476124031006,
      "min": 0.00829637722,
      "max": 0.01266679522
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.010438123672380955,
      "stddev": 0.001027204212906888,
      "median": 0.01027237622,
      "user": 0.005952341269841274,
      "system": 0.00514612238095238,
      "min": 0.00828555722,
      "max": 0.01352854222
    },
    {
      "command": "pnpr@main",
      "mean": 0.010507101209436613,
      "stddev": 0.0008863273032765655,
      "median": 0.010476486220000001,
      "user": 0.005639489436619718,
      "system": 0.005557175633802816,
      "min": 0.00830689722,
      "max": 0.013711328220000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.3 ± 0.7 8.0 12.4 1.20 ± 0.16
pacquet@main 8.5 ± 0.8 6.8 10.6 1.10 ± 0.16
pnpr@HEAD 7.7 ± 0.9 6.9 15.3 1.00
pnpr@main 8.7 ± 1.2 7.0 12.8 1.12 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009320884073264252,
      "stddev": 0.0006502786741780098,
      "median": 0.00925562398,
      "user": 0.005204776476683938,
      "system": 0.004562004663212436,
      "min": 0.00800370498,
      "max": 0.01238853298
    },
    {
      "command": "pacquet@main",
      "mean": 0.008509757864169881,
      "stddev": 0.0008310747043198278,
      "median": 0.00889932498,
      "user": 0.004845606872586873,
      "system": 0.004097254054054056,
      "min": 0.00680277098,
      "max": 0.010614192980000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.00774463865741936,
      "stddev": 0.0008512141023351237,
      "median": 0.00760195998,
      "user": 0.00424980136200717,
      "system": 0.0038906928315412164,
      "min": 0.0068997929800000005,
      "max": 0.01529361398
    },
    {
      "command": "pnpr@main",
      "mean": 0.008692333281324504,
      "stddev": 0.0011952133903893592,
      "median": 0.00901778198,
      "user": 0.004915920662251658,
      "system": 0.004202332450331127,
      "min": 0.00700909798,
      "max": 0.01282335998
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.597 ± 0.079 2.492 2.767 1.68 ± 0.15
pacquet@main 2.546 ± 0.045 2.502 2.655 1.64 ± 0.14
pnpr@HEAD 1.548 ± 0.132 1.387 1.774 1.00
pnpr@main 1.581 ± 0.116 1.435 1.728 1.02 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.59701482858,
      "stddev": 0.07856670317588471,
      "median": 2.59391444518,
      "user": 2.0815095799999996,
      "system": 1.68588938,
      "min": 2.49218134518,
      "max": 2.76681249018
    },
    {
      "command": "pacquet@main",
      "mean": 2.54646056168,
      "stddev": 0.04482207163375799,
      "median": 2.5333605526799996,
      "user": 1.98340608,
      "system": 1.59030298,
      "min": 2.50248203618,
      "max": 2.65514993018
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5481657084800002,
      "stddev": 0.1322840268101539,
      "median": 1.55305835768,
      "user": 1.21834098,
      "system": 1.20493138,
      "min": 1.3865803211799999,
      "max": 1.77359891218
    },
    {
      "command": "pnpr@main",
      "mean": 1.5809364587800003,
      "stddev": 0.115926840854694,
      "median": 1.59082874218,
      "user": 1.2760149799999998,
      "system": 1.36389758,
      "min": 1.43541555118,
      "max": 1.7279070701800001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 472.7 ± 48.6 415.9 585.0 1.61 ± 0.18
pacquet@main 470.4 ± 23.1 430.6 511.2 1.61 ± 0.10
pnpr@HEAD 292.9 ± 12.0 268.1 309.9 1.00
pnpr@main 306.3 ± 41.5 279.2 421.1 1.05 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.47273917157999995,
      "stddev": 0.048579645029290554,
      "median": 0.47246093078000007,
      "user": 0.6455944,
      "system": 0.7877371,
      "min": 0.41586285978000004,
      "max": 0.58496930678
    },
    {
      "command": "pacquet@main",
      "mean": 0.4703741173800001,
      "stddev": 0.02307422397446442,
      "median": 0.47109634028,
      "user": 0.6453235,
      "system": 0.7538658,
      "min": 0.43060515578,
      "max": 0.5112314587800001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29291382308,
      "stddev": 0.012007983863072199,
      "median": 0.29173061678,
      "user": 0.25536250000000005,
      "system": 0.554059,
      "min": 0.26811305578,
      "max": 0.30989356778
    },
    {
      "command": "pnpr@main",
      "mean": 0.30632276108,
      "stddev": 0.04153262407766556,
      "median": 0.29892787377999996,
      "user": 0.259742,
      "system": 0.5941588,
      "min": 0.27918502278,
      "max": 0.42112618578
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.608 ± 0.026 1.579 1.648 5.74 ± 0.18
pacquet@main 1.640 ± 0.021 1.601 1.670 5.85 ± 0.17
pnpr@HEAD 0.280 ± 0.007 0.263 0.290 1.00
pnpr@main 0.282 ± 0.009 0.271 0.299 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.6083598890600002,
      "stddev": 0.025757115573151187,
      "median": 1.60851182756,
      "user": 0.83262754,
      "system": 0.79730014,
      "min": 1.57884625106,
      "max": 1.6483957580600002
    },
    {
      "command": "pacquet@main",
      "mean": 1.6397979152600002,
      "stddev": 0.02144230917733124,
      "median": 1.6399610250600003,
      "user": 0.88043294,
      "system": 0.8467412400000001,
      "min": 1.6014090440600002,
      "max": 1.6702910380600002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28024217875999996,
      "stddev": 0.007352043302090597,
      "median": 0.28156038555999996,
      "user": 0.23580404000000002,
      "system": 0.54190044,
      "min": 0.26317293206,
      "max": 0.28988361006
    },
    {
      "command": "pnpr@main",
      "mean": 0.28184166586000003,
      "stddev": 0.009384128682094782,
      "median": 0.27821799806,
      "user": 0.22970323999999995,
      "system": 0.56167974,
      "min": 0.27130121506,
      "max": 0.29895979206
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 237.7 ± 14.6 219.6 267.8 2.22 ± 0.21
pacquet@main 301.9 ± 52.1 226.6 367.3 2.82 ± 0.53
pnpr@HEAD 115.7 ± 5.6 106.0 128.8 1.08 ± 0.10
pnpr@main 106.9 ± 7.9 99.3 126.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23771143443384618,
      "stddev": 0.014560955859583648,
      "median": 0.23734913128000001,
      "user": 0.2147645953846154,
      "system": 0.11088424615384615,
      "min": 0.21960517928000003,
      "max": 0.26781695828
    },
    {
      "command": "pacquet@main",
      "mean": 0.30186129678000007,
      "stddev": 0.052097829015316656,
      "median": 0.32105672128000007,
      "user": 0.2794573133333333,
      "system": 0.14572715,
      "min": 0.22663709028000004,
      "max": 0.36732318028000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11565503353000002,
      "stddev": 0.005585087451431961,
      "median": 0.11489066828,
      "user": 0.05128181333333332,
      "system": 0.02622656666666666,
      "min": 0.10601657228,
      "max": 0.12875059328000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.10687062284521741,
      "stddev": 0.007887391397949212,
      "median": 0.10378326428,
      "user": 0.04584515391304347,
      "system": 0.021953921739130428,
      "min": 0.09927620928,
      "max": 0.12692395228000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.220 ± 0.085 1.091 1.355 1.00
pacquet@main 1.222 ± 0.162 0.829 1.349 1.00 ± 0.15
pnpm@HEAD 3.111 ± 0.103 2.959 3.292 2.55 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.2200318058244444,
      "stddev": 0.08495982664972629,
      "median": 1.20461928638,
      "user": 1.2729262777777777,
      "system": 0.4592010266666667,
      "min": 1.09067188038,
      "max": 1.35530743838
    },
    {
      "command": "pacquet@main",
      "mean": 1.2216999980466667,
      "stddev": 0.16234031542039035,
      "median": 1.25217464238,
      "user": 1.2775739444444443,
      "system": 0.4689975822222222,
      "min": 0.82932643338,
      "max": 1.3490307473799998
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.1105743506022225,
      "stddev": 0.10266766395666684,
      "median": 3.1188959353800003,
      "user": 4.4713365,
      "system": 0.30957547111111117,
      "min": 2.9594272693800003,
      "max": 3.29242119938
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 200.2 ± 3.9 194.3 207.0 1.01 ± 0.06
pacquet@main 198.2 ± 10.9 185.2 219.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20020369001428576,
      "stddev": 0.003933311260982402,
      "median": 0.19987932630000002,
      "user": 0.15521372857142857,
      "system": 0.08182716,
      "min": 0.19429034330000003,
      "max": 0.20700368230000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.19821421730000002,
      "stddev": 0.010941207956605936,
      "median": 0.1963508338,
      "user": 0.15794544285714282,
      "system": 0.0735629457142857,
      "min": 0.18518259730000003,
      "max": 0.21913025030000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.544 ± 0.105 4.413 4.761 1.28 ± 0.04
pacquet@main 4.562 ± 0.153 4.413 4.821 1.29 ± 0.05
pnpr@HEAD 3.560 ± 0.097 3.462 3.732 1.00 ± 0.04
pnpr@main 3.543 ± 0.092 3.441 3.703 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.544101080820001,
      "stddev": 0.10470168247677655,
      "median": 4.54914157162,
      "user": 2.2904493599999998,
      "system": 2.1575342399999995,
      "min": 4.41338591762,
      "max": 4.76084319162
    },
    {
      "command": "pacquet@main",
      "mean": 4.56233601302,
      "stddev": 0.15336471369950283,
      "median": 4.51559553812,
      "user": 2.10534856,
      "system": 2.0055014399999997,
      "min": 4.41333303762,
      "max": 4.82142948562
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5595590183199994,
      "stddev": 0.09729297473680279,
      "median": 3.5328907316200002,
      "user": 1.87395116,
      "system": 1.73234164,
      "min": 3.4623134516199996,
      "max": 3.7322713516199997
    },
    {
      "command": "pnpr@main",
      "mean": 3.5430265399199996,
      "stddev": 0.09225052170252551,
      "median": 3.54115062312,
      "user": 1.8829549599999997,
      "system": 1.79498604,
      "min": 3.44095171762,
      "max": 3.70326435962
    }
  ]
}

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 123.5 ± 8.4 110.8 141.6 1.00
pacquet@main 124.2 ± 7.2 114.1 140.0 1.01 ± 0.09
pnpr@HEAD 141.9 ± 16.9 127.6 183.0 1.15 ± 0.16
pnpr@main 160.3 ± 17.5 139.8 197.5 1.30 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.12353330929904761,
      "stddev": 0.008363176622548209,
      "median": 0.12140236768,
      "user": 0.14568431904761903,
      "system": 0.13579239619047614,
      "min": 0.11083930668,
      "max": 0.14158954968
    },
    {
      "command": "pacquet@main",
      "mean": 0.12424438536421052,
      "stddev": 0.007192265209387241,
      "median": 0.12228156768000001,
      "user": 0.1608034894736842,
      "system": 0.12813565684210526,
      "min": 0.11413893868000001,
      "max": 0.14002792868
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1418987062589474,
      "stddev": 0.01693722613899213,
      "median": 0.13621166768,
      "user": 0.16550033157894736,
      "system": 0.13840007789473682,
      "min": 0.12759028068,
      "max": 0.18300541568
    },
    {
      "command": "pnpr@main",
      "mean": 0.16029301744470587,
      "stddev": 0.017537807775331593,
      "median": 0.15336842268,
      "user": 0.18907111176470587,
      "system": 0.14452921411764702,
      "min": 0.13983260268,
      "max": 0.19745697468
    }
  ]
}

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Sibling packages run unapproved scripts ✗ Dismissed 🐞 Bug ⛨ Security
Description
preparePackage approves only the requested git artifact, but its selected pnpm install
recursively installs every project in the fetched workspace and runs their lifecycle scripts without
checking that approval. In a lockfile-less workspace with an unrelated sibling, the sibling’s
dependencies are installed and its postinstall can run even though it was not approved, before the
temporary installation is removed.
Code

pnpm-workspace.yaml[424]

+  preferred-pm: ^5.0.1
Relevance

●● Moderate

Potential lifecycle-script escape is substantive, but no close historical precedent confirms this
workspace-recursion concern.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new detection selects pnpm for the workspace, and preparePackage checks permission only for
the requested artifact before running the selected package manager’s install from the fetched
checkout. Pnpm installs workspace projects recursively by default, while the lifecycle runner
invokes selected projects’ scripts; preparation then removes the resulting node_modules.

pnpm-workspace.yaml[424-424]
pnpm11/exec/prepare-package/src/index.ts[40-65]
pnpm11/installing/commands/src/install.ts[106-118]
pnpm11/pnpm/src/main.ts[275-287]
pnpm11/exec/lifecycle/src/runLifecycleHooksConcurrently.ts[79-122]
pnpm11/exec/prepare-package/src/index.ts[47-74]
pnpm11/pnpm/src/main.ts[275-326]
pnpm11/fetching/git-fetcher/src/index.ts[62-72]

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

## Issue description
Selecting pnpm for a lockfile-less git workspace makes preparation install unrelated workspace projects and run their lifecycle scripts outside the requested artifact’s build approval.

## Fix Focus Areas
- pnpm-workspace.yaml[424-424]
- pnpm11/exec/prepare-package/src/index.ts[40-74]
- pnpm11/exec/lifecycle/src/runLifecycleHooksConcurrently.ts[79-122]
- pnpm11/pnpm/src/main.ts[275-326]

## Recommended Fix
Scope the child pnpm install to the requested project and the workspace dependencies needed to prepare it, rather than recursively selecting the entire workspace. Skip scripts for any additional workspace project or require explicit build approval for them, while retaining the requested package’s prepare behavior.

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



Remediation recommended

2. Subpackage lockfiles lose precedence 🐞 Bug ≡ Correctness
Description
preparePackage detects the package manager at gitRootDir rather than at pkgDir, so the new
workspace-marker detection can select pnpm ahead of a lockfile in the requested subdirectory. When a
git dependency targets a subdirectory with package-lock.json or yarn.lock beneath a
lockfile-less pnpm workspace root, preparation runs pnpm instead of the manager named by that
subdirectory’s lockfile.
Code

pnpm-workspace.yaml[424]

+  preferred-pm: ^5.0.1
Relevance

●● Moderate

Lockfile precedence is central to the stated fix, but historical evidence does not verify this
subdirectory edge case.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The git fetcher passes the requested resolution.path to preparation. Preparation reads that
subdirectory's manifest and runs the install there, but detects the manager from the repository
root; the added test establishes that a root workspace marker now selects pnpm without a root
lockfile.

pnpm-workspace.yaml[424-424]
pnpm11/fetching/git-fetcher/src/index.ts[62-68]
pnpm11/exec/prepare-package/src/index.ts[35-59]
pnpm11/exec/prepare-package/test/index.ts[85-97]

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

## Issue description
New workspace-marker detection at the git root takes precedence over an npm or Yarn lockfile in a git dependency's selected subdirectory.
## Fix Focus Areas
- pnpm-workspace.yaml[424-424]
- pnpm11/exec/prepare-package/src/index.ts[35-59]
- pnpm11/fetching/git-fetcher/src/index.ts[62-68]
## Recommended Fix
Detect a lockfile in the selected package directory before falling back to workspace detection at the git root. Add a git-subdirectory regression test covering a root workspace marker and a subdirectory npm or Yarn lockfile.

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


3. Workspace release note uses passive voice ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The changeset says the dependency is now prepared with pnpm instead of making pnpm the subject of
the sentence. Because the fix changes which tool prepares the dependency, the opening sentence makes
readers wait until its final phrase to identify that tool.
Code

.changeset/prepare-lockfile-less-pnpm-workspace.md[6]

+A git-hosted dependency that is a pnpm workspace without a committed lockfile is now prepared with pnpm. It was installed with npm before, which could skip its build [#14011](https://github.com/pnpm/pnpm/issues/14011).
Relevance

●● Moderate

Active-voice changeset edits are accepted, but recent similar active-voice requests were also
rejected.

PR-#15148
PR-#16280

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule calls for an active sentence with an explicit subject when the tool matters. The new
changeset sentence uses is now prepared with pnpm for a fix whose purpose is to select pnpm rather
than npm.

Rule 3058332: Use plain, direct, and quantifiable language in changeset entries
.changeset/prepare-lockfile-less-pnpm-workspace.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 describes the changed preparation behavior in passive voice, although the preparing tool is central to the fix.

## Fix Focus Areas
- .changeset/prepare-lockfile-less-pnpm-workspace.md[6-6]

## Recommended Fix
Rewrite the first sentence with pnpm as the subject, while keeping the previous npm behavior in its separate past-tense sentence.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 52 rules
✅ Skills: review-code
Review mode: ⏭️ Skipped: The latest push only revises wording in a changeset markdown release note and cannot affect runtime behavior.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread pnpm-workspace.yaml Resolved
@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 27, 2026

Copy link
Copy Markdown
Member Author

Replies to the other two findings from the Qodo review:

  • Workspace release note uses passive voice. Fixed in 6126ef7. pnpm is now the subject, and the old npm behavior stays in its own past-tense sentence.
  • Subpackage lockfiles lose precedence. Not acting on this. pnpm v12 also detects the package manager at the git root (detect_wanted_pm(git_root_dir, …) in pnpm/crates/git-fetcher/src/prepare_package.rs), so detecting at the requested subdirectory would make v11 disagree with v12. The repository root decides the repository's tooling. A root pnpm-lock.yaml already outranks a subdirectory's package-lock.json today.

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6126ef7

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preferred package manager should be pnpm when pnpm-workspace.yaml exists

2 participants