Skip to content

refactor(package-manager): run the fresh install as a pipeline of phases - #14746

Merged
zkochan merged 19 commits into
mainfrom
perfectionist-fresh-path
Sep 9, 2026
Merged

zkochan merged 19 commits into
mainfrom
perfectionist-fresh-path

Conversation

@zkochan

@zkochan zkochan commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Third installment of adopting perfectionist::too_many_local_bindings at max_bindings = 12; the fresh-lockfile counterpart of #14739. Related to #14562.

InstallWithFreshLockfile::run bound 148 distinct names. It is now a pipeline of phases, and install_with_fresh_lockfile.rs has no site over the cap left:

let (install, mut owned) = self.split();          // Copy view of the 26 borrowed inputs; the 18 owned ones apart
let mut setup    = set_up_resolvers(install, &mut owned).await?;   // registries, pick policy, store handles, resolver chain
let mut resolved = resolve_graph(install, &mut owned, &mut setup).await?;
// ... the resolvers and the metadata cache are dropped here, as before ...
let built_lockfile = build_lockfile_phase(install, ..., &resolved, ...).await?;
let initial = MaterializationScope::initial(install, setup.shape.is_hoisted, &built_lockfile);
let mut plan = plan_fresh_materialization(install, ..., PlanLockfiles { initial: initial.lockfile(&built_lockfile), built: &built_lockfile }, ...).await?;
let scope   = initial.finalize(install, setup.shape.is_hoisted, &built_lockfile, &plan.skipped);
let on_disk = run_on_disk_phases(OnDiskInputs { ctx: &InstallContext { ... }, ... }, &mut plan.skipped, ...).await?;

Inside, resolve_graph is prepare_resolution → the resolve pass → collect_resolution, and run_on_disk_phases is materialize → link → build, three methods on OnDiskInputs that read the install context #14737 introduced instead of nine fields of their own.

Things this path forced that the frozen one did not, each recorded in its commit:

  • Two of the views the later phases read borrow values the resolve phase owns — the pnpmfile's rewritten manifests, and the repaired wanted lockfile under fix-lockfile — so Resolved carries the owned values and run derives the views after the phase returns. Inside the phase the manifest view is a Cow, so the common case allocates nothing, as before.
  • The layout and the directory-clone cache borrow the initial materialization closure's lockfile, so run owns that closure and the plan borrows it; the closure over the skip set is a second value (MaterializationScope::finalize).
  • --lockfile-only returned early from the middle of run; the lockfile phase now returns the lockfile and run branches, which keeps the writer handoff in run. The allow-builds policy is built from config alone, so run builds it before the phase when it will materialize.
  • The five drops that release the resolvers and the metadata cache before materialization stay at the same point, as moves out of the setup's chain.

What the phases gained while being brought under the cap, beyond names:

  • Records for what is derived once. InstallShape (hoisting, bin-link options, filtered isolation, repair verification, transitive optionals) and ObserverSettings replace seven loose fields on the resolver setup; the partial-selection set comparison runs once where it ran twice. TrustGate, Patches and UpdateReuseScopes do the same for the resolution prep.
  • The lockfile build options split by what reads them. FreshLockfileBuildOptions mixed the fourteen fields dependencies_graph_to_lockfile lifts with six the graph build ignored by name (merge_wanted_lockfile: _, …). They are now inputs, splice: FilteredSplice and bumps: SpecBumps, each with its apply.
  • One lockfile build. build_lockfile_phase built the same options literal twice, once per branch of --lockfile-only; the branches now differ only in when the verification gate is awaited. The build_fresh_lockfile phase timing is logged under --lockfile-only too, where it was not before.

Also drops the DependencyGroupList type parameter: the one caller hands a Vec.

No user-visible behavior changes; no changeset. Nothing is cloned or allocated that was not before; every new struct is borrows, Copy scalars, or a move of a value the phase already owned. The submodules under install_with_fresh_lockfile/ (resolver_setup.rs 44, resolve.rs 38 and 25, manifest_transforms.rs 25) are the next PR.

Squash Commit Body

Restructure InstallWithFreshLockfile::run as a pipeline of phases —
set_up_resolvers, resolve_graph, build_lockfile_phase,
plan_fresh_materialization, MaterializationScope, run_on_disk_phases —
each returning one value the next reads whole. run bound 148 distinct
names; it and every phase in install_with_fresh_lockfile.rs are under
the 12-name cap.

The install's inputs are split once into a Copy FreshInputs view and
the owned OwnedInputs the phases consume. The resolve phase's two
borrowed views come back as owned values, and run derives the views;
the plan borrows the initial materialization closure run owns. The
resolvers and the metadata cache are dropped where they were. The
on-disk phases are three methods on their inputs reading one
InstallContext.

Record what is derived once as InstallShape, ObserverSettings,
TrustGate, Patches and UpdateReuseScopes. Split the fresh lockfile
build options by their readers (inputs, splice, bumps) and build the
lockfile once under --lockfile-only and otherwise.

Drop the DependencyGroupList type parameter: the one caller hands a Vec.

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

  • Bug Fixes
    • Improved fresh-lockfile installation handling to preserve dependency group information correctly.
    • Added safer initialization for registry configuration when no registries are specified.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 28f0e180-3337-4942-a687-dadfd73b1837

📥 Commits

Reviewing files that changed from the base of the PR and between 6620943 and 8e6bb73.

📒 Files selected for processing (1)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: ce70f1fb-0591-4618-951e-7b4f23608e3f

📥 Commits

Reviewing files that changed from the base of the PR and between 21e6009 and 8af5e24.

📒 Files selected for processing (3)
  • pnpm/crates/package-manager/src/install/materialize.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs

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


📝 Walkthrough

Walkthrough

The fresh-lockfile installation path now borrows dependency_groups. The Registries struct now supports default construction with empty maps.

Changes

Fresh-lockfile installation setup

Layer / File(s) Summary
Installation inputs and registry defaults
pnpm/crates/package-manager/src/install/materialize.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs
The installer receives dependency_groups by reference. Registries derives Default for empty by_scope and named maps.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 8af5e

This refactor updates fresh-lockfile setup to borrow dependency groups and allow empty registry defaults. No concrete current-head behavior or production risk remains identified, so it is ready to merge.

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-fresh-path

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.60     23.7±4.56ms    15.8 MB/sec    1.00     14.8±0.89ms    25.4 MB/sec
packument/parse                                  1.62     68.7±7.80µs   965.1 MB/sec    1.00     42.5±0.78µs  1560.6 MB/sec
tarball/download_dependency                      1.00      4.2±0.34ms  1033.2 KB/sec    1.04      4.3±0.58ms   997.3 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.04   266.2±39.23ms 60.1 KElem/sec    1.00   255.9±35.25ms 62.5 KElem/sec
workspace_resolution/hoist_heavy                 1.16   633.3±53.69ms        ? ?/sec    1.00   547.2±51.09ms        ? ?/sec
workspace_sort/chained_projects                  1.22    54.0±15.07ms        ? ?/sec    1.00    44.4±13.12ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (21e6009) to head (8e6bb73).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14746      +/-   ##
==========================================
+ Coverage   90.26%   90.30%   +0.03%     
==========================================
  Files         795      795              
  Lines      152748   153301     +553     
==========================================
+ Hits       137874   138431     +557     
+ Misses      14874    14870       -4     

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

zkochan and others added 15 commits September 9, 2026 20:55
…nning

`InstallWithFreshLockfile::run` destructured forty-five fields into
locals on entry. `split` separates the twenty-six the phases borrow, as
one `Copy` `FreshInputs`, from the eighteen one of them consumes, as
`OwnedInputs`; the body still reads the same names for now.

The dependency groups are borrowed as a slice: the one caller hands a
`Vec`, and the generic parameter only existed to collect it again.

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

The first hundred lines of `InstallWithFreshLockfile::run` opened the
store, resolved the registries, built the pick policy and the resolver
chain, and unpacked each of those into locals. `set_up_resolvers` owns
that work and returns `ResolverSetup`, which keeps `Registries`,
`PickPolicy`, `StoreIndexHandles` and `ResolverChain` whole; `run`
still unpacks them for now, until the phases after it read the setup
directly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
The resolve pass sat in the middle of `run` as two hundred and seventy
lines reading forty-odd names. `resolve` owns it: it takes the setup
and the owned inputs by mutable borrow, consumes the registries, the
pnpmfile hook and the shared wanted lockfile, and returns `Resolved`.

Two of the views the later phases read borrow values the phase owns —
the pnpmfile's rewritten manifests, and the repaired wanted lockfile
under `fix-lockfile` — so `Resolved` carries the owned values and `run`
derives the views after the phase returns. Inside the phase the
manifest view is a `Cow`, so the common case allocates nothing, as
before.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
`build_lockfile_phase` owns the lockfile build and the filtered-repair
verification, with the gate awaited before the build under
`--lockfile-only` and only for a filtered repair otherwise, as before.
It reads the resolve output by shared reference; the one value it
consumes, the resolved publish times, is taken off that output in `run`
so the two views `run` derives from it stay valid across the call.

The allow-builds policy comes from the config alone, so `run` builds it
before the phase when it will materialize and branches on that to
finish a `--lockfile-only` install, which keeps the writer handoff in
`run`. The resolver handles are still dropped where they were, before
the build, so the memory they hold is released at the same point.

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

`split` destructured all forty-five fields only to move them into two
literals. Reading them off `self` binds nothing.

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

`plan_fresh_materialization` detects the host, settles the engine name,
builds the slot layout and the directory-clone cache, and computes the
skip set, returning one `FreshPlan`. The initial materialization
closure stays owned by `run`: the layout and the cache borrow its
lockfile, so the plan borrows it rather than owning it, as the frozen
plan borrows the allow-builds policy.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
`run` unpacked the setup, the resolve output, the plan and the on-disk
output into locals only to forward them. It keeps each as the value it
is and reads a field where a phase needs it, and the borrowed inputs
come off the `FreshInputs` view the same way.

The resolver handles are released at the same point as before, now as
moves out of the setup's chain, so the custom fetchers the cold batch
consults survive while the resolvers and the metadata cache do not.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
The importers a selected install materializes were computed inline
twice in `run`: once without a skip set, for the host probe and the
layout, and once over the skip set the plan produced, for the on-disk
phases. `MaterializationScope` owns the first closure and `finalize`
builds the second with the project anchors; the plan borrows the first
closure's lockfile, so the second is a separate value.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
The registries ride inside the resolver setup until the resolve phase
takes them, the persisted lockfile comes back as one value, the
early-materializer finish accepts the option it is given, and the two
one-use views are built at their call sites. The lockfile phase takes
the resolved times before the resolve output it borrows, so `run` can
take them off that output in the same call.

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

`resolve` the function shadowed `resolve` the module in doc links, and
the closure parameter in the materialization scope needed a name.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
`prepare_resolution` owns what the resolve pass reads before it runs:
the manifest transforms, kept whole, the repaired wanted lockfile, the
patches, the pnpmfile hooks with their loggers as one `PnpmfileHooks`,
and the update reuse scopes. It runs the pnpmfile's pre-resolution hook
where it ran before. `resolve_graph` still unpacks the result for now.

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

`resolve_graph` unpacked the prep into twenty names to fill two struct
literals; the literals read the prep's fields directly now. The work
after the pass — the release-age policy, the patch-usage check, the
peer issues and the phase's output — is `collect_resolution`, which
takes the prep by value and assembles `Resolved` from it. The two facts
it needs from the manifest view, which borrows the prep, are gathered
before the prep moves.

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

The on-disk phases read the install context the frozen path already
builds instead of nine fields of their own, and run as three methods
on their inputs: materialize, link and build, each reading the previous
phase's output whole. The build consumes the inputs so the store-index
writer handle is dropped inside it, where the side-effects rows are
queued, as before.

Related to #14562.

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

The resolver setup carries the install's shape (hoisting, bin-link
options, filtered isolation, repair verification, transitive optionals)
and the resolution observer's settings as two records derived once,
instead of seven loose fields; the partial-selection check runs once
where it ran twice. The resolution prep groups the trust gate, the
patches and the update reuse scopes the same way, and the pnpmfile
hooks run their own pre-resolution hook.

Related to #14562.

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

build_lockfile_phase built the same options literal twice, once per
branch of --lockfile-only; the branches now differ only in when the
verification gate is awaited, and the build's phase timing is logged
under --lockfile-only too. The options are split by what reads them:
the inputs dependencies_graph_to_lockfile lifts, the filtered splice
and the spec bumps, each applying itself, where the graph build
ignored six fields by name.

The materialization plan lays out the slots and computes the skip set
as two named steps, and the lockfile-only tail reads its options in
place. With these, install_with_fresh_lockfile.rs has no function over
the twelve-name cap.

Related to #14562.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
@zkochan
zkochan force-pushed the perfectionist-fresh-path branch from 85cd2f1 to 8af5e24 Compare September 9, 2026 19:08
@zkochan
zkochan marked this pull request as ready for review September 9, 2026 19:08
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Refactor fresh-lockfile installs into a phased pipeline

✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Decomposes fresh installs into setup, resolution, lockfile, planning, and on-disk phases.
• Introduces typed phase inputs and outputs to clarify ownership and borrowing boundaries.
• Preserves lockfile-only exits, resource release timing, and materialization behavior.
Diagram

graph TD
  Setup["Resolver Setup"] --> Resolve["Resolve Graph"] --> Lockfile["Build Lockfile"] --> Mode{"Materialize?"}
  Mode -->|Yes| Plan["Plan Materialization"] --> Disk["Materialize Link Build"] --> Persist["Persist Lockfile"]
  Mode -->|No| Only["Lockfile Only"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Extract phases into dedicated modules
  • ➕ Reduces the size of the already large orchestration file
  • ➕ Creates stronger ownership boundaries and easier phase-level navigation
  • ➕ Allows phase-specific tests and documentation to live beside implementations
  • ➖ Introduces broader file and visibility churn for a behavior-preserving refactor
  • ➖ Makes lifetime-heavy shared types harder to keep private
  • ➖ Repeats an earlier modularization strategy that may not match current code organization

Recommendation: Keep the PR’s typed, in-file phased pipeline for this change. It directly addresses excessive local bindings while minimizing visibility and module churn, preserves explicit resource-release points, and aligns the fresh path with the frozen-install pipeline. Dedicated modules can follow if individual phases continue growing.

Files changed (3) +1430 / -1106

Refactor (3) +1430 / -1106
materialize.rsBorrow dependency groups during materialization +1/-1

Borrow dependency groups during materialization

• Passes the collected dependency groups by reference when constructing materialization inputs, matching the fresh installer’s slice-based API.

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

install_with_fresh_lockfile.rsDecompose fresh installs into typed pipeline phases +1428/-1105

Decompose fresh installs into typed pipeline phases

• Replaces the monolithic fresh-lockfile run method with typed setup, resolution, lockfile-building, materialization-planning, on-disk, and persistence phases. Introduces structured borrowed and owned inputs, explicit lifetime-bearing phase outputs, scoped lockfile views, and methods for materialize/link/build while preserving lockfile-only behavior and resolver cache release timing.

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

resolver_setup.rsAllow registry handles to be moved with take +1/-0

Allow registry handles to be moved with take

• Derives 'Default' for 'Registries', enabling the resolution phase to move registry maps out of setup with 'std::mem::take'.

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

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

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. A host-probe comment repeats its type ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The doc comment on HostProbeInputs only paraphrases that its two fields are inputs consumed by
plan_fresh_materialization. Because the fields and consuming parameter make that relationship
explicit, later renames or regrouping require synchronized prose without preserving any invariant or
rationale.
Code

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

+/// The host probe's inputs, consumed by the plan.
Relevance

●●● Strong

Recent repository precedents accept removing redundant Rust comments that restate names, structure,
or directly inferable behavior.

PR-#14593
PR-#14201

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713467 prohibits comments that merely restate identifiers or directly inferable structure. The
added comment says only that HostProbeInputs contains inputs consumed by the plan, while the
adjacent fields and the plan_fresh_materialization parameter already express that relationship.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1916-1920]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1812-1824]

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 `HostProbeInputs` doc comment merely repeats the type's role and does not document a rationale, invariant, or ownership constraint.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1916-1920]

## Recommended Fix
Remove the redundant comment, or replace it with a durable explanation of why these values must be grouped and consumed together if such a constraint exists.

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


2. Lockfile docs misstate persistence ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
PersistedLockfile documents lockfile as the wanted lockfile as written, although
persist_fresh_lockfile also populates it when save_lockfile is false. In that branch the
implementation states that nothing was persisted, so a maintainer reading the type contract can
mistake an in-memory built lockfile for evidence of an on-disk file.
Code

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

+/// The wanted lockfile as written, and whether its verification may
+/// be recorded against it.
Relevance

●●● Strong

The documentation misstates observable behavior; repository precedents accept clarifying comments to
reflect current persistence semantics.

PR-#13477
PR-#13940

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 772199 requires comments to describe current outputs and side effects accurately. The new type
documentation claims the lockfile is as written, but the !save_lockfile branch returns
Some(built_lockfile) while explicitly recording that nothing was persisted.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2732-2739]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2752-2758]

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 `PersistedLockfile` documentation says its lockfile was written, but the value is also present when lockfile persistence is disabled.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2732-2739]

## Recommended Fix
Document that `lockfile` contains the built wanted lockfile when lockfiles are enabled, regardless of whether this invocation wrote it, while `can_record_lockfile_verification` indicates whether persistence permits verification recording.

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


3. A plan comment repeats its fields ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The FreshPlan doc comment merely enumerates the host, engine, layout, cache, and skip-set fields
immediately below it. Any later addition or regrouping must update this prose without gaining
rationale about the plan's invariants or ownership constraints.
Code

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

+/// What the materialization plan decides before the on-disk phases:
+/// the host, the engine name, the slot layout, the directory-clone
+/// cache and the skip set.
Relevance

●●● Strong

Recent precedents accept removing comments that merely restate fields or obvious implementation
behavior.

PR-#14593
PR-#14534
PR-#13766

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 rejects comments that only restate identifiers or directly visible code. The
added comment lists the values represented by the immediately following FreshPlan fields without
adding intent or constraints.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1797-1807]

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 `FreshPlan` doc comment repeats the fields visible in the struct instead of documenting rationale, constraints, or an invariant.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1797-1807]

## Recommended Fix
Remove the redundant comment, or replace it with concise documentation of a non-obvious ownership or phase-boundary invariant that callers and maintainers must preserve.

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


View medium (1)
4. Two manifest views duplicate conversion ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
manifests_view repeats the effective-manifest selection and owned reference-map construction
already implemented by effective_manifests, and run discards the first map after resolve_graph
before reconstructing it for later phases. When compatibility transformations populate the effective
map—as they do by default—fresh install, add, update, and remove operations clone and insert every
importer ID twice across resolution, lockfile construction, linking, and building, while later
selection changes must also remain synchronized between both paths.
Code

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

+    if effective.is_empty() {
+        std::borrow::Cow::Borrowed(declared)
+    } else {
+        std::borrow::Cow::Owned(
Relevance

●● Moderate

Recent reviews accept allocation-reduction refactors, but similar cross-path deduplication was
rejected; maintainability intent remains subjective.

PR-#13762
PR-#14201
PR-#13173

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added manifests_view and the existing effective_manifests use the same selection rule: they
borrow declared manifests when the transformed map is empty, otherwise allocate a BTreeMap by
cloning effective importer IDs and borrowing transformed manifests. resolve_graph builds this
owned map through manifests_view, but run later calls effective_manifests and repeats the same
collection after the first map has been dropped; because compatibility-database processing is
enabled by default and populates the effective map when compatibility extensions are active, the
duplicated allocation and cloning occur in the normal transformed-manifest path.

Rule 713439: Avoid reimplementing existing functionality; extract and reuse shared modules
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1205-1218]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2137-2147]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[876-878]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1209-1218]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1230-1239]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2137-2146]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/manifest_transforms.rs[61-76]
pnpm/crates/config/src/lib.rs[1671-1674]

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

## Issue description
`manifests_view` duplicates the effective-manifest selection and reference-map construction already performed by `effective_manifests`. The phase refactor builds the transformed importer-manifest map for `resolve_graph`, drops it when that phase returns, and then reconstructs it for lockfile and on-disk phases, cloning and inserting importer IDs twice.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[876-878]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1205-1232]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2137-2147]

## Recommended Fix
Move ownership of the effective-manifest view to a scope spanning resolution and the later phases, and extract the transformed-manifest reference-map construction and empty-map selection into one shared helper. Construct the `BTreeMap<String, &PackageManifest>` once and pass the same borrowed view into `resolve_graph`, lockfile construction, linking, and building, while preserving the borrowed `Cow` fast path so the declared manifest map is used without allocation when no transforms are present.

ⓘ 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
✅ Cross-repo context — repo relationships
Review mode: 🧠 Deep: This is a large, behavior-preserving refactor of the install, resolution, lockfile, materialization, linking, and build pipelines with many independent ownership and lifecycle changes, creating a high density of subtle correctness, security, and performance regressions.

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 8e6bb73

Results up to commit 8af5e24 🧠 Deep


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


Remediation recommended
1. Two manifest views duplicate conversion ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
manifests_view repeats the effective-manifest selection and owned reference-map construction
already implemented by effective_manifests, and run discards the first map after resolve_graph
before reconstructing it for later phases. When compatibility transformations populate the effective
map—as they do by default—fresh install, add, update, and remove operations clone and insert every
importer ID twice across resolution, lockfile construction, linking, and building, while later
selection changes must also remain synchronized between both paths.
Code

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

+    if effective.is_empty() {
+        std::borrow::Cow::Borrowed(declared)
+    } else {
+        std::borrow::Cow::Owned(
Relevance

●● Moderate

Recent reviews accept allocation-reduction refactors, but similar cross-path deduplication was
rejected; maintainability intent remains subjective.

PR-#13762
PR-#14201
PR-#13173

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added manifests_view and the existing effective_manifests use the same selection rule: they
borrow declared manifests when the transformed map is empty, otherwise allocate a BTreeMap by
cloning effective importer IDs and borrowing transformed manifests. resolve_graph builds this
owned map through manifests_view, but run later calls effective_manifests and repeats the same
collection after the first map has been dropped; because compatibility-database processing is
enabled by default and populates the effective map when compatibility extensions are active, the
duplicated allocation and cloning occur in the normal transformed-manifest path.

Rule 713439: Avoid reimplementing existing functionality; extract and reuse shared modules
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1205-1218]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2137-2147]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[876-878]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1209-1218]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1230-1239]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2137-2146]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/manifest_transforms.rs[61-76]
pnpm/crates/config/src/lib.rs[1671-1674]

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

## Issue description
`manifests_view` duplicates the effective-manifest selection and reference-map construction already performed by `effective_manifests`. The phase refactor builds the transformed importer-manifest map for `resolve_graph`, drops it when that phase returns, and then reconstructs it for lockfile and on-disk phases, cloning and inserting importer IDs twice.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[876-878]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1205-1232]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2137-2147]

## Recommended Fix
Move ownership of the effective-manifest view to a scope spanning resolution and the later phases, and extract the transformed-manifest reference-map construction and empty-map selection into one shared helper. Construct the `BTreeMap<String, &PackageManifest>` once and pass the same borrowed view into `resolve_graph`, lockfile construction, linking, and building, while preserving the borrowed `Cow` fast path so the declared manifest map is used without allocation when no transforms are present.

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


Results up to commit ee0b783 🧠 Deep


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


Remediation recommended
1. A plan comment repeats its fields ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The FreshPlan doc comment merely enumerates the host, engine, layout, cache, and skip-set fields
immediately below it. Any later addition or regrouping must update this prose without gaining
rationale about the plan's invariants or ownership constraints.
Code

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

+/// What the materialization plan decides before the on-disk phases:
+/// the host, the engine name, the slot layout, the directory-clone
+/// cache and the skip set.
Relevance

●●● Strong

Recent precedents accept removing comments that merely restate fields or obvious implementation
behavior.

PR-#14593
PR-#14534
PR-#13766

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 rejects comments that only restate identifiers or directly visible code. The
added comment lists the values represented by the immediately following FreshPlan fields without
adding intent or constraints.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1797-1807]

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 `FreshPlan` doc comment repeats the fields visible in the struct instead of documenting rationale, constraints, or an invariant.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1797-1807]

## Recommended Fix
Remove the redundant comment, or replace it with concise documentation of a non-obvious ownership or phase-boundary invariant that callers and maintainers must preserve.

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


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

The resolve phase built the effective-manifest view for the walk and
run built it again for the lockfile and on-disk phases, one extra map
of importer references per install whenever a transform applied, which
the compatibility database does by default. run owns the declared and
the transformed manifests as ManifestSlots, so the resolve phase hands
back the one view every later phase reads.

Related to #14562.

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

Addressed Qodo's finding (the effective-manifest view built twice) in ee0b783: run now owns the declared and the transformed importer manifests as ManifestSlots, and resolve_graph hands back the one Cow view (Resolved::importer_manifests) that the lockfile and on-disk phases read. effective_manifests and manifests_view are gone, so an install with the compatibility database on builds the reference map once, as before this PR.


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 ee0b783

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Qodo's second finding (the FreshPlan doc listing its fields) is addressed in 58600a6: the comment now states the one contract the on-disk phases rely on, that everything in the plan is settled except the skip set they fold fetch failures and linking into.


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 58600a6

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

…op a restating comment

The save's own doc comment goes back onto persist_fresh_lockfile, from
which the struct's insertion had separated it.

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

Both of Qodo's latest findings are addressed in 6620943: the HostProbeInputs comment is gone (the name and the consuming parameter say it), and PersistedLockfile now documents what it actually holds, the built lockfile whenever lockfiles are enabled whether or not this run wrote it, with can_record_lockfile_verification true only for a written one. The save's own doc comment, which an earlier insertion had separated from persist_fresh_lockfile, is back on it.


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 6620943

@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: 66209432d8e7

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.568 ± 0.182 2.355 2.869 1.69 ± 0.22
pacquet@main 2.471 ± 0.114 2.323 2.641 1.62 ± 0.19
pnpr@HEAD 1.520 ± 0.164 1.341 1.774 1.00
pnpr@main 1.560 ± 0.103 1.439 1.718 1.03 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.56812354438,
      "stddev": 0.18225003665095355,
      "median": 2.5715494337800004,
      "user": 1.7848223799999996,
      "system": 1.8437322999999997,
      "min": 2.35547526828,
      "max": 2.86856166628
    },
    {
      "command": "pacquet@main",
      "mean": 2.4706975163800005,
      "stddev": 0.11395083094413405,
      "median": 2.47031629078,
      "user": 1.6447484799999998,
      "system": 1.6913132999999998,
      "min": 2.32284198228,
      "max": 2.6414936422800004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5204418070799997,
      "stddev": 0.1637939364067396,
      "median": 1.47034612078,
      "user": 1.5311202800000001,
      "system": 1.7868674999999996,
      "min": 1.3407513812799998,
      "max": 1.77385522728
    },
    {
      "command": "pnpr@main",
      "mean": 1.5600822058800001,
      "stddev": 0.10262702364748959,
      "median": 1.55079112028,
      "user": 1.6301215800000002,
      "system": 1.8539533000000001,
      "min": 1.4391910742799998,
      "max": 1.71814129728
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 301.1 ± 37.9 238.1 344.5 1.01 ± 0.19
pacquet@main 314.4 ± 52.7 243.4 392.3 1.06 ± 0.23
pnpr@HEAD 321.4 ± 60.6 267.5 453.9 1.08 ± 0.25
pnpr@main 297.6 ± 41.3 264.5 387.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.30106465386000003,
      "stddev": 0.037924206406271393,
      "median": 0.30108672766000005,
      "user": 0.29727338000000003,
      "system": 0.6415192000000001,
      "min": 0.23813231416,
      "max": 0.34449785316000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.31442006716000004,
      "stddev": 0.052665518328126305,
      "median": 0.31142582066,
      "user": 0.31503518,
      "system": 0.6697059999999999,
      "min": 0.24342508516,
      "max": 0.39225563516000006
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32138666056000004,
      "stddev": 0.06055749296858828,
      "median": 0.29536695116000006,
      "user": 0.31394128,
      "system": 0.6542579999999999,
      "min": 0.26746828416,
      "max": 0.4538896511600001
    },
    {
      "command": "pnpr@main",
      "mean": 0.29758696736000007,
      "stddev": 0.04131090792091049,
      "median": 0.28246600116000004,
      "user": 0.25843608,
      "system": 0.6562851000000001,
      "min": 0.26447724216,
      "max": 0.38711616316
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.8 ± 3.4 7.9 22.8 1.14 ± 0.38
pacquet@main 12.6 ± 2.5 6.8 22.0 1.11 ± 0.32
pnpr@HEAD 11.3 ± 2.3 7.6 18.8 1.00
pnpr@main 14.5 ± 3.2 7.8 25.3 1.29 ± 0.39
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.012811612742205884,
      "stddev": 0.0033857404274820016,
      "median": 0.011923803040000002,
      "user": 0.006619648970588238,
      "system": 0.006906568382352939,
      "min": 0.00790518404,
      "max": 0.02280787304
    },
    {
      "command": "pacquet@main",
      "mean": 0.012573585446593412,
      "stddev": 0.0025266974128663206,
      "median": 0.01246595654,
      "user": 0.006706696923076923,
      "system": 0.006591394945054946,
      "min": 0.006778540040000001,
      "max": 0.02202195904
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011278278849523806,
      "stddev": 0.002300134614209541,
      "median": 0.010776190040000001,
      "user": 0.00641641523809524,
      "system": 0.005478712952380955,
      "min": 0.007562351040000002,
      "max": 0.01878649904
    },
    {
      "command": "pnpr@main",
      "mean": 0.014521000286636764,
      "stddev": 0.003226695739461323,
      "median": 0.01464725304,
      "user": 0.007587141883408071,
      "system": 0.0077090678026905815,
      "min": 0.007838158040000001,
      "max": 0.02530336604
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.3 ± 7.0 6.8 36.3 1.31 ± 0.77
pacquet@main 13.2 ± 2.8 8.4 23.3 1.41 ± 0.34
pnpr@HEAD 11.9 ± 3.0 7.6 20.5 1.27 ± 0.36
pnpr@main 9.4 ± 1.2 6.3 12.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.012282670340000003,
      "stddev": 0.007028073839965778,
      "median": 0.009495275639999998,
      "user": 0.006182713333333334,
      "system": 0.0067115737777777755,
      "min": 0.006808305140000001,
      "max": 0.036264418140000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.013208824254624506,
      "stddev": 0.002788308505847464,
      "median": 0.01275175414,
      "user": 0.007547463794466403,
      "system": 0.006416098023715414,
      "min": 0.00835376514,
      "max": 0.02327244414
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011871136498585861,
      "stddev": 0.0030481231571300982,
      "median": 0.01151441914,
      "user": 0.006617689090909088,
      "system": 0.005923156767676768,
      "min": 0.007583920140000001,
      "max": 0.02052565114
    },
    {
      "command": "pnpr@main",
      "mean": 0.009365463246995888,
      "stddev": 0.0011548995397194135,
      "median": 0.00950571614,
      "user": 0.005292105102880659,
      "system": 0.004589784691358021,
      "min": 0.006343452140000001,
      "max": 0.01285816614
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.631 ± 0.071 2.548 2.772 1.65 ± 0.15
pacquet@main 2.600 ± 0.030 2.560 2.649 1.63 ± 0.15
pnpr@HEAD 1.595 ± 0.142 1.465 1.850 1.00
pnpr@main 1.639 ± 0.108 1.516 1.888 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6305656845399996,
      "stddev": 0.07108281984842857,
      "median": 2.62016943224,
      "user": 2.2215699399999997,
      "system": 1.8454175400000001,
      "min": 2.54847315874,
      "max": 2.77219260174
    },
    {
      "command": "pacquet@main",
      "mean": 2.60037910654,
      "stddev": 0.02984627031438594,
      "median": 2.59054540274,
      "user": 2.19001054,
      "system": 1.82899104,
      "min": 2.56026012274,
      "max": 2.64870974874
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5954559055400002,
      "stddev": 0.1416801963247515,
      "median": 1.51424209724,
      "user": 1.3885247399999998,
      "system": 1.6484686399999997,
      "min": 1.46505858474,
      "max": 1.8501962167400001
    },
    {
      "command": "pnpr@main",
      "mean": 1.63930317994,
      "stddev": 0.10818333462735466,
      "median": 1.65092571324,
      "user": 1.7316285399999998,
      "system": 1.9265484400000001,
      "min": 1.51577979674,
      "max": 1.88790565574
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 502.1 ± 43.6 443.2 567.6 1.34 ± 0.19
pacquet@main 502.2 ± 45.7 442.3 564.0 1.35 ± 0.19
pnpr@HEAD 389.9 ± 63.6 333.1 519.6 1.04 ± 0.20
pnpr@main 373.4 ± 40.4 332.5 444.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5020919054,
      "stddev": 0.0436491761948459,
      "median": 0.4989237418,
      "user": 0.75445098,
      "system": 1.02482696,
      "min": 0.4431973538,
      "max": 0.5676155638
    },
    {
      "command": "pacquet@main",
      "mean": 0.5021906118,
      "stddev": 0.045704300345866825,
      "median": 0.5009005788,
      "user": 0.7635298799999999,
      "system": 0.9810999600000001,
      "min": 0.4422945018,
      "max": 0.5640265748000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38989963910000003,
      "stddev": 0.0636294334192563,
      "median": 0.36280462230000005,
      "user": 0.30448928,
      "system": 0.65851256,
      "min": 0.3331459198,
      "max": 0.5196362248
    },
    {
      "command": "pnpr@main",
      "mean": 0.37335760030000004,
      "stddev": 0.04038619891563016,
      "median": 0.36056210480000006,
      "user": 0.30004457999999995,
      "system": 0.62491246,
      "min": 0.33253254880000005,
      "max": 0.44408334880000006
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.708 ± 0.038 1.645 1.760 5.80 ± 0.20
pacquet@main 1.713 ± 0.063 1.622 1.837 5.81 ± 0.26
pnpr@HEAD 0.337 ± 0.023 0.307 0.390 1.14 ± 0.08
pnpr@main 0.295 ± 0.008 0.285 0.310 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.70785445394,
      "stddev": 0.03825274078531382,
      "median": 1.70628688834,
      "user": 1.08428268,
      "system": 1.11255932,
      "min": 1.64473889884,
      "max": 1.75959066184
    },
    {
      "command": "pacquet@main",
      "mean": 1.71305023254,
      "stddev": 0.06283555294411927,
      "median": 1.7091997438400002,
      "user": 1.1355759799999998,
      "system": 1.14122372,
      "min": 1.62197883884,
      "max": 1.83740534984
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33696301744000007,
      "stddev": 0.023488013592488404,
      "median": 0.32875537134000005,
      "user": 0.24348078,
      "system": 0.5953450199999999,
      "min": 0.30748079784000004,
      "max": 0.39016724584000007
    },
    {
      "command": "pnpr@main",
      "mean": 0.29470318174,
      "stddev": 0.007530506807338875,
      "median": 0.29290746734000006,
      "user": 0.20915938,
      "system": 0.53545972,
      "min": 0.28537958284000003,
      "max": 0.30975138684000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 247.6 ± 14.7 228.4 272.3 2.50 ± 0.17
pacquet@main 225.9 ± 29.5 197.1 290.9 2.28 ± 0.31
pnpr@HEAD 99.3 ± 3.2 94.8 107.0 1.00 ± 0.05
pnpr@main 98.9 ± 3.3 94.2 109.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24763046061999994,
      "stddev": 0.014680553915266032,
      "median": 0.24863554531999998,
      "user": 0.26525723999999995,
      "system": 0.08994445999999998,
      "min": 0.22842214782,
      "max": 0.27234270782000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.22591118112769232,
      "stddev": 0.029505080264710208,
      "median": 0.22045227582000002,
      "user": 0.21788937076923073,
      "system": 0.09041164461538462,
      "min": 0.19713920882,
      "max": 0.29092174382
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09934288537172416,
      "stddev": 0.0032304106365730325,
      "median": 0.09931057182000001,
      "user": 0.04017469172413793,
      "system": 0.015757156551724136,
      "min": 0.09476576482000001,
      "max": 0.10697797682000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09891288267185187,
      "stddev": 0.003326940430269319,
      "median": 0.09802065182000001,
      "user": 0.03861317703703703,
      "system": 0.017644065185185184,
      "min": 0.09415025082000002,
      "max": 0.10953403082000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 957.8 ± 156.9 701.2 1184.3 1.12 ± 0.24
pacquet@main 851.8 ± 118.8 736.2 1079.7 1.00
pnpm@HEAD 3731.4 ± 337.1 3341.3 4421.2 4.38 ± 0.73
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.9578130852155555,
      "stddev": 0.15693236940603253,
      "median": 1.0152045746599998,
      "user": 0.9713206155555554,
      "system": 0.23647415555555554,
      "min": 0.70117929166,
      "max": 1.1842500916599998
    },
    {
      "command": "pacquet@main",
      "mean": 0.85176299566,
      "stddev": 0.11875644131348452,
      "median": 0.80504628666,
      "user": 0.8624595044444443,
      "system": 0.21533526666666666,
      "min": 0.73617248266,
      "max": 1.0797189006599999
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.731403333548889,
      "stddev": 0.33711557564216776,
      "median": 3.60731357366,
      "user": 5.766583282222222,
      "system": 0.32859015555555554,
      "min": 3.3412713106600003,
      "max": 4.42124958966
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.631 ± 0.137 4.496 4.900 1.30 ± 0.06
pacquet@main 4.636 ± 0.177 4.457 4.956 1.30 ± 0.06
pnpr@HEAD 3.594 ± 0.104 3.450 3.775 1.01 ± 0.04
pnpr@main 3.562 ± 0.113 3.414 3.823 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6310355159,
      "stddev": 0.13730532630197675,
      "median": 4.5831672088,
      "user": 2.0197448,
      "system": 1.9827833199999998,
      "min": 4.4964236438,
      "max": 4.9004281278
    },
    {
      "command": "pacquet@main",
      "mean": 4.6363709725,
      "stddev": 0.17747916643231826,
      "median": 4.5772201868,
      "user": 1.9677941999999997,
      "system": 1.9627574200000002,
      "min": 4.4571213288,
      "max": 4.9555107478
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5937389908999995,
      "stddev": 0.10358419410399529,
      "median": 3.5972444688,
      "user": 1.8236551000000003,
      "system": 1.8717654199999998,
      "min": 3.4495592308,
      "max": 3.7747006288
    },
    {
      "command": "pnpr@main",
      "mean": 3.5624299489,
      "stddev": 0.1126804589052783,
      "median": 3.5253730053,
      "user": 1.7295589999999996,
      "system": 1.7671970199999998,
      "min": 3.4140804498,
      "max": 3.8230546658
    }
  ]
}

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 231.3 ± 23.3 206.4 289.3 1.00
pacquet@main 235.7 ± 23.1 209.9 284.1 1.02 ± 0.14
pnpr@HEAD 346.5 ± 126.7 221.4 624.2 1.50 ± 0.57
pnpr@main 242.9 ± 30.8 181.5 298.6 1.05 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23130902676,
      "stddev": 0.023334295867781015,
      "median": 0.22816845526,
      "user": 0.30232002666666663,
      "system": 0.25430659333333333,
      "min": 0.20640780076,
      "max": 0.28928752176000005
    },
    {
      "command": "pacquet@main",
      "mean": 0.23573725439636367,
      "stddev": 0.023051692779035012,
      "median": 0.22907058876,
      "user": 0.3085680872727273,
      "system": 0.25001753272727273,
      "min": 0.20985103976,
      "max": 0.28413324076
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34647151096,
      "stddev": 0.12667092340044278,
      "median": 0.32796142726000005,
      "user": 0.39889656,
      "system": 0.27422586,
      "min": 0.22141100776,
      "max": 0.62417975376
    },
    {
      "command": "pnpr@main",
      "mean": 0.24286996239636363,
      "stddev": 0.03079283371698693,
      "median": 0.24423522876,
      "user": 0.3037922690909091,
      "system": 0.22798544181818176,
      "min": 0.18153311276,
      "max": 0.29857894276
    }
  ]
}

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14746
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
206.41 ms
(+46.60%)Baseline: 140.80 ms
168.96 ms
(122.16%)

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 (🔔)
206.41 ms
(+46.60%)Baseline: 140.80 ms
168.96 ms
(122.16%)

isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,548.47 ms
(-0.09%)Baseline: 2,550.87 ms
3,061.04 ms
(83.26%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,644.74 ms
(+2.91%)Baseline: 1,598.28 ms
1,917.93 ms
(85.76%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
443.20 ms
(+9.51%)Baseline: 404.72 ms
485.66 ms
(91.26%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
228.42 ms
(+1.58%)Baseline: 224.86 ms
269.83 ms
(84.65%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,355.48 ms
(+2.44%)Baseline: 2,299.37 ms
2,759.25 ms
(85.37%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,496.42 ms
(+3.24%)Baseline: 4,355.20 ms
5,226.24 ms
(86.04%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
238.13 ms
(+1.91%)Baseline: 233.67 ms
280.40 ms
(84.93%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
701.18 ms
(+8.32%)Baseline: 647.34 ms
776.81 ms
(90.26%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
6.81 ms
(-8.05%)Baseline: 7.40 ms
8.88 ms
(76.63%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
7.91 ms
(+11.17%)Baseline: 7.11 ms
8.53 ms
(92.64%)
🐰 View full continuous benchmarking report in Bencher

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

The Bencher alert on 66209432d8 is runner drift, not this PR: it fires on gvs-linker.fresh-restore.hot-cache.hot-store at 206 ms against a 141 ms baseline, while the same job's own control measured pacquet@HEAD at 231.3 ± 23.3 ms versus pacquet@main at 235.7 ± 23.1 ms (0.98×), and pnpr@HEAD versus pnpr@main, identical binaries, at 346.5 versus 242.9 ms (1.43×) on the same row. That scenario is the frozen path, which this PR does not touch.

The rows this PR can reach are flat on the same runner: fresh install cold cache + cold store 2.631 vs 2.600 s, hot cache + hot store 502.1 vs 502.2 ms, cold cache + hot store 1.708 vs 1.713 s, fresh resolve 247.6 ± 14.7 vs 225.9 ± 29.5 ms and peer-heavy resolve 957.8 ± 156.9 vs 851.8 ± 118.8 ms, the last two inside their own standard deviations.


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

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

The Rust CI / Clippy check turned red on 8e6bb73, a docs-only commit: its job fails compiling pnpm-cli's tests with the unused imports in pnpm/crates/cli/src/cargo_deps/git/tests.rs, which this branch leaves identical to main. main's own last three Rust CI runs (34396991770, 34397517338, 34398748506) fail the same way, and the PR's merge ref now includes the commit that introduced it.


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 8e6bb73

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan merged commit 1bf36b9 into main Sep 9, 2026
30 of 32 checks passed
@zkochan
zkochan deleted the perfectionist-fresh-path branch September 9, 2026 20:52
biisal pushed a commit to biisal/pnpm that referenced this pull request Sep 15, 2026
…ses (pnpm#14746)

Restructure InstallWithFreshLockfile::run as a pipeline of phases —
set_up_resolvers, resolve_graph, build_lockfile_phase,
plan_fresh_materialization, MaterializationScope, run_on_disk_phases —
each returning one value the next reads whole. run bound 148 distinct
names; it and every phase in install_with_fresh_lockfile.rs are under
the 12-name cap.

The install's inputs are split once into a Copy FreshInputs view and
the owned OwnedInputs the phases consume. The resolve phase's two
borrowed views come back as owned values, and run derives the views;
the plan borrows the initial materialization closure run owns. The
resolvers and the metadata cache are dropped where they were. The
on-disk phases are three methods on their inputs reading one
InstallContext.

Record what is derived once as InstallShape, ObserverSettings,
TrustGate, Patches and UpdateReuseScopes. Split the fresh lockfile
build options by their readers (inputs, splice, bumps) and build the
lockfile once under --lockfile-only and otherwise.

Drop the DependencyGroupList type parameter: the one caller hands a Vec.

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