Skip to content

fix(pacquet/login): honor the scope setting - #13255

Merged
zkochan merged 21 commits into
mainfrom
claude/pacquet-login-scope-bug-9k2qz4
Aug 3, 2026
Merged

zkochan merged 21 commits into
mainfrom
claude/pacquet-login-scope-bug-9k2qz4

Conversation

@KSXGitHub

@KSXGitHub KSXGitHub commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pacquet's pnpm login / pnpm adduser honored scope only as the --scope command-line flag, ignoring the setting when it came from configuration. The TypeScript pnpm CLI resolves scope through the config chain, so pacquet was missing three sources: pnpm-workspace.yaml, the global config.yaml, and the PNPM_CONFIG_SCOPE environment variable. This adds them.

pacquet-config's Config gains a scope field, populated from pnpm-workspace.yaml and the global config.yaml (via WorkspaceSettings) and from PNPM_CONFIG_SCOPE (via WorkspaceSettings::from_pnpm_config_env). The login adapter falls back to it when --scope is absent; the flag still wins when both are set. A resolved scope keys the granted token (//registry/:@scope:_authToken) and records the @scope:registry mapping, matching the TypeScript CLI.

.npmrc is deliberately not one of the sources. pnpm keeps only auth/registry keys when reading an .npmrc — readAndFilterNpmrc gates on isNpmrcReadableKey, and scope is in neither NPM_AUTH_SETTINGS nor NETWORK_INI_KEYS — so a scope= line there is dropped before it reaches the merged config. A test pins that pacquet ignores it too, so the two stacks stay identical on the point.

Fixes #12893.

Note that the linked issue is inaccurate on one detail: it describes the gap as pacquet not reading scope from .npmrc, but the TypeScript CLI does not read it from there either. The real gap was the config-file and environment sources, which is what this PR closes.

Squash Commit Body

pacquet's pnpm login / pnpm adduser honored scope only as the --scope
command-line flag, ignoring it when configured. The TypeScript pnpm CLI
resolves scope through the config chain, so pacquet was missing the
pnpm-workspace.yaml, global config.yaml, and PNPM_CONFIG_SCOPE sources.

Add a scope field to Config, populated from pnpm-workspace.yaml and the
global config.yaml (via WorkspaceSettings) and from PNPM_CONFIG_SCOPE (via
from_pnpm_config_env). The login CLI adapter falls back to the resolved
config.scope when --scope is absent, with the flag still taking
precedence.

.npmrc is deliberately excluded: pnpm's readAndFilterNpmrc keeps only
auth/registry keys (isNpmrcReadableKey), and scope is in neither
NPM_AUTH_SETTINGS nor NETWORK_INI_KEYS, so pnpm drops a `scope=` line
there. A test pins that pacquet ignores it too.

Fixes https://github.com/pnpm/pnpm/issues/12893

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pnpm/ port, or the description notes what still needs porting. (The TypeScript CLI already resolves scope from these sources; only the Rust port needed the fix.)
  • 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.

Summary by CodeRabbit

  • New Features

    • pnpm login and pnpm adduser now resolve package scope from workspace or global configuration, environment settings, or CLI options.
    • Explicit --scope values take precedence over configured defaults.
    • Scoped tokens and scope-to-registry mappings are persisted when applicable.
  • Bug Fixes

    • Empty scope environment values are now preserved as intentional overrides.
    • Unsupported scope entries in .npmrc are ignored consistently.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: add81d48-ce7d-44ed-981e-df05d2d2d312

📥 Commits

Reviewing files that changed from the base of the PR and between 9117f41 and 92c90b0.

📒 Files selected for processing (1)
  • pnpm/crates/config/src/env_overlay.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/config/src/env_overlay.rs

📝 Walkthrough

Walkthrough

The PR adds Config.scope, loads scope from workspace and environment configuration, supports CLI configuration overrides, and makes login fall back to configured scope when --scope is absent. Tests cover precedence and auth.ini persistence.

Changes

Login scope configuration

Layer / File(s) Summary
Configuration scope contract and npmrc filtering
pnpm/crates/config/src/lib.rs, pnpm/crates/config/src/npmrc_auth/tests.rs, pnpm/crates/config/src/tests.rs, pnpm/crates/package-manager/...
Config stores an optional scope. .npmrc scope entries remain ignored. Test configuration literals initialize the new field.
Workspace and environment scope propagation
pnpm/crates/config/src/workspace_yaml.rs, pnpm/crates/config/src/workspace_yaml/tests.rs, pnpm/crates/config/src/env_overlay.rs, pnpm/crates/config/src/env_overlay/tests.rs
Workspace YAML and PNPM_CONFIG_SCOPE populate Config.scope. Empty environment values remain significant.
CLI configuration scope override
pnpm/crates/cli/src/config_overrides.rs, pnpm/crates/cli/src/config_overrides/tests.rs
--config.scope is parsed and applied to Config.scope.
Login precedence and auth.ini persistence
pnpm/crates/cli/src/cli_args/login.rs, pnpm/crates/cli/src/cli_args/login/tests.rs, pnpm/crates/auth-commands/src/login.rs, .changeset/pacquet-login-scope-setting.md
Login resolves --scope before Config.scope. Tests verify scoped token and registry mapping persistence. Documentation describes the new behavior.

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

Assessment against linked issues

Objective Addressed Explanation
Read scope from .npmrc or rc configuration for login and adduser [#12893] ❌ .npmrc scope entries are explicitly ignored; scope is loaded from workspace YAML, environment variables, or CLI configuration instead.

Possibly related issues

  • pnpm/pnpm#13557 — Covers the same configured-scope fallback and auth.ini registry mapping behavior.

Possibly related PRs

Suggested labels: product: pacquet

Suggested reviewers: zkochan

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/pacquet-login-scope-bug-9k2qz4

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

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.4±0.03ms    32.9 MB/sec    1.03     11.8±0.05ms    31.8 MB/sec
packument/parse                                  1.00     36.7±0.14µs  1808.0 MB/sec    1.03     37.9±0.12µs  1748.5 MB/sec
tarball/download_dependency                      1.00      2.3±0.08ms  1906.4 KB/sec    1.01      2.3±0.08ms  1896.2 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    174.7±1.04ms 91.6 KElem/sec    1.01    177.2±3.68ms 90.3 KElem/sec
workspace_resolution/hoist_heavy                 1.01    241.2±0.72ms        ? ?/sec    1.00    239.6±0.60ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Jul 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (641ccd3) to head (92c90b0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13255      +/-   ##
==========================================
- Coverage   88.00%   87.99%   -0.01%     
==========================================
  Files         567      567              
  Lines       97930    97944      +14     
==========================================
+ Hits        86179    86188       +9     
- Misses      11751    11756       +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 Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 92c90b09f560

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.552 ± 0.176 2.351 2.791 1.71 ± 0.22
pacquet@main 2.543 ± 0.175 2.332 2.770 1.70 ± 0.22
pnpr@HEAD 1.543 ± 0.138 1.367 1.737 1.03 ± 0.15
pnpr@main 1.494 ± 0.165 1.348 1.780 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.55215781054,
      "stddev": 0.17612920259938342,
      "median": 2.5520133337399997,
      "user": 1.53286652,
      "system": 1.28250666,
      "min": 2.3514363427399996,
      "max": 2.79122496874,
      "times": [
        2.37877353974,
        2.79122496874,
        2.73193613774,
        2.58023430574,
        2.3725760237399998,
        2.3788206047399996,
        2.6435258237399997,
        2.52379236174,
        2.76925799674,
        2.3514363427399996
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5428749746399997,
      "stddev": 0.17523416760932536,
      "median": 2.5774627787399997,
      "user": 1.48781352,
      "system": 1.2506303600000002,
      "min": 2.33167413674,
      "max": 2.7697836047399997,
      "times": [
        2.6831862527399997,
        2.4986401467399997,
        2.7297166917399998,
        2.34906488674,
        2.39300656074,
        2.33167413674,
        2.66441176174,
        2.35298029374,
        2.65628541074,
        2.7697836047399997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.54280673484,
      "stddev": 0.13764062762037202,
      "median": 1.53752108624,
      "user": 1.07152552,
      "system": 1.10513086,
      "min": 1.36749567174,
      "max": 1.73719221674,
      "times": [
        1.67838792174,
        1.71163869674,
        1.4168715947400001,
        1.36893593574,
        1.60213100074,
        1.47037213774,
        1.52788839474,
        1.36749567174,
        1.73719221674,
        1.54715377774
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4941659864399999,
      "stddev": 0.16524723722909315,
      "median": 1.42313247224,
      "user": 1.06345432,
      "system": 1.11341976,
      "min": 1.34788400674,
      "max": 1.7804863347400002,
      "times": [
        1.44893390074,
        1.36137613574,
        1.35940046274,
        1.60815817774,
        1.55277394774,
        1.35026224474,
        1.34788400674,
        1.7804863347400002,
        1.73505360974,
        1.3973310437400002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 255.5 ± 9.0 240.5 266.5 1.01 ± 0.05
pacquet@main 252.0 ± 8.1 243.7 269.8 1.00
pnpr@HEAD 276.8 ± 6.5 263.6 285.0 1.10 ± 0.04
pnpr@main 270.6 ± 8.8 255.3 283.2 1.07 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25549964624,
      "stddev": 0.00901143500022442,
      "median": 0.25740869174000003,
      "user": 0.19753632,
      "system": 0.53522994,
      "min": 0.24046002074000003,
      "max": 0.26653477774,
      "times": [
        0.24355467274000003,
        0.25002732474,
        0.24046002074000003,
        0.25492767074,
        0.25101904774,
        0.26396234274,
        0.26653477774,
        0.26407022774,
        0.25988971274,
        0.26055066474
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25202029053999997,
      "stddev": 0.008147456691853919,
      "median": 0.25042774674,
      "user": 0.19598001999999998,
      "system": 0.5288582399999999,
      "min": 0.24370708974000002,
      "max": 0.26983626974,
      "times": [
        0.25172437274,
        0.24640879574000002,
        0.25771232274,
        0.24370708974000002,
        0.24619040574000003,
        0.24374845874000003,
        0.24913112074000002,
        0.26983626974,
        0.25406850574,
        0.25767556374
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27677608504,
      "stddev": 0.006458116723845182,
      "median": 0.27776409924,
      "user": 0.21162282000000002,
      "system": 0.5505070400000001,
      "min": 0.26359878074,
      "max": 0.28498976874,
      "times": [
        0.27689985974,
        0.27877776874,
        0.27697025274,
        0.26785835474,
        0.27855794574,
        0.28498976874,
        0.28167955974,
        0.28161897774,
        0.27680958174,
        0.26359878074
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27056017974,
      "stddev": 0.00875583872953946,
      "median": 0.27080804474,
      "user": 0.21934952000000002,
      "system": 0.52228074,
      "min": 0.25528640374,
      "max": 0.28323073474,
      "times": [
        0.28323073474,
        0.25528640374,
        0.26161146774,
        0.27230427674,
        0.26820696874,
        0.26982434074,
        0.26470562074,
        0.27179174874,
        0.27634646874,
        0.28229376674
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.596 ± 0.019 2.565 2.627 1.60 ± 0.15
pacquet@main 2.603 ± 0.014 2.582 2.625 1.60 ± 0.15
pnpr@HEAD 1.643 ± 0.175 1.429 1.845 1.01 ± 0.14
pnpr@main 1.626 ± 0.151 1.426 1.826 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5960352562,
      "stddev": 0.018541925952571422,
      "median": 2.5993716940000002,
      "user": 1.4812404799999999,
      "system": 1.30332554,
      "min": 2.5651212525,
      "max": 2.6266660825,
      "times": [
        2.5651212525,
        2.5769821645,
        2.6028990735,
        2.6078316725,
        2.5749944985,
        2.6266660825,
        2.5980250735,
        2.6007183145,
        2.6094416295,
        2.5976728005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6027207636,
      "stddev": 0.013985401210611684,
      "median": 2.6013025775000003,
      "user": 1.45401018,
      "system": 1.3148280399999996,
      "min": 2.5821044925,
      "max": 2.6249603015,
      "times": [
        2.6161687635,
        2.6144229015000002,
        2.6024568525,
        2.6103368725,
        2.5955637575,
        2.6001483025,
        2.5821044925,
        2.5979188385,
        2.5831265535,
        2.6249603015
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6430977042000001,
      "stddev": 0.17468257832571282,
      "median": 1.6618527090000002,
      "user": 1.01475888,
      "system": 1.1774469399999998,
      "min": 1.4292006595,
      "max": 1.8450192565,
      "times": [
        1.4324039605,
        1.4766367985,
        1.7577446275000002,
        1.7995060405,
        1.5091243295,
        1.7951844665,
        1.5659607905000001,
        1.8201961125000001,
        1.8450192565,
        1.4292006595
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6262138785000002,
      "stddev": 0.15054234682569936,
      "median": 1.574375996,
      "user": 1.01619758,
      "system": 1.14692364,
      "min": 1.4257649405000001,
      "max": 1.8259450195000002,
      "times": [
        1.7692709835,
        1.4487461305,
        1.7406715735,
        1.5364148315000001,
        1.4257649405000001,
        1.5828532465,
        1.8224582145000001,
        1.8259450195000002,
        1.5658987455000002,
        1.5441150995
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 397.5 ± 8.2 381.0 409.2 1.29 ± 0.03
pacquet@main 389.7 ± 5.0 384.0 399.5 1.26 ± 0.02
pnpr@HEAD 311.8 ± 8.6 297.8 325.5 1.01 ± 0.03
pnpr@main 309.0 ± 4.2 304.8 317.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3975198489800001,
      "stddev": 0.008173071718091946,
      "median": 0.40008509868000003,
      "user": 0.5151196599999999,
      "system": 0.70509328,
      "min": 0.38095850518,
      "max": 0.40919381918000003,
      "times": [
        0.40109623518000004,
        0.40919381918000003,
        0.39028627118000003,
        0.40227023218,
        0.39311793518,
        0.39907396218,
        0.40446471718,
        0.40142313918,
        0.39331367318,
        0.38095850518
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.38969643958000005,
      "stddev": 0.004965070573609055,
      "median": 0.38837964168000005,
      "user": 0.51341286,
      "system": 0.6768614800000001,
      "min": 0.38400967118,
      "max": 0.39946601918,
      "times": [
        0.38641793918,
        0.38400967118,
        0.38557090618,
        0.39024483318000003,
        0.39352182418000003,
        0.38651445018,
        0.39946601918,
        0.39203852718000004,
        0.38536238418,
        0.39381784118
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31183747528000005,
      "stddev": 0.008596797270425538,
      "median": 0.31017269068,
      "user": 0.19802666,
      "system": 0.54599078,
      "min": 0.29784987818,
      "max": 0.32553060918,
      "times": [
        0.31404572718,
        0.32553060918,
        0.30260473718,
        0.31657837818,
        0.30995317318,
        0.30854127718,
        0.31039220818,
        0.32387356418,
        0.30900520018,
        0.29784987818
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30899704848,
      "stddev": 0.00415777843955624,
      "median": 0.30738036618,
      "user": 0.21485566,
      "system": 0.53312818,
      "min": 0.30482416918,
      "max": 0.31701434818,
      "times": [
        0.30707869918,
        0.30768203318,
        0.31004977418,
        0.30482416918,
        0.30670445518,
        0.31059225518,
        0.30542133418,
        0.31701434818,
        0.30564414218,
        0.31495927418
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.726 ± 0.005 1.721 1.736 5.70 ± 0.14
pacquet@main 1.723 ± 0.006 1.718 1.739 5.69 ± 0.14
pnpr@HEAD 0.303 ± 0.008 0.292 0.316 1.00
pnpr@main 0.305 ± 0.006 0.294 0.313 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7262353632200003,
      "stddev": 0.005409608620912543,
      "median": 1.7247617655200003,
      "user": 0.7144493000000001,
      "system": 0.76148542,
      "min": 1.72064941302,
      "max": 1.7357384510200002,
      "times": [
        1.7232385710200002,
        1.7264580840200001,
        1.7248125100200002,
        1.7357384510200002,
        1.7283101060200001,
        1.72064941302,
        1.72219775402,
        1.73521755102,
        1.72471102102,
        1.7210201710200002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.72331242262,
      "stddev": 0.006284313618793279,
      "median": 1.7232193315200002,
      "user": 0.7147540000000001,
      "system": 0.7476182200000001,
      "min": 1.71771535602,
      "max": 1.73877985902,
      "times": [
        1.7248796590200002,
        1.7248447030200003,
        1.7240044520200002,
        1.7183786330200002,
        1.71864066602,
        1.71771535602,
        1.72543766902,
        1.7224342110200002,
        1.71800901802,
        1.73877985902
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3026724017200001,
      "stddev": 0.007540843488788096,
      "median": 0.30076905052,
      "user": 0.1952022,
      "system": 0.52212452,
      "min": 0.29211043302,
      "max": 0.31555937902000003,
      "times": [
        0.31349018802,
        0.29211043302,
        0.29342021602,
        0.30116950902,
        0.30507276802000005,
        0.30036859202000005,
        0.30017281402,
        0.30023608302000004,
        0.31555937902000003,
        0.30512403502
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30483430192000005,
      "stddev": 0.005979318125468603,
      "median": 0.30484943352000005,
      "user": 0.1919397,
      "system": 0.54475592,
      "min": 0.29413812502000003,
      "max": 0.31343206802,
      "times": [
        0.31170507102,
        0.30726021202000003,
        0.30358053202,
        0.29769037602000004,
        0.29413812502000003,
        0.30391483102000005,
        0.30578403602000004,
        0.30897622902000005,
        0.30186153902,
        0.31343206802
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 180.2 ± 3.9 173.7 186.5 2.07 ± 0.06
pacquet@main 172.0 ± 13.0 164.3 214.0 1.97 ± 0.15
pnpr@HEAD 87.4 ± 1.8 84.3 90.4 1.00 ± 0.03
pnpr@main 87.3 ± 1.7 83.3 90.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18022059539000002,
      "stddev": 0.003886637289081546,
      "median": 0.18062515964000003,
      "user": 0.1620077025,
      "system": 0.0756894375,
      "min": 0.17374517164,
      "max": 0.18654421064,
      "times": [
        0.17750865764,
        0.18508679964000002,
        0.18195455964,
        0.17374517164,
        0.18503639364000002,
        0.18654421064,
        0.17479103864,
        0.17996896564,
        0.17615512364000002,
        0.17840796964,
        0.18029545964000002,
        0.17559801564000002,
        0.18266317064,
        0.18185391064,
        0.18095485964000002,
        0.18296521964
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.17200898017846156,
      "stddev": 0.01303026208943278,
      "median": 0.16946495164,
      "user": 0.16010313999999998,
      "system": 0.06130669230769232,
      "min": 0.16426688764,
      "max": 0.21400836764,
      "times": [
        0.21400836764,
        0.17409197364,
        0.17083643164,
        0.16495751564,
        0.16465260264,
        0.16722205464,
        0.16500230964,
        0.16946495164,
        0.16426688764,
        0.16707456664,
        0.17196851064000002,
        0.17102708964000002,
        0.17154348064
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08737067054909091,
      "stddev": 0.0017532765668433728,
      "median": 0.08744784564000001,
      "user": 0.021359382424242426,
      "system": 0.008770393939393937,
      "min": 0.08431230964,
      "max": 0.09037825664,
      "times": [
        0.08604667064,
        0.08763684164,
        0.08575407164,
        0.08846910664,
        0.08572860364,
        0.08763966764,
        0.08756412464,
        0.08684730664000001,
        0.08617636564,
        0.08709143664,
        0.08716187864000001,
        0.08744784564000001,
        0.09003595364,
        0.08563771264,
        0.09037825664,
        0.09018704864,
        0.08909440264,
        0.08448177864,
        0.08956123064,
        0.08431230964,
        0.08908376264000001,
        0.08695506964000001,
        0.08740431264000001,
        0.08896308864000001,
        0.08472024864000001,
        0.08799515764,
        0.08931966864,
        0.08518589364000001,
        0.08946435064000001,
        0.08494610364,
        0.08580269364000001,
        0.08839179364000001,
        0.08774737164
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08725329485212122,
      "stddev": 0.001706476303969266,
      "median": 0.08746967064000001,
      "user": 0.021510685454545455,
      "system": 0.008418060606060604,
      "min": 0.08332035564000001,
      "max": 0.09058966764000001,
      "times": [
        0.08539327364,
        0.08917268264,
        0.08787178564,
        0.08505936664000001,
        0.09057418764,
        0.08332035564000001,
        0.08809381364,
        0.08766975564,
        0.08834579764,
        0.08781968764,
        0.08689844564,
        0.08634650764,
        0.08903392164,
        0.08797415764000001,
        0.08576651564,
        0.08843882264,
        0.08505900564,
        0.08779690464,
        0.08747980864,
        0.08584383264,
        0.08684918364000001,
        0.09017024864,
        0.08534100564000001,
        0.08672686364,
        0.09058966764000001,
        0.08514991764,
        0.08886214864,
        0.08550103764,
        0.08746967064000001,
        0.08667108764,
        0.08645180464,
        0.08854613464000001,
        0.08707133064
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 888.4 ± 177.4 546.4 1091.3 1.10 ± 0.26
pacquet@main 804.4 ± 102.5 580.6 939.7 1.00
pnpm@HEAD 2893.4 ± 58.7 2773.7 2956.0 3.60 ± 0.46
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.88843465412,
      "stddev": 0.17739333160407733,
      "median": 0.94362186812,
      "user": 0.8139812088888889,
      "system": 0.20975981555555556,
      "min": 0.5464053521200001,
      "max": 1.09134492212,
      "times": [
        0.69478631312,
        0.9925558011200001,
        0.79618394912,
        0.9268325311200001,
        0.94362186812,
        1.05858873612,
        0.9455924141200001,
        0.5464053521200001,
        1.09134492212
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.8044327570088889,
      "stddev": 0.10248228472125374,
      "median": 0.8327194141200001,
      "user": 0.747595431111111,
      "system": 0.17031581555555556,
      "min": 0.58062765612,
      "max": 0.9397212721200001,
      "times": [
        0.71476258412,
        0.8628961691200001,
        0.9397212721200001,
        0.8327194141200001,
        0.84059611012,
        0.58062765612,
        0.8433785721200001,
        0.82695861912,
        0.79823441612
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.893384379675556,
      "stddev": 0.05870344150390176,
      "median": 2.90587769512,
      "user": 4.424940431111111,
      "system": 0.25405514888888886,
      "min": 2.77366203012,
      "max": 2.9559881741200003,
      "times": [
        2.95316701012,
        2.83488762312,
        2.77366203012,
        2.91712097112,
        2.8846087911200002,
        2.90587769512,
        2.9559881741200003,
        2.88389807312,
        2.9312490491200003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.501 ± 0.139 4.404 4.803 1.27 ± 0.06
pacquet@main 4.576 ± 0.166 4.404 4.868 1.29 ± 0.07
pnpr@HEAD 3.553 ± 0.130 3.460 3.855 1.00
pnpr@main 3.590 ± 0.133 3.433 3.778 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.501153640620001,
      "stddev": 0.1386927113304073,
      "median": 4.43411187792,
      "user": 1.7039418599999998,
      "system": 1.35391854,
      "min": 4.40408662292,
      "max": 4.80339828592,
      "times": [
        4.42938374692,
        4.43652528792,
        4.40408662292,
        4.42176643992,
        4.4294210969200005,
        4.47069060592,
        4.80339828592,
        4.43169846792,
        4.47143085892,
        4.713134992920001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.5755941920200005,
      "stddev": 0.16562233350283528,
      "median": 4.498271834920001,
      "user": 1.66872866,
      "system": 1.3735740400000003,
      "min": 4.40432292692,
      "max": 4.86794784092,
      "times": [
        4.4805999319200005,
        4.515943737920001,
        4.40432292692,
        4.45614939992,
        4.86794784092,
        4.47254703692,
        4.66581201792,
        4.67704573392,
        4.41530278592,
        4.8002705079200005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5533193075200002,
      "stddev": 0.13009443549577712,
      "median": 3.5181367524200002,
      "user": 1.1605046599999997,
      "system": 1.23859934,
      "min": 3.45993932892,
      "max": 3.85530797092,
      "times": [
        3.5579405469200003,
        3.71051072792,
        3.4610539139200003,
        3.52305974092,
        3.4661765679200003,
        3.85530797092,
        3.46293077292,
        3.5197912539200003,
        3.45993932892,
        3.51648225092
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5900814146200006,
      "stddev": 0.13277188357407252,
      "median": 3.56616672192,
      "user": 1.20400606,
      "system": 1.2075874399999997,
      "min": 3.43333518292,
      "max": 3.77764769392,
      "times": [
        3.47103999192,
        3.5680044569200002,
        3.56432898692,
        3.7575593029200003,
        3.50339576492,
        3.57464839992,
        3.43333518292,
        3.77764769392,
        3.7758987049200003,
        3.47495566092
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13255
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,565.12 ms
(-0.31%)Baseline: 2,573.17 ms
3,087.81 ms
(83.07%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,720.65 ms
(-0.12%)Baseline: 1,722.80 ms
2,067.35 ms
(83.23%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
380.96 ms
(-1.46%)Baseline: 386.60 ms
463.91 ms
(82.12%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
173.75 ms
(-1.56%)Baseline: 176.49 ms
211.79 ms
(82.04%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,351.44 ms
(-0.60%)Baseline: 2,365.62 ms
2,838.74 ms
(82.83%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,404.09 ms
(-0.69%)Baseline: 4,434.70 ms
5,321.63 ms
(82.76%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
240.46 ms
(-2.05%)Baseline: 245.48 ms
294.58 ms
(81.63%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
546.41 ms
(-36.59%)Baseline: 861.73 ms
1,034.07 ms
(52.84%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13255
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

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

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,429.20 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.11 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
297.85 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.31 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,367.50 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,459.94 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
263.60 ms
🐰 View full continuous benchmarking report in Bencher

pnpm login / pnpm adduser only read the --scope command-line flag; the
scope rc option in .npmrc and pnpm-workspace.yaml was ignored, unlike the
TypeScript pnpm CLI, which already treats scope as an rc option. This
closes a pacquet-only parity gap in the auth.ini contract; no TypeScript
change is required.

Add a scope field to Config, populated from the scope key in .npmrc (via
NpmrcAuth) and pnpm-workspace.yaml (via WorkspaceSettings), mirroring how
registry is resolved. The login CLI adapter now falls back to the resolved
config.scope when --scope is absent, with the flag still taking precedence.

Fixes #12893

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
@KSXGitHub
KSXGitHub force-pushed the claude/pacquet-login-scope-bug-9k2qz4 branch from d50cd7f to 67618f8 Compare July 23, 2026 21:17
claude added 2 commits July 23, 2026 21:41
Complete the scope rc-option mirror of registry: scope was resolved from
.npmrc and pnpm-workspace.yaml but not from the PNPM_CONFIG_SCOPE
environment variable, because WorkspaceSettings::from_pnpm_config_env (a
hand-maintained macro list) had no scope entry. registry is env-readable
via PNPM_CONFIG_REGISTRY, so scope must be too for parity.

Add the string_field!(scope, "SCOPE") env line and a matching env-overlay
test, and note the env source in the changeset.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
Brings in the native ci / clean-install command and the update --latest
catalog / node-gyp holdback from main. No files overlap with this
branch's scope changes, so the merge is conflict-free.
Brings in the GitHub Actions env-file persistence fix, the update --latest
resolver-decides-writes fix, and the opt-in GitHub Actions checks for
outdated / update. Only workspace_yaml.rs overlaps this branch's scope
changes, and git auto-merged it cleanly (main reworded the distant
UpdateSettings / UpdateConfig github_actions docs, far from the scope field).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@pnpm/crates/cli/src/cli_args/login/tests.rs`:
- Around line 89-120: Add a fixture-backed integration test that exercises the
actual login write path, covering config/environment-derived scope versus an
explicit --scope override. Assert that the resulting npmrc contains the scoped
authentication token and matching `@scope`:registry mapping, and verify both
precedence cases rather than only inspecting LoginOptions.scope.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 01a4896c-be46-4935-be69-d11562cf73f5

📥 Commits

Reviewing files that changed from the base of the PR and between f4ebdb9 and 4d46635.

📒 Files selected for processing (11)
  • .changeset/pacquet-login-scope-from-npmrc.md
  • pnpm/crates/cli/src/cli_args/login.rs
  • pnpm/crates/cli/src/cli_args/login/tests.rs
  • pnpm/crates/config/src/env_overlay.rs
  • pnpm/crates/config/src/env_overlay/tests.rs
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/npmrc_auth.rs
  • pnpm/crates/config/src/npmrc_auth/tests.rs
  • pnpm/crates/config/src/workspace_yaml.rs
  • pnpm/crates/config/src/workspace_yaml/tests.rs
  • pnpm/crates/package-manager/src/install_package_from_registry/tests.rs

claude added 2 commits July 29, 2026 20:44
Brings in 125 commits, including the pnpm 12 beta lane move, the
web-login-without-a-TTY feature, the unscoped .npmrc setting pinning, and
the resolver/dedupe parity work. Git auto-merged every overlapping file
(login tests, npmrc_auth, workspace_yaml, env_overlay, lib.rs) with no
conflicts; this branch's scope wiring is unchanged.
… scope

The adapter tests proved only that a config-derived scope reaches
LoginOptions.scope; the auth.ini write path was covered separately in
pacquet-auth-commands, which feeds LoginOptions.scope directly. Nothing
spanned both halves, so a future refactor decoupling login_options from
login could regress the feature with every test still green.

Add two execute-level tests that start from Config.scope and assert the
persisted auth.ini: a config-only scope writes the scoped _authToken plus
the @scope:registry mapping (and nothing unscoped), and --scope beats a
configured scope all the way to disk. Both were verified to fail when the
config fallback is dropped or its precedence inverted.

The auth.ini write is captured by extending login_host_fake! with an
opt-in auth_ini_writes helper, mirroring login_fake! in
pacquet-auth-commands.

Raised by CodeRabbit on #13255

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 29, 2026
Comment thread pnpm/crates/config/src/npmrc_auth.rs Resolved
@KSXGitHub
KSXGitHub marked this pull request as ready for review July 31, 2026 01:50
@KSXGitHub
KSXGitHub requested a review from zkochan as a code owner July 31, 2026 01:50
Copilot AI review requested due to automatic review settings July 31, 2026 01:50
@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (4): Last reviewed commit: "docs(pacquet/config): de-duplicate the s..." | Re-trigger Greptile

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.

Pull request overview

Fixes a pacquet-only parity gap where pnpm login / pnpm adduser ignored the scope rc option (from .npmrc, pnpm-workspace.yaml, and PNPM_CONFIG_SCOPE), causing scoped auth tokens and @scope:registry mappings to be persisted incorrectly compared to the TypeScript CLI.

Changes:

  • Add Config.scope to pacquet-config and plumb it through the existing config layering (npmrc, workspace yaml, env overlay).
  • Make the login CLI adapter fall back to config.scope when --scope is not provided (with the flag still taking precedence).
  • Add/extend tests to cover scope parsing and end-to-end auth.ini persistence for config-sourced scope, plus a changeset for the Rust-side fix.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm/crates/package-manager/src/install_package_from_registry/tests.rs Updates test config construction for the new Config.scope field.
pnpm/crates/config/src/workspace_yaml/tests.rs Adds coverage for parsing/applying scope from pnpm-workspace.yaml and precedence vs .npmrc.
pnpm/crates/config/src/workspace_yaml.rs Adds WorkspaceSettings.scope, env substitution support, and applies it onto Config.
pnpm/crates/config/src/npmrc_auth/tests.rs Adds coverage for reading scope= from .npmrc and applying it to Config.
pnpm/crates/config/src/npmrc_auth.rs Extends .npmrc parsing and layering to include top-level scope= (similar to registry=).
pnpm/crates/config/src/lib.rs Introduces Config.scope as a resolved default scope for login/adduser.
pnpm/crates/config/src/env_overlay/tests.rs Adds coverage for parsing scope from PNPM_CONFIG_SCOPE.
pnpm/crates/config/src/env_overlay.rs Adds scope to the env overlay fields (PNPM_CONFIG_SCOPE).
pnpm/crates/cli/src/cli_args/login/tests.rs Adds unit + end-to-end tests ensuring config-sourced scope affects persisted auth.ini the same as --scope.
pnpm/crates/cli/src/cli_args/login.rs Uses config.scope as the fallback when --scope is absent.
.changeset/pacquet-login-scope-from-npmrc.md Adds a patch changeset documenting the pacquet behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pnpm/crates/cli/src/cli_args/login.rs Resolved
Copilot AI review requested due to automatic review settings July 31, 2026 01:55

This comment was marked as outdated.

This comment was marked as resolved.

@KSXGitHub
KSXGitHub marked this pull request as draft July 31, 2026 21:28
pnpm does not honor `scope` from an .npmrc: readAndFilterNpmrc keeps only
auth/registry keys (isNpmrcReadableKey), and scope is in neither
NPM_AUTH_SETTINGS nor NETWORK_INI_KEYS, so a `scope=` line there is
dropped before it reaches the merged config. Parsing it in pacquet was
therefore a divergence, not the parity fix it was framed as.

Drop the .npmrc parsing (npmrc_auth.rs returns to its previous state) and
pin the behavior with a test asserting a `scope=` line is ignored. The
sources pnpm does honor stay: pnpm-workspace.yaml and the global
config.yaml via WorkspaceSettings, PNPM_CONFIG_SCOPE via the env overlay,
and --scope on the command line, which still wins.

Verified against the TypeScript reader: loadNpmrcFiles.ts:454 gates
.npmrc keys on isNpmrcReadableKey; addSettingsFromWorkspaceManifestToConfig
assigns any camelCase yaml key; parseEnvVars accepts a PNPM_CONFIG_* key
whose schema resolves in `types`, which includes scope via npmConfigTypes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
@KSXGitHub KSXGitHub changed the title fix(pacquet/login): honor scope rc option fix(pacquet/login): honor the scope setting Jul 31, 2026
claude added 6 commits August 1, 2026 12:40
The scope tests all sat at the unit level — WorkspaceSettings::apply_to,
from_pnpm_config_env, NpmrcAuth::apply_to, login_options — so nothing
exercised the assembled Config::current pipeline. That is the layer where a
setting can be silently swallowed by a filter, which is exactly what .npmrc
does to scope, so it is the layer worth pinning.

Add two tests alongside the existing registry-from-yaml one: a
pnpm-workspace.yaml scope reaches Config::current (and beats an .npmrc
scope), and an .npmrc scope on its own never does. Verified non-vacuous by
removing the yaml apply, which fails the first and correctly leaves the
second passing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
Brings in 42 commits, including the pnpm 11.19.0 / pacquet 12.0.0-beta.2
releases, the resolver and peer-hoisting performance work, and the napi
readConfig additions.

Git merged every overlapping file without a textual conflict, but one
change needed a semantic fixup: #13277 argument-gates `web_auth_fake!`, so
the two scope tests added on this branch had to name the helpers they use
(`FakeHost`, `RecordingReporter`, `set_fetch`) instead of calling the macro
bare. Without it the crate would still merge cleanly and then fail to
compile.
LoginOptions::scope still documented itself as "the --scope value", which
stopped being true once the adapter began falling back to the resolved
setting; a reader consulting the contract would conclude the setting is not
honored. normalize_scope's doc had the same flag-only framing.

The tests had three weaknesses. Nothing pinned that scope must survive
clear_workspace_only_fields, so adding it to that list — a long roster of
plausible-looking workspace-only knobs — would have silently removed the
global config.yaml source with every test still green; a guard now covers
it, verified by adding scope to the list and watching it fail. The
Config::current test claimed yaml beat an .npmrc scope, a contest .npmrc
cannot enter, so it is renamed to what it actually proves and the .npmrc
half is left to the test that covers it non-vacuously. And the npmrc test's
doc re-listed the scope sources for a third time.

Also add the compile_error! fallback arm that login_host_fake!'s own doc
implies by claiming to mirror login_fake!, so a mistyped helper reports the
valid names instead of "no rules expected this token".

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
pnpm turns a --config.<key>=<value> token into a plain cli option:
normalizeOptions strips the `config.` prefix, so --config.scope=@org
reaches config.scope the same way --scope does. pacquet strips those
tokens out of argv itself and only re-applies a curated set, which already
included registry but not scope — so the sibling settings behaved
differently after this branch taught login to read the scope setting.

Add scope to ConfigOverrides alongside registry. Verified the test fails
when the new `set` arm is dropped.

Also state the callee contract on LoginOptions::scope instead of narrating
where the value came from, which the adapter already shows and which left
the field describing its resolution while its `registry` sibling described
its contract, and note the .npmrc exclusion in the changeset since that is
where npm users would expect `scope=` to work.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V8DMrvmeGcZWqJsA3v4co3
…ypeScript

An empty `PNPM_CONFIG_SCOPE=` must override a scope set by a lower-priority
layer (`pnpm-workspace.yaml`, global `config.yaml`) so `pnpm login` records an
unscoped token — the way the TypeScript CLI's env pass does, since it skips
only an absent variable, never an empty one. Reading `scope` through
`read_env` dropped the empty value and let the lower layer's scope leak
through, diverging from the TypeScript CLI in the on-disk `auth.ini`.

Route `scope` through `read_env_allow_empty`, joining `savePrefix` as the
exception where `""` is observably different from unset, and cover the case
with a test.

@KSXGitHub KSXGitHub left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Claude Code,

Below are many different reviews. Each may belong to different categories.

I wish that you do not collapse all the unrelated tasks into a single commit.

You shall analyze the reviews. You shall make groups of related reviews.

Each group of related reviews correspond to a task and a git commit.

A git commit should have its purpose clear and focused.

If there would be multiple groups of related reviews, then I expect multiple commits.

claude and others added 3 commits August 3, 2026 04:40
The second paragraph of the `login_host_fake!` doc comment restated what the
macro's `auth_ini_writes` argument already conveys and duplicated the rationale
that lives on `login_fake!` in `pacquet-auth-commands`. Per pnpm/CLAUDE.md, a
test's documentation should not re-narrate what the code says; drop it and keep
the one-line contract.
Bind the fake `-/v1/login` handshake body to a `body` local before building the
mock, instead of inlining the `serde_json::json!(...).to_string()` expression in
the `with_body(...)` call. With the argument now short, rustfmt reflows the
builder chain onto one line; the calls and their order are unchanged.
Format the fake `-/v1/login` handshake body as a multi-line
`serde_json::json!` object instead of a single long line.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pnpm/crates/config/src/workspace_yaml.rs (1)

531-535: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep unrelated saveExact behavior out of this scope-only PR.

The PR objective is login scope resolution. These changes add separate workspace and environment configuration behavior. Revert them unless this PR intentionally includes saveExact. If retained, add matching parity tests and a changeset that names the affected Rust package.

  • pnpm/crates/config/src/workspace_yaml.rs#L531-L535: remove the new WorkspaceSettings.save_exact field, or document and test the feature as part of this PR.
  • pnpm/crates/config/src/workspace_yaml.rs#L1046-L1046: remove save_exact from the workspace application list, or complete its configuration contract.
  • pnpm/crates/config/src/env_overlay.rs#L271-L271: remove SAVE_EXACT parsing, or add complete end-to-end coverage and release documentation.

As per path instructions, keep the change limited to the scope feature and describe each user-visible Rust behavior in the matching changeset.

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

In `@pnpm/crates/config/src/workspace_yaml.rs` around lines 531 - 535, Remove the
unrelated saveExact configuration changes: delete WorkspaceSettings.save_exact
in pnpm/crates/config/src/workspace_yaml.rs:531-535, remove save_exact from the
workspace application list in
pnpm/crates/config/src/workspace_yaml.rs:1046-1046, and remove SAVE_EXACT
parsing in pnpm/crates/config/src/env_overlay.rs:271-271. Keep this PR limited
to login scope resolution.

Source: Path instructions

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

Nitpick comments:
In `@pnpm/crates/config/src/workspace_yaml.rs`:
- Around line 531-535: Remove the unrelated saveExact configuration changes:
delete WorkspaceSettings.save_exact in
pnpm/crates/config/src/workspace_yaml.rs:531-535, remove save_exact from the
workspace application list in
pnpm/crates/config/src/workspace_yaml.rs:1046-1046, and remove SAVE_EXACT
parsing in pnpm/crates/config/src/env_overlay.rs:271-271. Keep this PR limited
to login scope resolution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a332dce5-33d3-4fbb-9339-f7c3b9fbd0bc

📥 Commits

Reviewing files that changed from the base of the PR and between c542c36 and 9117f41.

📒 Files selected for processing (12)
  • .changeset/pacquet-login-scope-setting.md
  • pnpm/crates/auth-commands/src/login.rs
  • pnpm/crates/cli/src/cli_args/login/tests.rs
  • pnpm/crates/cli/src/config_overrides.rs
  • pnpm/crates/cli/src/config_overrides/tests.rs
  • pnpm/crates/config/src/env_overlay.rs
  • pnpm/crates/config/src/env_overlay/tests.rs
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/npmrc_auth/tests.rs
  • pnpm/crates/config/src/tests.rs
  • pnpm/crates/config/src/workspace_yaml.rs
  • pnpm/crates/config/src/workspace_yaml/tests.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/pacquet-login-scope-setting.md
  • pnpm/crates/config/src/env_overlay/tests.rs
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/workspace_yaml/tests.rs

claude added 2 commits August 3, 2026 05:53
…mment

The reworded doc comment dropped the subject from one sentence, leaving a
fragment ("For nearly every setting that is indistinguishable from leaving
it unset, which is why read_env drops it"). Restore "an empty value is" so
the sentence reads as intended.
The call-site comment restated the empty-value clobber/parity rationale
already documented on read_env_allow_empty, which it references. Per the
comment policy, keep the shared "why" in one place: trim the call site to
its local point (scope breaks the string_field! pattern to keep an empty
value) and defer to the referenced doc.
@KSXGitHub
KSXGitHub marked this pull request as ready for review August 3, 2026 13:23
Copilot AI review requested due to automatic review settings August 3, 2026 13:23

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@zkochan
zkochan merged commit 37b387f into main Aug 3, 2026
35 checks passed
@zkochan
zkochan deleted the claude/pacquet-login-scope-bug-9k2qz4 branch August 3, 2026 13:46
KSXGitHub pushed a commit that referenced this pull request Aug 4, 2026
The pending changeset from #13255 still advertised
`pnpm-workspace.yaml` as a source for the login `scope`, which this
branch removes. Both intents are consumed by the same release, so the
notes would have announced the setting and its removal side by side.
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.

pacquet login/adduser ignores the scope .npmrc/rc option (only reads --scope)

5 participants