Skip to content

[rush] Avoid unnecessary package manager install lock#5844

Open
EscapeB wants to merge 1 commit into
microsoft:mainfrom
EscapeB:codex/package-manager-install-lock
Open

[rush] Avoid unnecessary package manager install lock#5844
EscapeB wants to merge 1 commit into
microsoft:mainfrom
EscapeB:codex/package-manager-install-lock

Conversation

@EscapeB

@EscapeB EscapeB commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR extracts the package-manager install lock optimization from #5830 into a standalone change.

Rush now skips acquiring the global package manager install lock when the requested package manager is already installed and no matching install lock file exists. If a lock file exists, Rush still acquires the lock to preserve stale/dirty recovery behavior.

Testing

node common/scripts/install-run-rush.js test --to @microsoft/rush-lib --verbose

path: `${tempFolderPath}/rush-global`,
nodeSpecificPath: `${tempFolderPath}/rush-global/node-${process.version}`
} as RushGlobalFolder;
const packageManagerToolFolder: string = path.join(rushGlobalFolder.nodeSpecificPath, 'pnpm-10.27.0');

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.

How is this version of pnpm selected, and when was it installed? I don't see anything mocking the file system checks to ensure that the version exists and/or writing files to do so.

packageManagerToolVersion: '10.27.0'
} as RushConfiguration;

await InstallHelpers.ensureLocalPackageManagerAsync(rushConfiguration, rushGlobalFolder, 1, true);

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.

Ensure that the lockAcquireSpy returns false so that the test doesn't try to actually install the package if something goes wrong.

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