Skip to content

fix(rush-lib): suppress --prefer-frozen-lockfile during --lockfile-only phase (pnpm v10)#5801

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-broken-lockfile-with-pnpm-v10
Draft

fix(rush-lib): suppress --prefer-frozen-lockfile during --lockfile-only phase (pnpm v10)#5801
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-broken-lockfile-with-pnpm-v10

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

Bug Fix

What was the bug?

Enabling both usePnpmPreferFrozenLockfileForRushUpdate and usePnpmLockfileOnlyThenFrozenLockfileForRushUpdate together silently breaks rush update on pnpm v10. The two-phase install's Phase 1 was receiving --prefer-frozen-lockfile --lockfile-only simultaneously. In pnpm v10's v9 lockfile format (packages:/snapshots: split), this combination causes pnpm to write a lockfile containing only importers:, omitting packages: and snapshots: entirely. Phase 2 (--frozen-lockfile) then immediately fails:

ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY  Broken lockfile: no entry for '<package>@<version>' in pnpm-lock.yaml

How did you fix it?

In BaseInstallManager.pushConfigurationArgs, add !onlyShrinkwrap to the usePnpmPreferFrozenLockfileForRushUpdate guard so that --prefer-frozen-lockfile is never emitted during the Phase 1 lockfile-write step:

- } else if (experiments.usePnpmPreferFrozenLockfileForRushUpdate) {
+ } else if (experiments.usePnpmPreferFrozenLockfileForRushUpdate && !onlyShrinkwrap) {

This falls through to --no-prefer-frozen-lockfile for Phase 1, ensuring a full resolution and a complete lockfile. --prefer-frozen-lockfile continues to apply for single-phase rush update.

Scenario Phase 1 flags Phase 2 flags
Two-phase rush update (both experiments on) --no-prefer-frozen-lockfile --lockfile-only --frozen-lockfile
Single-phase rush update --prefer-frozen-lockfile n/a
rush install --frozen-lockfile n/a

Testing

Added a test to BaseInstallManager.test.ts asserting that when usePnpmPreferFrozenLockfileForRushUpdate is enabled, --prefer-frozen-lockfile is absent from the args when onlyShrinkwrap: true, and present when onlyShrinkwrap: false.

@github-project-automation github-project-automation Bot moved this to Needs triage in Bug Triage May 11, 2026
Copilot AI changed the title fix: do not pass --prefer-frozen-lockfile during --lockfile-only phase with pnpm v10 fix(rush-lib): suppress --prefer-frozen-lockfile during --lockfile-only phase (pnpm v10) May 11, 2026
Copilot AI requested a review from bmiddha May 11, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants