Skip to content

refactor(package-manager): decompose install modules - #13640

Merged
zkochan merged 13 commits into
mainfrom
refactor-package-manager-modules
Aug 4, 2026
Merged

zkochan merged 13 commits into
mainfrom
refactor-package-manager-modules

Conversation

@zkochan

@zkochan zkochan commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Decompose pacquet's 4,583-line package-manager install.rs into focused internal modules for the install coordinator, lockfile freshness, modules state, lifecycle execution, and workspace state. The public install module is now about 800 lines, and no new crate or duplicate implementation is introduced. Split the install coordinator’s former roughly 1,900-line run_inner into typed phases; run_inner is now about 900 lines. Move the regular install phases into prepare_modules_state.rs, materialize.rs, and apply_materialization.rs, matching the phase-per-module structure of install_with_fresh_lockfile/. Decompose post-materialization work by ownership into resolve-only completion, materialized-state selection, project linking, modules-state commit, project lifecycle execution, workspace-state update, and final reporting.

Move patch_commit.rs unchanged into the existing pacquet-patching crate, where package filtering and diff generation belong. Keep patch.rs in package-manager because it coordinates lockfile selection, fetching, and package materialization.

Most changes are internal Rust refactors. Review-driven fixes also prevent both the TypeScript and Rust installers from purging project files when modulesDir resolves to the project root, and ensure the Rust installer writes blocked-build approval scaffolding to the discovered workspace manifest when per-project lockfiles are enabled.

Squash Commit Body

Split package-manager's install implementation into focused internal modules for orchestration, lockfile freshness, modules state, lifecycle execution, and workspace state. Decompose the install coordinator into typed phases, including ownership-specific post-materialization steps for state selection, project linking, modules-state commit, project lifecycle execution, workspace-state update, and reporting. This reduces the reading cost of the former 4,583-line install.rs and roughly 1,900-line run_inner while preserving its public API and behavior.

Move patch-commit's package filtering and diff generation into the existing pacquet-patching crate. Keep patch extraction in package-manager because it depends on install-engine fetching and materialization concerns.

Prevent unsafe modules cleanup from purging the project root in both installers. Write blocked-build approval scaffolding to the discovered workspace manifest when the Rust installer uses per-project lockfiles.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added or updated tests.

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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Added safer patch comparison and commit support with package-file filtering and normalized folder diffs.
    • Improved workspace installation, lifecycle script execution, and install-state tracking.
    • Added faster up-to-date checks and optimized repeat installs.
    • Improved dry-run, frozen-lockfile, filtered, and hoisted installation workflows.
  • Bug Fixes

    • Strengthened lockfile freshness, configuration, module-layout, and build-policy validation.
    • Improved recovery for inconsistent or partial installations and clarified diagnostics.
  • Tests

    • Expanded coverage for filesystem safety, path validation, temporary files, symlinks, and patch-diff behavior.

Copilot AI lite review requested due to automatic review settings August 4, 2026 11:51

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

The PR extracts the Rust install pipeline into dedicated modules for workspace state, lockfile freshness, module integrity, materialization phases, and execution orchestration. It adds package-tree filtering and normalized Git diffs to the patching crate with structured errors and filesystem validation.

Changes

Install pipeline modularization

Layer / File(s) Summary
Install module wiring
pnpm/crates/package-manager/src/install.rs
The entry module removes unused imports, declares extracted module names, and retains public dispatch methods.
Workspace state and discovery
pnpm/crates/package-manager/src/install/workspace_state.rs
Workspace-state helpers discover projects, detect stale installs, validate importers, assemble manifest lists, match directories, select lifecycle scripts, and construct workspace-state records.
Lockfile freshness validation
pnpm/crates/package-manager/src/install/lockfile_freshness.rs
Freshness validation orchestrates importer-lockfile updates, parses catalog overrides, validates settings-drift changes, checks manifest satisfaction, and converts errors to install-error types.
Module state and integrity
pnpm/crates/package-manager/src/install/modules_state.rs
Module-state helpers validate module-settings consistency, probe frozen-tree integrity, detect build-marker recovery, assess build-policy changes, assemble metadata, and manage partial-install metadata.
Module state preparation
pnpm/crates/package-manager/src/install/prepare_modules_state.rs
Module-state preparation reads .modules.yaml, detects layout inconsistency, prunes excluded links, assesses cache expiry, and performs optimistic frozen-install early-return with freshness and integrity validation.
Materialization orchestration
pnpm/crates/package-manager/src/install/materialize.rs
Materialization orchestrates frozen and fresh installation paths: verifies lockfiles, configures snapshot reuse, runs installers, records metadata, and returns unified output.
Materialization completion and state persistence
pnpm/crates/package-manager/src/install/apply_materialization.rs
Materialization completion handles resolve-only and dry-run cases, links projects, persists modules state, executes lifecycle scripts, and reports install status.
Install execution pipeline
pnpm/crates/package-manager/src/install/run.rs
Install::run_inner validates configuration, resolves workspace and catalogs, gates fast-path optimization, loads lockfiles, runs devPreinstall, and dispatches frozen or fresh resolution, chaining module preparation, materialization, and completion.
Lifecycle script execution
pnpm/crates/package-manager/src/install/lifecycle.rs
Lifecycle helpers discover workspace projects, order them by dependency groups, build execution environments, run root devPreinstall, and execute workspace scripts sequentially or in bounded parallel groups.

Patch commit diff support

Layer / File(s) Summary
Patch commit module wiring
pnpm/crates/patching/Cargo.toml, pnpm/crates/patching/src/lib.rs, pnpm/crates/package-manager/src/lib.rs
The patching crate declares Git and package-manifest dependencies. The commit module and its public exports are wired at the crate root. The package-manager re-exports specific patching types explicitly.
Package-tree filtering and Git diffs
pnpm/crates/patching/src/commit.rs
Package-tree preparation reads manifests, filters files by packlist, recreates temporary directories, and hard-links selected files. Git diffing captures normalized output with size limits, prefix stripping, and .DS_Store removal.
Patch commit filesystem validation
pnpm/crates/patching/src/commit/tests.rs
Tests validate diff normalization, package-file filtering, directory traversal protection, temporary-directory cleanup, symlink safety, and injected error conditions through test doubles.

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

Possibly related issues

  • pnpm/pacquet#464 — Module-state changes add .modules.yaml consistency and frozen-install integrity validation.

Possibly related PRs

  • pnpm/pnpm#13081 — Adds lockfile freshness logic extracted into install/lockfile_freshness.rs.
  • pnpm/pnpm#13170 — Adds build-marker recovery logic extracted into module-state modules.
  • pnpm/pnpm#13171 — Adds workspace lifecycle ordering and execution logic extracted into install/lifecycle.rs.

Suggested labels: product: pacquet

Suggested reviewers: copilot, qodo-code-review

✨ 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 refactor-package-manager-modules

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 package-manager: split install.rs into focused internal modules

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Split Rust installer orchestration into internal submodules while preserving public API/behavior.
• Extract lockfile freshness, workspace state, modules state, and lifecycle helpers into dedicated
 files.
• Move patch-commit diff/filter implementation into pacquet-patching and re-export from
 package-manager.
Diagram

graph TD
A["package-manager: install.rs (public API)"] --> B["install/run.rs (coordinator)"]
B --> C["install/lockfile_freshness.rs"]
B --> D["install/modules_state.rs"]
B --> E["install/workspace_state.rs"]
B --> F["install/lifecycle.rs"]
G["pacquet-patching: commit.rs"] --> H{{"git diff"}}
A --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Split install helpers into separate crates
  • ➕ Stricter boundaries and faster incremental compilation for isolated concerns
  • ➕ Clearer public/private APIs between subsystems
  • ➖ Higher maintenance and dependency graph complexity for purely-internal code
  • ➖ More churn across crates for tightly-coupled orchestration logic
2. Keep install.rs monolithic but extract private submodules inline (mod blocks)
  • ➕ No new files; minimal module plumbing
  • ➕ Easy single-file search/reading for some reviewers
  • ➖ Still leaves a very large file with high cognitive load
  • ➖ Harder to enforce separation and targeted ownership over time

Recommendation: Current approach (internal submodules under install/ with a small install.rs facade) is the best tradeoff: it reduces reading cost and improves local reasoning without introducing new crates or changing the public API. A multi-crate split could be revisited only if compile-time or ownership boundaries become a concrete problem.

Files changed (13) +3923 / -3808 · 2 not counted

Refactor (9) +3913 / -3805
install.rsTurn install.rs into a facade over internal install modules +42/-3803

Turn install.rs into a facade over internal install modules

• Introduces install/* internal modules (run, lifecycle, lockfile_freshness, modules_state, workspace_state) and re-exports/selectively imports helpers. Removes the large embedded orchestration implementation from this file and keeps the public entrypoints thin.

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

lifecycle.rsExtract workspace lifecycle ordering and script execution helpers +314/-0

Extract workspace lifecycle ordering and script execution helpers

• Adds helpers for loading workspace projects, ordering lifecycle groups (explicit/lockfile-derived/fallback), and running dev preinstall + per-project lifecycle scripts. Keeps rayon-based parallelism localized to lifecycle concerns.

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

lockfile_freshness.rsExtract lockfile freshness and settings drift checks +356/-0

Extract lockfile freshness and settings drift checks

• Moves lockfile freshness gates (overrides parsing, settings drift, importer satisfaction) into a focused module and introduces options structs used by the coordinator. Retains the fast-update importer lockfile path and shared error mapping.

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

modules_state.rsExtract .modules.yaml consistency and integrity checks +698/-0

Extract .modules.yaml consistency and integrity checks

• Centralizes checks for whether existing node_modules/.modules.yaml state matches current config and whether frozen-tree shortcuts are safe (including PnP and global-virtual-store nuances). Contains helpers for merging and validating recorded module metadata and build markers.

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

run.rsMove Install::run_inner orchestration into install/run.rs +1914/-0

Move Install::run_inner orchestration into install/run.rs

• Creates a dedicated coordinator module containing the main install dispatch logic previously in install.rs. Centralizes the flow that wires workspace discovery, lockfile freshness checks, modules state validation, and lifecycle execution.

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

workspace_state.rsExtract workspace discovery and up-to-date fast path helpers +582/-0

Extract workspace discovery and up-to-date fast path helpers

• Defines UpToDateFastPathCheck/UpToDateWorkspace and implements a synchronous pre-runtime fast path that mirrors the install pipeline’s workspace discovery and repeat-install checks. Also houses shared workspace-state building utilities used by the coordinator.

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

lib.rsRe-export patch-commit API from pacquet-patching +3/-2

Re-export patch-commit API from pacquet-patching

• Removes the local patch_commit module wiring and instead re-exports PatchCommitError, PkgFilesForDiff, diff_folders, and prepare_pkg_files_for_diff from pacquet_patching. Keeps patch coordination in package-manager while relocating diff/filter implementation.

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

commit.rsIntroduce patch-commit filtering and diff generation module not counted

Introduce patch-commit filtering and diff generation module

• Implements (moved) patch-commit functionality: compute filtered package file sets, create safe temporary directories, and generate normalized git diffs for patch commits. Provides dedicated errors and utilities to keep patch-commit concerns within pacquet-patching.

pnpm/crates/patching/src/commit.rs

lib.rsAdd commit module and export patch-commit helpers +4/-0

Add commit module and export patch-commit helpers

• Registers the new commit submodule and re-exports its public API; updates crate-level docs to include patch-commit diff preparation and folder diffing responsibilities.

pnpm/crates/patching/src/lib.rs

Tests (2) +3 / -3
tests.rsFix test imports after install module split +3/-3

Fix test imports after install module split

• Updates unit tests to import helpers from their new module locations (e.g., exclude_linked_dependencies via lockfile_freshness). No behavioral test logic changes intended.

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

tests.rsAdd/retain tests for patch-commit diff normalization and filtering not counted

Add/retain tests for patch-commit diff normalization and filtering

• Covers diff output normalization (no absolute temp paths), DS_Store filtering, dash-prefixed paths, temp file permissions (unix), and honoring package.json files lists during filtering.

pnpm/crates/patching/src/commit/tests.rs

Other (2) +7 / -0
Cargo.lockUpdate lockfile for new pacquet-patching dependencies +3/-0

Update lockfile for new pacquet-patching dependencies

• Adds pacquet-git-fetcher, pacquet-package-manifest, and serde_json as dependencies of the patching crate in the workspace lockfile.

Cargo.lock

Cargo.tomlAdd dependencies needed for patch-commit diff/filter implementation +4/-0

Add dependencies needed for patch-commit diff/filter implementation

• Adds pacquet-git-fetcher and pacquet-package-manifest plus serde_json to support packlist-based filtering and manifest reads for patch-commit workflows.

pnpm/crates/patching/Cargo.toml

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. False purge signal 🐞 Bug ☼ Reliability ⭐ New
Description
purgeModulesDirsOfImporters() now early-returns when no safe purge targets are found, but
validateModules() still returns purged: true based solely on importersToPurge.length. This can
suppress breaking-change errors (by taking the “forced repair” path) without actually cleaning the
modules directory, so the install may proceed with stale/incompatible .modules.yaml and contents.
Code

pnpm11/installing/deps-installer/src/install/validateModules.ts[R159-161]

+  const safeImporters = (await Promise.all(importers.map(resolveSafePurgeTarget)))
+    .filter((importer): importer is SafeImporterToPurge => importer != null)
+  if (safeImporters.length === 0) return
Relevance

●●● Strong

Team has accepted prior fixes ensuring purge/repair signals reflect real state and handle
inconsistent .modules.yaml safely.

PR-#12536

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
validateModules() sets purged from the presence of purge candidates and returns purged: true
on forced-repair branches, but the newly added safe-target resolution can make the purge a no-op
(early return) when the modules directory resolves to an unsafe target (e.g., project root or a
symlink target). The install coordinator uses purged to refresh context and then continues without
re-validating, so a false-positive purged can let installs proceed without actually repairing the
modules state.

pnpm11/installing/deps-installer/src/install/validateModules.ts[61-65]
pnpm11/installing/deps-installer/src/install/validateModules.ts[134-140]
pnpm11/installing/deps-installer/src/install/validateModules.ts[152-167]
pnpm11/installing/deps-installer/src/install/validateModules.ts[159-161]
pnpm11/installing/deps-installer/src/install/validateModules.ts[203-217]
pnpm11/installing/deps-installer/src/install/index.ts[357-379]
pnpm11/installing/deps-installer/test/breakingChanges.ts[41-85]

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

## Issue description
`validateModules()` reports `purged: true` whenever it *attempts* a purge (or has purge candidates), but the new safe-target filter can cause the purge to be skipped entirely (`safeImporters.length === 0`). This produces a false-positive “purged” result and can allow the “forceNewModules” recovery path to continue without actually repairing the modules directory.

## Issue Context
The new safety logic intentionally prevents purging dangerous targets (project root, symlink targets, non-subdirectories). However, callers (notably `install/index.ts`) treat `purged` as a signal that the modules state was actually recreated and refresh context accordingly.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/validateModules.ts[134-140]
- pnpm11/installing/deps-installer/src/install/validateModules.ts[152-162]
- pnpm11/installing/deps-installer/src/install/validateModules.ts[203-217]

## Suggested fix
1. Change `purgeModulesDirsOfImporters()` (and `purgeModulesDirsOfImporter()`) to return a boolean like `didPurge` (or a small enum distinguishing `purged` vs `skipped_unsafe`).
2. Compute/return `purged` from the *actual* purge result (e.g., `didPurge`), not from `importersToPurge.length`.
3. For the “forced repair” short-circuit branches (e.g., virtual store dir max length mismatch), if purging is skipped because the target is unsafe, throw a dedicated `PnpmError` explaining that pnpm refused to purge an unsafe `modulesDir` and the user must fix config and/or remove it manually.

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


2. Symlink purge bypass ✓ Resolved 🐞 Bug ⛨ Security
Description
The new purge guard in purgeModulesDirsOfImporters() only checks modulesDir with lexical
dirsAreEqual/isSubdir and never validates modulesDir via realpath/lstat, so a symlinked
modulesDir can still target the project root or another directory. removeContentsOfDir() will
then enumerate and rimraf() entries under the symlink target, causing unintended file deletion
during forced purge/repair.
Code

pnpm11/installing/deps-installer/src/install/validateModules.ts[R155-158]

+    const projectRootDir = importer.rootDirRealPath ?? importer.rootDir
+    return !dirsAreEqual(projectRootDir, importer.modulesDir) &&
+      isSubdir(projectRootDir, importer.modulesDir)
+  })
Relevance

●●● Strong

Team previously accepted realpath/symlink-safe containment guards to prevent unsafe node_modules
purges/deletes.

PR-#12536
PR-#12676

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new guard filters purge targets using only string-path checks, while the actual purge function
deletes directory contents based on fs.readdir() and rimraf() of the provided modulesDir,
which will follow a symlinked directory path and delete entries in the symlink target.

pnpm11/installing/deps-installer/src/install/validateModules.ts[154-159]
pnpm11/installing/deps-installer/src/install/validateModules.ts[185-215]

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 purge safety check only compares string paths (`dirsAreEqual` + `isSubdir`) and does not verify the *real* filesystem target of `modulesDir`. If `modulesDir` is a symlink (e.g. `node_modules -> .`), the guard may allow purging and `removeContentsOfDir()` will delete files from the symlink target.

## Issue Context
`removeContentsOfDir()` uses `fs.readdir(dir)` + `rimraf(path.join(dir, item))`, which will operate on the symlink target when `dir` itself is a symlink.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/validateModules.ts[147-199]
- pnpm11/installing/deps-installer/src/install/validateModules.ts[201-215]

## Suggested fix
- Resolve and validate both the project root and `modulesDir` using `fs.realpath()` (or equivalent) before deeming an importer safe to purge.
- Additionally, consider refusing to purge when `modulesDir` is a symlink (`lstat().isSymbolicLink()`), or ensure the `realpath(modulesDir)` is a strict descendant of `realpath(rootDir)` and not equal.
- If the importer is unsafe to purge, prefer throwing a clear error (instead of silently returning) when the install was relying on `--force`/repair semantics, so the system doesn’t proceed with known-incompatible state.

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


3. Workspace root purge possible ✓ Resolved 🐞 Bug ⛨ Security
Description
prepare_modules_state treats a modules directory as safe to purge when
canonical(modules_dir).starts_with(canonical(workspace_root)), which also returns true when the
paths are equal. A repo-controlled pnpm-workspace.yaml can set modulesDir: "." so that an
invalid/unreadable .modules.yaml triggers the inconsistent-path cleanup and deletes entries in the
workspace root via remove_dir_all/remove_file.
Code

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

+                (Ok(modules_canon), Ok(root_canon)) => {
+                    (modules_canon.starts_with(&root_canon), Some(modules_canon))
Relevance

●●● Strong

Destructive prune paths get hardened; containment/canonicalization safety fixes for deletion risks
are typically accepted.

PR-#12536
PR-#12587

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The purge target is accepted when modules_canon.starts_with(root_canon) (which includes equality),
and the subsequent cleanup iterates read_dir(target_dir) and deletes each non-exempt entry with
remove_dir_all/remove_file. Because modules_dir is sourced from repo-controlled
pnpm-workspace.yaml via resolve(base_dir, v), setting modulesDir: "." makes `modules_dir ==
workspace_root`, so the purge loop operates on the workspace root itself when the inconsistent-state
gate is entered.

pnpm/crates/package-manager/src/install/prepare_modules_state.rs[141-209]
pnpm/crates/config/src/workspace_yaml.rs[1098-1100]
pnpm/crates/config/src/workspace_yaml.rs[1361-1364]

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 inconsistent-modules repair path considers `modules_dir` safe to purge if `canonical(modules_dir).starts_with(canonical(workspace_root))`. Because `starts_with` is true for equality, a repo can configure `modulesDir: "."` (workspace root) and trigger deletion of workspace files when `.modules.yaml` is unreadable/invalid.

### Issue Context
`modulesDir` is set from `pnpm-workspace.yaml` and resolved as `base_dir.join(candidate)` without normalization, so `"."` becomes the workspace root.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[141-153]

### What to change
- Tighten the safety predicate to require a **strict descendant**:
 - e.g. `modules_canon != root_canon && modules_canon.starts_with(&root_canon)`.
- If the check fails (including equality), treat it as unsafe (same branch as outside-root), ideally returning an error (at least for filtered installs) and refusing to delete anything.

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



Remediation recommended

4. Missing Rust symlink purge test 📘 Rule violation ▣ Testability ⭐ New
Description
A new TypeScript regression test ensures forced repair does not purge through a modulesDir
symlink, but there is no equivalent Rust test covering the same scenario. This violates the
cross-stack requirement for mirrored tests and risks future pnpm/pacquet divergence or regression in
the purge safety guard.
Code

pnpm11/installing/deps-installer/test/breakingChanges.ts[R56-59]

+test('forced modules repair never follows a modules directory symlink', async () => {
+  prepareEmpty()
+  const projectRoot = process.cwd() as ProjectRootDir
+  const modulesDir = path.join(projectRoot, 'linked-modules')
Relevance

●●● Strong

Repo routinely mirrors behavior-contract changes with Rust+TS regression tests to prevent
divergence.

PR-#12677
PR-#13207

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR adds a new TypeScript test asserting that a symlinked modules directory must not be purged,
but the Rust-side purge guard test suite only covers strict-descendant lexical cases and does not
cover the symlink scenario. The compliance checklist requires mirrored tests for cross-stack
behavior contracts.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm11/installing/deps-installer/test/breakingChanges.ts[56-85]
pnpm/crates/package-manager/src/install/prepare_modules_state/tests.rs[5-16]

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

## Issue description
TypeScript now tests that forced modules repair does not follow a `modulesDir` symlink, but Rust lacks an equivalent test, violating the cross-stack mirrored-test requirement.

## Issue Context
The Rust purge guard relies on canonicalized paths; add a regression test that creates a symlinked `modules_dir` pointing at the workspace/project root and asserts the purge target is rejected.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/prepare_modules_state/tests.rs[1-30]

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


5. Historical linkDirectDeps comment ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new comment references pnpm v11 behavior (linkDirectDeps) rather than documenting the current
contract, which risks becoming stale and misleading. Comments should describe present
behavior/invariants, not historical implementations.
Code

pnpm/crates/package-manager/src/install/apply_materialization.rs[R210-213]

+    // of the lockfile importers, so the lockfile-driven symlink
+    // passes inside the frozen/fresh paths never see them; pnpm
+    // v11's `linkDirectDeps` linked them from the projects
+    // regardless. Aliases the wanted lockfile *does* track are
Relevance

●●● Strong

Repo enforces “no historical framing” in comments; similar rewrites have been accepted recently.

PR-#13138
PR-#13072

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comment explicitly calls out pnpm v11 behavior (v11's linkDirectDeps), which is historical
framing rather than describing the current code contract, violating the checklist rule against
historical implementation comments.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/package-manager/src/install/apply_materialization.rs[208-217]

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

## Issue description
A new comment references historical behavior (`pnpm v11` / `linkDirectDeps`) instead of describing the current behavior and why this path exists.

## Issue Context
Per compliance, comments must describe current behavior (inputs/outputs/invariants/rationale) and avoid historical framing (versioned/previous implementation references) that can become stale.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/apply_materialization.rs[208-217]

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


6. prefix typed as &String ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New install-phase input structs use &String for prefix, which is a needlessly specific borrowed
type and reduces API flexibility. Prefer &str for read-only string parameters to avoid unnecessary
coupling and caller constraints.
Code

pnpm/crates/package-manager/src/install/apply_materialization.rs[R16-19]

+    existing_wanted_lockfile: Option<&'a Lockfile>,
+    fresh_lockfile: Option<&'a Lockfile>,
+    prefix: &'a String,
+}
Relevance

●●● Strong

Team often relaxes overly-specific String ownership in APIs; &str is a straightforward flexibility
improvement.

PR-#13441

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed code introduces multiple signatures/inputs that store prefix as &String (read-only
usage), where &str would be the more general borrowed type per the checklist rule.

Rule 2254729: Prefer general borrowed parameter types (&str, &Path) over owned or specific types when no extra copies are required
pnpm/crates/package-manager/src/install/apply_materialization.rs[12-19]
pnpm/crates/package-manager/src/install/prepare_modules_state.rs[11-36]
pnpm/crates/package-manager/src/install/materialize.rs[54-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
Several new structs/functions accept `prefix` as `&String` even though they only need a borrowed string view.

## Issue Context
The compliance rule prefers general borrowed parameter types when ownership is not required. Using `&str` is more general than `&String` and avoids constraining callers.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/apply_materialization.rs[12-19]
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[11-36]
- pnpm/crates/package-manager/src/install/materialize.rs[54-56]

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


View more (2)
7. Wrong allowBuilds scaffold dir ✓ Resolved 🐞 Bug ≡ Correctness
Description
In install/run.rs, scaffold_allow_builds uses config.workspace_dir and otherwise falls back to
workspace_root, but workspace_root is set to the active project dir when
sharedWorkspaceLockfile=false. In an auto-discovered workspace (where workspace_dir_opt is
Some(...) but config.workspace_dir is None), this can scaffold pnpm-workspace.yaml in the
wrong location (project dir instead of workspace root), leading to incorrect guidance and
potentially failing this error-handling path.
Code

pnpm/crates/package-manager/src/install/run.rs[R2277-2279]

+        pacquet_workspace_manifest_writer::scaffold_allow_builds(
+            config.workspace_dir.as_deref().unwrap_or(&workspace_root),
+            allow_build_keys.iter().map(String::as_str),
Relevance

●●● Strong

Likely real workspace-path correctness bug; repo historically accepts similar install/workspace
edge-case fixes.

PR-#13424
PR-#13477
PR-#13161

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
workspace_root is deliberately set to the active project directory when
shared_workspace_lockfile is disabled, while the actual workspace root may still be discovered
separately as workspace_dir_opt. Since discovery does not set config.workspace_dir, the fallback
in the scaffolding call ignores the discovered workspace root and can point scaffolding at the
project directory instead.

pnpm/crates/package-manager/src/install/run.rs[143-157]
pnpm/crates/package-manager/src/install/run.rs[2272-2281]
pnpm/crates/package-manager/src/install/workspace_state.rs[438-446]

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

### Issue description
`scaffold_allow_builds` is called with `config.workspace_dir.as_deref().unwrap_or(&workspace_root)`. When `sharedWorkspaceLockfile=false`, `workspace_root` is intentionally set to the active project directory, but the workspace root may still have been *discovered* as `workspace_dir_opt`. Because discovery does not populate `config.workspace_dir`, the current call can target the project directory instead of the actual workspace root.

### Issue Context
- `workspace_dir_opt` is computed via `configured_or_discovered_workspace_dir(...)`.
- For dedicated (per-project) lockfiles, `workspace_root` is set to `manifest_dir` (active project dir).
- The scaffolding should target the directory that actually contains `pnpm-workspace.yaml` (i.e., the discovered workspace dir when present).

### Fix Focus Areas
- pnpm/crates/package-manager/src/install/run.rs[143-157]
- pnpm/crates/package-manager/src/install/run.rs[2277-2279]
- pnpm/crates/package-manager/src/install/workspace_state.rs[438-446]

### Suggested change
In `run_inner`, pass the resolved workspace manifest directory to `scaffold_allow_builds`, e.g. `workspace_dir_opt.as_deref().unwrap_or(&workspace_root)` (or compute a `workspace_manifest_dir` once and reuse it).

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


8. Pacquet purge guard diverges TS ✓ Resolved 📘 Rule violation ⌂ Architecture
Description
is_safe_modules_purge_target now refuses to purge when modules_dir equals the workspace_root,
but the TypeScript validateModules path still removes the contents of modulesDir without an
equivalent strict-descendant guard. This introduces a user-visible pnpm vs pacquet divergence and
adds pacquet-only behavior beyond pnpm for the same inputs.
Code

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

+fn is_safe_modules_purge_target(modules_dir: &Path, workspace_root: &Path) -> bool {
+    modules_dir != workspace_root && modules_dir.starts_with(workspace_root)
Relevance

●● Moderate

Repo values TS/Rust parity, but precedent is mixed and no close case for modules purge guard
divergence.

PR-#13464
PR-#12789
PR-#13594

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires user-visible behavior changes to remain in sync across pnpm TypeScript and
pacquet Rust, and forbids pacquet-only user-visible behavior beyond pnpm. The Rust change adds a new
safety gate for purge targets, while the TypeScript implementation still deletes modulesDir
contents without a similar guard, demonstrating divergence for the same configuration.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/package-manager/src/install/prepare_modules_state.rs[402-404]
pnpm11/installing/deps-installer/src/install/validateModules.ts[176-206]

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

## Issue description
Pacquet now protects against purging the workspace root when `modulesDir` resolves to the workspace root, but pnpm TypeScript still purges `modulesDir` contents without an equivalent guard. This creates a pnpm vs pacquet behavioral mismatch.

## Issue Context
- Rust (pacquet) added a strict-descendant check (`modules_dir != workspace_root && modules_dir.starts_with(workspace_root)`), preventing dangerous deletes when `modulesDir` points at the workspace root.
- TypeScript (pnpm) `validateModules` calls `removeContentsOfDir(importer.modulesDir, ...)` and `rimraf`s entries without a comparable workspace-root safety check.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/prepare_modules_state.rs[402-404]
- pnpm11/installing/deps-installer/src/install/validateModules.ts[176-206]

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



Informational

9. Changeset missing pnpm entry ✓ Resolved 📘 Rule violation § Compliance
Description
The new changeset declares a bump for pacquet but does not declare any bump for pnpm, which
violates the requirement to explicitly include pnpm with a valid bump type. This is especially
risky here because the changeset text claims to prevent pnpm from deleting workspace files.
Code

.changeset/protect-workspace-root-modules-purge.md[R1-3]

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

● Weak

Team often rejects adding pnpm bumps to pacquet-only changesets; they sometimes remove pnpm
entries instead.

PR-#13587
PR-#13347
PR-#12996

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include a pnpm entry with a valid
bump type. The added changeset only includes pacquet in its front-matter.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/protect-workspace-root-modules-purge.md[1-5]

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 an explicit `pnpm` entry and bump type.

## Issue Context
This changeset describes a behavior-affecting fix (“Prevent pnpm from removing workspace files...”), so the package list should explicitly include `pnpm` per the compliance rule.

## Fix Focus Areas
- .changeset/protect-workspace-root-modules-purge.md[1-5]

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


Grey Divider

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

Qodo Logo

@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 (12): Last reviewed commit: "fix(deps-installer): report refused purg..." | Re-trigger Greptile

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 17ea32f

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Honor custom lockfile output paths

Use the provided lockfile_path or derive it dynamically instead of a hardcoded
path when saving the wanted lockfile.

pnpm/crates/package-manager/src/install/run.rs [764-768]

 if config.lockfile {
+    let wanted_lockfile_path = lockfile_path
+        .map_or_else(|| workspace_root.join(Lockfile::FILE_NAME), Path::to_path_buf);
     lockfile
-        .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+        .save_to_path(&wanted_lockfile_path)
         .map_err(InstallError::SaveWantedLockfile)?;
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The hardcoded output path ignores the potentially supplied lockfile_path, which can result in writing to the wrong location.

High
Probe markers from lockfile directory

Pass the correctly derived lockfile_dir to gvs_build_marker_present instead of
workspace_root.

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

-&& !gvs_build_marker_present(wanted_lockfile, config, workspace_root)
+&& !gvs_build_marker_present(wanted_lockfile, config, lockfile_dir)

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a logic bug where workspace_root is used instead of the actual lockfile directory, which would cause build markers to be missed when shared_workspace_lockfile is false.

High
Run preparation before freshness checks

Move the devPreinstall script execution logic to run before any lockfile
freshness checks and lockfile updates.

pnpm/crates/package-manager/src/install/run.rs [476-613]

-let synthesized_lockfile: Option<Lockfile> = match current_lockfile.as_ref() {
-    Some(current) if lockfile.is_none() && !frozen_lockfile && prefer_frozen_lockfile => {
-        check_lockfile_freshness(
-            current,
-            &manifest_freshness_inputs,
-            config,
-            &catalogs,
-            pnpmfile_hook.as_ref(),
-            ignore_manifest_check,
-            true,
-        )
-        .await
-        .ok()
-        .map(|()| current.clone())
-    }
-    _ => None,
-};
-...
+let pnpmfile_hook = pnpmfile_hook_override
+    .or_else(|| pacquet_hooks::finder::load_pnpmfile(&workspace_root));
+
 if !config.ignore_scripts
     && !resolve_only
     && !ignore_manifest_check
     && rebuild.is_none()
     && !dev_preinstall_already_ran()
 {
-    ...
+    let normalized_root = pacquet_fs::lexical_normalize(&workspace_root);
+    let root_defines_hook = project_manifests
+        .iter()
+        .find(|(project_dir, _)| {
+            pacquet_fs::lexical_normalize(project_dir) == normalized_root
+        })
+        .is_none_or(|(_, manifest)| {
+            matches!(manifest.script(DEV_PREINSTALL_STAGE, true), Ok(Some(_)))
+        });
     if root_defines_hook {
         run_dev_preinstall::<Reporter>(config, &workspace_root)?;
     }
 }
 
+// Load the current lockfile and perform all freshness,
+// synthesis, and fast-update checks only after devPreinstall.
+...
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: Running devPreinstall before freshness checks is necessary, as the hook can prepare inputs for resolution, meaning the lockfile checks shouldn't happen before it completes.

Medium
General
Keep resolve-only runs side-effect free

Gate the creation of the store directory and registry modification with a
!resolve_only check to prevent unwanted side-effects during a dry-run.

pnpm/crates/package-manager/src/install/run.rs [410-428]

-if let Err(error) =
-    std::fs::create_dir_all(pacquet_store_dir::StoreDir::root(&config.store_dir))
-{
-    tracing::warn!(
-        target: "pacquet::install",
-        ?error,
-        "Failed to ensure store root exists before project registry write; install continues",
-    );
-}
-if let Err(error) =
-    pacquet_store_dir::register_project(&config.store_dir, &workspace_root)
-{
-    tracing::warn!(
-        target: "pacquet::install",
-        ?error,
-        "Failed to register workspace root in the store project registry; install continues",
-    );
+if !resolve_only {
+    if let Err(error) =
+        std::fs::create_dir_all(pacquet_store_dir::StoreDir::root(&config.store_dir))
+    {
+        tracing::warn!(
+            target: "pacquet::install",
+            ?error,
+            "Failed to ensure store root exists before project registry write; install continues",
+        );
+    }
+    if let Err(error) =
+        pacquet_store_dir::register_project(&config.store_dir, &workspace_root)
+    {
+        tracing::warn!(
+            target: "pacquet::install",
+            ?error,
+            "Failed to register workspace root in the store project registry; install continues",
+        );
+    }
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: Modifying the filesystem during a --dry-run violates the expected side-effect-free nature of such queries.

Medium
  • Update

Previous suggestions

Suggestions up to commit bc8803d
CategorySuggestion                                                                                                                                    Impact
Possible issue
Write the configured lockfile path

Use the provided lockfile_path instead of hardcoding
workspace_root.join(Lockfile::FILE_NAME) when saving the lockfile.

pnpm/crates/package-manager/src/install/run.rs [764-768]

 if config.lockfile {
+    let wanted_lockfile_path = lockfile_path
+        .map_or_else(|| workspace_root.join(Lockfile::FILE_NAME), Path::to_path_buf);
     lockfile
-        .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+        .save_to_path(&wanted_lockfile_path)
         .map_err(InstallError::SaveWantedLockfile)?;
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly points out a bug where the customized lockfile_path is ignored during the lockfile save operation in the frozen lockfile-only path.

Medium
Probe markers from lockfile directory

Add a lockfile_dir input to PrepareModulesStateInputs and pass it to
gvs_build_marker_present instead of workspace_root. This ensures build markers
are correctly resolved when sharedWorkspaceLockfile is false.

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

     pub(super) workspace_root: &'a Path,
+    pub(super) lockfile_dir: &'a Path,
 ...
-            && !gvs_build_marker_present(wanted_lockfile, config, workspace_root)
+            && !gvs_build_marker_present(wanted_lockfile, config, lockfile_dir)
Suggestion importance[1-10]: 8

__

Why: Using workspace_root fails to locate GVS build markers when sharedWorkspaceLockfile is false, causing the installation to incorrectly skip necessary build recovery.

Medium
Preserve mandatory install option behavior

Add !dry_run and !update_checksums to the optimistic repeat install condition to
avoid bypassing necessary operations.

pnpm/crates/package-manager/src/install/run.rs [305-307]

 && !frozen_lockfile
+&& !dry_run
+&& !update_checksums
 && !config.force
 && !disable_optimistic_repeat_install
Suggestion importance[1-10]: 6

__

Why: Adding !dry_run and !update_checksums prevents incorrect optimistic short-circuits, though the explanation regarding --frozen-lockfile is slightly inaccurate because !frozen_lockfile already prevents it.

Low
Security
Make destructive pruning symlink-safe

Refactor the virtual store pruning process to validate containment and delete
directories atomically to prevent TOCTOU vulnerabilities.

pnpm/crates/package-manager/src/install/apply_materialization.rs [315-326]

-if let Some(prune_dir) = crate::prune_virtual_store::prune_target_within_modules(
+match crate::prune_virtual_store::prune_virtual_store_within_modules(
     effective_virtual_store_dir,
     &config.modules_dir,
+    wanted.snapshots.iter().flat_map(|snapshots| snapshots.keys()),
+    install_skipped,
+    config.virtual_store_dir_max_length as usize,
 ) {
-    crate::prune_virtual_store::prune_virtual_store(
-        &prune_dir,
-        wanted.snapshots.iter().flat_map(|snapshots| snapshots.keys()),
-        install_skipped,
-        config.virtual_store_dir_max_length as usize,
-    )
-    .is_some()
-} else {
-    ...
+    Ok(did_prune) => did_prune,
+    Err(error) => {
+        tracing::warn!(
+            virtual_store_dir = %effective_virtual_store_dir.display(),
+            modules_dir = %config.modules_dir.display(),
+            ?error,
+            "skipping virtual-store prune: target could not be safely opened beneath node_modules",
+        );
+        false
+    }
 }
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a Time-of-Check to Time-of-Use (TOCTOU) vulnerability during virtual store pruning and proposes a secure refactoring, though it requires implementing a new atomic function.

Medium
Reject malformed paths during probing

Return false instead of true when encountering malformed importer IDs and
dependency aliases. This ensures inconsistent lockfile paths correctly fail the
intactness check.

pnpm/crates/package-manager/src/install/modules_state.rs [117-139]

     if crate::symlink_direct_dependencies::validate_importer_id(importer_id).is_err() {
-        return true;
+        return false;
     }
 ...
-            Err(_) => true,
+            Err(_) => false,
Suggestion importance[1-10]: 7

__

Why: Returning true is inconsistent with the handling of other malformed names (which return false) and could lead to incorrect fast-path evaluations, even if the structural gate catches it later.

Medium
Suggestions up to commit a31e252
CategorySuggestion                                                                                                                                    Impact
Security
Reject malformed paths during probing

Change the return value to false for malformed importer IDs and dependency
aliases. This ensures the full path is taken to properly reject invalid paths.

pnpm/crates/package-manager/src/install/modules_state.rs [117-140]

     if crate::symlink_direct_dependencies::validate_importer_id(importer_id).is_err() {
-        return true;
+        return false;
     }
 ...
-                Err(_) => true,
+                Err(_) => false,
Suggestion importance[1-10]: 9

__

Why: Returning true inside all() incorrectly marks malformed paths as intact, causing the fast path to be taken and bypassing the structural validation errors mentioned in the comments.

High
Possible issue
Honor the configured lockfile path

Honor the configured lockfile_path when saving the wanted lockfile in the frozen
lockfile-only path.

pnpm/crates/package-manager/src/install/run.rs [764-768]

 if config.lockfile {
+    let wanted_lockfile_path = lockfile_path
+        .map_or_else(|| workspace_root.join(Lockfile::FILE_NAME), Path::to_path_buf);
     lockfile
-        .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+        .save_to_path(&wanted_lockfile_path)
         .map_err(InstallError::SaveWantedLockfile)?;
 }
Suggestion importance[1-10]: 8

__

Why: This addresses a logical bug where the lockfile_path configuration is ignored, which could result in writing the lockfile to the wrong location.

Medium
Regenerate the intended lockfile

Thread the effective wanted lockfile path into CommitModulesStateInputs so it
can be used when regenerating synthesized or fast-updated lockfiles.

pnpm/crates/package-manager/src/install/apply_materialization.rs [445-453]

 if take_frozen_path
     && (lockfile_synthesized_from_current || lockfile_was_fast_updated)
     && config.lockfile
-    && let Some(updated) = loaded_wanted_lockfile
+    && let (Some(updated), Some(wanted_lockfile_path)) =
+        (loaded_wanted_lockfile, wanted_lockfile_path)
 {
     updated
-        .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+        .save_to_path(wanted_lockfile_path)
         .map_err(InstallError::SaveWantedLockfile)?;
 }
Suggestion importance[1-10]: 8

__

Why: This fixes a bug where synthesized or fast-updated lockfiles are saved to a hardcoded default path rather than respecting the configured lockfile_path.

Medium
Suggestions up to commit 5f872ec
CategorySuggestion                                                                                                                                    Impact
Security
Reject malformed lockfile paths

Return false for invalid importer IDs and malformed aliases to ensure the frozen
tree is not considered intact and falls back to full materialization.

pnpm/crates/package-manager/src/install/modules_state.rs [117-139]

 if crate::symlink_direct_dependencies::validate_importer_id(importer_id).is_err() {
-    return true;
+    return false;
 }
 ...
-        Err(_) => true,
+        Err(_) => false,
Suggestion importance[1-10]: 9

__

Why: Returning true inside the all() closure incorrectly marks malformed structures as valid, erroneously triggering the fast path and skipping the typed errors produced by full materialization.

High
Possible issue
Write lockfiles to effective directory

Write the lockfile to the effective lockfile directory based on the
shared_workspace_lockfile configuration rather than unconditionally saving it to
the workspace root.

pnpm/crates/package-manager/src/install/apply_materialization.rs [456-458]

 updated
-    .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+    .save_to_path(&lockfile_dir.join(Lockfile::FILE_NAME))
     .map_err(InstallError::SaveWantedLockfile)?;
Suggestion importance[1-10]: 9

__

Why: This fixes a critical bug where the lockfile is written to the wrong location when shared_workspace_lockfile is false, potentially overwriting a root lockfile instead of the project-specific one.

High
Preserve per-project lockfile location

Save the lockfile to the correct effective directory in prepare_modules_state
instead of unconditionally defaulting to workspace_root.

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

 wanted_lockfile
-    .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+    .save_to_path(&lockfile_dir.join(Lockfile::FILE_NAME))
     .map_err(InstallError::SaveWantedLockfile)?;
Suggestion importance[1-10]: 9

__

Why: This addresses the same critical bug as the previous suggestion, ensuring the lockfile path aligns with the shared_workspace_lockfile setting during fast-path updates.

High
Check the correct project lockfile

Check the shared_workspace_lockfile configuration when determining the lockfile
directory in check_deps_status_before_run_at, similar to
install_already_up_to_date.

pnpm/crates/package-manager/src/install/workspace_state.rs [212-216]

 let lockfile = if config.lockfile {
-    LazyLockfile::deferred(workspace_root.clone())
+    LazyLockfile::deferred(if config.shared_workspace_lockfile {
+        workspace_root.clone()
+    } else {
+        dir.to_path_buf()
+    })
 } else {
     LazyLockfile::disabled()
 };
Suggestion importance[1-10]: 9

__

Why: Ensures the dependency status checker examines the appropriate pnpm-lock.yaml file when shared_workspace_lockfile is disabled, avoiding incorrect "outdated" reports.

High
Honor configured lockfile path

Use the provided lockfile_path (or fall back to the default) when saving the
lockfile instead of hardcoding the path to the workspace root.

pnpm/crates/package-manager/src/install/run.rs [764-766]

+let wanted_lockfile_path = lockfile_path
+    .map_or_else(|| workspace_root.join(Lockfile::FILE_NAME), Path::to_path_buf);
 lockfile
-    .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+    .save_to_path(&wanted_lockfile_path)
     .map_err(InstallError::SaveWantedLockfile)?;
Suggestion importance[1-10]: 8

__

Why: Hardcoding the save path to workspace_root.join(Lockfile::FILE_NAME) ignores the caller-provided lockfile_path configuration, which could result in writing the lockfile to the wrong location.

Medium
Suggestions up to commit 7e30cd7
CategorySuggestion                                                                                                                                    Impact
Security
Reject malformed lockfile paths

Return false instead of true when encountering malformed importer IDs or
aliases. This ensures the materialization process does not skip validation and
correctly rejects invalid lockfiles.

pnpm/crates/package-manager/src/install/modules_state.rs [117-139]

     if crate::symlink_direct_dependencies::validate_importer_id(importer_id).is_err() {
-        return true;
+        return false;
     }
 ...
-                Err(_) => true,
+                Err(_) => false,
Suggestion importance[1-10]: 10

__

Why: Returning true incorrectly marks a malformed tree as intact, causing the fast path to short-circuit and silently swallow the error instead of falling back to the full path to reject it.

High
Possible issue
Read the correct project lockfile

Use the correct directory for LazyLockfile based on the
shared_workspace_lockfile configuration.

pnpm/crates/package-manager/src/install/workspace_state.rs [212-216]

 let lockfile = if config.lockfile {
-    LazyLockfile::deferred(workspace_root.clone())
+    LazyLockfile::deferred(if config.shared_workspace_lockfile {
+        workspace_root.clone()
+    } else {
+        dir.to_path_buf()
+    })
 } else {
     LazyLockfile::disabled()
 };
Suggestion importance[1-10]: 9

__

Why: Failing to respect shared_workspace_lockfile can cause the verifyDepsBeforeRun check to read the wrong lockfile and behave incorrectly for non-shared configurations.

High
Check markers under correct lockfile

Pass the correctly resolved lockfile directory to gvs_build_marker_present
instead of workspace_root.

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

-&& !gvs_build_marker_present(wanted_lockfile, config, workspace_root)
+&& !gvs_build_marker_present(wanted_lockfile, config, lockfile_dir)
Suggestion importance[1-10]: 9

__

Why: Using workspace_root unconditionally breaks the functionality for sharedWorkspaceLockfile: false, leading to incorrect assumptions about the presence of build markers.

High
Save lockfile in correct directory

Save the reconstructed lockfile to the correct lockfile_dir instead of
workspace_root.

pnpm/crates/package-manager/src/install/apply_materialization.rs [452-454]

 updated
-    .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+    .save_to_path(&lockfile_dir.join(Lockfile::FILE_NAME))
     .map_err(InstallError::SaveWantedLockfile)?;
Suggestion importance[1-10]: 9

__

Why: Saving the lockfile unconditionally at workspace_root will incorrectly overwrite or create lockfiles in the root directory when sharedWorkspaceLockfile is disabled.

High
Honor custom lockfile output paths

Update the lockfile save operation to respect the configured lockfile_path. This
prevents overwriting the default lockfile when a custom path is specified.

pnpm/crates/package-manager/src/install/run.rs [763-765]

+            let wanted_lockfile_path = lockfile_path
+                .map_or_else(|| workspace_root.join(Lockfile::FILE_NAME), Path::to_path_buf);
             lockfile
-                .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+                .save_to_path(&wanted_lockfile_path)
                 .map_err(InstallError::SaveWantedLockfile)?;
Suggestion importance[1-10]: 8

__

Why: The current implementation hardcodes the lockfile output path instead of honoring the configured lockfile_path, which can result in writing to the wrong location when custom paths are provided.

Medium
Suggestions up to commit 5d76ef0
CategorySuggestion                                                                                                                                    Impact
Possible issue
Prevent workspace root deletion

Ensure modules_canon is not exactly the root_canon to prevent accidental
deletion of workspace files during cleanup.

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

 (Ok(modules_canon), Ok(root_canon)) => {
-    (modules_canon.starts_with(&root_canon), Some(modules_canon))
+    let is_safe = modules_canon != root_canon
+        && modules_canon.starts_with(&root_canon);
+    (is_safe, Some(modules_canon))
 }
Suggestion importance[1-10]: 10

__

Why: This suggestion addresses a critical and potentially destructive bug where setting modules_dir to the workspace root could cause the cleanup loop to delete workspace files.

High
Use the correct lockfile directory

Update lockfile initialization in check_deps_status_before_run_at to respect the
shared_workspace_lockfile config, matching the behavior in
install_already_up_to_date.

pnpm/crates/package-manager/src/install/workspace_state.rs [212-216]

 let lockfile = if config.lockfile {
-    LazyLockfile::deferred(workspace_root.clone())
+    LazyLockfile::deferred(if config.shared_workspace_lockfile {
+        workspace_root.clone()
+    } else {
+        dir.to_path_buf()
+    })
 } else {
     LazyLockfile::disabled()
 };
Suggestion importance[1-10]: 9

__

Why: The suggestion catches a significant logic error where the lockfile path resolution incorrectly ignores shared_workspace_lockfile, breaking behavior for unshared workspaces.

High
Honor configured lockfile destination

Use the lockfile_path setting instead of hardcoding
workspace_root.join(Lockfile::FILE_NAME) when saving the lockfile. This ensures
the correctly configured lockfile path is honored.

pnpm/crates/package-manager/src/install/run.rs [762-766]

         if config.lockfile {
+            let wanted_lockfile_path = lockfile_path
+                .map_or_else(|| workspace_root.join(Lockfile::FILE_NAME), Path::to_path_buf);
             lockfile
-                .save_to_path(&workspace_root.join(Lockfile::FILE_NAME))
+                .save_to_path(&wanted_lockfile_path)
                 .map_err(InstallError::SaveWantedLockfile)?;
         }
Suggestion importance[1-10]: 8

__

Why: Hardcoding the lockfile path ignores the explicit lockfile_path override provided to the install options, causing the lockfile to be saved in the wrong location during a frozen lockfile-only run.

Medium
Security
Reject malformed lockfile paths

Return false instead of true for malformed importer IDs and dependency aliases.
This ensures the frozen no-op path correctly falls back to the full path
structural validation for malformed entries.

pnpm/crates/package-manager/src/install/modules_state.rs [117-139]

     if crate::symlink_direct_dependencies::validate_importer_id(importer_id).is_err() {
-        return true;
+        return false;
     }
 ...
-            Err(_) => true,
+            Err(_) => false,
Suggestion importance[1-10]: 9

__

Why: Returning true causes the validation to falsely consider a malformed lockfile as intact, short-circuiting the installation and suppressing the typed errors that the full path would have correctly emitted.

High
General
Prevent dry-run filesystem mutations

Add a !dry_run condition to the block that creates the global-store directory
and registers the project. This prevents filesystem side effects during dry
runs.

pnpm/crates/package-manager/src/install/run.rs [401-426]

-    if config.enable_global_virtual_store {
+    if config.enable_global_virtual_store && !dry_run {
         // Create the store root before calling `register_project` so
         // its `path_contains` guard can canonicalize the path
         // instead of falling through to a literal comparison that
         // wrongly matches against `<workspace>/../pacquet-store/v11`-
         // shaped relative store paths (resolved-on-disk: outside the
         // workspace; lexical: starts with the workspace prefix).
         if let Err(error) =
             std::fs::create_dir_all(pacquet_store_dir::StoreDir::root(&config.store_dir))
         {
             tracing::warn!(
                 target: "pacquet::install",
                 ?error,
                 "Failed to ensure store root exists before project registry write; install continues",
             );
         }
         if let Err(error) =
             pacquet_store_dir::register_project(&config.store_dir, &workspace_root)
         {
             tracing::warn!(
                 target: "pacquet::install",
                 ?error,
                 "Failed to register workspace root in the store project registry; install continues",
             );
         }
     }
Suggestion importance[1-10]: 8

__

Why: Mutating the filesystem and global project registry violates the expectations of a --dry-run operation, which should be purely side-effect-free.

Medium

Copilot AI review requested due to automatic review settings August 4, 2026 11:57

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 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 (3)
pnpm/crates/package-manager/src/install/run.rs (1)

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

Move the hoisted_locations note next to the tuple it documents.

Lines 658-667 describe "the third tuple element", but the tuple is destructured at lines 1159-1164, about 490 lines below. Keep the dispatch-priority comment here and place the hoisted_locations paragraph directly above the let (hoisted_dependencies, hoisted_locations, install_skipped, fresh_lockfile) binding.

🤖 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/run.rs` around lines 658 - 667, Move
the comment describing the third tuple element, hoisted_locations, from the
dispatch-priority section to immediately above the let binding that destructures
hoisted_dependencies, hoisted_locations, install_skipped, and fresh_lockfile.
Keep the dispatch-priority comment in its current location and preserve the
hoisted_locations wording.
pnpm/crates/package-manager/src/install/modules_state.rs (1)

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

Re-attach the doc and comment blocks the module split left behind. The decomposition moved functions into new modules but carried several doc blocks across boundaries without re-attaching them to the item they describe. The result is truncated text, duplicated paragraphs, function contracts attached to option structs, and one intra-doc link that no longer resolves. The fix at each site is the same: re-attach, deduplicate, or requalify the comment.

  • pnpm/crates/package-manager/src/install/modules_state.rs#L45-L70: split the block — lines 45-57 document modules_layout_consistent_with (line 264, currently undocumented); lines 58-69 document frozen_tree_intact.
  • pnpm/crates/package-manager/src/install/workspace_state.rs#L22-L24: delete the truncated fragment ending in "same workspace discovery, same"; keep only the sentence describing UpToDateWorkspace.
  • pnpm/crates/package-manager/src/install/workspace_state.rs#L448-L462: merge the two paragraphs that both describe the name/version index, the unnamed-project skip, and the 0.0.0 version fallback.
  • pnpm/crates/package-manager/src/install/lockfile_freshness.rs#L133-L149: move the gate description from CheckLockfileSettingsDriftOptions onto check_lockfile_settings_drift; keep the pnpmfile_checksum field note on the struct.
  • pnpm/crates/package-manager/src/install/modules_state.rs#L269-L281: keep one statement of the virtualStoreOnly rationale instead of two.
  • pnpm/crates/package-manager/src/install/lifecycle.rs#L9-L18: qualify the link as [super::build_workspace_packages_map], since the symbol now lives in workspace_state.rs.
  • pnpm/crates/package-manager/src/install/run.rs#L658-L667: move the hoisted_locations paragraph next to the tuple binding at lines 1159-1164.

As per coding guidelines, "Use rustdoc comments for public API contracts and regular comments for implementation rationale" and comments must not "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/package-manager/src/install/modules_state.rs` around lines 45 -
70, Reattach and clean up the split documentation without changing behavior: in
pnpm/crates/package-manager/src/install/modules_state.rs#L45-L70, assign the
first block to modules_layout_consistent_with and the remainder to
frozen_tree_intact; remove the duplicate virtualStoreOnly rationale at
`#L269-L281`. In workspace_state.rs#L22-L24, remove the truncated fragment, and
merge duplicate name/version-index paragraphs at `#L448-L462`. In
lockfile_freshness.rs#L133-L149, move the gate documentation to
check_lockfile_settings_drift while retaining the pnpmfile_checksum field note
on CheckLockfileSettingsDriftOptions. In lifecycle.rs#L9-L18, qualify the link
as super::build_workspace_packages_map. In run.rs#L658-L667, move the
hoisted_locations documentation beside its tuple binding at `#L1159-L1164`; keep
rustdoc for API contracts and regular comments for implementation rationale.

Source: Coding guidelines

pnpm/crates/patching/src/commit/tests.rs (1)

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

Remove the unused created_dirs counter.

CreateDirErrorFs::created_dirs is incremented in create_dir_all but no test reads it. The only construction site is Line 140, which sets it to 0. Delete the field to remove the dead state and the Cell import.

♻️ Proposed cleanup
 struct CreateDirErrorFs {
     fail_on: &'static str,
-    created_dirs: Cell<usize>,
 }
 
 impl PatchCommitFs for CreateDirErrorFs {
     fn symlink_metadata(&self, path: &Path) -> io::Result<fs::Metadata> {
         fs::symlink_metadata(path)
     }
 
     fn create_dir_all(&self, path: &Path) -> io::Result<()> {
         if path.ends_with(self.fail_on) {
             return Err(io::Error::new(io::ErrorKind::PermissionDenied, "blocked create_dir_all"));
         }
-        self.created_dirs.set(self.created_dirs.get() + 1);
         fs::create_dir_all(path)
     }

Then update the construction site and the import:

-        &CreateDirErrorFs { fail_on: "lib", created_dirs: Cell::new(0) },
+        &CreateDirErrorFs { fail_on: "lib" },
-use std::{cell::Cell, fs, io, path::Path};
+use std::{fs, io, path::Path};
🤖 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/patching/src/commit/tests.rs` around lines 311 - 325, Remove the
unused created_dirs field and its increment from CreateDirErrorFs, then update
its construction site to stop initializing that field and remove the now-unused
Cell import.
🤖 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/package-manager/src/install/modules_state.rs`:
- Around line 45-70: Reattach and clean up the split documentation without
changing behavior: in
pnpm/crates/package-manager/src/install/modules_state.rs#L45-L70, assign the
first block to modules_layout_consistent_with and the remainder to
frozen_tree_intact; remove the duplicate virtualStoreOnly rationale at
`#L269-L281`. In workspace_state.rs#L22-L24, remove the truncated fragment, and
merge duplicate name/version-index paragraphs at `#L448-L462`. In
lockfile_freshness.rs#L133-L149, move the gate documentation to
check_lockfile_settings_drift while retaining the pnpmfile_checksum field note
on CheckLockfileSettingsDriftOptions. In lifecycle.rs#L9-L18, qualify the link
as super::build_workspace_packages_map. In run.rs#L658-L667, move the
hoisted_locations documentation beside its tuple binding at `#L1159-L1164`; keep
rustdoc for API contracts and regular comments for implementation rationale.

In `@pnpm/crates/package-manager/src/install/run.rs`:
- Around line 658-667: Move the comment describing the third tuple element,
hoisted_locations, from the dispatch-priority section to immediately above the
let binding that destructures hoisted_dependencies, hoisted_locations,
install_skipped, and fresh_lockfile. Keep the dispatch-priority comment in its
current location and preserve the hoisted_locations wording.

In `@pnpm/crates/patching/src/commit/tests.rs`:
- Around line 311-325: Remove the unused created_dirs field and its increment
from CreateDirErrorFs, then update its construction site to stop initializing
that field and remove the now-unused Cell import.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 899dbe2e-4cb4-45b4-8496-c3cd6baae4e0

📥 Commits

Reviewing files that changed from the base of the PR and between e719786 and 54a4b23.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (12)
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/lifecycle.rs
  • pnpm/crates/package-manager/src/install/lockfile_freshness.rs
  • pnpm/crates/package-manager/src/install/modules_state.rs
  • pnpm/crates/package-manager/src/install/run.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm/crates/package-manager/src/install/workspace_state.rs
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm/crates/patching/Cargo.toml
  • pnpm/crates/patching/src/commit.rs
  • pnpm/crates/patching/src/commit/tests.rs
  • pnpm/crates/patching/src/lib.rs

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6794e7b

@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.20     19.2±3.29ms    19.5 MB/sec    1.00     16.0±2.32ms    23.4 MB/sec
packument/parse                                  1.06     46.5±5.10µs  1428.0 MB/sec    1.00     43.9±3.66µs  1512.1 MB/sec
tarball/download_dependency                      1.17      4.2±1.30ms  1039.1 KB/sec    1.00      3.6±0.70ms  1217.0 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   265.8±16.01ms 60.2 KElem/sec    1.04   275.2±18.54ms 58.1 KElem/sec
workspace_resolution/hoist_heavy                 1.26   491.7±46.16ms        ? ?/sec    1.00   390.2±34.61ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.97786% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.10%. Comparing base (e719786) to head (17ea32f).

Files with missing lines Patch % Lines
...rates/package-manager/src/install/modules_state.rs 93.67% 26 Missing ⚠️
...ckage-manager/src/install/prepare_modules_state.rs 88.88% 26 Missing ⚠️
pnpm/crates/package-manager/src/install/run.rs 97.26% 14 Missing ⚠️
...ckage-manager/src/install/apply_materialization.rs 97.52% 12 Missing ⚠️
...pm/crates/package-manager/src/install/lifecycle.rs 95.90% 10 Missing ⚠️
...tes/package-manager/src/install/workspace_state.rs 97.30% 10 Missing ⚠️
.../package-manager/src/install/lockfile_freshness.rs 96.00% 8 Missing ⚠️
.../crates/package-manager/src/install/materialize.rs 98.81% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13640      +/-   ##
==========================================
+ Coverage   88.05%   88.10%   +0.05%     
==========================================
  Files         574      582       +8     
  Lines       98386    98821     +435     
==========================================
+ Hits        86633    87068     +435     
  Misses      11753    11753              

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

Copilot AI review requested due to automatic review settings August 4, 2026 12:16

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

Copilot AI review requested due to automatic review settings August 4, 2026 12:22

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 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/package-manager/src/install/run.rs (1)

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

Both new phase-input structs borrow prefix as &String instead of &str. The extraction created two input structs that carry the reporter prefix. Both declare &'a String, which narrows the accepted type for no benefit. Every use is a clone, a to_owned, or a &str argument. The pnpm Rust code style guide requires the broadest suitable borrowed type.

  • pnpm/crates/package-manager/src/install/run.rs#L934-L934: change prefix: &'a String to prefix: &'a str in PrepareModulesStateInputs.
  • pnpm/crates/package-manager/src/install/run.rs#L1340-L1340: change prefix: &'a String to prefix: &'a str in MaterializationInputs, and confirm the requester fields at Lines 1530 and 1603 accept &str.

Call sites pass &prefix from an owned String, so deref coercion keeps them unchanged.

As per coding guidelines: "Choose owned versus borrowed parameters to minimize copies and prefer the broadest suitable borrowed types, such as &Path over &PathBuf and &str over &String."

🤖 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/run.rs` at line 934, Update the
prefix fields in PrepareModulesStateInputs at
pnpm/crates/package-manager/src/install/run.rs:934-934 and MaterializationInputs
at pnpm/crates/package-manager/src/install/run.rs:1340-1340 from &String to
&str. Confirm the requester fields at lines 1530 and 1603 accept &str, while
leaving existing call sites unchanged.

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/package-manager/src/install/run.rs`:
- Line 934: Update the prefix fields in PrepareModulesStateInputs at
pnpm/crates/package-manager/src/install/run.rs:934-934 and MaterializationInputs
at pnpm/crates/package-manager/src/install/run.rs:1340-1340 from &String to
&str. Confirm the requester fields at lines 1530 and 1603 accept &str, while
leaving existing call sites unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c460d212-28d1-4c21-8807-3d28e6553be5

📥 Commits

Reviewing files that changed from the base of the PR and between 6794e7b and 57d7e61.

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 57d7e61

Copilot AI review requested due to automatic review settings August 4, 2026 12:38

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 c1eabcc

Copilot AI review requested due to automatic review settings August 4, 2026 13:36

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 commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Addressed the latest Qodo review in commit a31e25220a:

  • rewrote the link: materialization comment as a current invariant, removing the historical pnpm v11 framing;
  • thread the discovered workspace manifest directory through install completion, so allowBuilds scaffolding is written to the workspace root even when sharedWorkspaceLockfile is false;
  • added an end-to-end regression for that per-project-lockfile case;
  • applied the strict-descendant modules-purge guard to the TypeScript installer as required by parity, with a regression proving a modulesDir of . preserves project files.

Validation passed: the focused TypeScript suite (10 tests), the Rust approval-builds suite (16 tests), and just ready including all 7,647 Rust tests, Clippy, rustdoc, and Dylint.


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

@qodo-code-review

Copy link
Copy Markdown

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

Copilot AI review requested due to automatic review settings August 4, 2026 13:51

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 bc8803d

Copilot AI review requested due to automatic review settings August 4, 2026 14:10

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 17ea32f

@blacksmith-sh

blacksmith-sh Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test/install/nodeRuntime.ts (110.721 s)/nodeRuntime.ts (110.721 s) View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 17ea32f70126

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.716 ± 0.189 2.505 2.934 1.71 ± 0.19
pacquet@main 2.698 ± 0.091 2.567 2.875 1.70 ± 0.16
pnpr@HEAD 1.597 ± 0.120 1.444 1.791 1.01 ± 0.12
pnpr@main 1.585 ± 0.140 1.436 1.853 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.71601543328,
      "stddev": 0.18867998676020692,
      "median": 2.72541214388,
      "user": 2.29568876,
      "system": 1.7023863399999999,
      "min": 2.50479027688,
      "max": 2.9343247148800002,
      "times": [
        2.50479027688,
        2.51018225588,
        2.5327958778800004,
        2.87917871488,
        2.9343247148800002,
        2.64245197488,
        2.90226183688,
        2.91891275688,
        2.80837231288,
        2.52688361088
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6983112903800004,
      "stddev": 0.09081746637930985,
      "median": 2.7183898508800004,
      "user": 2.372675159999999,
      "system": 1.8541889400000002,
      "min": 2.5667994588800003,
      "max": 2.87487058188,
      "times": [
        2.63496278588,
        2.71225129488,
        2.72452840688,
        2.61231440788,
        2.5667994588800003,
        2.73065506988,
        2.6215627228800003,
        2.77052943688,
        2.73463873788,
        2.87487058188
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5969690711800002,
      "stddev": 0.12018000316361335,
      "median": 1.5651184803800002,
      "user": 1.5929337600000002,
      "system": 1.6332178399999997,
      "min": 1.4439453648800002,
      "max": 1.7907370068800001,
      "times": [
        1.49384784688,
        1.5713503238800002,
        1.5117014988800002,
        1.4439453648800002,
        1.6616908338800003,
        1.76157488188,
        1.4942497198800002,
        1.7907370068800001,
        1.68170659788,
        1.55888663688
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5847051592800003,
      "stddev": 0.1399789462449955,
      "median": 1.5190338703800002,
      "user": 1.5864345600000003,
      "system": 1.62881764,
      "min": 1.4363933258800001,
      "max": 1.8531108608800002,
      "times": [
        1.4961807418800002,
        1.6998871278800003,
        1.4723141938800002,
        1.5418869988800001,
        1.4849442048800001,
        1.65125486688,
        1.73102087588,
        1.4363933258800001,
        1.8531108608800002,
        1.4800583958800002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 352.2 ± 29.6 312.5 406.0 1.00
pacquet@main 358.7 ± 34.0 313.1 408.3 1.02 ± 0.13
pnpr@HEAD 406.2 ± 16.4 386.0 438.9 1.15 ± 0.11
pnpr@main 410.2 ± 39.5 351.7 466.3 1.16 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35223975248,
      "stddev": 0.02961700977929191,
      "median": 0.35079166018,
      "user": 0.32219655999999997,
      "system": 0.64769842,
      "min": 0.31254991818,
      "max": 0.40602993818000005,
      "times": [
        0.33929702318000005,
        0.36229615718,
        0.36963500018,
        0.35377843718,
        0.40602993818000005,
        0.31254991818,
        0.32586469218,
        0.31988511618000004,
        0.34780488318,
        0.38525635918
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.35868047568000005,
      "stddev": 0.03398471883190196,
      "median": 0.34384238218,
      "user": 0.31305556,
      "system": 0.66165512,
      "min": 0.31310810118000004,
      "max": 0.40829628418,
      "times": [
        0.33502443518,
        0.40829628418,
        0.31310810118000004,
        0.40061941518000005,
        0.34737853018000003,
        0.34030623418,
        0.39791309118,
        0.37624251518,
        0.33290140318,
        0.33501474718
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.40618668778,
      "stddev": 0.016409220713209313,
      "median": 0.40761116418,
      "user": 0.33465806000000003,
      "system": 0.74992682,
      "min": 0.38601650618,
      "max": 0.43886494418000005,
      "times": [
        0.40854131018,
        0.40668101818,
        0.43886494418000005,
        0.40867440318000003,
        0.41105218718000003,
        0.38857439118000003,
        0.42365412618000003,
        0.38601650618,
        0.39954646018,
        0.39026153118
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.41023721988000006,
      "stddev": 0.03951006800865843,
      "median": 0.40764920118000003,
      "user": 0.37161975999999997,
      "system": 0.7083933199999999,
      "min": 0.35168095418,
      "max": 0.46626385018000005,
      "times": [
        0.45107335618000005,
        0.46626385018000005,
        0.36436831718,
        0.45393125918000005,
        0.39104239318,
        0.38122475318000004,
        0.42748891318000004,
        0.41947487618,
        0.35168095418,
        0.39582352618
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.030 ± 0.234 2.807 3.552 1.89 ± 0.22
pacquet@main 2.837 ± 0.090 2.732 3.005 1.77 ± 0.16
pnpr@HEAD 1.605 ± 0.137 1.469 1.913 1.00
pnpr@main 1.693 ± 0.155 1.462 1.933 1.05 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.02957594646,
      "stddev": 0.23367871971689194,
      "median": 2.95973979936,
      "user": 2.41822616,
      "system": 2.0458551999999997,
      "min": 2.80699265886,
      "max": 3.55231933586,
      "times": [
        3.0414002508599998,
        3.2603588548599998,
        3.0082589018599997,
        3.13413244386,
        3.55231933586,
        2.91122069686,
        2.89493887186,
        2.80699265886,
        2.87589926286,
        2.81023818686
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.83713182076,
      "stddev": 0.09025383042828265,
      "median": 2.81748757386,
      "user": 2.09318076,
      "system": 1.6590256,
      "min": 2.73158372686,
      "max": 3.00519213286,
      "times": [
        2.8246138358599997,
        2.83282854486,
        2.79006616986,
        2.73158372686,
        2.80530996686,
        2.81036131186,
        2.97525389386,
        2.73610424386,
        3.00519213286,
        2.86000438086
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6054275061600003,
      "stddev": 0.13719750689832702,
      "median": 1.5844873003600002,
      "user": 1.2240367600000002,
      "system": 1.3350725,
      "min": 1.46868613086,
      "max": 1.9127968748600002,
      "times": [
        1.5242311508600002,
        1.6622824598600001,
        1.9127968748600002,
        1.5669033538600001,
        1.6020712468600002,
        1.61495901086,
        1.4696690268600001,
        1.46868613086,
        1.5019825928600001,
        1.7306932138600002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.69279588556,
      "stddev": 0.15503748230938863,
      "median": 1.70906233286,
      "user": 1.1593442599999997,
      "system": 1.3164566999999998,
      "min": 1.46248956286,
      "max": 1.93336207886,
      "times": [
        1.54418910186,
        1.80693223086,
        1.6401782078600002,
        1.7658667778600001,
        1.7698223938600002,
        1.93336207886,
        1.8408768928600001,
        1.5119837208600002,
        1.46248956286,
        1.65225788786
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 473.6 ± 62.1 398.1 584.6 1.48 ± 0.20
pacquet@main 558.0 ± 116.7 423.4 698.5 1.74 ± 0.37
pnpr@HEAD 320.2 ± 10.0 303.0 336.6 1.00
pnpr@main 322.2 ± 11.7 309.1 346.4 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.47357805964,
      "stddev": 0.06205603662390278,
      "median": 0.43873164304,
      "user": 0.6360577000000001,
      "system": 0.7786373799999999,
      "min": 0.39808509054,
      "max": 0.5846392255400001,
      "times": [
        0.5243252265400001,
        0.54635382854,
        0.5846392255400001,
        0.39808509054,
        0.42502949854,
        0.43768546354000004,
        0.43884850954000004,
        0.43458164354,
        0.43861477654000003,
        0.50761733354
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5580049879400001,
      "stddev": 0.11666050142239184,
      "median": 0.56825745104,
      "user": 0.7568647,
      "system": 0.8730574799999999,
      "min": 0.42344221554,
      "max": 0.6984904745400001,
      "times": [
        0.6778261835400001,
        0.6897060345400001,
        0.6984904745400001,
        0.6308058695400001,
        0.62447080854,
        0.5120440935400001,
        0.44691383454,
        0.44326294754,
        0.42344221554,
        0.43308741754
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32022941214,
      "stddev": 0.009955300638907939,
      "median": 0.32002348354,
      "user": 0.21430629999999998,
      "system": 0.55933938,
      "min": 0.30304414454,
      "max": 0.33664866054000003,
      "times": [
        0.33664866054000003,
        0.32222184554,
        0.30304414454,
        0.32039625054000004,
        0.31266253554,
        0.31190192254,
        0.33375952754,
        0.32343787154000003,
        0.31965071654,
        0.31857064654
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.32224137923999996,
      "stddev": 0.011695928823075763,
      "median": 0.31996471204,
      "user": 0.2189956,
      "system": 0.5510962800000001,
      "min": 0.30912605454000003,
      "max": 0.34643496054,
      "times": [
        0.32640322854000003,
        0.32675809254,
        0.33389992554000003,
        0.31572865354,
        0.31052972954,
        0.30912605454000003,
        0.31367027854,
        0.32420077054,
        0.31566209854,
        0.34643496054
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.861 ± 0.132 1.764 2.118 5.12 ± 1.02
pacquet@main 1.883 ± 0.050 1.836 1.977 5.18 ± 0.98
pnpr@HEAD 0.373 ± 0.035 0.327 0.430 1.03 ± 0.21
pnpr@main 0.363 ± 0.068 0.328 0.555 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8611023032000003,
      "stddev": 0.13204212268822052,
      "median": 1.8131534042,
      "user": 0.9467306600000001,
      "system": 0.88743552,
      "min": 1.7644354247,
      "max": 2.1183346867000004,
      "times": [
        1.7962456867,
        1.7644354247,
        1.8095221586999999,
        1.7710589627,
        1.7665264527,
        2.0932436657,
        2.1183346867000004,
        1.8534034967000002,
        1.8214678477,
        1.8167846497
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8827559934,
      "stddev": 0.04987532016663004,
      "median": 1.8633772422,
      "user": 0.9862658599999999,
      "system": 0.9327779199999998,
      "min": 1.8361361486999999,
      "max": 1.9765280637,
      "times": [
        1.8606164536999998,
        1.8415451717,
        1.9435362157,
        1.8661380307,
        1.8383591697000001,
        1.9765280637,
        1.9332244487,
        1.8566531126999999,
        1.8361361486999999,
        1.8748231187
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.37304021940000004,
      "stddev": 0.03457385378402154,
      "median": 0.3608315872,
      "user": 0.26255026000000004,
      "system": 0.62198862,
      "min": 0.32707784370000004,
      "max": 0.43013147770000004,
      "times": [
        0.43013147770000004,
        0.41270705770000005,
        0.3522249967,
        0.3505030277,
        0.4055942327,
        0.39070696870000005,
        0.36943817770000004,
        0.3495694057,
        0.34244900570000003,
        0.32707784370000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.36347246420000007,
      "stddev": 0.06801755076429197,
      "median": 0.34471266970000003,
      "user": 0.25836245999999996,
      "system": 0.6093036199999998,
      "min": 0.3276017687,
      "max": 0.5552211377000001,
      "times": [
        0.3530342637,
        0.3497623617,
        0.3276017687,
        0.33624506870000004,
        0.3376758547,
        0.33966297770000003,
        0.3308519387,
        0.35188051270000004,
        0.3527887577,
        0.5552211377000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 233.6 ± 13.7 214.3 258.7 2.43 ± 0.16
pacquet@main 243.7 ± 18.6 227.0 284.1 2.54 ± 0.21
pnpr@HEAD 96.0 ± 2.6 90.7 100.9 1.00
pnpr@main 96.3 ± 2.6 92.1 102.5 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23360576039538455,
      "stddev": 0.013693451182452727,
      "median": 0.22970772978,
      "user": 0.2176690261538461,
      "system": 0.08250241538461539,
      "min": 0.21433223678000002,
      "max": 0.25871097378,
      "times": [
        0.21820118278,
        0.22279758978,
        0.21433223678000002,
        0.22970772978,
        0.23369250478,
        0.22733395178000002,
        0.23934045778000002,
        0.25398252578,
        0.24644435478,
        0.22643524578000002,
        0.22360672578000002,
        0.24228940578,
        0.25871097378
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24374770869666665,
      "stddev": 0.018589857426394657,
      "median": 0.23733567578,
      "user": 0.2215635966666666,
      "system": 0.09226138333333332,
      "min": 0.22696400978,
      "max": 0.28405268578000004,
      "times": [
        0.24231021578,
        0.23796860278,
        0.23670274878,
        0.23506749478,
        0.22696400978,
        0.23905166878,
        0.28078306778,
        0.28405268578000004,
        0.24192370178,
        0.23476184378,
        0.23520706978,
        0.23017939478000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.0960277813662069,
      "stddev": 0.0025732018091914974,
      "median": 0.09601677778,
      "user": 0.02433190413793104,
      "system": 0.01355928275862069,
      "min": 0.09072653478,
      "max": 0.10090964578000002,
      "times": [
        0.09553674678000001,
        0.09484954078,
        0.09458854678,
        0.09703956878000002,
        0.09634357878000001,
        0.10000104178000001,
        0.10090964578000002,
        0.09322136078000001,
        0.09806753078000001,
        0.09636217378,
        0.09981275478000001,
        0.09891522178,
        0.09601677778,
        0.09608190178,
        0.09479500778000001,
        0.09839367978,
        0.09403208078000001,
        0.09072653478,
        0.09435530378000001,
        0.09293577778,
        0.09330524878000002,
        0.09714161378000001,
        0.09584184478,
        0.09509564878000001,
        0.09118854078000001,
        0.09790636478,
        0.09486438978000002,
        0.09637496878000001,
        0.10010226378
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.0962718941248276,
      "stddev": 0.0026295369565121195,
      "median": 0.09641348978000001,
      "user": 0.024580317931034486,
      "system": 0.013065006896551719,
      "min": 0.09214342378000001,
      "max": 0.10254847878000001,
      "times": [
        0.09816960478000002,
        0.09242125078,
        0.09576000978000002,
        0.09330115178000001,
        0.09532037478000001,
        0.09415812878000002,
        0.09641348978000001,
        0.09559368478000001,
        0.09642374978000001,
        0.09407814778000001,
        0.09304503578000001,
        0.09677069978000001,
        0.09372291378000001,
        0.09330098178000001,
        0.09659998478000001,
        0.09726930478000001,
        0.09429818478000002,
        0.09214342378000001,
        0.09507473978000001,
        0.10254847878000001,
        0.09972339578000002,
        0.09840710678000002,
        0.09763400678,
        0.09706192278000002,
        0.10206598278000001,
        0.09580451478000002,
        0.09714255578000001,
        0.09903852478000001,
        0.09859357878000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.159 ± 0.157 0.774 1.315 1.00
pacquet@main 1.422 ± 0.289 1.081 1.924 1.23 ± 0.30
pnpm@HEAD 4.512 ± 0.102 4.362 4.707 3.89 ± 0.54
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1587694701911113,
      "stddev": 0.1574158542606962,
      "median": 1.1742103130800001,
      "user": 1.1047219466666665,
      "system": 0.1829598111111111,
      "min": 0.7735974810800001,
      "max": 1.31547552208,
      "times": [
        1.19748328708,
        1.12863037908,
        1.2797661980800001,
        1.15622552508,
        0.7735974810800001,
        1.1742103130800001,
        1.31547552208,
        1.15521858408,
        1.2483179420800001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.4223922105244444,
      "stddev": 0.2891113537780442,
      "median": 1.3288632370800002,
      "user": 1.3455268355555556,
      "system": 0.30281547777777784,
      "min": 1.08117949508,
      "max": 1.92361418108,
      "times": [
        1.2949488790800001,
        1.3288632370800002,
        1.31555398108,
        1.22430467408,
        1.4094529960800002,
        1.92361418108,
        1.8888153460800001,
        1.08117949508,
        1.33479710508
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.51179720008,
      "stddev": 0.10181508743141672,
      "median": 4.49802416008,
      "user": 6.920605724444445,
      "system": 0.4009284777777778,
      "min": 4.3624557910799995,
      "max": 4.70732773708,
      "times": [
        4.44637399008,
        4.70732773708,
        4.42673491508,
        4.495582618079999,
        4.55093704608,
        4.49802416008,
        4.512631068079999,
        4.3624557910799995,
        4.60610747508
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.865 ± 0.195 4.690 5.240 1.31 ± 0.06
pacquet@main 4.882 ± 0.180 4.683 5.268 1.32 ± 0.06
pnpr@HEAD 3.952 ± 0.214 3.682 4.207 1.07 ± 0.06
pnpr@main 3.711 ± 0.087 3.559 3.842 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.86508063172,
      "stddev": 0.19468828551324466,
      "median": 4.79959007922,
      "user": 2.85005968,
      "system": 2.014574,
      "min": 4.69013182522,
      "max": 5.240407268219999,
      "times": [
        5.240407268219999,
        4.80724128822,
        4.81978695422,
        4.73117974622,
        5.022190236219999,
        4.69013182522,
        4.79193887022,
        5.12670601322,
        4.71855458922,
        4.702669526219999
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.88249733342,
      "stddev": 0.17995072379002977,
      "median": 4.819272312719999,
      "user": 2.84924708,
      "system": 2.0734061,
      "min": 4.68312639122,
      "max": 5.26804785222,
      "times": [
        4.68312639122,
        4.810779977219999,
        4.72141451822,
        4.82776464822,
        4.781758507219999,
        4.783668351219999,
        4.952568277219999,
        4.90442277522,
        5.26804785222,
        5.09142203622
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.95243263392,
      "stddev": 0.2137363692890268,
      "median": 3.96038907172,
      "user": 2.1689893799999997,
      "system": 2.1138193999999997,
      "min": 3.68160810722,
      "max": 4.2074859042199995,
      "times": [
        4.05817954622,
        3.8334588912200003,
        4.13970931322,
        4.2074859042199995,
        3.8625985972200003,
        4.179788665219999,
        4.14039884222,
        3.69973399722,
        3.68160810722,
        3.72136447522
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.71052343622,
      "stddev": 0.0873662477176396,
      "median": 3.72086133922,
      "user": 1.80646828,
      "system": 1.7494358999999995,
      "min": 3.5592501152200002,
      "max": 3.84209216522,
      "times": [
        3.71033910122,
        3.76101897122,
        3.79707739122,
        3.75168609722,
        3.7129941622200002,
        3.84209216522,
        3.60673822122,
        3.72872851622,
        3.6353096212200002,
        3.5592501152200002
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13640
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,806.99 ms
(+6.69%)Baseline: 2,630.89 ms
3,157.07 ms
(88.91%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,764.44 ms
(-0.64%)Baseline: 1,775.88 ms
2,131.06 ms
(82.80%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
398.09 ms
(-5.68%)Baseline: 422.05 ms
506.47 ms
(78.60%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
214.33 ms
(+12.61%)Baseline: 190.32 ms
228.39 ms
(93.85%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,504.79 ms
(+4.82%)Baseline: 2,389.59 ms
2,867.50 ms
(87.35%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,690.13 ms
(+5.40%)Baseline: 4,449.75 ms
5,339.70 ms
(87.84%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
312.55 ms
(+19.60%)Baseline: 261.32 ms
313.59 ms
(99.67%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
773.60 ms
(+5.24%)Baseline: 735.08 ms
882.10 ms
(87.70%)
🐰 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/13640
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,468.69 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
327.08 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
303.04 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
90.73 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,443.95 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,681.61 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
386.02 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 74bf5dd into main Aug 4, 2026
36 of 38 checks passed
@zkochan
zkochan deleted the refactor-package-manager-modules branch August 4, 2026 14:41
KSXGitHub pushed a commit that referenced this pull request Aug 4, 2026
Picks up the install-module decomposition (#13640 and
#13624), the headless-install extraction (#13637), the
PnP-loader fix for virtual-store-only installs (#13636), and a
dependency bump (#13631).

`build_workspace_state` moved out of `install.rs` into the new
`install/workspace_state.rs`, and its two call sites moved into
`install/apply_materialization.rs` and `install/prepare_modules_state.rs`.
This branch's `Sys: Clock` seam and the `::<Host>` turbofish are
re-applied at those new homes.

# Conflicts:
#	pnpm/crates/package-manager/src/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