Skip to content

fix(lockfile,sbom): stop treating a git resolution's integrity as a checksum - #13748

Merged
zkochan merged 7 commits into
mainfrom
fix-13042
Aug 10, 2026
Merged

zkochan merged 7 commits into
mainfrom
fix-13042

Conversation

@zkochan

@zkochan zkochan commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #13042.

Lockfiles in the wild carry resolution: {type: git, repo, commit, integrity: sha512-…}. Nothing verifies a git checkout against that hash — the commit pins the content, and the store key is git-hosted rather than integrity-addressed — and both stacks were wrong about it, in opposite directions.

The Rust engine rejected the lockfile outright. GitResolution is deny_unknown_fields with no integrity, so the entry matched no ResolutionSerde variant and the whole install died with ERR_PNPM_BROKEN_LOCKFILE — on a lockfile the TypeScript CLI reads without complaint.

The TypeScript CLI passed the hash on as if it meant something. It echoed it back on every write, and pnpm sbom read .integrity off any resolution shape (collectComponents.ts), publishing it as a CycloneDX/SPDX checksum. An SBOM checksum reads as an assurance that the artifact was verified against it. For a git checkout, that verification never happened — so the field was quietly making a claim pnpm cannot back.

So the fix is not "preserve it for round-trip fidelity" (what the first revision of this PR did). It is: accept the key so the lockfile loads, and then drop it everywhere it could be mistaken for a check.

  • Rust — the field is declared so parsing succeeds, and cleared as the entry is read, so it cannot reach the lockfile writer, a resolution comparison, or an SBOM. It is typed as an unvalidated String because the value is discarded: rejecting a malformed one would fail a lockfile pnpm reads fine.
  • TypeScript — toLockfileResolution strips it on the way out, and the SBOM collector publishes only the tarball/registry hash it actually checks the downloaded bytes against.

The hash leaves with the next lockfile write rather than provoking one of its own, so a frozen install is untouched and no one gets a surprise diff.

On provenance

I could not reproduce a pnpm that writes this field, and I want that on the record rather than buried. Against a git+file:// dependency, none of pnpm 9.15.9, 10.34.5, 11.10.0 (the version that produced the reporter's lockfile) or 11.21.0 records an integrity on a type: git resolution, warm store and repeat installs included; addFilesFromDir — what the git fetcher returns — has no integrity at runtime, not merely in its types. A custom fetcher can still land one via the (resolution as TarballResolution).integrity = … write in packageRequester.ts, but I have not shown that to be the actual source, and an earlier revision of this description asserted it too confidently.

That does not change what to do. Whatever wrote it, pnpm reads such a lockfile and the Rust engine must not die on it, and neither stack should keep advertising a hash it never checks.

Verification

Both halves were checked against real behavior, not just unit tests:

  • Injecting an integrity into a lockfile and running the rebuilt TS bundle: the install succeeds (with a deliberately fabricated hash — nothing verified it), and a rewriting install now drops the key.
  • The pacquet e2e (install_from_a_git_repo_whose_lockfile_records_an_integrity) installs a git dep, injects the hash, asserts a frozen install still succeeds, then asserts the key is gone once a dependency change rewrites the lockfile.
  • Each new test was confirmed to fail without its fix — including the SBOM one, which reports Received: "sha512-AAAA" when the narrowing is reverted.

Note for the reviewer

The SBOM collector now excludes every typed resolution, which also drops the type: binary checksum that pnpm does verify. That matches integrity_string in the Rust CLI's sbom.rs today, so the two stacks agree; publishing verified binary hashes in both stacks would be a separate improvement.

Squash Commit Body

Nothing verifies a git checkout against a hash: the commit pins the
content, and the store key is git-hosted rather than integrity-addressed.
Yet lockfiles in the wild carry `resolution: {type: git, repo, commit,
integrity: sha512-...}`, and both stacks were wrong about it in opposite
directions.

The Rust engine declared `GitResolution` `deny_unknown_fields` with no
`integrity`, so such an entry matched no `ResolutionSerde` variant and
aborted the whole install with ERR_PNPM_BROKEN_LOCKFILE — a lockfile the
TypeScript CLI reads without complaint.

The TypeScript CLI went the other way and passed the hash on as if it
meant something: it echoed it back on every write, and `pnpm sbom` read
`.integrity` off any resolution shape, publishing it as a CycloneDX/SPDX
checksum. An SBOM checksum reads as an assurance that the artifact was
verified against it, which for a git checkout never happened.

Accept the key so the lockfile loads, then drop it: the Rust side clears
it as the entry is read, so it cannot reach the writer, a comparison, or
an SBOM; `toLockfileResolution` strips it on the way out; and the SBOM
collector only publishes the tarball/registry hash it actually checks the
bytes against. The value leaves with the next lockfile write rather than
provoking one of its own.

Closes pnpm/pnpm#13042

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • 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.

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

Summary by CodeRabbit

  • Bug Fixes

    • Git-based dependencies with integrity metadata now install successfully, including with frozen installations.
    • Lockfile rewrites remove unsupported Git integrity metadata while preserving resolved commits.
    • Legacy or malformed Git integrity values no longer prevent lockfile loading.
  • New Features

    • SBOM output now includes verified checksums for binary runtime archives.
    • Unverified Git integrity metadata remains excluded from SBOM checksums.

Copilot AI lite review requested due to automatic review settings August 9, 2026 23:44

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 Aug 9, 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

Git resolutions now accept integrity metadata during lockfile loading. The metadata is discarded from in-memory resolution data, rewritten lockfiles, and SBOM checksums. Binary resolution checksums are now included in SBOM output.

Changes

Git resolution integrity

Layer / File(s) Summary
Accept and discard Git integrity
pnpm/crates/lockfile/src/resolution.rs, pnpm/crates/lockfile/src/resolution/tests.rs
GitResolution accepts optional integrity metadata. Deserialization clears it, and serialization omits it. Tests cover valid and malformed values.
Filter integrity in lockfile and SBOM output
pnpm11/lockfile/utils/..., pnpm11/deps/compliance/sbom/..., pnpm/crates/cli/src/cli_args/sbom.rs, pnpm/crates/cli/src/cli_args/sbom/tests.rs
Git integrity is removed from lockfile conversion and SBOM output. Verified binary integrity is included in SBOM checksums.
Validate installation and resolver compatibility
pnpm/crates/cli/tests/suite/git_hosted_install.rs, pnpm/crates/resolving-git-resolver/src/git_resolver.rs, pnpm/crates/*/tests.rs, .changeset/git-resolution-integrity-parses.md
Tests cover frozen installation, lockfile rewriting, resolver construction, and Git fixtures without integrity.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Parse Git resolutions containing integrity [#13042] ✅
Allow installation to proceed with lockfiles that contain Git integrity metadata [#13042] ✅
Preserve the integrity field during round-trip serialization [#13042] ❌ Deserialization clears Git integrity, and serialization omits it.

Out-of-scope changes

Code Change Explanation
Filter Git integrity from SBOM components (pnpm11/deps/compliance/sbom/src/collectComponents.ts:236,332-347) Issue #13042 covers lockfile parsing and installation. It does not define SBOM checksum behavior.
Include binary integrity in SBOM output (pnpm/crates/cli/src/cli_args/sbom.rs:253-262) Issue #13042 does not specify checksum publication for binary resolutions.

Sequence Diagram(s)

sequenceDiagram
  participant LockfileParser
  participant GitResolution
  participant Installer
  participant LockfileSerializer
  participant SBOM
  LockfileParser->>GitResolution: Load Git resolution with integrity
  GitResolution->>GitResolution: Clear integrity metadata
  GitResolution->>Installer: Provide commit-pinned resolution
  Installer->>LockfileSerializer: Rewrite Git resolution without integrity
  GitResolution->>SBOM: Provide resolution metadata
  SBOM->>SBOM: Omit Git integrity checksum
Loading

Possibly related PRs

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

Suggested reviewers: qodo-code-review

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-13042

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

Fix lockfile parsing for git resolutions that include integrity

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Accept integrity on type: git lockfile resolutions to avoid broken installs
• Preserve the recorded integrity on serialization to prevent lockfile churn
• Add unit + end-to-end coverage reproducing pnpm/pnpm#13042
Diagram

graph TD
  A[("pnpm-lock.yaml")] --> B["Lockfile loader (serde)"] --> C["GitResolution { repo, commit, integrity?, path? }"] --> D["Installer / Git resolver"] --> E["Lockfile writer"] --> A
  F["E2E + unit tests"] --> B
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Relax `deny_unknown_fields` for `GitResolution`
  • ➕ Automatically tolerates any future/unknown keys on git resolutions
  • ➕ Smallest code change (remove/adjust annotation)
  • ➖ Weakens schema validation for git resolutions (typos silently accepted)
  • ➖ Does not document which extra fields are intentionally supported
2. Capture unknown keys via `#[serde(flatten)] extra: Map`
  • ➕ Preserves arbitrary fields without churn while keeping typed fields explicit
  • ➕ Avoids repeatedly adding one-off optional fields
  • ➖ More complex type shape and serialization behavior
  • ➖ Still dilutes strict validation guarantees unless carefully constrained

Recommendation: Keep the PR’s approach: explicitly add integrity: Option to GitResolution and continue to reject other unknown fields. This fixes real-world lockfiles while preserving the intentional strictness of the lockfile schema; the added tests also lock in the non-goal that git integrity remains non-checkable (commit remains the anchor).

Files changed (10) +99 / -4

Bug fix (2) +15 / -4
resolution.rsAllow optional 'integrity' on 'GitResolution' and clarify integrity semantics +12/-1

Allow optional 'integrity' on 'GitResolution' and clarify integrity semantics

• Adds 'integrity: Option<Integrity>' to 'GitResolution' with serde defaults so lockfiles containing this field parse and re-serialize without churn. Updates 'LockfileResolution::integrity()' docs to explicitly exclude git integrity as non-checkable round-trip data.

pnpm/crates/lockfile/src/resolution.rs

git_resolver.rsInitialize synthesized git resolutions with 'integrity: None' and update comments +3/-3

Initialize synthesized git resolutions with 'integrity: None' and update comments

• Updates the git resolver’s synthesized 'GitResolution' to explicitly set 'integrity: None' and adjusts commentary to emphasize the commit anchors content rather than an integrity hash.

pnpm/crates/resolving-git-resolver/src/git_resolver.rs

Tests (7) +79 / -0
git_hosted_install.rsAdd e2e test for installing from git lockfile entries with integrity +35/-0

Add e2e test for installing from git lockfile entries with integrity

• Introduces an end-to-end regression test that injects an 'integrity' field into a git resolution in the generated lockfile. Verifies frozen installs succeed and that a non-frozen install re-emits the integrity unchanged.

pnpm/crates/cli/tests/suite/git_hosted_install.rs

tests.rsUpdate git resolution test fixtures to include 'integrity: None' +1/-0

Update git resolution test fixtures to include 'integrity: None'

• Adjusts git resolution construction in tests to match the updated 'GitResolution' struct signature with an optional integrity field.

pnpm/crates/deps-restorer/src/build_modules/tests.rs

tests.rsUpdate virtual store git metadata fixture for new integrity field +1/-0

Update virtual store git metadata fixture for new integrity field

• Extends the 'GitResolution' fixture used in virtual store tests to set 'integrity: None', keeping compilation and expectations consistent.

pnpm/crates/deps-restorer/src/create_virtual_store/tests.rs

tests.rsAdd unit tests for git resolution integrity serde round-trip +38/-0

Add unit tests for git resolution integrity serde round-trip

• Updates existing git resolution serde tests for the new optional field and adds new tests for deserializing and serializing git resolutions that include integrity. Asserts 'LockfileResolution::integrity()' still returns 'None' for git resolutions.

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

tests.rsRefresh package-manager lockfile graph fixtures for new git integrity field +1/-0

Refresh package-manager lockfile graph fixtures for new git integrity field

• Updates git resolution instances in dependency graph to lockfile tests to include 'integrity: None' for the expanded struct.

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

tests.rsUpdate patch-related resolution kind tests for expanded git resolution struct +1/-0

Update patch-related resolution kind tests for expanded git resolution struct

• Adds 'integrity: None' to the git resolution used in resolution-kind tests, ensuring consistency with the updated 'GitResolution' model.

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

tests.rsUpdate lockfile reuse test fixtures for new git integrity field +2/-0

Update lockfile reuse test fixtures for new git integrity field

• Extends git resolution instances used in lockfile reuse tests to include 'integrity: None', preserving compilation and test intent.

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

Documentation (1) +5 / -0
git-resolution-integrity-parses.mdAdd changeset entry for git-resolution integrity compatibility fix +5/-0

Add changeset entry for git-resolution integrity compatibility fix

• Documents that lockfiles with 'resolution: {type: git, ..., integrity}' no longer fail to load and that the field is preserved on write. Links the fix to pnpm/pnpm#13042.

.changeset/git-resolution-integrity-parses.md

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 9, 2026
@greptile-apps

greptile-apps Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Reviews (8): Last reviewed commit: "test(sbom): assert the component exists ..." | Re-trigger Greptile

@qodo-code-review

qodo-code-review Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. SBOM drops binary checksums ✓ Resolved 🐞 Bug ⛨ Security
Description
collectComponents() now sets integrity to undefined for any resolution object containing a
type field, which unintentionally includes type: 'binary' resolutions whose integrity is
actively used to verify downloaded runtime archives. This removes a real, verified checksum from
SBOM output and degrades supply-chain/compliance value.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R242-244]

+      const integrity = 'type' in pkgSnapshot.resolution
+        ? undefined
+        : (pkgSnapshot.resolution as TarballResolution).integrity
Relevance

●●● Strong

Integrity regressions are treated seriously; dropping verified integrity is likely fixed quickly.

PR-#13728

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new SBOM logic suppresses integrity whenever type exists on the resolution object. But
BinaryResolution is a typed resolution that includes a required integrity and pnpm uses it for
actual on-download verification, so suppressing it is a security/compliance regression in SBOM
output.

pnpm11/deps/compliance/sbom/src/collectComponents.ts[236-244]
pnpm11/resolving/resolver-base/src/index.ts[32-38]
pnpm11/fetching/binary-fetcher/src/index.ts[60-66]
pnpm11/fetching/binary-fetcher/src/index.ts[161-169]

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()` suppresses `integrity` for all typed resolutions via `'type' in pkgSnapshot.resolution`, which drops checksums for `type: 'binary'` packages even though pnpm verifies binary downloads against that integrity.

## Issue Context
Binary resolutions have a required `integrity` field and pnpm enforces it during fetching (so SBOM should keep publishing it). The intent of this PR appears to be *only* suppressing unverified `integrity` recorded on `type: git` resolutions.

## Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[236-244]

### Suggested direction
Compute `integrity` based on the *kind* of resolution, e.g.:
- If resolution is an untyped tarball/registry resolution, publish `integrity`.
- If `resolution.type === 'git'`, publish no integrity.
- If `resolution.type === 'binary'`, publish `resolution.integrity`.
(Optionally add/adjust a regression test to ensure binary integrity still appears.)

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



Remediation recommended

2. Duplicated verifiedIntegrity call comment ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The inline comment above the verifiedIntegrity(...) call substantially restates what is already
documented in the function’s JSDoc. This increases maintenance burden because future updates must
keep both the JSDoc and the call-site comment in sync.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R246-253]

+      // A component checksum is published only when pnpm checks the
+      // downloaded bytes against it: the tarball/registry hash, and a
+      // `type: binary` runtime archive's. A typed resolution that merely
+      // carries an `integrity` — a `type: git` entry some other tool
+      // stamped one onto — was never checked against it, and an SBOM
+      // checksum reads as an assurance. Mirrors `integrity_string` in the
+      // Rust CLI's `sbom.rs`.
+      const integrity = verifiedIntegrity(pkgSnapshot.resolution)
Relevance

●●● Strong

Team has accepted removing redundant/duplicated comments to avoid drift and maintenance burden.

PR-#13468
PR-#13727

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule forbids call-site comments that restate a function’s purpose/contract when that information
already exists in the function’s JSDoc. The comment at the call site repeats the same
integrity-publication rationale already captured in verifiedIntegrity’s JSDoc.

Rule 713431: Avoid duplicating JSDoc content in call-site comments
pnpm11/deps/compliance/sbom/src/collectComponents.ts[194-202]
pnpm11/deps/compliance/sbom/src/collectComponents.ts[246-253]

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

## Issue description
A call-site comment repeats the callee’s JSDoc content instead of adding call-specific context.

## Issue Context
`verifiedIntegrity()` has JSDoc describing the integrity-filtering contract, but `walkStep()` also contains a long comment explaining the same rationale immediately above the call.

## Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[194-202]
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[246-253]

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


3. Binary integrity type unchecked ✓ Resolved 🐞 Bug ⛨ Security ⭐ New
Description
verifiedIntegrity() returns resolution.integrity for type: 'binary' without runtime type
validation, so a malformed/programmatically-constructed lockfile can propagate a non-string value
into SBOM serialization and trigger a runtime exception in ssri.parse.
This can make pnpm sbom fail (input-triggered DoS) instead of cleanly omitting or rejecting the
invalid checksum.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R199-202]

+function verifiedIntegrity (resolution: LockfileResolution): string | undefined {
+  if (!('type' in resolution)) return (resolution as TarballResolution).integrity
+  return resolution.type === 'binary' ? resolution.integrity : undefined
+}
Relevance

●●● Strong

Repo often accepts defensive runtime-hardening/DoS-prevention checks on untrusted lockfile inputs.

PR-#12467
PR-#13728

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new verifiedIntegrity() implementation now forwards resolution.integrity for `type:
'binary' directly into the SBOM component. SBOM serialization converts comp.integrity` into hashes
via integrityToHashes(), which calls ssri.parse(integrity) without guarding non-string values,
so a non-string integrity can crash SBOM generation.

pnpm11/deps/compliance/sbom/src/collectComponents.ts[194-202]
pnpm11/deps/compliance/sbom/src/serializeCycloneDx.ts[68-82]
pnpm11/deps/compliance/sbom/src/serializeSpdx.ts[97-107]
pnpm11/deps/compliance/sbom/src/integrity.ts[12-16]

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

### Issue description
`verifiedIntegrity()` returns `resolution.integrity` for `type: 'binary'` without checking that it is a string at runtime. Because lockfiles are loaded from YAML (untyped at runtime) and/or this code can be called with a programmatically constructed `lockfile` object, `integrity` can be a non-string truthy value. Downstream SBOM serializers pass `comp.integrity` to `integrityToHashes()`, which calls `ssri.parse(...)` without a type guard, so `pnpm sbom` can crash.

### Issue Context
This PR intentionally starts publishing checksums for `type: binary` runtime archives. That makes `verifiedIntegrity()` a new boundary where untrusted/malformed values can reach the checksum parsing path.

### Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[199-202]
- pnpm11/deps/compliance/sbom/src/integrity.ts[12-16]

### Suggested fix
- In `verifiedIntegrity()`, only return integrity values when `typeof integrity === 'string' && integrity.length > 0`.
 - For the binary branch: `return resolution.type === 'binary' && typeof (resolution as any).integrity === 'string' ? (resolution as any).integrity : undefined`.
 - For the untyped/tarball branch: similarly ensure `(resolution as any).integrity` is a string before returning.
- Optionally harden `integrityToHashes()` to fail closed without throwing when `integrity` is not a string (e.g., `if (typeof integrity !== 'string' || integrity.length === 0) return []`).
- Add/extend a unit test that supplies a `type: 'binary'` resolution with a non-string `integrity` (e.g. `integrity: true as any`) and asserts `collectSbomComponents()`/serialization does not throw and does not publish hashes.

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


4. verifiedIntegrity declared before use ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
verifiedIntegrity() is declared before its first call in the same file, violating the required
declaration-after-first-usage ordering. This makes the file harder to read in the mandated style and
breaks the project’s declared convention.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R199-202]

+function verifiedIntegrity (resolution: LockfileResolution): string | undefined {
+  if (!('type' in resolution)) return (resolution as TarballResolution).integrity
+  return resolution.type === 'binary' ? resolution.integrity : undefined
+}
Relevance

●● Moderate

Mixed precedent: ordering rule sometimes enforced, sometimes declined in favor of other refactors.

PR-#13398
PR-#13528

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule requires top-level TypeScript function declarations to appear after at least one call site
in the same file. Here, the declaration appears at line 199, while the first call occurs later at
line 253.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/deps/compliance/sbom/src/collectComponents.ts[199-202]
pnpm11/deps/compliance/sbom/src/collectComponents.ts[246-253]

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

## Issue description
`verifiedIntegrity()` is declared before its first usage, but the codebase rule requires top-level function declarations to appear only after their first use.

## Issue Context
This is a top-level `function verifiedIntegrity(...) { ... }` that is called later from `walkStep()`.

## Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[199-203]
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[246-254]

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


View review recommended (3)
5. SBOM TypeError on primitives ✓ Resolved 🐞 Bug ☼ Reliability
Description
The new 'type' in pkgSnapshot.resolution check will throw a TypeError if a malformed lockfile
provides a non-object resolution (e.g. string/number), turning pnpm sbom into a crash path
instead of producing a controlled broken-lockfile error. This is a robustness regression versus
simple property access and is reachable because lockfiles are loaded from untyped YAML.
Code

pnpm11/deps/compliance/sbom/src/collectComponents.ts[R242-244]

+      const integrity = 'type' in pkgSnapshot.resolution
+        ? undefined
+        : (pkgSnapshot.resolution as TarballResolution).integrity
Relevance

●●● Strong

Simple guard avoids crash on malformed YAML; team often accepts robustness hardening.

PR-#12467

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
js-yaml parsing is untyped and the current loader casts the result, so malformed YAML can yield
non-object values in nested fields. The in operator requires an object RHS and will throw on
primitives, making SBOM generation fragile against malformed lockfiles.

pnpm11/deps/compliance/sbom/src/collectComponents.ts[236-244]
pnpm11/lockfile/fs/src/read.ts[135-145]
pnpm11/lockfile/utils/src/pkgSnapshotToResolution.ts[22-39]

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 expression `'type' in pkgSnapshot.resolution` can throw when `pkgSnapshot.resolution` is not an object (e.g. string/number/null) which can happen with malformed/untyped YAML lockfiles. This causes `pnpm sbom` to crash with a raw `TypeError`.

## Issue Context
Lockfiles are parsed via `js-yaml` without schema validation; malformed nested fields can reach downstream code paths.

## Fix Focus Areas
- pnpm11/deps/compliance/sbom/src/collectComponents.ts[242-244]

### Suggested direction
Replace the `in` usage with a safe guard, e.g.:
```ts
const res = pkgSnapshot.resolution as unknown
const isObject = res != null && typeof res === 'object'
const integrity = (isObject && 'type' in res)
 ? undefined
 : (res as TarballResolution | { integrity?: string }).integrity
```
Or compute `resolution = pkgSnapshotToResolution(...)` first and branch on `resolution.type` in a type-safe way.

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


6. Test debug output 🐞 Bug ⚙ Maintainability
Description
New git-integrity tests emit dbg!/eprintln! unconditionally, adding noise to CI logs and making
real failures harder to spot.
Code

pnpm/crates/lockfile/src/resolution/tests.rs[409]

+    dbg!(&received);
Relevance

●●● Strong

Precedent: unconditional dbg!/noise in tests was removed in review; prefer silence on success.

PR-#13329

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added unit test uses dbg!(&received) and the new serialize test prints with eprintln!, both
of which run even on success.

pnpm/crates/lockfile/src/resolution/tests.rs[400-460]

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

### Issue description
New tests added for git-resolution integrity print debug output unconditionally (`dbg!`, `eprintln!`). This clutters CI output and reduces signal-to-noise.

### Issue Context
These prints are not required because the tests already assert exact values.

### Fix Focus Areas
- pnpm/crates/lockfile/src/resolution/tests.rs[400-460]

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


7. Git integrity parsed, not preserved ✓ Resolved 📘 Rule violation ≡ Correctness
Description
GitResolution.integrity is typed as Option<Integrity>, which forces parsing/validation and can
reject lockfiles that pnpm TypeScript would still load and preserve. This risks a new Rust-only
incompatibility for malformed-but-previously-tolerated integrity strings, despite the PR
describing the field as round-trip baggage.
Code

pnpm/crates/lockfile/src/resolution.rs[R67-75]

+    /// Hash recorded on the entry by whatever wrote it. pnpm's built-in
+    /// git fetcher computes none, but a custom fetcher's is written
+    /// through to the resolution, and lockfiles in the wild carry one.
+    /// Neither stack checks a git checkout against it — the `commit`
+    /// pins the content, and the store key is git-hosted rather than
+    /// integrity-addressed — so pacquet keeps it only to hand it back
+    /// unchanged on the next write.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub integrity: Option<Integrity>,
Relevance

●● Moderate

Parity concern is plausible, but no clear precedent about validating vs preserving malformed git
integrity.

PR-#13432

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Rust lockfile schema change introduces pub integrity: Option<Integrity> on GitResolution,
meaning serde deserialization will attempt to parse/validate the lockfile’s integrity string.
pnpm’s TypeScript lockfile reader uses js-yaml without schema validation, and the TS
GitRepositoryResolution type does not include an integrity field, indicating pnpm does not treat
git integrity as a validated contract in this shape.

Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/lockfile/src/resolution.rs[67-75]
pnpm11/lockfile/fs/src/read.ts[13-16]
pnpm11/lockfile/types/src/index.ts[117-125]

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

## Issue description
`GitResolution.integrity` is currently `Option<Integrity>`, which requires successfully parsing the field and may cause pacquet to reject lockfiles that pnpm TypeScript would accept (since TS lockfile reading is untyped YAML and git `integrity` is not a typed/validated part of the git resolution contract).

## Issue Context
The PR description states the git `integrity` value is not used for verification and is kept only for round-trip stability. Treating it as an SSRI-parsed `Integrity` makes this field a new validation surface and can introduce a Rust-only "broken lockfile" failure mode for malformed values.

## Fix Focus Areas
- pnpm/crates/lockfile/src/resolution.rs[67-75]
- pnpm/crates/lockfile/src/resolution/tests.rs[400-418]
- pnpm/crates/cli/tests/suite/git_hosted_install.rs[142-166]

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



Informational

8. Ambiguous integrity semantics ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
The new test doc comment says pnpm “hands it back untouched” but doesn’t explicitly say the git
integrity value is preserved only for round-tripping and is not verified. This can mislead future
maintainers into treating the recorded hash as a security check when it is not used that way.
Code

pnpm/crates/cli/tests/suite/git_hosted_install.rs[R136-138]

+/// pnpm's own git fetcher computes no integrity, yet lockfiles in the
+/// wild record one, and pnpm hands it back untouched.
+/// See <https://github.com/pnpm/pnpm/issues/13042>.
Relevance

●●● Strong

Team has accepted clarifying comments to avoid overstating/ambiguating integrity guarantees; likely
to accept this doc-comment tweak.

PR-#13652
PR-#13439
PR-#13734

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added comment does not state the integrity is non-verifying, while the lockfile model explicitly
documents that git integrity is not checked and is retained only to write it back unchanged.

pnpm/crates/cli/tests/suite/git_hosted_install.rs[136-138]
pnpm/crates/lockfile/src/resolution.rs[67-73]

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 doc comment above `install_from_a_git_repo_whose_lockfile_records_an_integrity` doesn’t explicitly state that the `integrity` field on git resolutions is *not* used for verification, only preserved for compatibility/round-tripping.

### Issue Context
Elsewhere the implementation documents that git integrity is “round-trip baggage” and is not checked against the checkout; aligning the test’s comment with that reduces the risk of misinterpretation.

### Fix Focus Areas
- pnpm/crates/cli/tests/suite/git_hosted_install.rs[136-138]

### Suggested wording
Replace the comment with something like:

```rust
/// pnpm's own git fetcher computes no integrity, yet lockfiles in the
/// wild may record one. pnpm preserves it as opaque round-trip data
/// (it is not verified against the checkout).
/// See <https://github.com/pnpm/pnpm/issues/13042>.
```

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


9. Fragile lockfile text edit ✓ Resolved 🐞 Bug ☼ Reliability
Description
The new e2e test injects integrity by string-replacing ", repo: ", which is coupled to the
current YAML flow-map formatting/key order and can fail if serialization formatting changes before
the behavior under test is exercised.
Code

pnpm/crates/cli/tests/suite/git_hosted_install.rs[R152-155]

+    let written = fs::read_to_string(&lockfile_path).expect("read lockfile");
+    let with_integrity = written.replace(", repo: ", &format!(", integrity: {INTEGRITY}, repo: "));
+    assert_ne!(with_integrity, written, "the git resolution must have a `repo` key to edit");
+    fs::write(&lockfile_path, &with_integrity).expect("write lockfile");
Relevance

●●● Strong

Precedent: brittle lockfile string replacement in tests was refactored to structured parsing.

PR-#13152
PR-#13563

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test performs a raw string replacement keyed on the current rendered substring. The lockfile
resolution rendering tests show the exact flow-map formatting the e2e replacement depends on
(comma+space separators and key ordering).

pnpm/crates/cli/tests/suite/git_hosted_install.rs[141-166]
pnpm/crates/lockfile/src/resolution/tests.rs[421-460]

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 e2e test mutates `pnpm-lock.yaml` via a formatting-dependent `String::replace` on `", repo: "`. If the lockfile emitter changes formatting (block mapping vs flow mapping, spacing, key order), the test can fail for reasons unrelated to parsing `integrity`.

### Issue Context
This is test-only, but it can create CI brittleness.

### Fix Focus Areas
- pnpm/crates/cli/tests/suite/git_hosted_install.rs[151-156]
- pnpm/crates/lockfile/src/resolution/tests.rs[421-460]

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


10. Missing Rust test for sbom 📘 Rule violation ▣ Testability
Description
A new TypeScript test asserts that SBOM generation must not publish integrity recorded on a `type:
git` resolution, but there is no mirrored Rust CLI test covering the same contract. This violates
the cross-stack parity requirement for behavior that exists in both implementations and risks silent
divergence over time.
Code

pnpm11/deps/compliance/sbom/test/collectComponents.test.ts[R75-78]

+  it('should not publish an integrity recorded on a git resolution', async () => {
+    const lockfile = {
+      lockfileVersion: '9.1',
+      importers: {
Relevance

● Weak

Team has rejected cross-stack drift/parity tests before; likely won’t add mirrored Rust SBOM test.

PR-#13727

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR adds a TS unit test asserting SBOM output must omit integrity for git resolutions. The Rust
CLI’s integrity_string helper only returns integrity for registry and tarball resolutions,
implying the same contract exists on the Rust side, but the Rust SBOM test suite shown contains no
corresponding test for git-resolution integrity omission.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm11/deps/compliance/sbom/test/collectComponents.test.ts[68-110]
pnpm/crates/cli/src/cli_args/sbom.rs[253-258]
pnpm/crates/cli/tests/suite/sbom.rs[1-120]

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

## Issue description
A new TS test covers the SBOM contract: do not publish an `integrity` value recorded on a `type: git` lockfile resolution as a checksum. The Rust CLI already implements similar behavior (only emits integrity for registry/tarball resolutions), but there is no Rust test asserting this specific scenario.

## Issue Context
Rule 2255044 requires mirrored tests across Rust and TypeScript for cross-stack user-visible behavior. Without a Rust-side test, future changes to Rust SBOM generation could regress and drift from pnpm TS.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/sbom.rs[1-120]
- pnpm/crates/cli/src/cli_args/sbom.rs[253-258]
- pnpm11/deps/compliance/sbom/test/collectComponents.test.ts[68-110]

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


View optional (1)
11. Changeset missing pnpm bump ✓ Resolved 📘 Rule violation § Compliance
Description
The new changeset only declares a pacquet bump, but the compliance rule requires explicitly
declaring the pnpm package with a valid bump type. This may block automated release tooling
expectations tied to the pnpm package entry.
Code

.changeset/git-resolution-integrity-parses.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

● Weak

Close precedent: “add pnpm bump” for pacquet-only changesets was rejected.

PR-#12981
PR-#13347

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The compliance checklist requires that changeset files explicitly include an entry for the pnpm
package with a valid bump type. The added changeset front-matter only includes "pacquet": patch
and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/git-resolution-integrity-parses.md[1-3]

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 added changeset does not include a `pnpm` package entry, which violates the changeset policy in the compliance checklist.

## Issue Context
Even if the functional change is primarily in pacquet/Rust, the compliance rule requires that changeset front-matter explicitly declares `pnpm` with a correct bump type.

## Fix Focus Areas
- .changeset/git-resolution-integrity-parses.md[1-3]

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


Grey Divider

Context used
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.8±0.37ms    31.7 MB/sec    1.20     14.2±2.21ms    26.3 MB/sec
packument/parse                                  1.00     41.1±1.09µs  1613.1 MB/sec    1.29    53.0±12.19µs  1252.1 MB/sec
tarball/download_dependency                      1.00      3.3±0.28ms  1321.5 KB/sec    1.68      5.5±0.80ms   788.6 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   187.6±25.28ms 85.3 KElem/sec    1.49   279.5±15.12ms 57.2 KElem/sec
workspace_resolution/hoist_heavy                 1.00    255.8±7.92ms        ? ?/sec    1.09   277.6±10.93ms        ? ?/sec

Copilot AI review requested due to automatic review settings August 9, 2026 23: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 Aug 9, 2026

Copy link
Copy Markdown
Member Author

Notes on the automated findings, so a human reviewer doesn't have to re-derive them:

1. Test debug output (dbg! / eprintln!) — keeping. It is the house style, not stray debugging: pnpm/CODE_STYLE_GUIDE.md asks for dbg! on complex structures and a log line before the comparison, and every neighbouring test in resolution/tests.rs does exactly this. Output is captured unless the test fails.

2. Option<Integrity> rejects a malformed integrity that the TypeScript CLI would tolerate — real, but deliberate and not a regression. Before this PR any integrity on a git resolution failed to parse; after it, only an unparseable one does. Every sibling shape (TarballResolution, RegistryResolution, BinaryResolution) already types the field as Integrity, so a garbage hash anywhere else in the lockfile is a hard parse error today. Typing this one as a bare String to be maximally tolerant would make the git resolution the only shape that silently carries an unparseable hash, and ssri is lenient anyway — it accepts anything of the form <algo>-<payload>, including the empty string (see empty_integrity_string_is_not_checkable). Rejecting the truly malformed rest matches the module's stated stance that a broken built-in resolution should fail loudly rather than be reinterpreted.

3. Fragile lockfile text edit in the e2e test — intentional, and it fails loudly rather than silently. Editing the file as text is the point: it simulates a lockfile written by something other than this engine, which is what the reported bug was about. Rebuilding the entry through this crate's own serializer would make the test circular (serialization is already covered by serialize_git_resolution_with_integrity). The assert_ne! guard immediately above the write means a formatting change surfaces as "the git resolution must have a repo key to edit", not as a silently-skipped assertion.

4. Changeset missing a pnpm bump — declining per repo policy. AGENTS.md ("Changesets for the Rust products"): in changesets pnpm always means the TypeScript CLI package, and a Rust-only change must target pacquet and omit "pnpm". This PR touches no TypeScript code. The bot flags its own precedent for this as previously rejected.

The failing Rust CI / Test jobs are unrelated to this change: they die in the shared registry-fixture setup (pnpr/crates/pnpr-fixtures/src/lib.rs:99, publish generated registry fixture storage: Directory not empty) before reaching anything this PR touches, and the same failure hits unrelated PRs on the same runners.


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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan

zkochan commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

The red Rust CI / Test jobs here are not from this PR: they die in the shared registry-fixture setup (pnpr/crates/pnpr-fixtures/src/lib.rs:99, publish generated registry fixture storage: Directory not empty) before any test in this diff runs, on all three platforms, and the same failure hits #13743. The cause is a fixture-storage tree restored from the CI build cache without its .complete marker — unusable, unrepairable, and fatal to every test process that touches it.

Fix is up as #13749. Once that lands this branch should go green on a re-run; nothing here needs to change for it.


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

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 69dfd275aa04

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. 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.699 ± 0.205 2.485 3.075 1.70 ± 0.18
pacquet@main 2.686 ± 0.107 2.468 2.844 1.69 ± 0.15
pnpr@HEAD 1.591 ± 0.122 1.451 1.854 1.00
pnpr@main 1.673 ± 0.132 1.473 1.866 1.05 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6994973247400003,
      "stddev": 0.2053169282708243,
      "median": 2.6368017963400003,
      "user": 2.69416298,
      "system": 2.0302834999999995,
      "min": 2.4852323813400004,
      "max": 3.07459205034,
      "times": [
        2.69753938934,
        3.07459205034,
        2.91900890634,
        2.60305180934,
        2.67055178334,
        2.5091304463400004,
        2.4852323813400004,
        2.58079219834,
        2.5243645763400004,
        2.9307097063400005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6861371083400005,
      "stddev": 0.10724432931359337,
      "median": 2.68742451584,
      "user": 2.53434638,
      "system": 1.9325468999999997,
      "min": 2.4681223623400004,
      "max": 2.8441736533400004,
      "times": [
        2.7615018593400005,
        2.7599923063400005,
        2.6919122043400003,
        2.65333964034,
        2.8441736533400004,
        2.65372161334,
        2.6829368273400003,
        2.4681223623400004,
        2.76596906434,
        2.57970155234
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5907620020400004,
      "stddev": 0.12186646643980731,
      "median": 1.5877225778400001,
      "user": 1.70225488,
      "system": 1.5583319,
      "min": 1.45125434734,
      "max": 1.85377461934,
      "times": [
        1.45125434734,
        1.57931162934,
        1.62035163334,
        1.51146115534,
        1.71661308234,
        1.59782035434,
        1.46140343034,
        1.51949624234,
        1.85377461934,
        1.59613352634
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6732243456400002,
      "stddev": 0.13214404706881205,
      "median": 1.66643350184,
      "user": 1.8021770799999999,
      "system": 1.6082440999999998,
      "min": 1.4728009953399999,
      "max": 1.86627039434,
      "times": [
        1.86627039434,
        1.74012844934,
        1.61975200634,
        1.61400424434,
        1.48476037634,
        1.4728009953399999,
        1.8129868153400002,
        1.68069529734,
        1.65217170634,
        1.78867317134
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 335.2 ± 15.1 311.6 361.9 1.00
pacquet@main 345.3 ± 18.2 313.6 377.5 1.03 ± 0.07
pnpr@HEAD 389.2 ± 17.5 363.0 417.6 1.16 ± 0.07
pnpr@main 371.9 ± 17.4 352.9 406.0 1.11 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.33523634476,
      "stddev": 0.01511246136521924,
      "median": 0.33235844066000003,
      "user": 0.30023834,
      "system": 0.6522349999999999,
      "min": 0.31160332466,
      "max": 0.36189597666,
      "times": [
        0.36189597666,
        0.32265990766,
        0.33311645566000003,
        0.32459845866000003,
        0.35515297366000004,
        0.33580947466,
        0.34449412166000004,
        0.33160042566000003,
        0.33143232866,
        0.31160332466
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.34531904966,
      "stddev": 0.018201013355999288,
      "median": 0.34324814866,
      "user": 0.31733903999999996,
      "system": 0.6542342,
      "min": 0.31355978766000003,
      "max": 0.37751254566000003,
      "times": [
        0.35263356166000004,
        0.32820347066,
        0.31355978766000003,
        0.34713421066,
        0.35933732466,
        0.33632841466,
        0.33936208666,
        0.33865341266,
        0.36046568166000004,
        0.37751254566000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38916151666000004,
      "stddev": 0.01745391788266312,
      "median": 0.38234567716,
      "user": 0.32486194,
      "system": 0.7093159,
      "min": 0.36295695366,
      "max": 0.41764192966,
      "times": [
        0.40914235666000004,
        0.38494545366,
        0.37785613366000004,
        0.41764192966,
        0.40314088166,
        0.37974590066,
        0.37887419866,
        0.37623186666,
        0.36295695366,
        0.40107949166
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.37194355465999995,
      "stddev": 0.01743101789100083,
      "median": 0.37081617866,
      "user": 0.31431254,
      "system": 0.6995247,
      "min": 0.35289786466,
      "max": 0.40602988066,
      "times": [
        0.37611617666,
        0.39484343866,
        0.35323157366,
        0.37056822466,
        0.40602988066,
        0.37106413266,
        0.36383710566,
        0.37449534766000003,
        0.35635180166,
        0.35289786466
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.912 ± 0.073 2.777 3.003 1.69 ± 0.16
pacquet@main 2.974 ± 0.081 2.917 3.176 1.73 ± 0.16
pnpr@HEAD 1.788 ± 0.163 1.610 2.046 1.04 ± 0.13
pnpr@main 1.724 ± 0.158 1.533 1.952 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.91196206412,
      "stddev": 0.07260328838098054,
      "median": 2.92440015022,
      "user": 2.7604664199999998,
      "system": 2.0956315800000005,
      "min": 2.77732835522,
      "max": 3.0025944442199997,
      "times": [
        2.94200148322,
        2.95472847522,
        2.82403777022,
        2.89163558722,
        2.77732835522,
        2.86898854522,
        2.9654241132199997,
        2.90679881722,
        2.98608305022,
        3.0025944442199997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.9740936533199998,
      "stddev": 0.08055009929762541,
      "median": 2.9492931367199997,
      "user": 2.8372751199999993,
      "system": 2.18641638,
      "min": 2.91721375622,
      "max": 3.17560321722,
      "times": [
        3.04558438822,
        2.9174599892199997,
        2.92814554822,
        3.17560321722,
        2.95954095522,
        2.91721375622,
        2.96393193822,
        2.92338803022,
        2.93904531822,
        2.97102339222
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.78834734512,
      "stddev": 0.16296487025063072,
      "median": 1.78159876972,
      "user": 1.9365432199999997,
      "system": 1.8368758800000002,
      "min": 1.6100103812200002,
      "max": 2.0464672302199998,
      "times": [
        1.80188204122,
        1.8897085522200001,
        1.6102046782200001,
        1.6718661752200001,
        1.6220097962200002,
        1.76131549822,
        1.8531129572200002,
        2.0464672302199998,
        2.0168961412199997,
        1.6100103812200002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7239230064200002,
      "stddev": 0.15776342352040554,
      "median": 1.68955225722,
      "user": 1.7865578199999999,
      "system": 1.65982898,
      "min": 1.53313790522,
      "max": 1.9523848482200001,
      "times": [
        1.63537236422,
        1.58238426222,
        1.53313790522,
        1.59953305922,
        1.9523848482200001,
        1.5890340182200002,
        1.94675363922,
        1.74373215022,
        1.7970613302200003,
        1.8598364872200002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 559.9 ± 36.7 489.4 602.8 1.34 ± 0.12
pacquet@main 581.0 ± 45.8 510.0 645.1 1.39 ± 0.14
pnpr@HEAD 417.9 ± 23.8 382.1 457.4 1.00 ± 0.08
pnpr@main 417.2 ± 25.5 380.9 451.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.55990086886,
      "stddev": 0.03668468753576863,
      "median": 0.57044725846,
      "user": 0.7967278199999999,
      "system": 0.90624752,
      "min": 0.48935004496,
      "max": 0.60280532296,
      "times": [
        0.58729141496,
        0.56635639796,
        0.56282794496,
        0.60280532296,
        0.57752733296,
        0.54765726496,
        0.48935004496,
        0.50413528596,
        0.58651955996,
        0.57453811896
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.58104548186,
      "stddev": 0.045842777886634586,
      "median": 0.57705101096,
      "user": 0.8017719199999999,
      "system": 0.97003572,
      "min": 0.50999340196,
      "max": 0.64514261096,
      "times": [
        0.55530466296,
        0.50999340196,
        0.53039786496,
        0.57352565996,
        0.58636231296,
        0.63421795996,
        0.63669549396,
        0.5805763619600001,
        0.64514261096,
        0.5582384889600001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.41785856136,
      "stddev": 0.02383527986067193,
      "median": 0.41646494495999997,
      "user": 0.31162631999999996,
      "system": 0.70511532,
      "min": 0.38209489296,
      "max": 0.45736935996,
      "times": [
        0.45736935996,
        0.43690329996,
        0.41826234796,
        0.41466754196,
        0.44716341296,
        0.40621627396,
        0.42177568796,
        0.39348833896,
        0.40064445696,
        0.38209489296
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.41716629456,
      "stddev": 0.025532532863092847,
      "median": 0.41424619346,
      "user": 0.32503832000000005,
      "system": 0.6805472199999998,
      "min": 0.38085321196,
      "max": 0.45144537896,
      "times": [
        0.41797637396,
        0.45144537896,
        0.39376104596,
        0.39910612596,
        0.41051601296,
        0.38085321196,
        0.44614373496,
        0.44280923296,
        0.39280676196,
        0.43624506596
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.966 ± 0.037 1.904 2.026 5.50 ± 0.24
pacquet@main 1.914 ± 0.033 1.844 1.949 5.35 ± 0.23
pnpr@HEAD 0.370 ± 0.016 0.337 0.391 1.03 ± 0.06
pnpr@main 0.358 ± 0.014 0.331 0.378 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9663413935,
      "stddev": 0.03738131206064696,
      "median": 1.9588390810000003,
      "user": 1.3267803399999998,
      "system": 1.17151286,
      "min": 1.9036261875,
      "max": 2.0257405635,
      "times": [
        1.9594582365000002,
        1.9436348745,
        1.9900285215000002,
        1.9582199255000001,
        2.0257405635,
        1.9988236235,
        2.0039746605,
        1.9344391455,
        1.9036261875,
        1.9454681965000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.9141078929000002,
      "stddev": 0.03257443726999684,
      "median": 1.9152497090000002,
      "user": 1.2338443399999999,
      "system": 1.1104298599999995,
      "min": 1.8444862835000002,
      "max": 1.9487696315000003,
      "times": [
        1.8932061615000002,
        1.9431393855,
        1.9017170605000002,
        1.9472168585,
        1.8995287155000002,
        1.9487696315000003,
        1.9287823575000003,
        1.9333304625,
        1.9009020125,
        1.8444862835000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3701203064000001,
      "stddev": 0.01643778126996067,
      "median": 0.3773254125,
      "user": 0.27865674,
      "system": 0.63885486,
      "min": 0.33695360550000003,
      "max": 0.3913600935,
      "times": [
        0.3913600935,
        0.36550685650000003,
        0.3803246645,
        0.37798732150000003,
        0.38205659550000004,
        0.3766635035,
        0.3553552425,
        0.33695360550000003,
        0.3557440445,
        0.37925113650000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3578129844,
      "stddev": 0.014374237296044564,
      "median": 0.3544416585,
      "user": 0.25449054,
      "system": 0.6184675599999999,
      "min": 0.3307313315,
      "max": 0.37789270550000004,
      "times": [
        0.37789270550000004,
        0.3705617505,
        0.3499300805,
        0.3559678995,
        0.3522561165,
        0.3529154175,
        0.3307313315,
        0.3649572505,
        0.3479976945,
        0.37491959750000003
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 244.9 ± 25.5 212.9 285.7 2.41 ± 0.29
pacquet@main 244.1 ± 27.5 205.1 287.8 2.40 ± 0.31
pnpr@HEAD 101.6 ± 6.3 93.4 119.8 1.00
pnpr@main 102.6 ± 5.7 94.8 119.2 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2448828096090909,
      "stddev": 0.02553362215343425,
      "median": 0.23593855870000002,
      "user": 0.2131703472727273,
      "system": 0.08636969818181817,
      "min": 0.21286756970000004,
      "max": 0.2857374347,
      "times": [
        0.2596153667,
        0.2857374347,
        0.2700070947,
        0.2778857167,
        0.2517138487,
        0.2241519637,
        0.21495845770000002,
        0.21286756970000004,
        0.23339417870000004,
        0.22744071570000002,
        0.23593855870000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24405923645000005,
      "stddev": 0.027457781320282874,
      "median": 0.23823346570000004,
      "user": 0.20361020333333332,
      "system": 0.09029429666666666,
      "min": 0.20512041770000003,
      "max": 0.28776479070000005,
      "times": [
        0.22498057170000002,
        0.2760020957,
        0.21933932070000003,
        0.25043228370000004,
        0.22054842470000002,
        0.22310201870000002,
        0.20512041770000003,
        0.25457548570000005,
        0.2676569017,
        0.2731538787,
        0.22603464770000004,
        0.28776479070000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10162767963103446,
      "stddev": 0.006310992299869455,
      "median": 0.1007256727,
      "user": 0.02872075793103448,
      "system": 0.014964914482758617,
      "min": 0.0933835947,
      "max": 0.1197793407,
      "times": [
        0.0963002397,
        0.09471434170000001,
        0.10376448170000001,
        0.0962675947,
        0.0977967197,
        0.10302597470000001,
        0.09393040970000001,
        0.09920562170000001,
        0.1053814517,
        0.0943542027,
        0.09562117170000001,
        0.1023245817,
        0.1031138937,
        0.09961922770000001,
        0.1007256727,
        0.0933835947,
        0.10633187070000001,
        0.1050206457,
        0.1005516407,
        0.1029169167,
        0.1048898427,
        0.1197793407,
        0.0986960597,
        0.1050374787,
        0.0977050737,
        0.10369075770000001,
        0.1196500917,
        0.1031398337,
        0.10026397670000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10259560212857143,
      "stddev": 0.005738703529410929,
      "median": 0.1025222082,
      "user": 0.027357691428571425,
      "system": 0.01710845142857143,
      "min": 0.0948406927,
      "max": 0.1192024517,
      "times": [
        0.0979255287,
        0.10081614970000001,
        0.0974906947,
        0.1101680827,
        0.1092567417,
        0.1028612247,
        0.1041280327,
        0.10505553270000001,
        0.0993471907,
        0.0993264107,
        0.1192024517,
        0.11107779170000001,
        0.0995039567,
        0.1044141257,
        0.0981564387,
        0.0961100877,
        0.09534118870000001,
        0.10218319170000001,
        0.1060807517,
        0.10532071970000001,
        0.0948406927,
        0.09595590970000001,
        0.09649440270000001,
        0.0978340027,
        0.10574262270000001,
        0.1046321937,
        0.10657663170000001,
        0.1068341107
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.220 ± 0.244 0.851 1.544 1.09 ± 0.36
pacquet@main 1.123 ± 0.299 0.874 1.696 1.00
pnpm@HEAD 4.156 ± 0.347 3.706 4.780 3.70 ± 1.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.21952384958,
      "stddev": 0.24359022733314875,
      "median": 1.25305860958,
      "user": 1.1917603688888887,
      "system": 0.24032329777777775,
      "min": 0.8512071625800001,
      "max": 1.54363336858,
      "times": [
        0.8512071625800001,
        1.1847898805800001,
        1.54363336858,
        0.8881058975800001,
        1.50597665258,
        1.09437003958,
        1.25305860958,
        1.34817037758,
        1.30640265758
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.1227750300244446,
      "stddev": 0.29858099206056726,
      "median": 0.9609329895800001,
      "user": 1.1021538133333333,
      "system": 0.20939407555555556,
      "min": 0.8740756925800001,
      "max": 1.69599487758,
      "times": [
        1.21148440158,
        0.91431313558,
        0.9609329895800001,
        0.93498843758,
        0.95407124858,
        1.5368196205800002,
        0.8740756925800001,
        1.02229486658,
        1.69599487758
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.155501068024445,
      "stddev": 0.3469749337750339,
      "median": 4.07468150858,
      "user": 6.084992924444443,
      "system": 0.4022940755555555,
      "min": 3.70575490258,
      "max": 4.77959569258,
      "times": [
        4.77959569258,
        3.70575490258,
        3.7717675655800003,
        4.07468150858,
        4.32497616358,
        3.99807535458,
        4.13100865758,
        4.06425367158,
        4.54939609558
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.809 ± 0.127 4.699 5.137 1.26 ± 0.05
pacquet@main 4.923 ± 0.212 4.732 5.275 1.29 ± 0.07
pnpr@HEAD 3.809 ± 0.160 3.663 4.143 1.00 ± 0.05
pnpr@main 3.809 ± 0.118 3.686 4.071 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.808887017999999,
      "stddev": 0.12665776028840545,
      "median": 4.7905993382,
      "user": 3.28940986,
      "system": 2.29206228,
      "min": 4.6987996662,
      "max": 5.1368113032,
      "times": [
        4.8420371802,
        4.7987835622,
        4.6987996662,
        4.7559358472,
        4.833872245199999,
        4.8186589581999995,
        4.7157821192,
        4.7057741842,
        5.1368113032,
        4.7824151142
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.9233496699,
      "stddev": 0.21157392531133187,
      "median": 4.8113049682,
      "user": 3.3381989600000006,
      "system": 2.41121198,
      "min": 4.7318545182,
      "max": 5.2750544702,
      "times": [
        4.7670924172,
        4.9761030031999995,
        5.2419487872,
        5.2750544702,
        4.750724154199999,
        4.7902923082,
        4.8323176282,
        4.7318545182,
        5.1040261362,
        4.7640832762
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.8090016751,
      "stddev": 0.15993160780743987,
      "median": 3.7310734517000004,
      "user": 2.28533726,
      "system": 2.0465323800000004,
      "min": 3.6629100742000005,
      "max": 4.1425012952,
      "times": [
        4.1425012952,
        3.8424120352,
        3.7021762362,
        3.9173631912,
        3.7377190192000005,
        3.6629100742000005,
        3.9853180612000005,
        3.7244278842000003,
        3.6707518402000003,
        3.7044371142
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.8086416600000006,
      "stddev": 0.11777363067557901,
      "median": 3.7693218257000005,
      "user": 2.32310746,
      "system": 2.0951109800000003,
      "min": 3.6858531862,
      "max": 4.0712468832,
      "times": [
        4.0712468832,
        3.7395290232000002,
        3.6858531862,
        3.7320073082000005,
        3.9092031682000004,
        3.7165963422000003,
        3.7991146282000003,
        3.8651143232000003,
        3.8432736272000003,
        3.7244781102
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13748
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.peer-heavy-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
851.21 ms
(+23.19%)Baseline: 690.99 ms
829.19 ms
(102.66%)

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,777.33 ms
(+5.84%)Baseline: 2,624.09 ms
3,148.90 ms
(88.20%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,903.63 ms
(+8.92%)Baseline: 1,747.69 ms
2,097.23 ms
(90.77%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
489.35 ms
(+12.62%)Baseline: 434.51 ms
521.41 ms
(93.85%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
212.87 ms
(-1.00%)Baseline: 215.02 ms
258.02 ms
(82.50%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,485.23 ms
(+3.03%)Baseline: 2,412.17 ms
2,894.60 ms
(85.86%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,698.80 ms
(+4.23%)Baseline: 4,508.18 ms
5,409.82 ms
(86.86%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
311.60 ms
(+15.38%)Baseline: 270.06 ms
324.08 ms
(96.15%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
851.21 ms
(+23.19%)Baseline: 690.99 ms
829.19 ms
(102.66%)

🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13748
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,512.12 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
363.38 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
290.33 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
88.49 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,390.29 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,638.12 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.14 ms
🐰 View full continuous benchmarking report in Bencher

`GitResolution` is `deny_unknown_fields` and declared no `integrity`, so a
lockfile entry shaped `{type: git, repo, commit, integrity: sha512-...}`
matched no `ResolutionSerde` variant and aborted the whole install with
ERR_PNPM_BROKEN_LOCKFILE. pnpm's built-in git fetcher computes no integrity,
but a custom fetcher's is written through to the resolution, and the
TypeScript CLI preserves the key across a read to write round trip, so
lockfiles in the wild carry it.

Declare the field so such an entry parses, and re-emit it on write so a
pacquet install doesn't churn the lockfile. `LockfileResolution::integrity()`
still reports `None` for git: the commit pins the content and the store key
is git-hosted rather than integrity-addressed, so nothing verifies a checkout
against the recorded hash.

Closes #13042
The test name, the frozen and re-resolving installs, and the final
assertion already state what the prose repeated.
Copilot AI review requested due to automatic review settings August 10, 2026 08:59

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 90398d2

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@codecov-commenter

codecov-commenter commented Aug 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.12%. Comparing base (9463e98) to head (69dfd27).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13748   +/-   ##
=======================================
  Coverage   88.12%   88.12%           
=======================================
  Files         622      622           
  Lines      101125   101129    +4     
=======================================
+ Hits        89118    89124    +6     
+ Misses      12007    12005    -2     

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

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.

pacquet: lockfile parse fails for git resolution carrying an integrity field (ResolutionSerde)

3 participants