Skip to content

perf(npm-resolver): cache meta in memory for exact version matches. - #12458

Merged
zkochan merged 4 commits into
pnpm:mainfrom
rtarpine-vanta:rct/version-cache
Jun 19, 2026
Merged

zkochan merged 4 commits into
pnpm:mainfrom
rtarpine-vanta:rct/version-cache

Conversation

@rtarpine-vanta

@rtarpine-vanta rtarpine-vanta commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In pickPackage(), cache the parsed package metadata in memory after reading it
from disk for exact version matches. Without this, the same metadata was read
and parsed from disk repeatedly. In a large monorepo this brings the time for
adding a new package down from minutes to seconds.

While populating the in-memory cache on the exact-version disk fast path, the
cache key is now also scoped by the registry. The on-disk mirror was already
registry-qualified, but the in-memory metaCache key was only the package name
(plus a :full suffix). A package of the same name served by two registries in
one install (e.g. the default registry plus a gh:/named registry) could
collide on a single cache slot and resolve the wrong tarball/integrity. The
network-fetch path already populated this registry-blind cache, so the gap was
pre-existing — but having the disk fast path populate it too made the collision
reachable on the common warm-cache path. The cache key is now registry-qualified
end to end, including the verifier's shared-meta reads, which already documented
this as the prerequisite for a registry-qualified read.

Squash Commit Body

On the exact-version disk fast path in pickPackage(), promote the parsed
packument into the in-memory metaCache so later resolutions of the same package
in one install skip the disk read and parse. In large monorepos this brings
adding a package down from minutes to seconds.

The in-memory cache key is now registry-qualified via a shared
getPkgMetaCacheKey(registry, name, fullMetadata) helper. Previously the key was
only the package name (plus a `:full` suffix) while the on-disk mirror was
registry-qualified, so a package of the same name served by two registries in
one install could share one cache slot and resolve the wrong tarball/integrity.
The registry is threaded through createNpmResolutionVerifier's shared-meta reads
(readSharedMeta / readSharedMetaForTrust), which already noted that a
registry-qualified read required the resolver's metaCache key shape to change
first. Added a regression test that resolves the same package name from two
registries and asserts each gets its own tarball.

The Rust pacquet port already implements both behaviors (registry-scoped cache
key and disk-fast-path cache population), so no port is required.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ port — pacquet already scopes its in-memory cache key by registry
    and populates it on the disk fast path, so no port was needed.
  • Added a changeset.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-4-8).

Summary by CodeRabbit

Bug Fixes

  • Fixed package metadata caching to be registry-qualified, preventing cache collisions when resolving the same package name from multiple registries in one install.
  • Fixed checksum update behavior so updateChecksums always revalidates from the registry, bypassing both warm in-memory cache and the on-disk exact-version fast path.
  • Improved cache warming by promoting disk-loaded exact-version metadata into the in-memory cache for faster subsequent resolutions.

Tests

  • Added coverage for registry-specific cache keys, disk-to-memory promotion behavior, and updateChecksums cache-bypass scenarios.

@rtarpine-vanta
rtarpine-vanta requested a review from zkochan as a code owner June 16, 2026 21:41
@welcome

welcome Bot commented Jun 16, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (5) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Cross-registry meta cache pollution 🐞 Bug ⛨ Security
Description
pickPackage() now stores disk-loaded metadata in ctx.metaCache under a cache key that omits the
registry, so later resolutions of the same name from a different registry can reuse the wrong
packument and resolve the wrong tarball/integrity. This can break installs (wrong host/auth) and can
install the wrong package when the same name/version exists in multiple registries.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The cache key used for ctx.metaCache is derived only from the package name (and :full), while the
disk mirror path is derived from opts.registry; caching the disk-loaded packument under the
name-only key enables returning registry A’s packument when resolving against registry B. The
resolved tarball URL is taken directly from the picked manifest’s dist.tarball, so using the wrong
packument can fetch/install from the wrong registry host; the verifier code explicitly documents
this registry-blind key limitation.

resolving/npm-resolver/src/pickPackage.ts[210-217]
resolving/npm-resolver/src/pickPackage.ts[276-288]
resolving/npm-resolver/src/index.ts[495-509]
resolving/npm-resolver/src/index.ts[588-592]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`pickPackage()` caches packuments in `ctx.metaCache` using a key derived only from `spec.name` (and `:full`). This PR adds an additional `metaCache.set()` on the disk fast-path, which makes registry-specific on-disk mirrors (keyed by `opts.registry`) now leak into a registry-agnostic in-memory cache entry.
As a result, if the same package name is resolved from two different registries in one process/install (e.g. default registry + `gh:` named registry), the second resolution can return the first registry’s packument and therefore use the wrong `dist.tarball`/integrity.
## Issue Context
- The on-disk mirror path is registry-qualified (`getPkgMirrorPath(..., opts.registry, spec.name)`), but the in-memory key is not.
- Downstream resolution uses `pickedPackage.dist.tarball` (from the packument) to decide what to download.
- The verifier already documents this as a known limitation; this PR expands the scenarios where it can happen by caching disk reads too.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[210-217]
- resolving/npm-resolver/src/pickPackage.ts[276-288]
- resolving/npm-resolver/src/pickPackage.ts[439-442]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. updateChecksums cache bypass 🐞 Bug ≡ Correctness
Description
pickPackage() now populates ctx.metaCache from the on-disk exact-version fast path, so a later call
with updateChecksums:true can return early from the in-memory cache without making the intended
conditional registry request. This can defeat checksum-repair / revalidation flows for callers that
reuse a resolver instance across calls with different updateChecksums values.
Code

