Skip to content

perf(pacquet): bound memory in peer-heavy hoisted installs - #13545

Merged
zkochan merged 6 commits into
mainfrom
fix-13540
Aug 1, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-13540

Conversation

@zkochan

@zkochan zkochan commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #13540.

Large peer-heavy installs through the Rust engine expanded a few thousand packages into millions
of temporary dependency-tree occurrences. Cache hits happened only after their lazy children had
been materialized, and discovery retained occurrence-keyed state that was not needed by the final
graph. Hoisted linking then expanded nested conflict roots into very deep node_modules paths.

This change:

  • checks pure-package and peers-cache entries before materializing lazy children, streams deferred
    children on true cache misses, and retains only nodes needed as peer providers;
  • indexes peer-relevant child providers once per evolving workspace graph instead of rescanning every
    child for each cached peer lookup;
  • structurally shares ancestor chains, missing-peer summaries, package data, peer maps, and
    dependency-path strings across repeated contexts;
  • recursively hoists nested package-conflict roots so the linker receives a bounded graph instead
    of hundreds of thousands of deeply nested paths; and
  • adds a deterministic integrated benchmark for the shared-subgraph peer-resolution failure mode,
    comparing Rust HEAD with main and TypeScript pnpm and requiring Rust to remain at least 10x faster.

The linked draft #13538 implements two bounded allocation reductions but explicitly leaves
the occurrence-keyed discovery state and hoisted-linker expansion unresolved. This PR includes those
reductions and addresses both remaining costs.

This is Rust-only. The TypeScript engine remains the behavioral reference, the emitted lockfile
contract is unchanged, and there is no TypeScript-side behavior to port.

The issue reproduction was run with @bitdev and @teambit scoped to
https://node-registry.bit.cloud/. To isolate resolver CPU from registry latency, the comparison
used fresh output directories with no lockfile, offline lockfileOnly installs, and the same
prewarmed metadata cache generated from that registry:

Engine Wall time Peak RSS
TypeScript pnpm 11.19 17.30–17.49 s 3.92–3.98 GiB
Rust before the provider index 19.60 s 2.88 GiB
Rust after the provider index 5.82–8.40 s 2.71–2.98 GiB

The final Rust implementation is 2.1–3.0x faster than TypeScript on this controlled reproduction.
The Rust lockfile before and after the optimization is byte-identical: 2,781,634 bytes with SHA-256
4a02feb99f5d1af834803a9bf3ba57a445f72488af1cb89a068355d63e019d45.

The permanent integrated case is self-contained so registry metadata cannot drift. It generates a
five-layer, 80-package-wide DAG: 400 peer-dependent packages, 25,600 shared dependency edges, and
more than 3.3 billion possible root-to-leaf occurrence paths. An online lockfile-only pass warms
metadata, then the timed pass removes the lockfile and resolves offline without linking. Three runs
produced:

Engine Mean wall time Relative to fixed Rust
Rust at PR HEAD 1.453 ± 0.133 s 1.00x
Rust at PR base 5.231 ± 0.626 s 3.60x slower
TypeScript pnpm 11.19 25.127 ± 0.107 s 17.29x slower

The earlier 24% example compared HEAD with intermediate commit 6ebf80d432, which already contained
most of the fix. Comparing with the actual PR base exposes the intended 3.60x reduction. The
benchmark also performs an untimed correctness pass and fails if target lockfiles differ. All three
lockfiles are byte-identical: 2,526,383 bytes with SHA-256
241575b87b2202d92c05fd313191afd0531162abe188a939c49e83deb0bb7b8c.

Resolver benchmarks also improved:

Benchmark Before After
Full workspace resolution 389–410 ms 336.72 ms
Peer-heavy workspace resolution 2.10–2.14 s 981.60 ms

The corrected nested hoister graph has 4,755 occurrences at maximum depth 5; before recursively
hoisting conflict roots, the same graph expanded to roughly 222,000 deeply nested paths.

Validation:

  • Controlled Bit-registry reproduction against TypeScript pnpm 11.19: Rust is 2.1–3.0x faster;
    pre-index and post-index Rust lockfiles are byte-identical.
  • Deterministic integrated peer-heavy benchmark: fixed Rust is 3.60x faster than the PR base and
    17.29x faster than TypeScript; all target lockfiles are byte-identical.
  • just ready: 7,529 tests passed, 4 skipped; formatting, checks, and clippy passed.
  • just dylint: passed.
  • Pre-push TypeScript compile/lint/spellcheck and Rust fmt/clippy/rustdoc/dylint/typos/TOML checks:
    passed.
  • pnpm change status: passed.

Squash Commit Body

Stream lazy child resolution through caches and share ancestry, missing-peer summaries, package
data, and dependency paths across repeated peer contexts. Retain only discovery nodes needed as
peer providers instead of occurrence state for every cache-served visit.

Index peer-provider children once per evolving workspace graph so cached peer lookup and lazy
provider previews avoid repeatedly scanning every dependency edge.

Recursively hoist nested conflict roots so the hoisted linker does not expand a small dependency
graph into deeply repeated node_modules paths.

Add a deterministic integrated benchmark that compares the peer-heavy resolver against main and
TypeScript pnpm while enforcing byte-identical lockfiles.

Closes pnpm/pnpm#13540.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

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

Summary by CodeRabbit

  • Performance

    • Reduced memory usage when resolving peer-heavy dependency graphs.
    • Limited unnecessary dependency-path expansion in deeply nested hoisted graphs.
    • Improved caching and deferred resolution for faster dependency processing.
  • Bug Fixes

    • Improved peer resolution for aliases, provider reuse, optional providers, and importer-specific contexts.
    • Improved handling of version conflicts, missing peers, cycles, and nested hoisting.
    • Preserved relevant dependency nodes for more accurate results.
    • Improved workspace hoisting and locator handling across nested projects.
    • Improved consistency when resolving dependencies across complex workspace layouts.

Stream lazy child resolution through caches and share ancestry and missing-peer state
across repeated peer contexts. Recursively hoist nested conflict roots so the linker does
not create deeply repeated paths.

Closes #13540.
Copilot AI review requested due to automatic review settings August 1, 2026 06:27
@coderabbitai

coderabbitai Bot commented Aug 1, 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

The resolver shares ancestry, peer, missing-peer, and dependency-path state. Peer discovery defers child realization and reuses cached state. Nested hoisting processes each result node independently. A peer-heavy benchmark measures lockfile parity and performance.

Changes

Peer resolution and hoisting

Layer / File(s) Summary
Shared ancestry and dependency-tree contracts
pnpm/crates/deps-path/src/dep_path.rs, pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs, pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs, pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
DepPath and lazy dependency-tree ancestry use shared storage. AncestorIds supports immutable extension and cycle checks.
Shared peer-discovery state
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
Peer caches, provider contexts, ancestry chains, peer maps, missing summaries, deferred children, and retained nodes use shared state.
Peer retention and cache validation
pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
Tests cover retained materialized nodes and updated shared cache representations.
Nested hoisting and conflict coverage
pnpm/crates/real-hoist/src/lib.rs, pnpm/crates/real-hoist/src/tests.rs, .changeset/quick-plums-hoist.md
Nested result nodes receive independent hoisting passes. Tests cover workspace limits and conflicting dependency versions. The changeset records a patch release.
Peer-heavy benchmark coverage
.github/workflows/pacquet-integrated-benchmark.yml, pnpm/tasks/integrated-benchmark/src/cli_args.rs, pnpm/tasks/integrated-benchmark/src/main.rs, pnpm/tasks/integrated-benchmark/src/work_env.rs, pnpm/tasks/integrated-benchmark/src/work_env/tests.rs, pnpm/tasks/integrated-benchmark/src/workspace_manifest.rs
The benchmark suite adds a deep peer-heavy fixture, registry seeding, offline resolution runs, lockfile parity checks, and a pacquet-versus-pnpm performance check.

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

Sequence Diagram(s)

sequenceDiagram
  participant DependencyResolver
  participant ResolvedTree
  participant PeerDiscovery
  participant RealHoist
  participant Benchmark
  DependencyResolver->>ResolvedTree: Share ancestor chains for lazy nodes
  DependencyResolver->>PeerDiscovery: Resolve providers with shared caches
  PeerDiscovery->>ResolvedTree: Preview or defer child materialization
  PeerDiscovery-->>DependencyResolver: Return peer and missing summaries
  DependencyResolver->>RealHoist: Pass the resolved result graph
  RealHoist->>RealHoist: Hoist each nested result node
  Benchmark->>PeerDiscovery: Run peer-heavy resolution scenario
  Benchmark->>Benchmark: Compare lockfiles and performance
Loading

Assessment against linked issues

Objective Addressed Explanation
Reduce intermediate memory used by peer-heavy dependency resolution and hoisted linking [#13540] ✅
Prevent excessive dependency-path expansion in nested hoisted graphs [#13540] ✅

Possibly related issues

  • pnpm/pacquet#438 — Modifies real-hoist nested workspace and importer locator handling.
  • pnpm/tasks#16 — Targets the same peer-resolution walks, caching, ancestry tracking, and hoisting paths.

Possibly related PRs

  • pnpm/pnpm#13491 — Shares resolver and peer-discovery optimization paths.
  • pnpm/pnpm#13506 — Modifies peer discovery, caching, and ownership handling in the same resolver flow.
  • pnpm/pnpm#13172 — Overlaps resolve_peers.rs ancestry, caching, and peer-resolution changes.

Suggested labels: product: pacquet

Suggested reviewers: copilot

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

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

perf(pacquet): bound memory in peer-heavy hoisted installs

✨ Enhancement 🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Reduce peer-resolution allocations by caching before child materialization and sharing
 ancestry/state.
• Replace occurrence-keyed peer-discovery retention with provider-only retention and shared
 summaries.
• Recursively hoist nested conflict roots to prevent linker path explosion in hoisted installs.
Diagram

graph TD
  A["resolve_dependency_tree"] --> B["ResolvedTree / TreeChildren"] --> C[("Peer caches")]
  C --> D["resolve_peers Walker"] --> E[("DependenciesGraph")]
  D --> F["DepPath (Arc<str>)"]
  E --> G["real-hoist"] --> H["node_modules layout"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use a persistent-collections crate (e.g., im) for chains/summaries
  • ➕ Less custom code for SharedChain/MissingSummary semantics
  • ➕ Potentially richer API for structural sharing and iteration
  • ➖ Adds dependency and potential perf/alloc overhead vs tailored Arc links
  • ➖ Harder to integrate with existing ownership/lifetime patterns in hot path
2. Arena + index-based IDs for occurrences and summaries
  • ➕ Very low per-node overhead; cheap clones via Copy indices
  • ➕ Centralized memory management could simplify undo/eviction logic
  • ➖ Higher implementation risk; requires pervasive API changes across resolver/peer code
  • ➖ More difficult correctness auditing for cycle detection and cache matching

Recommendation: Current approach is a good fit: it bounds memory by (1) checking caches before materializing lazy children, (2) structurally sharing ancestry and missing-peer summaries, and (3) pruning discovery retention to peer-provider-relevant nodes. Alternatives (persistent-collections crate or an arena) could reduce bespoke code further, but would increase dependency risk or require wider invasive refactors in critical resolver hot paths.

Files changed (12) +1199 / -440

Enhancement (3) +1085 / -394
dep_path.rsIntern DepPath storage with Arc<str> +5/-3

Intern DepPath storage with Arc<str>

• Changes DepPath’s internal representation from String to Arc<str> and updates constructors to share string storage across repeated contexts.

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

resolve_peers.rsBound peer-resolution memory via cache-first lazy streaming and shared state +1019/-389

Bound peer-resolution memory via cache-first lazy streaming and shared state

• Adds cache-first fast paths (purePkgs and peersCache) before child realization, streams deferred children on true misses, and retains only peer-provider-relevant node state during discovery. Introduces structural sharing for ancestor/name chains and missing-peer summaries, and reduces cloning via Arc-wrapped maps and DepPath sharing.

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

resolved_tree.rsIntroduce AncestorIds and update TreeChildren::Lazy contract +61/-2

Introduce AncestorIds and update TreeChildren::Lazy contract

• Adds AncestorIds (base + appended shared storage) and switches TreeChildren::Lazy parent_ids to use it, enabling cheaper sibling/peer-context sharing while preserving cycle detection.

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

Bug fix (1) +20 / -5
lib.rsRecursively hoist nested conflict roots +20/-5

Recursively hoist nested conflict roots

• Invokes a new hoist_nested_roots pass after hoisting into the root to bound nested conflict-root expansion and reduce deeply nested node_modules paths.

pnpm/crates/real-hoist/src/lib.rs

Refactor (2) +33 / -18
lib.rsRe-export AncestorIds for resolver consumers +2/-2

Re-export AncestorIds for resolver consumers

• Exposes the new AncestorIds type from resolved_tree for use across resolver modules and tests.

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

resolve_dependency_tree.rsThread shared ancestor IDs through lazy children and parent tracking +31/-16

Thread shared ancestor IDs through lazy children and parent tracking

• Reworks ancestor tracking to use Arc<Vec<String>> roots and a shared AncestorIds wrapper, reducing cloning while keeping cycle-detection semantics consistent across realized/lazy paths.

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

Tests (5) +56 / -23
tests.rsAdapt lockfile snapshot test to new lazy-parent-ids type +1/-1

Adapt lockfile snapshot test to new lazy-parent-ids type

• Updates test construction of TreeChildren::Lazy to use the new parent-ids wrapper conversion.

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

tests.rsExtend hoist conflict test to cover nested-root hoisting +16/-4

Extend hoist conflict test to cover nested-root hoisting

• Expands the version-conflict test scenario to ensure descendants are hoisted into the nested conflict root while preserving root conflicts.

pnpm/crates/real-hoist/src/tests.rs

tests.rsUpdate dependency-tree tests for AncestorIds-backed lazy edges +1/-1

Update dependency-tree tests for AncestorIds-backed lazy edges

• Adjusts tests that build lazy nodes to construct the new parent-ids type via Into conversion.

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

tests.rsRefactor peer-resolver tests for Arc/shared-chain structures +16/-17

Refactor peer-resolver tests for Arc/shared-chain structures

• Updates tests to use SharedChain for ancestor tracking and Arc-wrapped peer maps; adjusts purePkgs markers and expectations accordingly.

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

tests.rsAdd AncestorIds cycle-detection unit tests +22/-0

Add AncestorIds cycle-detection unit tests

• Introduces focused tests validating forms_cycle behavior across both base and appended ancestor segments.

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

Documentation (1) +5 / -0
quick-plums-hoist.mdAdd changeset for peer-heavy memory and hoist-path fix +5/-0

Add changeset for peer-heavy memory and hoist-path fix

• Adds a patch changeset noting reduced memory use in peer-heavy resolution and preventing nested hoisted graphs from expanding into excessive dependency paths.

.changeset/quick-plums-hoist.md

@greptile-apps

greptile-apps Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (6): Last reviewed commit: "docs(pacquet): explain benchmark prewarm" | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.2±0.05ms    33.4 MB/sec    1.05     11.8±0.10ms    31.7 MB/sec
packument/parse                                  1.02     39.1±0.30µs  1696.7 MB/sec    1.00     38.5±0.12µs  1724.9 MB/sec
tarball/download_dependency                      1.02      2.4±0.09ms  1810.9 KB/sec    1.00      2.4±0.08ms  1841.5 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    177.0±1.91ms 90.4 KElem/sec    1.00    177.7±3.56ms 90.0 KElem/sec

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.

Pull request overview

This PR reduces peak memory and pathological node_modules path expansion in pacquet (the Rust engine) for peer-heavy, hoisted installs by avoiding unnecessary occurrence materialization, increasing structural sharing across repeated peer contexts, and recursively hoisting nested conflict roots so the linker receives a bounded graph.

Changes:

  • Introduces shared ancestor-chain representations (AncestorIds, SharedChain) and updates lazy-children handling to avoid copying ancestor vectors and to enable cache checks before materializing lazy children.
  • Makes peer-resolution caches and “missing peer” summaries structurally shareable (using Arc<...> and a persistent summary structure) to reduce repeated allocations across revisits.
  • Recursively hoists nested package-conflict roots in the hoister to prevent deep repeated node_modules paths, plus adds/updates tests and a changeset.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs Adds AncestorIds, updates TreeChildren::Lazy to use it, and wires module tests.
pnpm/crates/resolving-deps-resolver/src/resolved_tree/tests.rs Adds a focused test for ancestor-cycle detection across base + appended chains.
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs Refactors peer discovery/walker to use shared chains, earlier cache checks, structurally shared maps/summaries, and reduced retained per-occurrence state.
pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs Updates tests for new cache/map shapes (Arc<HashMap>, pure_pkgs: HashMap, etc.).
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs Switches lazy parent-id threading to the new ancestor representation and avoids per-seed empty vec allocations.
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs Updates tests for TreeChildren::Lazy { parent_ids: AncestorIds }.
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs Updates tests to match AncestorIds in lazy nodes.
pnpm/crates/deps-path/src/dep_path.rs Changes DepPath storage to Arc<str> to reduce depPath string duplication.
pnpm/crates/real-hoist/src/lib.rs Adds recursive hoisting for nested conflict roots (hoist_nested_roots) and updates docs.
pnpm/crates/real-hoist/src/tests.rs Strengthens the conflict test to cover hoisting descendants of nested conflict roots.
pnpm/crates/resolving-deps-resolver/src/lib.rs Re-exports AncestorIds from the crate API surface.
.changeset/quick-plums-hoist.md Adds a pacquet patch changeset describing the memory/path-expansion reduction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pnpm/crates/real-hoist/src/lib.rs Resolved
Comment thread pnpm/crates/real-hoist/src/lib.rs Resolved
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. Hoist limits bypassed ✓ Resolved 🐞 Bug ⛨ Security
Description
hoist_nested_roots builds a package-based locator (e.g. [email protected]) and passes it to
hoist_into_root, but hoist_into_root applies borders by looking up opts.hoisting_limits by the
*root/importer locator*, so nested hoists likely run with an empty border set. This can violate
configured hoisting borders inside nested conflict roots and change the resulting node_modules
layout/module resolution compared to the configured policy.
Code

pnpm/crates/real-hoist/src/lib.rs[R611-623]

+fn hoist_nested_roots(root: &Rc<HoisterResult>, opts: &HoistOpts) {
+    let mut visited = HashSet::from([Rc::as_ptr(root)]);
+    let mut pending: Vec<Rc<HoisterResult>> =
+        root.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)).collect();
+    while let Some(node) = pending.pop() {
+        if !visited.insert(Rc::as_ptr(&node)) {
+            continue;
+        }
+        let reference = node.references.borrow().iter().next().cloned().unwrap_or_default();
+        let locator = format!("{}@{reference}", node.ident_name);
+        hoist_into_root(&node, &locator, opts);
+        pending.extend(node.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)));
+    }
Relevance

●● Moderate

No historical evidence found about nested-hoist hoisting_limits keying/border enforcement; unclear
team stance.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
HoistingLimits is defined/documented as keyed by importer locators, and hoist_into_root selects
its border set by looking up opts.hoisting_limits with the passed root_locator. The new
hoist_nested_roots instead passes a package locator built from ident_name@reference, so the
lookup will typically miss and borders won’t be enforced during nested hoists.

pnpm/crates/real-hoist/src/lib.rs[611-623]
pnpm/crates/real-hoist/src/lib.rs[719-741]
pnpm/crates/real-hoist/src/lib.rs[134-143]

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

## Issue description
`hoist_nested_roots` calls `hoist_into_root` for every reachable node, but it constructs a per-package `locator` from `ident_name@reference`. `hoist_into_root` uses its `root_locator` argument to select the hoisting border set (`opts.hoisting_limits.get(root_locator)`), and `HoistingLimits` is documented as keyed by importer locators (e.g. `.@`). As a result, nested hoists will usually miss the configured limits and run without borders.

## Issue Context
This is introduced by the new nested-root recursion in `nm_hoist`. The initial root hoist uses an importer/root locator, but nested invocations switch to package locators.

## Fix Focus Areas
- pnpm/crates/real-hoist/src/lib.rs[589-624]
- pnpm/crates/real-hoist/src/lib.rs[719-741]
- pnpm/crates/real-hoist/src/lib.rs[134-143]

## What to change
1. Thread the correct *importer/root locator* into `hoist_nested_roots` (e.g. pass `&root_locator` from `nm_hoist`) and use that locator when calling `hoist_into_root` for nested roots, so nested hoists respect the same border set as the top-level hoist.
  - Alternatively, change `hoist_into_root` to accept `border_names` directly, computed once from the importer/root locator, and reuse it for all nested calls.
2. Add a regression test that sets a `hoisting_limits` entry for the importer locator (e.g. `.@`) and constructs a graph that triggers nested-root hoisting; assert that descendants do not hoist past the configured border under nested roots.

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



Remediation recommended

2. Mean-based speedup assertion 🐞 Bug ☼ Reliability ⭐ New
Description
verify_peer_heavy_pacquet_pnpm_ratio hard-fails the peer-heavy benchmark if `pnpm@HEAD /
pacquet@HEAD < 10x` using hyperfine *mean* seconds, which is sensitive to shared-runner contention
and can cause spurious CI failures.
This contradicts the workflow’s own rationale for using minimum latency as the noise-resistant
signal, reducing the trustworthiness of the perf gate.
Code

pnpm/tasks/integrated-benchmark/src/work_env.rs[R1180-1202]

+    fn verify_peer_heavy_pacquet_pnpm_ratio(&self, diagnostics: &BenchmarkDiagnostics) {
+        if self.scenario != Some(BenchmarkScenario::IsolatedPeerHeavyResolveHotCacheOffline)
+            || !self
+                .targets
+                .iter()
+                .any(|target| target.kind == TargetKind::Pnpm && target.rev == "HEAD")
+            || !self
+                .targets
+                .iter()
+                .any(|target| target.kind == TargetKind::Pacquet && target.rev == "HEAD")
+        {
+            return;
+        }
+        let pacquet = benchmark_target_mean(diagnostics, "pacquet@HEAD");
+        let pnpm = benchmark_target_mean(diagnostics, "pnpm@HEAD");
+        let speedup = pnpm / pacquet;
+        assert!(
+            speedup >= PACQUET_PNPM_SPEEDUP_MIN,
+            "pacquet@HEAD was only {speedup:.2}x faster than pnpm@HEAD on the peer-heavy DAG; \
+             required at least {PACQUET_PNPM_SPEEDUP_MIN:.2}x \
+             (pacquet {pacquet:.3}s, pnpm {pnpm:.3}s)",
+        );
+    }
Relevance

●●● Strong

PR pnpm/pnpm#13111 explicitly switched perf gating to hyperfine *min* to avoid mean-based CI noise/false
alerts.

PR-#13111

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new CI gate computes speedup using benchmark_target_mean (mean seconds) and asserts it is at
least PACQUET_PNPM_SPEEDUP_MIN (10x). Separately, the workflow text explains that minimum latency
is used for thresholding specifically to avoid shared-runner contention noise, highlighting the
mismatch that can produce spurious failures.

pnpm/tasks/integrated-benchmark/src/work_env.rs[1073-1090]
pnpm/tasks/integrated-benchmark/src/work_env.rs[1180-1202]
.github/workflows/pacquet-integrated-benchmark.yml[438-445]

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 new peer-heavy perf gate asserts a 10x pacquet-vs-pnpm speedup using hyperfine **mean** time (`hyperfine_mean_seconds`). Mean is notably sensitive to shared-runner contention/outliers, so this assertion can fail even when pacquet’s typical performance hasn’t regressed.

### Issue Context
The workflow text explicitly states that Bencher thresholds on **minimum** latency because it is far less perturbed by shared-runner contention. The current implementation gates on **mean**, creating a mismatch between the stated noise model and the enforcement signal.

### Fix Focus Areas
- pnpm/tasks/integrated-benchmark/src/work_env.rs[1180-1202]

### What to change
- Prefer a noise-resistant metric for gating (e.g., hyperfine `min` or `median`) rather than `mean`.
 - If hyperfine JSON already contains `min`/`median`, extend `HyperfineCommand` parsing and `BenchmarkTargetDiagnostics` to store it, then compute the ratio from that metric.
- Consider loosening/removing the fixed `10.0x` hard assertion or making it configurable (env/flag), to avoid environment-specific false negatives.
- Keep the assertion aligned with whatever metric Bencher uses (min) so the CI comment and CI gate tell the same story.

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


3. Provider index rescanned per pass 🐞 Bug ➹ Performance
Description
Walker::new iterates over the entire tree.children_by_id map on every construction even when
peer_provider_children_by_pkg_id is already fully populated, adding avoidable O(#packages) work to
each discovery pass. In large workspaces with many importers/rounds, this repeated outer scan can
materially erode the intended performance wins (even though edge-level work is skipped for
already-indexed packages).
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R1069-1076]

+        if peer_provider_index_peer_names != tree.all_peer_dep_names {
+            peer_provider_children_by_pkg_id.clear();
+            peer_provider_index_peer_names.clone_from(&tree.all_peer_dep_names);
+        }
+        for (pkg_id, children) in &tree.children_by_id {
+            if peer_provider_children_by_pkg_id.contains_key(pkg_id) {
+                continue;
+            }
Relevance

●●● Strong

Team repeatedly accepts removing per-pass O(N) work in resolver hot paths (e.g., gating full
traversals in PR pnpm/pnpm#13172).

PR-#13172
PR-#13459
PR-#13510

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The index build path traverses tree.children_by_id each time Walker::new is called, and
discovery creates a new Walker per pass while reusing caches, so the scan repeats even when no new
packages were added (the loop body is skipped, but the outer traversal remains).

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[386-416]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1051-1099]

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

### Issue description
`Walker::new` always loops over all `tree.children_by_id` entries to check `contains_key(pkg_id)` even when the provider index is already complete. This adds repeated O(#packages) overhead to each discovery pass.

### Issue Context
`PeerHoistDiscovery::discover` creates a new `Walker` for each discovery call, while `PeerDiscoveryCaches` persists between calls, so the provider index is often already populated.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1069-1099]

### Implementation notes
- Add a fast-path guard before the `for (pkg_id, children) in &tree.children_by_id` loop, e.g.:
 - If `peer_provider_index_peer_names == tree.all_peer_dep_names` **and** `peer_provider_children_by_pkg_id.len() == tree.children_by_id.len()`, skip the loop entirely.
- Keep the existing rebuild-on-peer-names-change behavior.
- If you want to be extra safe: when lengths match, you can still debug-assert that all keys exist in `peer_provider_children_by_pkg_id` in debug builds.

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


4. Quadratic retention check 🐞 Bug ➹ Performance
Description
In undo_realize, each newly_inserted node calls should_retain_materialized_node, which (when
output is present) linearly scans output.external_resolved_peers and
output.auto_install_resolved_peers each time, making cleanup O(newly_inserted × peers). This can
add avoidable overhead in peer-heavy discovery walks where many temporary child nodes are
materialized then rolled back.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R3261-3263]

+        for child_id in &undo.newly_inserted {
+            if should_retain_materialized_node(&self.retained_peer_node_ids, output, child_id) {
+                continue;
Relevance

●●● Strong

Team often accepts resolver hot-path perf fixes avoiding repeated scans/allocations (accepted in PRs
#13459, pnpm/pnpm#13510, pnpm/pnpm#13172).

PR-#13459
PR-#13510
PR-#13172

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The cleanup loop calls the retention helper once per newly inserted node, and the helper performs
per-call linear scans over the output’s provider maps, producing O(newly_inserted × peers) work in
the worst case.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3254-3273]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3578-3591]

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

### Issue description
`undo_realize()` iterates over `undo.newly_inserted` and calls `should_retain_materialized_node(...)` for each node. When `output` is provided, `should_retain_materialized_node` scans the provider maps (`external_resolved_peers` and `auto_install_resolved_peers`) linearly per node, yielding O(children × peers) behavior.

### Issue Context
This code runs in the discovery rollback path that tries to remove temporary, materialized occurrence nodes. On peer-heavy graphs, both the number of temporarily inserted nodes and the number of peer-provider entries can be large.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3254-3273]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3578-3591]

### Suggested fix
In `undo_realize`, when `output.is_some()`, build a `HashSet<NodeId>` (or small optimized set) once containing:
- all `output.external_resolved_peers` values
- all `output.auto_install_resolved_peers` values
Then replace the per-child linear scans with an O(1) membership check against this precomputed set (while still keeping the fast `retained_peer_node_ids.contains(node_id)` short-circuit).

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



Informational

5. Real-name allocation in index 🐞 Bug ➹ Performance
Description
While building the peer-provider child index, the code allocates real_name via
pkg_name_version(..) for every child edge before deciding whether the edge is relevant, causing
avoidable allocations for edges that will be skipped. On large dependency graphs this adds
unnecessary allocator churn during index construction.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R1077-1084]

+            let mut providers = PeerProviderChildren::default();
+            for (edge_index, edge) in children.iter().enumerate() {
+                let Some(pkg) = tree.packages.get(&edge.pkg_id) else { continue };
+                let real_name = pkg_name_version(&pkg.result).0;
+                let alias_is_peer = tree.all_peer_dep_names.contains(&edge.alias);
+                let real_name_is_peer = tree.all_peer_dep_names.contains(&real_name);
+                if !alias_is_peer && !real_name_is_peer {
+                    continue;
Relevance

●●● Strong

Repo has accepted allocation-churn reductions on hot paths (e.g., avoiding extra String allocs in PR
#13417).

PR-#13417
PR-#13172
PR-#13510

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The index build loop unconditionally constructs real_name using pkg_name_version, which itself
creates owned Strings, and then discards it on the common continue path when the edge is not
peer-relevant.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1077-1096]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[122-128]

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 provider-index build calls `pkg_name_version(&pkg.result).0` (allocating a `String`) before it knows whether the edge will be kept. For edges where neither `edge.alias` nor the package real name is a peer name, this allocation is wasted.

### Issue Context
This happens inside the `Walker::new` provider-index construction loop over all package child edges.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1077-1096]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[122-128]

### Implementation notes
- Compute `alias_is_peer` first.
- Only compute/check the real package name when `alias_is_peer` is false.
- Prefer a borrowed real-name lookup when possible (e.g., use `pkg.result.name_ver.as_ref().map(|nv| nv.name.as_str())`) to check `all_peer_dep_names.contains(...)` without allocating.
- Only allocate a `String` for `real_name` when you actually need to insert it into `edge_indices_by_name` (and when it differs from `edge.alias`).

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


6. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset .changeset/quick-plums-hoist.md declares only pacquet and omits a pnpm entry
in its front-matter. This can cause the release/version bump process to miss updating pnpm as
required by the changeset policy.
Code

.changeset/quick-plums-hoist.md[R1-3]

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

● Weak

Same “changeset missing pnpm entry” suggestion consistently rejected in many recently merged PRs.

PR-#13404
PR-#13406
PR-#13459

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an entry for the pnpm
package. The added changeset front-matter includes only pacquet and does not declare pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/quick-plums-hoist.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 changeset front-matter is missing a required `pnpm` entry.

## Issue Context
Per the compliance checklist, newly added/modified changesets must explicitly declare the `pnpm` package and use an appropriate bump type.

## Fix Focus Areas
- .changeset/quick-plums-hoist.md[1-3]

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


7. Extra reference string clone ✓ Resolved 🐞 Bug ➹ Performance
Description
hoist_nested_roots clones the first reference String for every visited node before formatting
the locator, adding an extra allocation/copy on top of the unavoidable locator String allocation.
On large graphs this increases allocator churn in the new traversal.
Code

pnpm/crates/real-hoist/src/lib.rs[R619-621]

+        let reference = node.references.borrow().iter().next().cloned().unwrap_or_default();
+        let locator = format!("{}@{reference}", node.ident_name);
+        hoist_into_root(&node, &locator, opts);
Relevance

● Weak

Micro perf suggestions to avoid clones/allocations often rejected; likely considered low value vs
complexity.

PR-#13455
PR-#13506
PR-#12847

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new loop clones reference (.cloned().unwrap_or_default()) before constructing locator via
format!, so each visited node pays for both a reference clone and the locator allocation.

pnpm/crates/real-hoist/src/lib.rs[611-623]

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

## Issue description
In `hoist_nested_roots`, the code clones `reference` from `node.references` just to interpolate it into `format!(...)`. This adds an extra allocation/copy per visited node.

## Issue Context
The locator string still needs allocation, but the intermediate `reference.clone()` is avoidable.

## Fix Focus Areas
- pnpm/crates/real-hoist/src/lib.rs[611-623]

## What to change
Use a borrowed `&str`/`&String` from the `BTreeSet` iterator and format directly, e.g.:
- hold the `borrow()` in a variable, take `next()` as `Option<&String>`, and `map(String::as_str).unwrap_or("")` for the fallback, then `format!("{}@{}", node.ident_name, reference_str)`.
This removes the per-node reference clone while keeping behavior identical.

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


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit ad98aa6

Results up to commit d780c18 ⚖️ Balanced


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


Action required
1. Hoist limits bypassed ✓ Resolved 🐞 Bug ⛨ Security
Description
hoist_nested_roots builds a package-based locator (e.g. [email protected]) and passes it to
hoist_into_root, but hoist_into_root applies borders by looking up opts.hoisting_limits by the
*root/importer locator*, so nested hoists likely run with an empty border set. This can violate
configured hoisting borders inside nested conflict roots and change the resulting node_modules
layout/module resolution compared to the configured policy.
Code

pnpm/crates/real-hoist/src/lib.rs[R611-623]

+fn hoist_nested_roots(root: &Rc<HoisterResult>, opts: &HoistOpts) {
+    let mut visited = HashSet::from([Rc::as_ptr(root)]);
+    let mut pending: Vec<Rc<HoisterResult>> =
+        root.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)).collect();
+    while let Some(node) = pending.pop() {
+        if !visited.insert(Rc::as_ptr(&node)) {
+            continue;
+        }
+        let reference = node.references.borrow().iter().next().cloned().unwrap_or_default();
+        let locator = format!("{}@{reference}", node.ident_name);
+        hoist_into_root(&node, &locator, opts);
+        pending.extend(node.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)));
+    }
Relevance

●● Moderate

No historical evidence found about nested-hoist hoisting_limits keying/border enforcement; unclear
team stance.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
HoistingLimits is defined/documented as keyed by importer locators, and hoist_into_root selects
its border set by looking up opts.hoisting_limits with the passed root_locator. The new
hoist_nested_roots instead passes a package locator built from ident_name@reference, so the
lookup will typically miss and borders won’t be enforced during nested hoists.

pnpm/crates/real-hoist/src/lib.rs[611-623]
pnpm/crates/real-hoist/src/lib.rs[719-741]
pnpm/crates/real-hoist/src/lib.rs[134-143]

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

## Issue description
`hoist_nested_roots` calls `hoist_into_root` for every reachable node, but it constructs a per-package `locator` from `ident_name@reference`. `hoist_into_root` uses its `root_locator` argument to select the hoisting border set (`opts.hoisting_limits.get(root_locator)`), and `HoistingLimits` is documented as keyed by importer locators (e.g. `.@`). As a result, nested hoists will usually miss the configured limits and run without borders.

## Issue Context
This is introduced by the new nested-root recursion in `nm_hoist`. The initial root hoist uses an importer/root locator, but nested invocations switch to package locators.

## Fix Focus Areas
- pnpm/crates/real-hoist/src/lib.rs[589-624]
- pnpm/crates/real-hoist/src/lib.rs[719-741]
- pnpm/crates/real-hoist/src/lib.rs[134-143]

## What to change
1. Thread the correct *importer/root locator* into `hoist_nested_roots` (e.g. pass `&root_locator` from `nm_hoist`) and use that locator when calling `hoist_into_root` for nested roots, so nested hoists respect the same border set as the top-level hoist.
  - Alternatively, change `hoist_into_root` to accept `border_names` directly, computed once from the importer/root locator, and reuse it for all nested calls.
2. Add a regression test that sets a `hoisting_limits` entry for the importer locator (e.g. `.@`) and constructs a graph that triggers nested-root hoisting; assert that descendants do not hoist past the configured border under nested roots.

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



Informational
2. Extra reference string clone ✓ Resolved 🐞 Bug ➹ Performance
Description
hoist_nested_roots clones the first reference String for every visited node before formatting
the locator, adding an extra allocation/copy on top of the unavoidable locator String allocation.
On large graphs this increases allocator churn in the new traversal.
Code

pnpm/crates/real-hoist/src/lib.rs[R619-621]

+        let reference = node.references.borrow().iter().next().cloned().unwrap_or_default();
+        let locator = format!("{}@{reference}", node.ident_name);
+        hoist_into_root(&node, &locator, opts);
Relevance

● Weak

Micro perf suggestions to avoid clones/allocations often rejected; likely considered low value vs
complexity.

PR-#13455
PR-#13506
PR-#12847

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new loop clones reference (.cloned().unwrap_or_default()) before constructing locator via
format!, so each visited node pays for both a reference clone and the locator allocation.

pnpm/crates/real-hoist/src/lib.rs[611-623]

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

## Issue description
In `hoist_nested_roots`, the code clones `reference` from `node.references` just to interpolate it into `format!(...)`. This adds an extra allocation/copy per visited node.

## Issue Context
The locator string still needs allocation, but the intermediate `reference.clone()` is avoidable.

## Fix Focus Areas
- pnpm/crates/real-hoist/src/lib.rs[611-623]

## What to change
Use a borrowed `&str`/`&String` from the `BTreeSet` iterator and format directly, e.g.:
- hold the `borrow()` in a variable, take `next()` as `Option<&String>`, and `map(String::as_str).unwrap_or("")` for the fallback, then `format!("{}@{}", node.ident_name, reference_str)`.
This removes the per-node reference clone while keeping behavior identical.

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


3. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset .changeset/quick-plums-hoist.md declares only pacquet and omits a pnpm entry
in its front-matter. This can cause the release/version bump process to miss updating pnpm as
required by the changeset policy.
Code

.changeset/quick-plums-hoist.md[R1-3]

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

● Weak

Same “changeset missing pnpm entry” suggestion consistently rejected in many recently merged PRs.

PR-#13404
PR-#13406
PR-#13459

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an entry for the pnpm
package. The added changeset front-matter includes only pacquet and does not declare pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/quick-plums-hoist.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 changeset front-matter is missing a required `pnpm` entry.

## Issue Context
Per the compliance checklist, newly added/modified changesets must explicitly declare the `pnpm` package and use an appropriate bump type.

## Fix Focus Areas
- .changeset/quick-plums-hoist.md[1-3]

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


Results up to commit 6ebf80d ⚖️ Balanced


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


Remediation recommended
1. Quadratic retention check 🐞 Bug ➹ Performance
Description
In undo_realize, each newly_inserted node calls should_retain_materialized_node, which (when
output is present) linearly scans output.external_resolved_peers and
output.auto_install_resolved_peers each time, making cleanup O(newly_inserted × peers). This can
add avoidable overhead in peer-heavy discovery walks where many temporary child nodes are
materialized then rolled back.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R3261-3263]

+        for child_id in &undo.newly_inserted {
+            if should_retain_materialized_node(&self.retained_peer_node_ids, output, child_id) {
+                continue;
Relevance

●●● Strong

Team often accepts resolver hot-path perf fixes avoiding repeated scans/allocations (accepted in PRs
#13459, pnpm/pnpm#13510, pnpm/pnpm#13172).

PR-#13459
PR-#13510
PR-#13172

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The cleanup loop calls the retention helper once per newly inserted node, and the helper performs
per-call linear scans over the output’s provider maps, producing O(newly_inserted × peers) work in
the worst case.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3254-3273]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3578-3591]

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

### Issue description
`undo_realize()` iterates over `undo.newly_inserted` and calls `should_retain_materialized_node(...)` for each node. When `output` is provided, `should_retain_materialized_node` scans the provider maps (`external_resolved_peers` and `auto_install_resolved_peers`) linearly per node, yielding O(children × peers) behavior.

### Issue Context
This code runs in the discovery rollback path that tries to remove temporary, materialized occurrence nodes. On peer-heavy graphs, both the number of temporarily inserted nodes and the number of peer-provider entries can be large.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3254-3273]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[3578-3591]

### Suggested fix
In `undo_realize`, when `output.is_some()`, build a `HashSet<NodeId>` (or small optimized set) once containing:
- all `output.external_resolved_peers` values
- all `output.auto_install_resolved_peers` values
Then replace the per-child linear scans with an O(1) membership check against this precomputed set (while still keeping the fast `retained_peer_node_ids.contains(node_id)` short-circuit).

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


Results up to commit 33721eb ⚖️ Balanced


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


Remediation recommended
1. Provider index rescanned per pass 🐞 Bug ➹ Performance
Description
Walker::new iterates over the entire tree.children_by_id map on every construction even when
peer_provider_children_by_pkg_id is already fully populated, adding avoidable O(#packages) work to
each discovery pass. In large workspaces with many importers/rounds, this repeated outer scan can
materially erode the intended performance wins (even though edge-level work is skipped for
already-indexed packages).
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R1069-1076]

+        if peer_provider_index_peer_names != tree.all_peer_dep_names {
+            peer_provider_children_by_pkg_id.clear();
+            peer_provider_index_peer_names.clone_from(&tree.all_peer_dep_names);
+        }
+        for (pkg_id, children) in &tree.children_by_id {
+            if peer_provider_children_by_pkg_id.contains_key(pkg_id) {
+                continue;
+            }
Relevance

●●● Strong

Team repeatedly accepts removing per-pass O(N) work in resolver hot paths (e.g., gating full
traversals in PR pnpm/pnpm#13172).

PR-#13172
PR-#13459
PR-#13510

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The index build path traverses tree.children_by_id each time Walker::new is called, and
discovery creates a new Walker per pass while reusing caches, so the scan repeats even when no new
packages were added (the loop body is skipped, but the outer traversal remains).

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[386-416]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1051-1099]

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

### Issue description
`Walker::new` always loops over all `tree.children_by_id` entries to check `contains_key(pkg_id)` even when the provider index is already complete. This adds repeated O(#packages) overhead to each discovery pass.

### Issue Context
`PeerHoistDiscovery::discover` creates a new `Walker` for each discovery call, while `PeerDiscoveryCaches` persists between calls, so the provider index is often already populated.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1069-1099]

### Implementation notes
- Add a fast-path guard before the `for (pkg_id, children) in &tree.children_by_id` loop, e.g.:
 - If `peer_provider_index_peer_names == tree.all_peer_dep_names` **and** `peer_provider_children_by_pkg_id.len() == tree.children_by_id.len()`, skip the loop entirely.
- Keep the existing rebuild-on-peer-names-change behavior.
- If you want to be extra safe: when lengths match, you can still debug-assert that all keys exist in `peer_provider_children_by_pkg_id` in debug builds.

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



Informational
2. Real-name allocation in index 🐞 Bug ➹ Performance
Description
While building the peer-provider child index, the code allocates real_name via
pkg_name_version(..) for every child edge before deciding whether the edge is relevant, causing
avoidable allocations for edges that will be skipped. On large dependency graphs this adds
unnecessary allocator churn during index construction.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[R1077-1084]

+            let mut providers = PeerProviderChildren::default();
+            for (edge_index, edge) in children.iter().enumerate() {
+                let Some(pkg) = tree.packages.get(&edge.pkg_id) else { continue };
+                let real_name = pkg_name_version(&pkg.result).0;
+                let alias_is_peer = tree.all_peer_dep_names.contains(&edge.alias);
+                let real_name_is_peer = tree.all_peer_dep_names.contains(&real_name);
+                if !alias_is_peer && !real_name_is_peer {
+                    continue;
Relevance

●●● Strong

Repo has accepted allocation-churn reductions on hot paths (e.g., avoiding extra String allocs in PR
#13417).

PR-#13417
PR-#13172
PR-#13510

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The index build loop unconditionally constructs real_name using pkg_name_version, which itself
creates owned Strings, and then discards it on the common continue path when the edge is not
peer-relevant.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1077-1096]
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[122-128]

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 provider-index build calls `pkg_name_version(&pkg.result).0` (allocating a `String`) before it knows whether the edge will be kept. For edges where neither `edge.alias` nor the package real name is a peer name, this allocation is wasted.

### Issue Context
This happens inside the `Walker::new` provider-index construction loop over all package child edges.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[1077-1096]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs[122-128]

### Implementation notes
- Compute `alias_is_peer` first.
- Only compute/check the real package name when `alias_is_peer` is false.
- Prefer a borrowed real-name lookup when possible (e.g., use `pkg.result.name_ver.as_ref().map(|nv| nv.name.as_str())`) to check `all_peer_dep_names.contains(...)` without allocating.
- Only allocate a `String` for `real_name` when you actually need to insert it into `edge_indices_by_name` (and when it differs from `edge.alias`).

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


Qodo Logo

Comment thread pnpm/crates/real-hoist/src/lib.rs Resolved
@codecov-commenter

codecov-commenter commented Aug 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.49180% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.92%. Comparing base (c2b7cfb) to head (ad98aa6).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...rates/resolving-deps-resolver/src/resolve_peers.rs 89.84% 84 Missing ⚠️
...lving-deps-resolver/src/resolve_dependency_tree.rs 86.36% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   pnpm/pnpm#13545    +/-   ##
========================================
  Coverage   87.92%   87.92%            
========================================
  Files         550      550            
  Lines       96449    97060   +611     
========================================
+ Hits        84800    85343   +543     
- Misses      11649    11717    +68     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs (2)

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

Add a rustdoc contract tying package_name_matches to pkg_name_version.

package_name_matches reimplements, field by field, the name that pkg_name_version builds with name_ver.name.to_string(). The allocation-free comparison is the point, so keep it. But is_peer_relevant answers the same "does this package supply this name" question through pkg_name_version, so the repo now holds two spellings of one rule. If they drift, a child stops being recognized as a peer provider and depPaths change silently.

Document the invariant on package_name_matches: it must stay equivalent to pkg_name_version(result).0 == expected.

♻️ Proposed rustdoc
+/// Whether `result`'s real package name equals `expected`, without
+/// allocating the joined `@scope/bare` string.
+///
+/// Must stay equivalent to `pkg_name_version(result).0 == expected`.
 fn package_name_matches(result: &ResolveResult, expected: &str) -> bool {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs` around lines 130 -
143, Add rustdoc immediately above package_name_matches documenting the
invariant that its allocation-free comparison must remain equivalent to
pkg_name_version(result).0 == expected. Preserve the existing field-by-field
implementation and behavior; only establish this contract so future changes keep
it synchronized with pkg_name_version and is_peer_relevant.

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

Record why merge_realize_undo may discard the second prev_parent_ids.

merge_realize_undo keeps first.prev_parent_ids and drops the second one. That is correct only because both undos come from the same node_id and both captured the same pre-realization chain: preview_peer_provider_children reads parent_ids without flipping the node's children, so the later realize_children_with observes the identical Lazy chain. If a future change made the preview flip children to Realized, the second undo would carry a different chain and undo_realize would restore the wrong ancestry — silently changing cycle breaks on later occurrences.

State the invariant so the coupling is not rediscovered by debugging.

♻️ Proposed comment
+/// Both undos must describe the same node. `preview_peer_provider_children`
+/// leaves `children` on its `Lazy` arm, so both captured the same
+/// pre-realization chain and keeping `first.prev_parent_ids` is exact.
 fn merge_realize_undo(
🤖 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 944 -
955, Add a concise comment above merge_realize_undo documenting why
first.prev_parent_ids is retained: both undos must refer to the same node_id and
identical pre-realization parent chain because preview_peer_provider_children
reads parent_ids without changing children from Lazy to Realized. Note that
changing this preview behavior would make discarding second.prev_parent_ids
unsafe and could restore incorrect ancestry.
🤖 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/real-hoist/src/lib.rs`:
- Around line 611-624: The hoist_nested_roots function reconstructs locators
from an arbitrary first reference, which can select incorrect hoisting limits
when a HoisterResult has multiple references. Preserve the single
HoisterResult-to-locator mapping during conversion, as done for the root, and
use that retained locator when calling hoist_into_root for each nested node;
keep traversal and visited-node behavior unchanged.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs`:
- Around line 3364-3368: Align the deferred-child cleanup guard with
undo_realize: in the block removing entries from dependencies_tree,
node_dep_paths, and visited_this_call, require that the node is neither retained
in retained_peer_node_ids nor referenced by the returned output. Preserve
materialized nodes needed by retained peer resolutions so cached PeersCacheItem
entries continue to match and build_peer_id cannot access a removed node.

---

Nitpick comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs`:
- Around line 130-143: Add rustdoc immediately above package_name_matches
documenting the invariant that its allocation-free comparison must remain
equivalent to pkg_name_version(result).0 == expected. Preserve the existing
field-by-field implementation and behavior; only establish this contract so
future changes keep it synchronized with pkg_name_version and is_peer_relevant.
- Around line 944-955: Add a concise comment above merge_realize_undo
documenting why first.prev_parent_ids is retained: both undos must refer to the
same node_id and identical pre-realization parent chain because
preview_peer_provider_children reads parent_ids without changing children from
Lazy to Realized. Note that changing this preview behavior would make discarding
second.prev_parent_ids unsafe and could restore incorrect ancestry.
🪄 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: 6794d431-b52e-4ba1-836a-07f5e172c2c1

📥 Commits

Reviewing files that changed from the base of the PR and between a99b852 and d780c18.

📒 Files selected for processing (12)
  • .changeset/quick-plums-hoist.md
  • pnpm/crates/deps-path/src/dep_path.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/real-hoist/src/lib.rs
  • pnpm/crates/real-hoist/src/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/lib.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.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/resolved_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolved_tree/tests.rs

Comment thread pnpm/crates/real-hoist/src/lib.rs Resolved
@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to f53bf65

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Compare lockfiles semantically

Parse and compare lockfiles semantically rather than evaluating raw byte
equivalence.

pnpm/tasks/integrated-benchmark/src/work_env.rs [1117-1119]

-let contents =
-    fs::read(&path).unwrap_or_else(|error| panic!("read {path:?} for {id}: {error}"));
-(id.to_string(), contents)
+let contents = fs::read_to_string(&path)
+    .unwrap_or_else(|error| panic!("read {path:?} for {id}: {error}"));
+let lockfile: serde_yaml::Value = serde_yaml::from_str(&contents)
+    .unwrap_or_else(|error| panic!("parse {path:?} for {id}: {error}"));
+(id.to_string(), lockfile)

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 2

__

Why: Byte-for-byte lockfile parity is generally a strict requirement for drop-in package managers to avoid messy git diffs, so switching to semantic comparison would undesirably hide pacquet serialization regressions.

Low
Reject invalid benchmark timings

Assert that benchmark execution time means are positive and finite before
calculating the speedup ratio.

pnpm/tasks/integrated-benchmark/src/work_env.rs [1194-1198]

 let pacquet = benchmark_target_mean(diagnostics, "pacquet@HEAD");
 let pnpm = benchmark_target_mean(diagnostics, "pnpm@HEAD");
+assert!(
+    pacquet.is_finite() && pacquet > 0.0 && pnpm.is_finite() && pnpm > 0.0,
+    "peer-heavy benchmark means must be finite and positive \
+     (pacquet {pacquet:.3}s, pnpm {pnpm:.3}s)",
+);
 let speedup = pnpm / pacquet;
 assert!(
     speedup >= PACQUET_PNPM_SPEEDUP_MIN,

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 2

__

Why: Hyperfine mean execution times are inherently positive and finite unless there's a catastrophic runner failure, making these defensive floating-point checks highly pedantic and practically unnecessary.

Low
  • Update

Previous suggestions

Suggestions up to commit 33721eb
CategorySuggestion                                                                                                                                    Impact
Possible issue
Reject direct self-dependency edges

Add an explicit direct self-dependency check (pkg.id == edge.pkg_id) to prevent
infinite recursion during child traversal.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs [1810-1815]

             for edge in children.iter() {
                 if child_parent_refs.contains_key(&edge.alias) != repeated
+                    || pkg.id == edge.pkg_id
                     || parent_ids.forms_cycle(&pkg.id, &edge.pkg_id)
                 {
                     continue;
                 }
 ...
-        if full_chain.forms_cycle(&pkg_id, &edge.pkg_id) {
+        if pkg_id == edge.pkg_id || full_chain.forms_cycle(&pkg_id, &edge.pkg_id) {
             continue;
         }
Suggestion importance[1-10]: 5

__

Why: Explicitly checking for direct self-dependencies acts as a safeguard against potential infinite recursion if forms_cycle doesn't already handle the pkg.id == edge.pkg_id case.

Low
Suggestions up to commit d73a81c
CategorySuggestion                                                                                                                                    Impact
General
Avoid quadratic ancestor-chain copying

Change the appended property to a persistent linked chain (e.g., using a custom
AppendedAncestor struct) instead of a Vec. This provides O(1) push operations
and avoids repeated allocations and copying.

pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs [68-81]

+#[derive(Debug, Clone)]
+struct AppendedAncestor {
+    id: Arc<str>,
+    previous: Option<Arc<AppendedAncestor>>,
+}
+
 #[derive(Debug, Default, Clone)]
 pub struct AncestorIds {
     base: Arc<Vec<String>>,
-    appended: Arc<Vec<Arc<str>>>,
+    appended: Option<Arc<AppendedAncestor>>,
 }
 
 impl AncestorIds {
     #[must_use]
     pub fn pushed(&self, id: String) -> Self {
-        let mut appended = Vec::with_capacity(self.appended.len() + 1);
-        appended.extend(self.appended.iter().cloned());
-        appended.push(Arc::from(id));
-        Self { base: Arc::clone(&self.base), appended: Arc::new(appended) }
+        Self {
+            base: Arc::clone(&self.base),
+            appended: Some(Arc::new(AppendedAncestor {
+                id: Arc::from(id),
+                previous: self.appended.clone(),
+            })),
+        }
     }
+
+    // Update `forms_cycle` to walk `appended` through `previous`.
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion identifies a potential O(N²) memory allocation issue in pushed and offers a solid persistent linked list pattern that perfectly supports the PR's focus on memory reduction.

Medium
✅ Suggestions up to commit d780c18
CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Ensure deterministic locator string generation
Suggestion Impact:The commit removed the nondeterministic reference lookup and instead records each result node's locator from its unambiguous input tree during conversion, then reuses that locator when hoisting nested roots.

code diff:

-    // Compute the root locator from the input tree, where each
-    // node carries a single unambiguous `reference`. The result
-    // graph collects references into a `BTreeSet` (one
-    // `HoisterResult` can absorb several `HoisterTree` nodes with
-    // the same ident), so deriving the locator from a result
-    // node would mean picking an arbitrary entry from the set;
-    // doing it here keeps the lookup well-defined.
-    let root_locator = format!("{}@{}", tree.ident_name, tree.reference);
-    let mut memo: HashMap<*const HoisterTree, Rc<HoisterResult>> = HashMap::new();
-    let root = convert(tree, &mut memo);
-    hoist_into_root(&root, &root_locator, opts);
-    hoist_nested_roots(&root, opts);
+    let mut context = ConvertContext::default();
+    let root = convert(tree, &mut context);
+    let root_locator = context
+        .locator_by_result
+        .get(&Rc::as_ptr(&root))
+        .expect("every converted result has its input locator");
+    hoist_into_root(&root, root_locator, opts);
+    hoist_nested_roots(&root, opts, &context.locator_by_result);
     // Returning an owned `HoisterResult` (rather than
     // `Rc<HoisterResult>`) keeps the wrapper's post-hoist
     // `external_dependencies` filter from mutating the shared graph.
@@ -608,7 +599,11 @@
     (*root).clone()
 }
 
-fn hoist_nested_roots(root: &Rc<HoisterResult>, opts: &HoistOpts) {
+fn hoist_nested_roots(
+    root: &Rc<HoisterResult>,
+    opts: &HoistOpts,
+    locator_by_result: &HashMap<*const HoisterResult, String>,
+) {
     let mut visited = HashSet::from([Rc::as_ptr(root)]);
     let mut pending: Vec<Rc<HoisterResult>> =
         root.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)).collect();
@@ -616,9 +611,10 @@
         if !visited.insert(Rc::as_ptr(&node)) {
             continue;
         }
-        let reference = node.references.borrow().iter().next().cloned().unwrap_or_default();
-        let locator = format!("{}@{reference}", node.ident_name);
-        hoist_into_root(&node, &locator, opts);
+        let locator = locator_by_result
+            .get(&Rc::as_ptr(&node))
+            .expect("every converted result has its input locator");
+        hoist_into_root(&node, locator, opts);
         pending.extend(node.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)));
     }
 }
@@ -1139,12 +1135,15 @@
     false
 }
 
-fn convert(
-    tree: &HoisterTree,
-    memo: &mut HashMap<*const HoisterTree, Rc<HoisterResult>>,
-) -> Rc<HoisterResult> {
+#[derive(Default)]
+struct ConvertContext {
+    result_by_tree: HashMap<*const HoisterTree, Rc<HoisterResult>>,
+    locator_by_result: HashMap<*const HoisterResult, String>,
+}
+
+fn convert(tree: &HoisterTree, context: &mut ConvertContext) -> Rc<HoisterResult> {
     let ptr = std::ptr::from_ref::<HoisterTree>(tree);
-    if let Some(existing) = memo.get(&ptr) {
+    if let Some(existing) = context.result_by_tree.get(&ptr) {
         return Rc::clone(existing);
     }
     // Stash a node with empty `dependencies`, then recurse and
@@ -1161,7 +1160,10 @@
         peer_names: tree.peer_names.clone(),
         dependencies: RefCell::new(IndexSet::new()),
     });
-    memo.insert(ptr, Rc::clone(&node));
+    context.result_by_tree.insert(ptr, Rc::clone(&node));
+    context
+        .locator_by_result
+        .insert(Rc::as_ptr(&node), format!("{}@{}", tree.ident_name, tree.reference));
 
     // Collect the children before recursing so we can drop the
     // `Ref<'_, IndexSet<...>>` borrow on `tree.dependencies`. The
@@ -1173,7 +1175,7 @@
         tree.dependencies.borrow().iter().cloned().collect();
     let mut children: IndexSet<RcByPtr<HoisterResult>> = IndexSet::new();
     for child in to_convert {
-        children.insert(RcByPtr(convert(&child.0, memo)));
+        children.insert(RcByPtr(convert(&child.0, context)));

Replace .iter().next() with .iter().min() when fetching a reference to guarantee
a deterministic locator string.

pnpm/crates/real-hoist/src/lib.rs [615-623]

 while let Some(node) = pending.pop() {
     if !visited.insert(Rc::as_ptr(&node)) {
         continue;
     }
-    let reference = node.references.borrow().iter().next().cloned().unwrap_or_default();
+    let reference = node.references.borrow().iter().min().cloned().unwrap_or_default();
     let locator = format!("{}@{reference}", node.ident_name);
     hoist_into_root(&node, &locator, opts);
     pending.extend(node.dependencies.borrow().iter().map(|child| Rc::clone(&child.0)));
 }
Suggestion importance[1-10]: 9

__

Why: Using .next() on potentially unordered collections like HashSet causes non-deterministic package hoisting, which is a critical bug for reproducible package manager installations.

High

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: ad98aa6d31f5

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.498 ± 0.161 2.348 2.774 1.66 ± 0.17
pacquet@main 2.534 ± 0.165 2.356 2.756 1.68 ± 0.17
pnpr@HEAD 1.555 ± 0.153 1.347 1.749 1.03 ± 0.13
pnpr@main 1.507 ± 0.122 1.377 1.773 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.49797308204,
      "stddev": 0.1610426133432856,
      "median": 2.42187934294,
      "user": 1.47407362,
      "system": 1.31740846,
      "min": 2.34817272494,
      "max": 2.7736298119400002,
      "times": [
        2.56646092694,
        2.44900600394,
        2.71382861794,
        2.7736298119400002,
        2.38177893294,
        2.34817272494,
        2.36792742894,
        2.63380321594,
        2.35037047494,
        2.39475268194
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.53354022344,
      "stddev": 0.16514572134926128,
      "median": 2.47906724194,
      "user": 1.50028692,
      "system": 1.26342176,
      "min": 2.35555650194,
      "max": 2.75566339694,
      "times": [
        2.75566339694,
        2.45685394894,
        2.36755891494,
        2.36213098094,
        2.35555650194,
        2.5012805349400002,
        2.73302913894,
        2.73741639894,
        2.63100383594,
        2.4349085819400003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5547938290400003,
      "stddev": 0.15261192094496592,
      "median": 1.58152510644,
      "user": 1.05095802,
      "system": 1.13443106,
      "min": 1.3470098139400002,
      "max": 1.74945453494,
      "times": [
        1.6707316579400002,
        1.74945453494,
        1.7486068779400001,
        1.58520123094,
        1.64702570594,
        1.5778489819400001,
        1.4459956279400001,
        1.3470098139400002,
        1.3802044099400002,
        1.39585944894
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5071901022399998,
      "stddev": 0.12220158161691336,
      "median": 1.46760078344,
      "user": 1.03810582,
      "system": 1.12455006,
      "min": 1.3767426789400001,
      "max": 1.77326091694,
      "times": [
        1.53253537694,
        1.46339471094,
        1.77326091694,
        1.44477336394,
        1.6206641299400002,
        1.57830182394,
        1.4718068559400002,
        1.3767426789400001,
        1.39661666494,
        1.4138044999400001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 258.4 ± 8.0 246.5 270.4 1.02 ± 0.04
pacquet@main 254.0 ± 4.4 246.9 261.7 1.00
pnpr@HEAD 275.1 ± 4.8 267.0 281.8 1.08 ± 0.03
pnpr@main 265.7 ± 9.1 257.7 287.2 1.05 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25837288948000003,
      "stddev": 0.00804613091151853,
      "median": 0.25815282878,
      "user": 0.22586240000000002,
      "system": 0.5070596199999999,
      "min": 0.24649469978000002,
      "max": 0.27040244278000003,
      "times": [
        0.27040244278000003,
        0.25734344478,
        0.25547734978000003,
        0.26142949078,
        0.26252922278,
        0.25438753578,
        0.24649469978000002,
        0.24729305278000002,
        0.25896221278000003,
        0.26940944278
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25400034308,
      "stddev": 0.004403785213583747,
      "median": 0.25373651478000003,
      "user": 0.19940829999999998,
      "system": 0.52918232,
      "min": 0.24689393178000002,
      "max": 0.26169241578,
      "times": [
        0.26169241578,
        0.24951254378,
        0.25211721978,
        0.25792738478,
        0.25149365478,
        0.25535580978,
        0.25747677578,
        0.24689393178000002,
        0.25541719578,
        0.25211649878000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27507181438000006,
      "stddev": 0.004828354192831531,
      "median": 0.27391681328,
      "user": 0.2091443,
      "system": 0.5383649199999999,
      "min": 0.26702614278000003,
      "max": 0.28177545578,
      "times": [
        0.27324791378,
        0.28122385578000003,
        0.27108857578,
        0.27789067878,
        0.27458571278,
        0.27932167378,
        0.28177545578,
        0.26702614278000003,
        0.27148455078,
        0.27307358378
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26573784338,
      "stddev": 0.0091277377700561,
      "median": 0.26351888178,
      "user": 0.21974769999999996,
      "system": 0.50622422,
      "min": 0.25768061978,
      "max": 0.28723634178,
      "times": [
        0.25768061978,
        0.28723634178,
        0.26525249178,
        0.25868316878000003,
        0.25963920878,
        0.26888752878,
        0.27396382078000003,
        0.26467464378,
        0.25899748978000003,
        0.26236311978
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.595 ± 0.021 2.568 2.640 1.74 ± 0.07
pacquet@main 2.589 ± 0.017 2.560 2.610 1.73 ± 0.07
pnpr@HEAD 1.627 ± 0.151 1.452 1.881 1.09 ± 0.11
pnpr@main 1.496 ± 0.059 1.422 1.568 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5954598966000004,
      "stddev": 0.02147653117686855,
      "median": 2.5951277924000005,
      "user": 1.5074561,
      "system": 1.3350898199999999,
      "min": 2.5676078179,
      "max": 2.6397638729,
      "times": [
        2.5782804119000002,
        2.5676078179,
        2.5942569639000004,
        2.6397638729,
        2.6007123349,
        2.5846242999,
        2.6159547679,
        2.5959986209,
        2.5735459309,
        2.6038539449
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5886913478,
      "stddev": 0.0166033784443507,
      "median": 2.5894378934000004,
      "user": 1.5190952,
      "system": 1.29057982,
      "min": 2.5597119739000003,
      "max": 2.6100687109000003,
      "times": [
        2.5965916769,
        2.5722071989,
        2.5862463919,
        2.6093635819000003,
        2.6012317469,
        2.5895168919000002,
        2.5597119739000003,
        2.6100687109000003,
        2.5893588949,
        2.5726164099
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6266554765999999,
      "stddev": 0.15122803504351784,
      "median": 1.6197279639,
      "user": 1.0367355999999999,
      "system": 1.13052002,
      "min": 1.4521271289000002,
      "max": 1.8807857779000001,
      "times": [
        1.8056765279000002,
        1.6109750379,
        1.6697796579000002,
        1.4521271289000002,
        1.4704097239,
        1.5224849979000001,
        1.6284808899,
        1.8807857779000001,
        1.4697606299000001,
        1.7560743939
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4956459753,
      "stddev": 0.059115719712474785,
      "median": 1.4967921404000002,
      "user": 1.0210243999999997,
      "system": 1.1643852199999998,
      "min": 1.4221230659000001,
      "max": 1.5683764639,
      "times": [
        1.5683764639,
        1.5676538729000002,
        1.4741782819,
        1.5544516469,
        1.4367695029,
        1.4240032069000002,
        1.5300142279000002,
        1.4221230659000001,
        1.5194059989000002,
        1.4594834849000002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 407.6 ± 7.0 398.4 423.7 1.33 ± 0.04
pacquet@main 407.9 ± 7.9 397.5 421.2 1.34 ± 0.05
pnpr@HEAD 305.4 ± 8.8 289.8 321.9 1.00
pnpr@main 306.6 ± 5.0 298.2 314.0 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.4075799104800001,
      "stddev": 0.007032955080486626,
      "median": 0.40681585418000005,
      "user": 0.5244180999999999,
      "system": 0.6989951000000001,
      "min": 0.39843628518000007,
      "max": 0.42370914618000005,
      "times": [
        0.40478694718,
        0.40249746518000007,
        0.40728377018000006,
        0.41138656718000005,
        0.40634793818000003,
        0.40940273018000006,
        0.41062150618000004,
        0.42370914618000005,
        0.39843628518000007,
        0.40132674918000005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4078622229800001,
      "stddev": 0.007914988166534385,
      "median": 0.40580920168,
      "user": 0.5416158999999999,
      "system": 0.6742774999999999,
      "min": 0.39745608918,
      "max": 0.42121229418000006,
      "times": [
        0.40406814218000003,
        0.40308652418000007,
        0.39986511618000004,
        0.4018315101800001,
        0.40755026118000004,
        0.42121229418000006,
        0.41353798918000007,
        0.41336792918000004,
        0.41664637418000006,
        0.39745608918
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30539722088000004,
      "stddev": 0.008763730212910454,
      "median": 0.30635683668,
      "user": 0.17711149999999998,
      "system": 0.5409153,
      "min": 0.28981247218000006,
      "max": 0.32194957618000003,
      "times": [
        0.30934884918000005,
        0.29643128818000003,
        0.28981247218000006,
        0.30753405018,
        0.30631462418000005,
        0.30471619918000004,
        0.29976405318000005,
        0.32194957618000003,
        0.30639904918000005,
        0.31170204718000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30661964108000006,
      "stddev": 0.004966703812680008,
      "median": 0.3073752981800001,
      "user": 0.20105089999999998,
      "system": 0.5503785000000001,
      "min": 0.29821038718000004,
      "max": 0.31401647518000003,
      "times": [
        0.30388413318,
        0.31058143718000003,
        0.30691869818000006,
        0.30783189818000006,
        0.29821038718000004,
        0.30786014118000005,
        0.30003423318000005,
        0.31162239718000007,
        0.30523661018000003,
        0.31401647518000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.738 ± 0.011 1.714 1.751 5.75 ± 0.12
pacquet@main 1.734 ± 0.010 1.717 1.748 5.74 ± 0.12
pnpr@HEAD 0.302 ± 0.006 0.293 0.313 1.00
pnpr@main 0.304 ± 0.007 0.295 0.319 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7383097876800004,
      "stddev": 0.010719776129689409,
      "median": 1.7394136690800002,
      "user": 0.74676756,
      "system": 0.7598467,
      "min": 1.7139220945800002,
      "max": 1.75128676658,
      "times": [
        1.75128676658,
        1.7346028345800002,
        1.7139220945800002,
        1.74690334058,
        1.7412061995800001,
        1.7433114355800001,
        1.73724103258,
        1.74711471958,
        1.72988831458,
        1.73762113858
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7336853942800001,
      "stddev": 0.01048808514461774,
      "median": 1.7353750835800001,
      "user": 0.7551463599999999,
      "system": 0.7373287,
      "min": 1.71726193458,
      "max": 1.74757232958,
      "times": [
        1.73062416058,
        1.7425221585800001,
        1.7428932785800002,
        1.73659742058,
        1.74078392558,
        1.7181415125800001,
        1.74757232958,
        1.7341527465800002,
        1.72630447558,
        1.71726193458
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3022104741800001,
      "stddev": 0.0062741518323559875,
      "median": 0.30226251958000006,
      "user": 0.17454975999999997,
      "system": 0.5393340999999999,
      "min": 0.29252007658,
      "max": 0.31257867458000005,
      "times": [
        0.30530171858000005,
        0.30955594158000005,
        0.29823434858000003,
        0.30390544958000004,
        0.29795469258,
        0.29594300358000003,
        0.29252007658,
        0.30061958958,
        0.30549124658000004,
        0.31257867458000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30438989788000004,
      "stddev": 0.006776898850537666,
      "median": 0.30435038758000005,
      "user": 0.18076356,
      "system": 0.5436905999999999,
      "min": 0.29518774058,
      "max": 0.31919641858000003,
      "times": [
        0.29701298858,
        0.31919641858000003,
        0.30250436958000004,
        0.30334669758000005,
        0.29518774058,
        0.29969198458,
        0.30645173558000005,
        0.30876019258000004,
        0.30535407758000005,
        0.30639277358000006
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 187.3 ± 6.2 181.7 206.6 2.15 ± 0.08
pacquet@main 192.4 ± 3.0 187.9 199.1 2.21 ± 0.05
pnpr@HEAD 87.2 ± 1.4 84.2 90.3 1.00
pnpr@main 87.2 ± 1.5 84.9 90.2 1.00 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18727382482285715,
      "stddev": 0.006228522724118345,
      "median": 0.18509441768,
      "user": 0.17263195714285712,
      "system": 0.06550072,
      "min": 0.18165950368000003,
      "max": 0.20662137668000002,
      "times": [
        0.20662137668000002,
        0.19087336668000002,
        0.19086717468000003,
        0.18534061668000001,
        0.18165950368000003,
        0.18649411968000001,
        0.18744239468,
        0.18383602368000002,
        0.18484821868,
        0.18867128968000002,
        0.18369510768000002,
        0.18414381268000002,
        0.18361018768,
        0.18373035468
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.19240949127999998,
      "stddev": 0.002994900517616017,
      "median": 0.19143631768000002,
      "user": 0.18144186666666665,
      "system": 0.06337578666666667,
      "min": 0.18790276268000003,
      "max": 0.19914463468000002,
      "times": [
        0.19353838668000004,
        0.19109309068000002,
        0.19118369068000002,
        0.18884316268,
        0.19914463468000002,
        0.19743524568,
        0.19351924968000003,
        0.19020917568,
        0.19126812168000001,
        0.19143631768000002,
        0.19018162368000002,
        0.19378655368000003,
        0.18790276268000003,
        0.19386734468000003,
        0.19273300868
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08715679852848486,
      "stddev": 0.0013684034639938787,
      "median": 0.08710342068,
      "user": 0.020902266666666666,
      "system": 0.008675009696969698,
      "min": 0.08417153868,
      "max": 0.09032363568,
      "times": [
        0.08694974168,
        0.08643578368,
        0.08568916768,
        0.08417153868,
        0.08710342068,
        0.08752289068,
        0.08804426268,
        0.08596660968,
        0.08808453968,
        0.08763039368,
        0.09032363568,
        0.08588332368,
        0.08556572568,
        0.09022174368000001,
        0.08576616368000001,
        0.08704976068,
        0.08912881568,
        0.08578310368,
        0.08711308868,
        0.08782340668000001,
        0.08580146868,
        0.08913385568,
        0.08593911768,
        0.08640257168,
        0.08778692868,
        0.08834523068,
        0.08710857068,
        0.08859442968,
        0.08732209268,
        0.08696446868,
        0.08768831168,
        0.08642039368,
        0.08640979468
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08717885019515152,
      "stddev": 0.0015095147627965594,
      "median": 0.08727829068000001,
      "user": 0.020936993939393935,
      "system": 0.00853885818181818,
      "min": 0.08491756368,
      "max": 0.09017860268,
      "times": [
        0.08657552668,
        0.08630159168,
        0.08990450668,
        0.08521611668,
        0.08901792768,
        0.08610374868000001,
        0.08727829068000001,
        0.08809520868000001,
        0.08821050568000001,
        0.08757977868,
        0.08672376568000001,
        0.08794942468,
        0.08514021468,
        0.08939519668,
        0.08595344568,
        0.08799562268,
        0.08562394468000001,
        0.08515393968,
        0.08571254068,
        0.08711271868,
        0.08795345168,
        0.08728020468,
        0.08785243168,
        0.08569140268,
        0.08820455468,
        0.08992823168,
        0.08540250768,
        0.08678582268,
        0.09017860268,
        0.08491756368,
        0.08853524668,
        0.08576623268,
        0.08736178768
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.467 ± 0.346 1.072 1.719 1.00
pacquet@main 7.031 ± 1.070 6.396 8.266 4.79 ± 1.35
pnpm@HEAD 34.663 ± 1.072 33.426 35.295 23.64 ± 5.63
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.4666109565333334,
      "stddev": 0.3463009146915491,
      "median": 1.6092721262,
      "user": 1.36860448,
      "system": 0.19028440666666666,
      "min": 1.0717681362,
      "max": 1.7187926072000002,
      "times": [
        1.6092721262,
        1.7187926072000002,
        1.0717681362
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 7.031467437533333,
      "stddev": 1.0696410720490335,
      "median": 6.4319455672,
      "user": 6.412845146666665,
      "system": 0.70177374,
      "min": 6.3960480861999995,
      "max": 8.2664086592,
      "times": [
        6.3960480861999995,
        6.4319455672,
        8.2664086592
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 34.66341373086666,
      "stddev": 1.071723552537345,
      "median": 35.268932789199994,
      "user": 79.76397514666667,
      "system": 3.741499073333333,
      "min": 33.425987750199994,
      "max": 35.295320653199994,
      "times": [
        35.268932789199994,
        35.295320653199994,
        33.425987750199994
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.497 ± 0.113 4.422 4.775 1.28 ± 0.04
pacquet@main 4.547 ± 0.135 4.425 4.855 1.29 ± 0.04
pnpr@HEAD 3.553 ± 0.113 3.456 3.840 1.01 ± 0.04
pnpr@main 3.522 ± 0.057 3.444 3.638 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.49695842884,
      "stddev": 0.11324336825886364,
      "median": 4.44062404754,
      "user": 1.654092,
      "system": 1.34690686,
      "min": 4.42160428504,
      "max": 4.77482812604,
      "times": [
        4.43196884104,
        4.47529832104,
        4.43467662004,
        4.42160428504,
        4.43879326504,
        4.60731832104,
        4.42600422204,
        4.44245483004,
        4.51663745704,
        4.77482812604
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.54672863974,
      "stddev": 0.13477995978305488,
      "median": 4.49769736304,
      "user": 1.6625775999999999,
      "system": 1.34744426,
      "min": 4.4247701390400005,
      "max": 4.85518134304,
      "times": [
        4.85518134304,
        4.44490799004,
        4.46506975504,
        4.530324971040001,
        4.5990488990400005,
        4.450582514040001,
        4.609565373040001,
        4.64447452804,
        4.4247701390400005,
        4.443360885040001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5534989887400004,
      "stddev": 0.1126892292097113,
      "median": 3.5179483725400003,
      "user": 1.1461777999999998,
      "system": 1.2250462599999998,
      "min": 3.4562603210400002,
      "max": 3.8399564920400002,
      "times": [
        3.8399564920400002,
        3.62412159004,
        3.5110690480400004,
        3.52482769704,
        3.47896407304,
        3.57861013104,
        3.5477125000400003,
        3.4907326260400002,
        3.4562603210400002,
        3.48273540904
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5217534795400005,
      "stddev": 0.057205769505048666,
      "median": 3.5291094105400003,
      "user": 1.1466796999999997,
      "system": 1.23324506,
      "min": 3.44388426004,
      "max": 3.6377972630400004,
      "times": [
        3.5216819090400002,
        3.46199509404,
        3.4647159280400004,
        3.5365369120400003,
        3.6377972630400004,
        3.55684825904,
        3.5503461350400003,
        3.50148541704,
        3.44388426004,
        3.54224361804
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13545
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,567.61 ms
(-4.38%)Baseline: 2,685.33 ms
3,222.39 ms
(79.68%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,713.92 ms
(-6.22%)Baseline: 1,827.50 ms
2,193.00 ms
(78.15%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
398.44 ms
(-16.76%)Baseline: 478.64 ms
574.37 ms
(69.37%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
181.66 ms
(-18.87%)Baseline: 223.91 ms
268.70 ms
(67.61%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,348.17 ms
(-3.52%)Baseline: 2,433.73 ms
2,920.48 ms
(80.40%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,421.60 ms
(-2.36%)Baseline: 4,528.43 ms
5,434.12 ms
(81.37%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
246.49 ms
(-13.52%)Baseline: 285.02 ms
342.03 ms
(72.07%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
1,071.77 ms
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13545
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,452.13 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.52 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
289.81 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.17 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,347.01 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,456.26 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
267.03 ms
🐰 View full continuous benchmarking report in Bencher

Use the original locator for every recursive hoist root.

Keep deferred materializations that peer outputs still reference.
Copilot AI review requested due to automatic review settings August 1, 2026 08:17

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs (1)

3260-3267: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add an end-to-end retention regression test.

The current materialized_nodes_referenced_by_peer_outputs_are_retained test invokes only should_retain_materialized_node.

It still passes if undo_realize or deferred-child cleanup stops calling that helper.

Add a discovery-walk fixture that materializes a deferred provider and verifies that a peer-referenced node remains in dependencies_tree, while an unreferenced transient node is removed.

As per path instructions, require regression tests that fail without the fix, especially for cache-hit/deferred materialization and retained peer-provider nodes.

Also applies to: 3362-3368

🤖 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 3260 -
3267, Add an end-to-end discovery-walk regression test covering deferred
materialization: use a fixture that materializes a deferred provider, then
verify the peer-referenced node remains in dependencies_tree while an
unreferenced transient node is removed. Exercise the undo_realize/deferred-child
cleanup path rather than calling should_retain_materialized_node directly, so
the test fails if that integration call is removed.

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.

Outside diff comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs`:
- Around line 3260-3267: Add an end-to-end discovery-walk regression test
covering deferred materialization: use a fixture that materializes a deferred
provider, then verify the peer-referenced node remains in dependencies_tree
while an unreferenced transient node is removed. Exercise the
undo_realize/deferred-child cleanup path rather than calling
should_retain_materialized_node directly, so the test fails if that integration
call is removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b756bdc-475a-4a01-b698-1a4195e00103

📥 Commits

Reviewing files that changed from the base of the PR and between d780c18 and d73a81c.

📒 Files selected for processing (4)
  • pnpm/crates/real-hoist/src/lib.rs
  • pnpm/crates/real-hoist/src/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • pnpm/crates/real-hoist/src/lib.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs

@zkochan

zkochan commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

Review follow-up:

  • d73a81c addresses all five inline threads: exact nested-root locators and hoisting-limit coverage, fail-fast locator lookup, retained deferred peer nodes, and documentation cleanup.
  • 6ebf80d states the exact allocation-free package-name matching invariant requested in the non-inline review.
  • The changeset intentionally targets pacquet only. This PR changes only the Rust CLI, and the repository policy requires Rust-only changesets to omit pnpm because pnpm denotes the TypeScript CLI package in changeset front matter.

Validation passed: focused crate tests, full workspace readiness checks, clippy with warnings denied, Rust documentation, custom dylints, TypeScript compilation and linting, spelling, and formatting.


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

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 1, 2026 08:22
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6ebf80d

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@pnpm/napi: install of a large graph peaks at >30 GB RSS (per-occurrence tree expansion in peer resolution + hoisted linking)

3 participants