Skip to content

refactor(deps-restorer): split create_virtual_store, and fix stale file: dependency copies - #13649

Merged
zkochan merged 7 commits into
mainfrom
split-create-virtual-store
Aug 4, 2026
Merged

zkochan merged 7 commits into
mainfrom
split-create-virtual-store

Conversation

@zkochan

@zkochan zkochan commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Started as a decomposition of create_virtual_store::run (794 → 517 lines) into snapshot_plan.rs and partition.rs, then applied the "logic covered by tests needs no comment" rule to the extracted modules (comments 108 → 57 and 78 → 44, code unchanged).

Checking whether the remaining comments could be replaced by tests turned up a bug. One of them described the directory carve-out in plan_snapshots — the invariant that a file: dependency's slot must be re-materialized on every install. Writing that test showed the carve-out was unreachable on exactly the install it existed to serve.

file: dependencies were never re-copied when their source changed. pnpm's file: is a copy taken at install time, not a symlink like link:, so each install must retake it; the source is mutable and can change with nothing in the lockfile moving. Verified against the TypeScript CLI, which does re-copy.

Two independent gates caused it:

  1. prepare_modules_state's optimistic repeat-install short-circuit concluded the tree was current from an equal lockfile plus existence probes, returning before materialization ran. The TypeScript CLI has no gate at this level — it always runs headless and decides per package in lockfileToDepGraph, where depIsPresent is hard-gated on !isDirectoryDep.
  2. import_indexed_dir's completion-marker check then treated the existing slot as complete. Correct for CAS entries (immutable by key), wrong for a directory resolution, whose file map points at mutable source.

Also removed a factually wrong comment claiming snapshot_cache_key can raise UnsupportedResolution — that variant lives in install_package_by_snapshot, and the Directory arm returns Ok(None).

Squash Commit Body

Split create_virtual_store::run into per-phase submodules, and fix file: dependencies not being re-copied when their source directory changed. Both the optimistic repeat-install short-circuit and the import completion-marker check treated an unchanged lockfile as evidence that a mutable-source slot was current.

Checklist

  • Tests added — a_directory_dependency_is_recopied_when_its_source_changes, verified to fail against each of the two gates independently
  • Changeset added (pacquet, patch — Rust-only)
  • Behavior verified against the TypeScript CLI
  • cargo clippy, cargo doc --document-private-items, cargo dylint --all clean; 3259 tests pass

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

Summary by CodeRabbit

  • Performance
    • Improved virtual-store installations by reusing valid, unchanged dependency snapshots.
    • Streamlined processing of cached and uncached package data for faster installs.
  • Bug Fixes
    • Fixed repeat installs so changed local file: dependencies are copied with their latest contents.
    • Prevented stale local packages from being treated as up to date.
    • Ensured mutable local sources are refreshed when their contents change.
  • Reliability
    • Improved handling of skipped packages, rebuild requirements, missing package data, and host environment detection.

…rtition

`CreateVirtualStore::run` was 794 lines, two thirds of its file, and
read as one sequence with no boundary between the decisions it makes.
Extract the two largest phases into modules, leaving `run` at 517:

- `snapshot_plan` — which snapshots this install must materialize and
  which the current-lockfile check leaves alone, plus the store-index
  cache key each is looked up by. The asymmetry is worth a name:
  survivors take the strict key derivation because a malformed
  resolution must fail before the warm batch starts, while skipped
  snapshots take a lenient pass because a per-snapshot error there
  costs only a prefetch row.
- `partition` — the warm/cold split and the store-index rows the build
  and bin phases read. Skipped snapshots are walked here too: they have
  no link work, but dropping their side-effects rows would make the
  build phase re-run approved scripts on every warm reinstall.

`SnapshotWithCacheKey` was a type alias local to `run`; it moves to
module scope so both phases can name it.

Pure moves. No behaviour change.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@coderabbitai

coderabbitai Bot commented 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

CreateVirtualStore::run now delegates snapshot planning and warm/cold partitioning to private modules. The change adds structured cold-fetch records, mutable-source propagation for directory dependencies, repeat-install coverage, and typed host-node data.

Changes

Virtual store installation flow

Layer / File(s) Summary
Snapshot planning and cache-key handling
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs, pnpm/crates/deps-restorer/src/create_virtual_store.rs
plan_snapshots filters skipped entries, validates reusable snapshots, forces directory resolutions through reinstall, tracks marker rebuilds, and derives cache keys.
Warm and cold snapshot partitioning
pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs
partition_snapshots classifies prefetched snapshots as warm or cold and collects manifests, side-effects maps, and build requirements.
CreateVirtualStore integration
pnpm/crates/deps-restorer/src/create_virtual_store.rs
CreateVirtualStore::run uses structured prefetch results, SnapshotWithCacheKey, and ColdCapture. Slot links carry source mutability.
Mutable directory dependency recopy
pnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot.rs, pnpm/crates/deps-restorer/src/install_package_by_snapshot.rs, pnpm/crates/package-manager/src/install/prepare_modules_state.rs, pnpm/crates/cli/tests/repeat_install.rs, .changeset/directory-dep-recopy.md
Directory resolutions force virtual-directory replacement and disable the repeat-install shortcut. Tests cover direct and delegated directory resolutions and changed source contents.
Typed host-node propagation
pnpm/crates/deps-restorer/src/materialization_plan.rs, pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm/crates/deps-restorer/src/linking.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
HostNode replaces tuple-based host-node values across installation and linking interfaces. Engine-name resolution reads HostNode::version and HostNode::detected.

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

Sequence Diagram(s)

sequenceDiagram
  participant CreateVirtualStoreRun
  participant plan_snapshots
  participant partition_snapshots
  participant ColdFetch
  participant CreateVirtualDirBySnapshot
  CreateVirtualStoreRun->>plan_snapshots: plan snapshots and cache keys
  CreateVirtualStoreRun->>partition_snapshots: partition prefetched snapshots
  partition_snapshots-->>CreateVirtualStoreRun: warm and cold batches plus metadata
  CreateVirtualStoreRun->>ColdFetch: fetch CAS paths for cold entries
  CreateVirtualStoreRun->>CreateVirtualDirBySnapshot: materialize slot with source mutability
Loading

Possibly related PRs

  • pnpm/pnpm#13141: Modifies skipped-snapshot handling in installation and virtual-store planning.
  • pnpm/pnpm#13170: Modifies virtual-store materialization and build-recovery logic.
  • pnpm/pnpm#13648: Modifies directory-resolution handling in create_virtual_dir_by_snapshot.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch split-create-virtual-store

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

❤️ Share

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

refactor(deps-restorer): extract snapshot planning and prefetch partitioning

✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Extract snapshot selection + cache-key derivation into snapshot_plan module.
• Extract prefetch-result folding and warm/cold batching decision into partition module.
• Move SnapshotWithCacheKey to module scope and thread PrefetchResult through the pipeline.
Diagram

graph TD
  Run(["CreateVirtualStore::run"]) --> Plan["snapshot_plan::plan_snapshots"] --> Prefetch["prefetch_cas_paths"] --> Part["partition::partition_snapshots"]
  Prefetch --> Store[("Store index / CAFS")]
  Part --> Warm["Warm batch (rayon)"]
  Part --> Cold["Cold batch (tokio)"]
  subgraph Legend
    direction LR
    _entry(["Entry point"]) ~~~ _mod["Module function"] ~~~ _db[("Data store")]
  end
Loading
High-Level Assessment

This split cleanly names two long, conceptually distinct phases (snapshot planning and prefetch-driven partitioning) without changing the data flow or semantics. Alternatives like extracting private helper functions within create_virtual_store.rs were possible, but the module split better enforces boundaries and makes the contracts (e.g., strict vs lenient cache-key derivation) explicit.

Files changed (3) +474 / -309

Refactor (3) +474 / -309
create_virtual_store.rsDelegate snapshot planning and warm/cold partitioning to new modules +39/-309

Delegate snapshot planning and warm/cold partitioning to new modules

• Moves the snapshot skip/cache-key derivation logic into 'snapshot_plan::plan_snapshots' and the prefetch folding + warm/cold batching logic into 'partition::partition_snapshots'. Promotes 'SnapshotWithCacheKey' to module scope and adjusts the prefetch call site to use the returned 'PrefetchResult' fields ('prefetch.cas_paths', etc.). Adds module declarations for the new files.

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

partition.rsAdd 'partition' module for warm/cold split and store-index row folding +201/-0

Add 'partition' module for warm/cold split and store-index row folding

• Introduces 'partition_snapshots', which consumes 'PrefetchResult' and produces warm/cold worklists while populating 'package_manifests', 'side_effects_maps_by_snapshot', and 'requires_build_by_snapshot'. Preserves the existing behavior where skipped snapshots are still walked to keep side-effects rows for the build-phase 'is_built' gate, and respects 'marker_rebuilds' by withholding side-effects rows when rebuild markers demand it.

pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs

snapshot_plan.rsAdd 'snapshot_plan' module for survivor selection and cache-key derivation +234/-0

Add 'snapshot_plan' module for survivor selection and cache-key derivation

• Introduces 'plan_snapshots' to decide which snapshots are materialized vs skipped (installability skip vs current-lockfile skip) and to derive store-index cache keys for prefetch input. Makes the validation asymmetry explicit: survivors use strict cache-key derivation (fail early), while skipped snapshots use a lenient pass that swallows per-snapshot errors and may omit a prefetch row.

pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.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 because no eligible blocking failure remains in the follow-up review scope.

No blocking failure remains.

Reviews (6): Last reviewed commit: "test(cli): guard the hoisted linker's di..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs (3)

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

Remove the PR-relative wording from these comments.

Line 76 says "Installability skip (this PR)" and Line 85 says "Current-lockfile skip (main <…/pull/442>)". Both anchor the comment to the change history rather than to the invariant. After this refactor lands, "this PR" no longer identifies anything. State the two skip reasons and their consequences without the history references.

♻️ Proposed wording change
-    // 1. **Installability skip (this PR)** — `SkippedSnapshots`
+    // 1. **Installability skip** — `SkippedSnapshots`
@@
-    // 2. **Current-lockfile skip (main <https://github.com/pnpm/pacquet/pull/442>)** — the previous
+    // 2. **Current-lockfile skip** — the previous
🤖 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/create_virtual_store/snapshot_plan.rs` around
lines 71 - 103, Update the explanatory comments in the per-snapshot skip pass to
remove the PR-relative references “this PR” and “main <…/pull/442>”. Describe
the two skip reasons and their consequences directly in terms of installability
constraints and current-lockfile reuse, without mentioning change history.

Source: Path instructions


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

Use the imported HashSet.

Line 16 already imports HashSet. Line 209 qualifies it as std::collections::HashSet, which is inconsistent with marker_probe_keys and marker_rebuilds at Lines 104-105.

♻️ Proposed fix
-    let survivor_keys: std::collections::HashSet<&PackageKey> =
-        snapshot_entries.iter().map(|(k, _, _)| *k).collect();
+    let survivor_keys: HashSet<&PackageKey> =
+        snapshot_entries.iter().map(|(k, _, _)| *k).collect();
🤖 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/create_virtual_store/snapshot_plan.rs` around
lines 209 - 210, Update the survivor_keys declaration in the snapshot planning
logic to use the already imported HashSet directly, matching the style of
marker_probe_keys and marker_rebuilds; keep the existing type and collection
logic unchanged.

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

Consider importing AllowBuildPolicy and passing SnapshotPlanInputs by value.

Every field of SnapshotPlanInputs is Copy, so plan_snapshots copies all of them out of the reference at Line 59. Taking the struct by value removes the redundant indirection. Also, crate::AllowBuildPolicy is the only type referenced by inline path here, while SkippedSnapshots and VirtualStoreLayout are imported at Line 11. Explicit imports are the documented convention for this crate.

♻️ Proposed consistency tweak
-use crate::{SkippedSnapshots, VirtualStoreLayout};
+use crate::{AllowBuildPolicy, SkippedSnapshots, VirtualStoreLayout};
@@
-    pub allow_build_policy: &'a crate::AllowBuildPolicy,
+    pub allow_build_policy: &'a AllowBuildPolicy,
🤖 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/create_virtual_store/snapshot_plan.rs` around
lines 18 - 32, Update SnapshotPlanInputs and plan_snapshots to pass the inputs
struct by value instead of by reference, preserving the existing field usage.
Import AllowBuildPolicy alongside the existing VirtualStoreLayout and
SkippedSnapshots imports, then use the imported type in the allow_build_policy
field declaration rather than the inline crate path.

Source: Path instructions

pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs (1)

19-25: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Consider a named struct instead of the five-field WarmEntry tuple.

WarmEntry carries two scalar fields of different meaning, &'a str and bool, in adjacent positions. The three consumers in create_virtual_store.rs at Lines 443, 481, and 497 destructure it positionally, so a field reorder compiles silently in some combinations. A struct with named fields removes that risk and makes the doc comment at Lines 17-18 unnecessary.

🤖 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/create_virtual_store/partition.rs` around lines
19 - 25, The five-field WarmEntry tuple is vulnerable to positional misuse and
should become a named struct. Define a WarmEntry struct with fields
corresponding to the existing package key, snapshot entry, paths map, string,
and boolean values, then update all three consumers in create_virtual_store.rs
to construct and access these named fields; remove the now-unnecessary tuple doc
comment while preserving behavior.
pnpm/crates/deps-restorer/src/create_virtual_store.rs (1)

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

Reduce SnapshotWithCacheKey visibility to pub(super).

snapshot_plan and partition import the alias through super::{...}, which gives child modules access without exposing it to unrelated crate modules. If the alias should remain crate-scoped, document that visibility outside the type definition.

🤖 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/create_virtual_store.rs` around lines 76 - 80,
Reduce the visibility of the SnapshotWithCacheKey type alias from pub(crate) to
pub(super), since snapshot_plan and partition access it through their parent
module and no unrelated crate modules need it.
🤖 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/create_virtual_store/partition.rs`:
- Around line 120-166: Extract the duplicated store-index row logic into a
shared helper near the surrounding partition code, accepting the snapshot key,
optional cache key, prefetch data, marker rebuild set, and the three mutable
destination maps. Centralize the manifest, marker-gated side-effects, and
requires-build updates there, evaluating the optional cache key once, then
replace both the skipped-entry and snapshot-entry blocks with calls to the
helper while preserving their existing inputs and behavior.
- Around line 64-89: The comments are detached from the code they explain. In
pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs lines 64-89,
retain only the partition criterion and move the rayon-versus-tokio rationale
and benchmark details beside the warm-batch link_slots_parallel call in
create_virtual_store.rs; at lines 90-94, delete or rewrite the “no explicit
alias” paragraph to reflect the existing WarmEntry alias; in
pnpm/crates/deps-restorer/src/create_virtual_store.rs lines 367-381, move the
snapshot-walking and cache-key-derivation rationale beside the relevant logic in
snapshot_plan.rs while keeping only the sort-and-dedup explanation for lines
405-411.

In `@pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs`:
- Around line 56-58: Add an external unit-test module for plan_snapshots
covering the directory-resolution carve-out, missing-slot BrokenModules reporter
emission, and marker-rebuild set population. Use tempfile::TempDir for slot
probes and a recording Reporter to assert emitted missing-slot events, while
constructing inputs that exercise the snapshot_deps_equal and integrity_equal
gates as needed.

---

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/create_virtual_store.rs`:
- Around line 76-80: Reduce the visibility of the SnapshotWithCacheKey type
alias from pub(crate) to pub(super), since snapshot_plan and partition access it
through their parent module and no unrelated crate modules need it.

In `@pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs`:
- Around line 19-25: The five-field WarmEntry tuple is vulnerable to positional
misuse and should become a named struct. Define a WarmEntry struct with fields
corresponding to the existing package key, snapshot entry, paths map, string,
and boolean values, then update all three consumers in create_virtual_store.rs
to construct and access these named fields; remove the now-unnecessary tuple doc
comment while preserving behavior.

In `@pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs`:
- Around line 71-103: Update the explanatory comments in the per-snapshot skip
pass to remove the PR-relative references “this PR” and “main <…/pull/442>”.
Describe the two skip reasons and their consequences directly in terms of
installability constraints and current-lockfile reuse, without mentioning change
history.
- Around line 209-210: Update the survivor_keys declaration in the snapshot
planning logic to use the already imported HashSet directly, matching the style
of marker_probe_keys and marker_rebuilds; keep the existing type and collection
logic unchanged.
- Around line 18-32: Update SnapshotPlanInputs and plan_snapshots to pass the
inputs struct by value instead of by reference, preserving the existing field
usage. Import AllowBuildPolicy alongside the existing VirtualStoreLayout and
SkippedSnapshots imports, then use the imported type in the allow_build_policy
field declaration rather than the inline crate path.
🪄 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: b5dbd4aa-56df-49c3-891d-787898f3e11b

📥 Commits

Reviewing files that changed from the base of the PR and between 0238477 and 0a64138.

📒 Files selected for processing (3)
  • pnpm/crates/deps-restorer/src/create_virtual_store.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Wasted lockfile equality scan 🐞 Bug ➹ Performance
Description
In prepare_modules_state, the new !has_directory_snapshot(wanted_lockfile) guard is evaluated
after wanted_lockfile == current, so repeat installs that include any directory (file:)
resolution still pay the deep lockfile equality traversal even though the guard will prevent the
early return. Reordering the directory-resolution check before the equality comparison avoids that
wasted hot-path work for directory-dep installs without changing behavior.
Code

pnpm/crates/package-manager/src/install/prepare_modules_state.rs[303]

+            && !has_directory_snapshot(wanted_lockfile)
Relevance

●●● Strong

Small, behavior-preserving reorder to avoid expensive equality work; likely accepted as a hot-path
micro-optimization.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The short-circuit predicate compares the full lockfile (wanted_lockfile == current) before it
checks !has_directory_snapshot(wanted_lockfile), so directory-dep installs still incur the
equality cost even though the new guard forces a full materialization path. has_directory_snapshot
itself is a linear scan over lockfile.packages, so moving it earlier allows bypassing the equality
comparison entirely when directory resolutions exist.

pnpm/crates/package-manager/src/install/prepare_modules_state.rs[286-306]
pnpm/crates/package-manager/src/install/prepare_modules_state.rs[411-420]

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

### Issue description
`prepare_modules_state` now blocks the optimistic repeat-install short-circuit when the wanted lockfile contains any `LockfileResolution::Directory`, but it evaluates this guard only after doing `wanted_lockfile == current`.

### Issue Context
On installs that *do* have directory snapshots, the early return is impossible, so the lockfile equality traversal becomes wasted work on a hot path.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[286-306]
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[411-420]

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



Informational

2. InstalledPackage docs mislabel 🐞 Bug ⚙ Maintainability ⭐ New
Description
The updated InstallPackageBySnapshot::run doc comment describes the returned map as a “CAS file
index”, but InstalledPackage explicitly supports directory-backed installs where the map points at
mutable local source (not CAFS/CAS). This wording mismatch can mislead future callers into assuming
immutability/content-addressing guarantees that don’t hold.
Code

pnpm/crates/deps-restorer/src/install_package_by_snapshot.rs[R276-279]

+    /// Execute the subroutine. Returns the fetched package's CAS file
+    /// index — the map relative-archive-path → absolute-store-path
+    /// that downstream consumers use to either populate a
+    /// virtual-store slot (isolated) or import into a hoisted
Relevance

●●● Strong

Team has accepted fixing misleading Rustdoc/comments; this is a straightforward wording correction.

PR-#13644

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The doc comment introduced in the focused hunk uses the term “CAS file index”, while the immediately
adjacent struct definition makes it explicit that the returned map can refer to mutable local source
via source_is_mutable. That means the map is not always a CAS index, so the doc is misleading as
written.

pnpm/crates/deps-restorer/src/install_package_by_snapshot.rs[265-273]
pnpm/crates/deps-restorer/src/install_package_by_snapshot.rs[276-283]

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

### Issue description
`InstallPackageBySnapshot::run` documentation calls the returned map a “CAS file index”, but the API now explicitly supports `source_is_mutable == true` for directory resolutions, where paths are not immutable CAS entries.

### Issue Context
This is a documentation/API-contract clarity issue: callers may treat the map as store/CAS-backed unless the docs are precise.

### Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_package_by_snapshot.rs[276-283]

### Suggested change
Adjust the doc comment to describe the return value as a *file map* (relative path -> absolute path), and then state:
- Usually the absolute paths are CAS/store paths.
- When `source_is_mutable` is true, entries may point at mutable local source (directory resolution / delegated directory resolution).

This keeps the contract correct for both CAS-backed and directory-backed installs.

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


3. Hoisted file: test false-green 🐞 Bug ☼ Reliability ⭐ New
Description
a_directory_dependency_is_recopied_under_the_hoisted_linker only asserts that editing the source
changes node_modules/local-pkg/marker.txt, which would also pass if the dependency were mistakenly
*symlinked/junctioned* instead of copied. This can let a regression violate pnpm’s documented
file: copy semantics while still passing CI.
Code

pnpm/crates/cli/tests/hoisted_node_linker.rs[R1015-1018]

+    assert_eq!(
+        fs::read_to_string(&installed_marker).expect("read the installed marker"),
+        "second",
+        "the second install should re-copy the directory into node_modules",
Relevance

● Weak

Similar test-hardening symlink/junction assertion change in same area was rejected previously.

PR-#13306

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test currently asserts only the observed marker content change after reinstall, and does not
assert the install is a copy rather than a link. The repo’s other directory-dep test explicitly
documents that file: is a copy-not-symlink, so without a “not a symlink/junction” assertion, this
new hoisted test can pass for an incorrect linking implementation.

pnpm/crates/cli/tests/hoisted_node_linker.rs[981-1019]
pnpm/crates/cli/tests/repeat_install.rs[310-312]

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

### Issue description
The new hoisted-linker regression test validates that the installed marker content updates across installs, but it does not validate that `file:` dependencies are materialized as *copies* (not symlinks/junctions). A symlinked install would also reflect edits and make the test pass, so the test can be false-green.

### Issue Context
pnpm’s `file:` dependencies are install-time copies (unlike `link:`), so tests guarding this behavior should explicitly ensure the installed package directory is not linked.

### Fix Focus Areas
- pnpm/crates/cli/tests/hoisted_node_linker.rs[981-1020]

### Suggested change
In `a_directory_dependency_is_recopied_under_the_hoisted_linker`, add an assertion after the first install (and/or before the second) that `node_modules/local-pkg` is not a symlink/reparse-point.

Example (platform-aware):
- Use `fs::symlink_metadata(&workspace.join("node_modules/local-pkg"))` and assert `!metadata.file_type().is_symlink()`.
- If Windows junction behavior is a concern, prefer an existing repo helper (if available) or add a Windows-specific check that reliably detects reparse points in this codebase.

Keep the existing marker-content assertions as they still validate the re-copy behavior.

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


4. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset declares a bump for pacquet but does not include a pnpm entry in its
front-matter. This violates the changeset requirement and may cause the pnpm release metadata to
miss this user-visible fix.
Code

.changeset/directory-dep-recopy.md[R1-3]

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

● Weak

Close precedents show team often rejects adding pnpm bump to Rust-only pacquet changesets.

PR-#13594
PR-#13549
PR-#12996

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changeset front-matter to contain an entry for pnpm with a valid
bump type. The added changeset front-matter includes only "pacquet": patch and no pnpm entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/directory-dep-recopy.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 new changeset `.changeset/directory-dep-recopy.md` lists only `"pacquet": patch` and omits a `pnpm` entry, which violates the rule requiring changesets to explicitly include `pnpm` with a valid bump type.

## Issue Context
This changeset describes a user-visible behavior fix for `pnpm install` with `file:` dependencies; the changeset front-matter should include the `pnpm` package with an appropriate bump type (likely `patch`).

## Fix Focus Areas
- .changeset/directory-dep-recopy.md[1-3]

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


View more (1)
5. partition comment cites Copilot PR ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New comments in partition.rs and snapshot_plan.rs include historical/temporal review context
(e.g., Copilot review on <...>, this PR, and links to prior PRs) that will become stale and are
not part of the current code contract. This violates the requirement that source comments describe
present-day behavior/contracts and rationale rather than historical implementation or review
references.
Code

pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs[R91-94]

+    // explicit alias, so the warm tuple's third field stays bound
+    // to whatever value type `pacquet_tarball::PrefetchedCasPaths`
+    // exposes. A future change there propagates here without a
+    // local alias drifting (Copilot review on <https://github.com/pnpm/pacquet/pull/292>).
Relevance

● Weak

Similar requests to rewrite historical/temporal comment phrasing were rejected in deps-restorer
reviews.

PR-#13349
PR-#13306

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 requires comments to describe current behavior and avoid historical
references such as temporal phrasing (e.g., this PR) or links to prior PRs/reviews. The cited
comment in partition.rs explicitly embeds a prior-review PR link (“Copilot review on ...”), and
the cited additions in snapshot_plan.rs include temporal language and prior-PR references,
demonstrating that these comments are anchored to historical context rather than a stable, timeless
contract.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs[90-95]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[71-92]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[179-183]

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

## Issue description
Comments recently added in `partition.rs` and `snapshot_plan.rs` include historical/temporal phrasing and review/PR references (e.g., `Copilot review on ...`, `this PR`, and links to prior PRs). Compliance rule PR Compliance ID 772199 requires that comments remain focused on the current behavior/contract and rationale, not on historical review or implementation context that will become stale.

## Issue Context
The underlying rationale and explanatory value of the comments is useful, but references to when the code was introduced, what PR it came from, or prior review links should be removed or rewritten as timeless statements about what the code does now and why; any historical breadcrumbs belong in PR/commit history rather than in-source comments.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs[90-95]
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[71-92]
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[179-183]

ⓘ 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 2420d85

Results up to commit 0a64138 ⚖️ Balanced


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


Informational
1. partition comment cites Copilot PR ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New comments in partition.rs and snapshot_plan.rs include historical/temporal review context
(e.g., Copilot review on <...>, this PR, and links to prior PRs) that will become stale and are
not part of the current code contract. This violates the requirement that source comments describe
present-day behavior/contracts and rationale rather than historical implementation or review
references.
Code

pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs[R91-94]

+    // explicit alias, so the warm tuple's third field stays bound
+    // to whatever value type `pacquet_tarball::PrefetchedCasPaths`
+    // exposes. A future change there propagates here without a
+    // local alias drifting (Copilot review on <https://github.com/pnpm/pacquet/pull/292>).
Relevance

● Weak

Similar requests to rewrite historical/temporal comment phrasing were rejected in deps-restorer
reviews.

PR-#13349
PR-#13306

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 requires comments to describe current behavior and avoid historical
references such as temporal phrasing (e.g., this PR) or links to prior PRs/reviews. The cited
comment in partition.rs explicitly embeds a prior-review PR link (“Copilot review on ...”), and
the cited additions in snapshot_plan.rs include temporal language and prior-PR references,
demonstrating that these comments are anchored to historical context rather than a stable, timeless
contract.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs[90-95]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[71-92]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[179-183]

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

## Issue description
Comments recently added in `partition.rs` and `snapshot_plan.rs` include historical/temporal phrasing and review/PR references (e.g., `Copilot review on ...`, `this PR`, and links to prior PRs). Compliance rule PR Compliance ID 772199 requires that comments remain focused on the current behavior/contract and rationale, not on historical review or implementation context that will become stale.

## Issue Context
The underlying rationale and explanatory value of the comments is useful, but references to when the code was introduced, what PR it came from, or prior review links should be removed or rewritten as timeless statements about what the code does now and why; any historical breadcrumbs belong in PR/commit history rather than in-source comments.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs[90-95]
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[71-92]
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[179-183]

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


Results up to commit d17121a ⚖️ Balanced


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


Remediation recommended
1. Wasted lockfile equality scan 🐞 Bug ➹ Performance
Description
In prepare_modules_state, the new !has_directory_snapshot(wanted_lockfile) guard is evaluated
after wanted_lockfile == current, so repeat installs that include any directory (file:)
resolution still pay the deep lockfile equality traversal even though the guard will prevent the
early return. Reordering the directory-resolution check before the equality comparison avoids that
wasted hot-path work for directory-dep installs without changing behavior.
Code

pnpm/crates/package-manager/src/install/prepare_modules_state.rs[303]

+            && !has_directory_snapshot(wanted_lockfile)
Relevance

●●● Strong

Small, behavior-preserving reorder to avoid expensive equality work; likely accepted as a hot-path
micro-optimization.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The short-circuit predicate compares the full lockfile (wanted_lockfile == current) before it
checks !has_directory_snapshot(wanted_lockfile), so directory-dep installs still incur the
equality cost even though the new guard forces a full materialization path. has_directory_snapshot
itself is a linear scan over lockfile.packages, so moving it earlier allows bypassing the equality
comparison entirely when directory resolutions exist.

pnpm/crates/package-manager/src/install/prepare_modules_state.rs[286-306]
pnpm/crates/package-manager/src/install/prepare_modules_state.rs[411-420]

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

### Issue description
`prepare_modules_state` now blocks the optimistic repeat-install short-circuit when the wanted lockfile contains any `LockfileResolution::Directory`, but it evaluates this guard only after doing `wanted_lockfile == current`.

### Issue Context
On installs that *do* have directory snapshots, the early return is impossible, so the lockfile equality traversal becomes wasted work on a hot path.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[286-306]
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[411-420]

ⓘ 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 declares a bump for pacquet but does not include a pnpm entry in its
front-matter. This violates the changeset requirement and may cause the pnpm release metadata to
miss this user-visible fix.
Code

.changeset/directory-dep-recopy.md[R1-3]

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

● Weak

Close precedents show team often rejects adding pnpm bump to Rust-only pacquet changesets.

PR-#13594
PR-#13549
PR-#12996

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changeset front-matter to contain an entry for pnpm with a valid
bump type. The added changeset front-matter includes only "pacquet": patch and no pnpm entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/directory-dep-recopy.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 new changeset `.changeset/directory-dep-recopy.md` lists only `"pacquet": patch` and omits a `pnpm` entry, which violates the rule requiring changesets to explicitly include `pnpm` with a valid bump type.

## Issue Context
This changeset describes a user-visible behavior fix for `pnpm install` with `file:` dependencies; the changeset front-matter should include the `pnpm` package with an appropriate bump type (likely `patch`).

## Fix Focus Areas
- .changeset/directory-dep-recopy.md[1-3]

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


Qodo Logo

@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.19     14.9±2.24ms    25.0 MB/sec    1.00     12.6±1.02ms    29.7 MB/sec
packument/parse                                  1.05     43.8±1.58µs  1513.7 MB/sec    1.00     41.5±2.03µs  1596.7 MB/sec
tarball/download_dependency                      1.00      2.7±0.27ms  1590.2 KB/sec    1.05      2.9±0.42ms  1512.7 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.03   250.5±47.90ms 63.9 KElem/sec    1.00   244.2±34.17ms 65.5 KElem/sec
workspace_resolution/hoist_heavy                 1.49   382.9±63.79ms        ? ?/sec    1.00   256.5±13.95ms        ? ?/sec

@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 97.11934% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.09%. Comparing base (0238477) to head (2420d85).

Files with missing lines Patch % Lines
...eps-restorer/src/create_virtual_store/partition.rs 94.52% 4 Missing ⚠️
...restorer/src/create_virtual_store/snapshot_plan.rs 98.83% 1 Missing ⚠️
...s/deps-restorer/src/install_package_by_snapshot.rs 75.00% 1 Missing ⚠️
...m/crates/deps-restorer/src/materialization_plan.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13649   +/-   ##
=======================================
  Coverage   88.08%   88.09%           
=======================================
  Files         582      584    +2     
  Lines       98601    98677   +76     
=======================================
+ Hits        86853    86929   +76     
  Misses      11748    11748           

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

The extracted phases carried long blocks narrating what the code does,
including scenarios the suite already pins: the two skip reasons
(`skip_failing_optional_dependencies`, `repeat_install`,
`hoisting_skips_broken_symlink_for_skipped_optional`), the
abort-on-malformed-lockfile path (`install/tests.rs` asserts
`MissingPackageMetadata`), and the peer-variant manifest keying.

A test is a better record of behaviour than prose: it cannot drift.
Those blocks shrink to the parts no test carries — the ordering
constraint that the skip pass must precede cache-key derivation, why the
slot probe goes through `layout.slot_dir` under GVS, and why the skipped
entries are built as a parallel `Vec`.

Kept in full: the rayon-versus-tokio profiling numbers, which are the
only record of why the warm batch is shaped that way and which no test
asserts.

Comment lines 108 -> 57 in `snapshot_plan` and 78 -> 44 in `partition`,
with the code unchanged in both.

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

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.

Caught by `perfectionist::unicode-ellipsis-in-comments`.
Copilot AI review requested due to automatic review settings August 4, 2026 20:21

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 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 (2)
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs (1)

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

Correct the directory-resolution comment.

Lines 105-109 return true from the filter, so directory snapshots remain in survivors. Lines 139-144 then derive their cache keys. The comment incorrectly states that these snapshots are dropped before cache-key derivation. Remove that claim and document the actual invariant: directory snapshots bypass the current-lockfile skip so the cold path re-walks mutable local sources.

🤖 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/create_virtual_store/snapshot_plan.rs` around
lines 71 - 74, Update the ordering comment near the snapshot filtering logic to
remove the incorrect claim that directory-backed snapshots are dropped before
cache-key derivation. Document instead that directory snapshots bypass the
current-lockfile skip, allowing the cold path to re-walk mutable local sources
before cache-key derivation.

Sources: Coding guidelines, Path instructions

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

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

Update the host_node contract comment.

Lines 1199-1201 describe a (node_detected, node_version) tuple. Line 1202 exposes HostNode instead. Update the comment to describe HostNode, or remove the field-level comment if the type documentation is sufficient.

As per coding guidelines, “Use rustdoc comments for public API contracts and regular comments for implementation rationale.”

🤖 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` at line 1202,
Update the documentation associated with the public host_node field to describe
its actual Option<&HostNode> contract instead of the outdated (node_detected,
node_version) tuple. Use a rustdoc comment for this public API documentation, or
remove the field-level comment if HostNode’s existing type documentation fully
covers it.

Source: Coding guidelines

🤖 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/create_virtual_store/snapshot_plan.rs`:
- Around line 71-74: Update the ordering comment near the snapshot filtering
logic to remove the incorrect claim that directory-backed snapshots are dropped
before cache-key derivation. Document instead that directory snapshots bypass
the current-lockfile skip, allowing the cold path to re-walk mutable local
sources before cache-key derivation.

In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs`:
- Line 1202: Update the documentation associated with the public host_node field
to describe its actual Option<&HostNode> contract instead of the outdated
(node_detected, node_version) tuple. Use a rustdoc comment for this public API
documentation, or remove the field-level comment if HostNode’s existing type
documentation fully covers it.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c6ad2476-8804-4c6b-bf1a-5e7ac19a3260

📥 Commits

Reviewing files that changed from the base of the PR and between 0a64138 and 9907228.

📒 Files selected for processing (6)
  • pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
  • pnpm/crates/deps-restorer/src/linking.rs
  • pnpm/crates/deps-restorer/src/materialization_plan.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs

The skip-pass comment said the ordering exists so directory-backed
snapshots are not "tripped by `snapshot_cache_key`'s
`UnsupportedResolution`". `snapshot_cache_key` cannot produce that
variant — it lives in `install_package_by_snapshot` and is raised at
install time — and its only failure is `MissingPackageMetadata`, via
`ok_or_else`. Its `Directory` arm returns `Ok(None)`.

Removed rather than reworded: the strict-versus-lenient distinction the
ordering actually serves is already stated on `plan_snapshots`.

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

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 Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1bc5dc6

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

pnpm's `file:` is a copy taken at install time, not a symlink like
`link:`, so each install has to retake the copy — the source is mutable
by definition and can change with nothing in the lockfile moving. A
second install left the first install's copy in place instead.

Two gates had to give way, each independently sufficient to cause it:

- `prepare_modules_state`'s optimistic repeat-install short-circuit
  concluded the tree was current from an equal lockfile plus existence
  probes, and returned before materialization ran at all. Directory
  resolutions now disqualify the short-circuit. The TypeScript CLI has
  no gate at this level; it always runs headless and lets
  `lockfileToDepGraph` decide per package, where `depIsPresent` is
  hard-gated on `!isDirectoryDep`.
- `import_indexed_dir`'s completion-marker check then treated the
  existing slot as complete. That check is correct for CAS entries,
  which are immutable by key, but a directory resolution's file map
  points at mutable source, so those slots now take the
  `force` / `stage_and_swap` path that already served interrupted
  builds. `keep_modules_dir` preserves the child links.

`create_virtual_store`'s cold capture becomes a named struct so the
resolution kind rides along to the link pass instead of widening a
positional tuple.

Found while checking whether the directory carve-out in
`plan_snapshots` could be pinned by a test instead of described in a
comment. It could not — the carve-out was unreachable on the very
install it existed to serve.

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

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): split the virtual-store snapshot plan and partition refactor(deps-restorer): split create_virtual_store, and fix stale file: dependency copies Aug 4, 2026

@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

🤖 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/install_package_by_snapshot.rs`:
- Line 639: Update the source_is_mutable assignment in the package snapshot
installation flow to match the effective resolution used by fetching,
referencing resolution rather than metadata.resolution. Add a regression test
covering a custom fetcher that delegates to LockfileResolution::Directory and
verifies changed directory contents are re-copied on the next install.
🪄 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: c06c12f2-91d6-46c9-a8a7-86ea67545528

📥 Commits

Reviewing files that changed from the base of the PR and between 1bc5dc6 and d17121a.

📒 Files selected for processing (8)
  • .changeset/directory-dep-recopy.md
  • pnpm/crates/cli/tests/repeat_install.rs
  • pnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot.rs
  • pnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot/tests.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs
  • pnpm/crates/deps-restorer/src/install_package_by_snapshot.rs
  • pnpm/crates/package-manager/src/install/prepare_modules_state.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs

@qodo-code-review

Copy link
Copy Markdown

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

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

A custom fetcher's `delegate` can resolve to a directory, so reading
the lockfile's own resolution missed the case where the file map points
at mutable source but the lockfile entry does not say so. The
installer now reports it from the effective resolution, which is the
only place that knows, and returns it alongside the CAS map as
`InstalledPackage`. The cold batch reads it from there rather than
re-deriving it from metadata it cannot see through.

Also folds the two identical store-index row collections in
`partition_snapshots` into one `IndexRows::absorb`, so a skipped
snapshot and a survivor cannot diverge in what they contribute.

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

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 bdd956f

@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: 2

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

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

Remove the loop narration.

Line 80 and Line 81 only describe the loop that follows. Delete this comment. The cache-key comment below explains a reporter contract and should remain.

As per coding guidelines, comments must not merely restate code or narrate function bodies.

🤖 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/create_virtual_store/partition.rs` around lines
80 - 81, Remove the loop-narration comment immediately before the second-pass
survivor loop in the partitioning logic, while preserving the cache-key contract
comment that follows it.

Source: Coding guidelines

🤖 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/install_package_by_snapshot.rs`:
- Line 292: Update the rustdoc for the run method returning InstalledPackage to
describe the InstalledPackage result, including its source_is_mutable metadata,
instead of documenting a raw CAS file map. Revise the linker-specific
descriptions to match the current return contract while preserving the existing
behavior details.
- Line 669: Update the hoisted install flow in create_virtual_store.rs to retain
source_is_mutable alongside cas_paths in cas_paths_by_pkg_id. In
link_hoisted_modules(), use that flag for directory resolutions and call
import_indexed_dir() with force enabled and keep_modules_dir enabled so file:
packages are rebuilt rather than reusing the prior install’s copy.

---

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/create_virtual_store/partition.rs`:
- Around line 80-81: Remove the loop-narration comment immediately before the
second-pass survivor loop in the partitioning logic, while preserving the
cache-key contract comment that follows it.
🪄 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: 0e099e2e-fcde-47da-a9df-a5dd3319cf96

📥 Commits

Reviewing files that changed from the base of the PR and between d17121a and bdd956f.

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

The hoisted linker imports straight into the flat `node_modules/`
rather than into a virtual-store slot, so it needs its own guard that a
`file:` dependency's copy is retaken when the source moves. Verified to
fail without the repeat-install gate carve-out.

Also corrects `InstallPackageBySnapshot::run`'s return contract, which
still described a bare CAS map.

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

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.

@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 2420d85

@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: 2420d85fa307

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.756 ± 0.196 2.472 2.957 1.81 ± 0.20
pacquet@main 2.689 ± 0.225 2.395 3.065 1.76 ± 0.21
pnpr@HEAD 1.528 ± 0.161 1.368 1.806 1.00 ± 0.14
pnpr@main 1.525 ± 0.132 1.360 1.767 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7559751566999995,
      "stddev": 0.19633731164921187,
      "median": 2.8649785719,
      "user": 2.19357276,
      "system": 1.7716785800000003,
      "min": 2.4723309904,
      "max": 2.9569778834,
      "times": [
        2.8392758734,
        2.9006201944,
        2.5311456974,
        2.9569778834,
        2.6170074164,
        2.9363652134,
        2.8987298254,
        2.5166172024,
        2.8906812704,
        2.4723309904
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6889365047,
      "stddev": 0.22533571361367666,
      "median": 2.6252055159000003,
      "user": 2.1790255600000004,
      "system": 1.76703908,
      "min": 2.3950862304,
      "max": 3.0653842384,
      "times": [
        2.7825341064,
        2.9405453834,
        2.6330461654,
        2.5499900114,
        3.0653842384,
        2.6173648664,
        2.5517030894,
        2.9115680314,
        2.3950862304,
        2.4421429244
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5279711293999998,
      "stddev": 0.16132970709760908,
      "median": 1.4773799213999999,
      "user": 1.1448684599999996,
      "system": 1.19381738,
      "min": 1.3681786674,
      "max": 1.8062206144,
      "times": [
        1.8062206144,
        1.3821152684,
        1.3681786674,
        1.6471282783999999,
        1.3898521614,
        1.7060100234,
        1.4748346574,
        1.3722862004,
        1.6531602374,
        1.4799251854
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5252425966,
      "stddev": 0.13168772735780035,
      "median": 1.5376672948999999,
      "user": 1.1689528599999999,
      "system": 1.23243248,
      "min": 1.3596301444,
      "max": 1.7673302554,
      "times": [
        1.4860260344,
        1.5532448604,
        1.7673302554,
        1.5916739544,
        1.3822958004,
        1.6365433174000001,
        1.5220897294,
        1.5903302304,
        1.3596301444,
        1.3632616394000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 322.7 ± 56.6 271.2 423.7 1.11 ± 0.21
pacquet@main 442.0 ± 190.6 272.5 863.7 1.51 ± 0.66
pnpr@HEAD 298.7 ± 20.0 278.7 343.2 1.02 ± 0.09
pnpr@main 291.8 ± 17.9 262.6 320.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.32268490848,
      "stddev": 0.056629216708196366,
      "median": 0.30512055567999996,
      "user": 0.27174807999999995,
      "system": 0.59281442,
      "min": 0.27118611968,
      "max": 0.42373058468,
      "times": [
        0.29881765868,
        0.42373058468,
        0.42226605368000003,
        0.33872800468,
        0.31142345268,
        0.27999547668,
        0.28536684268,
        0.27118611968,
        0.27946805268,
        0.31586683868
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.44204864788,
      "stddev": 0.190556359408575,
      "median": 0.39145990468,
      "user": 0.36746488,
      "system": 0.7198073199999999,
      "min": 0.27250220068000003,
      "max": 0.86374730968,
      "times": [
        0.28484252468,
        0.29154086068,
        0.27250220068000003,
        0.37197552968,
        0.42286122468000004,
        0.41094427968,
        0.32607040368,
        0.51532933768,
        0.86374730968,
        0.66067280768
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29874372298,
      "stddev": 0.02002424244835711,
      "median": 0.29340470418,
      "user": 0.24988547999999997,
      "system": 0.5483649199999998,
      "min": 0.27867062868000003,
      "max": 0.34323062168,
      "times": [
        0.29955835568,
        0.32062178168,
        0.28001187668,
        0.34323062168,
        0.28857112268,
        0.30497844168,
        0.29142256668,
        0.29538684168,
        0.27867062868000003,
        0.28498499268
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29182862608,
      "stddev": 0.0178942770141207,
      "median": 0.28617575868,
      "user": 0.23700997999999998,
      "system": 0.5691888199999998,
      "min": 0.26255575968,
      "max": 0.32045965668,
      "times": [
        0.30919444068,
        0.31549670068,
        0.32045965668,
        0.28507282368000003,
        0.28706199468,
        0.27888211168,
        0.28391971968,
        0.29035353068,
        0.28528952268,
        0.26255575968
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.726 ± 0.071 2.649 2.887 1.56 ± 0.12
pacquet@main 3.056 ± 0.192 2.805 3.426 1.75 ± 0.17
pnpr@HEAD 1.749 ± 0.129 1.566 1.915 1.00
pnpr@main 1.807 ± 0.134 1.606 2.017 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7257002666599996,
      "stddev": 0.07106612859198326,
      "median": 2.70528184256,
      "user": 1.8295808999999998,
      "system": 1.5016443799999997,
      "min": 2.64893869706,
      "max": 2.88690069506,
      "times": [
        2.66743440806,
        2.72730564206,
        2.68160610906,
        2.68059070406,
        2.64893869706,
        2.68325804306,
        2.73965696906,
        2.77962415406,
        2.76168724506,
        2.88690069506
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.05591200276,
      "stddev": 0.1923838247446465,
      "median": 3.0105202050599997,
      "user": 2.4933509000000003,
      "system": 2.1217961799999996,
      "min": 2.80526569906,
      "max": 3.4260286830599997,
      "times": [
        2.95831075306,
        2.80526569906,
        2.83630764606,
        2.9705443040599997,
        3.15424025706,
        3.0504961060599998,
        3.26519316006,
        2.96099818306,
        3.13173523606,
        3.4260286830599997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7492241269600002,
      "stddev": 0.12861883484866615,
      "median": 1.76117623206,
      "user": 1.6584949000000002,
      "system": 1.80696098,
      "min": 1.56552109906,
      "max": 1.91530744406,
      "times": [
        1.8744104960599999,
        1.7541420690599998,
        1.56552109906,
        1.89010007706,
        1.62937215506,
        1.76821039506,
        1.57475583106,
        1.91530744406,
        1.81768845106,
        1.7027332520599998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.80693084836,
      "stddev": 0.1342030415135326,
      "median": 1.80872637656,
      "user": 1.5620068999999996,
      "system": 1.6178863799999998,
      "min": 1.60577684806,
      "max": 2.0172598270599997,
      "times": [
        1.60577684806,
        1.9009368600599998,
        1.80841292106,
        1.88929249906,
        1.9334567860599998,
        1.77715001806,
        1.8090398320599999,
        1.6192330740599998,
        2.0172598270599997,
        1.7087498180599998
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 745.8 ± 117.8 604.0 928.9 1.89 ± 0.31
pacquet@main 609.9 ± 63.1 532.8 688.0 1.55 ± 0.17
pnpr@HEAD 394.1 ± 17.1 377.4 436.1 1.00
pnpr@main 416.3 ± 47.8 344.3 487.9 1.06 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7457948900000001,
      "stddev": 0.11776178145988614,
      "median": 0.7109085242,
      "user": 1.0556451999999998,
      "system": 1.01189548,
      "min": 0.6040450797,
      "max": 0.9289433087000001,
      "times": [
        0.9289433087000001,
        0.6040450797,
        0.7123767177,
        0.6999067857,
        0.6495949287,
        0.8870386817,
        0.8821775777,
        0.7730937217,
        0.6113317677,
        0.7094403307
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6099498139999999,
      "stddev": 0.06309680580597242,
      "median": 0.5976489017,
      "user": 0.8766128999999999,
      "system": 0.9006437799999999,
      "min": 0.5328406727,
      "max": 0.6880243437,
      "times": [
        0.5482422897,
        0.5687351077,
        0.5519033337,
        0.6265626957,
        0.6853196147,
        0.6880243437,
        0.6665039587,
        0.6690349107,
        0.5623312127,
        0.5328406727
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3941090911,
      "stddev": 0.01711602261074671,
      "median": 0.3896505742,
      "user": 0.29830439999999997,
      "system": 0.67206918,
      "min": 0.3774225697,
      "max": 0.4361338727,
      "times": [
        0.3990756737,
        0.3941780607,
        0.4361338727,
        0.3835989537,
        0.3774225697,
        0.4041931927,
        0.3851230877,
        0.3962448877,
        0.3812915937,
        0.3838290187
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.416271781,
      "stddev": 0.04778036963556326,
      "median": 0.4151841027,
      "user": 0.3238929,
      "system": 0.67674958,
      "min": 0.3442790037,
      "max": 0.4878737857,
      "times": [
        0.43213166470000003,
        0.4029001237,
        0.4005742077,
        0.3894531007,
        0.4356624597,
        0.4878737857,
        0.4855739707,
        0.4274680817,
        0.3442790037,
        0.3568014117
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.926 ± 0.083 1.806 2.051 4.97 ± 0.34
pacquet@main 1.996 ± 0.113 1.894 2.252 5.15 ± 0.40
pnpr@HEAD 0.388 ± 0.021 0.340 0.410 1.00
pnpr@main 0.402 ± 0.018 0.369 0.431 1.04 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.925931524,
      "stddev": 0.08297881529116775,
      "median": 1.91187355,
      "user": 1.04408024,
      "system": 0.9569534200000002,
      "min": 1.8060466560000001,
      "max": 2.051299008,
      "times": [
        2.018794927,
        1.964282123,
        2.051299008,
        2.013381291,
        1.895991533,
        1.84817917,
        1.856839758,
        1.8060466560000001,
        1.927755567,
        1.8767452070000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.9964899839,
      "stddev": 0.11318769619289909,
      "median": 1.963119495,
      "user": 1.2171953399999997,
      "system": 1.01250362,
      "min": 1.894376077,
      "max": 2.2521943120000003,
      "times": [
        1.894913449,
        1.948793641,
        1.894376077,
        1.92980341,
        1.9774453490000001,
        1.9174048339999998,
        1.984322315,
        2.102561975,
        2.2521943120000003,
        2.0630844770000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38769732000000007,
      "stddev": 0.02073043036572916,
      "median": 0.3933006845,
      "user": 0.28395364,
      "system": 0.65760432,
      "min": 0.34044476700000004,
      "max": 0.40982776400000004,
      "times": [
        0.394529531,
        0.392071838,
        0.391233697,
        0.399295758,
        0.39669218900000003,
        0.375170805,
        0.40745257500000004,
        0.370254276,
        0.34044476700000004,
        0.40982776400000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.4024408255,
      "stddev": 0.017642716586654096,
      "median": 0.39862946600000004,
      "user": 0.30563783999999994,
      "system": 0.66044932,
      "min": 0.36899665600000003,
      "max": 0.430832422,
      "times": [
        0.39965921200000004,
        0.39855276700000003,
        0.398679585,
        0.419016025,
        0.422366832,
        0.39214075800000003,
        0.36899665600000003,
        0.430832422,
        0.39857934700000003,
        0.395584651
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 419.8 ± 94.1 296.4 550.2 4.04 ± 0.98
pacquet@main 369.5 ± 72.9 304.0 558.4 3.56 ± 0.77
pnpr@HEAD 106.9 ± 9.2 94.7 130.5 1.03 ± 0.13
pnpr@main 103.8 ± 9.5 93.4 126.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.41978077368,
      "stddev": 0.09414342152981887,
      "median": 0.42906712968,
      "user": 0.38213162,
      "system": 0.14885140000000002,
      "min": 0.29638972118,
      "max": 0.55019222018,
      "times": [
        0.29638972118,
        0.30687726418,
        0.34727395218,
        0.40611947218,
        0.33972800718,
        0.47417444418,
        0.54198419418,
        0.48305367418,
        0.55019222018,
        0.45201478718
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.36951423818,
      "stddev": 0.07288311668802797,
      "median": 0.34793492368,
      "user": 0.33612352,
      "system": 0.13356819999999997,
      "min": 0.30402902317999997,
      "max": 0.55837612818,
      "times": [
        0.38647703118,
        0.55837612818,
        0.31930686518,
        0.39265122118,
        0.35212242318,
        0.33778161618,
        0.34374742418,
        0.30402902317999997,
        0.32035214718,
        0.38029850218
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10688190970173914,
      "stddev": 0.009215362744567199,
      "median": 0.10357991218000001,
      "user": 0.02811474608695651,
      "system": 0.018149347826086955,
      "min": 0.09465872218,
      "max": 0.13051357018,
      "times": [
        0.11942305018,
        0.10357991218000001,
        0.10608777018000001,
        0.10444118518,
        0.10129635718,
        0.12638384418,
        0.10305854918,
        0.09765903018000001,
        0.10324953918,
        0.09933992818000001,
        0.10008999318,
        0.09986654118,
        0.10615676018,
        0.10272796518,
        0.09465872218,
        0.10165060418,
        0.10138413218,
        0.10715671418,
        0.10541412018,
        0.11683012218000001,
        0.11816621118000001,
        0.13051357018,
        0.10914930118
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10383634134000001,
      "stddev": 0.00948712241451233,
      "median": 0.09984713518,
      "user": 0.03131215999999999,
      "system": 0.01251892,
      "min": 0.09344435318000001,
      "max": 0.12671348518,
      "times": [
        0.11025869218,
        0.10667328418000001,
        0.12671348518,
        0.10855057218000001,
        0.09956450118,
        0.09832079718,
        0.10252531418000001,
        0.09585007918,
        0.09455458718000001,
        0.09702774918000001,
        0.09609601218000001,
        0.09674922418000001,
        0.09688181418000001,
        0.11085323518000001,
        0.11482724618000001,
        0.10237657318000001,
        0.09858424318,
        0.12090927218000001,
        0.12368832118,
        0.10030218218,
        0.09785492918000001,
        0.09488424918,
        0.09984713518,
        0.10857068118,
        0.09344435318000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.189 ± 0.466 0.782 2.321 1.00 ± 0.46
pacquet@main 1.189 ± 0.276 0.778 1.606 1.00
pnpm@HEAD 4.457 ± 0.268 4.082 4.906 3.75 ± 0.90
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1890435457155557,
      "stddev": 0.4656695603885629,
      "median": 1.10346749416,
      "user": 1.1049339022222222,
      "system": 0.16693735555555553,
      "min": 0.78187738216,
      "max": 2.32102359316,
      "times": [
        0.78187738216,
        2.32102359316,
        0.93723116416,
        1.14026670416,
        1.10346749416,
        1.40784392916,
        1.14019081016,
        0.80261893816,
        1.06687189616
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.1888866619377778,
      "stddev": 0.27550873473550086,
      "median": 1.2392970541600001,
      "user": 1.1469566799999997,
      "system": 0.19689313333333333,
      "min": 0.77775739416,
      "max": 1.6055936731600002,
      "times": [
        1.6055936731600002,
        1.4624863111600002,
        1.2392970541600001,
        0.98728392216,
        1.39259992916,
        0.77775739416,
        0.9157881451600001,
        1.27943665316,
        1.03973687516
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.457262886382223,
      "stddev": 0.2680369598450006,
      "median": 4.54653992116,
      "user": 6.885893013333334,
      "system": 0.3435811333333333,
      "min": 4.0820182781600005,
      "max": 4.906027408160001,
      "times": [
        4.54653992116,
        4.0820182781600005,
        4.272982569160001,
        4.671791793160001,
        4.6191737471600005,
        4.16585667316,
        4.30009224816,
        4.906027408160001,
        4.55088333916
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.869 ± 0.219 4.632 5.331 1.34 ± 0.07
pacquet@main 4.760 ± 0.146 4.606 5.037 1.31 ± 0.06
pnpr@HEAD 3.623 ± 0.113 3.514 3.846 1.00
pnpr@main 3.658 ± 0.079 3.545 3.780 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.8687511819800005,
      "stddev": 0.2185948366123539,
      "median": 4.77123362378,
      "user": 2.8569922599999997,
      "system": 2.0580833199999997,
      "min": 4.63218078078,
      "max": 5.33074944178,
      "times": [
        4.75997936878,
        5.10450193778,
        4.71771386878,
        4.92921325778,
        4.63218078078,
        4.78248787878,
        4.68973749878,
        4.75369520078,
        5.33074944178,
        4.98725258578
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.7604138997800005,
      "stddev": 0.14647656178020263,
      "median": 4.72203641628,
      "user": 2.68090706,
      "system": 1.90494722,
      "min": 4.60575466178,
      "max": 5.03686494778,
      "times": [
        4.97570329878,
        4.70129029378,
        4.60575466178,
        4.66063690278,
        4.8379296707799995,
        4.74278253878,
        4.628705399779999,
        5.03686494778,
        4.66462890278,
        4.74984238078
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6227619783800002,
      "stddev": 0.11285499903389314,
      "median": 3.5741603802799995,
      "user": 1.47948316,
      "system": 1.4247926200000003,
      "min": 3.51382456778,
      "max": 3.84610915578,
      "times": [
        3.58781110678,
        3.74069248978,
        3.70784431578,
        3.67047491778,
        3.52087097578,
        3.84610915578,
        3.51382456778,
        3.5300396457799996,
        3.54944295478,
        3.5605096537799996
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.6576971710799997,
      "stddev": 0.07906734114162674,
      "median": 3.6466138897800002,
      "user": 1.7709819599999999,
      "system": 1.6838358199999999,
      "min": 3.54522725478,
      "max": 3.77958366878,
      "times": [
        3.7373123757799998,
        3.5904237637799996,
        3.65511697678,
        3.63423505978,
        3.5601668967799998,
        3.54522725478,
        3.63811080278,
        3.77958366878,
        3.7123662887799997,
        3.7244286227799996
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13649
Testbedpacquet

🚨 2 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-install.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
604.05 ms
(+39.44%)Baseline: 433.20 ms
519.84 ms
(116.20%)

isolated-linker.fresh-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
296.39 ms
(+50.41%)Baseline: 197.05 ms
236.46 ms
(125.35%)

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,648.94 ms
(+0.01%)Baseline: 2,648.77 ms
3,178.52 ms
(83.34%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,806.05 ms
(+0.88%)Baseline: 1,790.21 ms
2,148.26 ms
(84.07%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
604.05 ms
(+39.44%)Baseline: 433.20 ms
519.84 ms
(116.20%)

isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
296.39 ms
(+50.41%)Baseline: 197.05 ms
236.46 ms
(125.35%)

isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,472.33 ms
(+3.11%)Baseline: 2,397.87 ms
2,877.44 ms
(85.92%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,632.18 ms
(+3.78%)Baseline: 4,463.63 ms
5,356.36 ms
(86.48%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
271.19 ms
(-0.06%)Baseline: 271.34 ms
325.61 ms
(83.29%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
781.88 ms
(+10.95%)Baseline: 704.68 ms
845.62 ms
(92.46%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit a540b24 into main Aug 4, 2026
38 of 39 checks passed
@zkochan
zkochan deleted the split-create-virtual-store branch August 4, 2026 23:08
KSXGitHub pushed a commit that referenced this pull request Aug 6, 2026
Picks up sixteen commits, most of them module splits: the optimistic
repeat-install check (#13661), the frozen install and its build
phase (#13659, #13662), `create_virtual_store`
(#13649), the tarball crate root (#13652), and the
audit command (#13657). Also the move to the `rc` lane and
pacquet 12.0.0-rc.0 (#13666, #13667).

#13661 split `optimistic_repeat_install.rs` into per-concern
modules, moving one of this branch's two `build_workspace_state::<Host>`
call sites into the new `deps_status.rs`. The turbofish is re-applied at
both of its new homes.

# Conflicts:
#	pnpm/crates/package-manager/src/optimistic_repeat_install.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants