Repository navigation
feat(lockfile): key named-registry packages by their registry - #13528
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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. ChangesNamed-registry lockfile format 12.0
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoAdd lockfile format 9.1 with registry-qualified keys for named registries
AI Description
Diagram
High-Level Assessment
Files changed (93)
|
Confidence Score: 4/5The 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 |
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1.
|
PR Code Suggestions ✨Latest suggestions up to fa898ca Warning
Previous suggestionsSuggestions up to commit 72984cd
Suggestions up to commit e6be03c
Suggestions up to commit ab93c65
✅ Suggestions up to commit bb953db
Suggestions
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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:
Fix. The changeset finding was a false positive — replied on that thread. Two other things landed since the first push, worth a reviewer's attention:
Written by an agent (Claude Code, claude-fable-5). |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 14
🧹 Nitpick comments (6)
pnpm/crates/config/src/workspace_yaml.rs (1)
206-206: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd rustdoc for
WorkspaceSettings::named_registries_lockfile_format.
WorkspaceSettingsis public, but this new public field has no contract comment. Document that it controls format 9.1 registry-qualified keys and thatNoneleaves theConfigdefault 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 winAlign the named-registry fallback with
pkgSnapshotToResolution's fail-closed behavior.When
registryNameis present but absent frommergedNamedRegistries, this branch usesdp.getRegistryByPackageName(registries, depNode.name)instead of failing closed. This can rewrite a registry-qualified lockfile entry to the default or scope registry’s tarball. ThrowMISSING_NAMED_REGISTRYhere too, or ensure every path intoupdateLockfilerejects 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 winUse an options object for the metadata API.
getPkgMetadataandgetPkgMetadataUnclampednow 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 valueRemove 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 winReuse the validated merged registry map.
Lines 3053-3060 duplicate
merge_named_registriesafter lines 751-752 already producemerged_named_registries. Keep one alias-precedence and URL-normalization policy.Add the merged map to
FreshLockfileBuildOptions. Pass&merged_named_registriesat bothbuild_fresh_lockfilecall 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 winExtend coverage for reserved named-registry aliases.
is_reserved_version_prefixalready includes the full reserved set, includingnpmandjsr, so the alias rejection path is safe. The existing regression loop only coverslink,workspace,file, andruntime; addnpm,jsr,github,catalog,git,http,https, andpatch, 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
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lock,!Cargo.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!pnpm-lock.yaml
📒 Files selected for processing (91)
.changeset/named-registries-lockfile-format.mdpnpm/crates/cli/tests/named_registry_install.rspnpm/crates/config/src/lib.rspnpm/crates/config/src/workspace_yaml.rspnpm/crates/deps-path/Cargo.tomlpnpm/crates/deps-path/src/lib.rspnpm/crates/deps-path/src/registry_qualified.rspnpm/crates/deps-path/src/registry_qualified/tests.rspnpm/crates/deps-path/src/try_get_package_id.rspnpm/crates/lockfile-verification/src/verify_lockfile_resolutions.rspnpm/crates/lockfile/src/pkg_ver_peer.rspnpm/crates/lockfile/src/pkg_ver_peer/tests.rspnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rspnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rspnpm/crates/package-manager/src/fast_update_overrides.rspnpm/crates/package-manager/src/install.rspnpm/crates/package-manager/src/install_package_by_snapshot.rspnpm/crates/package-manager/src/install_package_from_registry/tests.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/resolving-deps-resolver/benches/workspace_full_resolution.rspnpm/crates/resolving-deps-resolver/src/lockfile_reuse.rspnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-deps-resolver/src/resolve_workspace.rspnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rspnpm/crates/resolving-npm-resolver/Cargo.tomlpnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rspnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/tests.rspnpm/crates/resolving-npm-resolver/src/named_registry.rspnpm/crates/resolving-npm-resolver/src/named_registry/tests.rspnpm/crates/resolving-npm-resolver/src/named_registry_resolver.rspnpm/crates/resolving-npm-resolver/src/named_registry_resolver/tests.rspnpm/crates/resolving-npm-resolver/src/npm_resolver.rspnpm/crates/resolving-npm-resolver/src/violation_codes.rspnpm/crates/resolving-npm-resolver/tests/chain.rspnpm/crates/resolving-resolver-base/src/resolve.rspnpm/crates/resolving-resolver-base/src/tests.rspnpm/crates/resolving-resolver-base/src/verifier.rspnpm11/config/reader/src/Config.tspnpm11/config/reader/src/configFileKey.tspnpm11/config/reader/src/index.tspnpm11/config/reader/src/types.tspnpm11/core/constants/src/index.tspnpm11/deps/compliance/commands/src/licenses/licensesList.tspnpm11/deps/compliance/commands/src/sbom/sbom.tspnpm11/deps/compliance/license-scanner/src/getPkgInfo.tspnpm11/deps/compliance/license-scanner/src/licenses.tspnpm11/deps/compliance/license-scanner/src/lockfileToLicenseNodeTree.tspnpm11/deps/compliance/sbom/src/collectComponents.tspnpm11/deps/compliance/sbom/src/getPkgMetadata.tspnpm11/deps/compliance/sbom/test/getPkgMetadata.test.tspnpm11/deps/graph-builder/src/lockfileToDepGraph.tspnpm11/deps/inspection/list/src/index.tspnpm11/deps/inspection/tree-builder/src/buildDependenciesTree.tspnpm11/deps/inspection/tree-builder/src/buildDependentsTree.tspnpm11/deps/inspection/tree-builder/src/getPkgInfo.tspnpm11/deps/inspection/tree-builder/src/getTree.tspnpm11/deps/path/src/index.tspnpm11/deps/path/test/index.tspnpm11/installing/commands/src/install.tspnpm11/installing/commands/src/installDeps.tspnpm11/installing/commands/src/recursive.tspnpm11/installing/context/src/readLockfiles.tspnpm11/installing/deps-installer/src/install/extendInstallOptions.tspnpm11/installing/deps-installer/src/install/index.tspnpm11/installing/deps-installer/src/install/tryFastUpdateOverrides.tspnpm11/installing/deps-installer/src/install/verifyLockfileResolutions.tspnpm11/installing/deps-resolver/src/index.tspnpm11/installing/deps-resolver/src/resolveDependencies.tspnpm11/installing/deps-resolver/src/resolveDependencyTree.tspnpm11/installing/deps-resolver/src/updateLockfile.tspnpm11/installing/deps-restorer/src/index.tspnpm11/installing/deps-restorer/src/lockfileToHoistedDepGraph.tspnpm11/lockfile/fs/src/lockfileFormatConverters.tspnpm11/lockfile/fs/test/normalizeLockfile.test.tspnpm11/lockfile/utils/package.jsonpnpm11/lockfile/utils/src/index.tspnpm11/lockfile/utils/src/nameVerFromPkgSnapshot.tspnpm11/lockfile/utils/src/pkgSnapshotToResolution.tspnpm11/lockfile/utils/test/pkgSnapshotToResolution.tspnpm11/lockfile/utils/tsconfig.jsonpnpm11/resolving/default-resolver/test/namedRegistry.tspnpm11/resolving/npm-resolver/package.jsonpnpm11/resolving/npm-resolver/src/createNpmResolutionVerifier.tspnpm11/resolving/npm-resolver/src/index.tspnpm11/resolving/npm-resolver/src/parseBareSpecifier.tspnpm11/resolving/npm-resolver/src/violationCodes.tspnpm11/resolving/npm-resolver/test/resolveNamedRegistry.test.tspnpm11/resolving/npm-resolver/tsconfig.jsonpnpm11/resolving/resolver-base/src/index.tspnpm11/store/controller-types/src/index.ts
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]>
|
Code review by qodo was updated up to the latest commit 72b69aa |
PR Code Suggestions ✨Warning
|
||||||||||||||||||
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
pnpm11/installing/deps-installer/test/namedRegistriesLockfileFormat.ts (5)
14-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPlace helper declarations after their first use.
readLockfileandinstallFooare 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 winState 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 winDocument the new user-facing setting before release.
The tests cover
namedRegistriesLockfileFormatand 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 winForce a lockfile read and rewrite in the preservation test.
The assertion at Line 45 checks only the serialized
resolutionshape. The secondinstallFoocall 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 theworkalias 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 winAssert 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!pnpm-lock.yaml
📒 Files selected for processing (10)
pnpm/crates/config/src/pnpm_default_parity.rspnpm11/deps/compliance/license-scanner/src/licenses.tspnpm11/deps/compliance/license-scanner/src/lockfileToLicenseNodeTree.tspnpm11/deps/compliance/license-scanner/test/licenses.spec.tspnpm11/deps/compliance/sbom/package.jsonpnpm11/deps/compliance/sbom/src/collectComponents.tspnpm11/deps/compliance/sbom/src/purl.tspnpm11/deps/compliance/sbom/test/purl.test.tspnpm11/deps/compliance/sbom/tsconfig.jsonpnpm11/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
|
Code review by qodo was updated up to the latest commit 7c805eb |
Integrated-Benchmark Report (Linux)Commit: 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
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
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
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
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
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
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
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
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13528 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,450.98 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 316.73 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 299.87 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 102.46 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,371.63 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,498.57 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 274.44 ms |
…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.
|
Code review by qodo was updated up to the latest commit 72984cd |
`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".
|
Code review by qodo was updated up to the latest commit fa898ca |
* 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]>
Summary
namedRegistriesshipped in v11.1.0, but the lockfile was never extended to match it. A package resolved from a named registry lands under a plainname@versionkey, so two registries serving the same name+version collapse onto onepackages: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 onrefToRelative(ref, name), so awork:foospec can be satisfied by an entry that was really resolved from npmjs, and vice versa.This keys named-registry packages as
<name>@<registryName>:<version>: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,depPathToFilenameescapes the colon to+, andrefToRelativealready reconstructsfoo@work:1.0.0from awork:1.0.0ref 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.0behind auseLockfileV12setting. That was dropped: it was the one part of the change that could not be adopted incrementally.lockfile/fs/src/read.tsgates compatibility on the major version alone — same code inv10.9.0— so a client that has not learned12.0does 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 the5.3 → 5.4/6.0 → 6.1sense rather than breaking in the6.x → 7.0sense — and consistent with pnpm 10 and 11, which both shipped on9.0because 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 withERR_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)
update --latestchain still builds no named-registry resolver.namedRegistriesstill need writing.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Codex, GPT-5), reworked by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit