Skip to content

fix(pacquet): align n8n lockfile with pnpm 11 - #13432

Merged
zkochan merged 5 commits into
mainfrom
test-n8n
Jul 27, 2026
Merged

zkochan merged 5 commits into
mainfrom
test-n8n

Conversation

@zkochan

@zkochan zkochan commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Aligns Rust pnpm lockfile generation with pnpm 11 for the n8n workspace validation tracked by #13305.

The Rust implementation now:

  • waits for every shared-subtree owner to publish its initial missing-peer context before optional-peer hoisting;
  • writes singleton libc metadata as a scalar;
  • omits archive integrity for commit-addressed git-hosted dependencies and normalizes recognized integrity-less git archives.

No TypeScript change is needed: pnpm 11 produced the correct reference shapes in all three cases. Fresh back-to-back resolutions of n8n produced byte-identical lockfiles: 77 importers, 3,795 package entries, and 3,884 snapshots.

Related to #13305.

Squash Commit Body

Synchronize every workspace importer through an initial required-peer pass
before optional peers are selected. This ensures a non-owner occurrence of a
shared subtree uses the missing-peer context published by that subtree owner,
rather than selecting a provider from an unrelated importer.

Preserve pnpm lockfile serialization conventions for singleton libc metadata
and commit-addressed git-hosted archives. These corrections make fresh n8n
lockfiles generated by pnpm 11 and Rust pnpm byte-identical.

Related to pnpm/pnpm#13305.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Codex, GPT-5).


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

Summary by CodeRabbit

  • Bug Fixes

    • Git-hosted dependencies addressed by commit no longer receive archive integrity data in lockfiles.
    • Git-hosted archive resolutions are now correctly identified and recorded.
    • Single-value libc metadata is serialized in pnpm-compatible scalar format.
    • Optional peer dependencies are no longer incorrectly selected from unrelated shared dependency contexts.
  • Tests

    • Added coverage for git-hosted lockfile output, scalar libc serialization, and shared peer-resolution scenarios.

Synchronize shared-subtree owner context before optional peer hoisting.

Preserve scalar libc metadata and omit integrity for commit-addressed git archives.

Related to #13305.
Copilot AI review requested due to automatic review settings July 27, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@coderabbitai

coderabbitai Bot commented Jul 27, 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

This PR updates git-hosted tarball metadata, serializes singleton libc values as scalars, and reorganizes workspace peer-resolution rounds to preserve owner context during optional peer hoisting.

Changes

Git-hosted lockfile resolution

Layer / File(s) Summary
Git archive resolution and lockfile normalization
pnpm/crates/resolving-git-resolver/..., pnpm/crates/lockfile/src/resolution*, .changeset/git-hosted-lockfile-resolution.md
Git-hosted tarballs no longer receive archive integrity from the resolver; lockfile conversion records git_hosted: true for recognized integrityless archives. Tests and release metadata cover the behavior.

Libc metadata serialization

Layer / File(s) Summary
Scalar libc metadata output
pnpm/crates/lockfile/src/package_metadata*, .changeset/libc-lockfile-scalar.md
Singleton vector metadata values serialize as scalars, with coverage for libc: glibc output.

Workspace peer resolution

Layer / File(s) Summary
Missing-peer provenance and scope filtering
pnpm/crates/resolving-deps-resolver/src/resolve_peers*
Missing peer issues retain ancestor package chains and can be filtered using HoistMissingScope.
Owner missing-peer initialization barrier
pnpm/crates/resolving-deps-resolver/src/resolve_importer*, pnpm/crates/resolving-deps-resolver/src/resolve_workspace*, .changeset/shared-peer-owner-barrier.md
Workspace resolution prepares and completes initial required rounds before optional hoisting, then processes optional and required rounds in the new order. A shared-subtree regression test verifies unrelated owner peers are not selected.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workspace
  participant ImporterHoistState
  participant PeerResolver
  participant MissingScope
  Workspace->>ImporterHoistState: prepare required round
  ImporterHoistState->>PeerResolver: resolve peer requirements
  PeerResolver->>MissingScope: apply owner scope to missing issues
  Workspace->>ImporterHoistState: complete required rounds
  Workspace->>ImporterHoistState: hoist optional peers across importers
Loading

Possibly related issues

  • pnpm/pnpm#11633 — Covers the lockfile and dependency-resolution parity areas changed here.
  • pnpm/pacquet#488 — Directly concerns git-hosted resolution and lockfile handling.

Possibly related PRs

  • pnpm/pnpm#13343 — Modifies the same peer-hoisting and workspace resolution paths.
  • pnpm/pnpm#13346 — Changes libc lockfile serialization to preserve scalar representation.
  • pnpm/pnpm#13349 — Addresses integrityless git-hosted tarball handling.

Suggested labels: product: pacquet

Suggested reviewers: copilot, yeshyungseok, sensei-woo

✨ 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 test-n8n

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 pacquet lockfile output to match pnpm 11 for n8n (peers, libc, git deps)

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add an owner-context barrier so optional peer hoisting uses the shared-subtree owner’s
 missing-peer sets.
• Match pnpm 11 lockfile serialization: scalar singleton libc and normalized git-hosted tarball
 metadata.
• Add targeted regression tests and changesets documenting the lockfile compatibility fixes.
Diagram

graph TD
A["Workspace resolver"] --> B["Required-peer pass"] --> C{“Init owner context?”} --> D["2nd required pass"] --> E["Optional peer hoist"] --> F["LockfileResolution\nnormalize"] --> G["Lockfile YAML\nserialize"]
C -->|"yes"| E
E --> H["Git resolver\n(read manifest)"] --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Topologically prioritize shared-subtree owners
  • ➕ Avoids an extra required-peer pass for all importers
  • ➕ Makes the ‘owner context first’ invariant explicit in traversal order
  • ➖ Requires reliably identifying shared-subtree owners ahead of time (can be dynamic)
  • ➖ More complex scheduling logic; higher maintenance and risk of edge-case regressions
2. Two-phase global fixpoint (required rounds until stable, then optional)
  • ➕ Generalizes beyond a single ‘initialization’ barrier; robust to complex graphs
  • ➕ Clear separation of concerns: required stability before optional selection
  • ➖ Potentially more rounds than the single extra pass, impacting performance
  • ➖ More invasive behavioral change vs. the minimal targeted barrier in this PR

Recommendation: Keep the PR’s targeted ‘owner missing-set initialization’ barrier: it’s the smallest change that enforces the needed invariant (owner context published before optional hoisting) while staying close to existing behavior. The more global scheduling/fixpoint alternatives could be revisited only if further pnpm 11 parity issues show the single barrier is insufficient.

Files changed (12) +199 / -25

Bug fix (4) +47 / -22
package_metadata.rsSerialize 'libc' as string-or-array to match pnpm +21/-1

Serialize 'libc' as string-or-array to match pnpm

• Extends 'PackageMetadata.libc' serde behavior to serialize singleton vectors as a scalar while still accepting both scalar and list forms on input. Introduces a dedicated 'serialize_string_or_vec' helper for pnpm-compatible YAML output.

pnpm/crates/lockfile/src/package_metadata.rs

resolution.rsNormalize integrity-less git-hosted tarballs and omit integrity when absent +8/-2

Normalize integrity-less git-hosted tarballs and omit integrity when absent

• Adjusts lockfile-form conversion to mark recognized git-hosted tarball URLs as 'git_hosted: true' even when integrity is missing. Ensures the conversion doesn’t assume integrity presence before applying git-hosted normalization.

pnpm/crates/lockfile/src/resolution.rs

resolve_workspace.rsAdd owner-context barrier before optional peer hoisting +12/-0

Add owner-context barrier before optional peer hoisting

• Introduces a one-time extra required round across all importer states before the first optional-hoisting round. This ensures shared-subtree owners publish their missing-peer sets before non-owners filter/hoist optional peers.

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

git_resolver.rsStop injecting integrity for git-hosted archives during resolution +6/-19

Stop injecting integrity for git-hosted archives during resolution

• Updates documentation and behavior so git resolution reads only the manifest from the package.json and no longer populates tarball integrity for host archives during resolution.

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

Tests (4) +135 / -0
tests.rsTest singleton 'libc' scalar emission +9/-0

Test singleton 'libc' scalar emission

• Adds a regression test asserting that 'libc: [glibc]' round-trips and serializes back to 'libc: glibc' in YAML.

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

tests.rsTest git_hosted flag for integrity-less archives +15/-0

Test git_hosted flag for integrity-less archives

• Adds a test verifying 'to_lockfile_form' records 'git_hosted: true' for a codeload GitHub tarball URL without integrity.

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

tests.rsRegression test for shared-subtree owner context availability +110/-0

Regression test for shared-subtree owner context availability

• Adds a workspace-level test covering importer visitation order where a non-owner is visited before the shared-subtree owner. Asserts optional peer hoisting does not incorrectly select a provider from an unrelated importer context.

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

tests.rsAssert git-hosted tarball resolutions have no integrity +1/-0

Assert git-hosted tarball resolutions have no integrity

• Tightens the GitHub full-commit shortcut test to assert that tarball resolutions are marked git-hosted but do not include integrity.

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

Documentation (4) +17 / -3
git-hosted-lockfile-resolution.mdChangeset: omit integrity for commit-addressed git-hosted deps +5/-0

Changeset: omit integrity for commit-addressed git-hosted deps

• Adds a pacquet patch changeset documenting that lockfile output no longer writes archive integrity for commit-addressed git-hosted dependencies.

.changeset/git-hosted-lockfile-resolution.md

libc-lockfile-scalar.mdChangeset: serialize singleton libc as scalar +5/-0

Changeset: serialize singleton libc as scalar

• Adds a pacquet patch changeset documenting that single-value 'libc' metadata is emitted as a scalar to match pnpm’s lockfile conventions.

.changeset/libc-lockfile-scalar.md

shared-peer-owner-barrier.mdChangeset: prevent unrelated optional peer selection +5/-0

Changeset: prevent unrelated optional peer selection

• Adds a pacquet patch changeset describing the fix to optional peer selection when shared-subtree owner context is required.

.changeset/shared-peer-owner-barrier.md

lib.rsDocs: clarify git resolver no longer records archive integrity +2/-3

Docs: clarify git resolver no longer records archive integrity

• Updates crate-level documentation to remove references to capturing git-hosted archive integrity during resolution.

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

@greptile-apps

greptile-apps Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (5): Last reviewed commit: "perf(pacquet): publish peer context befo..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
pnpm/crates/lockfile/src/resolution/tests.rs (1)

721-734: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the complete normalized resolution.

The regression currently checks only the variant and git_hosted. Compare against a full expected TarballResolution so changes to the URL, integrity, or path cannot pass unnoticed.

As per path instructions, lockfile regression tests must prove the exact lockfile shape.

🤖 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/lockfile/src/resolution/tests.rs` around lines 721 - 734, Update
the test to construct a complete expected TarballResolution and compare it with
the result of to_lockfile_form, covering the normalized tarball URL, integrity,
git_hosted, and path fields. Replace the current variant-only extraction and
git_hosted assertion while preserving the existing resolution inputs.

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/lockfile/src/package_metadata/tests.rs`:
- Around line 46-53: Update singleton_libc_is_written_as_a_string to serialize
metadata through the production serialize_yaml::to_string path used by the
round-trip test, then assert the exact expected libc: glibc line or field shape
rather than using a substring contains check. Ensure the test rejects additional
or alternate libc representations.

In `@pnpm/crates/lockfile/src/resolution.rs`:
- Around line 355-362: Update the rustdoc contract for to_lockfile_form to
clarify that integrity-less tarballs pass through unchanged except for
recognized git-hosted archives, which may be normalized with git_hosted set to
Some(true). Keep the implementation unchanged.

---

Nitpick comments:
In `@pnpm/crates/lockfile/src/resolution/tests.rs`:
- Around line 721-734: Update the test to construct a complete expected
TarballResolution and compare it with the result of to_lockfile_form, covering
the normalized tarball URL, integrity, git_hosted, and path fields. Replace the
current variant-only extraction and git_hosted assertion while preserving the
existing resolution inputs.
🪄 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: ea11661e-467a-4a03-a52d-ccee44326bd5

📥 Commits

Reviewing files that changed from the base of the PR and between e1babf7 and ec71d3c.

📒 Files selected for processing (12)
  • .changeset/git-hosted-lockfile-resolution.md
  • .changeset/libc-lockfile-scalar.md
  • .changeset/shared-peer-owner-barrier.md
  • pnpm/crates/lockfile/src/package_metadata.rs
  • pnpm/crates/lockfile/src/package_metadata/tests.rs
  • pnpm/crates/lockfile/src/resolution.rs
  • pnpm/crates/lockfile/src/resolution/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pnpm/crates/resolving-git-resolver/src/git_resolver.rs
  • pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs
  • pnpm/crates/resolving-git-resolver/src/lib.rs

Comment thread pnpm/crates/lockfile/src/resolution.rs Resolved
@github-actions

github-actions Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.04     13.1±0.71ms    28.6 MB/sec    1.00     12.5±0.25ms    29.9 MB/sec
packument/parse                1.00     42.5±0.78µs  1559.0 MB/sec    1.00     42.5±0.74µs  1561.6 MB/sec
tarball/download_dependency    1.00      2.7±0.20ms  1615.5 KB/sec    1.01      2.7±0.24ms  1607.3 KB/sec

@codecov-commenter

codecov-commenter commented Jul 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.49624% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.63%. Comparing base (ef32e98) to head (dbc5cfc).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/lockfile/src/package_metadata.rs 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   pnpm/pnpm#13432      +/-   ##
==========================================
+ Coverage   87.60%   87.63%   +0.03%     
==========================================
  Files         545      545              
  Lines       93698    93849     +151     
==========================================
+ Hits        82085    82246     +161     
+ Misses      11613    11603      -10     

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

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (2) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. Barrier not reapplied per round ✓ Resolved 🐞 Bug ≡ Correctness
Description
resolve_workspace only runs the extra all-importers run_required_round() refresh once;
subsequent hoist iterations never recompute importers’ optional-hoist inputs after all current
owners have published their missing-peer sets. If optional-peer hoisting changes shared-subtree
ownership (first_importer_by_pkg), some importers will compute all_missing_optional_peers before
the new owner records first_walk_missing_by_pkg, so optional peers can be hoisted/suppressed using
stale owner context and the workspace graph/lockfile becomes order-dependent again.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R295-305]

+        if !owner_missing_sets_initialized && states.len() > 1 {
+            // A non-owner importer can be visited before the importer that owns
+            // a shared package's children. Refresh every hoist input after all
+            // owners have published their missing-peer sets so foreign
+            // subtrees are filtered against their owner context before optional
+            // peers are added.
+            for state in &mut states {
+                state.run_required_round(resolver).await?;
+            }
+            owner_missing_sets_initialized = true;
+        }
Relevance

⭐⭐ Medium

No direct history on reapplying this barrier; team often accepts determinism/peer-context fixes (PRs
#13343/#13381) but rejects some state-refresh ideas (#13388).

PR-#13343
PR-#13381
PR-#13388

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new guard permanently disables the second required-round refresh after its first execution, but
ownership and the data used to suppress foreign-subtree missing peers are dynamic: ownership
(first_importer_by_pkg) is updated whenever a shallower occurrence wins (claim_children_owner),
while the owner-missing map (first_walk_missing_by_pkg) is only overwritten when the owner runs
and is otherwise left as-is. Because run_required_round() snapshots HoistMissingScope and builds
the optional-hoist buckets before hoist_optional_round(), a later owner change can make those
buckets stale unless the barrier is reapplied.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-312]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[793-808]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2626-2675]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[921-957]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[214-246]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[492-559]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[646-689]

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

## Issue description
`resolve_workspace` gates the second `run_required_round()` pass behind `owner_missing_sets_initialized`, so the “owners publish missing-peer sets before optional hoisting” guarantee is only enforced once. But shared-subtree ownership can change after later hoist waves (ownership is depth-driven), and `first_walk_missing_by_pkg` is not invalidated when `first_importer_by_pkg` changes; this allows later iterations to compute optional-hoist buckets from stale owner-context data.

## Issue Context
- Ownership can change when a shallower occurrence appears (`claim_children_owner` selects by depth/importer order).
- `HoistMissingScope::suppresses` requires both `first_importer_by_pkg` and `first_walk_missing_by_pkg` to be coherent for the current ownership generation.
- `record_first_walk_missing` does not clear/refresh records on owner change; it only overwrites when the (new) owner runs.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-305]

### Suggested approach
1. Add a lightweight “children-owner generation” counter in `WorkspaceTreeCtx` (e.g., `AtomicU64`), incremented whenever `claim_children_owner()` changes the stored owner for any `pkg_id`.
2. In each outer `loop` iteration in `resolve_workspace`, snapshot the generation before the first `for state { run_required_round }` pass.
3. After that pass, if the generation changed during the pass (or if `first_walk_missing_by_pkg` is missing entries for current owners), run a second `run_required_round()` pass across all states to recompute `all_missing_optional_peers` with the now-published owner context before `hoist_optional_round()`.
4. Add a regression test that forces **multiple** optional-hoist iterations where a later importer hoists a dependency to depth 0, becoming the new owner, and assert the earlier importer’s optional-hoist decision respects the new owner’s missing-peer context.

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



Remediation recommended

2. Clones ancestor chains per miss 🐞 Bug ➹ Performance ⭐ New
Description
record_missing_issue clones and stores the full ancestor_pkg_ids chain for every missing-peer
issue, but the majority of required-round paths never call apply_hoist_missing_scope to consume
this data. This introduces avoidable allocations and memory churn on the resolution hot path,
particularly for large graphs with many missing peers.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R1590-1601]

+    fn record_missing_issue(
+        &mut self,
+        peer_name: &str,
+        issue: MissingPeer,
+        ancestor_pkg_ids: &[String],
+    ) {
+        self.issues.missing.entry(peer_name.to_string()).or_default().push(issue);
+        self.missing_ancestor_pkg_ids
+            .entry(peer_name.to_string())
+            .or_default()
+            .push(ancestor_pkg_ids.to_vec());
+    }
Relevance

⭐⭐ Medium

Perf gating accepted (#13172), but clone/laziness optimizations in resolver hot paths often rejected
(#13388).

PR-#13172
PR-#13388

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new record_missing_issue clones ancestor_pkg_ids into missing_ancestor_pkg_ids for every
missing peer, and apply_hoist_missing_scope is the only consumer. The normal required-round loop
sets hoist_missing_scope during resolve_required_round(Some(...)) but does not call
apply_hoist_missing_scope, so the cloned chains are typically unused overhead.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[368-383]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1590-1601]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1179-1194]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[506-518]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[592-599]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[528-537]

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

### Issue description
`ResolvePeersResult` now carries `missing_ancestor_pkg_ids`, and `record_missing_issue()` clones `ancestor_pkg_ids` into it for every missing peer. However, only the initial required-round barrier path applies `apply_hoist_missing_scope()`; the normal `run_required_round()` path suppresses at-walk via `hoist_missing_scope` and never consumes `missing_ancestor_pkg_ids`, so the extra cloning becomes pure overhead.

### Issue Context
- `apply_hoist_missing_scope()` is a post-filter that relies on per-issue ancestor chains.
- In non-initial required rounds, missing issues are already suppressed during the walk (`opts.hoist_missing_scope = Some(...)`), so no post-filter is needed.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[368-384]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1590-1602]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[520-538]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[506-518]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[592-599]

### Suggested approach
- Add an explicit option/flag (e.g. `collect_missing_ancestor_pkg_ids: bool`) to `ResolvePeersOptions`, default `false`.
- In `record_missing_issue()`, only push into `missing_ancestor_pkg_ids` when that flag is enabled.
- Enable the flag only for the initial required-round barrier where `apply_hoist_missing_scope()` is used (i.e. the `prepare_initial_required_round` path), and keep it disabled for normal required rounds where `hoist_missing_scope` is already set.
- Consider adding a small regression test/benchmark or assertion that `missing_ancestor_pkg_ids` remains empty in the common scoped-walk path.

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


3. Peak memory from snapshots 🐞 Bug ➹ Performance ⭐ New
Description
resolve_workspace now constructs and retains an initial RequiredRound for every hoist-enabled
importer before completing any, and RequiredRound contains a full cloned ResolvedTree snapshot.
This can significantly increase peak memory in large workspaces and slow down or fail resolution
under memory pressure.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R290-301]

+    let mut initial_required_rounds: Vec<_> =
+        states.iter_mut().map(ImporterHoistState::prepare_initial_required_round).collect();
+    for (state, round) in states.iter().zip(&mut initial_required_rounds) {
+        if let Some(round) = round {
+            state.apply_owner_missing_scope(round);
+        }
+    }
+    for (state, round) in states.iter_mut().zip(initial_required_rounds) {
+        if let Some(round) = round {
+            state.complete_initial_required_round(resolver, round).await?;
        }
+    }
Relevance

⭐⭐ Medium

No direct precedent; recent resolver perf/memory refactors often rejected without strong evidence
(#13388).

PR-#13388

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
resolve_workspace collects one RequiredRound per importer before any are completed.
RequiredRound includes snapshot: ResolvedTree, and WorkspaceTreeCtx::snapshot clones large
internal maps into ResolvedTree, meaning N rounds can hold N full clones concurrently.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-301]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[359-363]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[520-526]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[871-886]

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 initial barrier phase collects `Option<RequiredRound>` for all importers at once. Each `RequiredRound` owns a `ResolvedTree` snapshot (cloned maps), so peak memory can grow with the number of hoist-enabled importers.

### Issue Context
This is a performance/reliability risk (peak RSS), especially for large monorepos. The barrier semantics can still be preserved while avoiding holding all full snapshots concurrently.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-299]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[359-364]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[520-526]

### Suggested approach
Pick one:
1) **Two-phase, low-memory barrier**: first phase computes only the data needed to publish owner missing-peer context (e.g. `missing_names_by_pkg`) and records it, without retaining `ResolvedTree` snapshots; second phase re-runs the required round per importer to proceed with hoisting. This trades extra CPU for much lower peak memory.
2) **Share snapshot backing storage**: refactor snapshots so the large maps are shared (e.g. `Arc`-backed) rather than cloned per importer, and `RequiredRound` holds shared references.
3) **Stream rounds**: store just enough per-importer state to apply `apply_owner_missing_scope` later (or defer it), and complete each importer as soon as the global context is ready, without keeping all `ResolvedTree`s alive simultaneously.

Add a stress/regression test or benchmark that exercises many importers with a large shared tree and asserts peak memory stays within an expected bound (or at least that the algorithm does not scale linearly in snapshots held).

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


4. libc scalar diverges from pnpm 📘 Rule violation ⌂ Architecture
Description
Pacquet now serializes a singleton libc list as a scalar YAML string, but pnpm’s lockfile fixtures
and TypeScript lockfile snapshots show libc written as a one-item sequence (e.g. libc: [glibc]).
This creates a pnpm↔pacquet user-visible lockfile format divergence and can break byte-identical
lockfile validation.
Code

pnpm/crates/lockfile/src/package_metadata.rs[R118-135]

+#[expect(
+    clippy::ref_option,
+    reason = "serde serialize_with requires a reference to the field type"
+)]
+fn serialize_string_or_vec<Value, Ser>(
+    value: &Option<Vec<Value>>,
+    serializer: Ser,
+) -> Result<Ser::Ok, Ser::Error>
+where
+    Value: Serialize,
+    Ser: serde::Serializer,
+{
+    match value.as_deref() {
+        Some([item]) => item.serialize(serializer),
+        Some(items) => items.serialize(serializer),
+        None => serializer.serialize_none(),
+    }
+}
Relevance

⭐⭐ Medium

No close historical review finding on libc scalar/seq; repo often prioritizes pnpm↔pacquet parity
changes.

PR-#13375

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new pacquet serializer explicitly collapses singleton vectors into a scalar, changing the
emitted lockfile YAML shape. pnpm’s own lockfile artifacts in the repo (fixtures/snapshots) show
libc emitted as a one-item sequence (libc: [glibc]), so the pacquet change introduces a
pnpm-incompatible, unsynchronized user-visible output change.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/lockfile/src/package_metadata.rs[118-135]
pnpm11/lockfile/fs/test/snapshots/write.test.ts.snap[19-25]
pnpm11/benchmarks/fixture/pnpm-lock.yaml[1545-1551]

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

## Issue description
Pacquet writes singleton `libc` as a scalar (`libc: glibc`), but pnpm writes singleton `libc` as a one-item sequence (`libc: [glibc]`) in the lockfile.

## Issue Context
This is a user-visible lockfile format difference. The PR introduces a custom `serialize_with` that collapses `Some([item])` into a scalar, causing lockfiles generated by pacquet to differ from pnpm.

## Fix Focus Areas
- pnpm/crates/lockfile/src/package_metadata.rs[118-135]

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



Informational

5. Extra required-round barrier ✓ Resolved 🐞 Bug ➹ Performance
Description
Workspace resolution now runs run_required_round() twice for every importer before the first
optional-peer hoist, adding an extra dependency-tree snapshot + resolve_peers(...) pass per
importer. On large workspaces this is guaranteed additional CPU work on a hot path, even when no
additional required-peer hoists occur in the second pass.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R290-305]

+    let mut owner_missing_sets_initialized = false;
    loop {
        for state in &mut states {
            state.run_required_round(resolver).await?;
        }
+        if !owner_missing_sets_initialized {
+            // A non-owner importer can be visited before the importer that owns
+            // a shared package's children. Refresh every hoist input after all
+            // owners have published their missing-peer sets so foreign
+            // subtrees are filtered against their owner context before optional
+            // peers are added.
+            for state in &mut states {
+                state.run_required_round(resolver).await?;
+            }
+            owner_missing_sets_initialized = true;
+        }
Relevance

⭐⭐ Medium

Limited direct history on “extra resolve pass” complaints; team sometimes accepts perf hot-path
optimizations.

PR-#13172

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new barrier explicitly invokes run_required_round() twice across all importer states.
run_required_round() snapshots the resolved tree and runs resolve_peers(...) in a loop, which is
non-trivial work even if the second invocation ends up not hoisting anything.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[250-313]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[492-613]

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

### Issue description
`resolve_workspace()` introduces a one-time barrier that re-runs `run_required_round()` for every importer to ensure owner missing-peer context is published before optional hoisting. This is correct for behavior, but it also redoes work that `run_required_round()` performs (snapshot + `resolve_peers` loop) even when the second pass won’t hoist any required peers.

### Issue Context
`run_required_round()` does more than “publish missing sets”: it clears and rebuilds optional buckets and can loop to a fixpoint, snapshotting the tree and running `resolve_peers(...)` (and potentially `extend_tree(...)`). The second workspace-wide invocation is meant to refresh hoist inputs after owner context is available; it likely does **not** need to attempt required-peer hoisting again.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-305]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[492-613]

### Suggested fix
Factor `run_required_round()` so you can call a cheaper “refresh optional hoist inputs” step in the barrier:
- Add an `ImporterHoistState::refresh_missing_optional_peers(...)` (or similar) that:
 - snapshots + runs `resolve_peers(...)` once with the updated `HoistMissingScope`,
 - rebuilds `all_missing_optional_peers`,
 - does **not** enter the required-peer hoist/`extend_tree` loop.
- In the barrier, call this lighter refresh instead of a full second `run_required_round()`.

This preserves the correctness barrier while reducing repeated work on large workspaces.

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


6. pnpm missing from changeset 📘 Rule violation § Compliance
Description
New changeset files declare only "pacquet": patch and omit an explicit "pnpm" entry. This
violates the requirement that changesets explicitly include pnpm with a valid bump type.
Code

.changeset/libc-lockfile-scalar.md[R1-3]

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

⭐ Low

Same “missing pnpm in changeset frontmatter” suggestion repeatedly rejected in recent merged PRs.

PR-#13347
PR-#13417
PR-#12981

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule requires changeset frontmatter to include pnpm explicitly. The added changeset
frontmatter contains only "pacquet": patch, so the requirement is not met.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/libc-lockfile-scalar.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 newly added changesets don’t include an explicit `pnpm` entry in the frontmatter.

## Issue Context
Compliance requires that changeset frontmatter explicitly lists `pnpm` with `patch`/`minor`/`major`.

## Fix Focus Areas
- .changeset/libc-lockfile-scalar.md[1-3]
- .changeset/git-hosted-lockfile-resolution.md[1-3]
- .changeset/shared-peer-owner-barrier.md[1-3]

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


7. Unverified git tarball installs 🐞 Bug ⛨ Security
Description
Git-hosted tarball resolutions no longer record a computed integrity, so the install path will
fetch these commit-addressed archives without lockfile-pinned content verification. This weakens
tamper detection for git-hosted archives (content substitution on a compromised archive
endpoint/CDN/TLS termination would not be detected) compared to the prior behavior that stored and
verified the hash.
Code

pnpm/crates/resolving-git-resolver/src/git_resolver.rs[R155-158]

                .map_err(|err| Box::new(err) as ResolveError)?;

                result.manifest = resolved.manifest.map(Arc::new);
-                if let LockfileResolution::Tarball(tarball) = &mut result.resolution {
-                    // A git host's archive carries no integrity of its
-                    // own, and the install pass refuses a tarball
-                    // resolution without one
-                    // (`tarball_url_and_integrity`). The bytes were
-                    // just hashed to extract them, so record that —
-                    // same field upstream writes for a git dep.
-                    tarball.integrity = Some(resolved.integrity);
-                }
            }
Relevance

⭐ Low

Repo merged work allowing integrity-less git-hosted tarballs; verification tightened elsewhere, not
via stored integrity.

PR-#13349
PR-#13408

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The git resolver still fetches hosted archives to read the manifest but no longer copies the
computed integrity into the tarball resolution. The install helper explicitly allows missing
integrity only for file: tarballs or recognized git-hosted commit archive URLs, meaning these
git-hosted tarballs are fetched without a pinned hash check.

pnpm/crates/resolving-git-resolver/src/git_resolver.rs[125-176]
pnpm/crates/resolving-git-resolver/src/git_resolver.rs[245-266]
pnpm/crates/package-manager/src/install_package_by_snapshot.rs[677-758]
pnpm/crates/lockfile/src/resolution.rs[520-603]

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

### Issue description
Git-hosted tarballs are still downloaded during resolution (to read `package.json`), but the computed sha512 integrity is no longer stored in the `TarballResolution`. This means installs of git-hosted commit archives proceed in the “unverified fetch allowed” mode, losing a cryptographic pin that previously detected content substitution.

### Issue Context
The PR’s goal (byte-identical pnpm 11 lockfiles) is about *serialization*. You can preserve that lockfile shape while still keeping integrity **in-memory** for verification by stripping it only at lockfile-write time.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/git_resolver.rs[125-176]
- pnpm/crates/lockfile/src/resolution.rs[346-388]
- pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs[129-133]

### Suggested fix
1. Reintroduce setting `tarball.integrity = Some(resolved.integrity)` after `FetchTarballForResolution::run()` so the current run can verify bytes.
2. Update `LockfileResolution::to_lockfile_form()` to **omit** `integrity` when serializing git-hosted **commit-addressed** archive URLs (use `is_git_hosted_tarball_url(...)`), so the written lockfile still matches pnpm 11.
3. Adjust the git resolver test to assert the lockfile form omits integrity (rather than asserting the resolver result always has `integrity.is_none()`).

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


Grey Divider

Previous review results

Review updated until commit dbc5cfc

Results up to commit ec71d3c ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (2) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. libc scalar diverges from pnpm 📘 Rule violation ⌂ Architecture
Description
Pacquet now serializes a singleton libc list as a scalar YAML string, but pnpm’s lockfile fixtures
and TypeScript lockfile snapshots show libc written as a one-item sequence (e.g. libc: [glibc]).
This creates a pnpm↔pacquet user-visible lockfile format divergence and can break byte-identical
lockfile validation.
Code

pnpm/crates/lockfile/src/package_metadata.rs[R118-135]

+#[expect(
+    clippy::ref_option,
+    reason = "serde serialize_with requires a reference to the field type"
+)]
+fn serialize_string_or_vec<Value, Ser>(
+    value: &Option<Vec<Value>>,
+    serializer: Ser,
+) -> Result<Ser::Ok, Ser::Error>
+where
+    Value: Serialize,
+    Ser: serde::Serializer,
+{
+    match value.as_deref() {
+        Some([item]) => item.serialize(serializer),
+        Some(items) => items.serialize(serializer),
+        None => serializer.serialize_none(),
+    }
+}
Relevance

⭐⭐ Medium

No close historical review finding on libc scalar/seq; repo often prioritizes pnpm↔pacquet parity
changes.

PR-#13375

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new pacquet serializer explicitly collapses singleton vectors into a scalar, changing the
emitted lockfile YAML shape. pnpm’s own lockfile artifacts in the repo (fixtures/snapshots) show
libc emitted as a one-item sequence (libc: [glibc]), so the pacquet change introduces a
pnpm-incompatible, unsynchronized user-visible output change.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/lockfile/src/package_metadata.rs[118-135]
pnpm11/lockfile/fs/test/snapshots/write.test.ts.snap[19-25]
pnpm11/benchmarks/fixture/pnpm-lock.yaml[1545-1551]

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

## Issue description
Pacquet writes singleton `libc` as a scalar (`libc: glibc`), but pnpm writes singleton `libc` as a one-item sequence (`libc: [glibc]`) in the lockfile.

## Issue Context
This is a user-visible lockfile format difference. The PR introduces a custom `serialize_with` that collapses `Some([item])` into a scalar, causing lockfiles generated by pacquet to differ from pnpm.

## Fix Focus Areas
- pnpm/crates/lockfile/src/package_metadata.rs[118-135]

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



Informational
2. Extra required-round barrier ✓ Resolved 🐞 Bug ➹ Performance
Description
Workspace resolution now runs run_required_round() twice for every importer before the first
optional-peer hoist, adding an extra dependency-tree snapshot + resolve_peers(...) pass per
importer. On large workspaces this is guaranteed additional CPU work on a hot path, even when no
additional required-peer hoists occur in the second pass.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R290-305]

+    let mut owner_missing_sets_initialized = false;
    loop {
        for state in &mut states {
            state.run_required_round(resolver).await?;
        }
+        if !owner_missing_sets_initialized {
+            // A non-owner importer can be visited before the importer that owns
+            // a shared package's children. Refresh every hoist input after all
+            // owners have published their missing-peer sets so foreign
+            // subtrees are filtered against their owner context before optional
+            // peers are added.
+            for state in &mut states {
+                state.run_required_round(resolver).await?;
+            }
+            owner_missing_sets_initialized = true;
+        }
Relevance

⭐⭐ Medium

Limited direct history on “extra resolve pass” complaints; team sometimes accepts perf hot-path
optimizations.

PR-#13172

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new barrier explicitly invokes run_required_round() twice across all importer states.
run_required_round() snapshots the resolved tree and runs resolve_peers(...) in a loop, which is
non-trivial work even if the second invocation ends up not hoisting anything.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[250-313]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[492-613]

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

### Issue description
`resolve_workspace()` introduces a one-time barrier that re-runs `run_required_round()` for every importer to ensure owner missing-peer context is published before optional hoisting. This is correct for behavior, but it also redoes work that `run_required_round()` performs (snapshot + `resolve_peers` loop) even when the second pass won’t hoist any required peers.

### Issue Context
`run_required_round()` does more than “publish missing sets”: it clears and rebuilds optional buckets and can loop to a fixpoint, snapshotting the tree and running `resolve_peers(...)` (and potentially `extend_tree(...)`). The second workspace-wide invocation is meant to refresh hoist inputs after owner context is available; it likely does **not** need to attempt required-peer hoisting again.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-305]
- pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[492-613]

### Suggested fix
Factor `run_required_round()` so you can call a cheaper “refresh optional hoist inputs” step in the barrier:
- Add an `ImporterHoistState::refresh_missing_optional_peers(...)` (or similar) that:
 - snapshots + runs `resolve_peers(...)` once with the updated `HoistMissingScope`,
 - rebuilds `all_missing_optional_peers`,
 - does **not** enter the required-peer hoist/`extend_tree` loop.
- In the barrier, call this lighter refresh instead of a full second `run_required_round()`.

This preserves the correctness barrier while reducing repeated work on large workspaces.

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


3. Unverified git tarball installs 🐞 Bug ⛨ Security
Description
Git-hosted tarball resolutions no longer record a computed integrity, so the install path will
fetch these commit-addressed archives without lockfile-pinned content verification. This weakens
tamper detection for git-hosted archives (content substitution on a compromised archive
endpoint/CDN/TLS termination would not be detected) compared to the prior behavior that stored and
verified the hash.
Code

pnpm/crates/resolving-git-resolver/src/git_resolver.rs[R155-158]

                .map_err(|err| Box::new(err) as ResolveError)?;

                result.manifest = resolved.manifest.map(Arc::new);
-                if let LockfileResolution::Tarball(tarball) = &mut result.resolution {
-                    // A git host's archive carries no integrity of its
-                    // own, and the install pass refuses a tarball
-                    // resolution without one
-                    // (`tarball_url_and_integrity`). The bytes were
-                    // just hashed to extract them, so record that —
-                    // same field upstream writes for a git dep.
-                    tarball.integrity = Some(resolved.integrity);
-                }
            }
Relevance

⭐ Low

Repo merged work allowing integrity-less git-hosted tarballs; verification tightened elsewhere, not
via stored integrity.

PR-#13349
PR-#13408

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The git resolver still fetches hosted archives to read the manifest but no longer copies the
computed integrity into the tarball resolution. The install helper explicitly allows missing
integrity only for file: tarballs or recognized git-hosted commit archive URLs, meaning these
git-hosted tarballs are fetched without a pinned hash check.

pnpm/crates/resolving-git-resolver/src/git_resolver.rs[125-176]
pnpm/crates/resolving-git-resolver/src/git_resolver.rs[245-266]
pnpm/crates/package-manager/src/install_package_by_snapshot.rs[677-758]
pnpm/crates/lockfile/src/resolution.rs[520-603]

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

### Issue description
Git-hosted tarballs are still downloaded during resolution (to read `package.json`), but the computed sha512 integrity is no longer stored in the `TarballResolution`. This means installs of git-hosted commit archives proceed in the “unverified fetch allowed” mode, losing a cryptographic pin that previously detected content substitution.

### Issue Context
The PR’s goal (byte-identical pnpm 11 lockfiles) is about *serialization*. You can preserve that lockfile shape while still keeping integrity **in-memory** for verification by stripping it only at lockfile-write time.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/git_resolver.rs[125-176]
- pnpm/crates/lockfile/src/resolution.rs[346-388]
- pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs[129-133]

### Suggested fix
1. Reintroduce setting `tarball.integrity = Some(resolved.integrity)` after `FetchTarballForResolution::run()` so the current run can verify bytes.
2. Update `LockfileResolution::to_lockfile_form()` to **omit** `integrity` when serializing git-hosted **commit-addressed** archive URLs (use `is_git_hosted_tarball_url(...)`), so the written lockfile still matches pnpm 11.
3. Adjust the git resolver test to assert the lockfile form omits integrity (rather than asserting the resolver result always has `integrity.is_none()`).

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


4. pnpm missing from changeset 📘 Rule violation § Compliance
Description
New changeset files declare only "pacquet": patch and omit an explicit "pnpm" entry. This
violates the requirement that changesets explicitly include pnpm with a valid bump type.
Code

.changeset/libc-lockfile-scalar.md[R1-3]

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

⭐ Low

Same “missing pnpm in changeset frontmatter” suggestion repeatedly rejected in recent merged PRs.

PR-#13347
PR-#13417
PR-#12981

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule requires changeset frontmatter to include pnpm explicitly. The added changeset
frontmatter contains only "pacquet": patch, so the requirement is not met.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/libc-lockfile-scalar.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 newly added changesets don’t include an explicit `pnpm` entry in the frontmatter.

## Issue Context
Compliance requires that changeset frontmatter explicitly lists `pnpm` with `patch`/`minor`/`major`.

## Fix Focus Areas
- .changeset/libc-lockfile-scalar.md[1-3]
- .changeset/git-hosted-lockfile-resolution.md[1-3]
- .changeset/shared-peer-owner-barrier.md[1-3]

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


Results up to commit c210f83 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Barrier not reapplied per round ✓ Resolved 🐞 Bug ≡ Correctness
Description
resolve_workspace only runs the extra all-importers run_required_round() refresh once;
subsequent hoist iterations never recompute importers’ optional-hoist inputs after all current
owners have published their missing-peer sets. If optional-peer hoisting changes shared-subtree
ownership (first_importer_by_pkg), some importers will compute all_missing_optional_peers before
the new owner records first_walk_missing_by_pkg, so optional peers can be hoisted/suppressed using
stale owner context and the workspace graph/lockfile becomes order-dependent again.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R295-305]

+        if !owner_missing_sets_initialized && states.len() > 1 {
+            // A non-owner importer can be visited before the importer that owns
+            // a shared package's children. Refresh every hoist input after all
+            // owners have published their missing-peer sets so foreign
+            // subtrees are filtered against their owner context before optional
+            // peers are added.
+            for state in &mut states {
+                state.run_required_round(resolver).await?;
+            }
+            owner_missing_sets_initialized = true;
+        }
Relevance

⭐⭐ Medium

No direct history on reapplying this barrier; team often accepts determinism/peer-context fixes (PRs
#13343/#13381) but rejects some state-refresh ideas (#13388).

PR-#13343
PR-#13381
PR-#13388

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new guard permanently disables the second required-round refresh after its first execution, but
ownership and the data used to suppress foreign-subtree missing peers are dynamic: ownership
(first_importer_by_pkg) is updated whenever a shallower occurrence wins (claim_children_owner),
while the owner-missing map (first_walk_missing_by_pkg) is only overwritten when the owner runs
and is otherwise left as-is. Because run_required_round() snapshots HoistMissingScope and builds
the optional-hoist buckets before hoist_optional_round(), a later owner change can make those
buckets stale unless the barrier is reapplied.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-312]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[793-808]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2626-2675]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[921-957]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[214-246]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[492-559]
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs[646-689]

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

## Issue description
`resolve_workspace` gates the second `run_required_round()` pass behind `owner_missing_sets_initialized`, so the “owners publish missing-peer sets before optional hoisting” guarantee is only enforced once. But shared-subtree ownership can change after later hoist waves (ownership is depth-driven), and `first_walk_missing_by_pkg` is not invalidated when `first_importer_by_pkg` changes; this allows later iterations to compute optional-hoist buckets from stale owner-context data.

## Issue Context
- Ownership can change when a shallower occurrence appears (`claim_children_owner` selects by depth/importer order).
- `HoistMissingScope::suppresses` requires both `first_importer_by_pkg` and `first_walk_missing_by_pkg` to be coherent for the current ownership generation.
- `record_first_walk_missing` does not clear/refresh records on owner change; it only overwrites when the (new) owner runs.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[290-305]

### Suggested approach
1. Add a lightweight “children-owner generation” counter in `WorkspaceTreeCtx` (e.g., `AtomicU64`), incremented whenever `claim_children_owner()` changes the stored owner for any `pkg_id`.
2. In each outer `loop` iteration in `resolve_workspace`, snapshot the generation before the first `for state { run_required_round }` pass.
3. After that pass, if the generation changed during the pass (or if `first_walk_missing_by_pkg` is missing entries for current owners), run a second `run_required_round()` pass across all states to recompute `all_missing_optional_peers` with the now-published owner context before `hoist_optional_round()`.
4. Add a regression test that forces **multiple** optional-hoist iterations where a later importer hoists a dependency to depth 0, becoming the new owner, and assert the earlier importer’s optional-hoist decision respects the new owner’s missing-peer context.

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


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.

Copilot AI review requested due to automatic review settings July 27, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan

zkochan commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Follow-up on the four Qodo findings:

  1. The libc scalar is intentional. A fresh pnpm 11 resolution of n8n emits libc: glibc, and the byte-for-byte comparison identified pacquet’s sequence as the divergence. The cited fixtures do not reproduce this n8n resolution path. Commit 06f7f81 strengthens the production-serializer assertion.
  2. The second required pass is the correctness barrier that refreshes owner-scoped missing-peer reports before optional selection. It can also discover required peers after another importer publishes ownership context, so replacing it with an optional-only refresh would change behavior. It runs only once before the normal fixpoint rounds.
  3. These are Rust-only changesets. Per the repository instructions, Rust-only changesets target pacquet and must omit pnpm, which names the TypeScript CLI package.
  4. Persisting the generated archive byte hash would recreate the lockfile instability this PR fixes. Keeping it only in resolver memory and dropping it while constructing the lockfile would not authenticate subsequent frozen installs. The exemption remains restricted to HTTPS, exact provider archive URL shapes, and full 40-character commit IDs on the explicit GitHub/GitLab/Bitbucket host allowlist.

The two actionable inline review findings were fixed in 06f7f81, and the full pre-push checks passed.


Written by an agent (Codex, GPT-5).

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 06f7f81

@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 Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: dbc5cfc027e6

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

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

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.764 ± 0.221 2.408 3.142 1.78 ± 0.21
pacquet@main 2.588 ± 0.165 2.419 2.873 1.67 ± 0.18
pnpr@HEAD 1.598 ± 0.133 1.421 1.810 1.03 ± 0.12
pnpr@main 1.551 ± 0.135 1.392 1.788 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7644001810000005,
      "stddev": 0.22125367159253992,
      "median": 2.8032526519000003,
      "user": 2.0637020799999997,
      "system": 1.6166630599999998,
      "min": 2.4082255724,
      "max": 3.1424571924,
      "times": [
        2.4976725144,
        2.8754238694000005,
        2.5466970634000003,
        2.4082255724,
        2.9380453624000005,
        2.8422014604,
        3.1424571924,
        2.7932178894,
        2.7867734714,
        2.8132874144000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5880413994,
      "stddev": 0.1651332246180289,
      "median": 2.5283338169,
      "user": 1.8640877799999997,
      "system": 1.47108946,
      "min": 2.4186320284000002,
      "max": 2.8733221964,
      "times": [
        2.8733221964,
        2.5139781094,
        2.4864916214000004,
        2.8579516944000005,
        2.5426895244,
        2.5014553244,
        2.4186320284000002,
        2.5616777314,
        2.6945706964000005,
        2.4296450674
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5982874268999998,
      "stddev": 0.13275813475028297,
      "median": 1.5805307444,
      "user": 1.2510063800000002,
      "system": 1.3032172599999998,
      "min": 1.4205303524,
      "max": 1.8096020754000002,
      "times": [
        1.5605308724,
        1.4205303524,
        1.4586945994,
        1.7027973964,
        1.8096020754000002,
        1.6005306164000002,
        1.6657687064,
        1.5063326414,
        1.4955693794,
        1.7625176294
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5510354312,
      "stddev": 0.13513515252100308,
      "median": 1.5203085004,
      "user": 1.2765200799999998,
      "system": 1.29368736,
      "min": 1.3918552004,
      "max": 1.7875996314,
      "times": [
        1.4746981664,
        1.3918552004,
        1.7875996314,
        1.7217299494,
        1.4232276054,
        1.6724100464,
        1.5475960434,
        1.4930209574,
        1.5633408764,
        1.4348758354
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 323.7 ± 39.5 284.7 418.6 1.12 ± 0.14
pacquet@main 289.4 ± 16.6 266.6 312.0 1.00 ± 0.06
pnpr@HEAD 300.6 ± 5.6 289.0 307.8 1.04 ± 0.03
pnpr@main 289.0 ± 7.0 275.8 297.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3236613346,
      "stddev": 0.039462826176523205,
      "median": 0.31851688910000003,
      "user": 0.26755384,
      "system": 0.6437921600000001,
      "min": 0.2847235241,
      "max": 0.41862984410000004,
      "times": [
        0.2893506161,
        0.3000406111,
        0.2847235241,
        0.2926338891,
        0.34612445810000003,
        0.31995444310000004,
        0.33573766310000003,
        0.41862984410000004,
        0.3170793351,
        0.3323389621
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.289388171,
      "stddev": 0.016565471835211742,
      "median": 0.2869381756,
      "user": 0.25069344,
      "system": 0.56845986,
      "min": 0.26660170110000003,
      "max": 0.3119658711,
      "times": [
        0.3077030831,
        0.3119658711,
        0.2743146871,
        0.3087771951,
        0.2765018851,
        0.26660170110000003,
        0.2761401181,
        0.2930384981,
        0.2980008181,
        0.28083785310000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30061704720000004,
      "stddev": 0.005584667854802415,
      "median": 0.2996340786,
      "user": 0.25539323999999997,
      "system": 0.56445316,
      "min": 0.2890107201,
      "max": 0.3077722001,
      "times": [
        0.29767184210000003,
        0.29958409410000003,
        0.2981285681,
        0.29874327910000004,
        0.3077623021,
        0.30296328910000003,
        0.2996840631,
        0.3048501141,
        0.3077722001,
        0.2890107201
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.28899472239999996,
      "stddev": 0.0070002292171346785,
      "median": 0.2903777111,
      "user": 0.22589093999999998,
      "system": 0.56213046,
      "min": 0.2757739511,
      "max": 0.2972601701,
      "times": [
        0.2972601701,
        0.2971512061,
        0.2891266261,
        0.2928127451,
        0.2856118301,
        0.2943772371,
        0.29162879610000003,
        0.2831534221,
        0.2830512401,
        0.2757739511
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.948 ± 0.057 2.820 3.057 1.87 ± 0.15
pacquet@main 2.856 ± 0.077 2.778 3.027 1.82 ± 0.15
pnpr@HEAD 1.602 ± 0.120 1.454 1.850 1.02 ± 0.11
pnpr@main 1.573 ± 0.123 1.437 1.781 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.9476770535999997,
      "stddev": 0.057185164987543675,
      "median": 2.9532285878,
      "user": 2.12654204,
      "system": 1.6077850599999999,
      "min": 2.8200831143,
      "max": 3.0566137923,
      "times": [
        2.9222909063,
        2.8200831143,
        2.9534573163,
        2.9529998592999998,
        3.0566137923,
        2.9494084143,
        2.9550592393,
        2.9593893393,
        2.9661763323,
        2.9412922223
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.8561111903000005,
      "stddev": 0.07728638466324463,
      "median": 2.8353867832999997,
      "user": 1.9313627399999997,
      "system": 1.4599956600000001,
      "min": 2.7779824123,
      "max": 3.0268682363,
      "times": [
        3.0268682363,
        2.8109870753,
        2.8493189553,
        2.9235231573,
        2.8731966493,
        2.8973083343,
        2.7779824123,
        2.7908209413000002,
        2.7896515303,
        2.8214546113
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6017240103,
      "stddev": 0.11970632160641569,
      "median": 1.5743998817999998,
      "user": 1.1811197399999998,
      "system": 1.29484156,
      "min": 1.4543908373,
      "max": 1.8503646702999998,
      "times": [
        1.5443969303,
        1.4915589333,
        1.4543908373,
        1.5865140712999999,
        1.6440383443,
        1.6859624062999998,
        1.8503646702999998,
        1.5005667043,
        1.6971615133,
        1.5622856923
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5729293624,
      "stddev": 0.12316185881030733,
      "median": 1.5148229552999999,
      "user": 1.0878804399999997,
      "system": 1.1918788599999997,
      "min": 1.4371141363,
      "max": 1.7806408572999999,
      "times": [
        1.5157599103,
        1.6600362572999998,
        1.5138860002999999,
        1.7806408572999999,
        1.4772957883,
        1.7340667853,
        1.4794190942999998,
        1.6567052983,
        1.4371141363,
        1.4743694963
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 620.4 ± 23.3 597.1 658.9 2.02 ± 0.08
pacquet@main 603.5 ± 13.8 584.3 634.6 1.97 ± 0.05
pnpr@HEAD 306.7 ± 4.6 299.8 315.8 1.00
pnpr@main 307.5 ± 9.1 294.9 317.0 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6203548406199999,
      "stddev": 0.023333975200013075,
      "median": 0.60899197602,
      "user": 0.74558216,
      "system": 0.71063818,
      "min": 0.59710047402,
      "max": 0.65890841802,
      "times": [
        0.60535048602,
        0.60837383802,
        0.64585858602,
        0.65890841802,
        0.65074152302,
        0.62617564102,
        0.59710047402,
        0.60961011402,
        0.59849485502,
        0.60293447102
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6035199146200001,
      "stddev": 0.013834767592686776,
      "median": 0.60447297402,
      "user": 0.7564528599999999,
      "system": 0.6651374800000001,
      "min": 0.58433733102,
      "max": 0.63464536602,
      "times": [
        0.59727315602,
        0.60610846502,
        0.58850986202,
        0.58433733102,
        0.60719972702,
        0.63464536602,
        0.59710328702,
        0.60370083902,
        0.60524510902,
        0.61107600402
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30665270872000006,
      "stddev": 0.0045964267662094585,
      "median": 0.30629030252,
      "user": 0.21133375999999998,
      "system": 0.52957438,
      "min": 0.29984962502,
      "max": 0.31583623302,
      "times": [
        0.30806126802000006,
        0.31583623302,
        0.31029165202000003,
        0.29984962502,
        0.30421466602,
        0.30558775702,
        0.30261552402,
        0.30976215102000004,
        0.30699284802000004,
        0.30331536302
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30751552302000007,
      "stddev": 0.009140824302914486,
      "median": 0.31040021602,
      "user": 0.21389505999999997,
      "system": 0.5257100799999999,
      "min": 0.29485402402000005,
      "max": 0.31695317302000003,
      "times": [
        0.29485402402000005,
        0.31401274802,
        0.29960558902,
        0.29942740502000004,
        0.31535887802,
        0.31654881602,
        0.31695317302000003,
        0.31536640302,
        0.30678768402,
        0.29624051002
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.012 ± 0.086 1.924 2.156 6.66 ± 0.34
pacquet@main 2.061 ± 0.163 1.896 2.370 6.82 ± 0.57
pnpr@HEAD 0.310 ± 0.004 0.303 0.317 1.03 ± 0.03
pnpr@main 0.302 ± 0.008 0.288 0.313 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.01235644926,
      "stddev": 0.08640688919453382,
      "median": 1.9807744545600001,
      "user": 1.11857706,
      "system": 0.8272385800000001,
      "min": 1.9237977710599998,
      "max": 2.15578064706,
      "times": [
        2.15578064706,
        2.11307554306,
        2.13005377706,
        1.97447396506,
        1.98707494406,
        1.93592376006,
        1.94833724806,
        1.9237977710599998,
        1.9644107070599999,
        1.99063613006
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.06120357416,
      "stddev": 0.16336862155531712,
      "median": 2.00842663856,
      "user": 1.20838556,
      "system": 0.9011972799999999,
      "min": 1.89629054606,
      "max": 2.37023224606,
      "times": [
        1.89853546006,
        1.91469481706,
        1.89629054606,
        1.97083832706,
        2.00306598306,
        2.01378729406,
        2.09538445906,
        2.19988931306,
        2.37023224606,
        2.24931729606
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30984969426000003,
      "stddev": 0.004449589572489868,
      "median": 0.30840124556,
      "user": 0.20001525999999997,
      "system": 0.53933098,
      "min": 0.30305218606,
      "max": 0.31736397305999997,
      "times": [
        0.31134550006,
        0.30852427606,
        0.31429649706,
        0.30305218606,
        0.31473940706,
        0.31736397305999997,
        0.30827821505999997,
        0.30649053606,
        0.30740317606,
        0.30700317606
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30207596206,
      "stddev": 0.007912946527336416,
      "median": 0.30290066305999996,
      "user": 0.19761726000000002,
      "system": 0.5181232799999999,
      "min": 0.28803579006,
      "max": 0.31281599406,
      "times": [
        0.29709542905999997,
        0.30475310206,
        0.29886648706,
        0.28803579006,
        0.30104822406,
        0.29291300506,
        0.30765289306,
        0.30991339906,
        0.31281599406,
        0.30766529706
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 379.7 ± 19.5 359.0 429.6 4.33 ± 0.25
pacquet@main 373.7 ± 11.3 357.6 401.3 4.26 ± 0.17
pnpr@HEAD 87.7 ± 2.2 84.7 94.7 1.00
pnpr@main 87.9 ± 1.6 85.8 92.7 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.37969806404,
      "stddev": 0.019524938561533034,
      "median": 0.37715401674000004,
      "user": 0.3784701999999999,
      "system": 0.05157337999999999,
      "min": 0.35902358324,
      "max": 0.42955502024000003,
      "times": [
        0.37017172324000003,
        0.37247290424,
        0.38256700124,
        0.38336996424,
        0.35902358324,
        0.42955502024000003,
        0.36175477924,
        0.37810405124,
        0.38375763124,
        0.37620398224
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3736611204400001,
      "stddev": 0.011263747229234644,
      "median": 0.37208180074,
      "user": 0.36164260000000004,
      "system": 0.06165288,
      "min": 0.35763447324000003,
      "max": 0.40132726724,
      "times": [
        0.37645051424000003,
        0.37136851524000003,
        0.37355926924,
        0.35763447324000003,
        0.36643566624,
        0.37246644024000003,
        0.37169716124,
        0.40132726724,
        0.37771848824,
        0.36795340924000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08765371308848485,
      "stddev": 0.002213285700614575,
      "median": 0.08754530724000001,
      "user": 0.021326000000000005,
      "system": 0.009261841212121215,
      "min": 0.08466418124,
      "max": 0.09465318024000001,
      "times": [
        0.08598894124,
        0.09014960624,
        0.08558326324,
        0.08642042024,
        0.08785356424,
        0.08754530724000001,
        0.08833593924000001,
        0.08837018224,
        0.09049229824,
        0.08520103724,
        0.09017941924,
        0.08552728824,
        0.08643500924,
        0.08813443024,
        0.08864495724,
        0.08563275524,
        0.08615704724,
        0.08770492624000001,
        0.09050545324,
        0.08470418524000001,
        0.08894094024,
        0.08797893124,
        0.08665965824,
        0.08560287924,
        0.08748311124000001,
        0.09465318024000001,
        0.09199237724,
        0.08466418124,
        0.08668554924,
        0.08805268724,
        0.08637076724000001,
        0.08811079924000001,
        0.08581143924000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08785223278545451,
      "stddev": 0.0015507094118949855,
      "median": 0.08753050724,
      "user": 0.02228281818181817,
      "system": 0.0070546181818181815,
      "min": 0.08584120524000001,
      "max": 0.09272234524,
      "times": [
        0.08626072224,
        0.08900906824,
        0.08584120524000001,
        0.08725444424,
        0.08735254624000001,
        0.08734632424000001,
        0.09004469924,
        0.08592442124,
        0.08843229924,
        0.08639742824,
        0.08713771324,
        0.08810739024,
        0.09272234524,
        0.08927497724,
        0.08792220824000001,
        0.08868352424,
        0.08680239124,
        0.08875503024,
        0.08665461524,
        0.08768387324,
        0.08967476124,
        0.08620552424,
        0.08584346624,
        0.08716845824,
        0.08811602224000001,
        0.08753050724,
        0.08761330124,
        0.08689849224,
        0.08793805924,
        0.08751468624,
        0.08846688924,
        0.09157414824,
        0.08697213924000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.738 ± 0.193 4.529 5.006 1.34 ± 0.06
pacquet@main 4.635 ± 0.177 4.470 4.944 1.31 ± 0.06
pnpr@HEAD 3.531 ± 0.073 3.469 3.724 1.00
pnpr@main 3.572 ± 0.096 3.461 3.746 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.73756142234,
      "stddev": 0.1929850283480382,
      "median": 4.6705428941400005,
      "user": 2.23937374,
      "system": 1.7346386799999998,
      "min": 4.52903021814,
      "max": 5.0064085471399995,
      "times": [
        4.54165583114,
        4.62315107514,
        4.95572992914,
        4.94212194614,
        4.65059426414,
        4.69049152414,
        4.90258778714,
        4.52903021814,
        5.0064085471399995,
        4.53384310114
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.63467860754,
      "stddev": 0.1767418491961395,
      "median": 4.56510638414,
      "user": 1.8864882399999998,
      "system": 1.4754593799999998,
      "min": 4.46967338914,
      "max": 4.94448814414,
      "times": [
        4.83924169314,
        4.47940079014,
        4.84815611114,
        4.62624588214,
        4.59856505214,
        4.52218387914,
        4.46967338914,
        4.48718341814,
        4.53164771614,
        4.94448814414
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5313403531400005,
      "stddev": 0.0725653953299533,
      "median": 3.50877904864,
      "user": 1.3626206399999998,
      "system": 1.36103138,
      "min": 3.46877607914,
      "max": 3.72367164814,
      "times": [
        3.5366960921399997,
        3.54278854314,
        3.72367164814,
        3.50489625614,
        3.50389621314,
        3.54431836814,
        3.50542641914,
        3.46877607914,
        3.51213167814,
        3.4708022341399998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5724676430399995,
      "stddev": 0.09624288018702265,
      "median": 3.54825490614,
      "user": 1.28409314,
      "system": 1.3256380799999998,
      "min": 3.46052107514,
      "max": 3.74610092314,
      "times": [
        3.67201013114,
        3.46052107514,
        3.47389663014,
        3.74610092314,
        3.55921264114,
        3.65452787814,
        3.51508566614,
        3.53729717114,
        3.48644465814,
        3.61957965614
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13432
Testbedpacquet
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,820.08 ms
(+2.58%)Baseline: 2,749.03 ms
3,298.84 ms
(85.49%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,923.80 ms
(+0.88%)Baseline: 1,907.09 ms
2,288.51 ms
(84.06%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
597.10 ms
(+1.56%)Baseline: 587.91 ms
705.50 ms
(84.64%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
359.02 ms
(-1.22%)Baseline: 363.45 ms
436.14 ms
(82.32%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,408.23 ms
(+1.59%)Baseline: 2,370.60 ms
2,844.72 ms
(84.66%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,529.03 ms
(+2.14%)Baseline: 4,434.27 ms
5,321.13 ms
(85.11%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
284.72 ms
(+11.63%)Baseline: 255.05 ms
306.06 ms
(93.03%)
🐰 View full continuous benchmarking report in Bencher

Copilot AI review requested due to automatic review settings July 27, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan

zkochan commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

The +43.83% isolated-linker.fresh-resolve.hot-cache.offline regression came from running the new cross-importer owner-context barrier for a single-importer project. A single importer cannot have a foreign shared-subtree owner, so that second pass was pure overhead.

Commit c210f83 skips the barrier unless the workspace has multiple importers. The 31 targeted workspace resolver tests pass, including both owner-context regressions, and the full pre-push checks pass. The pushed commit has triggered a fresh benchmark run.


Written by an agent (Codex, GPT-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit c210f83

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

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 dbc5cfc

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs (1)

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

Duplicate HoistMissingScope construction — extract a helper.

The same 3-field HoistMissingScope (importer_id, first_importer_by_pkg, first_walk_missing_by_pkg) is built here and again inline in complete_required_round's fixpoint loop (Lines 594-598). A future field addition/rename to HoistMissingScope that only updates one site would silently reintroduce inconsistent owner-scoping between the initial round and subsequent rounds.

♻️ Suggested extraction
+    fn build_hoist_missing_scope(&self) -> HoistMissingScope {
+        HoistMissingScope {
+            importer_id: self.importer_id.clone(),
+            first_importer_by_pkg: self.ctx.workspace().first_importer_by_pkg(),
+            first_walk_missing_by_pkg: self.ctx.workspace().first_walk_missing_by_pkg(),
+        }
+    }
+
     pub(crate) fn apply_owner_missing_scope(&self, round: &mut RequiredRound) {
-        apply_hoist_missing_scope(
-            &mut round.peers_result,
-            &HoistMissingScope {
-                importer_id: self.importer_id.clone(),
-                first_importer_by_pkg: self.ctx.workspace().first_importer_by_pkg(),
-                first_walk_missing_by_pkg: self.ctx.workspace().first_walk_missing_by_pkg(),
-            },
-        );
+        apply_hoist_missing_scope(&mut round.peers_result, &self.build_hoist_missing_scope());
     }
             let RequiredRound { snapshot, original_node_ids, peers_result } =
                 first_round.take().unwrap_or_else(|| {
-                    self.resolve_required_round(Some(Arc::new(HoistMissingScope {
-                        importer_id: self.importer_id.clone(),
-                        first_importer_by_pkg: self.ctx.workspace().first_importer_by_pkg(),
-                        first_walk_missing_by_pkg: self.ctx.workspace().first_walk_missing_by_pkg(),
-                    })))
+                    self.resolve_required_round(Some(Arc::new(self.build_hoist_missing_scope())))
                 });

Also applies to: 583-599

🤖 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_importer.rs` around lines 528
- 537, Extract a shared helper on the surrounding resolver type that constructs
and returns HoistMissingScope using importer_id, first_importer_by_pkg, and
first_walk_missing_by_pkg. Update apply_owner_missing_scope and the
complete_required_round fixpoint loop to call this helper instead of
constructing HoistMissingScope inline, preserving identical owner-scoping
behavior across both paths.
pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs (1)

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

Document the cross-importer barrier invariant behind owner-scope filtering. The correctness of missing-peer suppression depends on every importer's initial required round finishing (and recording into the shared WorkspaceTreeCtx) before apply_owner_missing_scope runs for any importer; this is currently enforced only by the accidental structure of three separate loops, with no comment stating the precondition at either the enforcing site or the function that relies on it.

  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs#L290-301: add a comment above the three-loop sequence explaining that loop 2 (apply_owner_missing_scope) must run only after loop 1 (prepare_initial_required_round) has finished for every importer, since it depends on the fully-populated first_importer_by_pkg/first_walk_missing_by_pkg maps.
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs#L528-537: add a doc comment on apply_owner_missing_scope stating its precondition (must be called only after all importers' initial required rounds have completed) so the contract travels with the function, not just its current call site.
🤖 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_workspace.rs` at line 1,
Document the cross-importer ordering contract in the three-loop sequence in
resolve_workspace.rs: explain that apply_owner_missing_scope must run only after
prepare_initial_required_round has completed for every importer because it
relies on fully populated first_importer_by_pkg and first_walk_missing_by_pkg
maps. Add a doc comment to apply_owner_missing_scope in resolve_importer.rs
stating the same precondition.
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs (1)

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

Document the single-use, consuming contract of apply_hoist_missing_scope.

result.missing_ancestor_pkg_ids.remove(peer_name) destructively drains the ancestor-chain map. A second invocation on the same ResolvePeersResult would find empty ancestor chains for every peer_name, causing zip to yield zero pairs and retain to silently drop all of that peer's missing issues — a full, hard-to-detect loss of diagnostics rather than a crash. Currently only apply_owner_missing_scope calls this once per round, but nothing documents that this must not be called twice.

📝 Suggested doc comment
+/// Consumes (drains) `result.missing_ancestor_pkg_ids` while filtering
+/// `result.peer_dependency_issues.missing`. Must be called at most once
+/// per `ResolvePeersResult` — a second call would find no recorded
+/// ancestor chains and silently drop every remaining missing-peer issue.
 pub(crate) fn apply_hoist_missing_scope(
     result: &mut ResolvePeersResult,
     scope: &HoistMissingScope,
 ) {
🤖 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_peers.rs` around lines 368 -
384, Document the single-use, consuming contract on apply_hoist_missing_scope:
its removal of entries from result.missing_ancestor_pkg_ids means it must not be
invoked more than once for the same ResolvePeersResult, or subsequent calls will
discard missing peer issues. Keep the implementation unchanged and make the
warning explicit in the function’s documentation.
🤖 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.

Nitpick comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs`:
- Around line 528-537: Extract a shared helper on the surrounding resolver type
that constructs and returns HoistMissingScope using importer_id,
first_importer_by_pkg, and first_walk_missing_by_pkg. Update
apply_owner_missing_scope and the complete_required_round fixpoint loop to call
this helper instead of constructing HoistMissingScope inline, preserving
identical owner-scoping behavior across both paths.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs`:
- Around line 368-384: Document the single-use, consuming contract on
apply_hoist_missing_scope: its removal of entries from
result.missing_ancestor_pkg_ids means it must not be invoked more than once for
the same ResolvePeersResult, or subsequent calls will discard missing peer
issues. Keep the implementation unchanged and make the warning explicit in the
function’s documentation.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs`:
- Line 1: Document the cross-importer ordering contract in the three-loop
sequence in resolve_workspace.rs: explain that apply_owner_missing_scope must
run only after prepare_initial_required_round has completed for every importer
because it relies on fully populated first_importer_by_pkg and
first_walk_missing_by_pkg maps. Add a doc comment to apply_owner_missing_scope
in resolve_importer.rs stating the same precondition.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ea526e9-9d9e-46ff-a326-393c65432298

📥 Commits

Reviewing files that changed from the base of the PR and between a8dff6f and dbc5cfc.

📒 Files selected for processing (4)
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13432
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,454.39 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
303.05 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
299.85 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.66 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,420.53 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,468.78 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
289.01 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit bcd0b3c into main Jul 27, 2026
37 checks passed
@zkochan
zkochan deleted the test-n8n branch July 27, 2026 14:42
zkochan added a commit that referenced this pull request Jul 27, 2026
Restore the integrity hash collected while resolving commit-addressed
git-hosted archives. This keeps Rust pnpm aligned with the TypeScript security
behavior that pins downloaded archive bytes in the lockfile.

Revert only the git integrity portion of #13432; retain its peer
resolution and libc serialization changes.
@qodo-code-review qodo-code-review Bot mentioned this pull request Jul 29, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants