You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #12491 moved the pickFetcher call in resolveAndFetch (pnpm11/installing/package-requester/src/packageRequester.ts) so that it now runs eagerly for every resolved package, before the skip-fetch early return:
Previously pickFetcher ran lazily, only inside the actual download path (fetcher()), i.e. only on a store cache miss. Now it is invoked once per resolved package regardless of whether the package is:
a store cache hit (the bulk of a warm-cache install),
skipped via --lockfile-only / skipFetch, or
not installable on the current platform (optional deps for another OS).
Impact
For each of those packages the install now pays for:
classifyResolution(), which does a .toLowerCase() URL classification per tarball resolution, and
with custom-fetcher hooks configured, an await customFetcher.canFetch(...) per custom fetcher per package — potentially expensive async work that previously only ran on cache misses.
This is a small, hot-path inefficiency. It is not a measured regression in the current pacquet Bencher suite (the registry-mock fixtures are small and it stays within noise), but it is unnecessary work on large real-world installs, especially with custom fetchers.
Proposed fix
Only select a fetcher eagerly when its resolutionNeedsFetch signal can actually be non-false: when custom fetchers are present, or for a tarball-shaped resolution (resolution.type == null) whose integrity is missing. Otherwise leave fetcherForResolution undefined and let the fetch path pick lazily on a cache miss (the pre-#12491 behavior). variations must continue to never go through pickFetcher.
A working patch (verified against the package-requester test suite, 27/27 passing) gates the call like this:
This keeps the common registry-tarball-with-integrity path off the pickFetcher path entirely, while preserving the integrity-population behavior #12491 added (integrity-less remote tarballs still set resolutionNeedsFetch).
Written by an agent (Claude Code, claude-opus-4-8).
This discussion was converted from issue #12583 on September 26, 2026 11:07.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
PR #12491 moved the
pickFetchercall inresolveAndFetch(pnpm11/installing/package-requester/src/packageRequester.ts) so that it now runs eagerly for every resolved package, before the skip-fetch early return:Previously
pickFetcherran lazily, only inside the actual download path (fetcher()), i.e. only on a store cache miss. Now it is invoked once per resolved package regardless of whether the package is:--lockfile-only/skipFetch, orImpact
For each of those packages the install now pays for:
classifyResolution(), which does a.toLowerCase()URL classification per tarball resolution, andawait customFetcher.canFetch(...)per custom fetcher per package — potentially expensive async work that previously only ran on cache misses.This is a small, hot-path inefficiency. It is not a measured regression in the current pacquet Bencher suite (the registry-mock fixtures are small and it stays within noise), but it is unnecessary work on large real-world installs, especially with custom fetchers.
Proposed fix
Only select a fetcher eagerly when its
resolutionNeedsFetchsignal can actually be non-false: when custom fetchers are present, or for a tarball-shaped resolution (resolution.type == null) whose integrity is missing. Otherwise leavefetcherForResolutionundefined and let the fetch path pick lazily on a cache miss (the pre-#12491 behavior).variationsmust continue to never go throughpickFetcher.A working patch (verified against the package-requester test suite, 27/27 passing) gates the call like this:
This keeps the common registry-tarball-with-integrity path off the
pickFetcherpath entirely, while preserving the integrity-population behavior #12491 added (integrity-less remote tarballs still setresolutionNeedsFetch).Written by an agent (Claude Code, claude-opus-4-8).
All reactions