Skip to content

refactor(deps-restorer): run the frozen install as a pipeline of phases - #14739

Merged
zkochan merged 13 commits into
mainfrom
perfectionist-pipeline
Sep 9, 2026
Merged

zkochan merged 13 commits into
mainfrom
perfectionist-pipeline

Conversation

@zkochan

@zkochan zkochan commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Stacked on #14737. Related to #14562.

Turns InstallFrozenLockfile::run from one 470-line body into a pipeline of named phases, each a &self method that returns one struct the next phase consumes whole:

let plan    = self.plan_materialization(&allow_build_policy, ...).await?;
let ctx     = InstallContext { layout: &plan.layout, ... };
let settled = self.settle_skip_set(plan.host, seed_skipped).await?;
let fetched = self.fetch(&ctx, FetchInputs { cas_prefetch: plan.cas_prefetch, ... }).await?;
let linked  = self.link(&ctx, LinkInputs { fetched: &fetched, ... }, &mut skipped)?;
let built   = self.build(&ctx, BuildInputs { fetched: &fetched, linked: &linked, ... }).await?;

run bound 77 distinct names; it and every phase now sit under the 12-name cap, so install_frozen_lockfile.rs has no too_many_local_bindings site left. Two things made that affordable: the install context from the parent PR (a phase reads the layout, the policies and the linker off &ctx instead of threading them), and FrozenInputs, the Copy view of the install's borrowed inputs a phase captures as one value — a future holding &self would not be Send, so the phases cannot simply borrow self.

Two things the borrow checker decided, recorded in the commit messages:

  • The directory-clone cache borrows the allow-builds policy, so the policy cannot live in the plan struct with the cache. run owns it and the plan borrows it.
  • An async fn holding &self is not Send, because the verification override is a boxed future without Sync. Each phase is a plain fn returning an explicit Send future that captures only its Copy inputs.

Also drops the DependencyGroupList type parameter from InstallFrozenLockfile: its one caller passes a Vec, and run collected the iterator into another Vec on entry. A slice borrow removes the parameter and the copy.

No user-visible behavior changes; no changeset. Nothing is cloned or allocated that was not before: the phase input and output structs are borrows and moves of values run already held.

The parent PR's benchmark rows that looked slow (cold_store_many_medium_tarballs at 1.14–1.19) exercise pnpm-tarball, which neither PR touches; across three samples the row landed at 1.14, 1.01 and 0.92.

Squash Commit Body

Restructure InstallFrozenLockfile::run as a pipeline of &self phases —
plan_materialization, settle_skip_set, fetch, link, build — each
returning one struct the next consumes whole, where run alone bound 77
names.

The plan borrows the allow-builds policy rather than owning it: the
directory-clone cache keeps a reference to the policy, so the two cannot
share a struct. Every phase returns an explicit Send future capturing
only its Copy inputs, because a future holding &self would not be Send
(the verification override is a boxed future without Sync). The owned
inputs run consumes are taken off self before the phases borrow it.

Hand each phase the install's borrowed inputs as one Copy value,
FrozenInputs, and keep each phase's output whole for the next; run and
every phase bind at most twelve names.

Drop the DependencyGroupList type parameter: the one caller hands a Vec
and run collected the iterator into another Vec on entry.

Related to pnpm/pnpm#14562.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • Added or updated tests.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw

Summary by CodeRabbit

  • Refactor
    • Streamlined frozen-lockfile installations into distinct planning, fetching, linking, and building phases.
    • Preserved dependency validation, caching, snapshot handling, and installation behavior.
    • Improved processing of fetch failures across multiple packages.
    • Simplified lockfile information used during injected-dependency processing.
  • Tests
    • Updated installation and injected-dependency coverage for revised lockfile handling and no-snapshot scenarios.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: defc2a2d-98c2-42c6-bb0d-9456c72edea7

📥 Commits

Reviewing files that changed from the base of the PR and between d08f69d and 66cc01f.

📒 Files selected for processing (1)
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The frozen lockfile installation path now uses borrowed dependency groups, phase-specific planning and execution structs, aggregated lockfile entries, and separate materialization, fetch, link, build, and output stages.

Changes

Installation pipeline consolidation

Layer / File(s) Summary
Shared install and lockfile contracts
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm/crates/deps-restorer/src/virtual_store_layout.rs, pnpm/crates/deps-restorer/src/virtual_store_layout/tests.rs, pnpm/crates/package-manager/src/install/materialize.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
InstallFrozenLockfile now borrows dependency groups. collect_injected_deps now accepts LockfileEntries. Callers and tests use the updated contracts.
Frozen install phase orchestration
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm/crates/deps-restorer/src/installability.rs
Frozen installation now passes state through materialization planning, skip-set settlement, fetch, link, and build phases. Fetch failures can be added in bulk while preserving subset checks.
Materialization and package installation
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
Phase results now provide fetch-failure folding, link inputs, build inputs, and final installation output construction. Engine-name resolution and custom-fetcher documentation follow the refactored phase structure.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 66cc0

The installation pipeline refactor preserves the existing frozen-lockfile flow while organizing it into explicit phases. No concrete merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant InstallFrozenLockfile
  participant MaterializationPlan
  participant FetchPhase
  participant LinkPhase
  participant BuildPhase
  InstallFrozenLockfile->>MaterializationPlan: plan_materialization
  InstallFrozenLockfile->>FetchPhase: fetch with settled skip set
  FetchPhase-->>InstallFrozenLockfile: fetched packages and failures
  InstallFrozenLockfile->>LinkPhase: link phase inputs
  LinkPhase-->>InstallFrozenLockfile: linked packages
  InstallFrozenLockfile->>BuildPhase: build phase inputs
  BuildPhase-->>InstallFrozenLockfile: build results
Loading

Suggested labels: product: pacquet

✨ 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 perfectionist-pipeline

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.

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     14.4±2.60ms    26.1 MB/sec    1.09     15.7±2.61ms    23.8 MB/sec
packument/parse                                  1.09     43.6±3.12µs  1522.8 MB/sec    1.00     40.0±0.92µs  1659.9 MB/sec
tarball/download_dependency                      1.30      5.9±1.38ms   740.3 KB/sec    1.00      4.5±0.78ms   959.1 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.07    240.3±6.70ms 66.6 KElem/sec    1.00    225.6±8.22ms 70.9 KElem/sec
workspace_resolution/hoist_heavy                 1.06   336.4±19.82ms        ? ?/sec    1.00   316.8±27.27ms        ? ?/sec
workspace_sort/chained_projects                  1.00     14.2±1.49ms        ? ?/sec    1.02     14.5±1.49ms        ? ?/sec

@zkochan
zkochan marked this pull request as ready for review September 9, 2026 14:23
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Refactor frozen lockfile installs into explicit phases

✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Decomposes frozen installs into planning, skip-set, fetch, link, and build phases.
• Preserves Send futures through borrowed input views and explicit phase handoff structs.
• Removes dependency-group copying and standardizes lockfile-entry handoffs.
Diagram

graph TD
  RUN["Frozen Install"] --> PLAN["Plan Materialization"] --> SKIP["Settle Skip Set"] --> FETCH["Fetch Packages"] --> LINK["Link Projects"] --> BUILD["Build Modules"] --> OUTPUT["Install Output"]
Loading
High-Level Assessment

The explicit phase pipeline is appropriate because it makes ordering and ownership visible without introducing runtime abstraction or allocation. Closures, trait-based phase objects, and separate coordinator types would either retain difficult captures or add unnecessary indirection; the borrowed Copy input view and concrete handoff structs preserve Send requirements and existing behavior.

Files changed (6) +668 / -422

Refactor (5) +657 / -415
install_frozen_lockfile.rsSplit frozen installation into typed pipeline phases +646/-410

Split frozen installation into typed pipeline phases

• Replaces the large run body with planning, skip-set, fetch, link, and build methods connected through explicit phase structs. Introduces borrowed and owned input views to preserve Send futures, removes the dependency-group generic and copy, and centralizes engine-source and phase handoff logic.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs

installability.rsAdd bulk recording for fetch-failed snapshots +7/-0

Add bulk recording for fetch-failed snapshots

• Adds add_fetch_failed_all so fetch-phase failures can be drained into the shared skip set while retaining existing precedence rules.

pnpm/crates/deps-restorer/src/installability.rs

virtual_store_layout.rsBundle injected-dependency lockfile inputs +2/-2

Bundle injected-dependency lockfile inputs

• Changes collect_injected_deps to accept LockfileEntries instead of separate package and snapshot options, matching the pipeline's bundled lockfile view.

pnpm/crates/deps-restorer/src/virtual_store_layout.rs

materialize.rsBorrow dependency groups for frozen installs +1/-1

Borrow dependency groups for frozen installs

• Passes the materialization dependency groups as a slice, eliminating the frozen install's generic iterator and redundant Vec collection.

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

install_with_fresh_lockfile.rsPass bundled lockfile entries when collecting injected dependencies +1/-2

Pass bundled lockfile entries when collecting injected dependencies

• Converts the fresh materialization lockfile into LockfileEntries for the shared injected-dependency collector API.

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

Tests (1) +11 / -7
tests.rsAdapt injected-dependency tests to LockfileEntries +11/-7

Adapt injected-dependency tests to LockfileEntries

• Updates existing isolated, missing-snapshot, and hoisted-layout cases to pass bundled lockfile entries into collect_injected_deps.

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

@codecov-commenter

codecov-commenter commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.22481% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.24%. Comparing base (fc56dc1) to head (66cc01f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rates/deps-restorer/src/install_frozen_lockfile.rs 99.20% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14739      +/-   ##
==========================================
+ Coverage   90.22%   90.24%   +0.01%     
==========================================
  Files         794      794              
  Lines      152466   152580     +114     
==========================================
+ Hits       137560   137690     +130     
+ Misses      14906    14890      -16     

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

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

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Plan docs describe the wrong function ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The inserted MaterializationPlan documentation continues an existing doc block about
load_custom_fetcher_session, causing Rust to attach both unrelated contracts to the struct.
Readers inspecting the plan now see false guarantees about custom-fetcher loading, while the actual
loader below is left without its intended documentation.
Code

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[R998-1000]

+/// What [`InstallFrozenLockfile::plan_materialization`] decides before
+/// the on-disk phases run. Owned by `run` for the whole install; the
+/// phases borrow the parts they read.
Relevance

●●● Strong

Exact recent precedent accepts documentation corrections; this malformed Rust doc block
misattributes contracts and leaves the loader undocumented.

PR-#14737
PR-#13644

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 772199 requires comments to describe the current code item's behavior. Lines 993-997 describe
loading custom fetchers, but the newly inserted lines 998-1001 make that entire contiguous doc block
belong to MaterializationPlan.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[993-1001]

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

## Issue description
Separate the custom-fetcher documentation from `MaterializationPlan` so each item documents its own current behavior.

## Issue Context
The new plan struct was inserted between the existing custom-fetcher doc comment and `load_custom_fetcher_session`, causing Rust to associate that comment with the wrong item.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[993-1001]
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[1200-1214]

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


2. Failed fetches appear as completed phases ✓ Resolved 🐞 Bug ◔ Observability
Description
The fetch phase logs phase complete after storing the fetch_verified result, even when that
result is an error. Any verification or materialization failure therefore emits a successful-looking
completion event, misleading phase dashboards and hiding failures in telemetry.
Code

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[R700-704]

+            tracing::info!(
+                target: "pacquet::install::phase",
+                phase = "create_virtual_store",
+                elapsed_ms = phase_start.elapsed().as_millis() as u64,
+                "phase complete",
Relevance

●●● Strong

Unconditional success telemetry misreports failed fetches; explicit failure-aware phase logging
matches observability-focused fixes.

PR-#14280
PR-#14518

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
fetch_verified is awaited into a Result, but the unconditional tracing call runs before that
result is returned, so both successful and failed fetches produce the same phase complete event.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[671-706]
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[384-394]

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 `fetch` phase emits a `phase complete` event regardless of whether `fetch_verified` returns `Ok` or `Err`, so failed installs are represented as successful phase completions.

## Issue Context
Preserve the timer placement after custom fetcher setup, but ensure failure paths use an error-specific event or do not emit the success completion event. Keep the original fetch error unchanged.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[699-706]

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


3. A helper comment repeats its body ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
The doc comment on add_fetch_failed_all only says that it calls add_fetch_failed for every key,
exactly mirroring the loop below it. Any implementation rename or restructuring makes this comment
stale without preserving useful intent, constraints, or behavior not already evident from the
signature.
Code

pnpm/crates/deps-restorer/src/installability.rs[131]

+    /// [`add_fetch_failed`](Self::add_fetch_failed) for every key.
Relevance

●●● Strong

Repository history repeatedly accepts trimming comments that merely narrate obvious implementation
details.

PR-#14246
PR-#13256

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 prohibits comments that only repeat a method name or directly inferable
operation. The added comment says add_fetch_failed is invoked for every key, while the immediately
following implementation visibly performs precisely that loop.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/deps-restorer/src/installability.rs[131-136]

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 documentation for `add_fetch_failed_all` merely restates its implementation and provides no additional contract or rationale.

## Issue Context
The helper's name, parameter type, and loop already communicate that every supplied key is recorded as fetch-failed.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/installability.rs[131-136]

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


View medium (1)
4. Store timings include hook startup ✓ Resolved 🐞 Bug ◔ Observability
Description
run starts the create_virtual_store timer before fetch, but fetch now awaits
load_custom_fetcher_session before materialization starts. Whenever a pnpmfile supplies custom
fetchers, hook setup time is charged to the store phase and reaches the integrated benchmark's
store-phase summary, obscuring whether regressions come from hooks or package materialization.
Code

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[674]

+            let custom_fetcher_session = load_custom_fetcher_session(install.pnpmfile_hook).await?;
Relevance

●●● Strong

Concrete benchmark misattribution introduced by refactoring; separating hook setup preserves
meaningful phase metrics.

PR-#14265

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The phase timer starts before fetch and is emitted immediately after that future completes, while
fetch first awaits custom-fetcher session loading before invoking fetch_verified. The integrated
benchmark averages this event's elapsed time as its virtual-store metric, so the newly enclosed hook
work is observably misattributed.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[384-400]
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[667-675]
pnpm/tasks/integrated-benchmark/src/work_env.rs[1406-1411]

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 `create_virtual_store` phase timer now includes custom-fetcher hook setup because `load_custom_fetcher_session` moved inside the timed `fetch` call. Keep hook setup outside the materialization timing so benchmark diagnostics continue to measure the virtual-store phase itself.

## Issue Context
The integrated benchmark consumes the `create_virtual_store` event's elapsed time directly. A pnpmfile hook may perform non-materialization work before `CreateVirtualStore` starts.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[384-400]
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[667-675]
- pnpm/tasks/integrated-benchmark/src/work_env.rs[1406-1411]

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


Grey Divider

Context sources
✅ Compliance rules (platform): 37 rules
Review mode: ⏭️ Skipped: The latest push only moves an existing documentation comment within the same Rust source file and has no semantic or behavioral effect.

Grey Divider

Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 66cc01f

Results up to commit 9bd4613 🧠 Deep


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


Remediation recommended
1. A helper comment repeats its body ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
The doc comment on add_fetch_failed_all only says that it calls add_fetch_failed for every key,
exactly mirroring the loop below it. Any implementation rename or restructuring makes this comment
stale without preserving useful intent, constraints, or behavior not already evident from the
signature.
Code

pnpm/crates/deps-restorer/src/installability.rs[131]

+    /// [`add_fetch_failed`](Self::add_fetch_failed) for every key.
Relevance

●●● Strong

Repository history repeatedly accepts trimming comments that merely narrate obvious implementation
details.

PR-#14246
PR-#13256

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 prohibits comments that only repeat a method name or directly inferable
operation. The added comment says add_fetch_failed is invoked for every key, while the immediately
following implementation visibly performs precisely that loop.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/deps-restorer/src/installability.rs[131-136]

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 documentation for `add_fetch_failed_all` merely restates its implementation and provides no additional contract or rationale.

## Issue Context
The helper's name, parameter type, and loop already communicate that every supplied key is recorded as fetch-failed.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/installability.rs[131-136]

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


2. Store timings include hook startup ✓ Resolved 🐞 Bug ◔ Observability
Description
run starts the create_virtual_store timer before fetch, but fetch now awaits
load_custom_fetcher_session before materialization starts. Whenever a pnpmfile supplies custom
fetchers, hook setup time is charged to the store phase and reaches the integrated benchmark's
store-phase summary, obscuring whether regressions come from hooks or package materialization.
Code

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[674]

+            let custom_fetcher_session = load_custom_fetcher_session(install.pnpmfile_hook).await?;
Relevance

●●● Strong

Concrete benchmark misattribution introduced by refactoring; separating hook setup preserves
meaningful phase metrics.

PR-#14265

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The phase timer starts before fetch and is emitted immediately after that future completes, while
fetch first awaits custom-fetcher session loading before invoking fetch_verified. The integrated
benchmark averages this event's elapsed time as its virtual-store metric, so the newly enclosed hook
work is observably misattributed.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[384-400]
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[667-675]
pnpm/tasks/integrated-benchmark/src/work_env.rs[1406-1411]

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 `create_virtual_store` phase timer now includes custom-fetcher hook setup because `load_custom_fetcher_session` moved inside the timed `fetch` call. Keep hook setup outside the materialization timing so benchmark diagnostics continue to measure the virtual-store phase itself.

## Issue Context
The integrated benchmark consumes the `create_virtual_store` event's elapsed time directly. A pnpmfile hook may perform non-materialization work before `CreateVirtualStore` starts.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[384-400]
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[667-675]
- pnpm/tasks/integrated-benchmark/src/work_env.rs[1406-1411]

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


Results up to commit 35a881c 🚀 Fast


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


Remediation recommended
1. Failed fetches appear as completed phases ✓ Resolved 🐞 Bug ◔ Observability
Description
The fetch phase logs phase complete after storing the fetch_verified result, even when that
result is an error. Any verification or materialization failure therefore emits a successful-looking
completion event, misleading phase dashboards and hiding failures in telemetry.
Code

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[R700-704]

+            tracing::info!(
+                target: "pacquet::install::phase",
+                phase = "create_virtual_store",
+                elapsed_ms = phase_start.elapsed().as_millis() as u64,
+                "phase complete",
Relevance

●●● Strong

Unconditional success telemetry misreports failed fetches; explicit failure-aware phase logging
matches observability-focused fixes.

PR-#14280
PR-#14518

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
fetch_verified is awaited into a Result, but the unconditional tracing call runs before that
result is returned, so both successful and failed fetches produce the same phase complete event.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[671-706]
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[384-394]

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 `fetch` phase emits a `phase complete` event regardless of whether `fetch_verified` returns `Ok` or `Err`, so failed installs are represented as successful phase completions.

## Issue Context
Preserve the timer placement after custom fetcher setup, but ensure failure paths use an error-specific event or do not emit the success completion event. Keep the original fetch error unchanged.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[699-706]

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


Grey Divider

Qodo Logo

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Honor forced package rematerialization

Clear current_entries if config.force is true to prevent the warm-reinstall
optimization from skipping unchanged snapshots.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [2056]

-current_entries: current_lockfile.map(Into::into).unwrap_or_default(),
+current_entries: if config.force {
+    Default::default()
+} else {
+    current_lockfile.map(Into::into).unwrap_or_default()
+},

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly resolves an explicit TODO left in the PR, ensuring the --force flag behaves correctly by not bypassing unchanged snapshots.

Medium
  • Update

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Both Qodo findings addressed:

  • Store timings include hook startup — real: the create_virtual_store timer started in run before fetch, which now loads the pnpmfile's fetcher session first. The timer moved inside the phase, after the session load, so the integrated benchmark's store metric measures materialization again (33e2db0).
  • A helper comment repeats its body — dropped (35a881c).

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 35a881c

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Honor forced package rematerialization

Clear current_entries if config.force is true to prevent the warm-reinstall
optimization from skipping unchanged snapshots.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [2056]

-current_entries: current_lockfile.map(Into::into).unwrap_or_default(),
+current_entries: if config.force {
+    Default::default()
+} else {
+    current_lockfile.map(Into::into).unwrap_or_default()
+},

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly resolves an explicit TODO left in the PR, ensuring the --force flag behaves correctly by not bypassing unchanged snapshots.

Medium
  • More

Base automatically changed from perfectionist-local-bindings to main September 9, 2026 14:50
@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Failed fetches appear as completed phases — real, and introduced by the timer move two commits earlier: the event was logged after the result was stored but before it was checked. It follows the ? again in 717eed3.


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

zkochan and others added 12 commits September 9, 2026 16:51
`InstallFrozenLockfile` was generic over any `IntoIterator` of groups,
yet its one caller hands it a `Vec` and `run` collected the iterator
into another `Vec` on entry. A slice borrow drops the type parameter
and the copy.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
`InstallFrozenLockfile::run` decided the slot layout, the engine name,
the directory-clone cache and the store-side prefetch inline, between
the store-index writer and the skip set. `plan_materialization` owns
those decisions and hands back one `MaterializationPlan` the rest of the
install reads.

The plan borrows the allow-builds policy rather than owning it: the
directory-clone cache keeps a reference to the policy, so the two cannot
live in one struct. The method returns an explicit `Send` future that
captures only its `Copy` inputs — an `async fn` holding `&self` would
not be `Send`, because the verification override is a boxed future
without `Sync`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
Resolving the pending host probe, delivering its engine name to the
directory-clone cache's slot, and computing the skip set were the next
fifty lines of `InstallFrozenLockfile::run`. `settle_skip_set` owns
them and takes the half of the plan the host probe decides, `HostPlan`,
by value.

Every owned input `run` consumes — the early host detection, the node
version, the seed skip set, the verification override — is now taken
off `self` before the phases borrow it, so `self` stays whole for their
`&self` calls.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…ts own

`run` assembled the `CreateVirtualStore` and the concurrent verification
inline, which meant holding a dozen of the install's inputs just to
forward them. `fetch` reads them off `self` and takes only what the
phases before it produced: the store-side prefetch, the directory-clone
cache, the writer, the skip set and the verification override.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…t whole

`run` unpacked the six fields of the fetch's output and the four of the
link's only to forward them, one by one, into the next phase. `link`
takes the fetch output by reference, and `run` keeps both outputs as
the values they are, reading a field where a phase needs it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…place

`build` takes the fetch and link outputs by reference and reads the
layout, the policy and the linker off the install context. With every
phase a method, `run` no longer destructures `self` or the plan: it
reads the few fields it still needs where it needs them, and forwards
each phase's output whole to the next.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…lues

`run` took the four owned inputs off `self` one by one, unpacked the
skip-set result into three names, and derived the lockfile's maps a
last time for the injected-deps epilogue. `take_owned` hands back the
owned inputs as one value, the skip-set result stays whole, and
`collect_injected_deps` takes a `LockfileEntries` like every other
reader of the two maps.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…as one value

Every phase began by destructuring `self` into five to eleven names it
needed, because a future holding `&self` is not `Send`. `FrozenInputs`
is the `Copy` view of those inputs, built by `inputs()` and captured as
one value; a phase reads `install.lockfile` where it needs it.

The three dependency-group flags the phases each recomputed come from
one `included()`, and `settle_engine_name` owns the match that fills
the directory-clone cache's slot once the host is known.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
`plan_materialization` unpacked the engine-name plan into three names
and matched on two of them to pick the directory-clone cache's engine
source. The plan stays one value, and `EngineNamePlan::source` owns
that match.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
The `create_virtual_store` timer started in `run` before the fetch
phase, which now loads the pnpmfile's fetcher session before it
materializes anything, so a pnpmfile with custom fetchers charged its
setup to the store phase. The integrated benchmark reads that event's
elapsed time as its virtual-store metric. The timer now starts inside
the phase, after the session is loaded, as it did before the split.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
Moving the phase timer into `fetch` put the "phase complete" event after
the fetch's result was stored but before it was checked, so a rejected
lockfile or a failed materialization logged a completed phase. The
event follows the `?` again.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 717eed3

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Honor forced package rematerialization
Suggestion Impact:The commit uses LockfileEntries::of_previous_install(current_lockfile, config.force), which centralizes the suggested behavior and empties prior entries under --force.

code diff:

-use pnpm_lockfile::{Lockfile, SaveLockfileError};
+use pnpm_lockfile::{Lockfile, LockfileEntries, SaveLockfileError};
 use pnpm_modules_yaml::IncludedDependencies;
 use pnpm_network::{AuthHeaders, ThrottledClient};
 use pnpm_package_manifest::{DependencyGroup, PackageManifest};
@@ -2048,12 +2048,7 @@
         ctx: &ctx,
         http_client,
         entries: materialization_lockfile.into(),
-        // TODO: the frozen path builds this with
-        // `LockfileEntries::of_previous_install`, which empties it under
-        // `--force` so the warm-reinstall skip cannot keep a package
-        // from being relinked. The fresh path never has, so `--force`
-        // over a stale lockfile still skips unchanged snapshots.
-        current_entries: current_lockfile.map(Into::into).unwrap_or_default(),
+        current_entries: LockfileEntries::of_previous_install(current_lockfile, config.force),

Clear current_entries if config.force is true to prevent the warm-reinstall
optimization from skipping unchanged snapshots.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [2056]

-current_entries: current_lockfile.map(Into::into).unwrap_or_default(),
+current_entries: if config.force {
+    Default::default()
+} else {
+    current_lockfile.map(Into::into).unwrap_or_default()
+},

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly resolves an explicit TODO left in the PR, ensuring the --force flag behaves correctly by not bypassing unchanged snapshots.

Medium
  • More

@zkochan
zkochan force-pushed the perfectionist-pipeline branch from 717eed3 to d08f69d Compare September 9, 2026 14:53
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again manually by commenting /agentic_review on this PR.

Grey Divider

Qodo Logo

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

/agentic_review

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

Copy link
Copy Markdown

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

Inserting the phase types above `load_custom_fetcher_session` left its
doc comment attached to whichever item came first, most recently
`MaterializationPlan`. The comment sits on the loader again.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Plan docs describe the wrong function — real: inserting the phase types above load_custom_fetcher_session had left its doc comment attached to MaterializationPlan. The comment is back on the loader in 66cc01f.


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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 66cc01f

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 66cc01f52d47

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.571 ± 0.134 2.428 2.859 1.70 ± 0.18
pacquet@main 2.478 ± 0.123 2.367 2.695 1.64 ± 0.17
pnpr@HEAD 1.612 ± 0.114 1.435 1.774 1.06 ± 0.12
pnpr@main 1.515 ± 0.139 1.388 1.806 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5710787451,
      "stddev": 0.13415972049662428,
      "median": 2.5315407488000004,
      "user": 1.9713249999999998,
      "system": 2.013457,
      "min": 2.4283744103,
      "max": 2.8585082463000004
    },
    {
      "command": "pacquet@main",
      "mean": 2.4776105954,
      "stddev": 0.12347654307901677,
      "median": 2.4267777023,
      "user": 1.7676389999999997,
      "system": 1.8510829999999998,
      "min": 2.3667875553,
      "max": 2.6953201753
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6118467512999999,
      "stddev": 0.11433920848439598,
      "median": 1.5852347727999998,
      "user": 1.7861299,
      "system": 1.9510402,
      "min": 1.4348390693,
      "max": 1.7739595133000001
    },
    {
      "command": "pnpr@main",
      "mean": 1.5148329683,
      "stddev": 0.13888874257062683,
      "median": 1.4828017853,
      "user": 1.7689778,
      "system": 1.8249377,
      "min": 1.3880181302999999,
      "max": 1.8060194003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 357.9 ± 20.8 331.6 389.5 1.00
pacquet@main 396.8 ± 44.9 318.9 459.2 1.11 ± 0.14
pnpr@HEAD 395.5 ± 32.5 362.1 454.5 1.10 ± 0.11
pnpr@main 387.5 ± 34.2 345.8 440.7 1.08 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3579204159800001,
      "stddev": 0.020772433158535695,
      "median": 0.36137182938,
      "user": 0.37214089999999994,
      "system": 0.72047922,
      "min": 0.33161988738000003,
      "max": 0.38952540338
    },
    {
      "command": "pacquet@main",
      "mean": 0.39680410928,
      "stddev": 0.044907025929506836,
      "median": 0.38953609388,
      "user": 0.3983846999999999,
      "system": 0.77972792,
      "min": 0.31894064638,
      "max": 0.45922211438000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.39547872538000006,
      "stddev": 0.03245297444961489,
      "median": 0.38242471588000004,
      "user": 0.37385619999999997,
      "system": 0.73148082,
      "min": 0.36210180838000006,
      "max": 0.45446968138000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.38748616428000004,
      "stddev": 0.03419748443312114,
      "median": 0.38055670188,
      "user": 0.3654441999999999,
      "system": 0.7862760200000001,
      "min": 0.34584447638000004,
      "max": 0.44067872438000005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 11.7 ± 2.2 8.1 20.2 1.00
pacquet@main 13.7 ± 2.5 8.4 22.0 1.17 ± 0.30
pnpr@HEAD 15.5 ± 4.5 9.0 32.7 1.33 ± 0.46
pnpr@main 17.1 ± 4.3 10.7 29.2 1.47 ± 0.46
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.011677145781944441,
      "stddev": 0.0021770007082430307,
      "median": 0.0112283649,
      "user": 0.00662107,
      "system": 0.006078100694444446,
      "min": 0.0081196054,
      "max": 0.020247892400000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.01367276765698324,
      "stddev": 0.0024724705975748525,
      "median": 0.0134605424,
      "user": 0.007282258324022343,
      "system": 0.007435597765363127,
      "min": 0.008358161400000001,
      "max": 0.0219987264
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.015527867993749998,
      "stddev": 0.004518597165131257,
      "median": 0.0145660309,
      "user": 0.008516176875000002,
      "system": 0.008088421875000003,
      "min": 0.0089814604,
      "max": 0.0326920024
    },
    {
      "command": "pnpr@main",
      "mean": 0.01713836073333333,
      "stddev": 0.0042525077622588645,
      "median": 0.0165854484,
      "user": 0.009592642857142855,
      "system": 0.008633595238095237,
      "min": 0.0107324354,
      "max": 0.029227565400000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 15.5 ± 2.0 11.3 23.0 1.02 ± 0.19
pacquet@main 15.8 ± 2.0 11.3 22.3 1.04 ± 0.19
pnpr@HEAD 16.2 ± 2.3 11.6 25.4 1.07 ± 0.21
pnpr@main 15.2 ± 2.0 11.4 21.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.015518218967941174,
      "stddev": 0.002007439297267756,
      "median": 0.015385715240000002,
      "user": 0.007980185000000002,
      "system": 0.008380124999999999,
      "min": 0.011319363740000001,
      "max": 0.022978821740000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.01580252229555556,
      "stddev": 0.0019535679669545974,
      "median": 0.015646930240000002,
      "user": 0.00876660861111111,
      "system": 0.007891180555555558,
      "min": 0.01127511074,
      "max": 0.022309676740000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.016176999555642467,
      "stddev": 0.002275917454767523,
      "median": 0.01590050574,
      "user": 0.00866973877094972,
      "system": 0.008335097765363127,
      "min": 0.01162815174,
      "max": 0.025436091740000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.015160526079622637,
      "stddev": 0.0020192099083665123,
      "median": 0.01495815774,
      "user": 0.008773201509433962,
      "system": 0.007248405660377359,
      "min": 0.01138451574,
      "max": 0.021947217740000004
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.121 ± 0.155 2.931 3.379 1.94 ± 0.20
pacquet@main 2.935 ± 0.052 2.856 3.034 1.83 ± 0.17
pnpr@HEAD 1.628 ± 0.076 1.537 1.777 1.01 ± 0.10
pnpr@main 1.607 ± 0.145 1.442 1.843 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.12077256566,
      "stddev": 0.15526520003205974,
      "median": 3.08980614066,
      "user": 3.28536426,
      "system": 2.6242286200000002,
      "min": 2.93147146266,
      "max": 3.37865179166
    },
    {
      "command": "pacquet@main",
      "mean": 2.93472371206,
      "stddev": 0.052217913538490895,
      "median": 2.93978788116,
      "user": 2.96503556,
      "system": 2.4030028199999993,
      "min": 2.85631273666,
      "max": 3.03355972966
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.62833256986,
      "stddev": 0.07557797861517897,
      "median": 1.60926671166,
      "user": 1.6057930599999999,
      "system": 1.77823012,
      "min": 1.53687283466,
      "max": 1.77673140566
    },
    {
      "command": "pnpr@main",
      "mean": 1.6072376678600002,
      "stddev": 0.14528857580486068,
      "median": 1.58226775366,
      "user": 1.39679576,
      "system": 1.5584562200000003,
      "min": 1.44206844666,
      "max": 1.84303738466
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 439.0 ± 48.5 395.1 559.0 1.30 ± 0.17
pacquet@main 442.6 ± 37.5 402.3 508.3 1.31 ± 0.15
pnpr@HEAD 340.6 ± 30.6 297.6 377.2 1.01 ± 0.12
pnpr@main 337.5 ± 24.4 303.8 367.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.43902489859999994,
      "stddev": 0.04852982889036776,
      "median": 0.43117159790000004,
      "user": 0.66415626,
      "system": 0.90457968,
      "min": 0.39508884340000006,
      "max": 0.5590213734
    },
    {
      "command": "pacquet@main",
      "mean": 0.44260419250000005,
      "stddev": 0.03754446146446538,
      "median": 0.43264245590000006,
      "user": 0.66062736,
      "system": 0.97192808,
      "min": 0.40229113140000006,
      "max": 0.5083319934
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3405711278,
      "stddev": 0.03064838265233422,
      "median": 0.3420898574000001,
      "user": 0.25065076000000003,
      "system": 0.60569038,
      "min": 0.29762826340000004,
      "max": 0.37718992340000007
    },
    {
      "command": "pnpr@main",
      "mean": 0.33751373380000005,
      "stddev": 0.0243560469687406,
      "median": 0.33612023090000004,
      "user": 0.25630565999999994,
      "system": 0.6069102799999999,
      "min": 0.30375960440000005,
      "max": 0.36742767440000007
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.678 ± 0.032 1.608 1.738 5.55 ± 0.33
pacquet@main 1.674 ± 0.097 1.597 1.929 5.53 ± 0.44
pnpr@HEAD 0.307 ± 0.014 0.284 0.336 1.02 ± 0.07
pnpr@main 0.303 ± 0.017 0.282 0.332 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.67800690234,
      "stddev": 0.031853446695153456,
      "median": 1.6796577252399998,
      "user": 1.0850149999999998,
      "system": 1.06235544,
      "min": 1.6078886312399998,
      "max": 1.7377764082399998
    },
    {
      "command": "pacquet@main",
      "mean": 1.67390924274,
      "stddev": 0.09682965947735064,
      "median": 1.64571251924,
      "user": 1.0438064,
      "system": 1.05170474,
      "min": 1.59714181924,
      "max": 1.92902208024
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30720014834000003,
      "stddev": 0.014334931935899296,
      "median": 0.30620318124,
      "user": 0.24976959999999998,
      "system": 0.54170914,
      "min": 0.28411620024,
      "max": 0.33641366024
    },
    {
      "command": "pnpr@main",
      "mean": 0.30261053004000005,
      "stddev": 0.01680165206898092,
      "median": 0.30059353524000004,
      "user": 0.2219966,
      "system": 0.55820744,
      "min": 0.28191357924000005,
      "max": 0.33244746924
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 219.5 ± 10.6 198.5 237.2 2.19 ± 0.13
pacquet@main 214.2 ± 19.8 192.8 248.9 2.14 ± 0.21
pnpr@HEAD 100.0 ± 3.5 91.4 105.7 1.00
pnpr@main 118.1 ± 15.0 99.6 159.3 1.18 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21949254536461546,
      "stddev": 0.01063461930405219,
      "median": 0.22160378998000002,
      "user": 0.22385189692307694,
      "system": 0.08447195076923077,
      "min": 0.19854711398000002,
      "max": 0.23717593698000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.2142258326466667,
      "stddev": 0.01979445772993193,
      "median": 0.20826546248000002,
      "user": 0.21085815333333333,
      "system": 0.07261355333333333,
      "min": 0.19280653798000003,
      "max": 0.24893751698000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1000156633248276,
      "stddev": 0.0035451858798510255,
      "median": 0.10105479698,
      "user": 0.04166706137931034,
      "system": 0.015559409655172418,
      "min": 0.09141956398,
      "max": 0.10569936798
    },
    {
      "command": "pnpr@main",
      "mean": 0.11810781523,
      "stddev": 0.01496649892589409,
      "median": 0.11483346498,
      "user": 0.05096439142857143,
      "system": 0.02327357714285715,
      "min": 0.09961241098,
      "max": 0.15934577598000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 893.9 ± 210.8 514.2 1076.2 1.00
pacquet@main 997.5 ± 182.6 576.2 1226.7 1.12 ± 0.33
pnpm@HEAD 6471.6 ± 2324.7 4290.2 11841.9 7.24 ± 3.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8938941805222222,
      "stddev": 0.2107722518336349,
      "median": 1.0207244863,
      "user": 0.9090657022222222,
      "system": 0.22751499333333333,
      "min": 0.5141549273,
      "max": 1.0762235813
    },
    {
      "command": "pacquet@main",
      "mean": 0.9974841174111112,
      "stddev": 0.18257501390537895,
      "median": 1.0349692033,
      "user": 1.0229752577777775,
      "system": 0.24260421555555556,
      "min": 0.5761790313,
      "max": 1.2267387693
    },
    {
      "command": "pnpm@HEAD",
      "mean": 6.471649640855556,
      "stddev": 2.3247181384721634,
      "median": 5.674001369300001,
      "user": 9.786528368888888,
      "system": 0.5378532155555554,
      "min": 4.2902144283000005,
      "max": 11.8419444543
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.775 ± 0.197 4.532 5.019 1.30 ± 0.07
pacquet@main 4.771 ± 0.198 4.527 5.104 1.30 ± 0.07
pnpr@HEAD 3.767 ± 0.079 3.632 3.900 1.03 ± 0.04
pnpr@main 3.659 ± 0.135 3.491 3.970 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.775145066959999,
      "stddev": 0.1973935369879696,
      "median": 4.74850759686,
      "user": 2.22306342,
      "system": 2.0995260399999998,
      "min": 4.5324965513599995,
      "max": 5.01888384136
    },
    {
      "command": "pacquet@main",
      "mean": 4.7711079735599995,
      "stddev": 0.19780439090983995,
      "median": 4.75940284036,
      "user": 2.26925852,
      "system": 2.1881435399999996,
      "min": 4.52663826136,
      "max": 5.10442849936
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.7671886458600006,
      "stddev": 0.07916787129751512,
      "median": 3.75048580686,
      "user": 2.2546101199999997,
      "system": 2.32968544,
      "min": 3.63176130136,
      "max": 3.90028651636
    },
    {
      "command": "pnpr@main",
      "mean": 3.6592486264599997,
      "stddev": 0.13517116365043344,
      "median": 3.64567347886,
      "user": 2.0127883199999994,
      "system": 1.9500865399999998,
      "min": 3.4905407083599997,
      "max": 3.97016337236
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store — the layout pnpm 12 installs into by default. Comparable to that scenario head-to-head.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 198.9 ± 17.8 167.6 229.6 1.12 ± 0.15
pacquet@main 176.9 ± 16.6 160.1 224.9 1.00
pnpr@HEAD 190.6 ± 12.0 169.9 214.2 1.08 ± 0.12
pnpr@main 204.1 ± 22.4 173.5 250.9 1.15 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.19887817379818182,
      "stddev": 0.01775934977382055,
      "median": 0.19612527898,
      "user": 0.27081678181818186,
      "system": 0.22763717454545454,
      "min": 0.16763281998000001,
      "max": 0.22958352998
    },
    {
      "command": "pacquet@main",
      "mean": 0.1769244362657143,
      "stddev": 0.016648271627747815,
      "median": 0.17086810298,
      "user": 0.2441055285714286,
      "system": 0.20276764857142854,
      "min": 0.16010436898000002,
      "max": 0.22489660898000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.19060273444153847,
      "stddev": 0.012045082376995406,
      "median": 0.19143887798,
      "user": 0.24586490769230773,
      "system": 0.18852872,
      "min": 0.16989369998,
      "max": 0.21423317898000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.2040620864085714,
      "stddev": 0.022398408839348027,
      "median": 0.19924489598,
      "user": 0.25226859999999995,
      "system": 0.20494043428571432,
      "min": 0.17348126798000002,
      "max": 0.25090536998
    }
  ]
}

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14739
Testbedpacquet

🚨 4 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
167.63 ms
(+25.62%)Baseline: 133.45 ms
160.14 ms
(104.68%)

isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
331.62 ms
(+53.04%)Baseline: 216.68 ms
260.02 ms
(127.54%)

isolated-linker.repeat-install.cold-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
11.32 ms
(+71.58%)Baseline: 6.60 ms
7.92 ms
(142.98%)

isolated-linker.repeat-install.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
8.12 ms
(+25.66%)Baseline: 6.46 ms
7.75 ms
(104.72%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
167.63 ms
(+25.62%)Baseline: 133.45 ms
160.14 ms
(104.68%)

isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,931.47 ms
(+18.62%)Baseline: 2,471.30 ms
2,965.57 ms
(98.85%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,607.89 ms
(+3.61%)Baseline: 1,551.79 ms
1,862.15 ms
(86.35%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
395.09 ms
(+8.61%)Baseline: 363.76 ms
436.51 ms
(90.51%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
198.55 ms
(-1.89%)Baseline: 202.37 ms
242.85 ms
(81.76%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,428.37 ms
(+7.01%)Baseline: 2,269.36 ms
2,723.24 ms
(89.17%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,532.50 ms
(+4.87%)Baseline: 4,321.91 ms
5,186.30 ms
(87.39%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
331.62 ms
(+53.04%)Baseline: 216.68 ms
260.02 ms
(127.54%)

isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
514.15 ms
(-14.97%)Baseline: 604.64 ms
725.57 ms
(70.86%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
11.32 ms
(+71.58%)Baseline: 6.60 ms
7.92 ms
(142.98%)

isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
8.12 ms
(+25.66%)Baseline: 6.46 ms
7.75 ms
(104.72%)

🐰 View full continuous benchmarking report in Bencher

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Holding this PR: the integrated benchmark's gvs-linker.fresh-restore.hot-cache.hot-store row has pacquet@HEAD slower than pacquet@main on the same runner in all three runs of this commit — 221.6 ± 15.6 vs 199.4 ± 22.2 ms, 141.1 ± 8.8 vs 129.3 ± 4.7, and 198.9 ± 17.8 vs 176.9 ± 16.6 (1.11×, 1.09×, 1.12×). The isolated-linker hot restore shows HEAD faster in two of the three, and every multi-second scenario is flat, so it is specific to the GVS restore, which is the path this PR restructures. The other Bencher alerts are runner-era noise (main's own runs sit over their boundaries too). Bisecting the thirteen commits with probe branches before deciding anything.


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

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Bisect result: the GVS hot-restore slowdown does not reproduce, so the hold is lifted.

Three probe branches ran the integrated benchmark through workflow_dispatch (same runner class, pacquet@HEAD vs pacquet@main on the same machine), each cut after a prefix of this PR's commits:

probe commits gvs-linker.fresh-restore.hot-cache.hot-store HEAD vs main ratio
after-3 (3a94fc3d0b) plan + settle phases 181.5 ± 20.5 vs 186.2 ± 12.9 ms 0.97
after-7 (fce10a4917) + fetch, link, build phases 220.0 ± 22.8 vs 199.7 ± 19.2 ms 1.10
after-10 (9e0e120581) + inputs view, engine-name plan, timer fix 149.2 ± 10.8 vs 151.8 ± 9.7 ms 0.98

Runs 34386887050, 34386889954, 34386893490 (the only failing step is the Bencher upload, which has no PR to attach to). The three commits after after-10 are two doc-comment edits and moving a "phase complete" log line past a ?, so after-10 is the PR's code. A superset of the commits that measured 1.10 measures 0.98, which puts the earlier 1.09 to 1.12 readings inside this row's noise: in the same runs, pnpr@HEAD and pnpr@main (identical binaries) differ by up to 9% on the cold-restore row and by 30% on the isolated hot-restore row.


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

@zkochan
zkochan merged commit 21e6009 into main Sep 9, 2026
36 of 37 checks passed
@zkochan
zkochan deleted the perfectionist-pipeline branch September 9, 2026 18:53
biisal pushed a commit to biisal/pnpm that referenced this pull request Sep 15, 2026
…es (pnpm#14739)

Restructure InstallFrozenLockfile::run as a pipeline of &self phases —
plan_materialization, settle_skip_set, fetch, link, build — each
returning one struct the next consumes whole, where run alone bound 77
names.

The plan borrows the allow-builds policy rather than owning it: the
directory-clone cache keeps a reference to the policy, so the two cannot
share a struct. Every phase returns an explicit Send future capturing
only its Copy inputs, because a future holding &self would not be Send
(the verification override is a boxed future without Sync). The owned
inputs run consumes are taken off self before the phases borrow it.

Hand each phase the install's borrowed inputs as one Copy value,
FrozenInputs, and keep each phase's output whole for the next; run and
every phase bind at most twelve names.

Drop the DependencyGroupList type parameter: the one caller hands a Vec
and run collected the iterator into another Vec on entry.

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

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants