Skip to content

feat: proof of concept for pnpr platform variants - #17522

Closed
zkochan wants to merge 28 commits into
mainfrom
poc/platform-variants
Closed

zkochan wants to merge 28 commits into
mainfrom
poc/platform-variants

Conversation

@zkochan

@zkochan zkochan commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Proof of concept for the pnpr platform variants RFC (merged in pnpm/rfcs#51), updated to the merged text: one package version with a primary archive plus platform variant archives, so packages with native binaries no longer need a set of per-platform optionalDependencies packages or a postinstall download. Not meant to be merged as is; it exists to test the design end to end. The results are folded into the RFC's "Prototype" section.

pnpr

  • A variant archive declares where it runs in its own package.json: "variant": { "platforms": ["linux-x64", "linux-x64-musl"] }. Platform tags cover os, cpu, musl, glibc floors (manylinux_2_28), macOS/Windows floors (macos_11_0), N-API (napi8), Node.js/Electron ABIs (node127), and wasm32, parsed by a new shared crate, pnpm-platform-variants; only the canonical form parses. pnpr names the variant by its platforms' tags sorted and joined with +.
  • The publish body references each variant archive only by the .tgz integrity its upload is verified against (versions[<v>].pnprVariants: { "<label>": "<integrity>" }, attached as <basename>-<version>~<label>.tgz).
  • Publication rejects a variant whose name, version, or peers differ from the version's, that requires a build, whose variant field is missing or does not parse, that declares os/cpu/libc, or that lists a platform another variant lists. Dependencies may differ.
  • pnpr's own document and release records list each variant with its tag, structured platforms, tar integrity, sizes, bins, and a manifest of the fields that differ from the version's; no URL. npm's documents list none. Variants are served at <name>@<version>/variants/<tag> and at <name>@<version>+r<N>/variants/<tag> for the selected revision.

pnpm

  • The resolver writes a variations resolution with the primary as fallback, best variant first, and the version's revision. The lockfile stores no tag: pnpm derives it from each variant's targets, which gain the floor and ABI fields. A variant with a platform field pnpm does not know is left out.
  • Selection follows the RFC: more matched fields, then the highest glibc/OS/N-API floor, then wasm32, then the primary; an equal fit fails the install. pnpm probes the host's glibc, macOS, N-API, and ABI once. Runtime archives keep their first-match rule.
  • Every archive's dependencies are resolved on every machine. The version's snapshot keeps the primary's; a variant whose resolved snapshot differs gets <name>@<version>/variants/<tag>(<peers>), and the installer wires the selected variant's snapshot before materializing the lockfile.
  • The global virtual store keys every variations entry, runtime or package, by the selected archive's integrity. On main, runtime variations are hashed without integrity, so two projects selecting different Node.js archives of one version share a slot; this fixes that too.

Split packuments (pnpm/rfcs#54; variant integrities do not compress, so inline they make a packument several times larger)

  • pnpm asks a registry declared serverType: pnpr for application/vnd.pnpr.install-v2+json (other registries get npm's media types), and pnpr answers in a format of its own (on by default; PNPR_INSTALL_V2=0 turns it off): an entry per version with its deprecation, trust rank, selected revision, and its publish time only within 30 days of the package's last publish (timesSince). A complete entry also has pnpr's facts about the archives at its top level (integrity, fileCount, unpackedSize, requiresBuild, bins, variants) and the publisher's manifest. Under PNPR_SPLIT_METADATA_THRESHOLD (64 KiB) every entry is complete; above it only dist-tag targets and the highest release of each major (each minor below 1.0) are. npm's documents no longer carry dist.pnpr. pnpm converts the document where it is parsed (parse_install_v2) and records a version without a time as published at timesSince.
  • The rest of a version is its release record at <name>/<version>+r<revision> (Cache-Control: immutable), without deprecated, _npmUser, signatures, or attestations. <name>/<version> stays the selected revision, which can change.
  • pnpm turns each entry into a version marked external where the document is parsed, fetches the record of a picked one in pick_package once per install, and keeps the deprecation and trust evidence from the packument.
  • Found while testing: split documents need a client metadata cache of their own. An older pnpm on PATH sharing v12/metadata read a split document the new one had cached and failed to switch versions. Moving the cache directory touches the cache commands and many tests, so they are cached in v12/metadata-pnpr, which a pnpm release that predates the format never reads.
  • bench-split.sh resolves a 787-package app proxied from npmjs through a CDN-like proxy (gzip, cache, RTT, bandwidth cap), cold cache each run, with the registry declared serverType: pnpr. Median resolution: 1.35 s → 0.36 s at 10 ms/200 Mbit, 5.07 s → 0.79 s at 40 ms/50 Mbit, 24.7 s → 2.6 s at 100 ms/10 Mbit; a full install at 40 ms/50 Mbit 28.5 s → 24.0 s. Package documents 30.3 MB → 2.5 MB gzipped (14.9 MB with every manifest inline), with 22 release records. The lockfile is identical.

pnpr/poc/platform-variants/ has the scripts that repackage real npm packages (esbuild, biome, napi-rs packages, lightningcss, rolldown, Tailwind oxide with a wasm primary) and GitHub release binaries as variant packages, plus packages that each break one publish rule.

Tested end to end against a local pnpr with variants.sh, after this update: every publish rejection with its reason; installs from pnpr's format linking the host's variant, repeated frozen and after a pnpm add; a dependency only the Linux variant declares, recorded in that variant's own snapshot and linked for it. Before this update (with declared tags and no per-variant dependencies), the PoC also ran Vite 8 and Tailwind 4 builds, Alpine containers, server-side resolution, and frozen installs for glibc/musl/darwin/win32/freebsd/unknown OS; those have not been rerun.

Revisions (pnpm/rfcs#55): npm's documents give a selected revision by its +r<N> tarball URL and integrity only; pnpr's format marks revision-aware versions with revision (including 0) and serves a release record for every revision in the history. pnpm rebuilds the +r<N> URL, reads a +r<N> override from its record, and treats an unmarked revision URL as an ordinary tarball that answers only for its own revision. revisions.sh installs an original and a patched revision through both formats, with and without a +r0 override, and repeats each install frozen.

Not implemented: a version without a primary, and the minimal primary pnpr would generate for npm clients; a name declared by two archives with different specifiers (it resolves once, with the version's specifier); supportedArchitectures fetching several variants or linking the one platform it names (materialized dependencies follow the host); relinking when the selection changes; pnpm why/audit/licenses/SBOM visiting variant snapshots; a lockfile marker older pnpm releases reject; uploads by integrity, one provenance statement naming every archive, the compatibility view; rejecting a minimumReleaseAge above 30 days, which split packuments rely on; the warning about an undeclared pnpr (pnpm's tests run against one); the pnpm cache commands for v12/metadata-pnpr. The publish body limit is raised 8x for the PoC.

Squash Commit Body

feat: proof of concept for pnpr platform variants

Prototype of the pnpr platform variants RFC. A variant archive declares
the platforms it runs on in its package.json; pnpr verifies each variant
against its version, names it by its platform tags, and lists it in its
own package document only. pnpm locks the variants in a variations entry
with the primary as fallback, derives each variant's route from its
targets, selects the variant that fits the host best, and records a
variant's own dependencies in a snapshot of its own. Large packuments are
split: versions other than the dist-tag targets and the highest release of
each major keep only an entry of mutable flags and recent publish times,
and pnpm reads a picked one from its immutable release record.

Checklist

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

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

🤖 Generated with Claude Code

pnpr accepts platform variant archives with a version, checks them against
the primary, serves them as dist.pnpr.variants and at
<name>@<version>/variants/<tag>. pnpm resolves them into a variations
resolution with the primary as fallback, installs the variant selected for
the platform, and hashes global virtual store slots by the selected archive.

PoC shortcuts: the selected platform reaches the slot hash through a
process-global, and the publish body limit is raised so one request can
carry every variant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2257.44 ms 2245.19 ms -0.5% 112.87 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1437.34 ms 1401.53 ms -2.5% 71.87 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 231.87 ms 239.08 ms 3.1% 11.59 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 253.01 ms 259.45 ms 2.5% 12.65 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 7.67 ms 7.88 ms 2.7% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 7.72 ms 7.71 ms -0.1% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.98 ms 9.50 ms 5.8% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 8.97 ms 9.00 ms 0.3% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2587.09 ms 2589.43 ms 0.1% 129.35 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1522.53 ms 1439.08 ms -5.5% 76.13 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 485.12 ms 505.94 ms 4.3% 24.26 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 298.27 ms 306.04 ms 2.6% 14.91 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1569.09 ms 1571.70 ms 0.2% 78.45 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 257.53 ms 268.34 ms 4.2% 12.88 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 230.68 ms 235.04 ms 1.9% 11.53 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 87.59 ms 87.94 ms 0.4% 4.38 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 186.07 ms 185.33 ms -0.4% 9.30 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 86.08 ms 88.13 ms 2.4% 4.30 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 78.43 ms 78.65 ms 0.3% 3.92 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4345.35 ms 4378.00 ms 0.8% 217.27 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3415.72 ms 3556.79 ms 4.1% 170.79 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 127.39 ms 127.86 ms 0.4% 6.37 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 141.43 ms 148.29 ms 4.8% 7.07 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1206.38 ms 1193.06 ms -1.1% 60.32 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 27.89 ms 28.10 ms 0.7% 2.00 ms Within tolerance

Same-run syscall check

Each install runs 2 more times per revision, untimed, under strace --follow-forks --summary-only. A file syscall regresses when HEAD's fewest calls exceed main's most by more than 2% of main or 50 calls, whichever is larger. mkdir and mkdirat count only the calls that created a directory, since concurrent installs fail a varying number with EEXIST. A syscall whose identical runs differ by more than that tolerance is reported unstable and not gated, unless HEAD's fewest calls also exceed main's most by more than the tolerance plus that difference. Each scenario lists its largest change relative to its tolerance and every row that is not within tolerance.

Scenario Engine Syscall main calls (max) HEAD calls (min) Change Tolerance Identical-run spread Result
isolated-fresh-restore-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr symlink 3883 3887 +0.1% 77 1 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet readlink 16047 15608 -2.7% 320 601 Unstable (identical runs differ by 601, not gated)
isolated-fresh-install-cold-cache-cold-store pacquet statx 149183 146746 -1.6% 2983 3174 Unstable (identical runs differ by 3174, not gated)
isolated-fresh-install-cold-cache-cold-store pnpr ioctl 11 17 +54.5% 50 6 Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr statx 48984 48985 +0.0% 979 11 Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet statx 1741 1742 +0.1% 50 2 Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr openat 855 856 +0.1% 50 0 Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet fstat 136 139 +2.2% 50 10 Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet openat 1543 1544 +0.1% 50 0 Within tolerance

Integrated-Benchmark Report (Linux)

Commit: e9a2554ca6f2

Compared against main at: 14342aea2fd9

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.353 ± 0.151 2.231 2.564 1.63 ± 0.19
pacquet@main 2.297 ± 0.084 2.222 2.447 1.59 ± 0.16
pnpr@HEAD 1.442 ± 0.139 1.288 1.658 1.00
pnpr@main 1.463 ± 0.117 1.287 1.691 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.3533359263000007,
      "stddev": 0.1513968772006778,
      "median": 2.2451949761000005,
      "user": 2.0827378399999996,
      "system": 1.7126264999999996,
      "min": 2.2305309306,
      "max": 2.5637462086
    },
    {
      "command": "pacquet@main",
      "mean": 2.2972784067000003,
      "stddev": 0.08355708113877937,
      "median": 2.2574449996,
      "user": 1.9931700399999996,
      "system": 1.6781879,
      "min": 2.2217314256000003,
      "max": 2.4465073546
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4421561781,
      "stddev": 0.13897202628716399,
      "median": 1.4015272206,
      "user": 1.98488924,
      "system": 1.6386845,
      "min": 1.2884227896,
      "max": 1.6575511276
    },
    {
      "command": "pnpr@main",
      "mean": 1.4632437307,
      "stddev": 0.11680198614641131,
      "median": 1.4373440575999998,
      "user": 1.8546461400000003,
      "system": 1.6492977999999998,
      "min": 1.2869149506,
      "max": 1.6912395146
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 237.9 ± 4.9 227.5 243.8 1.02 ± 0.05
pacquet@main 233.9 ± 10.5 218.6 257.7 1.00
pnpr@HEAD 260.2 ± 8.3 246.9 274.2 1.11 ± 0.06
pnpr@main 250.9 ± 14.3 230.1 277.3 1.07 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23788853106,
      "stddev": 0.004866387763503721,
      "median": 0.23907886796,
      "user": 0.29618156,
      "system": 0.59470028,
      "min": 0.22751048846,
      "max": 0.24376949246000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.23386778046,
      "stddev": 0.010503849599538692,
      "median": 0.23186906696,
      "user": 0.29068166,
      "system": 0.5759510800000001,
      "min": 0.21862865946,
      "max": 0.25768376446
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26022069966,
      "stddev": 0.008260243607100568,
      "median": 0.25945098596000005,
      "user": 0.29414256000000005,
      "system": 0.60203188,
      "min": 0.24692244446,
      "max": 0.27419478946
    },
    {
      "command": "pnpr@main",
      "mean": 0.25085978325999997,
      "stddev": 0.014313490747703118,
      "median": 0.25300760495999997,
      "user": 0.28533025999999995,
      "system": 0.6130650799999999,
      "min": 0.23007466446,
      "max": 0.27734660246
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.0 ± 0.4 7.4 10.5 1.03 ± 0.06
pacquet@main 7.8 ± 0.5 7.2 11.8 1.00 ± 0.07
pnpr@HEAD 7.8 ± 0.3 7.3 9.2 1.00
pnpr@main 7.8 ± 0.4 7.3 10.9 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.007981973573469381,
      "stddev": 0.0003792945345971723,
      "median": 0.0078768314,
      "user": 0.004556074557823129,
      "system": 0.004165839863945578,
      "min": 0.007419545900000001,
      "max": 0.0105240559
    },
    {
      "command": "pacquet@main",
      "mean": 0.00777847139855073,
      "stddev": 0.00048651722071923917,
      "median": 0.007672301900000001,
      "user": 0.004855171304347827,
      "system": 0.0036117594202898545,
      "min": 0.007235048900000001,
      "max": 0.0118089539
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007759362560818714,
      "stddev": 0.0002881965215105722,
      "median": 0.007708174900000001,
      "user": 0.0049378817543859616,
      "system": 0.003510599883040933,
      "min": 0.007271016900000001,
      "max": 0.0091762699
    },
    {
      "command": "pnpr@main",
      "mean": 0.007817142125903608,
      "stddev": 0.00038587165576731657,
      "median": 0.007718854400000001,
      "user": 0.004980170963855419,
      "system": 0.0035253904819277098,
      "min": 0.0072841609,
      "max": 0.0108964569
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.6 ± 0.6 8.2 11.7 1.07 ± 0.09
pacquet@main 9.0 ± 0.7 7.8 12.2 1.01 ± 0.10
pnpr@HEAD 9.0 ± 0.5 8.1 10.9 1.00
pnpr@main 9.0 ± 0.5 8.1 11.5 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009608230356260168,
      "stddev": 0.0005715135340388336,
      "median": 0.009502702340000002,
      "user": 0.005407986178861788,
      "system": 0.004937763414634144,
      "min": 0.008159375840000002,
      "max": 0.011711193840000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.009040622794887217,
      "stddev": 0.0007391308211204881,
      "median": 0.008983054340000001,
      "user": 0.005366393533834585,
      "system": 0.004383930827067671,
      "min": 0.007837479840000001,
      "max": 0.012242141840000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008989778955789476,
      "stddev": 0.0005021859564018736,
      "median": 0.008997120840000001,
      "user": 0.005360781754385964,
      "system": 0.004364471929824565,
      "min": 0.008096988840000001,
      "max": 0.010921659840000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.009045721071343285,
      "stddev": 0.0004513107404711281,
      "median": 0.00896787634,
      "user": 0.005166843880597014,
      "system": 0.004606977611940296,
      "min": 0.00812789784,
      "max": 0.01145252784
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.587 ± 0.029 2.548 2.627 1.77 ± 0.09
pacquet@main 2.580 ± 0.026 2.542 2.618 1.76 ± 0.09
pnpr@HEAD 1.465 ± 0.071 1.409 1.618 1.00
pnpr@main 1.511 ± 0.081 1.396 1.646 1.03 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.586722133360001,
      "stddev": 0.028619508053448046,
      "median": 2.58942627006,
      "user": 2.6491488399999996,
      "system": 1.73396862,
      "min": 2.54823444356,
      "max": 2.6269870825600004
    },
    {
      "command": "pacquet@main",
      "mean": 2.58042544136,
      "stddev": 0.026032049198499767,
      "median": 2.58708810206,
      "user": 2.5343361399999997,
      "system": 1.7484252200000001,
      "min": 2.5416962185600003,
      "max": 2.6182175455600003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.46481886316,
      "stddev": 0.07052354887691395,
      "median": 1.4390781535600001,
      "user": 2.0717485399999997,
      "system": 1.57570832,
      "min": 1.40947092356,
      "max": 1.61786689956
    },
    {
      "command": "pnpr@main",
      "mean": 1.5111365823600003,
      "stddev": 0.08085047410926283,
      "median": 1.5225324200600001,
      "user": 1.9862496399999998,
      "system": 1.57187132,
      "min": 1.39618866556,
      "max": 1.64616659056
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 504.8 ± 15.0 483.6 520.8 1.69 ± 0.08
pacquet@main 493.5 ± 17.3 474.7 520.7 1.65 ± 0.08
pnpr@HEAD 302.5 ± 7.4 289.8 309.7 1.01 ± 0.04
pnpr@main 299.0 ± 9.9 285.3 320.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5048013968,
      "stddev": 0.015012425589959456,
      "median": 0.5059398310000001,
      "user": 0.78275884,
      "system": 1.0703889400000002,
      "min": 0.48364200150000003,
      "max": 0.5208245275
    },
    {
      "command": "pacquet@main",
      "mean": 0.49351357619999997,
      "stddev": 0.017314048541597963,
      "median": 0.485124563,
      "user": 0.7510497399999998,
      "system": 1.0717032400000002,
      "min": 0.47469798350000003,
      "max": 0.5206501005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3025105195,
      "stddev": 0.007430108695572803,
      "median": 0.306044386,
      "user": 0.3135000399999999,
      "system": 0.58082144,
      "min": 0.2898333895,
      "max": 0.3097093995
    },
    {
      "command": "pnpr@main",
      "mean": 0.29895346469999995,
      "stddev": 0.009927016513267828,
      "median": 0.29827001399999997,
      "user": 0.31989224,
      "system": 0.56169034,
      "min": 0.2852967885,
      "max": 0.3208186865
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.576 ± 0.013 1.551 1.595 6.06 ± 0.17
pacquet@main 1.571 ± 0.017 1.548 1.604 6.04 ± 0.18
pnpr@HEAD 0.266 ± 0.005 0.257 0.271 1.02 ± 0.03
pnpr@main 0.260 ± 0.007 0.253 0.271 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.57580240038,
      "stddev": 0.013453128697815364,
      "median": 1.5717036816799999,
      "user": 0.80247918,
      "system": 0.7979015399999999,
      "min": 1.55114884268,
      "max": 1.59547626068
    },
    {
      "command": "pacquet@main",
      "mean": 1.57074192858,
      "stddev": 0.017069123265155688,
      "median": 1.56909135868,
      "user": 0.7585406799999999,
      "system": 0.7889185400000001,
      "min": 1.5484136686799999,
      "max": 1.60372489368
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26613390168,
      "stddev": 0.004969832754587291,
      "median": 0.26833908268,
      "user": 0.23797767999999997,
      "system": 0.5229087399999999,
      "min": 0.25711873668,
      "max": 0.27129354568
    },
    {
      "command": "pnpr@main",
      "mean": 0.26008550178,
      "stddev": 0.007100648943973272,
      "median": 0.25753447818,
      "user": 0.24939488,
      "system": 0.50748164,
      "min": 0.25283154168,
      "max": 0.27127537168
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 235.2 ± 13.9 209.5 261.1 2.69 ± 0.17
pacquet@main 229.5 ± 11.5 210.3 252.3 2.63 ± 0.14
pnpr@HEAD 87.7 ± 1.0 85.3 89.9 1.00 ± 0.02
pnpr@main 87.4 ± 1.5 83.1 90.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2352000866145455,
      "stddev": 0.013861326017956994,
      "median": 0.23503848516000003,
      "user": 0.20740094909090906,
      "system": 0.24725238000000002,
      "min": 0.20954877816000003,
      "max": 0.26108412416
    },
    {
      "command": "pacquet@main",
      "mean": 0.2295414016215385,
      "stddev": 0.01150653893423691,
      "median": 0.23067611916000003,
      "user": 0.20667027076923075,
      "system": 0.26150876461538464,
      "min": 0.21033016416000003,
      "max": 0.25227775816
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08774127366,
      "stddev": 0.0009943173649563514,
      "median": 0.08793626716,
      "user": 0.031183665,
      "system": 0.017856411250000002,
      "min": 0.08533386316,
      "max": 0.08987796116
    },
    {
      "command": "pnpr@main",
      "mean": 0.08736358212875,
      "stddev": 0.001527609949877163,
      "median": 0.08759228166,
      "user": 0.026661383750000007,
      "system": 0.021762493124999997,
      "min": 0.08308019316,
      "max": 0.09024144316
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 184.7 ± 11.1 173.4 204.2 1.00
pacquet@main 186.1 ± 9.3 172.6 200.6 1.01 ± 0.08
pnpm@HEAD 3588.2 ± 200.3 3400.0 4019.0 19.43 ± 1.60
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18468053710444446,
      "stddev": 0.011145158036231166,
      "median": 0.18532893966,
      "user": 0.1786121911111111,
      "system": 0.048761059999999995,
      "min": 0.17336318966,
      "max": 0.20420570666
    },
    {
      "command": "pacquet@main",
      "mean": 0.1860710855488889,
      "stddev": 0.009276302693942227,
      "median": 0.18607149966,
      "user": 0.1916389688888889,
      "system": 0.037334948888888886,
      "min": 0.17261640766,
      "max": 0.20062299366
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.5882163408822216,
      "stddev": 0.20025589832927812,
      "median": 3.5086811086600003,
      "user": 5.48640419111111,
      "system": 0.31852472666666665,
      "min": 3.40000250766,
      "max": 4.01898139466
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 88.7 ± 4.4 81.1 102.1 1.03 ± 0.06
pacquet@main 86.2 ± 3.2 80.5 93.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0887149847875,
      "stddev": 0.00439747634810549,
      "median": 0.08812569310000001,
      "user": 0.083271935,
      "system": 0.055627446250000004,
      "min": 0.0810754961,
      "max": 0.1021414971
    },
    {
      "command": "pacquet@main",
      "mean": 0.08620570581875002,
      "stddev": 0.0032328222580946813,
      "median": 0.08608342260000001,
      "user": 0.07882524750000001,
      "system": 0.056550571249999994,
      "min": 0.08054263610000001,
      "max": 0.0934733581
    }
  ]
}

Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 79.0 ± 3.4 71.8 85.9 1.01 ± 0.05
pacquet@main 78.5 ± 1.5 76.1 82.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.07901849926324327,
      "stddev": 0.0033943467827725073,
      "median": 0.07864522102000002,
      "user": 0.02739423675675676,
      "system": 0.0579701545945946,
      "min": 0.07181006102000001,
      "max": 0.08594673702000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.07848580007405406,
      "stddev": 0.0014506894416745422,
      "median": 0.07843248002000001,
      "user": 0.027673669189189197,
      "system": 0.05704169513513513,
      "min": 0.07606955402000001,
      "max": 0.08241412002000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.437 ± 0.133 4.330 4.764 1.28 ± 0.06
pacquet@main 4.379 ± 0.097 4.297 4.576 1.26 ± 0.05
pnpr@HEAD 3.567 ± 0.153 3.385 3.818 1.03 ± 0.06
pnpr@main 3.474 ± 0.117 3.397 3.757 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.437068286419999,
      "stddev": 0.13337347683933107,
      "median": 4.378001575019999,
      "user": 1.8996925400000002,
      "system": 1.3344614399999999,
      "min": 4.33035264602,
      "max": 4.76449717702
    },
    {
      "command": "pacquet@main",
      "mean": 4.37884919212,
      "stddev": 0.09691098527311501,
      "median": 4.34535075152,
      "user": 1.80514024,
      "system": 1.31450224,
      "min": 4.297173948019999,
      "max": 4.57579031602
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.56720705832,
      "stddev": 0.1525371905731028,
      "median": 3.55679163952,
      "user": 1.8294618399999998,
      "system": 1.2900347399999998,
      "min": 3.38530600802,
      "max": 3.81778148702
    },
    {
      "command": "pnpr@main",
      "mean": 3.47414058662,
      "stddev": 0.11656973027974755,
      "median": 3.4157221475200004,
      "user": 1.7883047400000003,
      "system": 1.26426604,
      "min": 3.39686386202,
      "max": 3.75679044102
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 129.2 ± 3.7 124.2 136.0 1.01 ± 0.05
pacquet@main 127.3 ± 5.2 118.7 141.3 1.00
pnpr@HEAD 147.5 ± 4.1 141.3 155.0 1.16 ± 0.06
pnpr@main 140.2 ± 6.0 127.4 149.9 1.10 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.12920398879789474,
      "stddev": 0.003732886004220345,
      "median": 0.12786131764,
      "user": 0.15731328736842107,
      "system": 0.15938210526315788,
      "min": 0.12420600064000001,
      "max": 0.13598761964
    },
    {
      "command": "pacquet@main",
      "mean": 0.12731595644,
      "stddev": 0.005222422952299408,
      "median": 0.12738983464,
      "user": 0.17007838999999997,
      "system": 0.14531235,
      "min": 0.11869268364,
      "max": 0.14130685064
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.14749380134588239,
      "stddev": 0.00407391795265439,
      "median": 0.14829133064,
      "user": 0.17347039882352944,
      "system": 0.15940641176470588,
      "min": 0.14125733764,
      "max": 0.15503223164000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.14019373275111113,
      "stddev": 0.005950560810195613,
      "median": 0.14143301764,
      "user": 0.17538489555555556,
      "system": 0.14709194444444443,
      "min": 0.12744779864,
      "max": 0.14990148464
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.194 ± 0.041 1.130 1.290 1.00
pacquet@main 1.222 ± 0.050 1.174 1.295 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1941835633800002,
      "stddev": 0.04078767462706282,
      "median": 1.19306124868,
      "user": 0.54624846,
      "system": 0.21470893999999996,
      "min": 1.13015608468,
      "max": 1.2903292136800002
    },
    {
      "command": "pacquet@main",
      "mean": 1.22151228858,
      "stddev": 0.04958736450610232,
      "median": 1.2063793296800003,
      "user": 0.57915106,
      "system": 0.23882374,
      "min": 1.17424753368,
      "max": 1.29500584168
    }
  ]
}

Scenario: Cargo: repeat install, hot cache + hot store

Frozen repeat install of a Cargo workspace (cargo.enabled: true) whose crates are already materialized in <storeDir>/v11/crates/ and linked into .pnpm/crates/crates-io. Direct installs only.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 28.3 ± 0.9 27.3 32.4 1.01 ± 0.05
pacquet@main 28.1 ± 0.9 26.5 31.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.028312346618823533,
      "stddev": 0.0008617289430969387,
      "median": 0.028098954560000004,
      "user": 0.020331530588235294,
      "system": 0.01563125137254902,
      "min": 0.027250398560000003,
      "max": 0.03237851156
    },
    {
      "command": "pacquet@main",
      "mean": 0.02806514266476191,
      "stddev": 0.0009323146004003334,
      "median": 0.027894068560000002,
      "user": 0.019691264761904765,
      "system": 0.016289008571428575,
      "min": 0.026544922560000003,
      "max": 0.031101169560000003
    }
  ]
}

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.01     12.3±0.67ms    30.4 MB/sec    1.00     12.3±0.57ms    30.5 MB/sec
packument/parse                                  1.00     41.8±0.49µs  1588.4 MB/sec    1.00     41.7±0.82µs  1591.8 MB/sec
tarball/download_dependency                      1.23  895.8±171.83µs     4.7 MB/sec    1.00   729.1±53.61µs     5.8 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.06    208.8±6.78ms 76.6 KElem/sec    1.00    196.9±7.01ms 81.3 KElem/sec
version_pick/repeated_ranges_file                1.01      4.2±0.07ms  7.4 KElem/sec    1.00      4.2±0.07ms  7.4 KElem/sec
version_pick/repeated_ranges_raw                 1.01      4.2±0.04ms  7.4 KElem/sec    1.00      4.2±0.03ms  7.5 KElem/sec
workspace_resolution/hoist_heavy                 1.00    242.1±6.55ms        ? ?/sec    1.04    250.9±1.99ms        ? ?/sec
workspace_sort/chained_projects                  1.00     13.1±0.98ms        ? ?/sec    1.00     13.1±1.10ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.01497% with 299 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.61%. Comparing base (17e062e) to head (e9a2554).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
...npm-resolver/src/npm_resolver/platform_variants.rs 12.16% 65 Missing ⚠️
pnpm/crates/lockfile/src/resolution/variants.rs 73.72% 36 Missing ⚠️
pnpm/crates/platform-variants/src/host_floors.rs 23.91% 35 Missing ⚠️
pnpm/crates/platform-variants/src/lib.rs 47.54% 32 Missing ⚠️
...s-resolver/src/resolve_dependency_tree/manifest.rs 46.15% 14 Missing ⚠️
...npr/src/server/publishing/variants/verification.rs 91.13% 14 Missing ⚠️
...estorer/src/install_package_by_snapshot/runtime.rs 88.54% 11 Missing ⚠️
...crates/pnpr/src/server/routing/variant_handlers.rs 77.08% 11 Missing ⚠️
...-restorer/src/install_package_by_snapshot/fetch.rs 69.69% 10 Missing ⚠️
pnpr/crates/pnpr/src/server/publishing/variants.rs 93.97% 10 Missing ⚠️
... and 18 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17522      +/-   ##
==========================================
- Coverage   92.66%   92.61%   -0.06%     
==========================================
  Files        1921     1946      +25     
  Lines      250916   253401    +2485     
==========================================
+ Hits       232523   234675    +2152     
- Misses      18393    18726     +333     

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

zkochan and others added 2 commits October 30, 2026 20:41
Move the lockfile and npm resolver variant code into their own modules,
fold both variations fetch arms into one method, and replace single
'/' escapes in the PoC scripts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan

zkochan commented Oct 30, 2026 •

Copy link
Copy Markdown
Member Author

Staying in draft on purpose: this is a prototype for pnpm/rfcs#51, kept as a reference for the RFC discussion rather than for merging. CI was green on 42b0ca8; 1c6494f unifies runtime and package variant selection. What a mergeable version still needs is listed under Not implemented in the description (staged per-archive publishing, the version/ABI fields, the compatibility view for other clients, multi-platform pnpm fetch, and relinking a local virtual store slot).


🤖 Generated with Claude Code (Claude Opus 5.5)

zkochan and others added 3 commits October 30, 2026 21:54
Runtimes and registry packages now share one variations selection
(VariationsResolution::select): the first matching variant, else the
fallback. The selected resolution's type, not the presence of a tag or
fallback, decides whether it is fetched as a binary archive or a
registry tarball. The global virtual store receives the selected
platform from the install's config instead of a process-global, and
hashes runtime variations by the selected archive too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm now asks for application/vnd.pnpr.install-v2+json. When the
abbreviated packument is larger than PNPR_SPLIT_METADATA_THRESHOLD, pnpr
moves each version's dist to its immutable version document and marks
the version dist.pnpr.details "external". Dist-tag targets and the
highest release of each major keep their dist inline, so most picks need
no second request. pnpm fetches the version document of a picked version
marked external, once per install.

Variant integrities do not compress, so this keeps packages with
variants from multiplying their packument. bench-split.sh measures cold
resolution 33 to 40 percent faster with split packuments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The request-log parity tests classified a request by the media type its
Accept header names first, which is now pnpr's split form. Both ask for
the abbreviated document. Also cap the benchmark proxy's delays and stop
echoing upstream errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The version a pnpm version switch picks goes through pick_package, not
the npm resolver, so the external dist is now read there, for every
caller. Splitting is off unless PNPR_SPLIT_METADATA_THRESHOLD is set: an
older pnpm on PATH that shared the metadata cache read a split document
the new one had cached, and moving the cache directory touches the
cache commands and many tests. Also validate the benchmark proxy's
control input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan and others added 7 commits October 31, 2026 17:48
…ments

A split packument now keeps only what picking a version reads (name,
version, deprecated, the _npmUser trust flags, provenance, and the marker)
for versions that are not likely picks. The version document is served as
the abbreviated packument would list the version when the split media type
is asked for, and pnpm reads the whole picked version from it.
PNPR_SPLIT_DIST_ONLY=1 keeps the earlier shape for comparison.

The benchmark now declares the registry as pnpr, so optional dependencies
are read from abbreviated documents too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Versions that are not likely picks move from `versions` to
pnpr.externalVersions as their publish time, or [time, flags] with their
deprecation, trust rank, and selected revision, so a client that does
not read the map sees only complete versions. The rest of a version is
its release record at <name>/<version>+r<revision>, without deprecation
or evidence, and served as immutable; <name>/<version> stays the selected
revision. pnpm turns each entry into a version marked external where the
document is parsed, fetches the record of a picked one, and keeps the
deprecation and trust evidence from the packument.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Entries and release records list pnpr's facts about the archives
(integrity, fileCount, unpackedSize, requiresBuild, bins, variants) at their
top level, beside the publisher's manifest. npm's documents no longer carry
dist.pnpr or the stored variants, and pnpr's format is served by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan and others added 3 commits November 1, 2026 00:27
pnpr serves its own format by default now, so pnpm sends its media type
only to registries declared serverType: pnpr, whose tarball URLs it can
rebuild, and caches those documents in v12/metadata-pnpr, where a pnpm
release that predates the format never reads them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
npm's documents give a selected revision by its +r<N> tarball URL and
integrity, without dist.revision and dist.revisions. pnpr's format marks a
revision-aware version with revision, including 0, and serves a release
record for every revision in the history. pnpm rebuilds the revision URL,
reads a +r<N> override from its record, and treats an unmarked revision URL
as an ordinary tarball that answers only for its own revision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpr answers `Accept: application/vnd.pnpr.install-v2+json` with its own
package document: every version has a short entry with its deprecation,
trust rank, selected revision, and its publish time when it falls in the
publish-time window, and the versions a resolution likely picks keep
their manifest and pnpr's facts about the archives. Above the split
threshold, every other version's manifest is its release record at
`<name>/<version>+r<revision>`, served with immutable caching (or the
caller-gated headers). The document is coarsened against the package's
last publish rather than the current time, so it changes only when the
package does.

npm's documents no longer carry `dist.pnpr`, `dist.revision`, or
`dist.revisions`: a selected revision appears there by its `+r<N>`
tarball URL and integrity. Package documents carry a `pnpr-registry`
header. The new `packageDocuments` setting configures the split
threshold and a publish-time window of at least 30 days.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
…e pnpr

pnpm asks a registry declared `serverType: pnpr` for pnpr's own package
document and turns it into its usual package type where it is parsed.
Each version from it is marked with how the document listed it, so a
picked version whose manifest the document left out, or a `+r<N>`
override of a revision other than the selected one, is read from its
release record: once per install, shared between the picks that need
it, and cached on disk with no expiry in `v12/metadata-pnpr-records`.
The documents themselves are cached in `v12/metadata-pnpr`, which the
`pnpm cache` commands now cover.

A response in pnpr's format is read only when it was asked for. A
registry that sends `pnpr-registry` without being declared gets a
warning, once per registry. A `minimumReleaseAge` above 30 days fails
with `ERR_PNPM_UNSUPPORTED_MINIMUM_RELEASE_AGE` for a declared registry,
since an entry without a publish time is only known to be 30 days older
than the package's last publish.

npm's documents served by pnpr give a selected revision only by its
URL, so an unmarked revision URL is an ordinary tarball that answers
only for its own revision.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpr answers `Accept: application/vnd.pnpr.install-v2+json` with its own
package document: every version has a short entry with its deprecation,
trust rank, selected revision, and its publish time when it falls in the
publish-time window, and the versions a resolution likely picks keep
their manifest and pnpr's facts about the archives. Above the split
threshold, every other version's manifest is its release record at
`<name>/<version>+r<revision>`, served with immutable caching (or the
caller-gated headers). The document is coarsened against the package's
last publish rather than the current time, so it changes only when the
package does.

npm's documents no longer carry `dist.pnpr`, `dist.revision`, or
`dist.revisions`: a selected revision appears there by its `+r<N>`
tarball URL and integrity. Package documents carry a `pnpr-registry`
header. The new `packageDocuments` setting configures the split
threshold and a publish-time window of at least 30 days.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
…e pnpr

pnpm asks a registry declared `serverType: pnpr` for pnpr's own package
document and turns it into its usual package type where it is parsed.
Each version from it is marked with how the document listed it, so a
picked version whose manifest the document left out, or a `+r<N>`
override of a revision other than the selected one, is read from its
release record: once per install, shared between the picks that need
it, and cached on disk with no expiry in `v12/metadata-pnpr-records`.
The documents themselves are cached in `v12/metadata-pnpr`, which the
`pnpm cache` commands now cover.

A response in pnpr's format is read only when it was asked for. A
registry that sends `pnpr-registry` without being declared gets a
warning, once per registry. A `minimumReleaseAge` above 30 days fails
with `ERR_PNPM_UNSUPPORTED_MINIMUM_RELEASE_AGE` for a declared registry,
since an entry without a publish time is only known to be 30 days older
than the package's last publish.

npm's documents served by pnpr give a selected revision only by its
URL, so an unmarked revision URL is an ordinary tarball that answers
only for its own revision.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
`pnpm-platform-variants` parses and writes the platform tags of the
platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows
floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a
variant's tag from its platforms, and selects the variant that fits a
host by the RFC's ranking rule: native above wasm32, then more explicit
constraints, then the highest glibc and OS floors, then an exact ABI
above an N-API floor. A floor or ABI the host's value is unknown for is
not met when linking, and is met when fetching for another platform.
pnpr and pnpm share it.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
A publish references each variant archive by the integrity of its `.tgz`
under `versions[<v>].pnprVariants` and attaches it beside the primary.
Each archive declares its platforms in its own `package.json`, and pnpr
derives the variant's tag from them. Publication rejects a variant whose
name, version, or peer dependencies differ from the version's, that
requires a build, that declares `os`, `cpu`, or `libc`, whose `variant`
field is missing or does not parse, or that overlaps another variant,
and an unreferenced or missing attachment.

pnpr's package document and release records list the verified variants;
npm's documents do not. Each variant's tar is served at
`<name>@<version>/variants/<tag>`, and under the selected revision at
`<name>@<version>+r<revision>/variants/<tag>`.

The archives travel in one publish body until uploads by integrity land
with atomic workspace publication.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zkochan added a commit that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in #17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kairosci pushed a commit to kairosci/pnpm that referenced this pull request Nov 2, 2026
pnpm reads `variants` from pnpr's package document and records the
version as a `variations` resolution with the primary as `fallback`,
each variant integrity-only with targets that carry the floor and ABI
fields, in the byte order of their derived tags, and `revision` for a
revision-aware version. A variant with a platform field pnpm does not
know is left out. Every archive's dependencies are resolved on every
machine; a variant whose resolved snapshot differs from the version's
gets `<name>@<version>/variants/<tag>`.

At install, the selector ranks every variant's best matching target for
the host, independently of the lockfile's order, and falls back to the
primary; two equally fitting variants fail the install. Runtimes keep
their first-match selection. The installer walks the selected variant's
snapshot, fetches the variant from its registry route, and the global
virtual store keys a `variations` package by the selected archive's
integrity in addition to its graph identity.

Ported from the proof of concept in pnpm#17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-pnpm__pnpm that referenced this pull request Nov 2, 2026
…nts) (pnpm#17556)

* feat(pnpr): serve a package document of its own and release records

pnpr answers `Accept: application/vnd.pnpr.install-v2+json` with its own
package document: every version has a short entry with its deprecation,
trust rank, selected revision, and its publish time when it falls in the
publish-time window, and the versions a resolution likely picks keep
their manifest and pnpr's facts about the archives. Above the split
threshold, every other version's manifest is its release record at
`<name>/<version>+r<revision>`, served with immutable caching (or the
caller-gated headers). The document is coarsened against the package's
last publish rather than the current time, so it changes only when the
package does.

npm's documents no longer carry `dist.pnpr`, `dist.revision`, or
`dist.revisions`: a selected revision appears there by its `+r<N>`
tarball URL and integrity. Package documents carry a `pnpr-registry`
header. The new `packageDocuments` setting configures the split
threshold and a publish-time window of at least 30 days.

Ported from the proof of concept in pnpm#17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat: read pnpr's package document from registries declared serverType pnpr

pnpm asks a registry declared `serverType: pnpr` for pnpr's own package
document and turns it into its usual package type where it is parsed.
Each version from it is marked with how the document listed it, so a
picked version whose manifest the document left out, or a `+r<N>`
override of a revision other than the selected one, is read from its
release record: once per install, shared between the picks that need
it, and cached on disk with no expiry in `v12/metadata-pnpr-records`.
The documents themselves are cached in `v12/metadata-pnpr`, which the
`pnpm cache` commands now cover.

A response in pnpr's format is read only when it was asked for. A
registry that sends `pnpr-registry` without being declared gets a
warning, once per registry. A `minimumReleaseAge` above 30 days fails
with `ERR_PNPM_UNSUPPORTED_MINIMUM_RELEASE_AGE` for a declared registry,
since an entry without a publish time is only known to be 30 days older
than the package's last publish.

npm's documents served by pnpr give a selected revision only by its
URL, so an unmarked revision URL is an ordinary tarball that answers
only for its own revision.

Ported from the proof of concept in pnpm#17522.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: describe pnpr's package document and its client

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor: fit pnpr's package document code to the lint limits

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: end a multi-line format with a trailing comma

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(pnpr): measure the split threshold on pnpr's own document

Decide the split from the document with every manifest inline rather than
from npm's abbreviated document, which keeps every publish time. A publish
after a long gap advances `timesSince` and drops the publish times of the
entries outside the window, so it can take a document back below the
threshold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: box the update-config future of a command's state

The state future every command awaits embeds the future that applies a
pnpmfile's updateConfig hook. Inline, it passes clippy's large-future
threshold on Windows at several command dispatch sites, so box it once
where it is built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(pnpr): serve a release record immutable only once its archive is verified

A release record carries what pnpr derives from the archive, and an
upstream archive is verified only after its first read, so a record read
before that could gain fileCount, unpackedSize, requiresBuild, and bins
later. It is now served immutable only once every fact is derived.

A revision-aware version's records are made from its revision history
alone, so a record's bytes no longer depend on which revision is
selected.

Adds a test that the document and release records render from SQLite
metadata, and that a deprecation changes the document but not the record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: keep only release records pnpr serves as lasting, and bound their size

pnpm keeps a release record on disk only when pnpr serves it immutable,
or privately to a caller-gated package's callers. A record larger than
8 MiB is refused instead of buffered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: lead the changeset with what users get

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: end a multi-line assert with a trailing comma

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(pnpr): address release records by exact version, and build the document once

A release record is addressed by an exact version: `latest+r0` named
whatever `latest` pointed at, under an immutable cache header.

pnpr's document is built once and measured with a counting writer, and a
document over the split threshold leaves out the manifests of the
unlikely picks in place instead of being built again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: keep only immutable release records, and trust a record's address

A caller-gated record is `private, no-store`, so it is no longer kept on
disk. The revision a record describes is the one its address names, a
`+r<N>` override of an ordinary version reads no record before the
revision check rejects it, and a cached record is read without blocking
the runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: honor pnpr's document marker only for a registry declared pnpr

A version that pnpr's document listed may leave out its revision history.
Another registry could set the same marker in npm's documents and skip
the revision checks, so the marker is now honored only for a registry
declared `serverType: pnpr`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: order versions published at the same time by semver in the trust check

pnpr's document gives every version published before its publish-time
window the same time, so trustPolicy: no-downgrade counted none of them
as earlier than another, and a downgrade among them went unnoticed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: describe revision validation and pnpr's document savings accurately

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(pnpr): write pnpr's document once unless it is split

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: assert the revision-history error for an undeclared registry

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@zkochan

zkochan commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Closing this proof of concept. #17556 (split packuments) and #17559 (platform variants) carry the implementation, and both have merged. The benchmark scripts under pnpr/poc/platform-variants/ stay on this branch for reference.

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

@zkochan zkochan closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants