Skip to content

fix(cli): resolve the pinned pnpm through the registry and proxy flags - #16919

Merged
zkochan merged 1 commit into
mainfrom
fix-16911
Oct 14, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-16911

Conversation

@zkochan

@zkochan zkochan commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Related to #16911.

The report: on a network that blocks registry.npmjs.org, pnpm install --registry=<azure feed> fails with ERR_PNPM_BAD_CONFIG_DEP: Failed to fetch metadata from https://registry.npmjs.org/pnpm, even when the running pnpm is the version packageManager pins.

In that case the pre-command pass still resolves the pin, to record its integrity in pnpm-lock.yaml. It uses the package-manager bootstrap registry. By design, that registry reads only trusted sources and ignores the project .npmrc and pnpm-workspace.yaml. But the pass loads its own config and applied only --config.* overrides. It skipped the global CliNetworkArgs flags (--registry, --https-proxy, --http-proxy, --no-proxy), which only the main dispatch applies.

Reproduced with a dead registry URL on 12.13.0 and a fresh HOME:

source pin lookup goes to
--config.registry= the given registry
PNPM_CONFIG_REGISTRY the given registry
registry= in ~/.npmrc the given registry
--registry= registry.npmjs.org (bug)
project .npmrc registry.npmjs.org (by design, untrusted)

After the fix, --registry= reaches the given registry. pnpm v11 already sends --registry to packageManagerRegistries (CLI --registry overrides pnpm-workspace.yaml registries.default in config/reader/test/index.ts), so this is v12-only.

Until a release ships the fix, registry=<mirror> in ~/.npmrc or PNPM_CONFIG_REGISTRY=<mirror> works around it.

Squash Commit Body

The pre-command pass loads its own config to switch to, or record, the
pnpm version a project pins. It applied the `--config.*` overrides but
not the global network flags (`--registry`, `--https-proxy`,
`--http-proxy`, `--no-proxy`), so `pnpm install --registry=<mirror>`
still looked up pnpm on registry.npmjs.org. Behind a firewall that only
allows a private registry, every command failed with
ERR_PNPM_BAD_CONFIG_DEP even when the running pnpm was the pinned one.

The parsed flags now reach that config, and the argv scans of the
`--version` and unparsed command-line paths read them too.

Reported in https://github.com/pnpm/pnpm/discussions/16911.

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. (v11 already honors --registry here.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package.
  • Added or updated tests. (Without the fix, the new config test fails, asserting registry.npmjs.org.)

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


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

Summary by CodeRabbit

  • Bug Fixes
    • Registry and proxy options now apply when resolving and downloading the version pinned in packageManager, rather than using the npm registry by default.
    • Registry and proxy flags provided before a command are now applied to package-manager configuration.

The pre-command pass loads its own config to switch to, or record, the
pnpm version a project pins. It applied the `--config.*` overrides but
not the global network flags (`--registry`, `--https-proxy`,
`--http-proxy`, `--no-proxy`), so `pnpm install --registry=<mirror>`
still looked up pnpm on registry.npmjs.org. Behind a firewall that only
allows a private registry, every command failed with
ERR_PNPM_BAD_CONFIG_DEP even when the running pnpm was the pinned one.

The parsed flags now reach that config, and the argv scans of the
`--version` and unparsed command-line paths read them too.

Reported in #16911.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: a259aef9-062f-4d73-b116-6473189c82ff
📥 Commits

Reviewing files that changed from the base of the PR and between 607ed0a and f3c99d0.

📒 Files selected for processing: 7
  • .changeset/registry-flag-reaches-pnpm-pin.md
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/pre_command.rs
  • pnpm/crates/cli/src/cli_args/pre_command/input.rs
  • pnpm/crates/cli/src/cli_args/pre_command/input/argv_scan.rs
  • pnpm/crates/cli/src/cli_args/pre_command/load_config.rs
  • pnpm/crates/cli/src/cli_args/pre_command/tests.rs

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

📝 Walkthrough

The pre-command argument scan now captures registry and proxy options for the pinned pnpm. Config loading applies those settings, and tests cover argument scanning and the resulting bootstrap registry and HTTPS proxy.

Changes: Pinned pnpm network options

Layer / File(s) Summary
Capture network options
pnpm/crates/cli/src/cli_args/cli_command.rs, pnpm/crates/cli/src/cli_args/pre_command.rs, pnpm/crates/cli/src/cli_args/pre_command/input.rs, pnpm/crates/cli/src/cli_args/pre_command/input/argv_scan.rs, pnpm/crates/cli/src/cli_args/pre_command/tests.rs
SwitchInput now carries CliNetworkArgs. Pre-command scanning captures registry, HTTPS proxy, HTTP proxy, and no-proxy options. Tests cover captured registry and no-proxy values.
Apply network options to configuration
pnpm/crates/cli/src/cli_args/pre_command/load_config.rs, pnpm/crates/cli/src/cli_args/pre_command/tests.rs, .changeset/registry-flag-reaches-pnpm-pin.md
Config loading applies the captured network settings. A test checks the bootstrap registry, its default mapping, and HTTPS proxy. The changeset describes registry and proxy options applying to resolution and download of the pinned pnpm.

Priority: ➖ Normal

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

Change: Bug fix

Suggested labels: product: pacquet

Suggested reviewers: ayush442842q, ksxgithub

Merge Risk: ⚪ Minimal · up to f3c99

The pinned-pnpm bootstrap path now receives the requested registry and proxy settings. No actionable merge-blocking risk remains after normal checks.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.35     21.4±5.47ms    17.5 MB/sec    1.00     15.9±1.12ms    23.6 MB/sec
packument/parse                                  1.00     48.8±4.33µs  1359.2 MB/sec    1.03     50.4±4.63µs  1315.2 MB/sec
tarball/download_dependency                      1.33      5.9±1.24ms   741.1 KB/sec    1.00      4.4±0.67ms   986.9 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.21   318.0±44.16ms 50.3 KElem/sec    1.00   263.1±36.12ms 60.8 KElem/sec
version_pick/repeated_ranges_file                1.01      5.0±0.53ms  6.3 KElem/sec    1.00      4.9±0.13ms  6.4 KElem/sec
version_pick/repeated_ranges_raw                 1.00      5.0±0.87ms  6.2 KElem/sec    1.05      5.3±0.42ms  5.9 KElem/sec
workspace_resolution/hoist_heavy                 1.00   432.7±60.91ms        ? ?/sec    1.00   431.8±53.99ms        ? ?/sec
workspace_sort/chained_projects                  1.63     26.3±8.48ms        ? ?/sec    1.00     16.1±1.89ms        ? ?/sec

@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 2591.96 ms 2600.99 ms 0.3% 129.60 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1559.12 ms 1721.54 ms 10.4% 77.96 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 356.30 ms 370.28 ms 3.9% 17.81 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 403.62 ms 416.27 ms 3.1% 20.18 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 11.69 ms 11.03 ms -5.6% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 11.62 ms 11.10 ms -4.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 12.68 ms 12.90 ms 1.8% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 15.02 ms 13.83 ms -7.9% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2824.86 ms 2850.59 ms 0.9% 141.24 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1773.08 ms 1583.82 ms -10.7% 88.65 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 550.73 ms 571.79 ms 3.8% 27.54 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 380.16 ms 325.37 ms -14.4% 19.01 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 2273.31 ms 2060.27 ms -9.4% 113.67 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 501.03 ms 480.57 ms -4.1% 25.05 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 327.61 ms 356.29 ms 8.8% 16.38 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 115.16 ms 112.17 ms -2.6% 5.76 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 391.98 ms 336.63 ms -14.1% 19.60 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 315.11 ms 280.67 ms -10.9% 15.76 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 131.45 ms 129.73 ms -1.3% 6.57 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4720.93 ms 4675.32 ms -1.0% 236.05 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3924.29 ms 3666.99 ms -6.6% 196.21 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 208.42 ms 191.96 ms -7.9% 10.42 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 258.71 ms 262.94 ms 1.6% 12.94 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1405.12 ms 1543.14 ms 9.8% 70.26 ms Inconclusive (overlapping samples)

Integrated-Benchmark Report (Linux)

Commit: f3c99d07c4a3

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked and injected workspace scenarios compare 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.619 ± 0.130 2.463 2.841 1.65 ± 0.16
pacquet@main 2.613 ± 0.107 2.526 2.901 1.64 ± 0.16
pnpr@HEAD 1.661 ± 0.142 1.457 1.828 1.04 ± 0.13
pnpr@main 1.591 ± 0.136 1.454 1.888 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6193905694799997,
      "stddev": 0.12990428906096346,
      "median": 2.60099117748,
      "user": 2.29234064,
      "system": 2.1749403999999997,
      "min": 2.46286218848,
      "max": 2.84140440448
    },
    {
      "command": "pacquet@main",
      "mean": 2.61292711758,
      "stddev": 0.10650095270844627,
      "median": 2.59196014798,
      "user": 2.4664461399999995,
      "system": 2.3479742999999997,
      "min": 2.52597188848,
      "max": 2.90096501148
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.66070829178,
      "stddev": 0.1420460454367118,
      "median": 1.7215359024799999,
      "user": 2.25780564,
      "system": 2.0098149999999997,
      "min": 1.45724023148,
      "max": 1.82787266848
    },
    {
      "command": "pnpr@main",
      "mean": 1.59142233108,
      "stddev": 0.13648355840343443,
      "median": 1.55912158998,
      "user": 2.4475827400000005,
      "system": 2.1272299,
      "min": 1.45383873748,
      "max": 1.88804532248
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 365.7 ± 28.2 328.3 411.9 1.01 ± 0.09
pacquet@main 362.1 ± 16.8 346.0 394.0 1.00
pnpr@HEAD 410.1 ± 27.4 365.9 443.2 1.13 ± 0.09
pnpr@main 399.9 ± 26.9 346.4 452.0 1.10 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36573038968,
      "stddev": 0.02817366192098657,
      "median": 0.37027731008,
      "user": 0.43761396,
      "system": 0.82883092,
      "min": 0.32825924558,
      "max": 0.41187826458000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.36211559908,
      "stddev": 0.01683104210190789,
      "median": 0.35629852958,
      "user": 0.46555616000000005,
      "system": 0.84915162,
      "min": 0.34599561158000003,
      "max": 0.39397524558
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.41008998768,
      "stddev": 0.027422357199054705,
      "median": 0.41627236108,
      "user": 0.47630465999999994,
      "system": 0.8725357200000001,
      "min": 0.36594206858,
      "max": 0.44319252058
    },
    {
      "command": "pnpr@main",
      "mean": 0.39985658378,
      "stddev": 0.02694982783565389,
      "median": 0.40361912708000003,
      "user": 0.4655792599999999,
      "system": 0.8786241200000001,
      "min": 0.34643619258,
      "max": 0.45199976858
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 11.3 ± 1.6 8.4 16.3 1.00
pacquet@main 11.8 ± 1.5 8.5 17.0 1.05 ± 0.20
pnpr@HEAD 11.9 ± 2.3 9.2 23.7 1.05 ± 0.25
pnpr@main 11.8 ± 1.5 9.1 19.3 1.04 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.011316150942958582,
      "stddev": 0.0016184222456905523,
      "median": 0.011032491440000002,
      "user": 0.006332142603550296,
      "system": 0.006009499053254435,
      "min": 0.00835441544,
      "max": 0.01627681244
    },
    {
      "command": "pacquet@main",
      "mean": 0.011849263296435646,
      "stddev": 0.001465590616587649,
      "median": 0.011686591440000001,
      "user": 0.006682870297029704,
      "system": 0.006343046831683172,
      "min": 0.00845190944,
      "max": 0.01695596944
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011891742040000004,
      "stddev": 0.0022682657079904148,
      "median": 0.011095810440000001,
      "user": 0.007029916326530605,
      "system": 0.005992130204081634,
      "min": 0.00918948544,
      "max": 0.02365173944
    },
    {
      "command": "pnpr@main",
      "mean": 0.011794187594545463,
      "stddev": 0.0014640420658431712,
      "median": 0.01161903394,
      "user": 0.00661161818181818,
      "system": 0.0062896213636363645,
      "min": 0.009080501440000001,
      "max": 0.01930470544
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 13.4 ± 2.0 9.5 19.6 1.01 ± 0.23
pacquet@main 13.3 ± 2.3 10.1 19.7 1.00
pnpr@HEAD 14.4 ± 2.7 10.2 23.0 1.08 ± 0.27
pnpr@main 15.2 ± 2.2 10.9 20.6 1.14 ± 0.26
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.013380853309411776,
      "stddev": 0.0020160903190536332,
      "median": 0.012901757980000001,
      "user": 0.007479977647058824,
      "system": 0.0071983887058823534,
      "min": 0.00947406198,
      "max": 0.019616958979999998
    },
    {
      "command": "pacquet@main",
      "mean": 0.013298003071549295,
      "stddev": 0.0022575301184012,
      "median": 0.012676375980000001,
      "user": 0.007154082535211266,
      "system": 0.0074726500000000026,
      "min": 0.01011402798,
      "max": 0.01974121098
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.014376380507173922,
      "stddev": 0.002659790700887279,
      "median": 0.01383192098,
      "user": 0.007990785,
      "system": 0.007764900434782602,
      "min": 0.01015919898,
      "max": 0.02296631898
    },
    {
      "command": "pnpr@main",
      "mean": 0.015157607935974838,
      "stddev": 0.0022173787679147425,
      "median": 0.015017625980000003,
      "user": 0.00825230465408805,
      "system": 0.008386582012578614,
      "min": 0.010902739980000001,
      "max": 0.02060392298
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.877 ± 0.130 2.728 3.087 1.82 ± 0.12
pacquet@main 2.833 ± 0.102 2.688 2.990 1.79 ± 0.11
pnpr@HEAD 1.582 ± 0.079 1.485 1.724 1.00
pnpr@main 1.779 ± 0.137 1.572 1.962 1.12 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.8765244089,
      "stddev": 0.13018310621918674,
      "median": 2.8505948512000003,
      "user": 3.0357938199999994,
      "system": 2.3334058799999995,
      "min": 2.7284159027,
      "max": 3.0867861457
    },
    {
      "command": "pacquet@main",
      "mean": 2.8334873424000007,
      "stddev": 0.10230204157430291,
      "median": 2.8248553502,
      "user": 2.95128602,
      "system": 2.27146298,
      "min": 2.6881115147,
      "max": 2.9895301177
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5824997077,
      "stddev": 0.07906177971580783,
      "median": 1.5838184247,
      "user": 1.67677642,
      "system": 1.64011578,
      "min": 1.4849135187,
      "max": 1.7243410887000001
    },
    {
      "command": "pnpr@main",
      "mean": 1.7791161125,
      "stddev": 0.13679998570900123,
      "median": 1.7730770567,
      "user": 1.9199775199999998,
      "system": 2.0671073800000004,
      "min": 1.5720404557,
      "max": 1.9617471967000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 564.3 ± 54.4 476.3 666.3 1.77 ± 0.22
pacquet@main 569.6 ± 56.5 493.7 677.0 1.79 ± 0.23
pnpr@HEAD 319.0 ± 25.3 277.3 348.3 1.00
pnpr@main 382.0 ± 39.0 325.1 453.0 1.20 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5643192228999999,
      "stddev": 0.054384022076832406,
      "median": 0.5717904928,
      "user": 0.82757794,
      "system": 0.8889654200000001,
      "min": 0.47632459330000004,
      "max": 0.6662669823
    },
    {
      "command": "pacquet@main",
      "mean": 0.5695752629,
      "stddev": 0.05654428751920088,
      "median": 0.5507301573000001,
      "user": 0.8644248399999999,
      "system": 0.91484942,
      "min": 0.49372186030000004,
      "max": 0.6769680483
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31898804960000005,
      "stddev": 0.025260245122111866,
      "median": 0.32536877880000004,
      "user": 0.29838624,
      "system": 0.5939258199999999,
      "min": 0.2772803373,
      "max": 0.3483405983
    },
    {
      "command": "pnpr@main",
      "mean": 0.38199907680000006,
      "stddev": 0.038963209795714056,
      "median": 0.38016150930000003,
      "user": 0.37412154,
      "system": 0.7497890199999999,
      "min": 0.32507687030000004,
      "max": 0.45296068530000005
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.105 ± 0.133 1.947 2.394 4.38 ± 0.45
pacquet@main 2.257 ± 0.126 2.031 2.404 4.70 ± 0.46
pnpr@HEAD 0.481 ± 0.038 0.422 0.545 1.00
pnpr@main 0.488 ± 0.048 0.355 0.519 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.1049560928799997,
      "stddev": 0.13256709917243745,
      "median": 2.0602672649800002,
      "user": 1.7940098199999999,
      "system": 1.40775618,
      "min": 1.94730899948,
      "max": 2.39431199448
    },
    {
      "command": "pacquet@main",
      "mean": 2.25676079988,
      "stddev": 0.1259725046610262,
      "median": 2.2733087529800002,
      "user": 1.9791064200000001,
      "system": 1.51239718,
      "min": 2.03058460548,
      "max": 2.4035353504800003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.48062820288,
      "stddev": 0.03846753314841058,
      "median": 0.48056873598000005,
      "user": 0.46233442,
      "system": 0.81733118,
      "min": 0.42192114148000004,
      "max": 0.54486225248
    },
    {
      "command": "pnpr@main",
      "mean": 0.48756324517999994,
      "stddev": 0.04761960911909735,
      "median": 0.5010285369799999,
      "user": 0.51335362,
      "system": 0.82400338,
      "min": 0.35478839648000005,
      "max": 0.51931775448
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 364.1 ± 64.8 283.1 463.6 3.25 ± 0.60
pacquet@main 327.5 ± 22.6 298.1 376.0 2.92 ± 0.25
pnpr@HEAD 112.0 ± 5.7 99.4 123.6 1.00
pnpr@main 115.0 ± 7.7 99.6 130.5 1.03 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3641006551,
      "stddev": 0.06477201461346235,
      "median": 0.35629137050000004,
      "user": 0.37665651999999994,
      "system": 0.14304145999999998,
      "min": 0.283090298,
      "max": 0.463559795
    },
    {
      "command": "pacquet@main",
      "mean": 0.3274684217,
      "stddev": 0.02257194290881501,
      "median": 0.32760855450000004,
      "user": 0.33557712,
      "system": 0.12463765999999998,
      "min": 0.298133873,
      "max": 0.375990962
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11204885964000001,
      "stddev": 0.005699400139803667,
      "median": 0.11216606100000001,
      "user": 0.053327400000000004,
      "system": 0.018749679999999998,
      "min": 0.09943762800000001,
      "max": 0.12355937900000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.11500576514285714,
      "stddev": 0.00774601006842826,
      "median": 0.11515927950000002,
      "user": 0.05160755571428572,
      "system": 0.02291136285714285,
      "min": 0.099602542,
      "max": 0.130513871
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 356.7 ± 32.6 324.4 402.7 1.00
pacquet@main 386.5 ± 37.4 317.2 432.7 1.08 ± 0.14
pnpm@HEAD 5614.4 ± 407.7 4911.8 6367.2 15.74 ± 1.84
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35673917390888893,
      "stddev": 0.032617521542045946,
      "median": 0.33662959102,
      "user": 0.3780464444444444,
      "system": 0.08949014444444445,
      "min": 0.32441285902,
      "max": 0.40273159802
    },
    {
      "command": "pacquet@main",
      "mean": 0.38646716557555555,
      "stddev": 0.037385148716022394,
      "median": 0.39197922602,
      "user": 0.4081503333333333,
      "system": 0.09092669999999999,
      "min": 0.31722012302,
      "max": 0.43270167602
    },
    {
      "command": "pnpm@HEAD",
      "mean": 5.614354985575555,
      "stddev": 0.4076737048144897,
      "median": 5.59857430602,
      "user": 8.891112222222224,
      "system": 0.5577924777777777,
      "min": 4.91182359802,
      "max": 6.36718220702
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 283.3 ± 22.2 255.9 317.1 1.00
pacquet@main 314.8 ± 18.9 278.9 339.8 1.11 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.28328419903818186,
      "stddev": 0.022167789406386595,
      "median": 0.28067351722000006,
      "user": 0.23067994545454543,
      "system": 0.10844117636363636,
      "min": 0.25594288522,
      "max": 0.31709074922
    },
    {
      "command": "pacquet@main",
      "mean": 0.31484219632,
      "stddev": 0.01888147978931886,
      "median": 0.3151074087200001,
      "user": 0.2688597,
      "system": 0.10754743999999998,
      "min": 0.27889919222000004,
      "max": 0.33975170722000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 128.2 ± 8.4 117.4 140.1 1.00
pacquet@main 131.5 ± 9.9 115.3 146.3 1.03 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.12818197868285716,
      "stddev": 0.008357879292254908,
      "median": 0.12973300054,
      "user": 0.049104228571428564,
      "system": 0.08956938857142857,
      "min": 0.11742848854000001,
      "max": 0.14008685254
    },
    {
      "command": "pacquet@main",
      "mean": 0.13154827758000004,
      "stddev": 0.009903101095760076,
      "median": 0.13145456254000001,
      "user": 0.0533274,
      "system": 0.08798532000000002,
      "min": 0.11525432654000001,
      "max": 0.14631948754000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.712 ± 0.201 4.470 5.017 1.27 ± 0.06
pacquet@main 4.787 ± 0.136 4.669 5.046 1.29 ± 0.05
pnpr@HEAD 3.704 ± 0.080 3.622 3.844 1.00
pnpr@main 3.977 ± 0.323 3.655 4.713 1.07 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.71220646318,
      "stddev": 0.20094763068110486,
      "median": 4.67531527978,
      "user": 1.93067706,
      "system": 2.09234514,
      "min": 4.47019954078,
      "max": 5.01736943578
    },
    {
      "command": "pacquet@main",
      "mean": 4.78689084268,
      "stddev": 0.13649430624321565,
      "median": 4.720930339780001,
      "user": 2.1043927600000005,
      "system": 2.18765674,
      "min": 4.66909607178,
      "max": 5.046395077780001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.7044694769799995,
      "stddev": 0.08048569430825529,
      "median": 3.66699220678,
      "user": 1.93750876,
      "system": 2.00262154,
      "min": 3.62172196478,
      "max": 3.84377409878
    },
    {
      "command": "pnpr@main",
      "mean": 3.9767810358800006,
      "stddev": 0.32275220352558803,
      "median": 3.92428838678,
      "user": 2.13696106,
      "system": 2.17957774,
      "min": 3.65545744878,
      "max": 4.71328301378
    }
  ]
}

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 197.1 ± 17.7 174.8 236.0 1.00
pacquet@main 211.0 ± 17.3 189.4 250.3 1.07 ± 0.13
pnpr@HEAD 261.4 ± 24.1 216.3 303.8 1.33 ± 0.17
pnpr@main 253.6 ± 25.3 212.3 282.0 1.29 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1971196501327273,
      "stddev": 0.017740955078099033,
      "median": 0.19195742786000003,
      "user": 0.2496470818181818,
      "system": 0.16807698727272727,
      "min": 0.17482544486,
      "max": 0.23599795586000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.21104824055230773,
      "stddev": 0.017341543293639055,
      "median": 0.20841857886,
      "user": 0.26161866923076915,
      "system": 0.1757686446153846,
      "min": 0.18938013186000002,
      "max": 0.25028278586
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2613627300418182,
      "stddev": 0.024146231552328007,
      "median": 0.26294288986000003,
      "user": 0.2974733545454545,
      "system": 0.19428853272727273,
      "min": 0.21630638986000003,
      "max": 0.30379196786
    },
    {
      "command": "pnpr@main",
      "mean": 0.25361430276,
      "stddev": 0.02529752797152253,
      "median": 0.25871060286,
      "user": 0.29424669999999997,
      "system": 0.19944606000000004,
      "min": 0.21229866286000001,
      "max": 0.28196310386
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.509 ± 0.091 1.338 1.599 1.06 ± 0.08
pacquet@main 1.424 ± 0.059 1.352 1.534 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.50892428996,
      "stddev": 0.09141444494411735,
      "median": 1.54314074666,
      "user": 1.05498344,
      "system": 0.46217076000000007,
      "min": 1.33798421266,
      "max": 1.59852078566
    },
    {
      "command": "pacquet@main",
      "mean": 1.4243943721599996,
      "stddev": 0.05860960558979982,
      "median": 1.4051230071599998,
      "user": 0.99826284,
      "system": 0.39150556,
      "min": 1.3523199016599998,
      "max": 1.53363688366
    }
  ]
}

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.61%. Comparing base (607ed0a) to head (f3c99d0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16919      +/-   ##
==========================================
- Coverage   92.61%   92.61%   -0.01%     
==========================================
  Files        1708     1708              
  Lines      221718   221738      +20     
==========================================
+ Hits       205344   205358      +14     
- Misses      16374    16380       +6     

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

@zkochan
zkochan marked this pull request as ready for review October 14, 2026 06:41
Copilot AI balanced review requested due to automatic review settings October 14, 2026 06:41

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

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

PR Summary by Qodo

Honor network flags when resolving the pinned pnpm version

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Apply registry and proxy flags to pre-command resolution of the pnpm version pinned by a project.
• Read those flags on parsed, version, and unparsed command-line paths.
• Add regression coverage and a patch changeset for the published CLI.
Diagram

graph TD
  Parsed["Parsed CLI"] --> Switch["Switch input"] --> Config["Pre-command config"] --> Bootstrap["Bootstrap registry"] --> Pin["Pinned pnpm"]
  Scan["Argv scan"] --> Switch
Loading
High-Level Assessment

Reusing CliNetworkArgs.apply in the pre-command configuration is the appropriate approach: it matches normal dispatch while preserving the bootstrap configuration's trusted-source boundary. Reusing the main command configuration would couple pin resolution to a later stage with different configuration inputs.

Files changed (7) +79 / -9

Bug fix (5) +37 / -7
cli_command.rsMake network arguments default-constructible +1/-1

Make network arguments default-constructible

• Derives Default for CliNetworkArgs so argv scans can start with an empty set of network overrides.

pnpm/crates/cli/src/cli_args/cli_command.rs

pre_command.rsExpose network arguments to pre-command handling +1/-1

Expose network arguments to pre-command handling

• Imports CliNetworkArgs for use by the pre-command input and its configuration path.

pnpm/crates/cli/src/cli_args/pre_command.rs

input.rsCarry and scan network flags for package-manager switching +31/-3

Carry and scan network flags for package-manager switching

• Stores parsed network arguments in SwitchInput and reads registry and proxy flags when scanning argv. This makes the overrides available before the command runs.

pnpm/crates/cli/src/cli_args/pre_command/input.rs

argv_scan.rsInitialize network flags on fallback argv paths +3/-2

Initialize network flags on fallback argv paths

• Initializes empty network arguments for version and unparsed-command scans, allowing their shared flag reader to populate the overrides.

pnpm/crates/cli/src/cli_args/pre_command/input/argv_scan.rs

load_config.rsApply network flags to pre-command configuration +1/-0

Apply network flags to pre-command configuration

• Applies registry and proxy overrides after loading the pre-command configuration, so package-manager bootstrap resolution uses CLI-specified network settings.

pnpm/crates/cli/src/cli_args/pre_command/load_config.rs

Tests (1) +37 / -2
tests.rsCover network flag scanning and bootstrap configuration +37/-2

Cover network flag scanning and bootstrap configuration

• Extends unparsed-argv coverage for registry and no-proxy flags and verifies that version-path registry and HTTPS proxy flags reach the package-manager bootstrap configuration.

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

Documentation (1) +5 / -0
registry-flag-reaches-pnpm-pin.mdDocument the package-manager network flag fix +5/-0

Document the package-manager network flag fix

• Adds a patch changeset for pacquet describing how registry and proxy flags now affect pinned-pnpm resolution and downloads.

.changeset/registry-flag-reaches-pnpm-pin.md

@qodo-code-review

qodo-code-review Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Pinned pnpm may use the wrong registry 🐞 Bug ≡ Correctness
Description
absorb_network_flag records --registry even when it immediately follows an undeclared option
whose value the scanner cannot determine. If a pinned pnpm accepts that token as the unknown
option's value, the fallback applies the following URL to pin resolution before handing the command
to the pinned pnpm.
Code

pnpm/crates/cli/src/cli_args/pre_command/input.rs[R361-363]

+            if let Some((value, width)) = long_value(token, option, next) {
+                *slot = Some(value.to_string_lossy().into_owned());
+                return Some(width);
Relevance

●●● Strong

Accepted precedent specifically fixes scanners misreading values after undeclared options, matching
this registry-capture bug.

PR-#16360
PR-#16362

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The scanner tracks whether the preceding option may have an unknown value, but uses that state only
to reject scope flags. It still passes a following --registry to the newly added capture code; the
resulting value is applied to pre-command config, which the unknown-argument path uses when planning
a switch.

pnpm/crates/cli/src/cli_args/pre_command/input/argv_scan.rs[48-57]
pnpm/crates/cli/src/cli_args/pre_command/input/argv_scan.rs[133-151]
pnpm/crates/cli/src/cli_args/pre_command/input.rs[350-368]
pnpm/crates/cli/src/cli_args/pre_command/load_config.rs[39-46]
pnpm/crates/cli/src/cli_args/pre_command/argv_plans.rs[36-68]

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 unparsed-argv fallback can interpret a network flag as a flag even when it may be the value of an option only the pinned pnpm knows, changing the registry used to acquire that pnpm.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pre_command/input/argv_scan.rs[48-57]
- pnpm/crates/cli/src/cli_args/pre_command/input.rs[353-364]

## Recommended Fix
When a token immediately follows an undeclared option that may take a value, do not capture it as a network override. Preserve unambiguous network flags and add a regression test for the ambiguous sequence.

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

Dismiss ↗ | View ↗



Informational

2. CLI wiring lacks end-to-end coverage 📜 Skill insight ▣ Testability
Description
The added regression test calls SwitchInput::from_version_argv and load_pre_command_config
directly instead of invoking the real CLI entry path. A future dispatch or argument-propagation
regression could leave pnpm install --registry=... broken while this unit test still passes, so
the user-visible command wiring remains unverified.
Code

pnpm/crates/cli/src/cli_args/pre_command/tests.rs[R355-371]

+#[test]
+fn the_pre_command_config_resolves_the_pinned_pnpm_through_the_network_flags() {
+    let root = TempDir::new().expect("tmp dir");
+    let dir = dunce::canonicalize(root.path()).expect("canonicalize the project directory");
+    let mut switch = SwitchInput::from_version_argv(&[
+        OsString::from("pnpm"),
+        OsString::from("--registry=https://mirror.example.com/npm"),
+        OsString::from("--https-proxy"),
+        OsString::from("http://proxy.example.com:8080"),
+        OsString::from("--version"),
+    ]);
+    switch.paths.dir = dir.clone();
+    let input = PreCommandInput { switch, ..pre_command_input(&dir) };
+
+    let config =
+        load_pre_command_config(&input, &ConfigOverrides::default(), &dir, ConfigLoad::default())
+            .expect("load the pre-command config");
Relevance

● Weak

Recent precedents reject adding CLI-level tests when focused helper tests already cover the changed
behavior.

PR-#16734
PR-#16727
PR-#16437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires CLI wiring and configuration-propagation changes to have at least one test
invoking the real CLI path. The added test constructs SwitchInput and calls
load_pre_command_config directly, proving only internal helper behavior and not end-to-end command
wiring.

pnpm/crates/cli/src/cli_args/pre_command/tests.rs[355-371]
Skill: review-code

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 network-flag regression test exercises internal pre-command helpers but not the real CLI dispatch path, so it cannot detect wiring failures between CLI argument parsing and pinned pnpm resolution.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pre_command/tests.rs[355-371]

## Recommended Fix
Add an end-to-end CLI test that invokes the real pnpm command with `--registry` and proxy flags, configures a pinned `packageManager`, and asserts that pinned pnpm resolution uses those values rather than the default registry.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 66 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: 2457663d) — View relationship
  Explored: repo: pnpm/setup (sha: a0881977) — View relationship
Review mode: Auto: ⚖️ Balanced: Behavioral CLI network changes require careful security and configuration review.

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 14, 2026
@zkochan
zkochan merged commit c28afa0 into main Oct 14, 2026
59 checks passed
@zkochan
zkochan deleted the fix-16911 branch October 14, 2026 07:42
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants