Repository navigation
[rush] Close native pnpm compatibility gaps - #6131
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The install-critical changes hinge on external native-pnpm-12 behavior (env-var prefixes and CLI/flag parsing) that cannot be verified here, warranting human validation.
0 open findings
What changed in this PR
This PR closes five independently scoped compatibility gaps for native pnpm (v11/v12) while preserving behavior for earlier pnpm versions. It fits into @microsoft/rush's install pipeline, which must branch on the pnpm major version because native pnpm changes config/CLI/env semantics (e.g., pnpm 12 ignores NPM_CONFIG_* env vars and no longer reads several settings from .npmrc). Each fix is paired with focused regression tests and a change entry.
Changes:
- Normalize v9 lockfile importers even when a workspace-only/empty graph omits the
snapshotssection (PnpmShrinkwrapFile.tsnow converts for any lockfile major version ≥ 9 instead of gating onsnapshots). - Preserve Rush
auto-install-peers/resolution-modedefaults (and warn) when pnpm 11+ ignores obsolete.npmrcsettings, and pass an explicit=trueforignoreCompatibilityDbto native pnpm 12. - Use the native
PNPM_CONFIG_prefix for store/cache/state dirs inrush-pnpm, and reject--resolution-onlybefore any install side effects on pnpm 12+.
| File | Description |
|---|---|
libraries/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts |
Convert v9+ lockfiles even without a snapshots section so workspace-only importers normalize correctly. |
libraries/rush-lib/src/logic/base/BaseInstallManager.ts |
Gate .npmrc-derived peer/resolution settings on pnpm < 11, warn when ignored, and pass explicit ignoreCompatibilityDb=true for pnpm 12+. |
libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts |
Choose PNPM_CONFIG_/NPM_CONFIG_ env prefix for store/cache/state by pnpm major; add _executeForTestingAsync hook. |
libraries/rush-lib/src/cli/actions/InstallAction.ts |
Reject --resolution-only for pnpm 12+ before project selection; update parameter description and fix a typo. |
libraries/rush-lib/src/logic/pnpm/PnpmOptionsConfiguration.ts |
Update doc comments to reflect pnpm 11+ ignoring .npmrc for these settings. |
libraries/rush-lib/src/logic/pnpm/test/PnpmShrinkwrapFile.test.ts |
New tests for snapshot-less v9 importer normalization. |
libraries/rush-lib/src/logic/test/BaseInstallManager.test.ts |
New tests for config-arg generation across pnpm versions/npmrc states. |
libraries/rush-lib/src/cli/test/RushPnpmCommandLineParser.test.ts |
New tests for env prefix/override precedence per pnpm version. |
libraries/rush-lib/src/cli/test/InstallAction.test.ts |
New tests for the --resolution-only rejection path. |
common/changes/@microsoft/rush/*.json (5) |
Change entries for the five fixes. |
No blocking in-diff issues were found: the enum/import for ShrinkwrapFileMajorVersion.V9 exist, convertLockfileV9ToLockfileObject safely handles missing snapshots (snapshots ?? {}), semver is imported where used, test fixtures resolve, and the pnpm-version branching is consistent with existing codebase patterns. One note for human attention: correctness depends on external pnpm 12 runtime semantics (env-var prefix, ignoreCompatibilityDb flag parsing) that cannot be fully verified in this environment, and the adjacent unchanged NPM_CONFIG_WORKSPACE_DIR (line 531) is left with the legacy prefix.
🧠 Review effort: Max
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep importer normalization active when a native workspace-only lockfile omits snapshots. Preserve earlier lockfile paths and the focused regressions. Original-Support-Commit: 8d508eec12c33c38a5573594148e9106c6c07e62 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bedb50cb-fcd4-4dc4-83b9-dba6064e5498
Use native pnpm's prefix for store, cache and state while retaining older-manager precedence. Exercise the current branded parser through the existing controlled-test pattern instead of accessing removed TypeScript private fields. Original-Support-Commit: 840e38962d236834bb2cf962ca584a6aab2953cd Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bedb50cb-fcd4-4dc4-83b9-dba6064e5498
Original-Support-Commit: b76cc141b6be5652c3d55c8721aec0a4ba01fdcb Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bedb50cb-fcd4-4dc4-83b9-dba6064e5498
Original-Support-Commit: 33003805b0d30348beef651ce019b70d11a48221 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bedb50cb-fcd4-4dc4-83b9-dba6064e5498
Preserve the existing compatibility database policy with an explicit native boolean, without changing legacy pnpm arguments. Original-Support-Commit: acfc4d4a9956e1f3635b000b66c3f54c204a33e8 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bedb50cb-fcd4-4dc4-83b9-dba6064e5498
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
a084c66 to
d5fb75a
Compare
Summary
Close five independently scoped compatibility gaps for native pnpm, preserving
the existing behavior for earlier pnpm versions:
the legacy argument form for pnpm 8, 10 and 11.
Each fix has its own commit, focused regressions and a change entry. The
store-environment tests use the current controlled-constructor test pattern
rather than accessing ECMAScript private members.
Validation
metadata was normalized to the repository's required noreply identity.
Scope and dependencies
This SUPPORT PR does not select pnpm 12 for this repository or change dependency
versions, build approvals, trust policy or release-age policy.
Existing #6119 addresses copying back a changed temporary lockfile after
rush update. It remains a separate dependency for complete native updatesupport and is deliberately not duplicated in this diff.
Injected-dependency synchronization and opt-in lock-retaining autoinstaller
reconciliation are separate SUPPORT changes. Repository adoption is a separate
USE change, with its own frozen-install, integrity, peer-graph and build gates.