resolving/npm-resolver/src/pickPackage.ts[R284-288]

      try {
        const pickedPackage = pickMatchingVersionFast(pickerOpts, spec, metaCachedInStore)
        if (pickedPackage) {
+            ctx.metaCache.set(cacheKey, metaCachedInStore)
          return {
Evidence
The code documents that updateChecksums relies on in-memory cache entries being populated only by
fresh network fetches, but the PR now writes disk-loaded metadata into the in-memory cache on the
exact-version fast path; meanwhile, the function still short-circuits on any in-memory cache hit
before considering updateChecksums.

resolving/npm-resolver/src/pickPackage.ts[66-82]
resolving/npm-resolver/src/pickPackage.ts[201-241]
resolving/npm-resolver/src/pickPackage.ts[279-292]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`PickPackageOptions.updateChecksums` is documented to skip the on-disk exact-version fast path so stale disk metadata cannot satisfy the call without a conditional registry request. This PR now seeds `ctx.metaCache` from that disk fast path; subsequent calls can short-circuit on the in-memory cache before reaching any revalidation logic, undermining `updateChecksums`.
## Issue Context
- `pickPackage()` unconditionally returns from `ctx.metaCache.get(cacheKey)` hits.
- The exact-version disk fast path now does `ctx.metaCache.set(cacheKey, metaCachedInStore)`.
- The option doc explicitly assumes metaCache entries only come from the current install’s network fetches.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[66-82]
- resolving/npm-resolver/src/pickPackage.ts[201-241]
- resolving/npm-resolver/src/pickPackage.ts[279-292]
## Suggested change
When `opts.updateChecksums === true`, do not return early from the in-memory `metaCache` (or only return if you can prove the entry was fetched/validated via network in this run). A simple, safe approach is:
- if `opts.updateChecksums` is true, skip the `cachedMeta` early-return path and proceed to the conditional-fetch logic (you may still use cachedMeta as a source of etag/modified headers if helpful).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Registry key not canonical 🐞 Bug ➹ Performance
Description
getPkgMetaCacheKey() keys the cache by the raw registry string, but the resolver and verifier can
produce different canonical forms for the same logical named registry (notably trailing slash). This
reduces shared cache hit rate (resolver↔verifier) and can cause duplicate in-memory entries for the
same registry/package pair.
Code

resolving/npm-resolver/src/pickPackage.ts[R594-606]

+/**
+ * Key for the in-memory `metaCache` holding a package's registry metadata. The
+ * registry is part of the key so that a package of the same name served by two
+ * registries in one install can't collide on a single slot (which would resolve
+ * the wrong tarball/integrity); `fullMetadata` keeps the abbreviated and full
+ * documents in distinct slots. `\x00` can't appear in a registry URL or a
+ * package name, so it's an unambiguous separator. The verifier reads this same
+ * cache and must build the key with this function.
+ */
+export function getPkgMetaCacheKey (registry: string, pkgName: string, fullMetadata: boolean): string {
+  const key = `${registry}\x00${pkgName}`
+  return fullMetadata ? `${key}:full` : key
+}
Evidence
The cache key is built directly from registry without normalization, while the resolver preserves
user-provided named registry URLs verbatim and the verifier canonicalizes named registry prefixes to
end with / and may return those prefixes as the registry value; this makes it possible for
resolver and verifier to compute different keys for the same logical registry.

resolving/npm-resolver/src/pickPackage.ts[594-606]
resolving/npm-resolver/src/index.ts[651-663]
resolving/npm-resolver/src/index.ts[698-745]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[131-153]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[846-868]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`getPkgMetaCacheKey(registry, name, full)` uses the registry string verbatim. In the same process, the resolver may use a user-supplied named registry URL as-is, while the verifier routes by a canonicalized prefix that always ends in `/`. With registry-qualified keys, that mismatch prevents reuse of the shared `metaCache` and can create duplicate slots.
## Issue Context
- Resolver: `mergeNamedRegistries()` stores user-defined URLs without normalization.
- Resolver: `pickFromSimpleRegistry()` passes that registry string into `pickPackage()`.
- Verifier: `namedRegistryPrefixes` are canonicalized to include a trailing slash, and `pickRegistryForVersion()` can return that canonical prefix.
- Both sides then call `getPkgMetaCacheKey()` with potentially different registry strings.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[594-606]
- resolving/npm-resolver/src/index.ts[651-663]
- resolving/npm-resolver/src/index.ts[698-745]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[131-153]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[846-868]
## Suggested change
Canonicalize the registry string used in the key, e.g.:
- Normalize in `getPkgMetaCacheKey()` (preferred: single source of truth), using the project’s existing registry normalization helper and ensuring consistent trailing-slash behavior.
OR
- Normalize `namedRegistries` values when building `ctx.namedRegistries` so resolver and verifier converge on the same string form.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Packument heap retention risk 🐞 Bug ➹ Performance
Description
Caching disk-loaded packuments on the exact-version fast path increases how many PackageMeta
objects can be retained concurrently in the shared metaCache, raising peak heap/GC pressure in
large resolutions. This is especially risky when fullMetadata is in play because the codebase
already treats “full packument kept resident” as an OOM risk in large workspaces.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The codebase explicitly calls out that metadata can be megabytes and that keeping full packuments
resident across large workspaces can OOM. This PR adds a new path that retains disk-loaded
packuments in the shared LRU (max=10000), increasing peak resident metadata compared to prior
behavior on this fast path.

resolving/npm-resolver/src/pickPackage.ts[318-321]
resolving/npm-resolver/src/index.ts[1095-1099]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[482-488]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new cache write increases the number of metadata documents retained in memory. Since packuments can be very large, retaining many of them simultaneously can increase GC overhead or even exhaust heap in large workspaces.
## Issue Context
- The resolver notes metadata files can be megabytes.
- The default `PackageMetaCache` is an LRU with `max: 10000` and `ttl: 120s`.
- Other code paths explicitly project full packuments down to avoid OOMs.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[276-289]
- resolving/npm-resolver/src/index.ts[1095-1099]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[482-488]
### Suggested approach
- Consider adding a `maxSize` + `sizeCalculation` to the LRU so the cache is bounded by estimated memory cost, not just entry count.
- Consider avoiding caching full packuments for the disk fast path (e.g. cache only the picked version manifest / minimal projection when `spec.type === 'version'`).
- If a separate disk-parse cache is introduced (see other finding), make it small and short-lived, so it cannot accumulate many megabyte-scale entries.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

5. Registry URL parse overhead 🐞 Bug ➹ Performance
Description
getPkgMetaCacheKey() canonicalizes the registry via new URL(registry) each time a cache key is
built, which happens on every pickPackage() call and verifier shared-cache read. Now that many
resolutions will be served from memory/disk without network I/O, this extra per-dependency parsing
can become measurable in large dependency graphs.
Code

resolving/npm-resolver/src/pickPackage.ts[R614-626]

+export function getPkgMetaCacheKey (registry: string, pkgName: string, fullMetadata: boolean): string {
+  const key = `${canonicalizeRegistry(registry)}\x00${pkgName}`
+  return fullMetadata ? `${key}:full` : key
+}
+
+function canonicalizeRegistry (registry: string): string {
+  try {
+    const parsed = new URL(registry)
+    const pathname = parsed.pathname.endsWith('/') ? parsed.pathname : `${parsed.pathname}/`
+    return `${parsed.origin}${pathname}`
+  } catch {
+    return registry
+  }
Evidence
The cache key is computed on every resolution (pickPackage()), and canonicalization performs a URL
parse (new URL(registry)), adding per-call work on a hot path.

resolving/npm-resolver/src/pickPackage.ts[210-226]
resolving/npm-resolver/src/pickPackage.ts[614-626]
resolving/npm-resolver/src/index.ts[258-269]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`getPkgMetaCacheKey()` calls `canonicalizeRegistry()` which uses `new URL(registry)` on every key construction. This adds avoidable overhead on the dependency-resolution hot path.
### Issue Context
This key is computed for each `pickPackage()` call, and the verifier also uses it when consulting the resolver’s shared meta cache.
### Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[614-626]
- resolving/npm-resolver/src/pickPackage.ts[216-226]
- resolving/npm-resolver/src/index.ts[258-269]
### Suggested fix
Memoize canonicalization results (e.g., `Map<string,string>` keyed by the raw registry string) or pre-canonicalize registry once at resolver construction and pass the canonical form through, so repeated picks don’t re-parse the same registry URL.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 5785a04

Results up to commit 5c6c040


🐞 Bugs (5) 📘 Rule violations (0) 📜 Skill insights (0)


Action required
1. Cross-registry meta cache pollution 🐞 Bug ⛨ Security
Description
pickPackage() now stores disk-loaded metadata in ctx.metaCache under a cache key that omits the
registry, so later resolutions of the same name from a different registry can reuse the wrong
packument and resolve the wrong tarball/integrity. This can break installs (wrong host/auth) and can
install the wrong package when the same name/version exists in multiple registries.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The cache key used for ctx.metaCache is derived only from the package name (and :full), while the
disk mirror path is derived from opts.registry; caching the disk-loaded packument under the
name-only key enables returning registry A’s packument when resolving against registry B. The
resolved tarball URL is taken directly from the picked manifest’s dist.tarball, so using the wrong
packument can fetch/install from the wrong registry host; the verifier code explicitly documents
this registry-blind key limitation.

resolving/npm-resolver/src/pickPackage.ts[210-217]
resolving/npm-resolver/src/pickPackage.ts[276-288]
resolving/npm-resolver/src/index.ts[495-509]
resolving/npm-resolver/src/index.ts[588-592]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`pickPackage()` caches packuments in `ctx.metaCache` using a key derived only from `spec.name` (and `:full`). This PR adds an additional `metaCache.set()` on the disk fast-path, which makes registry-specific on-disk mirrors (keyed by `opts.registry`) now leak into a registry-agnostic in-memory cache entry.
As a result, if the same package name is resolved from two different registries in one process/install (e.g. default registry + `gh:` named registry), the second resolution can return the first registry’s packument and therefore use the wrong `dist.tarball`/integrity.
## Issue Context
- The on-disk mirror path is registry-qualified (`getPkgMirrorPath(..., opts.registry, spec.name)`), but the in-memory key is not.
- Downstream resolution uses `pickedPackage.dist.tarball` (from the packument) to decide what to download.
- The verifier already documents this as a known limitation; this PR expands the scenarios where it can happen by caching disk reads too.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[210-217]
- resolving/npm-resolver/src/pickPackage.ts[276-288]
- resolving/npm-resolver/src/pickPackage.ts[439-442]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. updateChecksums cache bypass 🐞 Bug ≡ Correctness
Description
pickPackage() now populates ctx.metaCache from the on-disk exact-version fast path, so a later call
with updateChecksums:true can return early from the in-memory cache without making the intended
conditional registry request. This can defeat checksum-repair / revalidation flows for callers that
reuse a resolver instance across calls with different updateChecksums values.
Code

resolving/npm-resolver/src/pickPackage.ts[R284-288]

       try {
         const pickedPackage = pickMatchingVersionFast(pickerOpts, spec, metaCachedInStore)
         if (pickedPackage) {
+            ctx.metaCache.set(cacheKey, metaCachedInStore)
           return {
Evidence
The code documents that updateChecksums relies on in-memory cache entries being populated only by
fresh network fetches, but the PR now writes disk-loaded metadata into the in-memory cache on the
exact-version fast path; meanwhile, the function still short-circuits on any in-memory cache hit
before considering updateChecksums.

resolving/npm-resolver/src/pickPackage.ts[66-82]
resolving/npm-resolver/src/pickPackage.ts[201-241]
resolving/npm-resolver/src/pickPackage.ts[279-292]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`PickPackageOptions.updateChecksums` is documented to skip the on-disk exact-version fast path so stale disk metadata cannot satisfy the call without a conditional registry request. This PR now seeds `ctx.metaCache` from that disk fast path; subsequent calls can short-circuit on the in-memory cache before reaching any revalidation logic, undermining `updateChecksums`.
## Issue Context
- `pickPackage()` unconditionally returns from `ctx.metaCache.get(cacheKey)` hits.
- The exact-version disk fast path now does `ctx.metaCache.set(cacheKey, metaCachedInStore)`.
- The option doc explicitly assumes metaCache entries only come from the current install’s network fetches.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[66-82]
- resolving/npm-resolver/src/pickPackage.ts[201-241]
- resolving/npm-resolver/src/pickPackage.ts[279-292]
## Suggested change
When `opts.updateChecksums === true`, do not return early from the in-memory `metaCache` (or only return if you can prove the entry was fetched/validated via network in this run). A simple, safe approach is:
- if `opts.updateChecksums` is true, skip the `cachedMeta` early-return path and proceed to the conditional-fetch logic (you may still use cachedMeta as a source of etag/modified headers if helpful).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Registry key not canonical 🐞 Bug ➹ Performance
Description
getPkgMetaCacheKey() keys the cache by the raw registry string, but the resolver and verifier can
produce different canonical forms for the same logical named registry (notably trailing slash). This
reduces shared cache hit rate (resolver↔verifier) and can cause duplicate in-memory entries for the
same registry/package pair.
Code

resolving/npm-resolver/src/pickPackage.ts[R594-606]

+/**
+ * Key for the in-memory `metaCache` holding a package's registry metadata. The
+ * registry is part of the key so that a package of the same name served by two
+ * registries in one install can't collide on a single slot (which would resolve
+ * the wrong tarball/integrity); `fullMetadata` keeps the abbreviated and full
+ * documents in distinct slots. `\x00` can't appear in a registry URL or a
+ * package name, so it's an unambiguous separator. The verifier reads this same
+ * cache and must build the key with this function.
+ */
+export function getPkgMetaCacheKey (registry: string, pkgName: string, fullMetadata: boolean): string {
+  const key = `${registry}\x00${pkgName}`
+  return fullMetadata ? `${key}:full` : key
+}
Evidence
The cache key is built directly from registry without normalization, while the resolver preserves
user-provided named registry URLs verbatim and the verifier canonicalizes named registry prefixes to
end with / and may return those prefixes as the registry value; this makes it possible for
resolver and verifier to compute different keys for the same logical registry.

resolving/npm-resolver/src/pickPackage.ts[594-606]
resolving/npm-resolver/src/index.ts[651-663]
resolving/npm-resolver/src/index.ts[698-745]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[131-153]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[846-868]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`getPkgMetaCacheKey(registry, name, full)` uses the registry string verbatim. In the same process, the resolver may use a user-supplied named registry URL as-is, while the verifier routes by a canonicalized prefix that always ends in `/`. With registry-qualified keys, that mismatch prevents reuse of the shared `metaCache` and can create duplicate slots.
## Issue Context
- Resolver: `mergeNamedRegistries()` stores user-defined URLs without normalization.
- Resolver: `pickFromSimpleRegistry()` passes that registry string into `pickPackage()`.
- Verifier: `namedRegistryPrefixes` are canonicalized to include a trailing slash, and `pickRegistryForVersion()` can return that canonical prefix.
- Both sides then call `getPkgMetaCacheKey()` with potentially different registry strings.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[594-606]
- resolving/npm-resolver/src/index.ts[651-663]
- resolving/npm-resolver/src/index.ts[698-745]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[131-153]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[846-868]
## Suggested change
Canonicalize the registry string used in the key, e.g.:
- Normalize in `getPkgMetaCacheKey()` (preferred: single source of truth), using the project’s existing registry normalization helper and ensuring consistent trailing-slash behavior.
OR
- Normalize `namedRegistries` values when building `ctx.namedRegistries` so resolver and verifier converge on the same string form.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Packument heap retention risk 🐞 Bug ➹ Performance
Description
Caching disk-loaded packuments on the exact-version fast path increases how many PackageMeta
objects can be retained concurrently in the shared metaCache, raising peak heap/GC pressure in
large resolutions. This is especially risky when fullMetadata is in play because the codebase
already treats “full packument kept resident” as an OOM risk in large workspaces.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The codebase explicitly calls out that metadata can be megabytes and that keeping full packuments
resident across large workspaces can OOM. This PR adds a new path that retains disk-loaded
packuments in the shared LRU (max=10000), increasing peak resident metadata compared to prior
behavior on this fast path.

resolving/npm-resolver/src/pickPackage.ts[318-321]
resolving/npm-resolver/src/index.ts[1095-1099]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[482-488]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new cache write increases the number of metadata documents retained in memory. Since packuments can be very large, retaining many of them simultaneously can increase GC overhead or even exhaust heap in large workspaces.
## Issue Context
- The resolver notes metadata files can be megabytes.
- The default `PackageMetaCache` is an LRU with `max: 10000` and `ttl: 120s`.
- Other code paths explicitly project full packuments down to avoid OOMs.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[276-289]
- resolving/npm-resolver/src/index.ts[1095-1099]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[482-488]
### Suggested approach
- Consider adding a `maxSize` + `sizeCalculation` to the LRU so the cache is bounded by estimated memory cost, not just entry count.
- Consider avoiding caching full packuments for the disk fast path (e.g. cache only the picked version manifest / minimal projection when `spec.type === 'version'`).
- If a separate disk-parse cache is introduced (see other finding), make it small and short-lived, so it cannot accumulate many megabyte-scale entries.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
5. Registry URL parse overhead 🐞 Bug ➹ Performance ⭐ New
Description
getPkgMetaCacheKey() canonicalizes the registry via new URL(registry) each time a cache key is
built, which happens on every pickPackage() call and verifier shared-cache read. Now that many
resolutions will be served from memory/disk without network I/O, this extra per-dependency parsing
can become measurable in large dependency graphs.
Code

resolving/npm-resolver/src/pickPackage.ts[R614-626]

+export function getPkgMetaCacheKey (registry: string, pkgName: string, fullMetadata: boolean): string {
+  const key = `${canonicalizeRegistry(registry)}\x00${pkgName}`
+  return fullMetadata ? `${key}:full` : key
+}
+
+function canonicalizeRegistry (registry: string): string {
+  try {
+    const parsed = new URL(registry)
+    const pathname = parsed.pathname.endsWith('/') ? parsed.pathname : `${parsed.pathname}/`
+    return `${parsed.origin}${pathname}`
+  } catch {
+    return registry
+  }
Evidence
The cache key is computed on every resolution (pickPackage()), and canonicalization performs a URL
parse (new URL(registry)), adding per-call work on a hot path.

resolving/npm-resolver/src/pickPackage.ts[210-226]
resolving/npm-resolver/src/pickPackage.ts[614-626]
resolving/npm-resolver/src/index.ts[258-269]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`getPkgMetaCacheKey()` calls `canonicalizeRegistry()` which uses `new URL(registry)` on every key construction. This adds avoidable overhead on the dependency-resolution hot path.

### Issue Context
This key is computed for each `pickPackage()` call, and the verifier also uses it when consulting the resolver’s shared meta cache.

### Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[614-626]
- resolving/npm-resolver/src/pickPackage.ts[216-226]
- resolving/npm-resolver/src/index.ts[258-269]

### Suggested fix
Memoize canonicalization results (e.g., `Map<string,string>` keyed by the raw registry string) or pre-canonicalize registry once at resolver construction and pass the canonical form through, so repeated picks don’t re-parse the same registry URL.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 682f60b


🐞 Bugs (4) 📘 Rule violations (0) 📜 Skill insights (0)


Action required
1. Cross-registry meta cache pollution 🐞 Bug ⛨ Security
Description
pickPackage() now stores disk-loaded metadata in ctx.metaCache under a cache key that omits the
registry, so later resolutions of the same name from a different registry can reuse the wrong
packument and resolve the wrong tarball/integrity. This can break installs (wrong host/auth) and can
install the wrong package when the same name/version exists in multiple registries.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The cache key used for ctx.metaCache is derived only from the package name (and :full), while the
disk mirror path is derived from opts.registry; caching the disk-loaded packument under the
name-only key enables returning registry A’s packument when resolving against registry B. The
resolved tarball URL is taken directly from the picked manifest’s dist.tarball, so using the wrong
packument can fetch/install from the wrong registry host; the verifier code explicitly documents
this registry-blind key limitation.

resolving/npm-resolver/src/pickPackage.ts[210-217]
resolving/npm-resolver/src/pickPackage.ts[276-288]
resolving/npm-resolver/src/index.ts[495-509]
resolving/npm-resolver/src/index.ts[588-592]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`pickPackage()` caches packuments in `ctx.metaCache` using a key derived only from `spec.name` (and `:full`). This PR adds an additional `metaCache.set()` on the disk fast-path, which makes registry-specific on-disk mirrors (keyed by `opts.registry`) now leak into a registry-agnostic in-memory cache entry.
As a result, if the same package name is resolved from two different registries in one process/install (e.g. default registry + `gh:` named registry), the second resolution can return the first registry’s packument and therefore use the wrong `dist.tarball`/integrity.
## Issue Context
- The on-disk mirror path is registry-qualified (`getPkgMirrorPath(..., opts.registry, spec.name)`), but the in-memory key is not.
- Downstream resolution uses `pickedPackage.dist.tarball` (from the packument) to decide what to download.
- The verifier already documents this as a known limitation; this PR expands the scenarios where it can happen by caching disk reads too.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[210-217]
- resolving/npm-resolver/src/pickPackage.ts[276-288]
- resolving/npm-resolver/src/pickPackage.ts[439-442]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. updateChecksums cache bypass 🐞 Bug ≡ Correctness ⭐ New
Description
pickPackage() now populates ctx.metaCache from the on-disk exact-version fast path, so a later call
with updateChecksums:true can return early from the in-memory cache without making the intended
conditional registry request. This can defeat checksum-repair / revalidation flows for callers that
reuse a resolver instance across calls with different updateChecksums values.
Code

resolving/npm-resolver/src/pickPackage.ts[R284-288]

        try {
          const pickedPackage = pickMatchingVersionFast(pickerOpts, spec, metaCachedInStore)
          if (pickedPackage) {
+            ctx.metaCache.set(cacheKey, metaCachedInStore)
            return {
Evidence
The code documents that updateChecksums relies on in-memory cache entries being populated only by
fresh network fetches, but the PR now writes disk-loaded metadata into the in-memory cache on the
exact-version fast path; meanwhile, the function still short-circuits on any in-memory cache hit
before considering updateChecksums.

resolving/npm-resolver/src/pickPackage.ts[66-82]
resolving/npm-resolver/src/pickPackage.ts[201-241]
resolving/npm-resolver/src/pickPackage.ts[279-292]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`PickPackageOptions.updateChecksums` is documented to skip the on-disk exact-version fast path so stale disk metadata cannot satisfy the call without a conditional registry request. This PR now seeds `ctx.metaCache` from that disk fast path; subsequent calls can short-circuit on the in-memory cache before reaching any revalidation logic, undermining `updateChecksums`.

## Issue Context
- `pickPackage()` unconditionally returns from `ctx.metaCache.get(cacheKey)` hits.
- The exact-version disk fast path now does `ctx.metaCache.set(cacheKey, metaCachedInStore)`.
- The option doc explicitly assumes metaCache entries only come from the current install’s network fetches.

## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[66-82]
- resolving/npm-resolver/src/pickPackage.ts[201-241]
- resolving/npm-resolver/src/pickPackage.ts[279-292]

## Suggested change
When `opts.updateChecksums === true`, do not return early from the in-memory `metaCache` (or only return if you can prove the entry was fetched/validated via network in this run). A simple, safe approach is:
- if `opts.updateChecksums` is true, skip the `cachedMeta` early-return path and proceed to the conditional-fetch logic (you may still use cachedMeta as a source of etag/modified headers if helpful).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Registry key not canonical 🐞 Bug ➹ Performance ⭐ New
Description
getPkgMetaCacheKey() keys the cache by the raw registry string, but the resolver and verifier can
produce different canonical forms for the same logical named registry (notably trailing slash). This
reduces shared cache hit rate (resolver↔verifier) and can cause duplicate in-memory entries for the
same registry/package pair.
Code

resolving/npm-resolver/src/pickPackage.ts[R594-606]

+/**
+ * Key for the in-memory `metaCache` holding a package's registry metadata. The
+ * registry is part of the key so that a package of the same name served by two
+ * registries in one install can't collide on a single slot (which would resolve
+ * the wrong tarball/integrity); `fullMetadata` keeps the abbreviated and full
+ * documents in distinct slots. `\x00` can't appear in a registry URL or a
+ * package name, so it's an unambiguous separator. The verifier reads this same
+ * cache and must build the key with this function.
+ */
+export function getPkgMetaCacheKey (registry: string, pkgName: string, fullMetadata: boolean): string {
+  const key = `${registry}\x00${pkgName}`
+  return fullMetadata ? `${key}:full` : key
+}
Evidence
The cache key is built directly from registry without normalization, while the resolver preserves
user-provided named registry URLs verbatim and the verifier canonicalizes named registry prefixes to
end with / and may return those prefixes as the registry value; this makes it possible for
resolver and verifier to compute different keys for the same logical registry.

resolving/npm-resolver/src/pickPackage.ts[594-606]
resolving/npm-resolver/src/index.ts[651-663]
resolving/npm-resolver/src/index.ts[698-745]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[131-153]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[846-868]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`getPkgMetaCacheKey(registry, name, full)` uses the registry string verbatim. In the same process, the resolver may use a user-supplied named registry URL as-is, while the verifier routes by a canonicalized prefix that always ends in `/`. With registry-qualified keys, that mismatch prevents reuse of the shared `metaCache` and can create duplicate slots.

## Issue Context
- Resolver: `mergeNamedRegistries()` stores user-defined URLs without normalization.
- Resolver: `pickFromSimpleRegistry()` passes that registry string into `pickPackage()`.
- Verifier: `namedRegistryPrefixes` are canonicalized to include a trailing slash, and `pickRegistryForVersion()` can return that canonical prefix.
- Both sides then call `getPkgMetaCacheKey()` with potentially different registry strings.

## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[594-606]
- resolving/npm-resolver/src/index.ts[651-663]
- resolving/npm-resolver/src/index.ts[698-745]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[131-153]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[846-868]

## Suggested change
Canonicalize the registry string used in the key, e.g.:
- Normalize in `getPkgMetaCacheKey()` (preferred: single source of truth), using the project’s existing registry normalization helper and ensuring consistent trailing-slash behavior.
OR
- Normalize `namedRegistries` values when building `ctx.namedRegistries` so resolver and verifier converge on the same string form.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Packument heap retention risk 🐞 Bug ➹ Performance
Description
Caching disk-loaded packuments on the exact-version fast path increases how many PackageMeta
objects can be retained concurrently in the shared metaCache, raising peak heap/GC pressure in
large resolutions. This is especially risky when fullMetadata is in play because the codebase
already treats “full packument kept resident” as an OOM risk in large workspaces.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The codebase explicitly calls out that metadata can be megabytes and that keeping full packuments
resident across large workspaces can OOM. This PR adds a new path that retains disk-loaded
packuments in the shared LRU (max=10000), increasing peak resident metadata compared to prior
behavior on this fast path.

resolving/npm-resolver/src/pickPackage.ts[318-321]
resolving/npm-resolver/src/index.ts[1095-1099]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[482-488]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new cache write increases the number of metadata documents retained in memory. Since packuments can be very large, retaining many of them simultaneously can increase GC overhead or even exhaust heap in large workspaces.
## Issue Context
- The resolver notes metadata files can be megabytes.
- The default `PackageMetaCache` is an LRU with `max: 10000` and `ttl: 120s`.
- Other code paths explicitly project full packuments down to avoid OOMs.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[276-289]
- resolving/npm-resolver/src/index.ts[1095-1099]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[482-488]
### Suggested approach
- Consider adding a `maxSize` + `sizeCalculation` to the LRU so the cache is bounded by estimated memory cost, not just entry count.
- Consider avoiding caching full packuments for the disk fast path (e.g. cache only the picked version manifest / minimal projection when `spec.type === 'version'`).
- If a separate disk-parse cache is introduced (see other finding), make it small and short-lived, so it cannot accumulate many megabyte-scale entries.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit ca7538e


🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)


Action required
1. Cross-registry meta cache pollution 🐞 Bug ⛨ Security
Description
pickPackage() now stores disk-loaded metadata in ctx.metaCache under a cache key that omits the
registry, so later resolutions of the same name from a different registry can reuse the wrong
packument and resolve the wrong tarball/integrity. This can break installs (wrong host/auth) and can
install the wrong package when the same name/version exists in multiple registries.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The cache key used for ctx.metaCache is derived only from the package name (and :full), while the
disk mirror path is derived from opts.registry; caching the disk-loaded packument under the
name-only key enables returning registry A’s packument when resolving against registry B. The
resolved tarball URL is taken directly from the picked manifest’s dist.tarball, so using the wrong
packument can fetch/install from the wrong registry host; the verifier code explicitly documents
this registry-blind key limitation.

resolving/npm-resolver/src/pickPackage.ts[210-217]
resolving/npm-resolver/src/pickPackage.ts[276-288]
resolving/npm-resolver/src/index.ts[495-509]
resolving/npm-resolver/src/index.ts[588-592]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]
resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`pickPackage()` caches packuments in `ctx.metaCache` using a key derived only from `spec.name` (and `:full`). This PR adds an additional `metaCache.set()` on the disk fast-path, which makes registry-specific on-disk mirrors (keyed by `opts.registry`) now leak into a registry-agnostic in-memory cache entry.
As a result, if the same package name is resolved from two different registries in one process/install (e.g. default registry + `gh:` named registry), the second resolution can return the first registry’s packument and therefore use the wrong `dist.tarball`/integrity.
## Issue Context
- The on-disk mirror path is registry-qualified (`getPkgMirrorPath(..., opts.registry, spec.name)`), but the in-memory key is not.
- Downstream resolution uses `pickedPackage.dist.tarball` (from the packument) to decide what to download.
- The verifier already documents this as a known limitation; this PR expands the scenarios where it can happen by caching disk reads too.
## Fix Focus Areas
- resolving/npm-resolver/src/pickPackage.ts[210-217]
- resolving/npm-resolver/src/pickPackage.ts[276-288]
- resolving/npm-resolver/src/pickPackage.ts[439-442]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[742-765]
- resolving/npm-resolver/src/createNpmResolutionVerifier.ts[449-471]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. Packument heap retention risk 🐞 Bug ➹ Performance ⭐ New
Description
Caching disk-loaded packuments on the exact-version fast path increases how many PackageMeta
objects can be retained concurrently in the shared metaCache, raising peak heap/GC pressure in
large resolutions. This is especially risky when fullMetadata is in play because the codebase
already treats “full packument kept resident” as an OOM risk in large workspaces.
Code

resolving/npm-resolver/src/pickPackage.ts[284]

+            ctx.metaCache.set(cacheKey, metaCachedInStore)
Evidence
The codebase explicitly calls out that metadata can be megabytes and that keeping full packuments
resident across large workspaces can OOM. This PR adds a new path that retains disk-loaded
packuments in the shared LRU (max=10000), increasing peak resident metadata compared to prior
behavior on this fast path.

resolving/npm-resolver/src/pickPackage.ts[318-321]
[resolving/npm-resolver/src/index.ts[1095-1099]](https://github.com/pnpm/pn...

@coderabbitai

coderabbitai Bot commented Jun 16, 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: 011b1208-7ad3-4b48-bd1b-7c5a56511801

📥 Commits

Reviewing files that changed from the base of the PR and between 5c6c040 and 5785a04.

📒 Files selected for processing (3)
  • resolving/npm-resolver/src/createNpmResolutionVerifier.ts
  • resolving/npm-resolver/src/pickPackage.ts
  • resolving/npm-resolver/test/metaCache.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • resolving/npm-resolver/test/metaCache.test.ts

📝 Walkthrough

Walkthrough

The PR extends the in-memory and shared package metadata cache with registry-aware keys and a conditional bypass mechanism. A new getPkgMetaCacheKey function canonicalizes registry URLs and incorporates the package name, metadata depth (full vs. abbreviated), and filter status into stable cache keys. The pickPackage fast-path now promotes disk-loaded metadata into the in-memory cache, and both TypeScript and Rust implementations conditionally skip cache reads when updateChecksums is enabled to force revalidation. The resolution verifier's shared metadata reuse is also refactored to use registry-qualified keys, preventing collisions when the same package name is served from different registries. Comprehensive tests verify cache key canonicalization and bypass behavior across both implementations.

Changes

In-memory and shared metadata cache registry-qualification

Layer / File(s) Summary
Cache key computation with registry canonicalization
resolving/npm-resolver/src/pickPackage.ts
Introduces getPkgMetaCacheKey(registry, pkgName, fullMetadata, filterMetadata) to generate stable in-memory cache keys that canonicalize registry URLs (via canonicalizeRegistry helper for origin + trailing-slash normalization) and incorporate package name and metadata depth (full/abbreviated/filtered variants) using \x00 as an unambiguous separator.
TypeScript pickPackage cache integration and disk-to-memory promotion
resolving/npm-resolver/src/pickPackage.ts
Updates pickPackage to compute cache keys via getPkgMetaCacheKey, conditionally skip cache reads when opts.updateChecksums is enabled, and promote disk-loaded metaCachedInStore into the in-memory cache after successful fast-path matches. Updates updateChecksums JSDoc to explain fast-path and cache bypass semantics.
TypeScript cache key and bypass behavior tests
resolving/npm-resolver/test/metaCache.test.ts
Adds Jest tests covering cache-key canonicalization (trailing-slash registry normalization, non-collapsing for distinct registry paths, abbreviated vs full metadata separation, filtered vs unfiltered metadata interaction) and pickPackage caching (disk fast-path populates in-memory cache; subsequent resolve with updateChecksums: true bypasses warm entry and forces registry revalidation).
Rust pick_package cache bypass and revalidation logic
pacquet/crates/resolving-npm-resolver/src/pick_package.rs
Introduces use_mem_cache = !opts.update_checksums to gate both initial and post-acquire in-memory cache reads. Updates update_checksums documentation to clarify it bypasses both the on-disk exact-version fast path and in-memory cache, preventing warm disk-promoted entries from suppressing revalidation.
Rust updateChecksums bypass test
pacquet/crates/resolving-npm-resolver/src/pick_package/tests.rs
Adds Tokio test update_checksums_bypasses_warm_in_memory_cache that primes the on-disk mirror and in-memory cache via a normal pick_package call, then verifies that a second call with update_checksums: true bypasses the warm entry and contacts the registry for revalidation while maintaining the same version selection.
Resolution verifier shared metadata registry-qualification
resolving/npm-resolver/src/createNpmResolutionVerifier.ts
Updates createNpmResolutionVerifier to use registry-qualified cache keys via getPkgMetaCacheKey for shared metadata reuse: refactors fetchFullMetaForTrust, fetchAbbreviatedMeta, and shared-metadata helpers (readSharedMeta, readSharedMetaForTrust, readSharedFullMeta) to accept (cache, registry, name) parameters instead of name-only, preventing cross-registry cache collisions in per-install shared metadata lookups.
Changeset release notes
.changeset/npm-resolver-meta-cache.md
Changeset documents patch-level updates to @pnpm/resolving.npm-resolver and pnpm describing in-memory cache population on exact-version disk fast-path, registry-based cache key extension to prevent cross-registry collisions, and resolution verifier's registry-qualified shared metadata reuse.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • pnpm/pnpm#11622: Modifies the same spec.type === 'version' disk-cached fast-path in pickPackage.ts around upgrading abbreviated cached metadata to full on 304/cache hits.
  • pnpm/pnpm#11794: Updates resolver metadata caching logic with fullMetadata handling that affects cache partitioning and the metadata depth dimension across both TypeScript and Rust implementations.
  • pnpm/pnpm#11856: Changes pickPackage/pick_package to promote disk-loaded packument metadata into the install-scoped in-memory cache and have updateChecksums bypass that warm path for revalidation.

Suggested reviewers

  • zkochan
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing in-memory caching of package metadata for exact version matches in npm-resolver, which aligns with the PR's core objective of optimizing performance.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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 and usage tips.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

perf(npm-resolver): memoize disk-loaded metadata for exact version fast-path
✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

Walkthroughs

Description
• Cache parsed packument in memory after exact-version disk hit
• Avoid repeated disk reads/parses for the same package metadata
• Speeds up large-monorepo installs by reusing ctx.metaCache across resolutions
Diagram
graph TD
  resolver["Dependency resolver"] --> pick["pickPackage()"] --> cache["metaCache (mem)"]
  cache -->|"hit"| ret["Return meta + version"]
  cache -->|"miss"| disk[("Meta mirror (disk)")] --> fast["pickMatchingVersionFast"] --> set["Cache meta in memory"] --> ret
  set --> cache
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Bound metaCache with LRU/TTL eviction
  • ➕ Prevents unbounded memory growth in long-lived processes resolving many packages
  • ➕ Keeps hot packages fast while dropping cold entries
  • ➖ More complexity (eviction policy, sizing) and potential churn if cache is too small
  • ➖ May require tuning per environment (CI vs dev)
2. Cache only the exact version entry instead of full meta
  • ➕ Lower memory footprint vs storing full packument objects
  • ➕ Potentially faster serialization/copy if meta is large
  • ➖ More bespoke data structure and branching logic
  • ➖ Risks missing other call-sites that benefit from having full meta available

Recommendation: The PR’s approach (write-through to the existing ctx.metaCache on the exact-version disk fast-path) is the best near-zero-complexity win and aligns with how other pickPackage branches already populate the cache. If this cache is used in long-lived processes, consider adding an LRU/TTL later to cap memory growth, but that’s orthogonal to this performance fix.

Grey Divider

File Changes

Enhancement (1)
pickPackage.ts Write-through to ctx.metaCache on exact-version disk fast-path +1/-0

Write-through to ctx.metaCache on exact-version disk fast-path

• When the on-disk mirrored metadata already contains the requested exact version and the fast picker succeeds, the parsed metadata is now stored into ctx.metaCache. This avoids repeated disk reads/parses for subsequent resolutions of the same package/version in the same process.

resolving/npm-resolver/src/pickPackage.ts


Grey Divider

Qodo Logo

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
resolving/npm-resolver/src/pickPackage.ts (1)

276-297: ⚠️ Potential issue | 🔴 Critical

Add a changeset entry for the pickPackage cache optimization.

The @pnpm/resolving.npm-resolver package already has the equivalent Rust implementation in pacquet (the in-memory cache is populated after disk-cache hits in the version-spec fast path). However, this user-visible performance optimization (minutes → seconds for adding packages in large monorepos) requires a changeset entry. Add a .changeset/*.md file with "@pnpm/resolving.npm-resolver": patch and "pnpm": patch, describing the cache population improvement.

🤖 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 `@resolving/npm-resolver/src/pickPackage.ts` around lines 276 - 297, A
changeset entry is missing for the pickPackage cache optimization in the
pickMatchingVersionFast function. Create a new markdown file in the .changeset
directory with a filename following the project's naming convention (typically a
unique identifier). The file should contain entries for
"`@pnpm/resolving.npm-resolver`": patch and "pnpm": patch, followed by a
description of the performance improvement that the cache population
optimization provides (specifically how it reduces resolution time from minutes
to seconds in large monorepos by populating the in-memory cache after disk-cache
hits in the version-spec fast path).

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@resolving/npm-resolver/src/pickPackage.ts`:
- Around line 276-297: A changeset entry is missing for the pickPackage cache
optimization in the pickMatchingVersionFast function. Create a new markdown file
in the .changeset directory with a filename following the project's naming
convention (typically a unique identifier). The file should contain entries for
"`@pnpm/resolving.npm-resolver`": patch and "pnpm": patch, followed by a
description of the performance improvement that the cache population
optimization provides (specifically how it reduces resolution time from minutes
to seconds in large monorepos by populating the in-memory cache after disk-cache
hits in the version-spec fast path).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 41c06128-b1fa-4207-a838-c03f9a1bbcbe

📥 Commits

Reviewing files that changed from the base of the PR and between b1a28e0 and bf3e9b2.

📒 Files selected for processing (1)
  • resolving/npm-resolver/src/pickPackage.ts

In pickPackage(), cache the parsed package metadata in memory after reading it from disk
for exact version matches.

Without this, we were repeatedly reading and parsing the same metadata.
@zkochan
zkochan force-pushed the rct/version-cache branch from bf3e9b2 to ca7538e Compare June 18, 2026 20:29
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit ca7538e

The in-memory metaCache was keyed only by package name (and `:full`),
while the on-disk mirror is registry-qualified. A package of the same
name served by two registries in one install could collide on a single
cache slot and resolve the wrong tarball/integrity. This became reachable
on the common warm-cache path once the exact-version disk fast path
started populating the cache.

Include the registry in the in-memory cache key via a shared
getPkgMetaCacheKey helper, and thread the registry through the verifier's
shared-meta reads (which already documented this as the prerequisite for
a registry-qualified read).
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jun 18, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 682f60b

@zkochan
zkochan enabled auto-merge (squash) June 18, 2026 21:35
…onicalize the registry key

Addresses two issues raised in review of the metadata-cache change.

updateChecksums must force a conditional registry request, but the
in-memory cache can now hold a packument promoted from the on-disk
exact-version fast path rather than a fresh network fetch. On a shared
or long-lived resolver a later updateChecksums call could short-circuit
on that disk-sourced entry and skip revalidation. Bypass the in-memory
cache when updateChecksums is set. Ported to pacquet, guarding both the
pre-permit read and the post-permit re-check.

getPkgMetaCacheKey keyed by the raw registry string, so the resolver
(which may pass a configured named-registry URL verbatim) and the
verifier (which routes through trailing-slashed prefixes) could build
different keys for the same logical registry and miss the shared cache.
Canonicalize the registry to its origin plus a trailing-slashed path;
origin and path are preserved so registries that genuinely differ never
collapse. This is a pnpm-only change for now: pacquet populates only the
default registry today and its verifier shared-meta read is name-only,
so the canonicalization has nothing to converge there yet.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5c6c040

@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 `@resolving/npm-resolver/src/pickPackage.ts`:
- Around line 614-627: The getPkgMetaCacheKey function is missing the
filterMetadata parameter, causing cache collisions when the same
registry/package/fullMetadata combination has different filterMetadata values.
Add filterMetadata as a parameter to the function signature and include it in
the cache key generation by appending a suffix (similar to the existing :full
suffix) based on the filterMetadata boolean value—for example, append :filtered
when filterMetadata is true and :unfiltered when false, to match the Rust
implementation and prevent data corruption from cache key collisions.
🪄 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: 096b9072-dd95-42b9-bbd8-37674bc3ac8a

📥 Commits

Reviewing files that changed from the base of the PR and between 682f60b and 5c6c040.

📒 Files selected for processing (4)
  • pacquet/crates/resolving-npm-resolver/src/pick_package.rs
  • pacquet/crates/resolving-npm-resolver/src/pick_package/tests.rs
  • resolving/npm-resolver/src/pickPackage.ts
  • resolving/npm-resolver/test/metaCache.test.ts

@codecov-commenter

codecov-commenter commented Jun 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.19%. Comparing base (0474a9c) to head (5785a04).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12458      +/-   ##
==========================================
+ Coverage   88.18%   88.19%   +0.01%     
==========================================
  Files         313      313              
  Lines       43074    43086      +12     
==========================================
+ Hits        37983    37998      +15     
+ Misses       5091     5088       -3     

☔ 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.

The on-disk metaDir already splits full metadata into filtered and
unfiltered mirrors, but the in-memory metaCache key did not. A
filterMetadata resolver stores a clearMeta-stripped packument, so when a
metaCache is shared across resolvers with different filterMetadata
settings an unfiltered-full request could be served the stripped form
(or vice versa). Add the filtered dimension to getPkgMetaCacheKey,
matching pacquet's `:full:filtered` key and the on-disk split, and probe
both full variants from the verifier's shared-meta reads — a filtered
full packument still carries the time/_npmUser/dist the verifier needs.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5785a04

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.900 ± 0.215 3.682 4.331 1.68 ± 0.14
pacquet@main 3.781 ± 0.161 3.603 4.148 1.63 ± 0.12
pnpr@HEAD 2.877 ± 0.512 2.431 4.001 1.24 ± 0.23
pnpr@main 2.314 ± 0.144 2.117 2.569 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.89954755424,
      "stddev": 0.21477766042002577,
      "median": 3.80462874094,
      "user": 3.03767598,
      "system": 2.631602419999999,
      "min": 3.6816237849399998,
      "max": 4.330957451940001,
      "times": [
        3.7352403009399997,
        4.18043127694,
        3.7834067169399996,
        3.8220347379399997,
        4.06176627394,
        4.330957451940001,
        3.80395633394,
        3.6816237849399998,
        3.80530114794,
        3.79075751694
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.7807601142399996,
      "stddev": 0.16079385396668638,
      "median": 3.73301369044,
      "user": 3.0567855799999997,
      "system": 2.6344546199999996,
      "min": 3.6031225719399997,
      "max": 4.14775680494,
      "times": [
        3.73475602094,
        3.67541018194,
        3.8031645039399997,
        3.95415018594,
        3.7126930999399996,
        3.7312713599399996,
        3.78908622294,
        3.6031225719399997,
        3.65619018994,
        4.14775680494
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.87685768264,
      "stddev": 0.5117999439586768,
      "median": 2.6546033684399997,
      "user": 2.06452078,
      "system": 2.2270720199999996,
      "min": 2.43063524494,
      "max": 4.00076095294,
      "times": [
        3.0046638079399997,
        2.7358099719399998,
        4.00076095294,
        2.6580563419399996,
        2.59965438994,
        2.47763837194,
        2.64699737694,
        3.5632099729399997,
        2.43063524494,
        2.6511503949399997
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.31434133804,
      "stddev": 0.14351635871532786,
      "median": 2.28540532644,
      "user": 2.1065118800000002,
      "system": 2.22274572,
      "min": 2.11737513794,
      "max": 2.56944125694,
      "times": [
        2.56944125694,
        2.31081089894,
        2.23367569694,
        2.48391785994,
        2.20362328094,
        2.11737513794,
        2.32865199594,
        2.19389669694,
        2.4420208019399996,
        2.25999975394
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 609.7 ± 30.0 589.1 691.4 1.00
pacquet@main 685.7 ± 57.5 596.8 727.6 1.12 ± 0.11
pnpr@HEAD 699.8 ± 80.9 627.3 809.8 1.15 ± 0.14
pnpr@main 723.1 ± 95.4 635.9 946.2 1.19 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.60966179316,
      "stddev": 0.03004576661888147,
      "median": 0.6013932791600001,
      "user": 0.2943006799999999,
      "system": 1.0181628799999998,
      "min": 0.58912532466,
      "max": 0.69136989466,
      "times": [
        0.59687595266,
        0.58912532466,
        0.58974721566,
        0.61211901366,
        0.69136989466,
        0.59757515066,
        0.61010244266,
        0.60521140766,
        0.61185264766,
        0.59263888166
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6857105371600001,
      "stddev": 0.057482054592654555,
      "median": 0.71885349816,
      "user": 0.29521578,
      "system": 1.0251325799999997,
      "min": 0.59679442166,
      "max": 0.72764811366,
      "times": [
        0.72764811366,
        0.72100769566,
        0.61023310666,
        0.59679442166,
        0.71200160366,
        0.60133915466,
        0.72240014466,
        0.72274520466,
        0.71669930066,
        0.72623662566
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6998451556599999,
      "stddev": 0.08088021019015088,
      "median": 0.64246592216,
      "user": 0.30117088,
      "system": 1.05668468,
      "min": 0.62728681066,
      "max": 0.80983863566,
      "times": [
        0.64100106066,
        0.62728681066,
        0.80513283966,
        0.80983863566,
        0.75773090466,
        0.79661183066,
        0.63702349366,
        0.64393078366,
        0.63971264766,
        0.64018254966
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.7231128273599999,
      "stddev": 0.09539765837716996,
      "median": 0.70586809616,
      "user": 0.30580147999999996,
      "system": 1.0423899799999998,
      "min": 0.63588840866,
      "max": 0.9462263816600001,
      "times": [
        0.67729482766,
        0.65156771866,
        0.78125573466,
        0.6534568536600001,
        0.73444136466,
        0.63588840866,
        0.64028522366,
        0.75562146266,
        0.75509029766,
        0.9462263816600001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.985 ± 0.037 3.901 4.038 1.53 ± 0.20
pacquet@main 3.991 ± 0.055 3.940 4.109 1.53 ± 0.20
pnpr@HEAD 2.604 ± 0.335 2.280 3.334 1.00
pnpr@main 2.672 ± 0.407 2.239 3.650 1.03 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.9845867885399997,
      "stddev": 0.03662996094920252,
      "median": 3.9908436304399997,
      "user": 2.9132855999999996,
      "system": 2.5901848400000005,
      "min": 3.90123359594,
      "max": 4.03775874894,
      "times": [
        3.97893805394,
        3.99695030994,
        3.90123359594,
        3.98597814694,
        4.001943467939999,
        4.03775874894,
        3.9608895229399996,
        3.97111986094,
        4.01534706394,
        3.99570911394
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.9911136654399995,
      "stddev": 0.05470084545815714,
      "median": 3.96323746994,
      "user": 2.9461989999999996,
      "system": 2.55496604,
      "min": 3.93995000294,
      "max": 4.10875951194,
      "times": [
        3.93995000294,
        3.96071672494,
        3.96007977394,
        3.95812271694,
        4.05718593594,
        3.9909417649399996,
        3.95011246394,
        4.10875951194,
        3.96575821494,
        4.01950954394
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.6039930775399998,
      "stddev": 0.3349377493944825,
      "median": 2.5122065079399998,
      "user": 1.9583884,
      "system": 2.1787110400000005,
      "min": 2.28007372194,
      "max": 3.3337709109399998,
      "times": [
        2.4331040809399997,
        2.38237563994,
        2.28007372194,
        2.28345850894,
        2.51017926794,
        2.57089827294,
        3.3337709109399998,
        2.5142337479399997,
        2.73188885594,
        2.9999477679399997
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.67206789074,
      "stddev": 0.406545528061934,
      "median": 2.5885225419399998,
      "user": 1.9797498,
      "system": 2.16061454,
      "min": 2.2386911439399997,
      "max": 3.65048232394,
      "times": [
        2.78053707494,
        3.65048232394,
        2.9710394509399998,
        2.62493396394,
        2.69229222394,
        2.41733416194,
        2.2386911439399997,
        2.5521111199399997,
        2.33494148494,
        2.45831595894
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.172 ± 0.009 1.161 1.194 1.84 ± 0.02
pacquet@main 1.237 ± 0.123 1.170 1.568 1.94 ± 0.19
pnpr@HEAD 0.671 ± 0.093 0.631 0.933 1.05 ± 0.15
pnpr@main 0.637 ± 0.006 0.628 0.649 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.17209238696,
      "stddev": 0.009300536775615636,
      "median": 1.16973715406,
      "user": 1.03809588,
      "system": 1.3493729399999999,
      "min": 1.16130546856,
      "max": 1.19388893256,
      "times": [
        1.16621761556,
        1.16940396356,
        1.1645032145599998,
        1.16936020756,
        1.17331528556,
        1.17007034456,
        1.19388893256,
        1.18073337756,
        1.16130546856,
        1.17212545956
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.2374354429599999,
      "stddev": 0.12310259180889725,
      "median": 1.1891483110599999,
      "user": 1.0398925799999998,
      "system": 1.3853755399999998,
      "min": 1.1697867845599998,
      "max": 1.56812650056,
      "times": [
        1.17540825256,
        1.19289868156,
        1.19742222056,
        1.17907416456,
        1.56812650056,
        1.30987418256,
        1.18114583856,
        1.1697867845599998,
        1.21521986356,
        1.18539794056
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.67110330716,
      "stddev": 0.09295468810081928,
      "median": 0.6377356025600001,
      "user": 0.27360528,
      "system": 1.0010487399999999,
      "min": 0.6308893545600001,
      "max": 0.9331798285600001,
      "times": [
        0.63234219156,
        0.6398462555600001,
        0.6318397305600001,
        0.63562494956,
        0.6319207175600001,
        0.65346238156,
        0.6308893545600001,
        0.9331798285600001,
        0.6690889805600001,
        0.6528386815600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6374999392600001,
      "stddev": 0.006044927590986967,
      "median": 0.6373166765600001,
      "user": 0.2591136799999999,
      "system": 1.00473804,
      "min": 0.6280287095600001,
      "max": 0.6486202645600001,
      "times": [
        0.6363298375600001,
        0.6486202645600001,
        0.6280287095600001,
        0.63023037956,
        0.6335834455600001,
        0.64234151256,
        0.6393975905600001,
        0.6371520585600001,
        0.64183429956,
        0.6374812945600001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.684 ± 0.029 2.651 2.752 4.23 ± 0.06
pacquet@main 2.775 ± 0.053 2.720 2.856 4.37 ± 0.09
pnpr@HEAD 0.641 ± 0.004 0.637 0.648 1.01 ± 0.01
pnpr@main 0.635 ± 0.005 0.625 0.641 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6842347081800004,
      "stddev": 0.029283729577661323,
      "median": 2.6769069884800003,
      "user": 1.37741786,
      "system": 1.55046326,
      "min": 2.65106668998,
      "max": 2.75232963498,
      "times": [
        2.7121796059800003,
        2.6653859059800005,
        2.65106668998,
        2.67040963198,
        2.69222429798,
        2.66261353898,
        2.6745493989800004,
        2.68232379898,
        2.67926457798,
        2.75232963498
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7753731288800005,
      "stddev": 0.053096533360065944,
      "median": 2.75211064398,
      "user": 1.3816032599999999,
      "system": 1.6650021600000002,
      "min": 2.7197431359800004,
      "max": 2.85647045898,
      "times": [
        2.7197431359800004,
        2.82467512398,
        2.75021568498,
        2.72533444098,
        2.7412508249800003,
        2.84313971598,
        2.75400560298,
        2.85647045898,
        2.7255686229800005,
        2.81332767698
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.64125288458,
      "stddev": 0.003718854553443272,
      "median": 0.6410961764800001,
      "user": 0.26984226,
      "system": 0.9888409599999999,
      "min": 0.63655727198,
      "max": 0.64812007198,
      "times": [
        0.63857567598,
        0.63738216798,
        0.64589925298,
        0.64234129098,
        0.64059111598,
        0.64812007198,
        0.63858174098,
        0.63655727198,
        0.64160123698,
        0.64287901998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.63499959698,
      "stddev": 0.004796950272162789,
      "median": 0.6350919614799999,
      "user": 0.26458906,
      "system": 0.9987876599999999,
      "min": 0.62506101498,
      "max": 0.64113700998,
      "times": [
        0.63899547198,
        0.63419069698,
        0.63897061498,
        0.63412310698,
        0.64113700998,
        0.63254797798,
        0.63599322598,
        0.63835975898,
        0.63061709098,
        0.62506101498
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12458
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
3,984.59 ms
(-5.49%)Baseline: 4,215.93 ms
5,059.11 ms
(78.76%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
2,684.23 ms
(-10.53%)Baseline: 3,000.12 ms
3,600.14 ms
(74.56%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,172.09 ms
(-11.61%)Baseline: 1,326.07 ms
1,591.28 ms
(73.66%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
3,899.55 ms
(-6.01%)Baseline: 4,149.09 ms
4,978.91 ms
(78.32%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
609.66 ms
(-0.88%)Baseline: 615.09 ms
738.11 ms
(82.60%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12458
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
2,603.99 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
641.25 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
671.10 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,876.86 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
699.85 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan disabled auto-merge June 18, 2026 23:08
@zkochan
zkochan merged commit fa7004b into pnpm:main Jun 19, 2026
27 of 29 checks passed
@welcome

welcome Bot commented Jun 19, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants