Skip to content

fix(deps-restorer): shim publicly hoisted workspace-package bins on a headless install - #13644

Merged
zkochan merged 8 commits into
mainfrom
dedupe-materialization-plan
Aug 4, 2026
Merged

zkochan merged 8 commits into
mainfrom
dedupe-materialization-plan

Conversation

@zkochan

@zkochan zkochan commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Both install paths ran the same two phases from two copies. Sharing them turned up a real headless-install bug that the duplication had been hiding, plus an older one next to it.

Refactor. The materialization plan (installability host → skip set → --no-optional / --no-runtime → reachability closure → engine name) and the link phase (hoist plan, pre-link reconciliation, importer symlinks, root-component cross-links, per-slot bins, the hoisted-linker arm, the on-disk hoist pass, module-resolution sidecars) now live once in pacquet-deps-restorer. InstallFrozenLockfile::run drops 875 → 485. Net −190 lines.

Fix 1 — headless installs missed publicly hoisted workspace-package bins. A workspace package matching publicHoistPattern is hoisted into the root node_modules, but the hoist result records it in hoisted_workspace_aliases, not publicly_hoisted_aliases_with_bins — only the snapshot loop's HoistKind::Public branch fills that. The post-build top-level bin link reads only the latter, so such a package's bin reached the root .bin solely through the link phase's re-walk of node_modules, which only a non-frozen install performed. pnpm install --frozen-lockfile therefore left the shim missing until the next normal install. pnpm's own headless path re-walks (linkBinsOfImporter → linkBins), so this was pacquet diverging rather than shared behaviour, and no TypeScript change is needed.

Fix 2 — a stray file in node_modules failed the install. link_bins::read_package skipped a missing package.json but treated every other error as fatal, so a user file next to the dependencies died on NotADirectory reading <file>/package.json. This affected normal installs too and was simply unexercised. A non-directory entry now means "not a package", like a missing manifest.

How the fixes surfaced

Sharing the link phase left one behavioural flag, relink_importer_bins, that no test pinned — flipping it left 163 tests green. Rather than guess whether it was dead, I traced what the re-walk uniquely contributes, predicted the divergence from the hoist result's shape, and wrote a test for it. It failed exactly as predicted: passing on the fresh path, failing on the headless one.

Both paths now re-walk, which fixes the gap and removes the flag — the shared link phase has no path-specific behaviour left. Turning it on for the headless path then failed an existing test on a user file in node_modules, which is fix 2.

Differences kept as parameters

Merging behaviour would have been wrong in seven places; each is a caller-side input with its reason recorded:

Frozen Fresh
Skip-set seed previous .modules.yaml.skipped empty — it just re-resolved
--no-optional gate !include_optional also requires is_full_install
Host needed? also requires non-empty snapshots no such guard
Link anchor workspace_root modules_dir.parent()
Trusted importer ids from project_manifests project_anchor_importer_ids
Root-component importers from project_manifests from importer_manifests
Sidecar lockfile filtered to the current install the materialization closure

Two suspected differences were not differences. compute_hoist_plan's is_hoisted argument and the hoist/bin ordering: the fresh path passes false only because it reaches that call inside its isolated branch, where the flag is already known.

One nearly cost a behaviour change. any_installability_constraint short-circuits on packages.values().any(...) before reading snapshots, so it returns true for a lockfile with constrained metadata and no snapshots. Folding the frozen path's non-empty guard into the shared function looks redundant and is not: without it, that lockfile pays for a node --version it has nothing to check, and the resulting host_node flips engine-name derivation.

Tests

Two new, each verified to fail without its fix:

  • publicly_hoisted_workspace_package_bins_reach_the_root_bin_dir — covers fix 1 on both paths.
  • hoist_patterns_are_inert_under_the_hoisted_linker — nodeLinker: hoisted combined with a hoist pattern was previously untested, and is exactly what compute_hoist_plan's is_hoisted controls.

Fix 2 is covered by the existing included_drift_keeps_user_node_modules_entry_while_layout_drift_wipes_it, which failed the moment the headless path started re-walking.

Verification

  • pacquet-package-manager + pacquet-deps-restorer + pacquet-cmd-shim — 935 passed.
  • Full pacquet-cli suite — 2417 passed.
  • cargo clippy --workspace --all-targets -- -D warnings; cargo doc with RUSTDOCFLAGS=-D warnings --document-private-items.

Note for review

The refactor and the two fixes are independently backportable. Happy to split the fixes into their own PR if that is easier to land — say the word.

Squash Commit Body

Share the materialization plan and the link phase between the two
install paths, in `pacquet-deps-restorer`. The skip set decides what
`node_modules` contains and the link phase decides how it is wired, so
the paths diverging in either is a correctness bug rather than a style
difference. `InstallFrozenLockfile::run` drops 875 -> 485.

Sharing the link phase left one behavioural flag no test pinned, and
tracing it found a real bug. A workspace package matching
`publicHoistPattern` is recorded in the hoist result's
`hoisted_workspace_aliases`, not `publicly_hoisted_aliases_with_bins`,
which is all the post-build top-level bin link reads. Its bin therefore
reached the root `.bin` only via the link phase's `node_modules`
re-walk, which only a non-frozen install performed, so
`--frozen-lockfile` left the shim missing. pnpm's headless path
re-walks, so this was pacquet diverging. Both paths now re-walk, which
fixes the gap and removes the flag.

That surfaced a second latent bug: `link_bins::read_package` treated
anything but a missing manifest as fatal, so a stray file in
`node_modules` failed the install with `NotADirectory`. Non-directory
entries now mean "not a package".

Seven genuine differences stay as caller-side inputs, including the
frozen path's non-empty-snapshots guard, which is load-bearing because
`any_installability_constraint` short-circuits on `packages` before
reading snapshots.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package.
  • Added or updated tests.

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

…ll paths

Both install paths decided what may land on disk the same way — detect
the installability host, compute the skip set, fold in `--no-optional`
and `--no-runtime`, close it over reachability, then derive the engine
name — but only the fresh path had it factored out. The frozen path
carried the same sequence inline, so the two were kept in step by hand.

That is worth removing rather than tidying: the skip set decides what
`node_modules` contains, so the paths diverging here would be a
correctness bug, not a style difference.

`pacquet-deps-restorer::materialization_plan` now owns it, and both
paths call it. The crate is below `package-manager`, which is where the
helpers it builds on (`compute_skipped_snapshots`,
`add_direct_runtime_skips`, `extend_skipped_with_dependency_closure`)
already live.

Three things the paths genuinely disagree on stay with the callers,
because each has a reason the shared code cannot express:

- The skip-set seed. The frozen path seeds from the previous install's
  `.modules.yaml.skipped`; the fresh path has just re-resolved the graph
  and cannot assume those verdicts still hold.
- The `--no-optional` gate. The fresh path additionally requires
  `is_full_install`, since a partial run narrows its dependency groups
  for reasons of its own and must keep transitive optionals.
- Whether the host is needed at all. The frozen path also requires
  non-empty snapshots. That guard is load-bearing:
  `any_installability_constraint` short-circuits on `packages` before
  reading snapshots, so without it a lockfile with constrained metadata
  and no snapshots would pay for a `node --version` it has nothing to
  check — and the resulting `host_node` would change engine-name
  derivation.

No behaviour change on either path.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 4, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Deduplicate install materialization planning across fresh and frozen paths

✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Centralize skip-set + engine-name derivation into deps-restorer for both install paths.
• Preserve path-specific knobs (seed skips, no-optional gating, host-needed predicate) as inputs.
• Remove duplicated sequencing from fresh install and simplify frozen install call sites.
Diagram

graph TD
PM["package-manager: fresh install"] --> MP["deps-restorer: materialization_plan"] --> SS["compute_skip_set()"]
DR["deps-restorer: frozen install"] --> MP --> EN["resolve_engine_name()"]
MP --> IH["detect_installability_host()"] --> NP{{"node probe"}}
SS --> LF[("lockfile data")]
EN --> NP
subgraph Legend
  direction LR
  _m["Module"] ~~~ _db[("Data") ] ~~~ _e{{"External / probe"}}
end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep fresh-path module in package-manager and call it from deps-restorer
  • ➕ Keeps materialization planning closer to the install orchestrator
  • ➕ Avoids adding another public module in deps-restorer
  • ➖ Inverts layering: deps-restorer would depend upward on package-manager
  • ➖ Harder to guarantee both install paths stay behaviorally identical
2. Introduce a separate small shared crate for planning
  • ➕ Strong separation and explicit API boundary
  • ➕ Could be reused by future install modes without pulling full deps-restorer
  • ➖ More crate/module overhead for logic that already fits deps-restorer
  • ➖ Likely requires additional re-wiring of existing helper functions

Recommendation: The chosen approach—moving the shared planning logic into pacquet-deps-restorer::materialization_plan—is the best fit for correctness and dependency direction. It removes duplicated sequencing while keeping the three genuinely divergent behaviors (seed, no-optional gating, and host-needed predicate) explicitly owned by each caller.

Files changed (4) +330 / -197

Refactor (4) +330 / -197
install_frozen_lockfile.rsSwitch frozen install to shared materialization planning helpers +63/-170

Switch frozen install to shared materialization planning helpers

• Removes inline host-detection, skip-set computation, and engine-name resolution logic. Uses 'materialization_plan::detect_installability_host', 'compute_skip_set', and 'resolve_engine_name', while retaining the frozen-path-specific host-needed predicate and skip-set seeding from '.modules.yaml.skipped'.

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

lib.rsExport new materialization_plan module +1/-0

Export new materialization_plan module

• Adds 'pub mod materialization_plan;' so both install paths can reuse the shared planning logic from deps-restorer.

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

materialization_plan.rsAdd shared host/skip-set/engine-name planning module +217/-0

Add shared host/skip-set/engine-name planning module

• Introduces shared helpers to detect the installability host, compute the final skip set (installability + no-optional + no-runtime + reachability closure), and resolve engine name with the same priority rules as before. Encodes path differences as parameters (seed skips, exclude_optional) rather than branching behavior.

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

install_with_fresh_lockfile.rsAdopt deps-restorer materialization_plan and delete local duplicate +49/-27

Adopt deps-restorer materialization_plan and delete local duplicate

• Removes the local 'materialization_plan' module and calls into 'pacquet_deps_restorer::materialization_plan' for host detection, engine-name resolution, and skip-set computation. Keeps fresh-path semantics by using an empty skip seed and gating 'exclude_optional' on 'is_full_install'.

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

@greptile-apps

greptile-apps Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (8): Last reviewed commit: "style(deps-restorer): satisfy the perfec..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR moves materialization planning and link-phase orchestration into pacquet_deps_restorer. Fresh and frozen installs now share host detection, skip computation, engine resolution, linking, hoisting, metadata generation, and bin relinking.

Changes

Materialization planning and link phase

Layer / File(s) Summary
Shared materialization planning
pnpm/crates/deps-restorer/src/materialization_plan.rs, pnpm/crates/deps-restorer/src/lib.rs
Adds shared host detection, skip-set computation, engine-name resolution, and public module exports.
Shared link phase
pnpm/crates/deps-restorer/src/linking.rs
Adds link-phase contracts and orchestration for stale-module cleanup, isolated and hoisted linking, metadata generation, and bin relinking.
Fresh and frozen install integration
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
Replaces local planning and linking with shared APIs. Both flows map shared link-phase errors and consume returned link metadata.
Hoisted linker regressions
pnpm/crates/cli/tests/hoist.rs, pnpm/crates/cli/tests/hoisted_node_linker.rs, pnpm/crates/cmd-shim/src/link_bins.rs, .changeset/frozen-install-hoisted-workspace-bins.md
Tests hoisted layouts and workspace bin shims. Command-shim discovery skips non-directory entries without suppressing other I/O errors.

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

Sequence Diagram(s)

sequenceDiagram
  participant InstallFlow as FreshOrFrozenInstall
  participant MaterializationPlan as materialization_plan
  participant LinkPhase as run_link_phase
  participant HoistedLinker as HoistedLinker
  InstallFlow->>MaterializationPlan: Detect host and compute skipped snapshots
  MaterializationPlan-->>InstallFlow: Skip set and engine name
  InstallFlow->>LinkPhase: LinkPhaseInputs and skipped snapshots
  LinkPhase->>HoistedLinker: Materialize hoisted layout when configured
  HoistedLinker-->>LinkPhase: Hoisted locations and package roots
  LinkPhase-->>InstallFlow: LinkPhaseOutput
Loading

Possibly related issues

  • pnpm/pacquet#438: Covers the hoisted-linker support, shared hoisted linking, workspace handling, and regression tests changed here.

Possibly related PRs

  • pnpm/pnpm#13624: Introduced fresh-install materialization and linking logic that this PR moves into shared deps-restorer modules.
  • pnpm/pnpm#13637: Started the shared deps-restorer extraction used by this PR.
  • pnpm/pnpm#13151: Overlaps with the frozen-install linking and reconciliation flow centralized by this PR.

Suggested reviewers: copilot

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Bin precedence lost in relink ✗ Dismissed 🐞 Bug ⛨ Security
Description
The new link-phase re-walk calls pacquet_cmd_shim::link_bins over each importer’s node_modules,
but that scan constructs every candidate with BinOrigin::Direct, so bin-name conflicts can be
resolved as if hoisted packages were direct dependencies. This can cause a publicly-hoisted package
(including a workspace package) to be selected over a true direct dependency for the same bin name,
breaking expected command resolution and enabling command shadowing when a colliding bin is present.
Code

pnpm/crates/deps-restorer/src/linking.rs[R438-441]

+    // `SymlinkDirectDependencies` already linked direct-dep bins, but
+    // hoisting runs after it. Re-walking each importer's `node_modules`
+    // is what shims a publicly-hoisted *workspace package*'s bin: those
+    // are recorded in the hoist result's `hoisted_workspace_aliases`,
Relevance

●●● Strong

Repo has recent accepted fixes to preserve precedence semantics; this looks like a real
bin-precedence regression/security risk.

PR-#13455
PR-#13171

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new link-phase code explicitly introduces a node_modules re-walk to link bins post-hoist, but
it uses the cmd-shim API that scans the filesystem and creates all PackageBinSources with the
default origin. Since cmd-shim’s conflict resolution (pick_winner) depends on origin to guarantee
direct deps beat hoisted deps, this re-walk can mis-classify hoisted packages and choose the wrong
bin winner. deps-restorer already contains an origin-aware linking helper that avoids this by
tagging candidates based on whether their location is in the importer’s direct dep set.

pnpm/crates/deps-restorer/src/linking.rs[438-458]
pnpm/crates/cmd-shim/src/link_bins.rs[59-68]
pnpm/crates/cmd-shim/src/link_bins.rs[434-446]
pnpm/crates/deps-restorer/src/link_bins.rs[156-162]
pnpm/crates/deps-restorer/src/link_bins.rs[210-229]

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

### Issue description
`run_link_phase` re-walks each importer’s `node_modules` to link bins after hoisting, but it uses `pacquet_cmd_shim::link_bins`, which cannot classify packages as direct vs hoisted. Because `collect_packages_in_modules_dir` builds `PackageBinSource` with the default `BinOrigin::Direct`, `pick_winner`’s direct-over-hoisted tier is bypassed and hoisted packages may win bin conflicts.

### Issue Context
- `pacquet_cmd_shim::pick_winner` explicitly prioritizes `BinOrigin::Direct` over `BinOrigin::Hoisted`.
- deps-restorer already has an origin-aware helper (`link_project_bins`) that tags candidates as `Direct` iff they are in the importer’s direct dep set; everything else becomes `Hoisted`.
- The new re-walk exists to pick up bins from publicly-hoisted *workspace packages*, but it should not change the precedence rules for conflicting bin names.

### Fix Focus Areas
- pnpm/crates/deps-restorer/src/linking.rs[438-460]
- pnpm/crates/deps-restorer/src/link_bins.rs[210-234]
- pnpm/crates/cmd-shim/src/link_bins.rs[59-77]
- pnpm/crates/cmd-shim/src/link_bins.rs[434-455]

### Suggested fix approach
- Replace the `pacquet_cmd_shim::link_bins` re-walk with an origin-aware bin-linking call.
 - Prefer calling `crate::link_bins::link_project_bins(modules_dir, direct_dep_names, extra_node_paths)`.
 - Thread `direct_dep_names` (per importer) into this loop from the lockfile importer snapshot (same source used elsewhere for bin linking).
- Ensure the re-walk only adds the missing workspace-hoisted bins without allowing hoisted candidates to win over direct candidates for the same bin name.

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



Remediation recommended

2. Windows shim match wrong 🐞 Bug ⚙ Maintainability ⭐ New
Description
The new bin-precedence regression test checks for packages\\collide (two backslashes) in the shim
text, which won’t match a normal Windows .cmd shim path containing single backslashes. This can
let Windows CI pass even if the shim actually points at the hoisted workspace package, weakening
coverage for command-shadowing/preference behavior.
Code

pnpm/crates/cli/tests/hoist.rs[R1524-1526]

+        assert!(
+            !shim.contains("packages/collide") && !shim.contains(r"packages\\collide"),
+            "{stage}: the direct dependency must win over the hoisted workspace package:\n{shim}",
Relevance

●●● Strong

Team often accepts test hardening to prevent false-greens; this is a small, deterministic
Windows-path fix.

PR-#13425
PR-#13372
PR-#13453

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The assertion currently looks for two consecutive backslashes, but .cmd shims are rendered with
Windows-style backslash separators, so the shim text will contain single \ separators and won’t
match r"...\\..." (two backslashes).

pnpm/crates/cli/tests/hoist.rs[1521-1527]
pnpm/crates/cmd-shim/src/shim.rs[305-316]

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 test `direct_dep_bin_wins_over_a_publicly_hoisted_workspace_package` attempts to detect that the generated shim does not point to `packages/collide`. On Windows, `.cmd` shims contain paths with single backslashes (e.g. `packages\collide` in file text), but the test currently checks `r"packages\\collide"` (two literal backslashes), which can be a false-green.

### Issue Context
This test is specifically pinning direct-dependency bin precedence over a publicly-hoisted workspace package. If the Windows assertion is ineffective, a precedence regression (and resulting command shadowing) could slip through Windows coverage.

### Fix Focus Areas
- pnpm/crates/cli/tests/hoist.rs[1521-1527]

### Suggested fix
Replace `!shim.contains(r"packages\\collide")` with a single-backslash check like `!shim.contains("packages\\collide")` or `!shim.contains(r"packages\collide")`. Optionally, make the check separator-agnostic (e.g., normalize `\` to `/` before searching) to avoid platform-specific brittleness.

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


3. Brittle modules.yaml check 🐞 Bug ☼ Reliability
Description
The new test asserts .modules.yaml contains the exact substring "hoistedDependencies": {}, so
harmless serialization/formatting changes (whitespace/newlines) can break the test even when
hoistedDependencies is structurally empty. This couples the regression test to output formatting
instead of the actual behavior being pinned.
Code

pnpm/crates/cli/tests/hoisted_node_linker.rs[R963-967]

+        let modules_yaml = fs::read_to_string(workspace.join("node_modules/.modules.yaml"))
+            .expect("read .modules.yaml");
+        assert!(
+            modules_yaml.contains(r#""hoistedDependencies": {}"#),
+            "{stage}: the isolated hoist recorded nothing; got:\n{modules_yaml}",
Relevance

●●● Strong

Team often hardens tests by parsing YAML/JSON structurally instead of substring/format-dependent
checks.

PR-#13372
PR-#13563

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test currently checks for an exact text fragment in .modules.yaml, which is
format-dependent. Nearby/sibling tests parse .modules.yaml as JSON and assert on the
hoistedDependencies field structurally, demonstrating a more robust pattern already used in this
repo.

pnpm/crates/cli/tests/hoisted_node_linker.rs[963-968]
pnpm/crates/cli/tests/hoist.rs[750-756]
pnpm/crates/modules-yaml/tests/index.rs[51-56]

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 test `hoist_patterns_are_inert_under_the_hoisted_linker` validates an empty `hoistedDependencies` map using a raw substring match on `.modules.yaml`. This is sensitive to formatting changes and can fail even when the map is truly empty.

### Issue Context
Other CLI tests treat `.modules.yaml` as JSON content and assert on the parsed structure, which is robust to formatting.

### Fix Focus Areas
- pnpm/crates/cli/tests/hoisted_node_linker.rs[963-968]

### Suggested change
Replace the substring assertion with a structural check by parsing `.modules.yaml` (e.g., `serde_json::Value` or the `pacquet_modules_yaml` reader) and asserting `hoistedDependencies` is an empty object/map.

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


4. Wasted hoist planning work 🐞 Bug ➹ Performance
Description
run_link_phase() returns early under config.virtual_store_only, but only after it already
computed the hoist plan and public-hoist targets, adding unnecessary CPU/allocations to
virtual-store-only flows (e.g. pnpm fetch). This is discarded work because the function returns
empty outputs in that mode.
Code

pnpm/crates/deps-restorer/src/linking.rs[R229-232]

+    if config.virtual_store_only {
+        return Ok(LinkPhaseOutput {
+            hoisted_dependencies: crate::HoistedDependencies::new(),
+            hoisted_locations: BTreeMap::new(),
Relevance

●● Moderate

Seems like a safe perf tweak, but no close precedent about virtual_store_only hoist-plan
short-circuiting.

PR-#13170

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The function computes the hoist plan and public-hoist targets before the virtual_store_only early
return, so virtual_store_only still pays that cost despite returning empty outputs.

pnpm/crates/deps-restorer/src/linking.rs[188-214]
pnpm/crates/deps-restorer/src/linking.rs[223-236]

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

### Issue description
`run_link_phase()` performs hoist planning (`compute_hoist_plan` and `collect_public_hoist_targets`) before checking `config.virtual_store_only`, but `virtual_store_only` returns immediately with empty outputs and does no linking. This adds avoidable CPU and allocation work to hot fetch-like flows.

### Issue Context
The shared link phase is now used by multiple install paths, and `virtual_store_only` is intended to populate the store without doing project-level work. Hoist planning can traverse dependency graphs and allocate intermediate structures, so it should be skipped in this mode.

### Fix Focus Areas
- pnpm/crates/deps-restorer/src/linking.rs[188-236]

### Expected change
Move the `if config.virtual_store_only { ... }` early return to immediately after destructuring `inputs` (before computing `hoisted_workspace_packages`, `compute_hoist_plan`, or `collect_public_hoist_targets`), or guard the hoist-planning block with `if !config.virtual_store_only` so the plan is never computed in this mode.

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


View more (1)
5. Redundant hoisted bin relink 🐞 Bug ➹ Performance
Description
The fresh-lockfile path sets relink_importer_bins: true unconditionally, so the shared link phase
re-walks every importer’s node_modules and re-links bins even under nodeLinker: hoisted, where
the hoisted linker already performs its own per-node_modules bin pass. This adds avoidable
filesystem work on a hot install path and can increase install latency in large workspaces.
Code

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

+                // Public-hoist aliases land after
+                // `SymlinkDirectDependencies` has run, so this path
+                // re-walks each importer's `node_modules` to shim them.
+                relink_importer_bins: true,
Relevance

●● Moderate

Perf change touches bin-linking behavior; similar bin-relink overhead optimizations were rejected,
so outcome uncertain.

PR-#13171

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The fresh path always enables relink_importer_bins, and the shared link phase executes link_bins
for each trusted importer whenever that flag is set. The shared link phase also documents that under
nodeLinker: hoisted the hoisted linker performs its own per-node_modules bin pass, making the
extra traversal redundant for hoisted installs.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1422-1479]
pnpm/crates/deps-restorer/src/linking.rs[271-279]
pnpm/crates/deps-restorer/src/linking.rs[444-463]

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

## Issue description
Fresh installs currently set `relink_importer_bins: true` for the shared link phase even when `is_hoisted` is true. This triggers an additional per-importer `pacquet_cmd_shim::link_bins(...)` traversal after the hoisted linker has already linked bins while walking the hoisted hierarchy.

## Issue Context
- `pacquet_deps_restorer::linking::run_link_phase` runs the `relink_importer_bins` pass without checking `is_hoisted`.
- For `nodeLinker: hoisted`, the module comment and gating in the link phase indicate bin linking is already handled by the hoisted linker.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1454-1479]
- pnpm/crates/deps-restorer/src/linking.rs[444-465]

## Suggested fix
- Set `relink_importer_bins` to `!is_hoisted` (or otherwise gate it) in the fresh-lockfile caller.
- Optionally add a defensive guard in `run_link_phase`:
 - `if relink_importer_bins && !is_hoisted { ... }`
 so future callers can’t accidentally enable redundant work for hoisted installs.

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



Informational

6. Unused manifest vector allocation 🐞 Bug ➹ Performance
Description
The fresh-lockfile path always allocates and populates package_map_project_manifests, but the
shared link phase only consumes it inside the is_hoisted && !config.virtual_store_only branch. For
isolated installs this becomes pure overhead proportional to the number of importers.
Code

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

+        let package_map_project_manifests: Vec<(std::path::PathBuf, &PackageManifest)> =
+            importer_manifests
+                .iter()
+                .map(|(id, manifest)| (lockfile_dir.join(id), *manifest))
Relevance

●● Moderate

Team has rejected similar “avoid eager work/allocation” perf micro-opts without strong
justification; unclear priority here.

PR-#13173
PR-#13532

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The fresh-lockfile path eagerly builds package_map_project_manifests, while the shared link phase
only forwards it to run_hoisted_linker in the hoisted-only branch—so isolated installs never use
the constructed vector.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1422-1432]
pnpm/crates/deps-restorer/src/linking.rs[319-333]

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

## Issue description
`package_map_project_manifests` is constructed unconditionally in the fresh-lockfile path, but `pacquet_deps_restorer::linking::run_link_phase` only uses it when running the hoisted linker (`is_hoisted && !config.virtual_store_only`). This creates unnecessary allocations and `PathBuf` construction work for isolated installs.

## Issue Context
This is a small but measurable overhead in large workspaces, since the vector size scales with the number of importers.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1422-1433]
- pnpm/crates/deps-restorer/src/linking.rs[319-333]

## Suggested fix
- Construct `package_map_project_manifests` only when `is_hoisted` is true; otherwise pass an empty slice (e.g. `&[]`) or an empty `Vec` kept alive for the call.
- If the API shape makes this awkward, consider making `package_map_project_manifests` optional in `LinkPhaseInputs` and only requiring it for the hoisted branch.

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


7. Extra node_version clone 🐞 Bug ➹ Performance
Description
In the frozen-lockfile install path, host.node_version is cloned into host_node, introducing an
extra allocation on every installability-checked frozen install. This can be avoided by deriving
host_node after compute_skip_set and moving the node_version out of installability_host
instead of cloning it.
Code

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

+        let host_node = installability_host
+            .as_ref()
+            .map(|host| (host.node_detected, host.node_version.clone()));
Relevance

●● Moderate

Team sometimes accepts reducing redundant work, but has also rejected clone/allocation micro-opts
needing refactors.

PR-#13170
PR-#13350

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The frozen path currently clones host.node_version into host_node before computing the skip set,
even though resolve_engine_name(...) is invoked later and could use a moved-out value after the
borrow is no longer needed.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[717-755]
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[793-799]

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

### Issue description
`host.node_version.clone()` allocates a new `String` during frozen installs whenever an installability host was detected. This allocation is avoidable because `host_node` is only needed later (for engine-name derivation), after the skip set has already been computed.

### Issue Context
The code currently derives `host_node` immediately after `detect_installability_host(...)`, while `installability_host` must remain alive through `compute_skip_set(...)` (borrowed via `as_ref()`). Because the host cannot be moved out at that point, the version string is cloned.

### Fix
Derive `host_node` *after* `compute_skip_set(...)` and move the host out of the `Option` (e.g., via `take()`), so `node_version` can be moved rather than cloned.

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

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


8. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset lists only pacquet and does not include a pnpm bump entry, which violates the
requirement to explicitly declare the pnpm package in changesets. This can cause the pnpm
release/versioning automation to miss the intended bump for this change.
Code

.changeset/stray-node-modules-entry-no-longer-fails-install.md[R1-3]

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

● Weak

Multiple recent PRs rejected adding pnpm entry when changeset only bumps pacquet.

PR-#13459
PR-#13347
PR-#12981

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an explicit pnpm entry
with a valid bump type. The added changeset front-matter contains only "pacquet": patch and no
pnpm entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/stray-node-modules-entry-no-longer-fails-install.md[1-3]

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

## Issue description
The changeset front-matter is missing a `pnpm` entry.

## Issue Context
Per the compliance checklist, each new/modified changeset must explicitly include the `pnpm` package with a valid bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/stray-node-modules-entry-no-longer-fails-install.md[1-3]

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


Grey Divider

Context used
✅ Compliance rules (platform): 24 rules

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

Previous review results

Review updated until commit 7852815

Results up to commit b7be312 ⚖️ Balanced


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


Informational
1. Extra node_version clone 🐞 Bug ➹ Performance
Description
In the frozen-lockfile install path, host.node_version is cloned into host_node, introducing an
extra allocation on every installability-checked frozen install. This can be avoided by deriving
host_node after compute_skip_set and moving the node_version out of installability_host
instead of cloning it.
Code

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

+        let host_node = installability_host
+            .as_ref()
+            .map(|host| (host.node_detected, host.node_version.clone()));
Relevance

●● Moderate

Team sometimes accepts reducing redundant work, but has also rejected clone/allocation micro-opts
needing refactors.

PR-#13170
PR-#13350

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The frozen path currently clones host.node_version into host_node before computing the skip set,
even though resolve_engine_name(...) is invoked later and could use a moved-out value after the
borrow is no longer needed.

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[717-755]
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs[793-799]

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

### Issue description
`host.node_version.clone()` allocates a new `String` during frozen installs whenever an installability host was detected. This allocation is avoidable because `host_node` is only needed later (for engine-name derivation), after the skip set has already been computed.

### Issue Context
The code currently derives `host_node` immediately after `detect_installability_host(...)`, while `installability_host` must remain alive through `compute_skip_set(...)` (borrowed via `as_ref()`). Because the host cannot be moved out at that point, the version string is cloned.

### Fix
Derive `host_node` *after* `compute_skip_set(...)` and move the host out of the `Option` (e.g., via `take()`), so `node_version` can be moved rather than cloned.

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

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


Results up to commit d8ce328 ⚖️ Balanced


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


Remediation recommended
1. Brittle modules.yaml check 🐞 Bug ☼ Reliability
Description
The new test asserts .modules.yaml contains the exact substring "hoistedDependencies": {}, so
harmless serialization/formatting changes (whitespace/newlines) can break the test even when
hoistedDependencies is structurally empty. This couples the regression test to output formatting
instead of the actual behavior being pinned.
Code

pnpm/crates/cli/tests/hoisted_node_linker.rs[R963-967]

+        let modules_yaml = fs::read_to_string(workspace.join("node_modules/.modules.yaml"))
+            .expect("read .modules.yaml");
+        assert!(
+            modules_yaml.contains(r#""hoistedDependencies": {}"#),
+            "{stage}: the isolated hoist recorded nothing; got:\n{modules_yaml}",
Relevance

●●● Strong

Team often hardens tests by parsing YAML/JSON structurally instead of substring/format-dependent
checks.

PR-#13372
PR-#13563

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test currently checks for an exact text fragment in .modules.yaml, which is
format-dependent. Nearby/sibling tests parse .modules.yaml as JSON and assert on the
hoistedDependencies field structurally, demonstrating a more robust pattern already used in this
repo.

pnpm/crates/cli/tests/hoisted_node_linker.rs[963-968]
pnpm/crates/cli/tests/hoist.rs[750-756]
pnpm/crates/modules-yaml/tests/index.rs[51-56]

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 test `hoist_patterns_are_inert_under_the_hoisted_linker` validates an empty `hoistedDependencies` map using a raw substring match on `.modules.yaml`. This is sensitive to formatting changes and can fail even when the map is truly empty.

### Issue Context
Other CLI tests treat `.modules.yaml` as JSON content and assert on the parsed structure, which is robust to formatting.

### Fix Focus Areas
- pnpm/crates/cli/tests/hoisted_node_linker.rs[963-968]

### Suggested change
Replace the substring assertion with a structural check by parsing `.modules.yaml` (e.g., `serde_json::Value` or the `pacquet_modules_yaml` reader) and asserting `hoistedDependencies` is an empty object/map.

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


Results up to commit 2df883d ⚖️ Balanced


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


Remediation recommended
1. Redundant hoisted bin relink 🐞 Bug ➹ Performance
Description
The fresh-lockfile path sets relink_importer_bins: true unconditionally, so the shared link phase
re-walks every importer’s node_modules and re-links bins even under nodeLinker: hoisted, where
the hoisted linker already performs its own per-node_modules bin pass. This adds avoidable
filesystem work on a hot install path and can increase install latency in large workspaces.
Code

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

+                // Public-hoist aliases land after
+                // `SymlinkDirectDependencies` has run, so this path
+                // re-walks each importer's `node_modules` to shim them.
+                relink_importer_bins: true,
Relevance

●● Moderate

Perf change touches bin-linking behavior; similar bin-relink overhead optimizations were rejected,
so outcome uncertain.

PR-#13171

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The fresh path always enables relink_importer_bins, and the shared link phase executes link_bins
for each trusted importer whenever that flag is set. The shared link phase also documents that under
nodeLinker: hoisted the hoisted linker performs its own per-node_modules bin pass, making the
extra traversal redundant for hoisted installs.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1422-1479]
pnpm/crates/deps-restorer/src/linking.rs[271-279]
pnpm/crates/deps-restorer/src/linking.rs[444-463]

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

## Issue description
Fresh installs currently set `relink_importer_bins: true` for the shared link phase even when `is_hoisted` is true. This triggers an additional per-importer `pacquet_cmd_shim::link_bins(...)` traversal after the hoisted linker has already linked bins while walking the hoisted hierarchy.

## Issue Context
- `pacquet_deps_restorer::linking::run_link_phase` runs the `relink_importer_bins` pass without checking `is_hoisted`.
- For `nodeLinker: hoisted`, the module comment and gating in the link phase indicate bin linking is already handled by the hoisted linker.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1454-1479]
- pnpm/crates/deps-restorer/src/linking.rs[444-465]

## Suggested fix
- Set `relink_importer_bins` to `!is_hoisted` (or otherwise gate it) in the fresh-lockfile caller.
- Optionally add a defensive guard in `run_link_phase`:
 - `if relink_importer_bins && !is_hoisted { ... }`
 so future callers can’t accidentally enable redundant work for hoisted installs.

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



Informational
2. Unused manifest vector allocation 🐞 Bug ➹ Performance
Description
The fresh-lockfile path always allocates and populates package_map_project_manifests, but the
shared link phase only consumes it inside the is_hoisted && !config.virtual_store_only branch. For
isolated installs this becomes pure overhead proportional to the number of importers.
Code

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

+        let package_map_project_manifests: Vec<(std::path::PathBuf, &PackageManifest)> =
+            importer_manifests
+                .iter()
+                .map(|(id, manifest)| (lockfile_dir.join(id), *manifest))
Relevance

●● Moderate

Team has rejected similar “avoid eager work/allocation” perf micro-opts without strong
justification; unclear priority here.

PR-#13173
PR-#13532

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The fresh-lockfile path eagerly builds package_map_project_manifests, while the shared link phase
only forwards it to run_hoisted_linker in the hoisted-only branch—so isolated installs never use
the constructed vector.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1422-1432]
pnpm/crates/deps-restorer/src/linking.rs[319-333]

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

## Issue description
`package_map_project_manifests` is constructed unconditionally in the fresh-lockfile path, but `pacquet_deps_restorer::linking::run_link_phase` only uses it when running the hoisted linker (`is_hoisted && !config.virtual_store_only`). This creates unnecessary allocations and `PathBuf` construction work for isolated installs.

## Issue Context
This is a small but measurable overhead in large workspaces, since the vector size scales with the number of importers.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1422-1433]
- pnpm/crates/deps-restorer/src/linking.rs[319-333]

## Suggested fix
- Construct `package_map_project_manifests` only when `is_hoisted` is true; otherwise pass an empty slice (e.g. `&[]`) or an empty `Vec` kept alive for the call.
- If the API shape makes this awkward, consider making `package_map_project_manifests` optional in `LinkPhaseInputs` and only requiring it for the hoisted branch.

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


Results up to commit 8bdaccf ⚖️ Balanced


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


Action required
1. Bin precedence lost in relink ✗ Dismissed 🐞 Bug ⛨ Security
Description
The new link-phase re-walk calls pacquet_cmd_shim::link_bins over each importer’s node_modules,
but that scan constructs every candidate with BinOrigin::Direct, so bin-name conflicts can be
resolved as if hoisted packages were direct dependencies. This can cause a publicly-hoisted package
(including a workspace package) to be selected over a true direct dependency for the same bin name,
breaking expected command resolution and enabling command shadowing when a colliding bin is present.
Code

pnpm/crates/deps-restorer/src/linking.rs[R438-441]

+    // `SymlinkDirectDependencies` already linked direct-dep bins, but
+    // hoisting runs after it. Re-walking each importer's `node_modules`
+    // is what shims a publicly-hoisted *workspace package*'s bin: those
+    // are recorded in the hoist result's `hoisted_workspace_aliases`,
Relevance

●●● Strong

Repo has recent accepted fixes to preserve precedence semantics; this looks like a real
bin-precedence regression/security risk.

PR-#13455
PR-#13171

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new link-phase code explicitly introduces a node_modules re-walk to link bins post-hoist, but
it uses the cmd-shim API that scans the filesystem and creates all PackageBinSources with the
default origin. Since cmd-shim’s conflict resolution (pick_winner) depends on origin to guarantee
direct deps beat hoisted deps, this re-walk can mis-classify hoisted packages and choose the wrong
bin winner. deps-restorer already contains an origin-aware linking helper that avoids this by
tagging candidates based on whether their location is in the importer’s direct dep set.

pnpm/crates/deps-restorer/src/linking.rs[438-458]
pnpm/crates/cmd-shim/src/link_bins.rs[59-68]
pnpm/crates/cmd-shim/src/link_bins.rs[434-446]
pnpm/crates/deps-restorer/src/link_bins.rs[156-162]
pnpm/crates/deps-restorer/src/link_bins.rs[210-229]

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

### Issue description
`run_link_phase` re-walks each importer’s `node_modules` to link bins after hoisting, but it uses `pacquet_cmd_shim::link_bins`, which cannot classify packages as direct vs hoisted. Because `collect_packages_in_modules_dir` builds `PackageBinSource` with the default `BinOrigin::Direct`, `pick_winner`’s direct-over-hoisted tier is bypassed and hoisted packages may win bin conflicts.

### Issue Context
- `pacquet_cmd_shim::pick_winner` explicitly prioritizes `BinOrigin::Direct` over `BinOrigin::Hoisted`.
- deps-restorer already has an origin-aware helper (`link_project_bins`) that tags candidates as `Direct` iff they are in the importer’s direct dep set; everything else becomes `Hoisted`.
- The new re-walk exists to pick up bins from publicly-hoisted *workspace packages*, but it should not change the precedence rules for conflicting bin names.

### Fix Focus Areas
- pnpm/crates/deps-restorer/src/linking.rs[438-460]
- pnpm/crates/deps-restorer/src/link_bins.rs[210-234]
- pnpm/crates/cmd-shim/src/link_bins.rs[59-77]
- pnpm/crates/cmd-shim/src/link_bins.rs[434-455]

### Suggested fix approach
- Replace the `pacquet_cmd_shim::link_bins` re-walk with an origin-aware bin-linking call.
 - Prefer calling `crate::link_bins::link_project_bins(modules_dir, direct_dep_names, extra_node_paths)`.
 - Thread `direct_dep_names` (per importer) into this loop from the lockfile importer snapshot (same source used elsewhere for bin linking).
- Ensure the re-walk only adds the missing workspace-hoisted bins without allowing hoisted candidates to win over direct candidates for the same bin name.

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


Results up to commit d7b3ce2 ⚖️ Balanced


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


Remediation recommended
1. Wasted hoist planning work 🐞 Bug ➹ Performance
Description
run_link_phase() returns early under config.virtual_store_only, but only after it already
computed the hoist plan and public-hoist targets, adding unnecessary CPU/allocations to
virtual-store-only flows (e.g. pnpm fetch). This is discarded work because the function returns
empty outputs in that mode.
Code

pnpm/crates/deps-restorer/src/linking.rs[R229-232]

+    if config.virtual_store_only {
+        return Ok(LinkPhaseOutput {
+            hoisted_dependencies: crate::HoistedDependencies::new(),
+            hoisted_locations: BTreeMap::new(),
Relevance

●● Moderate

Seems like a safe perf tweak, but no close precedent about virtual_store_only hoist-plan
short-circuiting.

PR-#13170

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The function computes the hoist plan and public-hoist targets before the virtual_store_only early
return, so virtual_store_only still pays that cost despite returning empty outputs.

pnpm/crates/deps-restorer/src/linking.rs[188-214]
pnpm/crates/deps-restorer/src/linking.rs[223-236]

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

### Issue description
`run_link_phase()` performs hoist planning (`compute_hoist_plan` and `collect_public_hoist_targets`) before checking `config.virtual_store_only`, but `virtual_store_only` returns immediately with empty outputs and does no linking. This adds avoidable CPU and allocation work to hot fetch-like flows.

### Issue Context
The shared link phase is now used by multiple install paths, and `virtual_store_only` is intended to populate the store without doing project-level work. Hoist planning can traverse dependency graphs and allocate intermediate structures, so it should be skipped in this mode.

### Fix Focus Areas
- pnpm/crates/deps-restorer/src/linking.rs[188-236]

### Expected change
Move the `if config.virtual_store_only { ... }` early return to immediately after destructuring `inputs` (before computing `hoisted_workspace_packages`, `compute_hoist_plan`, or `collect_public_hoist_targets`), or guard the hoist-planning block with `if !config.virtual_store_only` so the plan is never computed in this mode.

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



Informational
2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset lists only pacquet and does not include a pnpm bump entry, which violates the
requirement to explicitly declare the pnpm package in changesets. This can cause the pnpm
release/versioning automation to miss the intended bump for this change.
Code

.changeset/stray-node-modules-entry-no-longer-fails-install.md[R1-3]

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

● Weak

Multiple recent PRs rejected adding pnpm entry when changeset only bumps pacquet.

PR-#13459
PR-#13347
PR-#12981

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an explicit pnpm entry
with a valid bump type. The added changeset front-matter contains only "pacquet": patch and no
pnpm entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/stray-node-modules-entry-no-longer-fails-install.md[1-3]

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

## Issue description
The changeset front-matter is missing a `pnpm` entry.

## Issue Context
Per the compliance checklist, each new/modified changeset must explicitly include the `pnpm` package with a valid bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/stray-node-modules-entry-no-longer-fails-install.md[1-3]

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


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     12.1±0.07ms    31.1 MB/sec    1.01     12.2±0.29ms    30.7 MB/sec
packument/parse                                  1.06     40.7±0.11µs  1628.3 MB/sec    1.00     38.3±0.19µs  1731.9 MB/sec
tarball/download_dependency                      1.09      2.5±0.24ms  1767.9 KB/sec    1.00      2.3±0.09ms  1926.5 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.04   188.0±11.41ms 85.1 KElem/sec    1.00    181.7±4.81ms 88.1 KElem/sec
workspace_resolution/hoist_heavy                 1.00    255.2±0.80ms        ? ?/sec    1.11    282.2±9.06ms        ? ?/sec

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs (1)

1251-1252: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Import materialization_plan instead of repeating the full path.

The three calls spell out pacquet_deps_restorer::materialization_plan:: in full. That forces the compute_skip_set call at lines 1294-1318 into deep indentation. Add one explicit module import and shorten the three call sites.

♻️ Proposed change

Add the import alongside the other pacquet_deps_restorer imports:

use pacquet_deps_restorer::materialization_plan;

Then shorten each call site:

-        let installability_host =
-            pacquet_deps_restorer::materialization_plan::detect_installability_host(
-                needs_installability_check,
-                config.engine_strict,
-                node_version,
-                supported_architectures,
-            )
-            .await;
+        let installability_host = materialization_plan::detect_installability_host(
+            needs_installability_check,
+            config.engine_strict,
+            node_version,
+            supported_architectures,
+        )
+        .await;

As per path instructions: "prefer borrowed parameters where they avoid copies, descriptive names, explicit imports".

Also applies to: 1294-1296

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs` around lines
1251 - 1252, Add an explicit materialization_plan import alongside the existing
pacquet_deps_restorer imports, then update the three calls to
detect_installability_host, compute_skip_set, and the other materialization_plan
API to use the imported module path. Preserve all existing arguments and
behavior while reducing unnecessary path repetition and indentation.

Source: Path instructions

pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs (3)

710-716: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

The non-empty-snapshots guard here has no counterpart in the fresh path.

This predicate requires !snaps.is_empty() before it calls any_installability_constraint. The comment at lines 706-709 states the reason: any_installability_constraint short-circuits on packages alone, so a lockfile with constrained metadata and no snapshots would pay for a node --version probe it has nothing to check.

The fresh path builds the same predicate at pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs lines 1245-1250 without that guard. The PR objectives list this as an intentional caller-specific difference. The stated reason for the guard applies to both callers.

Confirm whether the fresh path needs the probe in the empty-snapshots case. If it does not, add the same guard there.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs` around lines 710 -
716, Update the fresh-lockfile predicate near the installability-check
construction to require non-empty snapshots before calling
any_installability_constraint, matching the guarded logic in the frozen-lockfile
path. Preserve the existing !config.force condition and return false when
snapshots or packages are absent or snapshots are empty.

793-799: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Trim the preceding comment now that resolve_engine_name owns the logic.

The call now delegates to resolve_engine_name. The comment block above it restates that function's rustdoc: the two consumer sites, the three detection paths, the synthetic-host rule, and the runtime-pin rationale all appear in materialization_plan.rs lines 176-191.

Keep only what is local to this caller, such as why the deferred handle is awaited before BuildModules. Point the rest at the shared function.

As per coding guidelines: "Do not write comments that merely restate code, repeat callee documentation, describe removed implementation history, or narrate the function body".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs` around lines 793 -
799, Remove the comment block preceding the resolve_engine_name call that
restates the function's documentation (the two consumer sites, three detection
paths, synthetic-host rule, and runtime-pin rationale, which are documented in
materialization_plan.rs lines 176-191). Retain only comment text that is local
to this call site and specific to how the deferred_engine_handle is used before
BuildModules, and direct readers to the resolve_engine_name function
documentation for the shared logic details.

Source: Coding guidelines


748-752: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reuse one IncludedDependencies value.

This block builds an IncludedDependencies from dependency_groups. Line 1222 in the same function builds an identical value from the same three group checks. Bind it once above this call and pass it to both sites.

♻️ Proposed change
+        let included = pacquet_modules_yaml::IncludedDependencies {
+            dependencies: dependency_groups.contains(&DependencyGroup::Prod),
+            dev_dependencies: dependency_groups.contains(&DependencyGroup::Dev),
+            optional_dependencies: include_optional,
+        };

Then pass included at this call site and reuse the same binding at line 1222.

As per path instructions: report "missed reuse or duplication across the monorepo".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs` around lines 748 -
752, The function contains two identical constructions of
pacquet_modules_yaml::IncludedDependencies built from the same dependency_groups
checks (dependencies, dev_dependencies, optional_dependencies via
include_optional), one near this call and a duplicate later in the same
function. Bind the IncludedDependencies value once as a local variable (e.g.
included) before the first usage, and reuse that same binding at both call sites
instead of reconstructing it twice.

Source: Path instructions

pnpm/crates/deps-restorer/src/materialization_plan.rs (2)

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

Add a struct-level rustdoc for SkipSetInputs.

SkipSetInputs is a public type of the new materialization_plan API. Every other public item in this module carries rustdoc. This struct has none, so the field docs stand without a statement of the type's contract.

Document what the struct represents and link the consumer with an intra-doc link.

📝 Proposed rustdoc
+/// Inputs to [`compute_skip_set`].
+///
+/// Every field is read exactly once. The three fields the two install
+/// paths set differently are [`Self::seed`], [`Self::exclude_optional`],
+/// and [`Self::snapshots`] / [`Self::packages`] under a filtered install.
 pub struct SkipSetInputs<'a> {
     pub requester: &'a str,

As per path instructions: "For the new public materialization_plan API, document contracts with rustdoc and link public identifiers using intra-doc links".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/materialization_plan.rs` around lines 72 - 73,
Add a struct-level rustdoc comment above the SkipSetInputs struct definition
that documents the purpose and contract of this public type. Include a
description of what the struct represents and incorporate an intra-doc link to
identify its consumer or related context, following the documentation style
established by other public items in the materialization_plan module.

Source: Path instructions


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

Move find_runtime_node_major and parse_major_from_version out of install_frozen_lockfile.

The shared module imports two helpers from install_frozen_lockfile, which is one of its two callers. Both helpers are now used only by resolve_engine_name. The dependency direction points from the shared layer back into a caller layer.

Move both helpers into materialization_plan.rs so the shared layer owns the logic it needs. The frozen path already routes through resolve_engine_name, so no caller keeps a direct use.

♻️ Proposed import change after the move
 use crate::{
     InstallabilityHost, SkippedSnapshots, add_direct_runtime_skips, compute_skipped_snapshots,
     extend_skipped_with_dependency_closure,
-    install_frozen_lockfile::{find_runtime_node_major, parse_major_from_version},
 };

Verify that neither helper has a remaining caller outside this module before moving it:

#!/bin/bash
# Description: Find every reference to the two engine-name helpers.
rg -nP --type=rust -C3 '\b(find_runtime_node_major|parse_major_from_version)\b'

As per path instructions: "shared materialization-plan logic should remain in the owning deps-restorer layer".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/materialization_plan.rs` around lines 12 - 16,
The import in materialization_plan.rs pulls find_runtime_node_major and
parse_major_from_version from install_frozen_lockfile, creating a reverse
dependency from the shared layer back into a caller. Move both function
definitions out of install_frozen_lockfile and into materialization_plan.rs
itself, then remove the now-unneeded import line referencing
install_frozen_lockfile::{find_runtime_node_major, parse_major_from_version}.
Update resolve_engine_name (and any other in-module callers) to use the
locally-defined helpers. Before finalizing, confirm neither helper is still
referenced from install_frozen_lockfile or any other caller outside
materialization_plan.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Around line 1265-1271: Update the resolve_engine_name call in the
fresh-lockfile install flow to pass built_lockfile.snapshots.as_ref() instead of
initial_materialization_lockfile.snapshots.as_ref(). Ensure engine resolution
always sees the complete wanted lockfile snapshot map, including the
node@runtime: pin, regardless of selected_importer_ids filtering.

---

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs`:
- Around line 710-716: Update the fresh-lockfile predicate near the
installability-check construction to require non-empty snapshots before calling
any_installability_constraint, matching the guarded logic in the frozen-lockfile
path. Preserve the existing !config.force condition and return false when
snapshots or packages are absent or snapshots are empty.
- Around line 793-799: Remove the comment block preceding the
resolve_engine_name call that restates the function's documentation (the two
consumer sites, three detection paths, synthetic-host rule, and runtime-pin
rationale, which are documented in materialization_plan.rs lines 176-191).
Retain only comment text that is local to this call site and specific to how the
deferred_engine_handle is used before BuildModules, and direct readers to the
resolve_engine_name function documentation for the shared logic details.
- Around line 748-752: The function contains two identical constructions of
pacquet_modules_yaml::IncludedDependencies built from the same dependency_groups
checks (dependencies, dev_dependencies, optional_dependencies via
include_optional), one near this call and a duplicate later in the same
function. Bind the IncludedDependencies value once as a local variable (e.g.
included) before the first usage, and reuse that same binding at both call sites
instead of reconstructing it twice.

In `@pnpm/crates/deps-restorer/src/materialization_plan.rs`:
- Around line 72-73: Add a struct-level rustdoc comment above the SkipSetInputs
struct definition that documents the purpose and contract of this public type.
Include a description of what the struct represents and incorporate an intra-doc
link to identify its consumer or related context, following the documentation
style established by other public items in the materialization_plan module.
- Around line 12-16: The import in materialization_plan.rs pulls
find_runtime_node_major and parse_major_from_version from
install_frozen_lockfile, creating a reverse dependency from the shared layer
back into a caller. Move both function definitions out of
install_frozen_lockfile and into materialization_plan.rs itself, then remove the
now-unneeded import line referencing
install_frozen_lockfile::{find_runtime_node_major, parse_major_from_version}.
Update resolve_engine_name (and any other in-module callers) to use the
locally-defined helpers. Before finalizing, confirm neither helper is still
referenced from install_frozen_lockfile or any other caller outside
materialization_plan.rs.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Around line 1251-1252: Add an explicit materialization_plan import alongside
the existing pacquet_deps_restorer imports, then update the three calls to
detect_installability_host, compute_skip_set, and the other materialization_plan
API to use the imported module path. Preserve all existing arguments and
behavior while reducing unnecessary path repetition and indentation.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c0539695-3b7d-40c7-80ed-ccc406610750

📥 Commits

Reviewing files that changed from the base of the PR and between 74bf5dd and b7be312.

📒 Files selected for processing (5)
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
  • pnpm/crates/deps-restorer/src/lib.rs
  • pnpm/crates/deps-restorer/src/materialization_plan.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/materialization_plan.rs
💤 Files with no reviewable changes (1)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/materialization_plan.rs

`InstallFrozenLockfile::run` carried its whole link phase inline —
hoist plan, pre-link reconciliation, importer symlinks, root-component
cross-links, per-slot bins, the hoisted-linker arm, the on-disk hoist
pass, and the module-resolution sidecars. That is a phase, not a step,
and it kept `run` at 770 lines.

Move it to `install_frozen_lockfile::linking`, shaped like the fresh
path's `install_with_fresh_lockfile::linking`: the same
`LinkPhaseInputs` / `LinkPhaseOutput` pair and the same `run_link_phase`
entry point. `run` drops to 485 lines.

Deliberately a pure move, so the diff stays checkable against the
original. The two link phases are now adjacent in shape but not yet
merged: they still differ in five places (the `is_hoisted` argument to
`compute_hoist_plan`, how trusted importer ids are derived, whether the
anchor is `workspace_root` or `modules_dir.parent()`, whether the
sidecars filter the lockfile first, and the hoist/bin ordering). Sharing
them means parameterising those, which is its own change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 4, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2b8f7ae

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pnpm/crates/deps-restorer/src/install_frozen_lockfile/linking.rs (1)

133-133: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: merge the two identical guards.

Line 133 and line 157 evaluate the same condition !is_hoisted && !config.virtual_store_only. The reconciliation block and the linking block run back to back, so one block keeps the same order and the same reporter emission point. Keep them separate if the split documents the two intents on purpose.

Also applies to: 157-157

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile/linking.rs` at line
133, Optionally merge the adjacent reconciliation and linking blocks guarded by
`!is_hoisted && !config.virtual_store_only` into one block, preserving their
existing order and reporter emission point. If the separate guards intentionally
document distinct purposes, leave them unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile/linking.rs`:
- Line 133: Optionally merge the adjacent reconciliation and linking blocks
guarded by `!is_hoisted && !config.virtual_store_only` into one block,
preserving their existing order and reporter emission point. If the separate
guards intentionally document distinct purposes, leave them unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 25108b9e-2cfe-4e2d-9366-5816f50bca23

📥 Commits

Reviewing files that changed from the base of the PR and between b7be312 and 2b8f7ae.

📒 Files selected for processing (2)
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile/linking.rs

Copilot AI review requested due to automatic review settings August 4, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@codecov-commenter

codecov-commenter commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.75983% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.07%. Comparing base (74bf5dd) to head (7852815).

Files with missing lines Patch % Lines
pnpm/crates/deps-restorer/src/linking.rs 94.87% 10 Missing ⚠️
...m/crates/deps-restorer/src/materialization_plan.rs 90.90% 8 Missing ⚠️
pnpm/crates/cmd-shim/src/link_bins.rs 42.85% 4 Missing ⚠️
...rates/deps-restorer/src/install_frozen_lockfile.rs 97.80% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13644      +/-   ##
==========================================
- Coverage   88.11%   88.07%   -0.04%     
==========================================
  Files         582      582              
  Lines       98821    98620     -201     
==========================================
- Hits        87076    86864     -212     
- Misses      11745    11756      +11     

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

Both paths ran the same link sequence — hoist plan, pre-link
reconciliation, importer symlinks, root-component cross-links, per-slot
bins, the hoisted-linker arm, the on-disk hoist pass, and the
module-resolution sidecars — from two copies. `SymlinkDirectDependencies`
was constructed field-for-field identically in each.

`pacquet-deps-restorer::linking` now owns it and both paths call it,
with `LinkPhaseError` wrapped transparently by each path's error enum so
the surfaced `ERR_PNPM_*` codes are unchanged.

Four differences are ordinary inputs rather than merged behaviour: the
link anchor (`workspace_root` vs `modules_dir.parent()`), the trusted
importer-id set, the root-component importer set, and the lockfile the
sidecars describe (the frozen path filters to the current install
first).

A fifth is a real behavioural flag, `relink_importer_bins`. The fresh
path re-walks each importer's `node_modules` after hoisting to shim
publicly-hoisted aliases; the frozen path leaves those to the post-build
top-level link. Both are preserved as they were.

Two earlier suspicions turned out not to be differences at all:
`compute_hoist_plan`'s `is_hoisted` argument and the hoist/bin ordering.
The fresh path passes `false` only because it reaches that call inside
its isolated branch, where the flag is already known.

No behaviour change on either path.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 4, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan zkochan changed the title refactor(deps-restorer): share the materialization plan between install paths refactor(deps-restorer): share the materialization plan and link phase between install paths Aug 4, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2df883d

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs (1)

1267-1273: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Resolve the engine name from the complete lockfile.

When a filtered isolated install omits node@runtime: from initial_materialization_lockfile, this call loses the configured runtime pin. resolve_engine_name then uses the host Node version. A full install reads the pin from built_lockfile, so GVS slot hashes and side-effects-cache prefixes diverge for the same workspace.

Pass built_lockfile.snapshots.as_ref() here. Add a filtered-install regression test with a runtime pin outside the selected closure.

Proposed fix
             pacquet_deps_restorer::materialization_plan::resolve_engine_name(
                 config.enable_global_virtual_store,
-                initial_materialization_lockfile.snapshots.as_ref(),
+                built_lockfile.snapshots.as_ref(),
                 host_node.as_ref(),
             )

As per path instructions, preserve frozen/fresh parity and shared install behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs` around lines
1267 - 1273, Update the resolve_engine_name call in the fresh-lockfile install
flow to use built_lockfile.snapshots.as_ref() instead of
initial_materialization_lockfile.snapshots.as_ref(), preserving the configured
runtime pin for filtered isolated installs and keeping frozen/fresh and
shared-install behavior consistent. Add a regression test covering a filtered
install whose runtime pin is outside the selected dependency closure.

Source: Path instructions

🧹 Nitpick comments (1)
pnpm/crates/deps-restorer/src/linking.rs (1)

10-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Move hoisted-linking contracts into a shared module.

linking.rs imports HoistPlan and HoistedLinker* from install_frozen_lockfile, while that module invokes run_link_phase. This makes the shared layer depend on a caller-specific module. Move these contracts and the hoisted linker into linking.rs or a neutral hoisted-linking module.

As per path instructions, shared link logic must live in its owning pacquet layer without unnecessary abstraction.

Also applies to: 319-341

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/deps-restorer/src/linking.rs` around lines 10 - 11, Move
HoistPlan, HoistedLinkerError, HoistedLinkerInputs, HoistedLinkerOutput, and the
hoisted linker implementation (including run_link_phase) out of
install_frozen_lockfile into linking.rs or a neutral hoisted-linking module.
Update all imports and call sites so install_frozen_lockfile depends on the
shared linking layer rather than the reverse, while preserving existing behavior
and avoiding extra abstraction.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/deps-restorer/src/linking.rs`:
- Around line 32-35: Correct the LinkPhaseError rustdoc to distinguish variants
with explicit diagnostic codes from transparent wrapped errors. Add
contract-focused rustdoc to LinkPhaseInputs, LinkPhaseOutput, and run_link_phase
describing required materialization preconditions, how skipped is mutated, and
which downstream consumers use the output; document any non-obvious invariants
without changing behavior.

---

Duplicate comments:
In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Around line 1267-1273: Update the resolve_engine_name call in the
fresh-lockfile install flow to use built_lockfile.snapshots.as_ref() instead of
initial_materialization_lockfile.snapshots.as_ref(), preserving the configured
runtime pin for filtered isolated installs and keeping frozen/fresh and
shared-install behavior consistent. Add a regression test covering a filtered
install whose runtime pin is outside the selected dependency closure.

---

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/linking.rs`:
- Around line 10-11: Move HoistPlan, HoistedLinkerError, HoistedLinkerInputs,
HoistedLinkerOutput, and the hoisted linker implementation (including
run_link_phase) out of install_frozen_lockfile into linking.rs or a neutral
hoisted-linking module. Update all imports and call sites so
install_frozen_lockfile depends on the shared linking layer rather than the
reverse, while preserving existing behavior and avoiding extra abstraction.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 73807ed7-99ab-41a3-8823-3ae7927beb40

📥 Commits

Reviewing files that changed from the base of the PR and between d8ce328 and 2df883d.

📒 Files selected for processing (5)
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
  • pnpm/crates/deps-restorer/src/lib.rs
  • pnpm/crates/deps-restorer/src/linking.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/linking.rs
💤 Files with no reviewable changes (1)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/linking.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/deps-restorer/src/lib.rs

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

Copy link
Copy Markdown

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

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

Four violations across the link-phase share and its tests: a multi-line
`matches!` and a multi-line `assert!` missing trailing commas, two
`use crate::` statements that must collapse into one, and an escaped
string literal that reads better as a raw string.

These reached CI because dylint never ran locally. The lint library is
built per worktree, and this one had none, so the pre-push hook skipped
the step with a warning rather than failing. Built it here and ran
`cargo dylint --all` directly, which also caught the three violations CI
had not reached — it stops at the first crate that fails.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 4, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 7852815b3046

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.561 ± 0.124 2.462 2.872 1.61 ± 0.16
pacquet@main 2.578 ± 0.149 2.376 2.899 1.62 ± 0.17
pnpr@HEAD 1.591 ± 0.135 1.416 1.860 1.00
pnpr@main 1.701 ± 0.157 1.444 1.912 1.07 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.56067287468,
      "stddev": 0.12406660204944915,
      "median": 2.50964317768,
      "user": 1.8813114399999997,
      "system": 1.5522394800000001,
      "min": 2.4619123161800003,
      "max": 2.87153105518,
      "times": [
        2.4796651561800003,
        2.87153105518,
        2.5071935031800003,
        2.4661755281800004,
        2.6339795141800004,
        2.4619123161800003,
        2.49728223818,
        2.5120928521800003,
        2.57265280318,
        2.60424378018
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5784687769800003,
      "stddev": 0.14922677277258994,
      "median": 2.5886763201800003,
      "user": 2.02473994,
      "system": 1.5755993799999999,
      "min": 2.37629005618,
      "max": 2.8993001671800003,
      "times": [
        2.5182579141800003,
        2.8993001671800003,
        2.58391124318,
        2.59871576518,
        2.52313311218,
        2.39402534518,
        2.70049482418,
        2.37629005618,
        2.5971179451800004,
        2.5934413971800003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.59145459438,
      "stddev": 0.1353237742360014,
      "median": 1.5807367321799999,
      "user": 1.38343044,
      "system": 1.4391019799999998,
      "min": 1.41631221618,
      "max": 1.8604809091799999,
      "times": [
        1.5734069521799998,
        1.64731440818,
        1.49510436018,
        1.58806651218,
        1.7014342541799998,
        1.8604809091799999,
        1.52371726318,
        1.43272986418,
        1.6759792041800001,
        1.41631221618
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7010308771799998,
      "stddev": 0.15741182246413288,
      "median": 1.68308796618,
      "user": 1.64406644,
      "system": 1.7675772799999998,
      "min": 1.44396076918,
      "max": 1.91206917718,
      "times": [
        1.69243643518,
        1.67373949718,
        1.44396076918,
        1.60735742318,
        1.5107933491799999,
        1.64777661118,
        1.78296905118,
        1.85918069718,
        1.91206917718,
        1.88002576118
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 343.4 ± 22.8 312.6 384.2 1.10 ± 0.09
pacquet@main 349.5 ± 56.1 281.6 444.5 1.12 ± 0.19
pnpr@HEAD 368.2 ± 64.0 306.1 458.6 1.17 ± 0.21
pnpr@main 313.4 ± 16.9 289.1 349.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3434327072,
      "stddev": 0.022767114168209632,
      "median": 0.3444937805,
      "user": 0.30993634,
      "system": 0.6421333199999999,
      "min": 0.3125671935,
      "max": 0.3842169615,
      "times": [
        0.34914798150000004,
        0.3479849875,
        0.32565491550000003,
        0.3125671935,
        0.3260521115,
        0.3410025735,
        0.35396611250000004,
        0.3717374505,
        0.3842169615,
        0.3219967845
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.34953160520000004,
      "stddev": 0.056132624839460674,
      "median": 0.3422704435,
      "user": 0.29276973999999995,
      "system": 0.6930931199999999,
      "min": 0.28162304050000003,
      "max": 0.4444836795,
      "times": [
        0.40680688150000005,
        0.3896230955,
        0.4444836795,
        0.3888309365,
        0.35791167150000003,
        0.31183770250000004,
        0.3266292155,
        0.2879887975,
        0.29958103150000004,
        0.28162304050000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36823932880000004,
      "stddev": 0.06403645032309298,
      "median": 0.33313141300000004,
      "user": 0.32032474,
      "system": 0.6527779199999999,
      "min": 0.3061346105,
      "max": 0.45856126950000003,
      "times": [
        0.4573623285,
        0.4191208905,
        0.3185867505,
        0.3224624495,
        0.32268199150000004,
        0.3073214805,
        0.3061346105,
        0.34358083450000004,
        0.45856126950000003,
        0.42658068250000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3134284204,
      "stddev": 0.0169024152169478,
      "median": 0.3089268355,
      "user": 0.24717434,
      "system": 0.5821497199999999,
      "min": 0.2891479645,
      "max": 0.3490264625,
      "times": [
        0.3490264625,
        0.2891479645,
        0.3041726255,
        0.30771088150000003,
        0.3023537985,
        0.3321354375,
        0.3049321225,
        0.3195738535,
        0.3101427895,
        0.31508826850000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.785 ± 0.044 2.727 2.881 1.71 ± 0.11
pacquet@main 2.809 ± 0.140 2.695 3.191 1.73 ± 0.14
pnpr@HEAD 1.675 ± 0.086 1.552 1.823 1.03 ± 0.08
pnpr@main 1.628 ± 0.099 1.507 1.856 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7849717054600003,
      "stddev": 0.04379302443818641,
      "median": 2.77295794806,
      "user": 2.0121758599999997,
      "system": 1.6041876,
      "min": 2.72685866556,
      "max": 2.88054586356,
      "times": [
        2.77669935056,
        2.75862807856,
        2.76921654556,
        2.88054586356,
        2.7824491705599996,
        2.72685866556,
        2.75686996556,
        2.8260627285599997,
        2.7611859015599998,
        2.81120078456
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.8086733138599995,
      "stddev": 0.1404159068824714,
      "median": 2.75909969856,
      "user": 2.0765840599999996,
      "system": 1.6802913,
      "min": 2.6953382115599998,
      "max": 3.19101674556,
      "times": [
        2.78952331656,
        3.19101674556,
        2.8389163215599997,
        2.75835327156,
        2.7598461255599998,
        2.73359106156,
        2.75043747356,
        2.8169285135599997,
        2.75278209756,
        2.6953382115599998
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.67471963466,
      "stddev": 0.0856865633996584,
      "median": 1.69218046606,
      "user": 1.2993749600000002,
      "system": 1.3900029000000003,
      "min": 1.5520816665600001,
      "max": 1.8229958785600002,
      "times": [
        1.8229958785600002,
        1.61376907256,
        1.72288128556,
        1.55605768456,
        1.70758790056,
        1.5520816665600001,
        1.71047499356,
        1.63770557156,
        1.67677303156,
        1.74686926156
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6280875437600002,
      "stddev": 0.09949501056572639,
      "median": 1.6134891470600001,
      "user": 1.30658596,
      "system": 1.4110723,
      "min": 1.50722696656,
      "max": 1.85552285456,
      "times": [
        1.6370610515600001,
        1.7173577205600001,
        1.6193912435600002,
        1.5287876025600002,
        1.59806528656,
        1.5704414715600001,
        1.60758705056,
        1.50722696656,
        1.85552285456,
        1.63943418956
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 573.6 ± 51.3 501.5 694.7 1.60 ± 0.17
pacquet@main 546.2 ± 65.1 468.7 662.1 1.52 ± 0.20
pnpr@HEAD 468.3 ± 68.7 392.9 566.1 1.30 ± 0.20
pnpr@main 359.0 ± 19.8 327.9 394.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.57362851166,
      "stddev": 0.051325156063792496,
      "median": 0.57244456166,
      "user": 0.80489824,
      "system": 0.85979154,
      "min": 0.50150544316,
      "max": 0.69469387516,
      "times": [
        0.54711327716,
        0.50150544316,
        0.5299553501600001,
        0.58351608316,
        0.57949271516,
        0.56539640816,
        0.55465903116,
        0.59849732116,
        0.5814556121600001,
        0.69469387516
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.54617064726,
      "stddev": 0.06512929136000854,
      "median": 0.53773796366,
      "user": 0.7681067399999999,
      "system": 0.85872034,
      "min": 0.46870718916000004,
      "max": 0.66208855316,
      "times": [
        0.63556181916,
        0.66208855316,
        0.58665787416,
        0.51345755216,
        0.5431472081600001,
        0.53232871916,
        0.55032249516,
        0.47314643816,
        0.49628862416,
        0.46870718916000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.46827016936000004,
      "stddev": 0.06873024914484686,
      "median": 0.44858755916000004,
      "user": 0.35312864,
      "system": 0.7284537399999998,
      "min": 0.39289440116,
      "max": 0.56605134916,
      "times": [
        0.47135764716,
        0.5182888571600001,
        0.53297008316,
        0.56605134916,
        0.41934099616000003,
        0.55348713916,
        0.39312263016000004,
        0.39289440116,
        0.40937111916,
        0.42581747116
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.35900121546,
      "stddev": 0.019807000337196092,
      "median": 0.35531057866000004,
      "user": 0.25090483999999996,
      "system": 0.59903694,
      "min": 0.32791967116000004,
      "max": 0.39468136816000005,
      "times": [
        0.38408503516000003,
        0.34026474816,
        0.34886937016,
        0.35597308316000004,
        0.35464807416,
        0.39468136816000005,
        0.35075416916,
        0.32791967116000004,
        0.36762253316000004,
        0.36519410216000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.831 ± 0.049 1.779 1.905 4.88 ± 0.51
pacquet@main 1.902 ± 0.083 1.774 2.051 5.07 ± 0.56
pnpr@HEAD 0.375 ± 0.038 0.334 0.446 1.00
pnpr@main 0.383 ± 0.052 0.344 0.503 1.02 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8310121738200003,
      "stddev": 0.049318261916001686,
      "median": 1.82108726732,
      "user": 0.9265923999999999,
      "system": 0.83632848,
      "min": 1.77865548332,
      "max": 1.9047281923200001,
      "times": [
        1.9047281923200001,
        1.77865548332,
        1.78012018332,
        1.80973680232,
        1.82514618632,
        1.81702834832,
        1.77874051332,
        1.8939988603200002,
        1.8921807863200002,
        1.82978638232
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.9018700997200004,
      "stddev": 0.08335785344461637,
      "median": 1.88346376732,
      "user": 1.0255701,
      "system": 0.9316442799999999,
      "min": 1.77415397832,
      "max": 2.05115468332,
      "times": [
        1.8850415653200001,
        1.97296707432,
        1.88188596932,
        1.87814257832,
        1.77415397832,
        1.8226103423200002,
        1.88896074732,
        2.05115468332,
        2.0004039183200004,
        1.86338014032
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.37488045112,
      "stddev": 0.037920711654483616,
      "median": 0.36131264681999997,
      "user": 0.25812979999999996,
      "system": 0.6238129799999999,
      "min": 0.33428631332000003,
      "max": 0.44614427432000003,
      "times": [
        0.44614427432000003,
        0.41952943432,
        0.34945028632,
        0.37147327232,
        0.36700258432,
        0.34368023932,
        0.41311043732,
        0.34850496032,
        0.33428631332000003,
        0.35562270932
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3825498506200001,
      "stddev": 0.0516711548272263,
      "median": 0.35837297582,
      "user": 0.2702508,
      "system": 0.6305348799999998,
      "min": 0.34406484132,
      "max": 0.50320160432,
      "times": [
        0.36025001132,
        0.34406484132,
        0.40591760732,
        0.35649594032,
        0.36079652832000003,
        0.35242887132,
        0.35190830332,
        0.35262178332,
        0.43781301532,
        0.50320160432
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 241.7 ± 28.8 193.4 294.0 2.52 ± 0.32
pacquet@main 221.1 ± 26.1 189.1 271.7 2.30 ± 0.29
pnpr@HEAD 96.0 ± 4.5 86.9 105.2 1.00
pnpr@main 105.1 ± 10.8 90.2 137.5 1.09 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2416588141123077,
      "stddev": 0.028837743437908993,
      "median": 0.23975544542,
      "user": 0.23182937076923074,
      "system": 0.08135385692307692,
      "min": 0.19342965242000001,
      "max": 0.29396298142000005,
      "times": [
        0.20976659642,
        0.19342965242000001,
        0.21695489942,
        0.24948193342,
        0.25352878342,
        0.21867968742,
        0.25975051042,
        0.23517397842,
        0.28626052442000005,
        0.23249397642,
        0.25232561442,
        0.29396298142000005,
        0.23975544542
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.22110315592,
      "stddev": 0.026104993087491635,
      "median": 0.21862065642,
      "user": 0.20493522333333333,
      "system": 0.08340178,
      "min": 0.18914524442,
      "max": 0.27169024642000006,
      "times": [
        0.23206062142,
        0.23504096842,
        0.19214259442,
        0.20340233342,
        0.21880953142,
        0.23754583342,
        0.18914524442,
        0.27169024642000006,
        0.25611571342000006,
        0.19869811842000001,
        0.21843178142,
        0.20015488442
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09598648764580643,
      "stddev": 0.0045236084868383614,
      "median": 0.09476908942000001,
      "user": 0.02679662387096774,
      "system": 0.011306948387096775,
      "min": 0.08691077942000001,
      "max": 0.10524299542000001,
      "times": [
        0.09122808842,
        0.08996006642000001,
        0.09471354542,
        0.09270513242,
        0.09422484742000001,
        0.09245257842000001,
        0.08691077942000001,
        0.09329910842000001,
        0.09544202442000001,
        0.09557326942000001,
        0.10524299542000001,
        0.09778679742000002,
        0.09517609542000001,
        0.09191409742000001,
        0.09476908942000001,
        0.09409946142,
        0.10511246642000001,
        0.09568069042,
        0.09980290342,
        0.10118321642000001,
        0.10477781942000002,
        0.09863731642000001,
        0.09460205742000001,
        0.09152044842000001,
        0.09296643642,
        0.09371816642000001,
        0.09286956342000001,
        0.09991510342000001,
        0.10131584742000001,
        0.09690550042000001,
        0.10107560442
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10507458583379313,
      "stddev": 0.010800142157290287,
      "median": 0.10466765142000001,
      "user": 0.03127934689655172,
      "system": 0.014547607586206893,
      "min": 0.09022654842000001,
      "max": 0.13749903842,
      "times": [
        0.09776060842,
        0.09717537942000001,
        0.09022654842000001,
        0.09543223442000001,
        0.11751640642000001,
        0.10085903742,
        0.09770810942000001,
        0.09901658842000001,
        0.09707030142,
        0.09743816342000002,
        0.10466765142000001,
        0.13749903842,
        0.11175917142000001,
        0.09750114142,
        0.11371767042000001,
        0.10618969042000001,
        0.10638210142000001,
        0.09422037942000001,
        0.10553872742,
        0.11120509042000001,
        0.10195956542000001,
        0.10504543142000002,
        0.10496011142000002,
        0.13105201942,
        0.12061750942,
        0.10538331642000001,
        0.10514999742000002,
        0.09918839042000001,
        0.09492260842000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 789.2 ± 250.0 564.5 1329.9 1.00
pacquet@main 809.1 ± 224.8 547.1 1210.9 1.03 ± 0.43
pnpm@HEAD 3395.6 ± 109.0 3215.1 3593.5 4.30 ± 1.37
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7891559502777777,
      "stddev": 0.2500333259351278,
      "median": 0.6790334175,
      "user": 0.7239753288888888,
      "system": 0.14580681333333334,
      "min": 0.5645322815,
      "max": 1.3299020005,
      "times": [
        0.8364230985000001,
        0.6585555635,
        0.5645322815,
        1.0362513825,
        0.6262094595000001,
        1.3299020005,
        0.5939343275,
        0.7775620215,
        0.6790334175
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.8091098870555555,
      "stddev": 0.2247784130732295,
      "median": 0.7674868575,
      "user": 0.7541916622222221,
      "system": 0.14037448,
      "min": 0.5471073125,
      "max": 1.2108873775,
      "times": [
        0.5830168915,
        1.0715197565,
        1.2108873775,
        0.7618624035,
        0.8647157605,
        0.7674868575,
        0.8735244845000001,
        0.5471073125,
        0.6018681395000001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.3955670313888895,
      "stddev": 0.10900375425150413,
      "median": 3.3733407405,
      "user": 5.202397662222222,
      "system": 0.30590625777777775,
      "min": 3.2150818655,
      "max": 3.5934851625000004,
      "times": [
        3.5051928755,
        3.3315398555000004,
        3.3733407405,
        3.3535669385,
        3.3439315505000002,
        3.5934851625000004,
        3.4011134445000004,
        3.2150818655,
        3.4428508495
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.661 ± 0.124 4.544 4.954 1.31 ± 0.05
pacquet@main 4.511 ± 0.088 4.431 4.654 1.26 ± 0.05
pnpr@HEAD 3.571 ± 0.117 3.468 3.799 1.00
pnpr@main 3.588 ± 0.142 3.468 3.908 1.00 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.661178826359999,
      "stddev": 0.12353508670917368,
      "median": 4.61987872256,
      "user": 2.21703626,
      "system": 1.676296,
      "min": 4.54433953856,
      "max": 4.954066768560001,
      "times": [
        4.62913757356,
        4.60876349456,
        4.554100693560001,
        4.61061987156,
        4.54433953856,
        4.7162016945600005,
        4.954066768560001,
        4.55986735556,
        4.7334173255600005,
        4.70127394756
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.51077470306,
      "stddev": 0.08769257260344253,
      "median": 4.4791431930600005,
      "user": 1.8790939599999998,
      "system": 1.4432173,
      "min": 4.43074671656,
      "max": 4.65376845556,
      "times": [
        4.489812708560001,
        4.43827314256,
        4.44248660256,
        4.44614870556,
        4.65376845556,
        4.63203642656,
        4.4775497175600005,
        4.616187886560001,
        4.43074671656,
        4.4807366685600005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5707179947600003,
      "stddev": 0.11659610912170044,
      "median": 3.52531899956,
      "user": 1.32429676,
      "system": 1.2882203999999997,
      "min": 3.46847070056,
      "max": 3.7989546895600004,
      "times": [
        3.51003494456,
        3.52274047756,
        3.7989546895600004,
        3.52789752156,
        3.4776095385600003,
        3.57470880856,
        3.46847070056,
        3.49330254456,
        3.7638707135600002,
        3.56959000856
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.58848369306,
      "stddev": 0.14219328055730723,
      "median": 3.52790790956,
      "user": 1.3532964599999997,
      "system": 1.3345492999999997,
      "min": 3.46822113856,
      "max": 3.9077661485600004,
      "times": [
        3.9077661485600004,
        3.46822113856,
        3.4868130115600002,
        3.7068294995600004,
        3.54962846456,
        3.71308151656,
        3.53801863156,
        3.5123790775600003,
        3.5177971875600003,
        3.48430225456
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13644
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,726.86 ms
(+3.51%)Baseline: 2,634.41 ms
3,161.30 ms
(86.26%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,778.66 ms
(+0.09%)Baseline: 1,777.09 ms
2,132.51 ms
(83.41%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
501.51 ms
(+18.58%)Baseline: 422.92 ms
507.51 ms
(98.82%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
193.43 ms
(+0.89%)Baseline: 191.73 ms
230.08 ms
(84.07%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,461.91 ms
(+2.97%)Baseline: 2,390.89 ms
2,869.07 ms
(85.81%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,544.34 ms
(+2.09%)Baseline: 4,451.25 ms
5,341.50 ms
(85.08%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
312.57 ms
(+19.43%)Baseline: 261.72 ms
314.06 ms
(99.52%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
564.53 ms
(-21.43%)Baseline: 718.55 ms
862.26 ms
(65.47%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13644
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,552.08 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
334.29 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
392.89 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
86.91 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,416.31 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,468.47 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
306.13 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit df3a09a into main Aug 4, 2026
33 checks passed
@zkochan
zkochan deleted the dedupe-materialization-plan branch August 4, 2026 19:09
KSXGitHub pushed a commit that referenced this pull request Aug 4, 2026
Picks up the store-index helper sharing (#13647) and the
headless-install bin shim for publicly hoisted workspace packages
(#13644), which moves the linking and materialization-plan
modules from `package-manager` into `deps-restorer`.

Neither touches the mtime helpers or the workspace-state clock seam this
branch changes, so the merge is clean.
@coderabbitai coderabbitai Bot mentioned this pull request Aug 20, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants