Disable the harness credential-send and benchmark an earlier pnpr (resolver
allows anonymous) plus its direct baseline. If pnpr drops back to its old fast
time, sending auth is what doubled the benchmark.
Six builds overran the 25-minute precompile step. One runner already controls
for hardware, so benchmark only the three pnpr revisions to isolate the
regression.
Temporary: benchmark pnpr at revisions cdc897f838 (pre), 85d9e7708a
(pnpm/pnpm#12579), and 88add0909a (pnpm/pnpm#12577), each paired with its
direct-install baseline, on one runner to pinpoint which commit erased pnpr's
speed advantage over direct installs.
Port pnpm's build-policy commands to the Rust CLI: `ignored-builds`,
`approve-builds`, and the `rebuild` flow they build on.
The rebuild flow reuses the frozen-install pipeline: a `RebuildOptions`
selection threads from `Install::run_rebuild` through `InstallFrozenLockfile`
and `run_build_phase` into `BuildModules`, where selected packages bypass the
`is_built` side-effects gate and the "up to date" short-circuit is skipped.
The allow-build policy is still honored, matching `pnpm rebuild`.
`approve-builds` re-loads config after writing settings so the rebuild's
policy reflects the new `allowBuilds`; the frozen path then rewrites
`.modules.yaml` to pnpm's exact end state (decided entries removed, undecided
kept). Adds a boolean-aware `set_allow_builds` writer to
`workspace-manifest-writer` and an `allow_build_key_from_ignored_build`
helper (port of `@pnpm/building.policy` key derivation).
Tested with unit tests for the helper and writer plus mocked-registry
integration tests covering listing, approve, deny, and rebuild.
Pacquet-side port of existing TypeScript commands; no changeset needed.
The proxied-tarball integrity fix (pnpm/pnpm#12570, GHSA-5f9g-98vq-2jxw)
started reconstructing each rewritten dist.tarball filename from its
version key (`<name>-<version>.tgz`). That assumes upstream tarball names
are always canonical, which breaks packages like esprima-fb whose real
npm tarball is `esprima-fb-3001.0001.0000-dev-harmony-fb.tgz` for version
`3001.1.0-dev-harmony-fb`: the rewritten URL no longer matched what npm
hosts, so the client recorded the wrong lockfile URL and the proxied
fetch 404'd.
Preserve the upstream basename verbatim in the rewrite again, and resolve
a tarball request's version and dist.integrity by matching the requested
filename against each version's dist.tarball basename instead of parsing
the version out of the filename. OSV screening re-runs against the
resolved version when it differs from the filename-derived one.
The GHSA protection is unchanged: served bytes are still verified against
the SRI declared by the version that owns that tarball name, so a
preserved name cannot smuggle in bytes of another provenance. Tests that
encoded the canonical-reconstruction behavior are updated to assert
basename preservation, with new coverage for non-canonical names.
Also fix a pre-existing compile break in the pnpr server test target:
UserStore::in_memory gained a MaxUsers argument (pnpm/pnpm#12581) but one
test call site was not updated.
pnpr's resolver endpoint could previously accept anonymous resolve jobs and start outbound dependency-resolution work before checking any caller identity. Mount auth middleware on /-/pnpr/v0/resolve so Basic/Bearer credentials from the HTTP Authorization header are verified before Axum buffers or parses the body. Reject duplicate or non-text Authorization headers rather than picking one.
The resolver now loads configured auth state at startup, including resolver-only deployments, so configured htpasswd/token/SQL backends are honored. New-user registration defaults to disabled unless auth.htpasswd.max_users is explicitly configured, preventing anonymous callers from creating credentials on a fresh server.
Update pnpm and pacquet resolver fixtures to provision and send pnpr credentials, and add regression coverage proving anonymous Git resolve requests do not trigger egress while authenticated resolver requests still work.
Enforce pnpr's unpublish package policy independently from publish authorization.
pnpr already parsed an `unpublish` field from Verdaccio-style package rules, but destructive registry writes still checked only the publish permission. That let a caller who was allowed to publish but excluded from unpublish delete packages, delete tarballs, or replace a packument.
The policy model now carries an effective unpublish access list. Missing, null, or empty unpublish values deny destructive writes. The bundled config and README examples set unpublish explicitly where authenticated users should keep destructive-write access.
Package deletion and tarball deletion now check Action::Unpublish. Full packument replacement checks both publish and unpublish because it can rewrite package contents while also serving the partial-unpublish flow.
Regression coverage exercises missing and explicit deny behavior, publish-authorized package deletion denial, publish-authorized tarball deletion denial, and packument replacement requiring both permissions.
pnpr allowed anonymous self-registration by default. An omitted
`auth.htpasswd.max_users` mapped to `Unlimited`, and combined with the
default `$authenticated` publish policy on `**`, an anonymous client
could self-register, obtain a token, and publish or overwrite packages.
Make registration opt-in:
- A missing `max_users` now disables registration (the enum default and
the YAML mapping are `Disabled`); there is no YAML spelling for
"unlimited". Operators set an explicit positive cap to allow sign-ups.
- The in-memory user store (no `auth.htpasswd.file`) honored no cap and
ignored config; it now takes the cap from `AuthState::load`.
- `router()`/`try_router()` honor `auth.htpasswd.max_users` via
`AuthState::in_memory_with_max_users` instead of hardcoding `Unlimited`,
so library embedders inherit the opt-in default.
- The bundled fallback `config.yaml` ships locked down (`max_users: -1`);
a `--max-users` CLI override lets tests/benchmarks opt in. pnpm's e2e
registry passes `--max-users 1000`.
Test fixtures opt in explicitly where they create accounts.
Addresses GHSA-fg2v-jp32-w784 (CAND-PNPM-029).
pnpr persisted and surfaced each bearer token's readonly and cidr_whitelist
restrictions but never applied them during authorization, so a token marked
read-only or pinned to a network could still publish and mutate packages from
anywhere (GHSA-rp44-v426-6m56 / CAND-PNPM-034).
TokenBackend::lookup_record (a default method reusing find_by_key) resolves
the full record, and an axum middleware authenticates every request once:
it resolves the caller, enforces the bearer token's read-only / CIDR
restrictions before a write handler buffers its body, and stashes the
resolved Identity in request extensions for handlers to read via an
AuthedCaller extractor.
- Read-only tokens are limited to non-mutating methods (PUT/DELETE -> 403).
- CIDR-pinned tokens are checked against the real socket peer (ConnectInfo),
never a forwarding header; CIDR matching handles IPv4/IPv6, /0../32 and /128,
bare hosts, and IPv4-mapped IPv6 peers. Malformed entries and an unavailable
peer fail closed.
Resolving the caller once removes the second token lookup authed requests
previously paid (a round-trip on the remote libsql backend) and the
policy/identity race two independent lookups allowed. Basic-auth, anonymous,
and unknown tokens pass through unchanged and stay subject to the per-package
access policy; a store failure surfaces as a 5xx. pnpr-only; no change to the
pnpm CLI or pacquet.
Normalize blank and whitespace-only runtime selectors consistently in pnpm and pacquet.
The runtime command can produce `runtime:` when no version is provided, and hand-edited manifests may contain whitespace-only selectors. Treat those cases as `latest` in the TypeScript runtime resolvers, the pacquet runtime resolvers, and the manifest conversion helpers.
Also make manifest writeback reject malformed dependency fields before pruning managed runtime entries. This prevents a non-object dependency field from being interpreted as a removed runtime dependency and causing silent data loss during save.
Windows can surface opening <storage>/foo/foo-1.0.0.tgz when <storage>/foo is a regular file as NotFound rather than NotADirectory. The tarball handler treated NotFound as a hosted-store miss, so it fetched from the configured upstream even though the hosted store was in a faulted state.
Re-check the package path before classifying NotFound as a miss. Missing package directories and real directories still behave as cache misses; a non-directory package path returns a storage error, so the tarball handler fails closed before proxying. Add a storage regression covering this classification and keep the existing integration test as the endpoint guard.
Reject unsafe pnpr usernames before auth storage lookup or persistence.
The htpasswd backend serializes users as line-oriented username:hash records, so usernames containing structural characters must never reach the persistence boundary. Move shared username validation ahead of existing-user lookup, apply the same Basic-auth guard, and reject invalid usernames while parsing persisted htpasswd files.
Apply the same contract to the libsql and SQL auth backends so configured auth storage cannot authenticate username shapes that the local htpasswd backend rejects.
Add unit and persistence regression coverage for delimiter, line break, comment-marker, control-character, and edge-whitespace usernames.
* fix(dlx): make failed-install cache cleanup best-effort
On Windows, `pnpm dlx` could fail with a spurious "EBUSY: resource busy
or locked, rmdir" error. When an install into the dlx cache failed, the
catch block removed the partially-populated prepare dir with
`fs.promises.rm(cachedDir, { recursive: true, force: true })`. That call
has no retries, so it died on the same lingering Windows handle (a
just-run install script's child process, or antivirus scanning freshly
written files) and threw EBUSY — which then replaced and masked the
original install error.
Make the cleanup best-effort: swallow its failure so the original error
always surfaces, and add `maxRetries`/`retryDelay` so the removal itself
succeeds once the transient lock clears. A leftover prepare dir is
harmless — it has a unique name and findCache only trusts the `pkg`
symlink.
The pacquet port already removes the prepare dir best-effort (`let _ =
fs::remove_dir_all(...)`) and returns the original error, so the
user-visible behavior already matches; only the (non-observable) retry
is absent there.
* fix(dlx): log dlx cache cleanup failures instead of swallowing them
Catch the best-effort cache cleanup with a narrow handler that logs the
failure via logger.warn (mirroring tryRemovePkg in modules-cleaner's
prune) instead of a blanket `.catch(() => {})`. The original install
error is still the one rethrown, so cleanup failures stay visible without
ever masking the real cause.
Port the runtime command to pacquet by adding a runtime/rt CLI entry and routing runtime set <name> <version> through the existing add pipeline as <name>@runtime:<version>.
The command matches pnpm's local save behavior: devEngines.runtime is the default, --save-prod targets engines.runtime, and --save-dev wins when both flags are present. The global path is parsed but rejected because pacquet does not yet support global package management, matching the existing update/outdated global boundary.
Add the manifest writer conversion that folds runtime:<version> dependencies back into devEngines.runtime and engines.runtime before saving, complementing the existing read-time conversion used by install and lockfile checks.
Implemented the `cache` command for pacquet with support for `list`, `list-registries`, `view`, and `delete`. This ensures the pacquet port has parity with the TypeScript CLI for cache management logic.
Related to pnpm/pnpm#11633.
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
Bind proxied tarball requests to the selected packument version.
Require supported dist.integrity before serving upstream or cached tarballs.
Verify cache hits before response construction.
Fail closed on a hosted-store fault instead of falling through to the
upstream proxy, so an I/O error in the authoritative store can never serve
bytes of a different provenance for the same package name.
Delete invalid cache entries and promote upstream bytes only after SRI verification.
For cache:false uplinks, verify into a temp file and stream the same open
handle (rewound to the start) instead of dropping and reopening it by path,
closing the TOCTOU window where an attacker-writable cache directory could
swap the verified bytes before they are served; remove the temp file after
streaming.
Harden publish attachment SRI parsing for missing or unsupported integrity.
Addresses GHSA-5f9g-98vq-2jxw.
Some registries generate tarballs on demand and cannot list an integrity in
their packument. pnpm then wrote integrity-less lockfile entries on the first
install and failed the next one with ERR_PNPM_MISSING_TARBALL_INTEGRITY, unable
to install from its own lockfile.
Compute the missing integrity from the downloaded bytes and write it into the
resolution before the lockfile is built:
- Add an optional `resolutionNeedsFetch` contract to the fetcher API (backward
compatible, since custom fetchers come from hooks). The remote-tarball fetcher
reports it when a resolution lacks integrity; the picked fetcher's signal flows
through PackageResponse -> ResolvedPackage so nothing re-derives it.
- The package requester downloads such tarballs (including under --lockfile-only /
skipFetch / not-installable) and fills the computed integrity onto the resolution
via the already-running `fetching` promise, so dependency resolution isn't
blocked. The deps-resolver awaits only the flagged entries before updateLockfile,
because the integrity feeds the global virtual-store paths.
- Move read-side enforcement into the npm resolver's lockfile verifier
(MISSING_TARBALL_INTEGRITY): reject a registry/http(s) tarball entry whose
integrity is missing/empty/non-string, fail-closed, before the URL-keyed and
semver short-circuits. Drop the earlier read-side auto-heal (a missing-field
bypass). Harden against tampered lockfiles (non-string tarball/integrity).
- Reuse the fetcher picked during resolution on the fetch path instead of running
pickFetcher (and a custom fetcher's async canFetch) twice per package.
Mirrored in pacquet: PrefetchingResolver computes the integrity for integrity-less
tarball resolutions during resolution (FetchTarballForResolution::run), deduped per
URL with a singleflight cache.
Closespnpm/pnpm#12145.
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
Implements the `cat-index` command for the Rust pacquet CLI. It mirrors the exact behavior of pnpm's `cat-index`.
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
Load the local OSV index for the pnpr registry surface when osv is enabled, not just for the resolver surface.
Registry responses now apply the index at serve time. Full and abbreviated packuments, version manifests, and dist-tag responses omit vulnerable versions without mutating cached upstream bytes. Direct version-manifest requests for filtered versions return 404, and dist-tags pointing at filtered versions are removed from served responses.
Tarball requests parse the version from the validated npm tarball filename and return 403 for vulnerable versions after the normal access policy check, before reading from cache or fetching upstream. This keeps private package metadata behind the existing auth boundary.
The tests cover proxied and cached packuments, direct version manifests, dist-tags, tarballs before upstream fetch, tarballs from cache, registry-only OSV loading, and private-package access ordering.
Closes https://github.com/pnpm/pnpm/issues/12561.
The pnpr resolver's two POST endpoints were the only proprietary routes
served outside npm's reserved /-/ namespace, where they overlapped the
package path space (a package literally named `v1`). Move them under the
/-/pnpr namespace alongside the existing capability handshake:
POST /v1/resolve -> POST /-/pnpr/v0/resolve
POST /v1/verify-lockfile -> POST /-/pnpr/v0/verify-lockfile
The GET /-/pnpr handshake now advertises protocol version 0 to match, and
the Rust client's PROTOCOL_VERSION drops to 0. Keeping every pnpr route in
the reserved namespace removes the package-collision concern and lets the
disabled-resolver branch stop special-casing the old npm-compatible GET
paths.
No backward compatibility is kept: the resolver protocol is not yet
released. Server and both clients (Rust pacquet-pnpr-client and the
TypeScript `@pnpm/pnpr.client`) change together.
pnpr now exposes its registry and resolver surfaces as independent,
config-toggleable features (per-surface `registry:` / `resolver:` blocks,
both enabled by default; CLI `--disable-registry` / `--disable-resolver`).
This supports running a stateless resolver-only tier in front of an
existing registry, or a registry with no server-side resolution. At least
one surface must stay enabled, validated at config load and after CLI
overrides.
The resolver paths overlap the registry's catch-all param routes, so when
the resolver is disabled they are registered to an explicit 404 stub —
otherwise a capability probe (GET /-/pnpr) would fall through to the
registry and be proxied upstream, surfacing a 502 where clients expect the
"no resolver" 404.
OSV stays a top-level (cross-cutting) setting rather than nesting under a
surface. Registry-side OSV screening is not yet implemented; tracked in
pnpm/pnpm#12561.
Updates the minimumReleaseAgeExcludes output to combine entries per module, matching rec in docs. (Closespnpm/pnpm#12534).
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
Qodo re-runs its full review on every push (`push_commands`), which on a
long-running PR reposts low-severity perf/style nits as fresh inline
threads each commit. Keep the per-push review (it does catch issues
introduced in later commits) but raise `inline_comments_severity_threshold`
from 2 to 3 so only higher-severity findings get standalone inline
threads. `comments_location_policy = "both"` is unchanged, so every
finding still appears in the review summary — nothing is dropped, it's
just not re-threaded inline on each push.
Written by an agent (Claude Code, claude-opus-4-8).
`pacquet add <name>@owner/repo#sha` (and GitHub / GitLab / Bitbucket URL
forms) previously saved the request verbatim. Save the resolver's shortcut
form instead — `github:owner/repo#sha` — matching pnpm's saved
normalizedBareSpecifier. The normalization runs only in the non-registry
fallback (a git shorthand isn't claimed by the npm resolver, so no registry
fetch happens), leaving registry ranges, npm: aliases, file:, link:,
workspace:, and tarball URLs untouched.
Related to #12548.
Add feature-gated pnpr auth backends so deployments can build with libsql, PostgreSQL, or MySQL support instead of locking the registry to one database driver.
The auth state still resolves to the existing UserBackend and TokenBackend trait objects. Configuration now accepts backend.libsql, backend.postgres/backend.postgresql, or backend.mysql and rejects selecting multiple shared databases.
PostgreSQL and MySQL use a shared SQLx-backed auth implementation with driver-specific placeholder syntax. The shared auth schema uses common column types, and pnpr avoids SQLite-only upsert syntax in auth and verdict-cache writes.
Port pnpm's post-resolution manifest writer into the pacquet
package-manager crate as two modules mirroring pnpm's crate boundaries:
- update_project_manifest_object: port of @pnpm/pkg-manifest.utils'
updateProjectManifestObject (field upsert with cross-field delete,
peer-range derivation, guessDependencyType, empty-spec preservation).
- update_project_manifest: port of updateProjectManifest, matching
resolved direct deps to wanted deps by alias (with a github: shorthand
fallback) instead of by position, including the fix from #11373.
Both modules ship with the ported pnpm unit tests (14 total). They are
not yet wired into add/update; that integration (surfacing resolved
direct deps from Install and threading the catalog
userSpecifiedBareSpecifier) is tracked in #12548.
Related to #11267, #11373. Part of #12548.
Adds `pnpm cat-file` functionality to the `pacquet` CLI. This extracts the
base64-encoded file hash from an integrity string (e.g. `sha512-...`),
decodes it, and reads the corresponding file from the CAFS store directory
at `files/XX/YYYY...`.
Includes a new e2e test verifying correct lookup and read operations.
updateProjectManifest previously reconstructed the pairing between each
resolved direct dependency and the wanted dependency it came from — first by
alias, then by specifier shape, then by array position. Every one of those is
fragile: a failed optional dependency drops out of directDependencies and
shifts a positional pairing (#11267), and an aliasless selector that resolves
to an alias already in the manifest matches the stale aliased entry instead of
the request.
Carry the originating wanted dependency on each resolved direct dependency
(PkgAddressOrLinkBase.wantedDependency -> ResolvedDirectDependency.wantedDependency),
set where the resolver builds the result and already has it in scope, and have
updateProjectManifest read rdd.wantedDependency directly. This removes all the
alias/position/specifier heuristics (and the earlier normalizeGitHubBareSpecifier
band-aid) and fixes both correctness gaps structurally.
Adds unit tests for the failed-optional (#11267), alias-collision re-add, and
aliasless-optional-failure cases.
Closes#11267
---------
Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com>
Co-authored-by: Hermes Agent <hermes@example.invalid>
Co-authored-by: Zoltan Kochan <z@kochan.io>
Port the `restart` command from
<https://github.com/pnpm/pnpm/blob/d4a2b0364c/exec/commands/src/restart.ts>
to the Rust pacquet CLI. `restart` delegates to `RunArgs::run()` three
times (stop → restart → start), matching the TypeScript handler that
calls the `run` handler sequentially for each script name.
Add a standalone `stop` command alongside the existing `start` and
`test` shortcuts. `stop` silently succeeds when no script is defined
(like `start` with its `node server.js` fallback), matching npm
convention.
Both commands forward trailing args and the `--if-present` flag to
each script. Lifecycle hooks (`pre<name>`/`post<name>`) apply when
`enablePrePostScripts` is set, because each step runs through the
full `RunArgs` pipeline.
Tests cover:
- Sequential execution order (stop → restart → start)
- Failure propagation (stop fails → restart/start skipped)
- `--if-present` skipping missing scripts
- Args forwarding to each script
- Standalone `stop` with and without a script
- Regression guard for existing `start` command
Related: pnpm/pnpm#11633
Ports the create command from pnpm's TypeScript implementation
(@pnpm/exec.commands/create) to Rust. The handler converts the
user-provided name to a create-* package name via
convertToCreateName and delegates to the existing dlx
infrastructure — matching pnpm's exact design where create.ts
calls dlx.handler().
Implements the Stage 3 'Script & process' item from
pnpm/pnpm#11633 (pacquet roadmap).
Changes:
- Add pacquet/crates/cli/src/cli_args/create.rs: command handler,
name-conversion algorithm (13 unit tests covering all npm naming
conventions), and error for missing args.
- Wire Create(CreateArgs) into CliCommand dispatch.
- Add 5 integration tests (error handling, happy path, args
forwarding, --allow-build, -c/--shell-mode).
- Add create-touch-file-one-bin fixture to pnpr mock registry.
Add local OSV npm database support to pnpr. When enabled, pnpr loads an OSV npm dump (an `all.zip` or an extracted JSON directory) from disk at startup and fails before serving requests if the configured database is missing, not a regular file, empty of npm advisories, or otherwise invalid. Resolution then uses the in-memory index rather than querying OSV during package selection. Package names are matched case-insensitively, OSV range events are sorted before evaluation, and per-record reads are size-bounded.
Add a resolver-time package version guard to pacquet's npm resolver. The guard can reject a concrete package version, after which the picker filters that version out of the packument and tries the normal selection flow again. pnpr uses this hook to avoid vulnerable versions while preserving existing semver selection semantics. When every matching version is rejected, the resolver returns a distinct AllVersionsBlockedError rather than reporting the spec as unsupported.
Check frozen, cached, verified, and freshly produced lockfiles against the local OSV index, gating tarball entries on the tarball URL rather than the tamper-prone gitHosted flag. The pnpr lockfile-verdict cache records a content-based OSV database fingerprint in its policy snapshot, so a changed vulnerability database invalidates previous cached verification passes and forces rechecking under the new data.
Add fallible try_router / try_router_with_auth constructors so callers that build the router directly can handle an invalid OSV database recoverably instead of panicking.
Add tests for OSV range matching (including out-of-order events), exact-version and case-insensitive matching, withdrawn handling, zip and directory loading, empty/non-regular-file rejection, pnpr config parsing, guarded re-pick and all-versions-blocked behavior, and tarball OSV-checkability.
Reads `.modules.yaml` unconditionally before dispatching the install path. If the layout settings (nodeLinker, hoist patterns, etc.) differ from the currently active config, it purges `node_modules` completely. This mirrors upstream's `validateModules` prune side-effects and prevents leaving behind stale dependencies or symlinks when layout settings change.
claimChildrenResolution let a non-owner occurrence of a shared package reuse the
owner's missingPeersOfChildren when `existing.owner.depth >= currentDepth ||
existing.missingPeersOfChildren.resolved`. The second clause made reuse depend on
whether the owner's resolution had settled by claim time. Under concurrent
resolution that timing varies run to run, so a deeper consumer inherited the
owner's missing peers on some runs but not others — flipping an optional
transitive peer (e.g. `@babel/core`, reached via styled-jsx) in and out of a
package's resolved peer suffix and churning the lockfile, with intermittent
`pnpm dedupe --check` failures in CI.
Drop the `.resolved` clause: reuse only when the owner is at the same or a deeper
depth, a function of the dependency graph rather than completion order.
The `.resolved` flag was introduced in pnpm/pnpm#5467 (closing pnpm/pnpm#5454) to
avoid a deadlock where, with auto-install-peers in a workspace, a shared package
awaited its own not-yet-settled missingPeersOfChildren promise. Removing the
clause is strictly more conservative — a shallower owner's promise is never
reused, settled or not, so no unsettled promise is ever awaited and the deadlock
cannot return. The pnpm/pnpm#5454 regression test still passes, as do the peer,
dedupe, and cyclic suites. The deterministic owner selection from pnpm/pnpm#12362
made shared-package ownership order-independent but had moved this timing branch
in verbatim without neutralizing it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The TypeScript stack was relocated under pnpm11/ in pnpm/pnpm#12537, which
moved copy-artifacts.ts to pnpm11/__utils__/scripts/src/. Its
`import.meta.dirname` + '../../..' now resolves to the pnpm11/ directory
instead of the repository root, so `pn copy-artifacts` wrote the release
tarballs to pnpm11/dist.
The Release workflow attests (`subject-path: 'dist/*'`) and uploads
(`files: dist/*`) from the repo-root dist, so a tagged release would have
produced a GitHub Release with no binary assets and a failing provenance
attestation, even though the npm publishes (filtered by package name)
still succeeded.
Resolve repoRoot to the actual repository root again and point the
artifact source directories at their new pnpm11/pnpm/ locations.
The TypeScript pnpm CLI was relocated from `pnpm/` to `pnpm11/pnpm/` in
pnpm/pnpm#12537, but the "Extract pnpm CLI e2e test duration" step still
passed `--package-dir pnpm`. That path no longer exists, so the
exec-summary lookup found no entry and the step exited 1, failing the
full TS CI test job on main.
Point `--package-dir` at the package's new location, `pnpm11/pnpm`.
`pnpm audit` enumerates the install paths to every vulnerable package. The
reachability-based pruning added in 11.5.1 (pnpm/pnpm#12087) lets the walker
skip subtrees that reach no unsaturated finding by precomputing, per node, the
set of vulnerabilities reachable from it.
That getter only memoised acyclic subtrees: a node whose subtree contained a
cycle was `complete === false`, and so was every ancestor up to the importer
roots. None of them were cached, so their reachable set was recomputed on every
query. Real dependency graphs commonly contain cycles, and a single cycle high
in the graph makes a large fraction of nodes non-memoisable, yielding an O(N^2)
walk. This matched the report in pnpm/pnpm#12212 exactly (CPU-bound, identical
audit output across versions).
Reachability is now computed with Tarjan's strongly-connected-components
algorithm. Every node is scanned once; all members of an SCC reach the same set
of vulnerabilities and share one set, finalised in reverse-topological order.
Cyclic graphs are handled in O(N + E).
The reachable set is used only to prune, so it must never under-approximate
(that would hide a real finding). Tarjan yields the exact set for every node,
so no finding can be dropped, and the path-recording logic is unchanged. The
getter returns ReadonlySet<string> so the shared sets cannot be mutated by
callers, and a missing memo entry (an impossible-by-construction state) throws
rather than silently returning an empty set.
A regression test asserts the read-count growth ratio between two cycle sizes
(L=200 and L=400) is sub-quadratic: the fix scales ~2x (linear), the previous
code ~4x (quadratic). Asserting the ratio cancels the per-node constant, so the
test is not brittle to constant-factor changes.
Closespnpm/pnpm#12212.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Zoltan Kochan <z@kochan.io>
* fix(pacquet): read the pnpm CLI manifest from its pnpm11/ location
pnpm/pnpm#12537 moved the TypeScript pnpm CLI under `pnpm11/`, so
`pnpm_version_from` could no longer find `pnpm/package.json`;
`current_source_pnpm_version` then returned `None` and
`package_manager_to_sync` (and its test) failed.
Written by an agent (Claude Code, claude-opus-4-8).
* fix(pacquet): read pnpm's config-reader source from its pnpm11/ location
The `pnpm_default_parity` contract tests read pnpm's `defaultOptions` from
`config/reader/src/index.ts` in the TypeScript tree, which moved under
`pnpm11/` in pnpm/pnpm#12537. Point the path at the new location so the
tests stop failing with a missing-file panic.
Written by an agent (Claude Code, claude-opus-4-8).
Rename the `product: pnpm` label to `product: pnpm@11` and apply it only
when changes touch the pnpm11/ directory. After the TypeScript CLI moved
under pnpm11/, the old "any code outside pacquet/ and pnpr/" instruction
over-matched shared root files (workspace config, CI, docs), so the label
no longer cleanly tracked the TypeScript product.
The TypeScript pnpm CLI freezes at v11; pnpm 12 will be the Rust pacquet
port. To make that split legible, all TypeScript source, test, and build
directories move under a new top-level pnpm11/ directory. The name states
the version boundary rather than implying a behavioral fork, since the two
stacks are meant to behave identically.
Scope is source-only: the shared workspace root stays at the repo root.
pnpm-workspace.yaml, package.json, pnpm-lock.yaml, .pnpmfile.cjs,
.meta-updater, __patches__, .changeset, .husky, and the lint/spell configs
remain in place, so one pnpm workspace and one Cargo workspace still span
all three products. pnpr/client and pacquet/tasks/registry-mock stay as
cross-product workspace members.
Rewiring the move required:
- pnpm-workspace.yaml globs prefixed with pnpm11/
- root package.json script paths, eslint.config.mjs, tsconfig.lint.json,
.gitignore, and CODEOWNERS updated
- .meta-updater/src/index.ts literals repointed (pnpm11/pnpm/package.json,
pnpm11/__utils__, pnpm11/__typings__, and the main package directory)
- regenerated every moved package's repository/homepage URL via meta-updater
- pnpm11/pnpm/bundle-deps.ts and __utils__/scripts/src/typecheck-only.ts
climb one more level to reach the repo root
.meta-updater stays at the repo root because @pnpm/meta-updater resolves
its config at <cwd>/.meta-updater/main.mjs.
TS CI (.github/workflows/ci.yml) now only runs when pnpm11/-relevant paths
change, via a dorny/paths-filter changes job plus a TS CI / Success
aggregate gate; branch protection should require only that gate.
pnpm install --ignore-workspace auto-populated ignored builds into the
allowBuilds map of pnpm-workspace.yaml, overwriting committed true/false
values with the "set this to true or false" placeholder — even under
--frozen-lockfile, which must stay read-only.
The ignore-workspace CLI flag is now a first-class Config field
(ignoreWorkspace, mirroring ignoreWorkspaceCycles) instead of being read
from the untyped cliOptions bag. handleIgnoredBuilds reads it directly and
skips writing to allowBuilds when the workspace is ignored. The strict
ignored-build failure is unchanged.
Closespnpm/pnpm#12469
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
With `auto-install-peers` (default since v8), peer dependencies resolve into
the lockfile indistinguishably from a package's own deps, so `pnpm sbom` lists
them as the package's components. For a published-library SBOM that's wrong —
peers are supplied by the consumer. `--exclude-peers` drops them, plus any
transitive subtree reachable only through them.
peerDependencies come from the manifest (the lockfile carries no marker). The
collector filters those names at each importer's top level, so a peer's
exclusive subtree is never walked while a package also reached via a real dep
stays. With no `--filter`, every importer is walked, so each importer's own
manifest is resolved (via `safeReadProjectManifestOnly`, which tolerates a
missing manifest) and peers in workspace sub-packages are dropped too.
The flag name matches `pnpm list --exclude-peers`; the SBOM behavior is
stricter, pruning the exclusive subtree rather than only hiding leaf peers.
CycloneDX 1.7 has no scope or relationship for "consumer-provided peer", so
omission is the only spec-clean handling.
Known limitation: an aliased peer (`"x": "npm:real@1"` in `peerDependencies`)
is not excluded, since matching is by resolved package name. Aliased peer deps
are vanishingly rare in practice.
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
A non-retryable error code (e.g. SELF_SIGNED_CERT_IN_CHAIN) was thrown inside the
detached op.attempt callback, so the governing promise never settled: the caller
hung and the throw surfaced as an unhandled rejection that crashed the process.
Reject the promise instead, mirroring the retries-exhausted path right below it.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Zoltan Kochan <z@kochan.io>
Add @pnpm/resolving.tarball-url, which builds and recognizes the canonical npm
tarball URL of a package. It vendors getNpmTarballUrl (previously the external
get-npm-tarball-url dependency) and adds isCanonicalRegistryTarballUrl.
@pnpm/lockfile.utils (toLockfileResolution, pkgSnapshotToResolution) and
@pnpm/installing.env-installer now import from the new package; the private copy
of the canonical check in toLockfileResolution is removed, and the external
get-npm-tarball-url dependency and its catalog entry are dropped. The vendored
getNpmTarballUrl is byte-for-byte equivalent to get-npm-tarball-url@2.1.0, so the
fetch paths that use it are unchanged.
Two correctness fixes are folded in while consolidating the logic:
- the scoped-package unescape now handles uppercase %2F as well as %2f
(percent-encoding is case-insensitive), so canonical scoped URLs are not
needlessly persisted;
- protocol-insensitive comparison strips only a leading http(s):// scheme via
regex instead of splitting on the first :// (which could truncate a URL
containing a later :// and yield a false-positive "canonical" match).
Both fixes are mirrored in the pacquet port (is_canonical_registry_tarball_url
in pacquet/crates/lockfile/src/resolution.rs) so the two stacks omit the same
canonical scoped registry URLs from the lockfile, with matching regression tests.
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
When a project transitions from non-GVS to GVS mode, hoisted symlinks at
`node_modules/.pnpm/node_modules/<dep>` still pointed into
`node_modules/.pnpm/<depPath>/node_modules/<dep>`. The
`symlinkHoistedDependency` function only checked `isSubdir(virtualStoreDir, ...)`
— with GVS active, `virtualStoreDir` is `storeDir/links`, so these old symlinks
were classified as "external" and silently skipped.
Added `internalPnpmDir` (derived from `path.dirname(privateHoistedModulesDir)`)
as a second check. Symlinks under `node_modules/.pnpm/` are now recognized as
pnpm-internal and correctly replaced, matching the pattern in `safeIsInnerLink`.
The broader TypeScript type inference breakage (#9739) also has an architectural
dimension: when TypeScript follows a symlink to storeDir/links/<hash>/, Node's
module resolution walk-up never reaches node_modules/. This is the same root
cause as #12437 (packages from links store can't resolve transitive deps) and
requires a separate architectural fix.
Closespnpm/pnpm#9739
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>