Skip to content

fix(git-fetcher): detect a lockfile-less pnpm workspace as pnpm - #15660

Merged
zkochan merged 3 commits into
pnpm:mainfrom
xiechimon:fix/preferred-pm-workspace-manifest
Sep 25, 2026
Merged

zkochan merged 3 commits into
pnpm:mainfrom
xiechimon:fix/preferred-pm-workspace-manifest

Conversation

@xiechimon

@xiechimon xiechimon commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Related to #14011 — this is the detection half. Not Closes: the issue also tracks the v11 side and a suggested CLI override, neither of which this PR delivers (see "Out of scope" below).

detect_preferred_pm sniffed only lockfiles, so a git-hosted dependency that is a pnpm workspace with no committed lockfile fell through to the PreferredPm::Npm default. Committing a lockfile is optional in a pnpm workspace (lockfile: false), and pnpm-workspace.yaml is what declares the workspace, so that project is a pnpm project with nothing naming it as one.

prepare_package then ran the install stage with npm, which honours the dependency's own .npmrc ignore-scripts and skips the build — the dependency lands in the consumer's node_modules with no dist/.

The fix consults pnpm-workspace.yaml after every lockfile check, so it breaks only the no-lockfile tie. A dependency that ships a lockfile has named what installs it, and that is stronger evidence than a config file. This is the precedence preferred-pm uses — it consults the manifest in its fallback stage, after the same-directory lockfile checks (zkochan/packages#238) — which keeps v11 and v12 aligned rather than introducing a third ordering.

Out of scope, both flagged in the issue and neither a detection problem:

  • The v11 side reaches this through the external preferred-pm package, so it is fixed by zkochan/packages#238 landing and a dependency bump, not by a change in this repo. Calling it out per AGENTS.md, since a shared bug fix cannot be completed in both stacks in one PR here.
  • The suggested CLI flag to force an override is a new feature and needs design.

Squash Commit Body

fix(git-fetcher): detect a lockfile-less pnpm workspace as pnpm

A pnpm workspace is defined by pnpm-workspace.yaml, and committing a
lockfile is optional (lockfile: false). detect_preferred_pm only sniffed
pnpm-lock.yaml, so a git-hosted dependency that is a pnpm workspace with no
committed lockfile fell through to npm. prepare_package then ran the install
stage with npm, which honours the dependency's own .npmrc ignore-scripts and
skips the build, leaving no dist/.

Consult the manifest once every lockfile has had its say, so it breaks only
the no-lockfile tie: a dependency that ships a lockfile has named what
installs it, and that is stronger evidence than a config file. This is the
precedence preferred-pm uses, consulting the manifest in its fallback stage
(zkochan/packages#238), which keeps the two stacks aligned.

Refs pnpm/pnpm#14011 (the detection half; the v11 side lands via a
preferred-pm bump and the suggested CLI override needs its own design)

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.

Checklist notes: the v11 half of the "every affected version" item is the external preferred-pm bump described above, not a change in this tree.

How this was tested

Red-green on the three new cases in pnpm/crates/git-fetcher/src/preferred_pm/tests.rs. With preferred_pm.rs reverted to main and only the tests applied:

FAIL preferred_pm::tests::detects_pnpm_via_pnpm_workspace_yaml_when_it_ships_no_lockfile
FAIL preferred_pm::tests::a_lockfile_less_pnpm_workspace_wants_pnpm_with_no_version_pin
       left:  WantedPm { pm: Npm,  version_spec: None, pinned: false }
       right: WantedPm { pm: Pnpm, version_spec: None, pinned: false }
PASS preferred_pm::tests::a_shipped_lockfile_still_wins_over_pnpm_workspace_yaml

The third is a precedence guard, so it passes on both sides by design — it is there to fail if the manifest is ever promoted above a shipped lockfile. With the fix applied: preferred_pm 26/26, whole pnpm-git-fetcher crate 130/130, the git-dependency end-to-end suites (git_hosted_install::, cargo_git_install::, git_branch_lockfile::) 51/51, and pnpm test:rust-affected 23/23. cargo clippy --locked -p pnpm-git-fetcher --all-targets -- --deny warnings clean.

One thing worth recording, because it looks like an obvious e2e assertion and is not: I first wrote an end-to-end case asserting that the dependency's prepare script sees a pnpm/ npm_config_user_agent, then checked it against the reverted fix and it still passed. run_install_and_prepublish runs the detected package manager's install through pnpm's own lifecycle executor, so that environment variable names pnpm whichever way detection resolved, and the install-stage lockfile does not survive into the installed package either. The test could not distinguish the two outcomes, so I dropped it rather than leave a case that passes either way; the contract is pinned at detect_wanted_pm, which is the function prepare_package.rs:115 actually calls.


Written by an agent (Antigravity).

Summary by CodeRabbit

  • Bug Fixes
    • Git-hosted dependencies in pnpm workspaces are now detected as pnpm projects when no lockfile is present. If a supported npm or Yarn lockfile is available, it continues to take precedence over the workspace manifest. This helps ensure the package manager is selected correctly for workspaces that do not commit a lockfile.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

Warning

Review limit reached

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 708d9cbe-be14-4cbe-96e1-9ed00199919d

📥 Commits

Reviewing files that changed from the base of the PR and between fd20977 and ab8da43.

📒 Files selected for processing (1)
  • pnpm/crates/git-fetcher/src/preferred_pm.rs

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: b778ed63-f69a-4f60-b539-b66a4fac3500

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce6144 and fd20977.

📒 Files selected for processing (3)
  • .changeset/git-fetcher-detect-workspace-pnpm.md
  • pnpm/crates/git-fetcher/src/preferred_pm.rs
  • pnpm/crates/git-fetcher/src/preferred_pm/tests.rs

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


📝 Walkthrough

Walkthrough

The preferred package manager detector now selects pnpm from pnpm-workspace.yaml when no supported lockfile is present. Supported lockfiles take precedence. Tests cover fallback detection, lockfile precedence, and wanted package manager detection without a version pin.

Changes

Preferred Package Manager Detection

Layer / File(s) Summary
Workspace detection and validation
pnpm/crates/git-fetcher/src/preferred_pm.rs, pnpm/crates/git-fetcher/src/preferred_pm/tests.rs, .changeset/git-fetcher-detect-workspace-pnpm.md
The detector checks pnpm-workspace.yaml after supported lockfiles and keeps the existing npm fallback when neither signal is present. Tests cover the fallback, Yarn and npm lockfile precedence, and detect_wanted_pm selection without setting a version pin. The documentation and changeset describe workspace-manifest detection.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to fd209

This change selects pnpm for lockfile-less Git checkouts with a pnpm workspace manifest while preserving explicit pins and supported lockfile precedence. No actionable merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fd209

The change is limited to lockfile-less git-hosted workspaces, and existing build-permission checks remain in place. Previously cached packages may still retain the results of preparation with npm, so the fix may not take effect for every existing installation.

Retained concerns

  • Low · reliability · inferred: A previously cached npm-prepared snapshot can be reused for the same git package after workspace detection would select pnpm, delaying the corrected build behavior until that cache entry is replaced.
Security review details

Security Blast Radius

  • inferred — A git-hosted dependency’s workspace file can influence the install command used to prepare that dependency. The evidenced reach is package preparation and its stored output, not a new authentication or service boundary.

Trust Boundaries and Controls

  • observed — The existing ignore-scripts and build-permission gates precede manager selection, so the workspace file does not itself grant permission to run preparation scripts.

Hardening Proposals

  • proposed — Verify how both install commands apply dependency-local .npmrc script settings, and establish whether existing built-package cache entries need invalidation when manager detection changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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.

@codecov-commenter

codecov-commenter commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.92%. Comparing base (a509dc7) to head (ab8da43).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15660   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files        1456     1456           
  Lines      196657   196660    +3     
=======================================
+ Hits       180776   180784    +8     
+ Misses      15881    15876    -5     

☔ 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 25, 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 2279.94 ms 2370.33 ms 4.0% 114.00 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1345.49 ms 1364.56 ms 1.4% 67.27 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 255.28 ms 319.08 ms 25.0% 12.76 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pnpr 325.78 ms 354.31 ms 8.8% 16.29 ms Inconclusive (overlapping samples)
isolated-repeat-install-hot-cache-hot-store pacquet 9.59 ms 10.53 ms 9.7% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 8.93 ms 9.34 ms 4.6% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 13.53 ms 10.29 ms -23.9% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 12.42 ms 11.82 ms -4.9% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2503.31 ms 2512.38 ms 0.4% 125.17 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1508.37 ms 1435.05 ms -4.9% 75.42 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 418.48 ms 420.69 ms 0.5% 20.92 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 320.14 ms 278.97 ms -12.9% 16.01 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1710.00 ms 1722.84 ms 0.8% 85.50 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 306.87 ms 301.36 ms -1.8% 15.34 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 295.63 ms 318.41 ms 7.7% 14.78 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 103.47 ms 100.51 ms -2.9% 5.17 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 1432.89 ms 1385.28 ms -3.3% 71.64 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 201.57 ms 206.24 ms 2.3% 10.08 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4423.90 ms 4540.73 ms 2.6% 221.20 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3526.54 ms 3485.58 ms -1.2% 176.33 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 193.31 ms 171.98 ms -11.0% 9.67 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 252.11 ms 220.07 ms -12.7% 12.61 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: ab8da43ab0a1

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.432 ± 0.136 2.299 2.681 1.76 ± 0.15
pacquet@main 2.311 ± 0.089 2.236 2.486 1.67 ± 0.12
pnpr@HEAD 1.415 ± 0.136 1.289 1.646 1.02 ± 0.12
pnpr@main 1.382 ± 0.088 1.295 1.515 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.43174491976,
      "stddev": 0.1358512231870849,
      "median": 2.3703335911599996,
      "user": 1.80372138,
      "system": 1.67156236,
      "min": 2.29899963666,
      "max": 2.6811506126599998
    },
    {
      "command": "pacquet@main",
      "mean": 2.3109412977600003,
      "stddev": 0.08939517543325176,
      "median": 2.27994225366,
      "user": 1.4241445800000003,
      "system": 1.33507716,
      "min": 2.23567489066,
      "max": 2.48631753366
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4153693124600002,
      "stddev": 0.13603812803181312,
      "median": 1.3645591881599999,
      "user": 1.22864608,
      "system": 1.1255473599999999,
      "min": 1.2887981236600001,
      "max": 1.6461552646600002
    },
    {
      "command": "pnpr@main",
      "mean": 1.3822563329600002,
      "stddev": 0.08801584490981117,
      "median": 1.34548863316,
      "user": 1.26524978,
      "system": 1.1471492599999997,
      "min": 1.2954640696600002,
      "max": 1.51531052966
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 322.3 ± 22.2 295.9 366.9 1.21 ± 0.17
pacquet@main 266.8 ± 33.0 233.1 345.1 1.00
pnpr@HEAD 357.1 ± 70.5 275.0 501.5 1.34 ± 0.31
pnpr@main 332.7 ± 37.0 278.1 389.6 1.25 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.32229342528,
      "stddev": 0.022248214503231573,
      "median": 0.31908220598000003,
      "user": 0.33769368,
      "system": 0.71176788,
      "min": 0.29585581398000005,
      "max": 0.36694565798
    },
    {
      "command": "pacquet@main",
      "mean": 0.26683580838000004,
      "stddev": 0.03297547112922863,
      "median": 0.2552804469800001,
      "user": 0.28087018,
      "system": 0.6386628799999999,
      "min": 0.23307569698000002,
      "max": 0.34513819698000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.35714648338000005,
      "stddev": 0.0705009275365673,
      "median": 0.35430796548000004,
      "user": 0.3640047799999999,
      "system": 0.70967238,
      "min": 0.27496532098000004,
      "max": 0.5015190469799999
    },
    {
      "command": "pnpr@main",
      "mean": 0.33271058628000005,
      "stddev": 0.036963251221007604,
      "median": 0.32577608498,
      "user": 0.35395238000000007,
      "system": 0.6805905800000001,
      "min": 0.27807664498,
      "max": 0.38956626198000005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.7 ± 1.1 8.0 14.9 1.19 ± 0.17
pacquet@main 9.8 ± 1.0 8.0 13.6 1.08 ± 0.16
pnpr@HEAD 9.4 ± 0.9 7.7 12.1 1.04 ± 0.14
pnpr@main 9.0 ± 0.9 7.3 12.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010702595958181809,
      "stddev": 0.001052821857643883,
      "median": 0.01052842634,
      "user": 0.00574001636363636,
      "system": 0.005628683636363637,
      "min": 0.00799607484,
      "max": 0.01485792084
    },
    {
      "command": "pacquet@main",
      "mean": 0.009762958981843971,
      "stddev": 0.0010483520175515817,
      "median": 0.00959491484,
      "user": 0.005365449574468085,
      "system": 0.004993598581560284,
      "min": 0.00802100184,
      "max": 0.01358680584
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.00941620839244756,
      "stddev": 0.0008785680358189978,
      "median": 0.009341489840000002,
      "user": 0.005414215664335668,
      "system": 0.0045556524475524425,
      "min": 0.00767240684,
      "max": 0.012104604840000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.009016747843508765,
      "stddev": 0.0009140396867013888,
      "median": 0.00893173084,
      "user": 0.005438062877192978,
      "system": 0.00412466561403509,
      "min": 0.00733500384,
      "max": 0.01271663284
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 11.7 ± 3.7 7.7 26.9 1.00
pacquet@main 13.8 ± 2.8 10.1 24.5 1.18 ± 0.44
pnpr@HEAD 12.3 ± 2.1 9.4 22.2 1.05 ± 0.37
pnpr@main 12.9 ± 3.0 8.3 25.2 1.10 ± 0.43
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.011735518393388426,
      "stddev": 0.003707036452557739,
      "median": 0.010290171600000002,
      "user": 0.006125376363636362,
      "system": 0.00630142520661157,
      "min": 0.0077197796,
      "max": 0.0268917956
    },
    {
      "command": "pacquet@main",
      "mean": 0.013834099415950927,
      "stddev": 0.0027863285552854667,
      "median": 0.013528745600000001,
      "user": 0.00710000539877301,
      "system": 0.007579640122699385,
      "min": 0.0100672876,
      "max": 0.0245277756
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.012265718523857872,
      "stddev": 0.002060058217066006,
      "median": 0.011817476600000001,
      "user": 0.006472646091370557,
      "system": 0.0065279092385786795,
      "min": 0.009350179600000001,
      "max": 0.0221550386
    },
    {
      "command": "pnpr@main",
      "mean": 0.012942640698522166,
      "stddev": 0.0029667282433717855,
      "median": 0.012423724600000002,
      "user": 0.006600555270935959,
      "system": 0.0069927919211822676,
      "min": 0.0083161736,
      "max": 0.0252276346
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.576 ± 0.112 2.485 2.806 1.70 ± 0.15
pacquet@main 2.546 ± 0.094 2.467 2.702 1.68 ± 0.15
pnpr@HEAD 1.534 ± 0.188 1.370 1.923 1.01 ± 0.15
pnpr@main 1.518 ± 0.121 1.378 1.738 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.57582375094,
      "stddev": 0.11230019746960337,
      "median": 2.51238310764,
      "user": 2.03610546,
      "system": 1.59170172,
      "min": 2.48483387864,
      "max": 2.80607337164
    },
    {
      "command": "pacquet@main",
      "mean": 2.54648167334,
      "stddev": 0.09388440773482237,
      "median": 2.50330645014,
      "user": 2.0203571599999997,
      "system": 1.51757642,
      "min": 2.46722344164,
      "max": 2.70223116864
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5342655183400002,
      "stddev": 0.187687525779429,
      "median": 1.43504912464,
      "user": 1.14191376,
      "system": 1.1911183199999997,
      "min": 1.3701534366399999,
      "max": 1.92305966464
    },
    {
      "command": "pnpr@main",
      "mean": 1.51763497044,
      "stddev": 0.12090578429439534,
      "median": 1.5083722866399998,
      "user": 1.0222907599999997,
      "system": 1.1392210200000004,
      "min": 1.37771637564,
      "max": 1.73820895964
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 417.1 ± 22.4 379.6 452.7 1.51 ± 0.09
pacquet@main 419.3 ± 9.8 406.5 436.2 1.51 ± 0.06
pnpr@HEAD 277.0 ± 8.6 255.5 286.7 1.00
pnpr@main 338.8 ± 65.0 275.8 449.6 1.22 ± 0.24
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.4171440948000001,
      "stddev": 0.02241921166506251,
      "median": 0.4206866624000001,
      "user": 0.5992866199999998,
      "system": 0.6783826399999999,
      "min": 0.37962010490000003,
      "max": 0.45273539590000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.41929208529999995,
      "stddev": 0.009759821053876464,
      "median": 0.41848433240000005,
      "user": 0.6078438199999999,
      "system": 0.68538004,
      "min": 0.40648900590000003,
      "max": 0.43620366390000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2770082072,
      "stddev": 0.008642954199255237,
      "median": 0.27897358240000003,
      "user": 0.21977792,
      "system": 0.55932464,
      "min": 0.25545515490000004,
      "max": 0.2867114069
    },
    {
      "command": "pnpr@main",
      "mean": 0.33884827280000007,
      "stddev": 0.06497349812535003,
      "median": 0.32013964040000004,
      "user": 0.27512861999999993,
      "system": 0.66845064,
      "min": 0.2758127919,
      "max": 0.4495511729
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.715 ± 0.039 1.660 1.764 5.66 ± 0.20
pacquet@main 1.722 ± 0.039 1.669 1.783 5.68 ± 0.20
pnpr@HEAD 0.303 ± 0.008 0.292 0.322 1.00
pnpr@main 0.319 ± 0.050 0.263 0.400 1.05 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.71528281322,
      "stddev": 0.038824654671993024,
      "median": 1.72284478812,
      "user": 1.06027118,
      "system": 0.9910024399999999,
      "min": 1.6600648231200001,
      "max": 1.7638568411200002
    },
    {
      "command": "pacquet@main",
      "mean": 1.7222444124199998,
      "stddev": 0.03861743127312483,
      "median": 1.71000419212,
      "user": 1.08289698,
      "system": 0.9591218399999999,
      "min": 1.66946148212,
      "max": 1.7832986241200002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30320493772,
      "stddev": 0.00815120151369941,
      "median": 0.30136362062,
      "user": 0.24196368000000001,
      "system": 0.5901179400000001,
      "min": 0.29157125612,
      "max": 0.32198751812
    },
    {
      "command": "pnpr@main",
      "mean": 0.31900556412000003,
      "stddev": 0.05006050314463307,
      "median": 0.30687250162,
      "user": 0.27144828,
      "system": 0.61368484,
      "min": 0.26285422312,
      "max": 0.39963586512
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 325.5 ± 44.5 267.8 389.0 3.21 ± 0.45
pacquet@main 293.4 ± 29.8 239.4 325.2 2.90 ± 0.31
pnpr@HEAD 101.3 ± 3.5 95.9 110.0 1.00
pnpr@main 104.7 ± 4.7 95.9 113.4 1.03 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.32549274444000004,
      "stddev": 0.04446927787974893,
      "median": 0.31841130734,
      "user": 0.34750413999999996,
      "system": 0.11620705999999999,
      "min": 0.26778187584,
      "max": 0.38899084184000005
    },
    {
      "command": "pacquet@main",
      "mean": 0.29339152594000006,
      "stddev": 0.029786677851971324,
      "median": 0.29563307684,
      "user": 0.33538423999999994,
      "system": 0.09938416,
      "min": 0.23944115284,
      "max": 0.32524772684000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10130086469714285,
      "stddev": 0.0034834947370915685,
      "median": 0.10051089934,
      "user": 0.04429736142857142,
      "system": 0.017824767142857145,
      "min": 0.09593010784,
      "max": 0.11000640784
    },
    {
      "command": "pnpr@main",
      "mean": 0.10471149728444445,
      "stddev": 0.004693713336849344,
      "median": 0.10347136784000001,
      "user": 0.04593602148148147,
      "system": 0.02199132666666667,
      "min": 0.09589180884000001,
      "max": 0.11336477984
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.343 ± 0.235 0.916 1.648 1.00
pacquet@main 1.423 ± 0.287 0.868 1.772 1.06 ± 0.28
pnpm@HEAD 5.356 ± 0.994 3.882 6.749 3.99 ± 1.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.3428852491222223,
      "stddev": 0.2353541435933266,
      "median": 1.3852829999,
      "user": 1.3463408555555556,
      "system": 0.32265817333333335,
      "min": 0.9159168319,
      "max": 1.6479329619
    },
    {
      "command": "pacquet@main",
      "mean": 1.4234896511222221,
      "stddev": 0.2874740313271399,
      "median": 1.4328899729000002,
      "user": 1.4465012999999998,
      "system": 0.3413286177777778,
      "min": 0.8682819579,
      "max": 1.7719786029000002
    },
    {
      "command": "pnpm@HEAD",
      "mean": 5.356213517011111,
      "stddev": 0.9935158179217768,
      "median": 5.6820640749,
      "user": 8.134637744444444,
      "system": 0.4117939511111111,
      "min": 3.8822497839,
      "max": 6.7493999879
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 208.1 ± 6.1 198.8 218.1 1.02 ± 0.06
pacquet@main 204.4 ± 9.7 197.8 232.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20806988363714285,
      "stddev": 0.006064253782290965,
      "median": 0.20624090578,
      "user": 0.16668110571428568,
      "system": 0.08486744571428571,
      "min": 0.19880417178,
      "max": 0.21810559978000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.20439531036333333,
      "stddev": 0.009677609139413361,
      "median": 0.20157103828,
      "user": 0.16439357,
      "system": 0.07590816,
      "min": 0.19777003978000002,
      "max": 0.23290983978000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.568 ± 0.140 4.419 4.841 1.31 ± 0.05
pacquet@main 4.425 ± 0.056 4.367 4.553 1.26 ± 0.03
pnpr@HEAD 3.499 ± 0.062 3.432 3.619 1.00
pnpr@main 3.573 ± 0.117 3.427 3.753 1.02 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.56841077544,
      "stddev": 0.1396332632920831,
      "median": 4.54072882164,
      "user": 1.75708488,
      "system": 2.0205833599999994,
      "min": 4.41895801414,
      "max": 4.84087295814
    },
    {
      "command": "pacquet@main",
      "mean": 4.4254635350400005,
      "stddev": 0.05613603197071271,
      "median": 4.4239004066400005,
      "user": 1.6204458800000001,
      "system": 1.9819260599999997,
      "min": 4.36670650814,
      "max": 4.55253117814
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.4994527900399994,
      "stddev": 0.061593993098058616,
      "median": 3.48557750864,
      "user": 1.56043668,
      "system": 1.77978776,
      "min": 3.4322347951400003,
      "max": 3.61873649314
    },
    {
      "command": "pnpr@main",
      "mean": 3.5725080027400002,
      "stddev": 0.11739487442128113,
      "median": 3.5265361376400004,
      "user": 1.6335183800000004,
      "system": 1.8226194599999999,
      "min": 3.42702166314,
      "max": 3.7528178701400003
    }
  ]
}

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 175.1 ± 30.4 135.1 255.6 1.00
pacquet@main 201.6 ± 27.4 160.7 270.6 1.15 ± 0.25
pnpr@HEAD 225.2 ± 33.0 165.0 283.7 1.29 ± 0.29
pnpr@main 250.0 ± 23.5 220.3 282.4 1.43 ± 0.28
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17511255927333336,
      "stddev": 0.030416400900314788,
      "median": 0.17197553954,
      "user": 0.2172797133333333,
      "system": 0.17043719999999998,
      "min": 0.13511663154,
      "max": 0.25559173154000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.20156185838615387,
      "stddev": 0.02744375768441385,
      "median": 0.19330739154,
      "user": 0.23369902615384613,
      "system": 0.2101948153846154,
      "min": 0.16067244854,
      "max": 0.27060297654
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.22524190620666665,
      "stddev": 0.03302074400094648,
      "median": 0.22007121904,
      "user": 0.25810759666666666,
      "system": 0.18905161666666667,
      "min": 0.16503084754,
      "max": 0.28373113554
    },
    {
      "command": "pnpr@main",
      "mean": 0.25003834973999994,
      "stddev": 0.023511946329887252,
      "median": 0.25211067854,
      "user": 0.27429497999999997,
      "system": 0.19957019999999998,
      "min": 0.22027175154,
      "max": 0.28243544454
    }
  ]
}

@xiechimon
xiechimon marked this pull request as ready for review September 25, 2026 12:49
@xiechimon
xiechimon requested a review from zkochan as a code owner September 25, 2026 12:49
Copilot AI lite review requested due to automatic review settings September 25, 2026 12:49
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 25, 2026
xiechimon and others added 2 commits September 25, 2026 17:31
A pnpm workspace is defined by pnpm-workspace.yaml, and committing a
lockfile is optional (lockfile: false). detect_preferred_pm only sniffed
pnpm-lock.yaml, so a git-hosted dependency that is a pnpm workspace with no
committed lockfile fell through to npm. prepare_package then ran the install
stage with npm, which honours the dependency's own .npmrc ignore-scripts and
skips the build, leaving no dist/.

Consult the manifest once every lockfile has had its say, so it breaks only
the no-lockfile tie: a dependency that ships a lockfile has named what
installs it, and that is stronger evidence than a config file. This is the
precedence preferred-pm uses, consulting the manifest in its fallback stage
(zkochan/packages#238), which keeps the two stacks aligned.

Refs pnpm#14011
Copilot AI review requested due to automatic review settings September 25, 2026 15:36
@zkochan
zkochan force-pushed the fix/preferred-pm-workspace-manifest branch from 5ce6144 to fd20977 Compare September 25, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Version validation loses its rationale ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
pinned_version replaces its security-focused contract with a comment that merely repeats the
semver parse-and-return expression. When this unrelated cleanup lands with the workspace fix, future
edits to versions used during package preparation lose the trust-boundary context that explains why
URLs and tags are rejected.
Code

pnpm/crates/git-fetcher/src/preferred_pm.rs[127]

+/// Returns `version` if it parses as a semver range.
Relevance

●●● Strong

Recent git-fetcher history accepts removing redundant comments while preserving non-obvious
behavioral rationale.

PR-#14954
PR-#14160
PR-#13915

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new comment at line 127 directly restates the expression below it, violating the prohibition on
redundant comments. Its modification is also unrelated to detecting pnpm-workspace.yaml, so it
falls outside the bug fix's permitted scope.

Rule 713467: Avoid redundant comments that restate the code
Rule 2255067: Bug fix changes must not include unrelated refactors or reformatting
pnpm/crates/git-fetcher/src/preferred_pm.rs[127-130]

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 modified `pinned_version` comment only restates the implementation and removes relevant security rationale in a bug-fix PR.

## Fix Focus Areas
- pnpm/crates/git-fetcher/src/preferred_pm.rs[127-130]

## Recommended Fix
Restore a contract-focused comment explaining that versions are restricted to semver ranges because manifest input is untrusted and later influences package-manager preparation, or move unrelated documentation cleanup to a separate PR.

ⓘ 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
Review mode: 🚀 Fast: The push only changes documentation comments in one localized function, with no behavioral code change or meaningful security/performance risk.

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

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.

Copilot AI review requested due to automatic review settings September 25, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit ab8da43

@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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Rebased onto main, added changeset for pacquet patch release, cleaned doc comments adhering to AGENTS.md conventions, and all CI checks are passing.

@zkochan
zkochan merged commit a32900f into pnpm:main Sep 25, 2026
52 checks passed
zkochan added a commit that referenced this pull request Sep 27, 2026
#16301)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants