Skip to content

feat(lockfile): key named-registry packages by their registry - #13528

Merged
zkochan merged 30 commits into
mainfrom
named-registries-lockfile
Aug 2, 2026
Merged

zkochan merged 30 commits into
mainfrom
named-registries-lockfile

Conversation

@zkochan

@zkochan zkochan commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Summary

namedRegistries shipped in v11.1.0, but the lockfile was never extended to match it. A package resolved from a named registry lands under a plain name@version key, so two registries serving the same name+version collapse onto one packages: entry — whichever resolves first wins, and the other consumer silently gets the wrong tarball. There is also no registry marker anywhere in the lockfile: entry lookup keys on refToRelative(ref, name), so a work:foo spec can be satisfied by an entry that was really resolved from npmjs, and vice versa.

This keys named-registry packages as <name>@<registryName>:<version>:

importers:
  .:
    dependencies:
      foo:
        specifier: work:^1.0.0
        version: work:1.0.0
packages:
  [email protected]:            # from npmjs
    resolution: {integrity: sha512-aaa...}
  foo@work:1.0.0:       # from namedRegistries.work
    resolution: {integrity: sha512-bbb...}

The lockfile format version does not change. It stays 9.0.

The alias lives in the version slot because the dep-path grammar already admits colon-bearing non-semver values there (foo@file:..., node@runtime:...), so every existing mechanism composes unchanged: foo@work:1.0.0([email protected]) parses with the current balanced-paren scan, depPathToFilename escapes the colon to +, and refToRelative already reconstructs foo@work:1.0.0 from a work:1.0.0 ref with no change. The alias is recorded rather than the registry URL so keys stay readable and independent of registry configuration.

Tarball URLs now apply the pre-existing "omit whatever is reconstructible" rule against the named registry instead of the scope-routed default, so a canonical named-registry tarball serializes as bare {integrity} and is recomputed from the alias on read. Registries whose URLs cannot be rebuilt from name+version+base (GitHub Packages hashed /download/ URLs) keep the explicit field, exactly as before.

Why no format bump

An earlier revision of this PR introduced format 12.0 behind a useLockfileV12 setting. That was dropped: it was the one part of the change that could not be adopted incrementally.

lockfile/fs/src/read.ts gates compatibility on the major version alone — same code in v10.9.0 — so a client that has not learned 12.0 does not degrade, it rejects the file outright. That includes pnpm engines embedded in other tools, which cannot be patched after the fact.

Nothing in the format needed the bump. Registry-qualified keys appear only for packages resolved through namedRegistries, the tarball-omission rule only fires on those entries, and the alias validation is config-time. A project that does not configure a named registry produces a byte-identical lockfile. That makes this additive in the 5.3 → 5.4 / 6.0 → 6.1 sense rather than breaking in the 6.x → 7.0 sense — and consistent with pnpm 10 and 11, which both shipped on 9.0 because neither broke the format.

Qualification is therefore unconditional: the correctness fix reaches everyone using named registries rather than only those who opt in.

Reserved aliases

Named-registry aliases that would shadow a reserved specifier prefix (file, link, workspace, runtime, npm, jsr, ...) are now rejected at resolver construction with ERR_PNPM_RESERVED_NAMED_REGISTRY_NAME. They were previously accepted and silently shadowed by that prefix's own resolver in the chain — harmless while the alias only appeared in specifiers, but genuinely ambiguous in the version slot. This replaces the three "local protocol wins over a colliding alias" tests in both stacks.

Known gaps (both pre-existing, called out for a follow-up)

  • pacquet's update --latest chain still builds no named-registry resolver.
  • Docs for namedRegistries still need writing.

Squash Commit Body

Packages resolved from a named registry are now keyed
`<name>@<registryName>:<version>` (e.g. `foo@work:1.0.0`) instead of
`<name>@<version>`. Without the qualifier the same name+version served by two
different registries collapsed onto one `packages:` entry, so whichever
resolved first won and the other consumer silently got the wrong tarball.
The lockfile also carried no registry marker at all: entry lookup keys on
`refToRelative(ref, name)`, so a `work:foo` spec could be satisfied by an
entry that was really resolved from npmjs, and vice versa.

The alias goes in the version slot because the dep-path grammar already
admits colon-bearing non-semver values there (`foo@file:...`,
`node@runtime:...`), so every suffix mechanism composes unchanged:
`foo@work:1.0.0([email protected])` parses with the existing balanced-paren scan,
`depPathToFilename` escapes the colon to `+`, and `refToRelative` already
reconstructs `foo@work:1.0.0` from a `work:1.0.0` snapshot ref with no
change. The alias is recorded rather than the registry URL so keys stay
readable and independent of registry configuration; the concrete URL is
still pinned by the resolution when it is not derivable.

Tarball URLs now apply the pre-existing "omit whatever is reconstructible"
rule against the named registry instead of the scope-routed default, so a
canonical named-registry tarball serializes as bare `{integrity}` and is
recomputed from the alias on read. Registries whose URLs cannot be rebuilt
from name, version, and base URL (GitHub Packages hashed `/download/` URLs)
keep the explicit field, exactly as before.

The lockfile format version is unchanged. Registry-qualified keys are
additive: they appear only for packages resolved through `namedRegistries`,
the tarball-omission rule only fires on those entries, and the alias
validation is config-time, so a project that configures no named registry
produces a byte-identical lockfile. A format bump would not have been
adoptable incrementally — readers gate on the major version alone and reject
an unknown one outright rather than degrading, including pnpm engines
embedded in other tools, which cannot be patched after the fact.

Named-registry aliases that would shadow a reserved specifier prefix
(file, link, workspace, runtime, npm, jsr, and so on) are now rejected at
resolver construction with ERR_PNPM_RESERVED_NAMED_REGISTRY_NAME. They were
previously accepted and silently shadowed by that prefix's own resolver in
the chain, which was harmless while the alias only appeared in specifiers;
in the version slot it would make the dep path genuinely ambiguous.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • 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 (Codex, GPT-5), reworked by an agent (Claude Code, claude-opus-5).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added named-registry support for dependency resolution, lockfiles, peer identities, licenses, and SBOMs.
    • Introduced lockfile format 12.0, preserving distinct entries for identical packages from different registries.
    • Added built-in GitHub Packages support and configurable registry aliases.
    • pnpm 11 supports opt-in format 12.0; pnpm 12 enables it by default.
  • Bug Fixes
    • Invalid, reserved, malformed, or unavailable aliases now produce clear errors.
    • Existing lockfiles preserve their format during installation and updates.
  • Tests
    • Added coverage for compatibility, validation, compliance data, and multi-registry packages.

Copilot AI review requested due to automatic review settings July 31, 2026 11:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds named-registry support across pnpm and pacquet. Registry-qualified package IDs distinguish identical packages from different registries. Lockfile format 12.0 is supported, with registry identity preserved through resolution, installation, verification, inspection, license scanning, and SBOM generation.

Changes

Named-registry lockfile format 12.0

Layer / File(s) Summary
Qualified identifiers, parsing, and configuration
pnpm/crates/deps-path/..., pnpm/crates/lockfile/..., pnpm/crates/config/..., pnpm11/deps/path/..., pnpm11/core/constants/...
Adds registry-qualified semver parsing, reserved-alias validation, configuration flags, and supported lockfile versions.
Resolution, lockfile generation, and reuse
pnpm/crates/resolving-..., pnpm/crates/package-manager/..., pnpm/crates/lockfile-verification/..., pnpm11/installing/deps-resolver/..., pnpm11/lockfile/utils/...
Propagates named registries through resolution and lockfile reuse. Reconstructs tarballs from named-registry mappings. Selects lockfile format 12.0 and detects registry collisions.
pnpm 11 installation, inspection, and compliance
pnpm11/installing/..., pnpm11/deps/inspection/..., pnpm11/deps/compliance/...
Reads supported lockfile versions and forwards named registries through installation, inspection, license, and SBOM flows. Preserves registry identity in outputs.
Tests, migration, and release documentation
pnpm/crates/cli/tests/..., pnpm11/.../test/..., .changeset/...
Tests parsing, validation, format selection, migration, collision detection, peer identity, and distinct same-version packages. Documents lockfile format 12.0 and pnpm 11 configuration.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • pnpm/pnpm#11785 — Both changes modify named-registry configuration, validation, and resolution.
  • pnpm/pnpm#13109 — Both changes modify peer-resolution identity handling.
  • pnpm/pnpm#13464 — Both changes modify fast-update handling for qualified dependency paths.

Suggested labels: product: pnpm@11, product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch named-registries-lockfile
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch named-registries-lockfile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add lockfile format 9.1 with registry-qualified keys for named registries

✨ Enhancement 🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Add lockfile 9.1 keys @: to prevent cross-registry collisions.
• Recompute canonical tarball URLs via namedRegistries; fail closed when an alias is missing.
• Add opt-in + sticky writers (TS v11) and alias validation against reserved/malformed prefixes.
Diagram

graph TD
  TS["pnpm11 (TS CLI)"] --> RES["Resolver chain"] --> DP["deps.path"] --> LF["Lockfile IO"] --> YAML[("pnpm-lock.yaml 9.0/9.1")] --> REUSE["Lockfile reuse/install"] --> VER["Resolution verification"]
  RUST["pnpm (Rust CLI)"] --> RES
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Store `registryName` as a field on each lockfile package entry
  • ➕ Avoids changing dep-path / key grammar
  • ➕ Keeps key shape stable across formats
  • ➖ Still needs a unique key to prevent collisions (so the hard problem remains)
  • ➖ Requires every lookup path to join key+field correctly; easier to regress
  • ➖ Harder to make tarball reconstruction/omission purely derivable
2. Use full registry URL in the key (e.g. `foo@https://...:1.0.0`)
  • ➕ No dependence on local alias config to interpret keys
  • ➕ Globally unambiguous without extra mapping
  • ➖ Very noisy lockfiles; URLs are long and often environment-specific
  • ➖ Keys become unstable when registry configuration changes (even if content doesn’t)
3. Encode qualifier as a separate suffix (e.g. `[email protected](registry=work)`)
  • ➕ Avoids colon parsing ambiguity in the version slot
  • ➕ Could reuse existing suffix parsing patterns
  • ➖ More invasive to existing suffix grammar and filename escaping
  • ➖ Harder interop with existing refToRelative/id expectations; more bespoke logic

Recommendation: Proceed with the PR’s approach: placing the alias in the version slot (:) composes with existing dep-path grammar and suffix mechanisms, prevents collisions by construction, and enables deterministic tarball reconstruction/omission. The added reserved/malformed-alias validation is a necessary guardrail to keep the new syntax unambiguous.

Files changed (93) +1221 / -287

Enhancement (28) +378 / -19
lib.rsExpose registry-qualified helpers from deps-path (Rust) +5/-0

Expose registry-qualified helpers from deps-path (Rust)

• Adds the 'registry_qualified' module and re-exports parsing and validation helpers for other crates to consume.

pnpm/crates/deps-path/src/lib.rs

registry_qualified.rsImplement registry-qualified version parsing and alias validation (Rust) +61/-0

Implement registry-qualified version parsing and alias validation (Rust)

• Defines reserved prefixes, validates alias syntax, and parses '<registryName>:<semver>' into '(alias, Version)' for lockfile 9.1.

pnpm/crates/deps-path/src/registry_qualified.rs

pkg_ver_peer.rsAdd 'RegistryQualified' version-part to lockfile key parsing (Rust) +38/-1

Add 'RegistryQualified' version-part to lockfile key parsing (Rust)

• Introduces a dedicated 'VersionPart::RegistryQualified' variant, ensures display/parse round-trips, and adds an accessor to expose '(registry, semver)' to registry-aware callers.

pnpm/crates/lockfile/src/pkg_ver_peer.rs

dependencies_graph_to_lockfile.rsEmit 9.1 only when needed and drop canonical named-registry tarballs (Rust) +32/-3

Emit 9.1 only when needed and drop canonical named-registry tarballs (Rust)

• Threads named registry maps into lockfile building, routes tarball reconstructibility checks through the key’s named registry, avoids redundant 'version' fields for qualified keys, and stamps lockfile minor version when qualified keys exist.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs

install_with_fresh_lockfile.rsSticky 9.1 writes and named-registry plumbing into resolver + lockfile writer (Rust) +20/-1

Sticky 9.1 writes and named-registry plumbing into resolver + lockfile writer (Rust)

• Makes 9.1 emission sticky once present, threads 'named_registry_qualified_ids' into resolve options, and passes merged named registries into the lockfile builder to support tarball omission/reconstruction.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

resolve_dependency_tree.rsThread named registries through workspace dependency resolution context (Rust) +21/-1

Thread named registries through workspace dependency resolution context (Rust)

• Adds named registries to the workspace context and passes them into lockfile reuse materialization for correct tarball reconstruction.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

resolve_workspace.rsExtend workspace resolve options with named registries (Rust) +6/-1

Extend workspace resolve options with named registries (Rust)

• Adds a named registries map to the resolve options and attaches it to the workspace tree context.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs

named_registry_resolver.rsEmit registry-qualified IDs when enabled (Rust named registry resolver) +1/-0

Emit registry-qualified IDs when enabled (Rust named registry resolver)

• Sets 'registry_name' in resolve results only when 'named_registry_qualified_ids' is enabled, enabling 9.1 key emission upstream.

pnpm/crates/resolving-npm-resolver/src/named_registry_resolver.rs

npm_resolver.rsPlumb registry-name context into npm resolver result building (Rust) +14/-2

Plumb registry-name context into npm resolver result building (Rust)

• Extends resolve-result builder inputs to include an optional named registry alias and mints 'PkgResolutionId' in '<name>@<alias>:<version>' form when present.

pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs

violation_codes.rsAdd missing-named-registry violation code (Rust) +1/-0

Add missing-named-registry violation code (Rust)

• Introduces 'MISSING_NAMED_REGISTRY' for verifiers to report unknown named-registry aliases.

pnpm/crates/resolving-npm-resolver/src/violation_codes.rs

resolve.rsAdd 'named_registry_qualified_ids' to ResolveOptions (Rust base) +6/-0

Add 'named_registry_qualified_ids' to ResolveOptions (Rust base)

• Introduces a toggle to request registry-qualified IDs from named-registry resolution, mirroring TS API semantics.

pnpm/crates/resolving-resolver-base/src/resolve.rs

verifier.rsExtend VerifyCtx with optional named-registry alias (Rust base) +4/-0

Extend VerifyCtx with optional named-registry alias (Rust base)

• Adds 'registry_name' so verifiers can route metadata checks to the correct named registry when the lockfile key is registry-qualified.

pnpm/crates/resolving-resolver-base/src/verifier.rs

index.tsDefine supported lockfile versions and builtin named registries (TS) +17/-0

Define supported lockfile versions and builtin named registries (TS)

• Adds constants for 9.1 support ('SUPPORTED_LOCKFILE_VERSIONS') and introduces built-in named registry aliases (e.g. 'gh').

pnpm11/core/constants/src/index.ts

index.tsAdd 'namedRegistries' plumbing to inspection list/why/search commands +7/-0

Add 'namedRegistries' plumbing to inspection list/why/search commands

• Extends public command options to accept named registries and threads them through to internals that reconstruct package resolutions.

pnpm11/deps/inspection/list/src/index.ts

buildDependenciesTree.tsThread named registries into dependencies tree builder +2/-0

Thread named registries into dependencies tree builder

• Adds 'namedRegistries' to options and forwards it so tree rendering can resolve 9.1 tarballs.

pnpm11/deps/inspection/tree-builder/src/buildDependenciesTree.ts

buildDependentsTree.tsThread named registries into dependents tree builder +3/-0

Thread named registries into dependents tree builder

• Extends options to include named registries and passes them into node resolution for 9.1 compatibility.

pnpm11/deps/inspection/tree-builder/src/buildDependentsTree.ts

getTree.tsAdd named registries to tree-building base options +1/-0

Add named registries to tree-building base options

• Extends shared tree option types so named registries can be threaded consistently through tree builders.

pnpm11/deps/inspection/tree-builder/src/getTree.ts

index.tsParse registry-qualified dep paths and validate alias syntax (TS) +71/-2

Parse registry-qualified dep paths and validate alias syntax (TS)

• Adds reserved-prefix set, 'parseRegistryQualifiedVersion', updates dep path parsing to surface 'registryName', and ensures 'tryGetPackageId' preserves qualified IDs.

pnpm11/deps/path/src/index.ts

index.tsImplement sticky 9.1 writing and multi-version read support (TS installer) +10/-4

Implement sticky 9.1 writing and multi-version read support (TS installer)

• Treats 9.1 as supported for fast paths, sets 'namedRegistryQualifiedIds' when opted-in or when the existing lockfile is already 9.1, and reads lockfiles against the supported version set.

pnpm11/installing/deps-installer/src/install/index.ts

index.tsThread named registries into dependency resolution entry point (TS) +1/-0

Thread named registries into dependency resolution entry point (TS)

• Passes 'namedRegistries' through to lockfile updating so tarball URL omission/reconstruction follows the right registry.

pnpm11/installing/deps-resolver/src/index.ts

resolveDependencyTree.tsCarry 'namedRegistryQualifiedIds' through tree resolution context (TS) +4/-0

Carry 'namedRegistryQualifiedIds' through tree resolution context (TS)

• Adds an option to enable registry-qualified IDs and populates resolver context with named registries and prefix lists.

pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts

updateLockfile.tsStamp/write entries using named registry URL for canonical tarball omission (TS) +17/-3

Stamp/write entries using named registry URL for canonical tarball omission (TS)

• Merges built-in + user named registries, routes tarball canonical checks through the named registry for qualified dep paths, and avoids redundant 'version' field for qualified entries.

pnpm11/installing/deps-resolver/src/updateLockfile.ts

index.tsAdd named registries to headless restore options (TS) +1/-0

Add named registries to headless restore options (TS)

• Extends headless options so restore pipelines can reconstruct tarballs for 9.1 entries.

pnpm11/installing/deps-restorer/src/index.ts

nameVerFromPkgSnapshot.tsExpose 'registryName' from parsed dep paths (TS lockfile utils) +3/-0

Expose 'registryName' from parsed dep paths (TS lockfile utils)

• Extends snapshot name/version extraction to include 'registryName' so downstream can route tarball reconstruction and verifier checks.

pnpm11/lockfile/utils/src/nameVerFromPkgSnapshot.ts

index.tsValidate aliases and mint registry-qualified IDs for named registry resolutions (TS) +18/-0

Validate aliases and mint registry-qualified IDs for named registry resolutions (TS)

• Rejects reserved/malformed aliases, adds 'namedRegistryQualifiedIds' option, and mints IDs as 'name@alias:version' when enabled while keeping legacy IDs otherwise.

pnpm11/resolving/npm-resolver/src/index.ts

violationCodes.tsAdd missing-named-registry violation code (TS) +1/-0

Add missing-named-registry violation code (TS)

• Introduces 'MISSING_NAMED_REGISTRY' so verifiers can surface unknown alias failures consistently.

pnpm11/resolving/npm-resolver/src/violationCodes.ts

index.tsExtend verifier and resolve options with named-registry qualified IDs (TS base) +7/-1

Extend verifier and resolve options with named-registry qualified IDs (TS base)

• Updates 'ResolutionVerifier.verify' ctx to include 'registryName' and adds 'namedRegistryQualifiedIds' to resolve options to propagate 9.1 behavior through the stack.

pnpm11/resolving/resolver-base/src/index.ts

index.tsAdd 'namedRegistryQualifiedIds' request option to store controller types (TS) +6/-0

Add 'namedRegistryQualifiedIds' request option to store controller types (TS)

• Extends 'RequestPackageOptions' to allow resolvers to mint registry-qualified IDs for named registries under lockfile format 9.1.

pnpm11/store/controller-types/src/index.ts

Bug fix (24) +332 / -58
try_get_package_id.rsPreserve registry-qualified IDs in 'try_get_package_id' (Rust) +3/-1

Preserve registry-qualified IDs in 'try_get_package_id' (Rust)

• Prevents stripping the package name for runtime-like or registry-qualified IDs so 'foo@work:1.0.0' remains intact.

pnpm/crates/deps-path/src/try_get_package_id.rs

verify_lockfile_resolutions.rsRoute verification by registry for registry-qualified keys (Rust) +31/-5

Route verification by registry for registry-qualified keys (Rust)

• Extends candidate collection to extract 'registry_name' from keys, dedupes candidates including registry, and passes registry context into verifiers.

pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs

fast_update_overrides.rsDisable fast override updates for registry-qualified keys (Rust) +4/-0

Disable fast override updates for registry-qualified keys (Rust)

• Blocks the fast-path rewrite when a key is registry-qualified to avoid dropping the registry qualifier when reconstructing dep paths.

pnpm/crates/package-manager/src/fast_update_overrides.rs

install.rsTreat registry-qualified keys as non-file sources for injected source scanning (Rust) +3/-1

Treat registry-qualified keys as non-file sources for injected source scanning (Rust)

• Excludes 'RegistryQualified' entries from injected source path extraction to keep file-only behavior correct.

pnpm/crates/package-manager/src/install.rs

install_package_by_snapshot.rsReconstruct tarballs from named registries during snapshot install (Rust) +33/-4

Reconstruct tarballs from named registries during snapshot install (Rust)

• Adds a dedicated error for missing aliases and routes tarball URL construction through named registries for qualified keys; falls back to scope registry for legacy keys.

pnpm/crates/package-manager/src/install_package_by_snapshot.rs

lockfile_reuse.rsEnsure lockfile reuse respects registry qualifiers (Rust) +52/-12

Ensure lockfile reuse respects registry qualifiers (Rust)

• Reconstructs tarballs via named registries for qualified keys, prevents cross-registry spec satisfaction, and preserves qualified IDs when synthesizing reused results.

pnpm/crates/resolving-deps-resolver/src/lockfile_reuse.rs

create_npm_resolution_verifier.rsRoute npm resolution verification by named registry alias (Rust) +37/-4

Route npm resolution verification by named registry alias (Rust)

• Merges built-in and configured named registries into an alias map, fails closed on unknown alias for qualified entries, and uses the correct registry URL for metadata-backed checks.

pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs

named_registry.rsValidate named registry aliases and add structured errors (Rust) +28/-0

Validate named registry aliases and add structured errors (Rust)

• Rejects reserved or malformed aliases during merge, returning diagnostic errors to prevent ambiguous '<alias>:<version>' parsing.

pnpm/crates/resolving-npm-resolver/src/named_registry.rs

licensesList.tsThread 'namedRegistries' into license listing pipeline +2/-0

Thread 'namedRegistries' into license listing pipeline

• Extends options and wiring so resolution reconstruction can use named registry maps when reading 9.1 entries.

pnpm11/deps/compliance/commands/src/licenses/licensesList.ts

sbom.tsThread 'namedRegistries' into SBOM generation pipeline +2/-0

Thread 'namedRegistries' into SBOM generation pipeline

• Passes named registries through SBOM generation so tarball URL reconstruction works for registry-qualified lockfile entries.

pnpm11/deps/compliance/commands/src/sbom/sbom.ts

getPkgInfo.tsPass named registries to snapshot-to-resolution conversion (licenses) +2/-1

Pass named registries to snapshot-to-resolution conversion (licenses)

• Updates 'pkgSnapshotToResolution' calls to include both registries and named registries to support 9.1 reconstruction.

pnpm11/deps/compliance/license-scanner/src/getPkgInfo.ts

licenses.tsAccept named registries for license scanning +2/-0

Accept named registries for license scanning

• Extends options and threads named registries through to license extraction so 9.1 entries can be resolved.

pnpm11/deps/compliance/license-scanner/src/licenses.ts

lockfileToLicenseNodeTree.tsThread named registries through lockfile-to-license tree conversion +3/-0

Thread named registries through lockfile-to-license tree conversion

• Adds a named registries option and forwards it when constructing per-package info for license scanning.

pnpm11/deps/compliance/license-scanner/src/lockfileToLicenseNodeTree.ts

collectComponents.tsReconstruct tarballs using named registries when collecting SBOM components +3/-2

Reconstruct tarballs using named registries when collecting SBOM components

• Switches resolution reconstruction calls to pass named registries and updates metadata lookup calls similarly.

pnpm11/deps/compliance/sbom/src/collectComponents.ts

lockfileToDepGraph.tsUse named registries when building dep graph from lockfile +2/-1

Use named registries when building dep graph from lockfile

• Threads named registries into 'pkgSnapshotToResolution' calls so fetching and graph building work with 9.1 entries.

pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts

getPkgInfo.tsGracefully handle missing named registries in inspection tarball display +9/-1

Gracefully handle missing named registries in inspection tarball display

• Attempts to reconstruct tarballs using named registries but suppresses missing-alias errors so inspection can still run with partial config context.

pnpm11/deps/inspection/tree-builder/src/getPkgInfo.ts

readLockfiles.tsAccept both 9.0 and 9.1 lockfile versions when reading (TS) +2/-1

Accept both 9.0 and 9.1 lockfile versions when reading (TS)

• Switches readLockfiles compatibility checks to use 'SUPPORTED_LOCKFILE_VERSIONS' so 9.1 is readable without forcing upgrades.

pnpm11/installing/context/src/readLockfiles.ts

tryFastUpdateOverrides.tsDisable fast override updates for registry-qualified dep paths (TS) +3/-0

Disable fast override updates for registry-qualified dep paths (TS)

• Avoids rebuilding dep paths in a way that would drop the registry qualifier when handling 9.1 entries.

pnpm11/installing/deps-installer/src/install/tryFastUpdateOverrides.ts

verifyLockfileResolutions.tsPass registry alias into resolution verifiers (TS) +6/-4

Pass registry alias into resolution verifiers (TS)

• Extends candidate collection/dedupe to include 'registryName' from dep paths and passes it to verifiers for correct registry routing.

pnpm11/installing/deps-installer/src/install/verifyLockfileResolutions.ts

resolveDependencies.tsPrevent cross-registry reuse and mint qualified pkgIds (TS deps resolver) +46/-10

Prevent cross-registry reuse and mint qualified pkgIds (TS deps resolver)

• Uses registry-qualified information from dep paths to restrict spec satisfaction, reconstructs pkgIds as 'name@alias:version', and passes 'namedRegistryQualifiedIds' into package requests.

pnpm11/installing/deps-resolver/src/resolveDependencies.ts

lockfileToHoistedDepGraph.tsUse named registries when restoring from lockfile (TS) +2/-1

Use named registries when restoring from lockfile (TS)

• Passes named registries into snapshot-to-resolution conversion while fetching packages during hoisted graph construction.

pnpm11/installing/deps-restorer/src/lockfileToHoistedDepGraph.ts

lockfileFormatConverters.tsStamp lockfile version 9.1 only when qualified keys exist (TS) +7/-2

Stamp lockfile version 9.1 only when qualified keys exist (TS)

• Updates conversion to set 'lockfileVersion' to 9.1 only if any package key parses with a 'registryName', preserving byte-identical 9.0 lockfiles otherwise.

pnpm11/lockfile/fs/src/lockfileFormatConverters.ts

pkgSnapshotToResolution.tsReconstruct tarballs using named registries for 9.1 entries (TS) +21/-6

Reconstruct tarballs using named registries for 9.1 entries (TS)

• Accepts '{ registries, namedRegistries }', merges builtin aliases, reconstructs canonical tarballs for qualified dep paths, and throws 'ERR_PNPM_MISSING_NAMED_REGISTRY' on unknown aliases.

pnpm11/lockfile/utils/src/pkgSnapshotToResolution.ts

createNpmResolutionVerifier.tsRoute verifier by registryName and fail closed on missing alias (TS) +29/-2

Route verifier by registryName and fail closed on missing alias (TS)

• Builds a merged alias→URL map, uses 'registryName' to pick the correct registry for 9.1 entries without relying on tarball prefixes, and emits 'MISSING_NAMED_REGISTRY' violations when alias is absent.

pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts

Refactor (3) +8 / -10
getPkgMetadata.tsRefactor SBOM metadata helper to accept registry options object +6/-6

Refactor SBOM metadata helper to accept registry options object

• Changes API to accept '{ registries, namedRegistries }' and uses it when resolving tarballs for 9.1 lockfile entries.

pnpm11/deps/compliance/sbom/src/getPkgMetadata.ts

index.tsExport registry options type from lockfile utils (TS) +1/-1

Export registry options type from lockfile utils (TS)

• Exports 'PkgSnapshotToResolutionOptions' alongside 'pkgSnapshotToResolution' to standardize named registries threading.

pnpm11/lockfile/utils/src/index.ts

parseBareSpecifier.tsMove builtin named registries source of truth to constants (TS) +1/-3

Move builtin named registries source of truth to constants (TS)

• Re-exports 'BUILTIN_NAMED_REGISTRIES' from '@pnpm/constants' to share aliases across subsystems consistently.

pnpm11/resolving/npm-resolver/src/parseBareSpecifier.ts

Tests (18) +432 / -199
named_registry_install.rsAssert 9.1 stamping and qualified versions in Rust CLI integration tests +11/-2

Assert 9.1 stamping and qualified versions in Rust CLI integration tests

• Updates expected lockfile entries so named-registry dependencies record 'work:<semver>' in the version slot and verifies 'lockfileVersion' becomes 9.1.

pnpm/crates/cli/tests/named_registry_install.rs

tests.rsUnit tests for Rust registry-qualified parsing helpers +32/-0

Unit tests for Rust registry-qualified parsing helpers

• Covers successful parsing, reserved-prefix rejection, and alias well-formedness rules.

pnpm/crates/deps-path/src/registry_qualified/tests.rs

tests.rsTest registry-qualified parsing and reserved-prefix behavior (Rust) +43/-0

Test registry-qualified parsing and reserved-prefix behavior (Rust)

• Validates that 'work:1.0.0(...)' parses as registry-qualified, remains byte-stable, and that 'runtime:'/'file:' keep prior semantics.

pnpm/crates/lockfile/src/pkg_ver_peer/tests.rs

tests.rsThread empty named-registries map through lockfile builder tests (Rust) +19/-0

Thread empty named-registries map through lockfile builder tests (Rust)

• Adds a shared empty named registries map and updates call sites to satisfy new 'GraphToLockfileOptions' shape.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

tests.rsEnable named registries lockfile format in registry install tests (Rust) +1/-0

Enable named registries lockfile format in registry install tests (Rust)

• Sets the new config flag in test config to match the default behavior expected under the new format.

pnpm/crates/package-manager/src/install_package_from_registry/tests.rs

tests.rsUpdate reuse tests for new named-registries parameter threading (Rust) +17/-8

Update reuse tests for new named-registries parameter threading (Rust)

• Updates 'current_pkg_from_lockfile' call sites to pass the new named registries map.

pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs

tests.rsUpdate resolve workspace tests to include named registries map (Rust) +1/-0

Update resolve workspace tests to include named registries map (Rust)

• Ensures test helpers construct 'WorkspaceResolveOptions' with the new required field.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs

tests.rsUpdate verifier test ctx construction for registry-aware VerifyCtx (Rust) +1/-1

Update verifier test ctx construction for registry-aware VerifyCtx (Rust)

• Extends 'VerifyCtx' creation to include 'registry_name: None' under the new API.

pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/tests.rs

tests.rsTests for reserved/malformed alias rejection (Rust) +19/-1

Tests for reserved/malformed alias rejection (Rust)

• Adds coverage ensuring alias merging rejects reserved prefixes and malformed names in addition to URL validation.

pnpm/crates/resolving-npm-resolver/src/named_registry/tests.rs

tests.rsTest registry-qualified ID resolution toggle (Rust) +35/-0

Test registry-qualified ID resolution toggle (Rust)

• Adds a test verifying that named registry resolution produces an ID like '@acme/private@work:2.1.0' when enabled while retaining bare 'name@version' for display/peers.

pnpm/crates/resolving-npm-resolver/src/named_registry_resolver/tests.rs

chain.rsRefocus chain tests on alias validation (Rust) +24/-154

Refocus chain tests on alias validation (Rust)

• Replaces prior resolver-chain precedence tests with a direct validation test ensuring reserved aliases are rejected at construction time.

pnpm/crates/resolving-npm-resolver/tests/chain.rs

tests.rsUpdate dynamic verifier dispatch test for new VerifyCtx shape (Rust base) +3/-1

Update dynamic verifier dispatch test for new VerifyCtx shape (Rust base)

• Extends VerifyCtx construction to include 'registry_name: None' for compatibility with registry-aware verifiers.

pnpm/crates/resolving-resolver-base/src/tests.rs

getPkgMetadata.test.tsUpdate SBOM metadata tests for new registry options shape +8/-6

Update SBOM metadata tests for new registry options shape

• Adapts tests to pass the new '{ registries, namedRegistries }' object into metadata resolution helpers.

pnpm11/deps/compliance/sbom/test/getPkgMetadata.test.ts

index.tsTests for TS deps.path registry-qualified parsing and helpers +49/-0

Tests for TS deps.path registry-qualified parsing and helpers

• Adds coverage for parsing, ref reconstruction, filename escaping, and reserved-prefix behavior for 9.1-style dep paths.

pnpm11/deps/path/test/index.ts

normalizeLockfile.test.tsTest conditional 9.1 stamping behavior (TS lockfile fs) +41/-2

Test conditional 9.1 stamping behavior (TS lockfile fs)

• Adds a test verifying 9.1 is emitted only when registry-qualified keys are present and otherwise normalizes back to 9.0.

pnpm11/lockfile/fs/test/normalizeLockfile.test.ts

pkgSnapshotToResolution.tsUpdate tests for new options shape and add 9.1 named registry coverage (TS) +48/-9

Update tests for new options shape and add 9.1 named registry coverage (TS)

• Migrates tests to the new options object and adds cases for reconstructing qualified tarballs, builtin aliases, and missing-alias failures.

pnpm11/lockfile/utils/test/pkgSnapshotToResolution.ts

namedRegistry.tsUpdate default-resolver tests for alias validation and qualified IDs (TS) +33/-15

Update default-resolver tests for alias validation and qualified IDs (TS)

• Replaces protocol-precedence tests with validation tests for reserved/malformed aliases and adds a test for emitting registry-qualified IDs when enabled.

pnpm11/resolving/default-resolver/test/namedRegistry.ts

resolveNamedRegistry.test.tsTest qualified IDs and alias validation for named registries (TS) +47/-0

Test qualified IDs and alias validation for named registries (TS)

• Adds coverage that 'resolveFromNamedRegistry' emits qualified IDs when enabled and that reserved/malformed aliases throw at resolver creation.

pnpm11/resolving/npm-resolver/test/resolveNamedRegistry.test.ts

Documentation (1) +29 / -0
named-registries-lockfile-format.mdDocument lockfile 9.1 and rollout behavior +29/-0

Document lockfile 9.1 and rollout behavior

• Adds a changeset describing the 9.1 registry-qualified key format, tarball URL omission rules, writer stickiness, and new alias validation error.

.changeset/named-registries-lockfile-format.md

Other (19) +42 / -1
Cargo.lockUpdate Rust workspace lock for new deps-path dependency edges +2/-0

Update Rust workspace lock for new deps-path dependency edges

• Adds 'node-semver' and 'pacquet-deps-path' as locked dependencies to support registry-qualified parsing and routing.

Cargo.lock

pnpm-lock.yamlUpdate monorepo pnpm lockfile for workspace dependency wiring +6/-0

Update monorepo pnpm lockfile for workspace dependency wiring

• Adjusts workspace importer dependencies to include newly referenced internal packages after the format work.

pnpm-lock.yaml

lib.rsAdd 'named_registries_lockfile_format' config knob (Rust) +11/-0

Add 'named_registries_lockfile_format' config knob (Rust)

• Introduces a setting controlling whether named registries emit registry-qualified IDs (9.1), with documentation on sticky behavior for existing 9.1 lockfiles.

pnpm/crates/config/src/lib.rs

workspace_yaml.rsThread 'named_registries_lockfile_format' through workspace settings (Rust) +4/-1

Thread 'named_registries_lockfile_format' through workspace settings (Rust)

• Extends workspace YAML settings to include the new optional flag and ensures it is cleared/reset alongside other settings.

pnpm/crates/config/src/workspace_yaml.rs

Cargo.tomlAdd semver parser dependency for registry-qualified versions (Rust) +1/-0

Add semver parser dependency for registry-qualified versions (Rust)

• Adds 'node-semver' to support parsing '<alias>:<semver>' forms safely.

pnpm/crates/deps-path/Cargo.toml

workspace_full_resolution.rsInitialize named registries map in resolver bench (Rust) +1/-0

Initialize named registries map in resolver bench (Rust)

• Extends workspace resolve options for benches to include an empty named registries map.

pnpm/crates/resolving-deps-resolver/benches/workspace_full_resolution.rs

Cargo.tomlAdd deps-path dependency for alias validation (Rust npm resolver) +1/-0

Add deps-path dependency for alias validation (Rust npm resolver)

• Adds 'pacquet-deps-path' so the resolver can reuse reserved-prefix and well-formedness checks.

pnpm/crates/resolving-npm-resolver/Cargo.toml

Config.tsExpose 'namedRegistriesLockfileFormat' in TS config schema +1/-0

Expose 'namedRegistriesLockfileFormat' in TS config schema

• Adds a new optional config property to control writing 9.1 from pnpm v11 TypeScript CLI.

pnpm11/config/reader/src/Config.ts

configFileKey.tsAdd config key mapping for named registries lockfile format +1/-0

Add config key mapping for named registries lockfile format

• Registers 'named-registries-lockfile-format' as a known pnpm key for config parsing/exclusion lists.

pnpm11/config/reader/src/configFileKey.ts

index.tsDefault TS v11 opt-in flag to false +1/-0

Default TS v11 opt-in flag to false

• Sets the default for 'named-registries-lockfile-format' to false, matching staged rollout behavior.

pnpm11/config/reader/src/index.ts

types.tsDefine config type for named registries lockfile format +1/-0

Define config type for named registries lockfile format

• Adds boolean typing for 'named-registries-lockfile-format' in the config reader.

pnpm11/config/reader/src/types.ts

install.tsExpose named registries lockfile flag on install command options (TS) +1/-0

Expose named registries lockfile flag on install command options (TS)

• Adds 'namedRegistriesLockfileFormat' to the install command’s option pick so it can drive 9.1 output.

pnpm11/installing/commands/src/install.ts

installDeps.tsExpose named registries lockfile flag on installDeps options (TS) +1/-0

Expose named registries lockfile flag on installDeps options (TS)

• Adds 'namedRegistriesLockfileFormat' to option types so dependency installation can opt into 9.1.

pnpm11/installing/commands/src/installDeps.ts

recursive.tsExpose named registries lockfile flag on recursive install options (TS) +1/-0

Expose named registries lockfile flag on recursive install options (TS)

• Threads 'namedRegistriesLockfileFormat' into recursive command options for consistent 9.1 writing behavior.

pnpm11/installing/commands/src/recursive.ts

extendInstallOptions.tsAdd 'namedRegistriesLockfileFormat' to strict install options (TS) +1/-0

Add 'namedRegistriesLockfileFormat' to strict install options (TS)

• Extends installer option surface area to carry the opt-in/sticky 9.1 writer toggle.

pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts

package.jsonAdd constants dependency for builtin named registries (TS) +1/-0

Add constants dependency for builtin named registries (TS)

• Adds '@pnpm/constants' dependency to support builtin alias merge for tarball reconstruction.

pnpm11/lockfile/utils/package.json

tsconfig.jsonAdd TS project reference to constants +3/-0

Add TS project reference to constants

• Adds a TS project reference so lockfile utils can import builtin named registry constants.

pnpm11/lockfile/utils/tsconfig.json

package.jsonAdd deps.path dependency to npm-resolver (TS) +1/-0

Add deps.path dependency to npm-resolver (TS)

• Adds '@pnpm/deps.path' to reuse reserved prefix and well-formed alias validation logic.

pnpm11/resolving/npm-resolver/package.json

tsconfig.jsonAdd TS project reference to deps/path +3/-0

Add TS project reference to deps/path

• Adds a project reference so npm-resolver can import alias validation helpers from deps.path.

pnpm11/resolving/npm-resolver/tsconfig.json

@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The PR should not merge until registry-qualified packages remain distinct in the user-visible licenses table and JSON output.

The scanner now retains both same-name/version artifacts, but the licenses command subsequently deduplicates table rows by bare name and license and groups JSON records by the same incomplete identity, silently collapsing packages from different registries.

Files Needing Attention: pnpm11/deps/compliance/license-scanner/src/licenses.ts; pnpm11/deps/compliance/commands/src/licenses/outputRenderer.ts

Reviews (3): Last reviewed commit: "fix(lockfile): fail closed when a regist..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.01     12.0±0.04ms    31.2 MB/sec    1.00     11.9±0.03ms    31.6 MB/sec
packument/parse                                  1.00     38.0±0.11µs  1747.6 MB/sec    1.01     38.5±0.09µs  1723.5 MB/sec
tarball/download_dependency                      1.09      2.4±0.06ms  1787.1 KB/sec    1.00      2.2±0.10ms  1941.9 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    175.6±1.47ms 91.1 KElem/sec    1.00    176.3±5.06ms 90.7 KElem/sec
workspace_resolution/hoist_heavy                 1.00    237.5±0.98ms        ? ?/sec    1.11    263.0±1.12ms        ? ?/sec

@qodo-code-review

qodo-code-review Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (9) 📘 Rule violations (8) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. 9.1 lockfiles rejected ✓ Resolved 🐞 Bug ☼ Reliability
Description
pnpm11 now considers a lockfile supported only if its lockfileVersion is exactly one of `["9.0",
"12.0"], which rejects existing 9.1` lockfiles and can force unnecessary full resolution or fail
frozen installs.
Code

pnpm11/installing/deps-installer/src/install/index.ts[695]

+    const supportedLockfileVersion = SUPPORTED_LOCKFILE_VERSIONS.includes(ctx.wantedLockfile.lockfileVersion)
Relevance

●●● Strong

Team regularly fixes lockfile-compat breakages by accepting legacy formats/same-major variants to
avoid install failures (PR13330, PR13056).

PR-#13330
PR-#13056

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new SUPPORTED_LOCKFILE_VERSIONS.includes(ctx.wantedLockfile.lockfileVersion) gate only allows
versions listed in constants (currently 9.0 and 12.0). The repo contains lockfile objects with
lockfileVersion: '9.1', demonstrating that 9.1 is a real/expected value and would be rejected by
this new check.

pnpm11/installing/deps-installer/src/install/index.ts[694-723]
pnpm11/core/constants/src/index.ts[1-11]
pnpm11/deps/compliance/sbom/test/collectComponents.test.ts[8-31]

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

## Issue description
The TypeScript installer changed from a major-prefix compatibility check (accepting any `9.x`) to an exact allowlist via `SUPPORTED_LOCKFILE_VERSIONS.includes(...)`. Because `SUPPORTED_LOCKFILE_VERSIONS` is currently `["9.0", "12.0"]`, lockfiles stamped `9.1` (which exist in-repo and were previously accepted) are now treated as unsupported.

## Issue Context
This change can:
- trigger unnecessary full resolutions on otherwise-compatible lockfiles
- break frozen/CI installs that expect compatible `9.1` lockfiles to be accepted

## Fix Focus Areas
- pnpm11/core/constants/src/index.ts[1-11]
- pnpm11/installing/deps-installer/src/install/index.ts[694-723]

## Suggested fix
Implement a compatibility predicate equivalent to the previous behavior for 9.x (e.g., `lockfileVersion.startsWith('9.')`) while still allowing `12.0` explicitly, or expand `SUPPORTED_LOCKFILE_VERSIONS` to include all currently-supported 9.x minors (at least `9.1` if it’s still supported). Ensure all call sites that now use `SUPPORTED_LOCKFILE_VERSIONS.includes(...)` use the same compatibility logic.

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


2. SBOM registry URL disclosure ✓ Resolved 🐞 Bug ⛨ Security
Description
SBOM PURLs now embed the configured named-registry URL as a repository_url qualifier, which can
leak internal registry endpoints and even credentials if the URL contains userinfo (e.g.
https://user:token@host/). This is new behavior for named-registry packages and affects any SBOM
output that is stored or shared outside the build environment.
Code

pnpm11/deps/compliance/sbom/src/purl.ts[R33-35]

+  if (opts.registryUrl) {
+    return `pkg:npm/${encodePurlName(opts.name)}@${opts.version}?repository_url=${encodeURIComponent(opts.registryUrl)}`
+  }
Relevance

●●● Strong

Team has accepted multiple fixes to redact URL userinfo/credentials from outputs; likely will
redact/omit registryUrl in SBOM too.

PR-#12568
PR-#12666
PR-#12786

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The SBOM code now derives a named-registry URL and passes it into buildPurl(), which serializes it
into the returned PURL. The config stack explicitly supports expanding env vars into
namedRegistries (suggesting deployment-specific/sensitive values may exist there), and the named
registry URL validation only checks protocol, so credential-bearing URLs are not filtered out.

pnpm11/deps/compliance/sbom/src/collectComponents.ts[203-216]
pnpm11/deps/compliance/sbom/src/purl.ts[16-36]
pnpm11/config/reader/test/getOptionsFromRootManifest.test.ts[59-78]
pnpm11/resolving/npm-resolver/src/index.ts[784-800]

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

### Issue description
SBOM generation now includes `registryUrl` in the PURL (`repository_url` qualifier). If `namedRegistries` contains internal endpoints or credential-bearing URLs (userinfo), those values will be emitted into SBOM output.

### Issue Context
- `collectSbomComponents()` looks up a registry URL for a named-registry-resolved package and passes it to `buildPurl()`.
- `buildPurl()` serializes that URL into the returned PURL.
- The named-registry URL validator only enforces http(s) protocol, so userinfo (username/password) is not rejected.

### Fix
1) Sanitize `registryUrl` before encoding into the PURL:
  - Parse via `new URL(registryUrl)`.
  - Strip `username` and `password`.
  - Clear `search` and `hash`.
  - Use the sanitized string for `repository_url`.
  - If parsing fails, omit `repository_url` (or fall back to a safe, non-secret stable identifier).
2) Consider additionally reducing disclosure by using `url.origin` (and possibly `pathname` only if needed for uniqueness) rather than the full input string.

### Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/purl.ts[16-36]
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[205-216]

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



Remediation recommended

3. Registry alias missing in errors 🐞 Bug ◔ Observability
Description
For registry-qualified lockfile keys, collect_candidates() strips the alias and stores only the
bare semver in Candidate.version, but verification failures are still rendered/sorted as
name@version with no registry alias, making errors for [email protected] vs foo@work:1.0.0
indistinguishable.
Code

pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs[R423-426]

+        let version = match key.suffix.registry_qualified() {
+            Some((_, version)) => version.to_string(),
+            None => key.suffix.version().to_string(),
+        };
Relevance

●●● Strong

Team recently fixed/verbalized verifier error surfacing/labeling issues; likely to accept
registry-alias disambiguation. See PRs 12519, 13408.

PR-#12519
PR-#13408

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The verifier now extracts registry_name but normalizes the candidate version to a bare semver
string for registry-qualified keys; later, violations are sorted and rendered as name@version
without any registry qualifier, so two different registries’ entries can produce identical error
lines.

pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs[415-426]
pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs[568-580]
pnpm/crates/lockfile-verification/src/errors.rs[149-168]
pnpm/crates/resolving-resolver-base/src/verifier.rs[54-71]

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

### Issue description
Lockfile format 12 allows multiple `packages:` entries for the same `name@version` distinguished only by a named-registry alias (`<name>@<registryName>:<version>`). The verifier now routes by `registry_name`, but the violation/error rendering still prints `name@<bareSemver>` only. This makes diagnostics ambiguous and can mislead remediation when two registries serve the same name+version.

### Issue Context
- `Candidate` now tracks `registry_name`, and `VerifyCtx` passes it to verifiers.
- `ResolutionPolicyViolation` and the rendered error breakdown do not include `registry_name`.

### Fix Focus Areas
- pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs[417-426]
- pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs[568-580]
- pnpm/crates/resolving-resolver-base/src/verifier.rs[54-71]
- pnpm/crates/lockfile-verification/src/errors.rs[149-168]

### Suggested fix shape
- Extend `ResolutionPolicyViolation` (and `RenderedViolation`) to carry `registry_name: Option<String>` (or equivalent).
- When building violations, populate it from `Candidate.registry_name`.
- In `VerifyError::from_rendered()` (or earlier), render the identifier as:
 - `name@<registryName>:<version>` when `registry_name.is_some()`
 - `name@<version>` otherwise.
- Update the sort key similarly so output ordering stays stable and unambiguous.

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


4. Unsanitized depPath in error 🐞 Bug ⛨ Security
Description
The new missing-named-registry error in walkStep() interpolates the lockfile-derived depPath
directly into the thrown PnpmError message without stripping control characters, enabling
terminal/log injection if an untrusted lockfile is processed (e.g., in CI via pnpm sbom). Use the
existing redactAndSanitize() helper (or equivalent) on depPath before including it in the error
message/hint.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R220-222]

+        throw new PnpmError('MISSING_NAMED_REGISTRY',
+          `Cannot describe package "${depPath}": it was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting.`,
+          { hint: `Add '${registryName}' to the namedRegistries setting in pnpm-workspace.yaml.` })
Relevance

●●● Strong

Team repeatedly accepted sanitizing untrusted text in CLI/errors; added redactAndSanitize and
VT/control stripping in recent PRs.

PR-#13230
PR-#13337
PR-#13427

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
walkStep() pulls depPath from the lockfile walker and now embeds it into a newly added
PnpmError message. The @pnpm/error package already documents redactAndSanitize() as the
intended defense against control-character injection in printed/logged untrusted text, but it is not
applied here.

pnpm11/deps/compliance/sbom/src/collectComponents.ts[203-223]
pnpm11/core/error/src/index.ts[104-121]

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

## Issue description
`collectComponents.ts` throws `PnpmError('MISSING_NAMED_REGISTRY', ...)` with `depPath` interpolated into the message. Because `depPath` originates from the lockfile, it should be treated as untrusted text; emitting it without sanitization can allow control characters (newlines, ANSI escapes) to corrupt terminal output / logs.

## Issue Context
The repo already provides `redactAndSanitize(text)` in `@pnpm/error` specifically to make untrusted, URL-bearing text safe to print/log by redacting credentials and removing control characters.

## Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[220-222]
- pnpm11/core/error/src/index.ts[104-121]

## Implementation notes
- Import `redactAndSanitize` from `@pnpm/error` alongside `PnpmError`.
- Wrap `depPath` (and any other lockfile-derived interpolations) before inserting into the error `message`/`hint`, e.g. `const safeDepPath = redactAndSanitize(depPath)`.

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


5. Helper functions declared too early 📘 Rule violation ⚙ Maintainability
Description
In tryFastUpdateOverrides.test.ts, helper function declarations (makeLockfile, opts) appear
before their first call sites in the same file. This violates the required declaration order
convention and makes local code flow harder to follow.
Code

pnpm11/installing/deps-installer/test/install/tryFastUpdateOverrides.test.ts[R16-43]

+function makeLockfile (depPath: string, ref: string): LockfileObject {
+  return {
+    lockfileVersion: '9.0',
+    overrides: { foo: '1.0.0' },
+    importers: {
+      ['.' as ProjectId]: {
+        dependencies: { foo: ref },
+        specifiers: { foo: '^1.0.0' },
+      },
+    },
+    packages: {
+      [depPath as DepPath]: {
+        resolution: { integrity: 'sha512-AAAA' },
+      },
+    },
+  } as unknown as LockfileObject
+}
+
+function opts (requestPackage: RequestPackageFunction) {
+  return {
+    lockfileDir: '/test',
+    overrides,
+    parsedOverrides,
+    registries,
+    requestPackage,
+    isLockfileUpToDate: async () => true,
+  } as never
+}
Relevance

●●● Strong

Repo enforces “declare functions after first usage”; same issue accepted in PRs #13398, #12964,
#13133.

PR-#13398
PR-#12964
PR-#13133

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713432 requires top-level TypeScript function foo(...) {} declarations to appear after at
least one usage within the same file. The added helpers makeLockfile and opts are declared at
lines 16-43, but are first used later in the tests (e.g., tryFastUpdateOverrides(...) calls
starting at line 51).

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/installing/deps-installer/test/install/tryFastUpdateOverrides.test.ts[16-43]
pnpm11/installing/deps-installer/test/install/tryFastUpdateOverrides.test.ts[51-54]

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

## Issue description
Top-level helper functions are declared before their first usage in the file, violating the required ordering rule.

## Issue Context
This is a test file; helpers can be moved below their first usage (relying on hoisting) or converted to non-declaration forms (e.g., `const` arrow functions) which are out of scope for this specific rule.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/tryFastUpdateOverrides.test.ts[16-43]

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


View more (14)
6. Missing Rust lockfile-verification test 📘 Rule violation ▣ Testability
Description
A new TypeScript test asserts registry-qualified lockfile entries are verified independently per
registryName, but the Rust lockfile-verification test suite does not cover the equivalent
scenario. This violates the requirement to mirror cross-stack behavior tests in both
implementations.
Code

pnpm11/installing/deps-installer/test/install/verifyLockfileResolutions.ts[R561-584]

+test('registry-qualified entries are verified separately, each with its own registry name', async () => {
+  // Same name, version, and resolution — only the registry differs. Deduping
+  // on anything less than the full identity would verify one and skip the
+  // other entirely.
+  const lockfile = makeLockfile({
+    '[email protected]': { resolution: tarballResolution() },
+    'foo@work:1.0.0': { resolution: tarballResolution() },
+    'foo@gh:1.0.0': { resolution: tarballResolution() },
+  })
+
+  const seen: Array<{ name: string, version: string, registryName?: string }> = []
+  const recordingVerifier = wrap(async (_resolution, ctx) => {
+    seen.push({ name: ctx.name, version: ctx.version, registryName: ctx.registryName })
+    return { ok: true }
+  })
+
+  await expect(verifyLockfileResolutions(lockfile, [recordingVerifier])).resolves.toBeUndefined()
+
+  expect(seen).toHaveLength(3)
+  // Every candidate reports the bare semver plus its own alias.
+  expect(seen.every((entry) => entry.name === 'foo' && entry.version === '1.0.0')).toBe(true)
+  expect(new Set(seen.map((entry) => entry.registryName)))
+    .toStrictEqual(new Set([undefined, 'work', 'gh']))
+})
Relevance

●●● Strong

Repo prioritizes mirrored cross-stack tests; large parity-porting work merged in PR #13161 and
mirrored TS/Rust tests in #13101.

PR-#13161
PR-#13101

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new TypeScript test explicitly expects three separate verification contexts for [email protected],
foo@work:1.0.0, and foo@gh:1.0.0. The Rust test fixtures shown in the lockfile-verification test
module only exercise non-registry-qualified name@version keys, so the cross-stack behavior isn’t
covered in Rust tests.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm11/installing/deps-installer/test/install/verifyLockfileResolutions.ts[561-584]
pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions/tests.rs[22-67]

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

## Issue description
TypeScript adds coverage that registry-qualified lockfile entries (`<name>@<registryName>:<version>`) are verified separately (not deduped together) and that each candidate carries its own `registryName`. There is no equivalent Rust test in `pacquet` lockfile verification.

## Issue Context
Both stacks implement registry-qualified lockfile identities and verification routing/deduping logic, so the same behavioral scenario should be asserted in both test suites.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/verifyLockfileResolutions.ts[561-584]
- pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions/tests.rs[22-67]

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


7. Per-dep registry map merge 🐞 Bug ➹ Performance
Description
In SBOM generation, walkStep() calls resolveNamedRegistries() inside the per-dependency loop to look
up a registry URL, allocating and merging a new map repeatedly. This adds unnecessary work that
scales with the number of walked dependencies (especially for lockfiles with many named-registry
entries).
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R209-216]

+      const purl = buildPurl({
+        name,
+        version,
+        nonSemverVersion: nonSemverVersion ?? undefined,
+        registryUrl: registryName == null
+          ? undefined
+          : resolveNamedRegistries(opts.namedRegistries)[registryName],
+      })
Relevance

●●● Strong

Performance-in-hot-path suggestions are often accepted (e.g., accepted perf refactors in SBOM and
resolver loops).

PR-#12097
PR-#11324
PR-#12443

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The SBOM walker invokes resolveNamedRegistries() from inside the per-dependency mapping, and
resolveNamedRegistries() constructs a fresh merged object using Object.assign(Object.create(null),
...) each time, creating repeated allocations during traversal.

pnpm11/deps/compliance/sbom/src/collectComponents.ts[193-246]
pnpm11/core/constants/src/index.ts[32-44]

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

### Issue description
`collectComponents.walkStep()` calls `resolveNamedRegistries(opts.namedRegistries)` inside the per-dependency loop when building PURLs. `resolveNamedRegistries()` allocates a new null-prototype object and merges built-ins + user config on every call, which is avoidable because the merged map is invariant for the whole SBOM run.

### Issue Context
This happens during SBOM dependency traversal, which can touch many dependency edges for large lockfiles.

### Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[200-246]
- pnpm11/core/constants/src/index.ts[42-44]

### Suggested fix
1. Compute `const mergedNamedRegistries = resolveNamedRegistries(opts.namedRegistries)` once in `collectSbomComponents()` (or once at the start of `walkStep()` and pass it down).
2. Replace the inline `resolveNamedRegistries(opts.namedRegistries)[registryName]` with `mergedNamedRegistries[registryName]`.

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


8. Pacquet SBOM lacks registryUrl ✓ Resolved 📘 Rule violation ⌂ Architecture
Description
pnpm TypeScript SBOM generation now emits registry-qualified PURLs for named-registry packages, but
Pacquet’s sbom still builds PURLs without any registry information. This creates user-visible
cross-stack divergence in SBOM output for the same lockfile/config.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R209-216]

+      const purl = buildPurl({
+        name,
+        version,
+        nonSemverVersion: nonSemverVersion ?? undefined,
+        registryUrl: registryName == null
+          ? undefined
+          : resolveNamedRegistries(opts.namedRegistries)[registryName],
+      })
Relevance

●●● Strong

Team frequently accepts TS/Rust parity fixes; see accepted parity changes in PRs #13101, #13074,
#13132.

PR-#13101
PR-#13074
PR-#13132

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The TypeScript SBOM walker now passes a registryUrl for registryName-qualified packages into
buildPurl(...), changing the emitted PURLs. Pacquet’s SBOM implementation still calls
build_purl(&name, &version) with no registry context, so outputs will diverge for the same
named-registry dependency.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm11/deps/compliance/sbom/src/collectComponents.ts[209-216]
pnpm/crates/cli/src/cli_args/sbom.rs[651-672]

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

## Issue description
pnpm TypeScript SBOM generation now passes a `registryUrl` derived from `namedRegistries` into `buildPurl(...)` for registry-qualified packages, but Pacquet’s `sbom` still builds PURLs using only `(name, version)`. This makes SBOM output differ between pnpm and pacquet.

## Issue Context
This PR introduces registry-qualified package identities/semantics. SBOM output is user-visible and should stay in sync across stacks.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/sbom.rs[651-672]
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[209-216]

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


9. Pacquet licenses output diverges 📘 Rule violation ⌂ Architecture
Description
The TypeScript licenses renderer now includes registryName and groups packages by `(name,
registryName) to prevent named-registry duplicates from collapsing, but Pacquet’s licenses`
command still groups only by name. This creates user-visible divergence where pnpm reports
distinct registry-sourced packages while Pacquet collapses them into one entry.
Code

pnpm11/deps/compliance/commands/src/licenses/outputRenderer.ts[R66-77]

+    .map((item) => pick(['name', 'version', 'path', 'license', 'author', 'homepage', 'description', 'registryName'], item))

  const output: Record<string, LicensePackageJson[]> = {}
  const groupedByLicense = groupBy((item) => item.license, data)
  for (const license in groupedByLicense) {
    const outputList: LicensePackageJson[] = []
-    const groupedByName = groupBy((item) => item.name, groupedByLicense[license] ?? [])
+    // Group by the registry too: the same name from two registries is two
+    // packages, and collapsing them would drop one from the report.
+    const groupedByName = groupBy(
+      (item) => item.registryName == null ? item.name : `${item.name}\u0000${item.registryName}`,
+      groupedByLicense[license] ?? []
+    )
Relevance

●●● Strong

Team frequently fixes pacquet↔TS licenses parity (merged PRs aligning licenses
output/ordering/metadata).

PR-#13441
PR-#13461
PR-#13472

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In pnpm TypeScript, licenses JSON output now retains registryName and groups by a composite
(name, registryName) key to avoid collapsing same name across registries. Pacquet’s licenses
implementation still builds its per-license map keyed only by name, and its LicenseInfo has no
registry field, so two registries serving the same package name will still collapse into one output
entry.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm11/deps/compliance/commands/src/licenses/outputRenderer.ts[66-77]
pnpm/crates/cli/src/cli_args/licenses.rs[113-129]
pnpm/crates/cli/src/cli_args/licenses.rs[256-267]

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

## Issue description
pnpm TypeScript `licenses` output now disambiguates packages by named-registry alias (`registryName`), but Pacquet still groups license results by `name` only, collapsing same-name packages from different registries.

## Issue Context
This PR introduces registry-qualified lockfile identities (format 9.1). User-visible commands that display package identity (like `licenses`) must remain aligned across pnpm (TS) and Pacquet (Rust) per the compliance rule.

## Fix Focus Areas
- pnpm11/deps/compliance/commands/src/licenses/outputRenderer.ts[66-77]
- pnpm/crates/cli/src/cli_args/licenses.rs[113-129]
- pnpm/crates/cli/src/cli_args/licenses.rs[256-267]

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


10. Unsafe PURL registryUrl passthrough 🐞 Bug ⛨ Security
Description
sanitizeRegistryUrl() returns the raw input on URL parse failure and does not enforce an http(s)
scheme, so SBOM PURLs can contain unredacted secret material or non-http(s) URIs if an
unvalidated/malformed namedRegistries URL reaches buildPurl(). Since SBOMs are commonly
published/shared, this is a defense-in-depth leak/vector that should fail closed rather than
trusting upstream validation.
Code

pnpm11/deps/compliance/sbom/src/purl.ts[R56-67]

+function sanitizeRegistryUrl (url: string): string {
+  let parsed: URL
+  try {
+    parsed = new URL(url)
+  } catch {
+    return url
+  }
+  parsed.username = ''
+  parsed.password = ''
+  parsed.search = ''
+  parsed.hash = ''
+  return parsed.toString()
Relevance

●●● Strong

Team consistently accepts URL-hardening: redact credentials and enforce http(s) before emitting
sharable output (#12786, #13230).

PR-#12786
PR-#13230
PR-#12671

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code explicitly returns the raw string on parse failure and doesn’t check scheme, while SBOM
generation passes registry URLs from opts.namedRegistries into buildPurl() without invoking the
resolver’s mergeNamedRegistries() validation in this path.

pnpm11/deps/compliance/sbom/src/purl.ts[32-67]
pnpm11/deps/compliance/sbom/src/collectComponents.ts[203-216]
pnpm11/resolving/npm-resolver/src/index.ts[763-803]

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

### Issue description
`sanitizeRegistryUrl()` returns `url` unchanged when `new URL(url)` throws, and it never checks `parsed.protocol`. This means `buildPurl()` may embed unsafe or unsanitized values into the `repository_url` qualifier if the value is malformed or uses a non-http(s) scheme.

### Issue Context
Even if typical install flows validate `namedRegistries`, the SBOM path should not rely on validation elsewhere because SBOM output is designed to be published and consumed by downstream tooling.

### Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/purl.ts[56-67]

### Suggested fix
- Change `sanitizeRegistryUrl()` (or the `buildPurl()` branch) to **fail closed**:
 - If parsing fails: return `undefined`/`null` (or throw), and have `buildPurl()` omit `repository_url` in that case.
 - If parsing succeeds but `protocol` is not `http:` or `https:`: also omit (or throw).
- Keep current stripping (`username`, `password`, `search`, `hash`) for valid http(s) URLs.
- Add a test that verifies malformed/non-http(s) registry URLs do **not** get emitted as `repository_url`.

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


11. Helper functions declared too early 📘 Rule violation ⚙ Maintainability
Description
In the new test file, readLockfile and installFoo are declared before their first usage in the
same file, violating the required declaration order convention. This reduces local readability and
breaks the repository’s agreed hoisting-style rule.
Code

pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts[R14-27]

+function readLockfile (): LockfileFile {
+  return readYamlFileSync<LockfileFile>(WANTED_LOCKFILE)
+}
+
+function installFoo (opts: { namedRegistriesLockfileFormat?: boolean }): Promise<unknown> {
+  return install({
+    dependencies: {
+      '@pnpm.e2e/foo': 'work:1.0.0',
+    },
+  }, testDefaults({
+    namedRegistries,
+    ...opts,
+  }, { namedRegistries }))
+}
Relevance

●●● Strong

Declaration-after-first-usage rule often enforced; multiple reorderings accepted (e.g. #12964,
#12789, #13398).

PR-#12964
PR-#12789
PR-#13398

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713432 requires TypeScript function declarations to appear after their first usage
in the same file. The newly added helpers readLockfile and installFoo are declared at the top of
the file and only used later in the tests.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts[14-34]

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

## Issue description
`readLockfile` and `installFoo` are declared before their first usage in `namedRegistriesLockfileFormat.ts`, but the project convention requires function declarations to appear only after at least one call site in the same file.

## Issue Context
This rule applies only to `function foo() {}` declarations; reorganizing the file to place these helper declarations after the tests (or after the first call site) satisfies the convention while keeping behavior unchanged.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts[14-27]

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


12. parseRegistryQualifiedVersion declared too early 📘 Rule violation ⚙ Maintainability
Description
parseRegistryQualifiedVersion is declared before its first usage in the same TypeScript file,
violating the required declaration order. This makes local code flow harder to follow and breaks the
repository’s agreed hoisting-style convention.
Code

pnpm11/deps/path/src/index.ts[R56-64]

+export function parseRegistryQualifiedVersion (version: string): RegistryQualifiedVersion | undefined {
+  const colonIndex = version.indexOf(':')
+  if (colonIndex < 1) return undefined
+  const registryName = version.substring(0, colonIndex)
+  if (RESERVED_VERSION_PREFIXES.has(registryName) || !REGISTRY_NAME_RE.test(registryName)) return undefined
+  const qualifiedVersion = version.substring(colonIndex + 1)
+  if (semver.valid(qualifiedVersion) == null) return undefined
+  return { registryName, version: qualifiedVersion }
+}
Relevance

●●● Strong

Repo often enforces TS “declare after first use” ordering; multiple prior reviews accepted
reordering fixes.

PR-#12964
PR-#13398
PR-#13133

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713432 requires function declarations to appear after their first usage within the
same TypeScript file. In pnpm11/deps/path/src/index.ts, parseRegistryQualifiedVersion is
declared at lines 56-64, but its first usage is later within tryGetPackageId at line 143.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/deps/path/src/index.ts[56-64]
pnpm11/deps/path/src/index.ts[132-146]

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

## Issue description
In `pnpm11/deps/path/src/index.ts`, the function `parseRegistryQualifiedVersion()` is declared before any call site in the same file. Compliance requires top-level function declarations to appear only after their first usage.

## Issue Context
The first usage is inside `tryGetPackageId()`, but the function is declared earlier in the file.

## Fix Focus Areas
- pnpm11/deps/path/src/index.ts[56-64]
- pnpm11/deps/path/src/index.ts[132-146]

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


13. Rust accepts any 12.x 🐞 Bug ⚙ Maintainability
Description
LockfileVersion::<9>::is_compatible treats any lockfile with major version 12 as compatible, so a
future 12.1/12.2 lockfile could be accepted even if only 12.0 is actually supported/emitted by
this codebase.
Code

pnpm/crates/lockfile/src/lockfile_version.rs[16]

+        comver.major == MAJOR || MAJOR == 9 && comver.major == 12
Relevance

●● Moderate

No clear history on restricting 12.x→12.0; repo often broadens lockfile parsing compatibility (e.g.,
PR13330).

PR-#13330

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rust’s compatibility check is major-only for the 12.x exception, while the TypeScript stack
explicitly enumerates 12.0 as the supported named-registries format, and the Rust writer currently
only emits 12.0 when qualifying packages. This demonstrates that accepting arbitrary 12.x is
broader than the supported set implied elsewhere.

pnpm/crates/lockfile/src/lockfile_version.rs[12-17]
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[251-260]
pnpm11/core/constants/src/index.ts[1-11]

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

## Issue description
Rust’s `LockfileVersion::<9>::is_compatible` currently accepts *any* `comver.major == 12` regardless of `minor`. This can mask forward-incompatible format changes and diverges from the TypeScript stack, which enumerates specific supported versions (currently only `12.0`).

## Issue Context
The current writer code selects only `ComVer::new(12, 0)` when registry-qualified keys exist, and TS constants list only `12.0`. Accepting `12.1+` in Rust therefore increases the chance of parsing a format this client doesn’t actually understand.

## Fix Focus Areas
- pnpm/crates/lockfile/src/lockfile_version.rs[12-17]

## Suggested fix
Narrow the special-case compatibility for major 12 to the known supported minor(s), e.g. accept only `12.0` (or a bounded range you explicitly support). Add/adjust tests to cover acceptance/rejection boundaries for `12.0` vs `12.1`.

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


14. Misleading frozen-lockfile error ✓ Resolved 🐞 Bug ◔ Observability
Description
Enabling namedRegistriesLockfileFormat can now set needsFullResolution solely to migrate a
supported 9.0 lockfile to 9.1, but the frozen-install path throws
FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE claiming the lockfile version is incompatible. This makes
CI/debugging misleading because the real issue is “migration requires a non-frozen install,” not an
unsupported lockfile version.
Code

pnpm11/installing/deps-installer/src/install/index.ts[800]

+      namedRegistriesFormatUpgradePending(ctx.wantedLockfile, opts) ||
Relevance

●● Moderate

No close historical evidence on changing frozen-lockfile error wording; similar warning/message
tweaks often debated.

PR-#12876
PR-#13279

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR adds namedRegistriesFormatUpgradePending(...) into the needsFullResolution calculation,
which can become true even when the lockfile version is supported, and tryFrozenInstall() throws
an error whose message specifically blames an incompatible lockfile version whenever
needsFullResolution is true.

pnpm11/installing/deps-installer/src/install/index.ts[795-803]
pnpm11/installing/deps-installer/src/install/index.ts[1151-1161]
pnpm11/installing/deps-installer/src/install/index.ts[2500-2513]

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

## Issue description
`namedRegistriesFormatUpgradePending()` can force `needsFullResolution` to migrate 9.0 -> 9.1, and when `--frozen-lockfile` is in effect, `tryFrozenInstall()` throws `FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE` with an "incompatible lockfile version" message. This is misleading because 9.0 is supported; the install fails because the migration requires resolution and frozen mode forbids it.

## Issue Context
The new `namedRegistriesLockfileFormat` setting is intended to trigger a migration via re-resolution. When users run frozen installs (especially CI defaults), they should get an error that explicitly points to the needed 9.1 migration / disabling frozen / committing the updated lockfile.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/index.ts[795-803]
- pnpm11/installing/deps-installer/src/install/index.ts[1097-1161]
- pnpm11/installing/deps-installer/src/install/index.ts[2500-2514]

## Suggested fix approach
- Detect the specific case: `frozenLockfile === true` AND `namedRegistriesFormatUpgradePending(...) === true`.
- Throw a dedicated `PnpmError` (new code) with a message/hint like: "Cannot upgrade lockfile to format 9.1 with frozen-lockfile enabled. Run install with --no-frozen-lockfile and commit the updated lockfile.".
- Alternatively (if you want to reuse existing error codes), adjust the thrown error message/hint when `needsFullResolution` is true due to this migration, so it no longer claims lockfile version incompatibility.

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


15. Pacquet missing collision parity ✓ Resolved 📘 Rule violation ⌂ Architecture
Description
TypeScript now throws ERR_PNPM_NAMED_REGISTRY_PACKAGE_COLLISION when a named-registry and
non-named registry resolve the same name@version id but with different integrity. Pacquet still
constructs non-qualified ids when named_registry_qualified_ids is disabled, but there is no
matching collision guard, creating cross-stack divergence and leaving a silent-wrong-artifact risk
in Pacquet for the same configuration.
Code

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[R2455-2474]

+export function detectNamedRegistryCollision (
+  resolved: ResolvedPackage,
+  pkgResponse: PackageResponse
+): void {
+  if (resolved.resolvedVia !== 'named-registry' && pkgResponse.body.resolvedVia !== 'named-registry') return
+  const existingIntegrity = (resolved.resolution as TarballResolution | undefined)?.integrity
+  const incomingIntegrity = (pkgResponse.body.resolution as TarballResolution | undefined)?.integrity
+  if (
+    typeof existingIntegrity !== 'string' ||
+    typeof incomingIntegrity !== 'string' ||
+    existingIntegrity === incomingIntegrity
+  ) return
+  throw new PnpmError(
+    'NAMED_REGISTRY_PACKAGE_COLLISION',
+    `"${resolved.name}@${resolved.version}" is provided by more than one registry, but the lockfile cannot record which registry each dependency came from.`,
+    {
+      hint: 'Set "namedRegistriesLockfileFormat: true" in pnpm-workspace.yaml. That upgrades the lockfile to format 9.1, which keys each package by the registry it came from and lets the same name and version coexist. Without it, one of the two would silently be installed from the wrong registry.',
+    }
+  )
+}
Relevance

●● Moderate

No direct history for named-registry collision guard, but team often accepts TS↔pacquet
named-registry parity fixes.

PR-#13407
PR-#12862

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The TypeScript resolver now introduces detectNamedRegistryCollision() and throws a new pnpm error
when it detects two different tarball integrities under the same id with named-registry involvement.
In Pacquet, named-registry resolution only includes registry_name in the id when
named_registry_qualified_ids is enabled, and otherwise builds a plain name@version id, but there
is no corresponding collision error surfaced in the shown resolution id construction path.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2455-2474]
pnpm/crates/resolving-npm-resolver/src/named_registry_resolver.rs[151-160]
pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs[793-818]

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

## Issue description
pnpm TypeScript introduces `detectNamedRegistryCollision()` and throws an explicit error on integrity mismatch collisions when registry-qualified ids are not enabled. Pacquet still produces plain `name@version` ids when `named_registry_qualified_ids` is false and does not appear to have an equivalent collision check/error.

## Issue Context
This is a user-visible behavior change (new error and safety check). Per the compliance rule, behavior changes like this should be mirrored in Pacquet or explicitly called out as known divergence.

## Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2455-2474]
- pnpm/crates/resolving-npm-resolver/src/named_registry_resolver.rs[151-160]
- pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs[793-818]

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


16. Historical comment about format 9.1 ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
A new comment describes prior behavior using historical phrasing (Before format 9.1...). Inline
comments must describe current behavior/constraints rather than previous implementations.
Code

pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts[R90-91]

+  // Before format 9.1 these two collapsed onto a single `@pnpm.e2e/[email protected]`
+  // entry and one of the two consumers silently got the other's tarball.
Relevance

●● Moderate

Historical “before/used to” comment rewrites sometimes accepted (#13125) but also explicitly
rejected (#12954). Mixed precedent.

PR-#13125
PR-#12954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that describe historical behavior (e.g.,
"before"/"previously"). The added comment explicitly references behavior before lockfile format 9.1.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts[90-91]

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

## Issue description
The comment uses historical phrasing (`Before format 9.1...`) which violates the rule that comments must describe current behavior rather than past implementations.

## Issue Context
Rephrase the comment to state the current invariant/expectation (e.g., that the two registries must produce distinct lockfile entries, and why) without referencing the old format.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts[90-91]

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


17. Historical comment about dedupe key 📘 Rule violation ⚙ Maintainability
Description
A new test comment explains the fix using past-tense behavior (`collapsed them and dropped one
entirely`). Comments should be phrased in terms of current constraints/behavior rather than the
previous implementation.
Code

pnpm11/deps/compliance/license-scanner/test/licenses.spec.ts[R407-408]

+    // Two distinct artifacts with their own licenses. Keying the dedupe map
+    // on a bare `name@version` collapsed them and dropped one entirely.
Relevance

●● Moderate

Comment-temporal phrasing enforced inconsistently: rewrite accepted in #13125, but similar
historical regression comment kept in #12954.

[Comment truncated to fit github's 65,536-char limit.]

@qodo-code-review

qodo-code-review Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to fa898ca

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use the expected map type

Change the map type of EMPTY_NAMED_REGISTRIES to match the HashMap alias
(FxHashMap) expected by GraphToLockfileOptions.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs [22-23]

-static EMPTY_NAMED_REGISTRIES: std::sync::LazyLock<std::collections::HashMap<String, String>> =
-    std::sync::LazyLock::new(std::collections::HashMap::new);
+static EMPTY_NAMED_REGISTRIES: std::sync::LazyLock<HashMap<String, String>> =
+    std::sync::LazyLock::new(HashMap::default);
 
+fn named_registries_with(registry_name: &str, url: &str) -> HashMap<String, String> {
+    let mut map = HashMap::default();
+    map.insert(registry_name.to_string(), url.to_string());
+    map
+}
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a type mismatch that will cause compilation to fail, since GraphToLockfileOptions expects the locally aliased FxHashMap rather than std::collections::HashMap.

High
Reject case-variant reserved aliases

Convert registryName to lowercase before checking it against
RESERVED_VERSION_PREFIXES.

pnpm11/deps/path/src/index.ts [60]

-if (RESERVED_VERSION_PREFIXES.has(registryName) || !REGISTRY_NAME_RE.test(registryName)) return undefined
+if (RESERVED_VERSION_PREFIXES.has(registryName.toLowerCase()) || !REGISTRY_NAME_RE.test(registryName)) return undefined

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: REGISTRY_NAME_RE is case-insensitive, so RESERVED_VERSION_PREFIXES.has() should check the lowercased name to avoid reserved aliases bypassing the check.

High
Avoid misclassifying resolution identifiers

Gate the parsing of registry_name on result.resolved_via == "named-registry".
This prevents misclassifying identifiers from non-registry resolvers.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs [471-477]

 fn named_registry_of(result: &ResolveResult) -> Option<&str> {
+    if result.resolved_via != "named-registry" {
+        return None;
+    }
     let id = result.id.as_str();
     let at = id.get(1..)?.find('@')? + 1;
     let (registry_name, _) =
         pacquet_deps_path::parse_registry_qualified_version(id.get(at + 1..)?)?;
     Some(registry_name)
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: Checking result.resolved_via == "named-registry" ensures we do not accidentally parse a custom resolution ID as a registry-qualified one.

Medium
Security
Prevent registry credential disclosure

Throw an error if the registry URL is malformed or not HTTP/HTTPS instead of
returning it unchanged. This prevents potential credential exposure from
unparsed or unusual URL schemes.

pnpm11/deps/compliance/sbom/src/purl.ts [56-68]

 function sanitizeRegistryUrl (url: string): string {
   let parsed: URL
   try {
     parsed = new URL(url)
   } catch {
-    return url
+    throw new Error('Cannot emit an invalid registry URL in an SBOM')
+  }
+  if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
+    throw new Error('Cannot emit a non-HTTP registry URL in an SBOM')
   }
   parsed.username = ''
   parsed.password = ''
   parsed.search = ''
   parsed.hash = ''
   return parsed.toString()
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: Failing closed in a sanitization function is a strong defense-in-depth practice that prevents unexpected data formats from bypassing credential stripping, although this path may be unreachable during normal execution.

Medium
  • Update

Previous suggestions

Suggestions up to commit 72984cd
CategorySuggestion                                                                                                                                    Impact
Possible issue
Reject case-variant reserved aliases

Convert registryName to lowercase before checking it against
RESERVED_VERSION_PREFIXES to prevent case-variant circumventions.

pnpm11/deps/path/src/index.ts [60]

-if (RESERVED_VERSION_PREFIXES.has(registryName) || !REGISTRY_NAME_RE.test(registryName)) return undefined
+if (RESERVED_VERSION_PREFIXES.has(registryName.toLowerCase()) || !REGISTRY_NAME_RE.test(registryName)) return undefined
Suggestion importance[1-10]: 8

__

Why: The case-insensitive regex validation allows case-variant reserved prefixes to bypass the check unless registryName is checked case-insensitively against RESERVED_VERSION_PREFIXES.

Medium
Security
Block inherited registry properties

Use Object.hasOwn and check typeof namedRegistry === 'string' to safely exclude
object prototype properties from the verification.

pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts [228-238]

-const namedRegistry = mergedNamedRegistries[registryName]
-if (!namedRegistry) {
+const namedRegistry = Object.hasOwn(mergedNamedRegistries, registryName)
+  ? mergedNamedRegistries[registryName]
+  : undefined
+if (typeof namedRegistry !== 'string') {
   // Fail closed: without the registry URL, none of the metadata-backed
   // checks below can vouch for this entry.
   return {
     ok: false,
     code: MISSING_NAMED_REGISTRY_VIOLATION_CODE,
     reason: `was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting`,
   }
 }
 registry = namedRegistry
Suggestion importance[1-10]: 8

__

Why: Direct indexing of objects in JavaScript can yield inherited prototype properties (like constructor), incorrectly passing truthy checks and introducing bugs; using Object.hasOwn or typeof validates the entry correctly.

Medium
Prevent malformed registry credential leakage

Throw an error instead of returning the unparsed string when registryUrl fails
to parse. This ensures credentials are not inadvertently leaked.

pnpm11/deps/compliance/sbom/src/purl.ts [60-62]

 } catch {
-  return url
+  throw new Error('Cannot include an invalid registry URL in an SBOM purl')
 }
Suggestion importance[1-10]: 8

__

Why: Returning the raw string on parse failure is a fail-open behavior that could leak credentials if upstream validation is bypassed, making failing closed a more robust security practice.

Medium
Suggestions up to commit e6be03c
CategorySuggestion                                                                                                                                    Impact
Possible issue
Enforce supported formats in production

Replace debug_assert! with assert! to enforce the lockfile version compatibility
check in release builds.

pnpm/crates/package-manager/src/install.rs [1984-1986]

 let lockfile_major = lockfile_version.major;
 let supported_lockfile_major = matches!(lockfile_major, 9 | 12);
-debug_assert!(supported_lockfile_major);
+assert!(
+    supported_lockfile_major,
+    "unsupported materialization lockfile major: {lockfile_major}",
+);
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical regression where a runtime assert! was replaced with debug_assert!, potentially allowing unsupported lockfile versions to be processed in production builds.

High
Security
Reject unsafe registry URLs

Throw an error for unparseable or non-HTTP(S) registry URLs instead of returning
them unchanged. This prevents potential credential exposure in SBOM outputs.

pnpm11/deps/compliance/sbom/src/purl.ts [56-68]

 function sanitizeRegistryUrl (url: string): string {
   let parsed: URL
   try {
     parsed = new URL(url)
   } catch {
-    return url
+    throw new Error('Cannot include an invalid registry URL in an SBOM')
+  }
+  if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
+    throw new Error('Cannot include a non-HTTP(S) registry URL in an SBOM')
   }
   parsed.username = ''
   parsed.password = ''
   parsed.search = ''
   parsed.hash = ''
   return parsed.toString()
 }
Suggestion importance[1-10]: 8

__

Why: This is a valuable security enhancement that fails safely by throwing an error, preventing potential credential leaks when invalid URLs bypass the resolver's validation in lockfile-only commands.

Medium
Suggestions up to commit ab93c65
CategorySuggestion                                                                                                                                    Impact
Security
Prevent malformed registry credential leaks

Update sanitizeRegistryUrl to return undefined for malformed URLs and
conditionally omit the repository_url qualifier if sanitization fails.

pnpm11/deps/compliance/sbom/src/purl.ts [33-68]

 if (opts.registryUrl) {
   const repositoryUrl = sanitizeRegistryUrl(opts.registryUrl)
-  return `pkg:npm/${encodePurlName(opts.name)}@${opts.version}?repository_url=${encodeURIComponent(repositoryUrl)}`
+  if (repositoryUrl) {
+    return `pkg:npm/${encodePurlName(opts.name)}@${opts.version}?repository_url=${encodeURIComponent(repositoryUrl)}`
+  }
 }
 return `pkg:npm/${encodePurlName(opts.name)}@${opts.version}`
 ...
-function sanitizeRegistryUrl (url: string): string {
+function sanitizeRegistryUrl (url: string): string | undefined {
   let parsed: URL
   try {
     parsed = new URL(url)
   } catch {
-    return url
+    return undefined
   }
   parsed.username = ''
   parsed.password = ''
   parsed.search = ''
   parsed.hash = ''
   return parsed.toString()
 }
Suggestion importance[1-10]: 8

__

Why: Failing closed by omitting the URL qualifier when sanitization fails provides an important defense-in-depth security measure against potential secret leaks.

Medium
Block inherited registry aliases

Verify that registryName is an own string property to prevent prototype
pollution bypasses.

pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts [228-238]

-const namedRegistry = mergedNamedRegistries[registryName]
-if (!namedRegistry) {
+const namedRegistry = Object.hasOwn(mergedNamedRegistries, registryName)
+  ? mergedNamedRegistries[registryName]
+  : undefined
+if (typeof namedRegistry !== 'string') {
   // Fail closed: without the registry URL, none of the metadata-backed
   // checks below can vouch for this entry.
   return {
     ok: false,
     code: MISSING_NAMED_REGISTRY_VIOLATION_CODE,
     reason: `was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting`,
   }
 }
 registry = namedRegistry
Suggestion importance[1-10]: 7

__

Why: This addresses a valid edge case where inherited properties from Object.prototype could bypass validation, enhancing the robustness of the registry check.

Medium
Possible issue
Enforce supported formats in production

Replace debug_assert! with assert! to strictly enforce lockfile version
compatibility in production builds.

pnpm/crates/package-manager/src/install.rs [1984-1986]

 let lockfile_major = lockfile_version.major;
 let supported_lockfile_major = matches!(lockfile_major, 9 | 12);
-debug_assert!(supported_lockfile_major);
+assert!(
+    supported_lockfile_major,
+    "unsupported materialization lockfile major: {lockfile_major}",
+);
Suggestion importance[1-10]: 4

__

Why: Using assert! provides an extra layer of runtime safety in production, though it may be redundant given the prior compatibility check during deserialization.

Low
✅ Suggestions up to commit bb953db
CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Remove machine-specific verification cache
Suggestion Impact:The commit removed all generated cache entries containing developer-specific absolute paths, timestamps, and inode metadata.

code diff:

@@ -1,10 +1 @@
-{"lockfile":{"hash":"6gKi4Zx3Qn5px5cgX8wo1MfiVN23Di48ptkxQpL1qKU=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":745,"mtimeNs":"1785498621357672707","inode":"294268534"},"verifiedAt":"2026-07-31T12:14:37.854Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"6gKi4Zx3Qn5px5cgX8wo1MfiVN23Di48ptkxQpL1qKU=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":745,"mtimeNs":"1785498621357672707","inode":"294268534"},"verifiedAt":"2026-07-31T12:14:37.859Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"Kl4Wuas1J5UlDrgSo+zKV5PuMZ1AiwbCfJmHAtuqiCs=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":1011,"mtimeNs":"1785500077867900291","inode":"295873557"},"verifiedAt":"2026-07-31T12:14:37.873Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"6gKi4Zx3Qn5px5cgX8wo1MfiVN23Di48ptkxQpL1qKU=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":745,"mtimeNs":"1785500354730105850","inode":"296551199"},"verifiedAt":"2026-07-31T12:19:14.735Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"Kl4Wuas1J5UlDrgSo+zKV5PuMZ1AiwbCfJmHAtuqiCs=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":1011,"mtimeNs":"1785500354746827270","inode":"296551210"},"verifiedAt":"2026-07-31T12:19:14.752Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"6gKi4Zx3Qn5px5cgX8wo1MfiVN23Di48ptkxQpL1qKU=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":745,"mtimeNs":"1785500610824010830","inode":"297172334"},"verifiedAt":"2026-07-31T12:23:30.829Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"Kl4Wuas1J5UlDrgSo+zKV5PuMZ1AiwbCfJmHAtuqiCs=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":1011,"mtimeNs":"1785500610840011404","inode":"297172345"},"verifiedAt":"2026-07-31T12:23:30.845Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"6gKi4Zx3Qn5px5cgX8wo1MfiVN23Di48ptkxQpL1qKU=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":745,"mtimeNs":"1785500926966972809","inode":"297899462"},"verifiedAt":"2026-07-31T12:28:46.972Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-{"lockfile":{"hash":"Kl4Wuas1J5UlDrgSo+zKV5PuMZ1AiwbCfJmHAtuqiCs=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":1011,"mtimeNs":"1785500926981351229","inode":"297899473"},"verifiedAt":"2026-07-31T12:28:46.987Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}

Remove the auto-generated verification cache file from the fixtures. It contains
hardcoded, machine-specific paths and metadata that should be generated
dynamically during tests.

pnpm11/fixtures/with-git-protocol-dep/cache/lockfile-verified.jsonl [1-9]

-{"lockfile":{"hash":"6gKi4Zx3Qn5px5cgX8wo1MfiVN23Di48ptkxQpL1qKU=","path":"/home/zoltan/src/pnpm/pnpm/named-registries-lockfile/pnpm11/__fixtures__/with-git-protocol-dep/pnpm-lock.yaml","size":745,"mtimeNs":"1785498621357672707","inode":"294268534"},"verifiedAt":"2026-07-31T12:14:37.854Z","policy":{"tarballUrlBinding":true,"integrityRequired":true,"minimumReleaseAge":0,"minimumReleaseAgeExclude":[],"trustPolicy":null,"trustPolicyExclude":[],"trustPolicyIgnoreAfter":null,"resolutionShapeCheck":true,"dependencyAliasCheck":true}}
-...
 
+
Suggestion importance[1-10]: 9

__

Why: Committing developer-specific absolute paths (such as /home/zoltan/...) and system-specific inodes to a repository breaks cross-machine test portability and will likely cause CI failures.

High
Suggestions
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve sticky lockfile format

Thread the named_registry_qualified_ids flag into GraphToLockfileOptions to
prevent unintended lockfile downgrades when the last registry-qualified
dependency is removed.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs [256-257]

-let lockfile_minor =
-    u16::from(packages.keys().any(|key| key.suffix.registry_qualified().is_some()));
+let lockfile_minor = u16::from(
+    named_registries_lockfile_format
+        || packages.keys().any(|key| key.suffix.registry_qualified().is_some()),
+);
Suggestion importance[1-10]: 8

__

Why: Excellent catch identifying a logical flaw where the lockfile could inadvertently downgrade to 9.0, breaking the 'sticky' behavior explicitly intended in the PR for the 9.1 format.

Medium
Reject unresolved qualified registries

Avoid silently falling back to the default registry for unknown named
registries, and safely look up the registry using Object.hasOwn.

pnpm11/installing/deps-resolver/src/updateLockfile.ts [45-46]

-registry: (registryName != null ? mergedNamedRegistries[registryName] : undefined) ??
-  dp.getRegistryByPackageName(registries, depNode.name),
+registry: registryName == null
+  ? dp.getRegistryByPackageName(registries, depNode.name)
+  : Object.hasOwn(mergedNamedRegistries, registryName)
+    ? mergedNamedRegistries[registryName]
+    : (() => { throw new Error(`Missing named registry '${registryName}:'`) })(),
Suggestion importance[1-10]: 7

__

Why: This prevents an unintended fallback to the default registry when an unknown named registry is referenced, while simultaneously protecting against prototype poisoning.

Medium
Gate qualified parsing by format

Restrict : parsing to lockfiles explicitly using format 9.1 to avoid
misinterpreting arbitrary custom resolutions in 9.0 lockfiles.

pnpm/crates/lockfile/src/pkg_ver_peer.rs [210-217]

-if let Some((registry_name, version)) =
-    pacquet_deps_path::parse_registry_qualified_version(input)
-{
-    return Ok(VersionPart::RegistryQualified {
-        registry_name: registry_name.to_string(),
-        version,
-    });
+if registry_qualified_format {
+    if let Some((registry_name, version)) =
+        pacquet_deps_path::parse_registry_qualified_version(input)
+    {
+        return Ok(VersionPart::RegistryQualified {
+            registry_name: registry_name.to_string(),
+            version,
+        });
+    }
 }
Suggestion importance[1-10]: 4

__

Why: While the suggestion identifies a valid backward-compatibility edge case for custom resolutions, the proposed code introduces an undefined variable (registry_qualified_format) and requires a complex architectural change to the state-less deserializer to fix.

Low
Security
Prevent inherited registry alias lookup

Use Object.hasOwn when looking up registry names to prevent inherited properties
from bypassing the missing registry check.

pnpm11/lockfile/utils/src/pkgSnapshotToResolution.ts [52-57]

-registry = { ...BUILTIN_NAMED_REGISTRIES, ...opts.namedRegistries }[registryName]
+const namedRegistries = { ...BUILTIN_NAMED_REGISTRIES, ...opts.namedRegistries }
+registry = Object.hasOwn(namedRegistries, registryName)
+  ? namedRegistries[registryName]
+  : ''
 if (!registry) {
   throw new PnpmError('MISSING_NAMED_REGISTRY',
     `Cannot install package "${depPath}": it was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting.`,
     { hint: `Add '${registryName}' to the namedRegistries setting in pnpm-workspace.yaml.` })
 }
Suggestion importance[1-10]: 8

__

Why: This addresses a prototype poisoning risk where inherited Object properties could bypass truthiness checks, ensuring that invalid registry names correctly trigger the error instead of causing unexpected behavior.

Medium
Keep verification fail-closed

Use Object.hasOwn in the verifier when looking up named registries to prevent
prototype poisoning and ensure proper fail-closed behavior.

pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts [233-243]

-const namedRegistry = mergedNamedRegistries[registryName]
+const namedRegistry = Object.hasOwn(mergedNamedRegistries, registryName)
+  ? mergedNamedRegistries[registryName]
+  : undefined
 if (!namedRegistry) {
   // Fail closed: without the registry URL, none of the metadata-backed
   // checks below can vouch for this entry.
   return {
     ok: false,
     code: MISSING_NAMED_REGISTRY_VIOLATION_CODE,
     reason: `was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting`,
   }
 }
 registry = namedRegistry
Suggestion importance[1-10]: 8

__

Why: This ensures that inherited properties on the registry map cannot bypass the fail-closed verification loop, maintaining strict security guarantees for the verifier.

Medium

Copilot AI review requested due to automatic review settings July 31, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Thanks — the licenses finding was real and is fixed in 5ad7114, along with the same defect in the SBOM collector that the review didn't flag.

What was wrong. Both compliance reporters derived a package's identity from a bare name+version, which format 9.1 no longer makes unique:

  • pnpm licenses keyed its dedupe map on `${name}@${version}` (licenses.ts), so [email protected] and foo@work:1.0.0 collapsed and the second was dropped.
  • pnpm sbom keyed components on a purl built from the same pair, with an explicit if (componentsMap.has(purl)) return, so it dropped the second artifact too. Worse for an SBOM, since the two are different bytes with different integrity hashes and potentially different licenses.

Fix. LicensePackage now carries registryName and the dedupe key includes it. The SBOM emits the purl spec's repository_url qualifier for named-registry packages, which is the standard way to express a non-default registry and makes the two components distinct. Regression tests cover both: the licenses test asserts two entries survive where one used to, and the purl tests assert the two forms differ.

The changeset finding was a false positive — replied on that thread.

Two other things landed since the first push, worth a reviewer's attention:

  1. First intentional default divergence between the stacks. pacquet's pnpm_default_parity harness asserts every pnpm default matches pacquet's, and had no bucket for deliberate differences — this is the first. namedRegistriesLockfileFormat is opt-in on v11 and on by default on v12, so it now sits in an explicit divergent_rows bucket carrying the reason, plus a test asserting the divergence is still real so the row must be deleted once the TypeScript CLI defaults it on too. Flagging it because it weakens a previously absolute invariant, even if narrowly and self-cleaningly.

  2. End-to-end coverage for the TypeScript opt-in path, including the two-registry case the format exists to fix — previously only pacquet had an install-level test.


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

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🧹 Nitpick comments (6)
pnpm/crates/config/src/workspace_yaml.rs (1)

206-206: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add rustdoc for WorkspaceSettings::named_registries_lockfile_format.

WorkspaceSettings is public, but this new public field has no contract comment. Document that it controls format 9.1 registry-qualified keys and that None leaves the Config default unchanged.

As per path instructions, public Rust API contracts must use rustdoc comments that describe the current contract.

Suggested rustdoc
+    /// Selects whether named-registry resolutions use lockfile format 9.1.
+    /// `None` leaves the default from [`Config`] unchanged.
    pub named_registries_lockfile_format: Option<bool>,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/config/src/workspace_yaml.rs` at line 206, Add a rustdoc comment
to the public WorkspaceSettings::named_registries_lockfile_format field
documenting that it controls format 9.1 registry-qualified keys and that None
leaves the Config default unchanged.

Source: Path instructions

pnpm11/installing/deps-resolver/src/updateLockfile.ts (1)

19-51: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Align the named-registry fallback with pkgSnapshotToResolution's fail-closed behavior.

When registryName is present but absent from mergedNamedRegistries, this branch uses dp.getRegistryByPackageName(registries, depNode.name) instead of failing closed. This can rewrite a registry-qualified lockfile entry to the default or scope registry’s tarball. Throw MISSING_NAMED_REGISTRY here too, or ensure every path into updateLockfile rejects unknown named registries before writes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-resolver/src/updateLockfile.ts` around lines 19 - 51,
Update the registry selection in the updateLockfile flow around
toLockfileDependency so a present registryName with no entry in
mergedNamedRegistries fails closed by throwing MISSING_NAMED_REGISTRY, rather
than falling back to dp.getRegistryByPackageName. Preserve the existing
scope-routed registry fallback only when registryName is absent, and ensure the
validation occurs before lockfile.packages is written.

Source: Path instructions

pnpm11/deps/compliance/sbom/src/getPkgMetadata.ts (1)

27-43: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use an options object for the metadata API.

getPkgMetadata and getPkgMetadataUnclamped now take four positional arguments. Pass one argument object through both functions. Update the callers and tests together.

Proposed shape
+type GetPkgMetadataArgs = {
+  depPath: DepPath
+  snapshot: PackageSnapshot
+  registryOpts: PkgSnapshotToResolutionOptions
+  opts: GetPkgMetadataOptions
+}
+
-export async function getPkgMetadata (
-  depPath: DepPath,
-  snapshot: PackageSnapshot,
-  registryOpts: PkgSnapshotToResolutionOptions,
-  opts: GetPkgMetadataOptions
-): Promise<PkgMetadata> {
-  return limitMetadataReads(() => getPkgMetadataUnclamped(depPath, snapshot, registryOpts, opts))
+export async function getPkgMetadata (args: GetPkgMetadataArgs): Promise<PkgMetadata> {
+  return limitMetadataReads(() => getPkgMetadataUnclamped(args))
 }

As per coding guidelines, limit functions to two or three arguments and use an options object for more parameters.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/deps/compliance/sbom/src/getPkgMetadata.ts` around lines 27 - 43,
Update getPkgMetadata and getPkgMetadataUnclamped to accept a single options
object containing depPath, snapshot, registryOpts, and opts, and pass that
object through the wrapper. Update every caller and related test to use the
object shape while preserving existing metadata behavior.

Source: Coding guidelines

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs (1)

1343-1343: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove or replace the restating comment.

Line 1343 only repeats the builder name and field assignment. Remove it, or document a non-obvious contract for callers.

As per coding guidelines, comments must not “restate code” or “narrate the function body.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs` at line
1343, Remove the restating comment above the named-registry alias map builder
method or replace it with documentation describing a specific non-obvious caller
contract; do not narrate the method name or field assignment.

Source: Coding guidelines

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs (1)

3053-3060: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse the validated merged registry map.

Lines 3053-3060 duplicate merge_named_registries after lines 751-752 already produce merged_named_registries. Keep one alias-precedence and URL-normalization policy.

Add the merged map to FreshLockfileBuildOptions. Pass &merged_named_registries at both build_fresh_lockfile call sites.

As per coding guidelines, search for existing functionality and reuse shared utilities.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs` around lines
3053 - 3060, Remove the local named_registries reconstruction near the
fresh-lockfile setup and reuse the existing merged_named_registries produced by
merge_named_registries. Add this map as a field on FreshLockfileBuildOptions,
then pass &merged_named_registries at both build_fresh_lockfile call sites so
the validated alias precedence and URL normalization are preserved.

Sources: Coding guidelines, Path instructions

pnpm/crates/resolving-npm-resolver/src/named_registry.rs (1)

73-96: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Extend coverage for reserved named-registry aliases.

is_reserved_version_prefix already includes the full reserved set, including npm and jsr, so the alias rejection path is safe. The existing regression loop only covers link, workspace, file, and runtime; add npm, jsr, github, catalog, git, http, https, and patch, plus git host shorthands if intended for the same alias collision scenario.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/resolving-npm-resolver/src/named_registry.rs` around lines 73 -
96, The reserved-alias regression coverage is incomplete. In
pnpm/crates/resolving-npm-resolver/tests/chain.rs:1-27, extend the existing loop
covering link, workspace, file, and runtime to also test npm, jsr, github,
catalog, git, http, https, and patch, plus git host shorthands if they are part
of the same collision scenario; no direct change is required in
merge_named_registries in
pnpm/crates/resolving-npm-resolver/src/named_registry.rs:73-96 because its
existing is_reserved_version_prefix rejection already handles these aliases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/named-registries-lockfile-format.md:
- Around line 25-29: Expand the named-registries changeset with a concise
configuration and migration note covering the namedRegistries alias-to-URL
mapping, pnpm 11’s namedRegistriesLockfileFormat opt-in and pnpm 12 default,
missing and unknown alias behavior, explicit-URL fallback, and the name@version
collision behavior when the setting is disabled.

In `@pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs`:
- Around line 688-695: Update the registry selection in the lockfile generation
flow to fail closed when key.suffix.registry_qualified() returns an alias absent
from named_registries. Do not fall back to the scope-routed default registry;
instead propagate the established missing-registry error or retain the explicit
tarball URL so it is not removed as reconstructible.

In `@pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs`:
- Around line 21-23: Add focused tests around build_packages_and_snapshots
covering a configured registry alias that emits lockfile format 9.1, a normal
package that remains at 9.0, and preservation of tarball URLs when the alias is
unavailable. Use fixtures with populated registry mappings and assert URL
reconstruction, version stamping, and unknown-registry behavior.

In `@pnpm/crates/resolving-deps-resolver/src/lockfile_reuse.rs`:
- Around line 95-105: Update reduce_named_registry_spec and its reuse-validation
callers to preserve and compare an explicit package name against the lockfile
key name, while still validating the registry alias and range. Reject reuse when
the explicit name differs, including scoped names, and retain registry-qualified
identity handling. Add child and importer regression tests covering this
package-name collision.

In `@pnpm11/config/reader/src/Config.ts`:
- Line 244: Document the namedRegistriesLockfileFormat setting alongside its
declaration in Config.ts, covering the TypeScript default of false, the
<name>@<registryName>:<version> lockfile key format, sticky handling of existing
9.1 lockfiles, reserved aliases, and collision risks when disabled.

In `@pnpm11/deps/compliance/sbom/src/collectComponents.ts`:
- Around line 215-220: Preserve registry-qualified dependency identity in both
compliance paths: in pnpm11/deps/compliance/sbom/src/collectComponents.ts lines
215-220, include the dependency path or source registry when deduplicating and
emitting components; in pnpm11/deps/compliance/license-scanner/src/licenses.ts
line 98, include the registry identity in license-result deduplication instead
of using only name@version. Add focused collision coverage for identical package
names and versions from two named registries.

In `@pnpm11/installing/deps-installer/src/install/index.ts`:
- Line 1133: Update the install resolution and lockfile-staleness decisions
around SUPPORTED_LOCKFILE_VERSIONS, including the logic near
namedRegistriesLockfileFormat and resolveDependencies, so a requested format
differing from the current lockfile format triggers full resolution/migration.
In frozen mode, reject this mismatch with a clear error instead of accepting the
existing lockfile. Add a focused regression test covering migration from
lockfile format 9.0 to 9.1.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateOverrides.ts`:
- Around line 183-185: Add a regression test covering the override-update path
for a package with a registry-qualified dependency path, exercising the logic
around parsed.registryName in the fast update flow. Assert that the resulting
lockfile key preserves the <name>@<registryName>:<version> identity rather than
being rewritten as an unqualified key, and include coverage for the
named-registry collision scenario required by REVIEW_GUIDE.md.

In `@pnpm11/installing/deps-installer/src/install/verifyLockfileResolutions.ts`:
- Around line 400-405: Add a regression test for the candidate deduplication
logic around the key construction in verifyLockfileResolutions: create two
snapshots with identical name, version, and resolution but different
registryName values, run verification, and assert both candidates are passed
through with their respective registry names. Follow the required
REVIEW_GUIDE.md test expectations for named-registry collisions.

In `@pnpm11/lockfile/fs/test/normalizeLockfile.test.ts`:
- Around line 98-135: Update the withoutQualifiedKey case in the
convertToLockfileFile test so an input lockfile already using
NAMED_REGISTRIES_LOCKFILE_VERSION remains at that version even without a
qualified package key, and change the expectation accordingly while preserving
the existing 9.0-to-9.1 stamping assertion.

In `@pnpm11/lockfile/utils/src/pkgSnapshotToResolution.ts`:
- Around line 49-62: Update pkgSnapshotToResolution and its callers so
BUILTIN_NAMED_REGISTRIES is merged with opts.namedRegistries once per graph walk
or loop, then reuse that merged map for each package instead of rebuilding it
per invocation. Preserve the existing named-registry lookup and fallback
behavior, using the established mergedNamedRegistries pattern from
updateLockfile.ts.

In `@pnpm11/resolving/default-resolver/test/namedRegistry.ts`:
- Around line 81-94: Update the createResolver() reserved-alias tests to assert
the thrown error’s code equals ERR_PNPM_RESERVED_NAMED_REGISTRY_NAME, not only
its message. If changing the test to catch and inspect the error, use
util.types.isNativeError() rather than instanceof Error.

In `@pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts`:
- Around line 186-189: Update the registry lookup in the verifier flow around
mergedNamedRegistries to require an own property before reading a named registry
mapping, so inherited names such as constructor and toString are treated as
unconfigured and fail closed. Preserve configured aliases and existing routing
behavior, and add verifier coverage for unconfigured constructor: and toString:
entries.

In `@pnpm11/resolving/npm-resolver/test/resolveNamedRegistry.test.ts`:
- Around line 405-414: Update the test around createNpmResolver to catch the
thrown error and assert it is a native error via util.types.isNativeError(),
then verify its code equals ERR_PNPM_RESERVED_NAMED_REGISTRY_NAME while
retaining the reserved-prefix message assertion.

---

Nitpick comments:
In `@pnpm/crates/config/src/workspace_yaml.rs`:
- Line 206: Add a rustdoc comment to the public
WorkspaceSettings::named_registries_lockfile_format field documenting that it
controls format 9.1 registry-qualified keys and that None leaves the Config
default unchanged.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Around line 3053-3060: Remove the local named_registries reconstruction near
the fresh-lockfile setup and reuse the existing merged_named_registries produced
by merge_named_registries. Add this map as a field on FreshLockfileBuildOptions,
then pass &merged_named_registries at both build_fresh_lockfile call sites so
the validated alias precedence and URL normalization are preserved.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs`:
- Line 1343: Remove the restating comment above the named-registry alias map
builder method or replace it with documentation describing a specific
non-obvious caller contract; do not narrate the method name or field assignment.

In `@pnpm/crates/resolving-npm-resolver/src/named_registry.rs`:
- Around line 73-96: The reserved-alias regression coverage is incomplete. In
pnpm/crates/resolving-npm-resolver/tests/chain.rs:1-27, extend the existing loop
covering link, workspace, file, and runtime to also test npm, jsr, github,
catalog, git, http, https, and patch, plus git host shorthands if they are part
of the same collision scenario; no direct change is required in
merge_named_registries in
pnpm/crates/resolving-npm-resolver/src/named_registry.rs:73-96 because its
existing is_reserved_version_prefix rejection already handles these aliases.

In `@pnpm11/deps/compliance/sbom/src/getPkgMetadata.ts`:
- Around line 27-43: Update getPkgMetadata and getPkgMetadataUnclamped to accept
a single options object containing depPath, snapshot, registryOpts, and opts,
and pass that object through the wrapper. Update every caller and related test
to use the object shape while preserving existing metadata behavior.

In `@pnpm11/installing/deps-resolver/src/updateLockfile.ts`:
- Around line 19-51: Update the registry selection in the updateLockfile flow
around toLockfileDependency so a present registryName with no entry in
mergedNamedRegistries fails closed by throwing MISSING_NAMED_REGISTRY, rather
than falling back to dp.getRegistryByPackageName. Preserve the existing
scope-routed registry fallback only when registryName is absent, and ensure the
validation occurs before lockfile.packages is written.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ec97b202-a63e-43db-8fd4-569ab4d0eb14

📥 Commits

Reviewing files that changed from the base of the PR and between 536b7a2 and 0a8a226.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (91)
  • .changeset/named-registries-lockfile-format.md
  • pnpm/crates/cli/tests/named_registry_install.rs
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/workspace_yaml.rs
  • pnpm/crates/deps-path/Cargo.toml
  • pnpm/crates/deps-path/src/lib.rs
  • pnpm/crates/deps-path/src/registry_qualified.rs
  • pnpm/crates/deps-path/src/registry_qualified/tests.rs
  • pnpm/crates/deps-path/src/try_get_package_id.rs
  • pnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rs
  • pnpm/crates/lockfile/src/pkg_ver_peer.rs
  • pnpm/crates/lockfile/src/pkg_ver_peer/tests.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/package-manager/src/fast_update_overrides.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install_package_by_snapshot.rs
  • pnpm/crates/package-manager/src/install_package_from_registry/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/resolving-deps-resolver/benches/workspace_full_resolution.rs
  • pnpm/crates/resolving-deps-resolver/src/lockfile_reuse.rs
  • pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pnpm/crates/resolving-npm-resolver/Cargo.toml
  • pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs
  • pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/tests.rs
  • pnpm/crates/resolving-npm-resolver/src/named_registry.rs
  • pnpm/crates/resolving-npm-resolver/src/named_registry/tests.rs
  • pnpm/crates/resolving-npm-resolver/src/named_registry_resolver.rs
  • pnpm/crates/resolving-npm-resolver/src/named_registry_resolver/tests.rs
  • pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs
  • pnpm/crates/resolving-npm-resolver/src/violation_codes.rs
  • pnpm/crates/resolving-npm-resolver/tests/chain.rs
  • pnpm/crates/resolving-resolver-base/src/resolve.rs
  • pnpm/crates/resolving-resolver-base/src/tests.rs
  • pnpm/crates/resolving-resolver-base/src/verifier.rs
  • pnpm11/config/reader/src/Config.ts
  • pnpm11/config/reader/src/configFileKey.ts
  • pnpm11/config/reader/src/index.ts
  • pnpm11/config/reader/src/types.ts
  • pnpm11/core/constants/src/index.ts
  • pnpm11/deps/compliance/commands/src/licenses/licensesList.ts
  • pnpm11/deps/compliance/commands/src/sbom/sbom.ts
  • pnpm11/deps/compliance/license-scanner/src/getPkgInfo.ts
  • pnpm11/deps/compliance/license-scanner/src/licenses.ts
  • pnpm11/deps/compliance/license-scanner/src/lockfileToLicenseNodeTree.ts
  • pnpm11/deps/compliance/sbom/src/collectComponents.ts
  • pnpm11/deps/compliance/sbom/src/getPkgMetadata.ts
  • pnpm11/deps/compliance/sbom/test/getPkgMetadata.test.ts
  • pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts
  • pnpm11/deps/inspection/list/src/index.ts
  • pnpm11/deps/inspection/tree-builder/src/buildDependenciesTree.ts
  • pnpm11/deps/inspection/tree-builder/src/buildDependentsTree.ts
  • pnpm11/deps/inspection/tree-builder/src/getPkgInfo.ts
  • pnpm11/deps/inspection/tree-builder/src/getTree.ts
  • pnpm11/deps/path/src/index.ts
  • pnpm11/deps/path/test/index.ts
  • pnpm11/installing/commands/src/install.ts
  • pnpm11/installing/commands/src/installDeps.ts
  • pnpm11/installing/commands/src/recursive.ts
  • pnpm11/installing/context/src/readLockfiles.ts
  • pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateOverrides.ts
  • pnpm11/installing/deps-installer/src/install/verifyLockfileResolutions.ts
  • pnpm11/installing/deps-resolver/src/index.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencies.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts
  • pnpm11/installing/deps-resolver/src/updateLockfile.ts
  • pnpm11/installing/deps-restorer/src/index.ts
  • pnpm11/installing/deps-restorer/src/lockfileToHoistedDepGraph.ts
  • pnpm11/lockfile/fs/src/lockfileFormatConverters.ts
  • pnpm11/lockfile/fs/test/normalizeLockfile.test.ts
  • pnpm11/lockfile/utils/package.json
  • pnpm11/lockfile/utils/src/index.ts
  • pnpm11/lockfile/utils/src/nameVerFromPkgSnapshot.ts
  • pnpm11/lockfile/utils/src/pkgSnapshotToResolution.ts
  • pnpm11/lockfile/utils/test/pkgSnapshotToResolution.ts
  • pnpm11/lockfile/utils/tsconfig.json
  • pnpm11/resolving/default-resolver/test/namedRegistry.ts
  • pnpm11/resolving/npm-resolver/package.json
  • pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts
  • pnpm11/resolving/npm-resolver/src/index.ts
  • pnpm11/resolving/npm-resolver/src/parseBareSpecifier.ts
  • pnpm11/resolving/npm-resolver/src/violationCodes.ts
  • pnpm11/resolving/npm-resolver/test/resolveNamedRegistry.test.ts
  • pnpm11/resolving/npm-resolver/tsconfig.json
  • pnpm11/resolving/resolver-base/src/index.ts
  • pnpm11/store/controller-types/src/index.ts

Comment thread pnpm11/config/reader/src/Config.ts Resolved
zkochan added a commit to pnpm/rfcs that referenced this pull request Jul 31, 2026
The SRI-option rejection asserted that strict consumers may reject options.
The real failure is worse: pnpm's Rust ssri has no option grammar, so it
absorbs the option into the digest, round-trips it through Display, and fails
far from the parse. Integrity-string equality is also byte equality across
pnpm, so an ordinal inside the value would make a revision-only difference
read as a content change.

Record encoding the ordinal in the lockfile package key as an alternative,
since the registry-qualified keys of pnpm/pnpm#13528 invite it. It is rejected
on churn: a dep path repeats once per dependent, so one revision bump would
rewrite roughly fifty lines for a package as common as semver, and
patchedDependencies already demonstrates this with patch_hash. The key may
carry extra data; it may not carry data designed to change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread pnpm11/deps/compliance/sbom/src/purl.ts Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 72b69aa

@qodo-code-review

qodo-code-review Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve sticky lockfile format

Thread the named_registry_qualified_ids flag into GraphToLockfileOptions to
prevent unintended lockfile downgrades when the last registry-qualified
dependency is removed.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs [256-257]

-let lockfile_minor =
-    u16::from(packages.keys().any(|key| key.suffix.registry_qualified().is_some()));
+let lockfile_minor = u16::from(
+    named_registries_lockfile_format
+        || packages.keys().any(|key| key.suffix.registry_qualified().is_some()),
+);

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: Excellent catch identifying a logical flaw where the lockfile could inadvertently downgrade to 9.0, breaking the 'sticky' behavior explicitly intended in the PR for the 9.1 format.

Medium
Reject unresolved qualified registries

Avoid silently falling back to the default registry for unknown named
registries, and safely look up the registry using Object.hasOwn.

pnpm11/installing/deps-resolver/src/updateLockfile.ts [45-46]

-registry: (registryName != null ? mergedNamedRegistries[registryName] : undefined) ??
-  dp.getRegistryByPackageName(registries, depNode.name),
+registry: registryName == null
+  ? dp.getRegistryByPackageName(registries, depNode.name)
+  : Object.hasOwn(mergedNamedRegistries, registryName)
+    ? mergedNamedRegistries[registryName]
+    : (() => { throw new Error(`Missing named registry '${registryName}:'`) })(),

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: This prevents an unintended fallback to the default registry when an unknown named registry is referenced, while simultaneously protecting against prototype poisoning.

Medium
Gate qualified parsing by format

Restrict : parsing to lockfiles explicitly using format 9.1 to avoid
misinterpreting arbitrary custom resolutions in 9.0 lockfiles.

pnpm/crates/lockfile/src/pkg_ver_peer.rs [210-217]

-if let Some((registry_name, version)) =
-    pacquet_deps_path::parse_registry_qualified_version(input)
-{
-    return Ok(VersionPart::RegistryQualified {
-        registry_name: registry_name.to_string(),
-        version,
-    });
+if registry_qualified_format {
+    if let Some((registry_name, version)) =
+        pacquet_deps_path::parse_registry_qualified_version(input)
+    {
+        return Ok(VersionPart::RegistryQualified {
+            registry_name: registry_name.to_string(),
+            version,
+        });
+    }
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 4

__

Why: While the suggestion identifies a valid backward-compatibility edge case for custom resolutions, the proposed code introduces an undefined variable (registry_qualified_format) and requires a complex architectural change to the state-less deserializer to fix.

Low
Security
Prevent inherited registry alias lookup

Use Object.hasOwn when looking up registry names to prevent inherited properties
from bypassing the missing registry check.

pnpm11/lockfile/utils/src/pkgSnapshotToResolution.ts [52-57]

-registry = { ...BUILTIN_NAMED_REGISTRIES, ...opts.namedRegistries }[registryName]
+const namedRegistries = { ...BUILTIN_NAMED_REGISTRIES, ...opts.namedRegistries }
+registry = Object.hasOwn(namedRegistries, registryName)
+  ? namedRegistries[registryName]
+  : ''
 if (!registry) {
   throw new PnpmError('MISSING_NAMED_REGISTRY',
     `Cannot install package "${depPath}": it was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting.`,
     { hint: `Add '${registryName}' to the namedRegistries setting in pnpm-workspace.yaml.` })
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: This addresses a prototype poisoning risk where inherited Object properties could bypass truthiness checks, ensuring that invalid registry names correctly trigger the error instead of causing unexpected behavior.

Medium
Keep verification fail-closed

Use Object.hasOwn in the verifier when looking up named registries to prevent
prototype poisoning and ensure proper fail-closed behavior.

pnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.ts [233-243]

-const namedRegistry = mergedNamedRegistries[registryName]
+const namedRegistry = Object.hasOwn(mergedNamedRegistries, registryName)
+  ? mergedNamedRegistries[registryName]
+  : undefined
 if (!namedRegistry) {
   // Fail closed: without the registry URL, none of the metadata-backed
   // checks below can vouch for this entry.
   return {
     ok: false,
     code: MISSING_NAMED_REGISTRY_VIOLATION_CODE,
     reason: `was resolved from the named registry '${registryName}:', which is not present in the namedRegistries setting`,
   }
 }
 registry = namedRegistry

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: This ensures that inherited properties on the registry map cannot bypass the fail-closed verification loop, maintaining strict security guarantees for the verifier.

Medium
  • More

@codecov-commenter

codecov-commenter commented Jul 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.35361% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.98%. Comparing base (c2b2f15) to head (fa898ca).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ates/resolving-deps-resolver/src/lockfile_reuse.rs 70.73% 12 Missing ⚠️
...npm-resolver/src/create_npm_resolution_verifier.rs 77.14% 8 Missing ⚠️
pnpm/crates/config/src/pnpm_default_parity.rs 83.33% 4 Missing ⚠️
...package-manager/src/install_package_by_snapshot.rs 83.33% 3 Missing ⚠️
...le-verification/src/verify_lockfile_resolutions.rs 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13528      +/-   ##
==========================================
- Coverage   87.98%   87.98%   -0.01%     
==========================================
  Files         563      565       +2     
  Lines       97596    97856     +260     
==========================================
+ Hits        85874    86098     +224     
- Misses      11722    11758      +36     

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (5)
pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts (5)

14-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Place helper declarations after their first use.

readLockfile and installFoo are declared before the tests that call them. Move both declarations below the test declarations.

As per coding guidelines, function declarations must appear after use.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts`
around lines 14 - 26, Move the readLockfile and installFoo helper declarations
in namedRegistriesLockfileFormat.ts below the test declarations that first use
them, keeping their implementations and behavior unchanged.

Source: Coding guidelines


90-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

State the current lockfile invariant instead of implementation history.

The comment describes the pre-9.1 implementation. Replace it with a present-tense statement that registry identity must remain part of the package key.

Proposed comment
-  // Before format 9.1 these two collapsed onto a single
-  // entry and one of the two consumers silently got the other's tarball.
+  // Keep registry identity in each package key when name and version match.

As per coding guidelines, comments must explain contracts or invariants instead of removed implementation history.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts`
around lines 90 - 91, Replace the historical version-specific comment near the
lockfile fixture with a present-tense invariant stating that registry identity
must remain part of the package key, preserving distinct entries for packages
with the same name and version from different registries.

Source: Coding guidelines


60-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the new user-facing setting before release.

The tests cover namedRegistriesLockfileFormat and lockfile 9.1 behavior. The supplied PR objectives state that documentation remains outstanding. Document the setting, collision behavior when it is disabled, and the intentional TypeScript/pacquet default divergence.

As per path instructions, user-visible lockfile and configuration changes require documentation. Based on learnings from the supplied PR objectives, documentation remains outstanding.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts` at
line 60, Document the user-facing namedRegistriesLockfileFormat setting and its
lockfile 9.1 behavior, including collision handling when disabled and the
intentional TypeScript/pacquet default divergence. Update the relevant
configuration or lockfile documentation rather than changing the test in
namedRegistriesLockfileFormat.

Source: Path instructions


43-47: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Force a lockfile read and rewrite in the preservation test.

The assertion at Line 45 checks only the serialized resolution shape. The second installFoo call at Line 68 repeats the same dependency set and may not force a lockfile rewrite or fetch. Use a fresh store or a request assertion, then verify that the work alias reconstructs the URL from the 9.1 lockfile.

As per path instructions, format 9.1 tests must cover registry-aware URL reconstruction and lockfile round trips.

Also applies to: 63-68

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts`
around lines 43 - 47, Update the preservation test around the lockfile assertion
and second installFoo call to force a lockfile read and rewrite, using a fresh
store or asserting the registry request. Verify the subsequent install resolves
the work alias by reconstructing its tarball URL from the 9.1 lockfile, while
preserving the existing integrity assertion.

Source: Path instructions


55-58: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert package and snapshot identities in every format case.

The 9.1 test checks both maps, but the legacy and preservation tests check only packages. The collision test also checks only package keys and one importer. These tests can pass with mismatched snapshot keys or with the default dependency mapped to the wrong package.

  • pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts#L55-L58: Assert the legacy snapshot key.
  • pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts#L70-L73: Assert the qualified snapshot key after the second install.
  • pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts#L92-L97: Assert both snapshot keys and both importer entries resolve to their intended registry identities.

As per path instructions, lockfile tests must verify registry identity through package and snapshot structures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts`
around lines 55 - 58, The lockfile format tests do not fully validate
package-to-snapshot registry identities. In
pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts:55-58,
assert the legacy snapshot key; at 70-73, assert the qualified snapshot key
after the second install; and at 92-97, assert both snapshot keys plus both
importer entries resolve to their intended registry identities, matching the
existing 9.1 test coverage.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/config/src/pnpm_default_parity.rs`:
- Around line 107-113: Add user-facing documentation for the
named-registries-lockfile-format setting, covering the TypeScript CLI opt-in
behavior, pacquet’s default-on behavior, and preservation of existing 9.1
lockfiles. Also add the required accurate changeset for this user-visible
default difference, while keeping the parity entry and its existing behavior
unchanged.

In `@pnpm11/deps/compliance/sbom/src/purl.ts`:
- Around line 20-35: Update walkStep() in collectComponents.ts to resolve and
validate registryName before constructing the component or calling buildPurl().
If the named registry alias is unavailable, propagate the same
ERR_PNPM_MISSING_NAMED_REGISTRY failure produced by pkgSnapshotToResolution();
only pass a validated registry URL to buildPurl(), preserving default-registry
behavior for absent aliases.

In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts`:
- Around line 50-54: Extend the namedRegistriesLockfileFormat opt-out coverage
around the existing “9.1 format is opt-in” test to include dependencies with the
same package name and version from the default and work registries. Ensure the
legacy writer does not silently emit one ambiguous key: either reject the
collision with a stable actionable error or automatically select the 9.1 format,
while preserving registry identity in the resulting lockfile.

---

Nitpick comments:
In `@pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts`:
- Around line 14-26: Move the readLockfile and installFoo helper declarations in
namedRegistriesLockfileFormat.ts below the test declarations that first use
them, keeping their implementations and behavior unchanged.
- Around line 90-91: Replace the historical version-specific comment near the
lockfile fixture with a present-tense invariant stating that registry identity
must remain part of the package key, preserving distinct entries for packages
with the same name and version from different registries.
- Line 60: Document the user-facing namedRegistriesLockfileFormat setting and
its lockfile 9.1 behavior, including collision handling when disabled and the
intentional TypeScript/pacquet default divergence. Update the relevant
configuration or lockfile documentation rather than changing the test in
namedRegistriesLockfileFormat.
- Around line 43-47: Update the preservation test around the lockfile assertion
and second installFoo call to force a lockfile read and rewrite, using a fresh
store or asserting the registry request. Verify the subsequent install resolves
the work alias by reconstructing its tarball URL from the 9.1 lockfile, while
preserving the existing integrity assertion.
- Around line 55-58: The lockfile format tests do not fully validate
package-to-snapshot registry identities. In
pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts:55-58,
assert the legacy snapshot key; at 70-73, assert the qualified snapshot key
after the second install; and at 92-97, assert both snapshot keys plus both
importer entries resolve to their intended registry identities, matching the
existing 9.1 test coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 95b89a0d-2d5b-43dd-b488-48a53a4b0b73

📥 Commits

Reviewing files that changed from the base of the PR and between 0a8a226 and 72b69aa.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (10)
  • pnpm/crates/config/src/pnpm_default_parity.rs
  • pnpm11/deps/compliance/license-scanner/src/licenses.ts
  • pnpm11/deps/compliance/license-scanner/src/lockfileToLicenseNodeTree.ts
  • pnpm11/deps/compliance/license-scanner/test/licenses.spec.ts
  • pnpm11/deps/compliance/sbom/package.json
  • pnpm11/deps/compliance/sbom/src/collectComponents.ts
  • pnpm11/deps/compliance/sbom/src/purl.ts
  • pnpm11/deps/compliance/sbom/test/purl.test.ts
  • pnpm11/deps/compliance/sbom/tsconfig.json
  • pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/deps/compliance/sbom/src/collectComponents.ts

Comment thread pnpm11/deps/compliance/sbom/src/purl.ts Resolved
Copilot AI review requested due to automatic review settings July 31, 2026 12:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7c805eb

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: b36e78934398

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

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.597 ± 0.175 2.387 2.805 1.59 ± 0.18
pacquet@main 2.581 ± 0.088 2.460 2.700 1.58 ± 0.16
pnpr@HEAD 1.661 ± 0.117 1.421 1.812 1.02 ± 0.12
pnpr@main 1.632 ± 0.154 1.389 1.889 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.59723825138,
      "stddev": 0.1749722303560594,
      "median": 2.5411473666799997,
      "user": 1.6754598599999997,
      "system": 1.4312386999999998,
      "min": 2.38733675118,
      "max": 2.8051246221799997,
      "times": [
        2.8051246221799997,
        2.79922367918,
        2.57646761418,
        2.7719062261799996,
        2.47222044418,
        2.78858168818,
        2.38733675118,
        2.46348304718,
        2.40221132218,
        2.5058271191799997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5805547811799996,
      "stddev": 0.08763478782343001,
      "median": 2.59590720468,
      "user": 2.00433586,
      "system": 1.5227848000000002,
      "min": 2.4599552721799998,
      "max": 2.70044619018,
      "times": [
        2.55799439818,
        2.4599552721799998,
        2.65170633718,
        2.4680357261799997,
        2.6372333801799996,
        2.65826253818,
        2.63382001118,
        2.4850330331799997,
        2.70044619018,
        2.5530609251799996
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6609942083800004,
      "stddev": 0.11730657921278412,
      "median": 1.67862043468,
      "user": 1.3509624599999999,
      "system": 1.4706617999999998,
      "min": 1.42080444718,
      "max": 1.81199532918,
      "times": [
        1.64702671918,
        1.81199532918,
        1.42080444718,
        1.57305484118,
        1.67922084718,
        1.57022208118,
        1.7507293351800002,
        1.7951427751800002,
        1.68372568618,
        1.67802002218
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.63175233658,
      "stddev": 0.1535171193764824,
      "median": 1.63742022468,
      "user": 1.25108826,
      "system": 1.2807745,
      "min": 1.3894030611800001,
      "max": 1.88884445618,
      "times": [
        1.88884445618,
        1.59003855118,
        1.7320585751800002,
        1.40016954918,
        1.6262264351800002,
        1.73366503218,
        1.3894030611800001,
        1.64861401418,
        1.72542961718,
        1.58307407418
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 371.0 ± 38.0 300.8 419.0 1.36 ± 0.16
pacquet@main 272.7 ± 13.8 260.5 297.6 1.00
pnpr@HEAD 406.9 ± 90.2 306.2 545.2 1.49 ± 0.34
pnpr@main 304.3 ± 28.2 276.5 358.1 1.12 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.37098767876000005,
      "stddev": 0.03795182074508944,
      "median": 0.38001673866,
      "user": 0.30794857999999997,
      "system": 0.7291313399999999,
      "min": 0.30077180316,
      "max": 0.41899449016,
      "times": [
        0.31153529516,
        0.30077180316,
        0.37502681916,
        0.36499725416,
        0.39818028516000004,
        0.36751576416000004,
        0.40232554016000005,
        0.41899449016,
        0.38500665816,
        0.38552287816
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.27265725746,
      "stddev": 0.013827041874002669,
      "median": 0.26856033566000004,
      "user": 0.21497858,
      "system": 0.5513114399999999,
      "min": 0.26046974416,
      "max": 0.29758592416,
      "times": [
        0.26182165316,
        0.29516358216,
        0.26048733616,
        0.26853615016000004,
        0.26046974416,
        0.26858452116000003,
        0.26389091816,
        0.28035995116,
        0.29758592416,
        0.26967279416
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.40687121736,
      "stddev": 0.09020752911799047,
      "median": 0.39870017516,
      "user": 0.3292202799999999,
      "system": 0.69690144,
      "min": 0.30619035916000004,
      "max": 0.54521060316,
      "times": [
        0.30619035916000004,
        0.31485805316000004,
        0.47628478816,
        0.43127946516000004,
        0.54521060316,
        0.51069753216,
        0.46938843916,
        0.36612088516,
        0.31691225116,
        0.33176979716000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3042943114600001,
      "stddev": 0.02824949236201709,
      "median": 0.29424094866000006,
      "user": 0.26284507999999995,
      "system": 0.56090074,
      "min": 0.27653070016000003,
      "max": 0.35814240416000004,
      "times": [
        0.28341626816000004,
        0.30773821616,
        0.28315327516,
        0.28966182616,
        0.27653070016000003,
        0.28137578816000003,
        0.31966626216,
        0.35814240416000004,
        0.34443830316,
        0.29882007116000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.914 ± 0.071 2.759 2.979 1.81 ± 0.21
pacquet@main 2.841 ± 0.109 2.681 3.004 1.76 ± 0.21
pnpr@HEAD 1.643 ± 0.156 1.444 1.894 1.02 ± 0.15
pnpr@main 1.615 ± 0.180 1.430 1.924 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.9143472292800006,
      "stddev": 0.07097058651261945,
      "median": 2.93970657958,
      "user": 2.3542928000000005,
      "system": 1.8650678800000002,
      "min": 2.75890136658,
      "max": 2.9788603295800002,
      "times": [
        2.75890136658,
        2.8318732475800004,
        2.96847973958,
        2.9380515065800004,
        2.9413616525800004,
        2.89281465958,
        2.90418206458,
        2.9505138865800005,
        2.9788603295800002,
        2.97843383958
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.84102977588,
      "stddev": 0.10932725703183693,
      "median": 2.8533316920800003,
      "user": 2.1201026999999995,
      "system": 1.6908609799999996,
      "min": 2.68059697858,
      "max": 3.00398494958,
      "times": [
        3.00398494958,
        2.92052378858,
        2.92162360358,
        2.93336865358,
        2.83612767358,
        2.8104348265800003,
        2.8705357105800005,
        2.7401846675800003,
        2.68059697858,
        2.6929169065800003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6432902975799997,
      "stddev": 0.1563329874714356,
      "median": 1.6333978245799998,
      "user": 1.1080900999999999,
      "system": 1.1749491799999998,
      "min": 1.44405997158,
      "max": 1.8936272915799999,
      "times": [
        1.59497741358,
        1.61736541558,
        1.44785863158,
        1.64943023358,
        1.73517909958,
        1.47855965058,
        1.77908452758,
        1.8936272915799999,
        1.44405997158,
        1.7927607405800001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6145746042800002,
      "stddev": 0.17962357720949557,
      "median": 1.5648101480799999,
      "user": 1.085023,
      "system": 1.2230113799999998,
      "min": 1.42984166758,
      "max": 1.92435770058,
      "times": [
        1.42984166758,
        1.45198801558,
        1.44062591358,
        1.48901219458,
        1.72836584658,
        1.92435770058,
        1.68577361458,
        1.59278350558,
        1.86616079358,
        1.53683679058
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 446.8 ± 68.4 407.1 637.1 1.39 ± 0.23
pacquet@main 479.7 ± 119.4 401.5 797.3 1.49 ± 0.39
pnpr@HEAD 321.5 ± 21.8 303.5 379.4 1.00
pnpr@main 350.3 ± 37.6 314.5 437.4 1.09 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.44682498316000013,
      "stddev": 0.06838046211115267,
      "median": 0.42613578826000004,
      "user": 0.58260612,
      "system": 0.6966015599999998,
      "min": 0.40708121476000003,
      "max": 0.63714373376,
      "times": [
        0.40708121476000003,
        0.42627656276000003,
        0.42683491176000005,
        0.41585323376000005,
        0.41298944776,
        0.46029966676000006,
        0.42445367076000007,
        0.43132237576000004,
        0.42599501376000004,
        0.63714373376
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.47969573095999996,
      "stddev": 0.11943649338634296,
      "median": 0.43530281376,
      "user": 0.63061032,
      "system": 0.7147034599999998,
      "min": 0.40146376976000003,
      "max": 0.79734411476,
      "times": [
        0.43198972876,
        0.43861589876000007,
        0.44322400976000004,
        0.40146376976000003,
        0.40913974076000004,
        0.41077848776000003,
        0.42462239676,
        0.5135868487599999,
        0.52619231376,
        0.79734411476
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32154657436,
      "stddev": 0.021849398109150108,
      "median": 0.31422232776000003,
      "user": 0.21129161999999999,
      "system": 0.5517591599999998,
      "min": 0.30347558676,
      "max": 0.37943759776,
      "times": [
        0.31498530476000003,
        0.31213669676000005,
        0.32469846076000003,
        0.32848039076,
        0.32261650276000003,
        0.37943759776,
        0.30776544076,
        0.30347558676,
        0.31345935076000003,
        0.30841041176000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3503336275600001,
      "stddev": 0.03763372626907779,
      "median": 0.33625345926000005,
      "user": 0.22163871999999998,
      "system": 0.56516176,
      "min": 0.31448166276000006,
      "max": 0.43742768276000005,
      "times": [
        0.38330373576000004,
        0.33432989776000005,
        0.35129613176,
        0.36934303476,
        0.33817702076000006,
        0.32077253376000003,
        0.31448166276000006,
        0.32120842176000003,
        0.33299615376,
        0.43742768276000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.184 ± 0.253 1.986 2.805 4.48 ± 1.01
pacquet@main 2.154 ± 0.226 2.034 2.791 4.42 ± 0.97
pnpr@HEAD 0.488 ± 0.094 0.401 0.741 1.00
pnpr@main 0.491 ± 0.182 0.402 1.006 1.01 ± 0.42
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.1839430704400002,
      "stddev": 0.252955229126732,
      "median": 2.07798678984,
      "user": 1.4421529400000002,
      "system": 1.12945758,
      "min": 1.98634830934,
      "max": 2.80506209334,
      "times": [
        1.98634830934,
        2.80506209334,
        2.0881621043400003,
        2.06441247534,
        2.28789460234,
        2.00967536534,
        2.0383244833400003,
        2.06781147534,
        2.0974672253400004,
        2.39427257034
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.1536988749400003,
      "stddev": 0.22629644911264007,
      "median": 2.0863418468400003,
      "user": 1.4221468400000004,
      "system": 1.11123928,
      "min": 2.0344564923400004,
      "max": 2.79115427334,
      "times": [
        2.1513757693400004,
        2.0548761893400003,
        2.0652161333400003,
        2.0344564923400004,
        2.79115427334,
        2.0637407643400003,
        2.11004224434,
        2.0894281413400004,
        2.0832555523400003,
        2.0934431893400003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.48757471364000005,
      "stddev": 0.09379543625660187,
      "median": 0.47249204184000004,
      "user": 0.34587004,
      "system": 0.7189065799999999,
      "min": 0.40123482534,
      "max": 0.74089369134,
      "times": [
        0.46885370034,
        0.40123482534,
        0.47613038334,
        0.74089369134,
        0.48028148634,
        0.49431767934000004,
        0.43445309334000004,
        0.49345953734000003,
        0.43429629834,
        0.45182644134
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.49094571414,
      "stddev": 0.18209388243315983,
      "median": 0.43650572134,
      "user": 0.33481714,
      "system": 0.6830217799999999,
      "min": 0.40196702034000004,
      "max": 1.00562018434,
      "times": [
        0.44877297834,
        0.46713802834,
        0.45430319134,
        0.42391575834,
        0.45242662834,
        0.42357464934,
        0.42423846434,
        0.40196702034000004,
        0.40750023834000004,
        1.00562018434
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 359.2 ± 45.1 312.5 435.4 3.97 ± 0.57
pacquet@main 347.4 ± 40.8 290.2 425.1 3.84 ± 0.52
pnpr@HEAD 90.4 ± 6.3 85.5 106.7 1.00
pnpr@main 94.2 ± 10.8 84.6 130.4 1.04 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35921591509999995,
      "stddev": 0.04514688056911259,
      "median": 0.3479567254,
      "user": 0.3623856,
      "system": 0.10085410000000002,
      "min": 0.3124693189,
      "max": 0.4353633319,
      "times": [
        0.3240619039,
        0.4143024809,
        0.4353633319,
        0.3494891819,
        0.3464242689,
        0.3858218079,
        0.3159214999,
        0.3941424999,
        0.3141628569,
        0.3124693189
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3473602735,
      "stddev": 0.04080111401501471,
      "median": 0.3420700989,
      "user": 0.3427561,
      "system": 0.1088929,
      "min": 0.2901791589,
      "max": 0.42512045190000003,
      "times": [
        0.3485932009,
        0.3515928829,
        0.3824130179,
        0.3194607249,
        0.3355469969,
        0.42512045190000003,
        0.3871763009,
        0.3121711489,
        0.3213488509,
        0.2901791589
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09041796232307692,
      "stddev": 0.006279783355543948,
      "median": 0.08754809790000001,
      "user": 0.023584553846153853,
      "system": 0.009826284615384616,
      "min": 0.0854910269,
      "max": 0.10672594390000001,
      "times": [
        0.10672594390000001,
        0.1027310039,
        0.10333152190000001,
        0.10182086590000002,
        0.09153766890000001,
        0.08924418290000001,
        0.0961754159,
        0.09158372490000001,
        0.0857571369,
        0.08770196690000001,
        0.08642227390000001,
        0.08720365190000001,
        0.0854910269,
        0.08617096290000001,
        0.08641167490000001,
        0.08859426390000001,
        0.08557369190000001,
        0.0879433809,
        0.08615152590000001,
        0.08739422890000001,
        0.08571883390000001,
        0.08698270690000001,
        0.0865812229,
        0.09060054890000001,
        0.09000179490000002,
        0.08701579890000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09420833365757575,
      "stddev": 0.010813962601940582,
      "median": 0.0901565859,
      "user": 0.023988460606060604,
      "system": 0.01169308484848485,
      "min": 0.08462223490000001,
      "max": 0.1304168839,
      "times": [
        0.0863704579,
        0.08697503190000001,
        0.08686868290000001,
        0.0890206339,
        0.12257796790000001,
        0.1132268309,
        0.09966741290000002,
        0.10312393190000001,
        0.1304168839,
        0.1126908939,
        0.09963555290000001,
        0.09790181790000001,
        0.0902872809,
        0.09148688390000001,
        0.09389083690000001,
        0.08698493090000001,
        0.09426182290000001,
        0.0900381729,
        0.08994814390000001,
        0.0916319869,
        0.09147153490000001,
        0.09050818590000001,
        0.09068011890000001,
        0.08640466090000001,
        0.08462223490000001,
        0.0874673469,
        0.08795537390000001,
        0.0885692859,
        0.0897152969,
        0.0901565859,
        0.0859440669,
        0.08860166590000002,
        0.08977249490000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.659 ± 0.177 4.445 4.891 1.30 ± 0.06
pacquet@main 4.705 ± 0.175 4.495 5.108 1.31 ± 0.06
pnpr@HEAD 4.075 ± 0.195 3.730 4.397 1.13 ± 0.06
pnpr@main 3.595 ± 0.100 3.466 3.821 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.659227142600001,
      "stddev": 0.17713222692439962,
      "median": 4.6741513,
      "user": 1.7821338399999997,
      "system": 1.3882147599999999,
      "min": 4.445103995,
      "max": 4.890669825,
      "times": [
        4.751509616,
        4.869836798000001,
        4.6196885850000005,
        4.462290948000001,
        4.445103995,
        4.462984931,
        4.529966584,
        4.890669825,
        4.728614015,
        4.831606129000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.704500672699999,
      "stddev": 0.17483674933665191,
      "median": 4.657285453,
      "user": 2.55033324,
      "system": 1.81590876,
      "min": 4.4954883180000005,
      "max": 5.107706469,
      "times": [
        4.591376716,
        4.4954883180000005,
        4.668755746,
        4.570243604,
        4.769566284000001,
        4.608354608,
        4.645815160000001,
        4.749906367,
        4.837793455,
        5.107706469
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 4.074901673600001,
      "stddev": 0.19510132695239904,
      "median": 4.0273565515000005,
      "user": 2.4348931400000002,
      "system": 2.4456108599999995,
      "min": 3.7300117569999998,
      "max": 4.397341322,
      "times": [
        4.013045813000001,
        4.005882551,
        4.368607833,
        4.0302977030000005,
        4.397341322,
        3.9461970479999997,
        4.12731077,
        3.7300117569999998,
        4.0244154000000005,
        4.105906539
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5947765110999996,
      "stddev": 0.09999508478460846,
      "median": 3.574739278,
      "user": 1.47963794,
      "system": 1.46976096,
      "min": 3.4659978199999997,
      "max": 3.821444748,
      "times": [
        3.5736579429999997,
        3.552906358,
        3.5660346019999998,
        3.5233887669999997,
        3.709163029,
        3.4659978199999997,
        3.575820613,
        3.5777230149999997,
        3.581628216,
        3.821444748
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13528
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
312.47 ms
(+27.28%)Baseline: 245.51 ms
294.61 ms
(106.06%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,758.90 ms
(+1.77%)Baseline: 2,711.00 ms
3,253.20 ms
(84.81%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,986.35 ms
(+7.08%)Baseline: 1,854.97 ms
2,225.96 ms
(89.24%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
407.08 ms
(-20.08%)Baseline: 509.38 ms
611.25 ms
(66.60%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
312.47 ms
(+27.28%)Baseline: 245.51 ms
294.61 ms
(106.06%)

isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,387.34 ms
(-2.12%)Baseline: 2,439.16 ms
2,926.99 ms
(81.56%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,445.10 ms
(-1.95%)Baseline: 4,533.65 ms
5,440.38 ms
(81.71%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
300.77 ms
(+3.74%)Baseline: 289.92 ms
347.91 ms
(86.45%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13528
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,450.98 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
316.73 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
299.87 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
102.46 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,371.63 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,498.57 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
274.44 ms
🐰 View full continuous benchmarking report in Bencher

Copilot AI review requested due to automatic review settings July 31, 2026 12:32
Copilot AI review requested due to automatic review settings August 2, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…y fix it is

The lockfile carried no marker for which registry a package came from, and
entry lookup went through refToRelative(ref, name), so a dependency declared
against one registry could be satisfied by an entry resolved from another —
package substitution, live in 11.1.0 through 11.19.x.

Leading with that rather than with the lockfile re-keying puts the
semi-breaking diff in its actual context: the diff is the fix, and reviewing
it is worthwhile because an entry moving to an unexpected registry is a
finding. It also gives the mixed-version churn its real weight, since a
lockfile written back to the old shape is exposed again.
Copilot AI review requested due to automatic review settings August 2, 2026 14:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 2, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 72984cd

zkochan added 2 commits August 2, 2026 16:33
`npmjs:` now resolves to https://registry.npmjs.org/ with no configuration,
alongside the existing `gh:` alias. It pins a dependency to the public
registry even when `registry` points somewhere else, such as an internal
proxy — something no specifier could express before. `npm:` cannot serve
that purpose: it is reserved for the alias protocol and resolves through
whatever `registry` points at.

Built-in registry URLs are also the prefixes a recorded tarball URL is
matched against in `pick_registry`, so this changes where an entry whose
tarball URL is on registry.npmjs.org gets verified: the public registry
rather than a configured proxy. An org that mirrors npmjs points the alias
at their mirror to restore the old routing, the same escape hatch GHES users
already have for `gh`. The blast radius is bounded — a canonical URL for the
configured registry is omitted from the lockfile entirely, and the verifier
short-circuits unless a tarball-URL, minimumReleaseAge, or trustPolicy check
runs — but it is a real change and the release note calls it out with the
override to apply.

The scheme-and-port normalization test moved off registry.npmjs.org onto a
neutral host. It was pinning that a benign URL normalization is not treated
as tampering, and the host it happened to use is now a built-in prefix,
which routed its metadata fetch away from the mock and out to the real
registry.
…ests

Builds the percent-encoded scope through the same `slash` helper the
neighbouring tests use, and drops "repoint" for "override".
Copilot AI review requested due to automatic review settings August 2, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

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

@zkochan
zkochan merged commit 2d30dd6 into main Aug 2, 2026
34 checks passed
@zkochan
zkochan deleted the named-registries-lockfile branch August 2, 2026 14:52
zkochan added a commit to pnpm/rfcs that referenced this pull request Aug 26, 2026
* rfc(pnpr): propose integrity-addressed patch revisions

* rfc(pnpr): fetch patch revisions by integrity URL

* rfc: encode artifact revisions in SRI options

* rfc: rename revision options to rN and add override-based pinning

Replace the empty-option/`?vN` markers with explicit `?r0`/`?rN` ordinals:
`r` abbreviates *registry revision*, matches `dist.revisions` numbering,
and follows Alpine/Gentoo `-rN` precedent, while an always-non-empty
option removes the raw-SRI-parsing fragility.

Specify workspace revision selection through ordinary overrides whose
targets carry the ordinal as semver build metadata (`<version>+rN`):
`+r0` pins the original, positive ordinals adopt or freeze replacements,
unknown ordinals fail hard, and registry policy 403s still win.

Require each `dist.revisions` entry to carry a `manifest` object with the
abbreviated-packument field subset, derived from the verified tarball and
never provider-declared, so a pinned non-selected revision resolves with
its own dependency metadata.

Co-Authored-By: Claude Fable 5 <[email protected]>

* rfc: resolve +rN as a revision-addressed spec, drop post-pick dependency

Exact-version override selectors already match intersecting declared
ranges in current pnpm (pnpm/pnpm#13470, retained for npm parity), so no
resolver semantics change is needed. <version>+rN becomes a plain
revision-addressed spec — usable as an override target or a directly
declared dependency — resolved by picking the version normally, then
selecting the revision from dist.revisions. State the version-pinning
trade-off and the npm degradation (pin without revision selection)
honestly.

Co-Authored-By: Claude Fable 5 <[email protected]>

* rfc: address review — rollback, allocation, caching, and conflict rules

- Provider manifests carry a signed monotonic sequence; pnpr rejects
  replayed lower-sequence documents, so selection rollback requires a
  fresh manifest or an explicitly authorized operator action.
- Revision allocation is transactional: (registry, name, version,
  digest) maps to exactly one ordinal, idempotent under retries.
- Immutability means stable bytes, not availability: policy refusal
  requires edge purge or non-shared caching, applies identically to
  canonical and digest routes, and the digest route authorizes against
  the principal's package-level access.
- Ordinals are documented as registry-scoped; portability guarantees
  integrity, not identical ordinal meaning across registries.
- Override rewriting applies once (no chains or cycles), and
  conflicting revision demands for one name@version fail explicitly.
- deprecated is registry-managed mutable metadata, excluded from the
  artifact-derived revision manifest subset.

Co-Authored-By: Claude Fable 5 <[email protected]>

* rfc: serialize ordinal allocation per identity, fix checkpoint timing

- Allocation serializes on (registry, name, version) with separate
  uniqueness constraints on the ordinal and the digest mapping, so
  concurrent refreshes with different digests cannot share an ordinal.
- The registry owns the ordinal history: provider renames, replacements,
  or removals never renumber existing revisions (previously an open
  question, now normative since rN pins are a public API).
- The provider sequence checkpoint advances atomically with durable
  manifest acceptance, keeping a crashed sequence retryable.

Co-Authored-By: Claude Fable 5 <[email protected]>

* rfc: replace SRI options with a revision field, unmark originals

The ordinal moves out of the integrity value: dist.revision on the
registry side and resolution.revision in the lockfile, present only for
replacements (N >= 1). Originals are never marked — the canonical URL is
pinned to revision zero by invariant, so plain integrity-only entries
stay correct on every registry, a lockfile with no adopted patches is
byte-identical to today's format, and only revision entries need the
lockfile-version gate.

dist.integrity returns to a standard SRI value that strict consumers
parse. Registry feature detection (the pnpr handshake) is specified as
advisory only — diagnostics and an optional originals-by-digest
optimization — never load-bearing for the fetch convention, which the
lockfile field alone determines. Digest-route tarballs without
dist.revision are normalized to integrity-only entries so hostnames
never enter the lockfile.

Document that npm/yarn patch delivery rides dist.tarball (unchanged by
canonical immutability), that convention-reconstructing clients fail
loudly rather than silently, and add a client-matrix verification
question. The SRI-option and mark-everything designs move to rejected
alternatives; +rN spec syntax is unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>

* rfc: preserve original manifest across revisions

* rfc: add ordinal-in-URL scheme to alternatives

Co-Authored-By: Claude Fable 5 <[email protected]>

* rfc: sharpen SRI rejection, reject revision in the package key

The SRI-option rejection asserted that strict consumers may reject options.
The real failure is worse: pnpm's Rust ssri has no option grammar, so it
absorbs the option into the digest, round-trips it through Display, and fails
far from the parse. Integrity-string equality is also byte equality across
pnpm, so an ordinal inside the value would make a revision-only difference
read as a content change.

Record encoding the ordinal in the lockfile package key as an alternative,
since the registry-qualified keys of pnpm/pnpm#13528 invite it. It is rejected
on churn: a dep path repeats once per dependent, so one revision bump would
rewrite roughly fifty lines for a package as common as semver, and
patchedDependencies already demonstrates this with patch_hash. The key may
carry extra data; it may not carry data designed to change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Update pnpr/text/0000-integrity-addressed-patch-revisions.md

Co-authored-by: John-David Dalton <[email protected]>

* Update pnpr/text/0000-integrity-addressed-patch-revisions.md

Co-authored-by: John-David Dalton <[email protected]>

* Update text/0000-integrity-addressed-registry-tarballs.md

Co-authored-by: John-David Dalton <[email protected]>

* Update text/0000-integrity-addressed-registry-tarballs.md

Co-authored-by: John-David Dalton <[email protected]>

* Update pnpr/text/0000-integrity-addressed-patch-revisions.md

Co-authored-by: John-David Dalton <[email protected]>

* Update pnpr/text/0000-integrity-addressed-patch-revisions.md

Co-authored-by: John-David Dalton <[email protected]>

* Address PR review feedback; say "revision number" instead of "ordinal"

Review feedback from #19:

- sequence checkpoint stores the manifest digest: exact replay is a
  no-op, same sequence with different content is provider equivocation
- one validation rule for dist.revision, identical for full and
  abbreviated packuments
- abbreviated packuments retain each history entry's revision number
- new section on intermediaries: effective registry behind a proxy,
  digest-to-package mapping via dist.revisions
- per-entry withdrawn/supersededBy status in revision history
- every 3xx fails the digest fetch, same-origin included
- revision numbers bounded to 2^53 - 1 in canonical decimal form
- ship resolution.revision in @pnpm/lockfile-types with docs
- new unresolved questions: batch revision endpoint, human-readable
  revision annotation suffix

Terminology: a registry revision is now defined as the history entry;
its integer is its revision number, matching the dist.revision field.
The word "ordinal" no longer appears.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: John-David Dalton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants