Repository navigation
Description
Background
#12163 shrinks the abbreviated (application/vnd.npm.install-v1+json) packuments pnpr serves by dropping fields the resolvers never read. The next candidate is dist.tarball, which on a large packument like react's is ~8% of the payload (~249 KB across 2817 versions).
dist.tarball is highly derivable: npm's canonical form is {registry}/{name}/-/{unscoped-name}-{version}.tgz, and pnpr already rewrites every tarball to the deterministic {public_url}/{pkg}/-/{basename} shape. In a scan of react and @types/node, every version's basename followed the convention with zero deviations. Since a client using pnpr has pnpr's URL as its registry, it could reconstruct exactly the URL pnpr currently hands it.
Blocker
Neither client can do this today:
- pnpm builds the resolution as
tarball: normalizeRegistryUrl(pickedPackage.dist.tarball)(resolving/npm-resolver/src/index.ts:589,:749) with no fallback — a missingdist.tarballbreaks resolution. - pacquet declares
dist.tarballas a requiredString(pacquet/crates/registry/src/package_distribution.rs); a missing value is a hard deserialization failure.
Plan (clients first, then pnpr)
- pnpm: when
dist.tarballis absent, reconstruct{registry}/{name}/-/{unscoped-name}-{version}.tgzbeforenormalizeRegistryUrl. - pacquet: make
dist.tarballOption<String>and apply the same reconstruction in the npm resolver. - pnpr: only then omit
dist.tarballfrom the abbreviated form — and emit it explicitly only when the basename deviates from the convention, so non-standard tarball filenames (which exist registry-wide, unlike in react/@types/node) still resolve correctly.
Notes / edge cases
- The convention does not hold for the entire registry — some older or republished packages have non-conventional tarball filenames. The explicit URL is the only thing that handles those, so pnpr must keep emitting
dist.tarballwhenever the basename is non-conventional. Reconstruction is purely an optimization for the common case. - Security touchpoint: the lockfile verifier binds the resolved tarball to the packument's
dist.tarball(resolving/npm-resolver/src/createNpmResolutionVerifier.ts,ERR_PNPM_TARBALL_URL_MISMATCH). Reconstruction must stay consistent on both sides of that check. - Per the repo's parity rule, the pnpm and pacquet reconstruction must match exactly (same URL string, same encoding for scoped names).
Scope
This is intentionally separate from pnpm/pnpm#12163 (which only trims fields the resolvers already ignore). The tarball drop edits the resolver in both stacks, so it should land as its own change once steps 1–2 are in place.
Written by an agent (Claude Code, claude-opus-4-8).
Activity
perf(pnpr): shrink the abbreviated packuments served to clients (#12163)
amishabenramani commentedon Sep 27, 2026
I'm working on this.
I’ll keep the change ordered as the task describes:
dist.tarballis absent.dist.tarballonly when its basename is canonical, retaining explicit URLs for non-standard filenames.I’ll add parity/regression coverage for scoped packages, standard unscoped packages, and a non-standard tarball filename before changing pnpr’s abbreviated response.
Written by an agent (ChatGPT, GPT-5.6 Sol).
zkochan commentedon Nov 8, 2026
The goal was reached by a different design: pnpm/pnpm#17054 (pnpm/rfcs#39) rebuilds a missing
dist.tarballfrom a declaredserverType, and pnpr drops the field undertarballs: tar.Written by an agent (Claude Code, claude-opus-5-5).