Skip to content

feat(store): packageProvider allows custom package building - #13639

Closed
wmertens wants to merge 30 commits into
pnpm:mainfrom
wmertens:package-provider
Closed

wmertens wants to merge 30 commits into
pnpm:mainfrom
wmertens:package-provider

Conversation

@wmertens

@wmertens wmertens commented Aug 4, 2026 •

Copy link
Copy Markdown

Summary

This adds a packageProvider setting that outsources package building to a chosen third party.

This allows implementing #11703 via a custom package provider for Nix, without changing the lockfile, and thus being a local-only configuration setting.

When using the Nix pnpm provider, these are the advantages:

  • system-wide pnpm caching
  • system-wide GC of unused modules
  • can leverage the Nix caching ecosystem for production deploys

It does not replace pnpm, in fact it elevates its importance with Nix users (no other package manager is as well suited to Nix as pnpm).

Squash Commit Body

feat: support external package providers

Add a `packageProvider` setting that delegates package materialization to an
external executable. When set, pnpm sends the resolved dependency graph as
JSON over stdio (protocol v1: nodes keyed by depPath, carrying name, version,
tarball/integrity, directory or git resolution, dependency aliases, engine,
optional flag, and inline patch content). The provider materializes every
package as a read-only directory whose node_modules contains the package next
to symlinks to its dependencies (e.g. a Nix store path), and pnpm points
node_modules straight at the returned locations.

With a provider active, pnpm skips tarball fetching, importing into the
content-addressable store, virtual-store linking, and lifecycle scripts —
the provider is responsible for all of them. Direct-dependency, hoist, and
bin linking work unchanged on the provided paths.

Details:

- Patched dependencies are sent inline (content + hash) as provider inputs.
- Optional dependencies the provider cannot build are reported as skipped
  and scrubbed from the graph instead of failing the install.
- Directory (file:/injected) and git-by-commit resolutions are supported;
  git dependencies that need a prepare step are rejected with
  ERR_PNPM_PACKAGE_PROVIDER_UNSUPPORTED.
- Both the full install path and the headless/frozen fast path materialize
  through the provider; resolution data is threaded into the headless graph
  and fetching is skipped entirely.
- The setting is accepted in the global config file as well as
  pnpm-workspace.yaml, so it can be enabled user-wide.
- pacquet parity: the same setting, protocol, and error codes are
  implemented in the Rust CLI; both stacks produce byte-identical provider
  requests from the same lockfile.

A reference provider that materializes packages into the Nix store lives at
https://github.com/wmertens/pnpm-nix-provider.

Closes pnpm/pnpm#11703

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

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 support for configuring an external package provider.
    • Packages can be materialized in read-only directories, with project dependencies linked to those locations.
    • Provider-backed installs support dependency graphs, patches, optional dependencies, frozen lockfiles, local packages, and lifecycle scripts.
    • Added configuration through workspace settings, global configuration, environment variables, and command-line options.
  • Bug Fixes
    • Added validation and clear errors for unsupported provider scenarios and invalid provider responses.
  • Tests
    • Added comprehensive integration and end-to-end coverage for provider-backed installations.

wmertens and others added 7 commits July 7, 2026 09:44
When package-provider points to an executable, pnpm sends it the
resolved dependency graph (JSON over stdio, protocol v1) and the
provider materializes every depPath as a read-only directory whose
node_modules holds the package next to symlinks to its dependencies,
for example Nix store paths. pnpm then symlinks node_modules directly
to the returned directories and skips importing into the virtual store,
sibling symlinking, dependency bin linking, and lifecycle scripts (the
provider runs them during materialization). Resolution runs with
skipFetching so tarballs are not downloaded into pnpm's own store.

The frozen/headless install paths and pacquet delegation are disabled
when a provider is configured; porting the setting to pacquet is still
pending. Git, directory, and patched dependencies are rejected with
ERR_PNPM_PACKAGE_PROVIDER_UNSUPPORTED.

A reference implementation for the Nix store is developed separately
in the pnpm-nix project.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Patches are deterministic, so the patch content is just another
provider input: pnpm reads each patch file and sends it inline in the
request (patch: { content, hash }); a changed patch yields a new
materialized path while an unchanged one is reused. The depPath already
encodes the patch hash, so graph identity and the returned directories
stay consistent. Only a patch whose file is unavailable (hash-only) is
still rejected.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Request nodes now carry an optional flag, and the provider may respond
with a skipped list of optional depPaths whose build failed. Those
packages are removed from the graph (links to them scrubbed from
dependents) and recorded in the skipped set, matching the behavior of
optional dependencies whose build fails in a regular install. Skipping
a non-optional package is rejected as an invalid provider response.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Local directory resolutions (file: deps and injected workspace
packages) are sent as absolute directories, and git resolutions as
repo+commit. Git dependencies that need a prepare step are still
rejected. Only unknown resolution kinds abort now.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Frozen and repeat installs no longer fall back to the full install: the
headless installer sends the lockfile-derived graph to the provider,
repoints the precomputed direct-dependency maps at the returned
directories, and skips store fetching (a new skipFetching option in the
graph builder), virtual-store imports, sibling symlinks, dependency bin
linking, and buildModules. Provider-skipped optional packages join the
skipped set.

The provider client moves into deps-restorer (deps-installer already
depends on it) and becomes graph-shape agnostic: the headless graph is
keyed by install dir with dirs as children references, so requests are
keyed by the node's depPath and results mapped back through the graph
key. The headless graph nodes now carry the full resolution (tarball
URL included) instead of the raw lockfile snapshot resolution.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Port of the package-provider setting from the TypeScript CLI: when
configured, both the fresh-lockfile and frozen-lockfile install paths
send the resolved graph to the provider executable (protocol v1, JSON
over stdio) and symlink direct dependencies, hoisted aliases, and
project bins straight to the returned read-only directories. Virtual
store population, sibling symlinks, per-slot bin linking, tarball
prefetching, and the build phase are skipped; provider-skipped optional
packages join the persisted skipped set. VirtualStoreLayout::slot_dir
resolves through a per-key provider path map so every downstream
consumer picks up the provider directories unchanged.

Config plumbing follows the frozen-store model (PNPM_TYPES, config-file
keys, workspace yaml with env expansion, env overlay); conflicts with
node-linker!=isolated and the global virtual store are rejected with
the same codes and messages as the TypeScript CLI, as are the
ERR_PNPM_PACKAGE_PROVIDER_* request/response errors.

Verified end to end against the pnpm-nix provider: pacquet and the
TypeScript CLI produce byte-identical store paths from the same
lockfile and can frozen-install each other's projects.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
The pre-push lint gate flagged the word 'repointed' and the tsconfig
project references missing engine/runtime/system-version.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
@wmertens
wmertens requested a review from zkochan as a code owner August 4, 2026 11:46
Copilot AI lite review requested due to automatic review settings August 4, 2026 11:46
@welcome

welcome Bot commented Aug 4, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@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

Adds the package-provider setting and protocol-v1 integration. Providers receive resolved dependency graphs and return read-only materialized directories. Installers skip local fetching and lifecycle builds, then create absolute symlinks into provider directories.

Changes

Package-provider installation

Layer / File(s) Summary
Configuration and command wiring
pnpm/crates/config/..., pnpm11/config/..., pnpm/crates/cli/...
Adds package-provider configuration, environment and workspace YAML support, CLI help, install propagation, compatibility checks, and workspace-state tracking.
Provider protocol and graph materialization
pnpm/crates/deps-restorer/src/package_provider.rs, pnpm11/installing/deps-restorer/src/packageProvider.ts, pnpm11/installing/deps-resolver/...
Builds protocol-v1 requests, invokes external providers, validates returned paths and skipped optional packages, and supports registry, tarball, directory, Git, and patch inputs.
Provider-backed installation flow
pnpm/crates/package-manager/..., pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm11/installing/deps-installer/...
Skips local fetching, virtual-store materialization, dependency bin linking, and dependency builds when a provider is configured. Registers returned paths for installation and reporting.
Absolute linking and validation
pnpm/crates/fs/..., pnpm11/fs/symlink-dependency/..., pnpm11/installing/linking/..., pnpm/crates/deps-restorer/...
Adds provider-aware virtual-store lookup and absolute directory symlinks for direct and hoisted dependencies. Adds unit, integration, frozen-install, patch, optional-dependency, and failure tests.

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

Sequence Diagram(s)

sequenceDiagram
  participant Install
  participant DependencyResolver
  participant PackageProvider
  participant VirtualStoreLayout
  participant NodeModules
  Install->>DependencyResolver: resolve graph without fetching packages
  DependencyResolver->>PackageProvider: send protocol-v1 graph over stdin
  PackageProvider-->>DependencyResolver: return materialized paths and skipped optionals
  DependencyResolver->>VirtualStoreLayout: register provider paths
  VirtualStoreLayout->>NodeModules: create absolute dependency symlinks
Loading

Assessment against linked issues

Objective Addressed Explanation
Use externally materialized, hash-addressed package directories from a provider [#11703] ✅
Provide dependency metadata and dependency relationships to the external materializer [#11703] ✅
Support dependency linking, optional skips, patches, lifecycle execution, and garbage-collection roots [#11703] ✅

Possibly related PRs

  • pnpm/pnpm#13637: Shares the Rust dependency-restorer and package-manager installation paths.
  • pnpm/pnpm#13640: Overlaps in install configuration and materialization code.
  • pnpm/pnpm#13658: Shares virtual-store layout and frozen-lockfile installation paths.

Suggested labels: product: pnpm@11, product: pacquet, product: pnpr

Suggested reviewers: zkochan

✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch package-provider
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@greptile-apps

greptile-apps Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge because the previously reported provider-invalidation defects are fixed in the current code.

No blocking failure remains: both implementations persist the provider identity and compare it before returning an optimistic up-to-date result.

Reviews (13): Last reviewed commit: "fix: accept drive-less rooted provider p..." | Re-trigger Greptile

Comment thread pnpm11/config/reader/src/Config.ts Resolved

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.

Pull request overview

Adds a new packageProvider / package-provider configuration that delegates package materialization (fetch/build/layout) to an external executable, and wires it through pnpm’s TypeScript install paths and the Rust pacquet implementation to keep both stacks behaviorally aligned.

Changes:

  • TypeScript: introduce provider invocation + request/response protocol wiring, and skip store fetching/import + lifecycle/build/bin-link phases when provider is active.
  • Rust (pacquet): implement the same protocol, error codes/messages, and install-phase skipping behavior; repoint virtual-store layout to provider-returned directories.
  • Config/CLI: expose package-provider via config reader and pnpm install option, add validation for incompatible settings, and add tests + changeset.

Reviewed changes

Copilot reviewed 46 out of 47 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpr/crates/pnpr/src/resolver/resolve.rs Ensures resolve-only server path never consults a package provider.
pnpm11/installing/deps-restorer/tsconfig.json Adds workspace reference needed by provider integration.
pnpm11/installing/deps-restorer/src/packageProvider.ts Implements provider protocol v1 request/response and graph rewiring.
pnpm11/installing/deps-restorer/src/index.ts Exports provider helper and graph-node type for downstream use.
pnpm11/installing/deps-restorer/package.json Adds dependency needed to compute the engine string for provider requests.
pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts Threads skipFetching option into dependency resolution.
pnpm11/installing/deps-resolver/src/resolveDependencies.ts Skips tarball fetch when skipFetching is enabled.
pnpm11/installing/deps-installer/tsconfig.json Adds workspace reference needed by provider integration.
pnpm11/installing/deps-installer/test/packageProvider.ts Adds Jest coverage for provider-based installs (direct, headless, patches, optionals).
pnpm11/installing/deps-installer/src/install/link.ts Invokes provider materialization and disables import/link steps when externally materialized.
pnpm11/installing/deps-installer/src/install/index.ts Disables pacquet delegation and various linking/build steps when provider is enabled.
pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts Adds packageProvider option and rejects incompatible config combinations.
pnpm11/installing/deps-installer/package.json Adds dependency needed to compute the engine string for provider requests.
pnpm11/installing/commands/src/install.ts Exposes --package-provider CLI flag and config key.
pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts Supports building graphs without fetching, while still deriving usable resolutions.
pnpm11/config/reader/src/types.ts Adds package-provider to typed config parsing.
pnpm11/config/reader/src/configFileKey.ts Allows package-provider in config file key whitelist.
pnpm11/config/reader/src/Config.ts Adds packageProvider to the runtime Config interface.
pnpm-lock.yaml Records new workspace dependency links.
pacquet/crates/package-manager/src/virtual_store_layout.rs Adds provider-path mapping so slot resolution can redirect to provider directories.
pacquet/crates/package-manager/src/update.rs Threads configured provider into update path.
pacquet/crates/package-manager/src/remove.rs Threads configured provider into remove path.
pacquet/crates/package-manager/src/package_provider/tests.rs Adds unit tests for request building and response validation parity.
pacquet/crates/package-manager/src/package_provider.rs Implements provider protocol v1, invocation, validation, and parity error codes/messages.
pacquet/crates/package-manager/src/lib.rs Exposes provider module API from crate root.
pacquet/crates/package-manager/src/install/tests.rs Updates install tests for new install struct field.
pacquet/crates/package-manager/src/install.rs Adds provider config threading + config conflict validation.
pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs Skips fetch/materialization/build/bin-link phases and runs provider when configured.
pacquet/crates/package-manager/src/install_package_from_registry/tests.rs Updates config fixture for new field.
pacquet/crates/package-manager/src/install_frozen_lockfile.rs Skips virtual-store phases and runs provider when configured; keeps verification gating.
pacquet/crates/package-manager/src/create_virtual_store.rs Allows returning a default output when virtual-store creation is skipped.
pacquet/crates/package-manager/src/add.rs Threads configured provider into add path.
pacquet/crates/config/src/workspace_yaml.rs Supports packageProvider in workspace/global config YAML.
pacquet/crates/config/src/lib.rs Adds config field documentation for package provider.
pacquet/crates/config/src/env_overlay.rs Adds PACKAGE_PROVIDER environment overlay key.
pacquet/crates/config/src/config_types.rs Adds package-provider to config type + key lists for parity with TS.
pacquet/crates/cli/tests/package_provider.rs Adds pacquet E2E coverage mirroring TS provider tests (skipped on Windows).
pacquet/crates/cli/src/cli_args/unlink.rs Threads configured provider into unlink path.
pacquet/crates/cli/src/cli_args/rebuild.rs Threads configured provider into rebuild path.
pacquet/crates/cli/src/cli_args/prune.rs Threads configured provider into prune path.
pacquet/crates/cli/src/cli_args/link.rs Threads configured provider into link path.
pacquet/crates/cli/src/cli_args/install.rs Threads configured provider into install paths (including pnpr integration).
pacquet/crates/cli/src/cli_args/import.rs Threads configured provider into import path.
pacquet/crates/cli/src/cli_args/fetch.rs Threads configured provider into fetch path.
pacquet/crates/cli/src/cli_args/deploy.rs Threads configured provider into deploy path.
pacquet/crates/cli/src/cli_args/dedupe.rs Threads configured provider into dedupe path.
.changeset/nine-nix-doors-open.md Declares the user-facing release note + version bumps for the new setting.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🧹 Nitpick comments (3)
pacquet/crates/package-manager/src/package_provider.rs (1)

398-410: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Move the patch-file read off the reactor thread.

build_provider_request calls std::fs::read_to_string for every patched dependency. materialize_through_package_provider calls build_provider_request directly on line 283, before the spawn_blocking on line 293. So these blocking reads run on the reactor thread. The provider spawn already uses the blocking pool for the same reason.

Move the whole request build into the spawn_blocking closure, or read the patch files with an async API.

🤖 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 `@pacquet/crates/package-manager/src/package_provider.rs` around lines 398 -
410, Move the blocking request construction, including the
std::fs::read_to_string call in build_provider_request, into the existing
spawn_blocking closure used by materialize_through_package_provider. Ensure
build_provider_request is no longer invoked on the reactor thread, while
preserving its current error handling and provider request behavior.
pacquet/crates/cli/tests/package_provider.rs (2)

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

Assert the complete patch content.

The substring check accepts truncated or substituted patch content that includes "patched". Compare the response value with IS_POSITIVE_PATCH so this test validates the transmitted payload.

Proposed assertion
-    assert!(node["patch"]["content"].as_str().expect("patch content").contains("patched"));
+    assert_eq!(
+        node["patch"]["content"].as_str(),
+        Some(IS_POSITIVE_PATCH),
+    );

As per path instructions, provider tests must exercise the real changed behavior.

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

In `@pacquet/crates/cli/tests/package_provider.rs` around lines 256 - 257, Update
the patch content assertion in the provider test to compare
node["patch"]["content"] directly with IS_POSITIVE_PATCH instead of checking
whether it contains "patched"; keep the existing hash validation unchanged.

Source: Path instructions


379-384: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Exercise restoration of the persisted skip state.

The test checks .modules.yaml but does not run a later installation. A regression that writes the marker but does not restore the skip state would pass. Run a second provider-backed installation while retaining .modules.yaml, then assert that @pnpm.e2e/bar is absent from request["nodes"] and remains absent from node_modules.

As per path instructions, provider tests must exercise the real changed behavior, including the skip-state request contract.

🤖 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 `@pacquet/crates/cli/tests/package_provider.rs` around lines 379 - 384, Extend
the test around the existing .modules.yaml assertion to perform a second
provider-backed installation without deleting the persisted state. Then inspect
the resulting skip-state request and assert `@pnpm.e2e/bar` is absent from
request["nodes"], and verify it remains absent from node_modules; retain the
existing first-install setup and use the test’s existing provider-install
symbols.

Source: Path instructions

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

Inline comments:
In @.changeset/nine-nix-doors-open.md:
- Around line 1-7: Add the pacquet package entry with a minor bump to the
frontmatter of the changeset alongside the existing pnpm and TypeScript package
entries, ensuring both affected products are included in release metadata.

In `@pacquet/crates/cli/tests/package_provider.rs`:
- Around line 35-53: Update the fake provider setup around the dependency-link
creation loop to make every returned package tree read-only after links are
created, without following symlinks. Before changing permissions, recreate any
tree whose depPath may be reused by a later request, and ensure the provider
tests exercise this read-only directory contract.
- Around line 391-396: Add the same Windows-specific test exclusion attribute
used by the neighboring platform-gated tests to
the_install_aborts_when_the_provider_fails, preserving execution on Unix while
skipping the Unix-shebang provider test on Windows.

In `@pacquet/crates/package-manager/src/install_frozen_lockfile.rs`:
- Around line 1315-1329: Update the provider branch around link_top_level_bins
to forward publicly_hoisted_for_post_build for the root importer instead of
passing an empty hoisted slice. Preserve the existing empty list for non-root
importers, matching run_build_phase so publicly hoisted aliases participate in
root bin winner selection.

In `@pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts`:
- Around line 456-465: Extend the packageProvider validation block in
extendInstallOptions to reject configurations where pnprServer is also enabled,
using a dedicated PnpmError conflict code and message. Ensure this validation
runs before installation so pnprServer cannot silently take precedence over
packageProvider, while preserving the existing nodeLinker and
enableGlobalVirtualStore checks.

In `@pnpm11/installing/deps-installer/src/install/index.ts`:
- Around line 405-406: Update the frozen-install delegation branch around the
pacquet execution path to require opts.packageProvider == null, matching the
willDelegateToPacquet predicate. Ensure opts.runPacquet.run() cannot execute
when a package provider is configured, or explicitly reject that configuration
combination.

In `@pnpm11/installing/deps-restorer/src/index.ts`:
- Around line 408-413: The provider-skipped dependencies are added to skipped
after filteredLockfile is created, so the written lockfile can retain them. In
the restore flow around materializeThroughPackageProvider, refilter the current
filteredLockfile after processing providerSkipped while preserving the earlier
importer modifications, and add a frozen-install test that skips an optional
dependency and verifies node_modules/.pnpm/lock.yaml excludes it.

In `@pnpm11/installing/deps-restorer/src/packageProvider.ts`:
- Around line 125-146: Validate the provider response before the skipped-node
loop mutates depGraph: require paths to be a plain object, skipped to be an
array containing only strings, and every retained node’s paths[node.depPath] to
be a non-empty absolute path. Reject malformed values with
PACKAGE_PROVIDER_RESULT_INVALID instead of allowing untyped runtime errors or
relative link targets, while preserving the existing skipped optional-dependency
validation and node setup.
- Around line 159-170: Update invokeProvider around child.stdin.end to register
a one-shot stdin error handler that rejects the current promise with a
PACKAGE_PROVIDER_FAILED PnpmError, including the stream error details. Ensure
EPIPE and other stdin failures are handled without uncaught errors while
preserving the existing child process error and close handling.

---

Nitpick comments:
In `@pacquet/crates/cli/tests/package_provider.rs`:
- Around line 256-257: Update the patch content assertion in the provider test
to compare node["patch"]["content"] directly with IS_POSITIVE_PATCH instead of
checking whether it contains "patched"; keep the existing hash validation
unchanged.
- Around line 379-384: Extend the test around the existing .modules.yaml
assertion to perform a second provider-backed installation without deleting the
persisted state. Then inspect the resulting skip-state request and assert
`@pnpm.e2e/bar` is absent from request["nodes"], and verify it remains absent from
node_modules; retain the existing first-install setup and use the test’s
existing provider-install symbols.

In `@pacquet/crates/package-manager/src/package_provider.rs`:
- Around line 398-410: Move the blocking request construction, including the
std::fs::read_to_string call in build_provider_request, into the existing
spawn_blocking closure used by materialize_through_package_provider. Ensure
build_provider_request is no longer invoked on the reactor thread, while
preserving its current error handling and provider request behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c38902f-c008-4009-b591-75297e81b23b

📥 Commits

Reviewing files that changed from the base of the PR and between e719786 and 13ab22d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (46)
  • .changeset/nine-nix-doors-open.md
  • pacquet/crates/cli/src/cli_args/dedupe.rs
  • pacquet/crates/cli/src/cli_args/deploy.rs
  • pacquet/crates/cli/src/cli_args/fetch.rs
  • pacquet/crates/cli/src/cli_args/import.rs
  • pacquet/crates/cli/src/cli_args/install.rs
  • pacquet/crates/cli/src/cli_args/link.rs
  • pacquet/crates/cli/src/cli_args/prune.rs
  • pacquet/crates/cli/src/cli_args/rebuild.rs
  • pacquet/crates/cli/src/cli_args/unlink.rs
  • pacquet/crates/cli/tests/package_provider.rs
  • pacquet/crates/config/src/config_types.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/add.rs
  • pacquet/crates/package-manager/src/create_virtual_store.rs
  • pacquet/crates/package-manager/src/install.rs
  • pacquet/crates/package-manager/src/install/tests.rs
  • pacquet/crates/package-manager/src/install_frozen_lockfile.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/package_provider.rs
  • pacquet/crates/package-manager/src/package_provider/tests.rs
  • pacquet/crates/package-manager/src/remove.rs
  • pacquet/crates/package-manager/src/update.rs
  • pacquet/crates/package-manager/src/virtual_store_layout.rs
  • pnpm11/config/reader/src/Config.ts
  • pnpm11/config/reader/src/configFileKey.ts
  • pnpm11/config/reader/src/types.ts
  • pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts
  • pnpm11/installing/commands/src/install.ts
  • pnpm11/installing/deps-installer/package.json
  • pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/link.ts
  • pnpm11/installing/deps-installer/test/packageProvider.ts
  • pnpm11/installing/deps-installer/tsconfig.json
  • pnpm11/installing/deps-resolver/src/resolveDependencies.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts
  • pnpm11/installing/deps-restorer/package.json
  • pnpm11/installing/deps-restorer/src/index.ts
  • pnpm11/installing/deps-restorer/src/packageProvider.ts
  • pnpm11/installing/deps-restorer/tsconfig.json
  • pnpr/crates/pnpr/src/resolver/resolve.rs

Comment thread .changeset/nine-nix-doors-open.md Resolved
wmertens and others added 2 commits August 4, 2026 14:59
Provider-materialized directories (e.g. Nix store paths) never move,
while the project directory may, so relativized links through ../
chains would break on any depth change. Direct-dependency and hoisted
links now store the absolute target when a package provider is
configured, in both stacks.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Upstream renamed pacquet/ to pnpm/ and split its package-manager crate,
extracting a deps-restorer crate that mirrors the TypeScript layout. The
provider integration moved accordingly: the package_provider module and
its consumers now live in pacquet-deps-restorer, the Install field is
threaded through the new phase modules of install_with_fresh_lockfile,
and the absolute-symlink helpers plug into the parameterized
force_symlink_inner upstream introduced. New upstream surface handled:
custom fetchers and registry-qualified versions are rejected as
unsupported provider resolutions, and pkgSnapshotToResolution's new
namedRegistries argument is passed on the hoisted resolution.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Copilot AI review requested due to automatic review settings August 5, 2026 14:46
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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.

Pull request overview

Copilot reviewed 62 out of 63 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Suppressed comments (4)

pnpm11/installing/linking/hoist/src/index.ts:356

  • Same as above: this debug log swaps target and link, which is misleading when diagnosing hoist/link problems.
    pnpm11/fs/symlink-dependency/src/forceAbsoluteSymlink.ts:45
  • The final symlink creation also hardcodes 'dir'. For Windows compatibility this should mirror the earlier calls and use 'junction' on win32.
    pnpm11/installing/linking/hoist/src/index.ts:330
  • The debug log swaps target and link (it logs target: dest, link: depLocation). This is inconsistent with other symlink logs (e.g. symlinkDependency) and makes troubleshooting harder.

This issue also appears on line 353 of the same file.
pnpm11/fs/symlink-dependency/src/forceAbsoluteSymlink.ts:29

  • fs.symlink(..., 'dir') on Windows can fail (often EPERM) unless Developer Mode/admin is enabled. pnpm typically uses junctions for directory links on Windows (as symlink-dir does). This should use 'junction' on win32 to keep the new absolute-symlink behavior working cross-platform.

This issue also appears on line 38 of the same file.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pnpm/crates/deps-restorer/src/link_root_component_members.rs (1)

242-248: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Do not write root-component sibling links into provider directories.

With a package provider, slot_modules_dir resolves into the provider-returned package directory. This function then writes a sibling link below that read-only directory. Provider-backed Bit root-component installs will fail.

Add a writable overlay for these links, or use a provider-aware root-component linking 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/deps-restorer/src/link_root_component_members.rs` around lines
242 - 248, Update the root-component sibling-link flow around symlink_package so
links are written to a writable overlay or through a provider-aware linking
path, rather than directly beneath slot_modules_dir when it resolves to a
provider package directory. Preserve the existing member and sibling link
behavior while ensuring provider-backed Bit root-component installs do not write
into read-only provider directories.

Source: Path instructions

pnpm11/installing/deps-installer/src/install/link.ts (1)

154-158: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use opts.skipped when filtering newCurrentLockfile.

Lines 137-139 add provider-skipped paths to opts.skipped. This call replaces that set with new Set(). The returned current lockfile can therefore retain a provider-skipped optional package as installed.

Remove the skipped: new Set() override. Add a focused provider-skip test that checks the generated current lockfile.

As per path instructions, “include tests for provider-backed installs and failures.”

Proposed fix
   const newCurrentLockfile = filterLockfileByImporters(opts.wantedLockfile, projectIds, {
     ...filterOpts,
     failOnMissingDependencies: true,
-    skipped: new Set(),
   })
🤖 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 `@pnpm11/installing/deps-installer/src/install/link.ts` around lines 154 - 158,
Update the `newCurrentLockfile` filtering in `link.ts` to reuse `opts.skipped`
instead of replacing it with a fresh set, so provider-skipped optional packages
stay excluded from the generated current lockfile. Keep the existing
`filterLockfileByImporters` call and its other options intact, and add a focused
test around the provider-backed install flow that verifies the current lockfile
reflects the skipped provider paths.

Source: Path instructions

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

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

Consider covering the absolute writer in the stale-replacement path.

All five call sites pass pacquet_fs::symlink_dir, so the existing assertions stay valid. No test exercises update_stale_hoist_symlink with pacquet_fs::symlink_dir_absolute, which is the writer symlink_hoisted_dependencies selects when layout.uses_provider() is true. The end-to-end provider test checks that freshly created hoist links are absolute, but not that a replaced stale link is absolute.

Add one case that seeds a stale link, calls update_stale_hoist_symlink with pacquet_fs::symlink_dir_absolute, and asserts std::fs::read_link(&dest) returns an absolute 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/deps-restorer/src/hoist/tests.rs` around lines 664 - 671, Add a
test case alongside the existing update_stale_hoist_symlink tests that seeds a
stale link, invokes update_stale_hoist_symlink with
pacquet_fs::symlink_dir_absolute, and verifies std::fs::read_link(&dest) returns
an absolute path; leave the existing pacquet_fs::symlink_dir assertions
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/config/src/workspace_yaml.rs`:
- Line 992: Update the workspace configuration method containing
substitute_optional_string for package_provider so the final value is resolved
relative to the pnpm-workspace.yaml parent/base directory, not the process
working directory. Apply environment substitution first, then normalize the
resulting path, make it absolute, and reject values that escape the workspace
root; add tests covering both relative provider paths and environment-expanded
values.

In `@pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs`:
- Around line 1103-1106: After inserting provider-skipped keys in the loop over
provided.skipped, invoke extend_skipped_with_dependency_closure() again before
computing the hoist plan, so optional-only descendants are also marked skipped
for subsequent hoisting, package-map output, and provider requests.
- Around line 1003-1011: Update the package_provider handling around
CreateVirtualStoreOutput and the subsequent hoisted-linker path so a package
provider cannot reach hoisted linking with an empty cas_paths_by_pkg_id map.
Either implement provider-path support for the hoisted linker, or validate and
reject the combined package_provider/nodeLinker=hoisted configuration before
linking begins.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Around line 1551-1566: In the package-provider branch of the dependency build
flow, emit an IgnoredScriptsLog with Debug level, an empty package_names list,
and config.strict_dep_builds before returning empty BuildModulesOutput. Keep the
existing non-provider behavior unchanged.

In `@pnpm11/installing/deps-installer/test/packageProvider.ts`:
- Around line 63-67: Add a focused test in the package-provider suite that
configures packageProvider through the supported CLI/configuration source, runs
the real pnpm CLI install, and verifies the provider is used rather than calling
installer APIs directly. Ensure pnpm/dist/pnpm.mjs is rebuilt before any bundled
CLI end-to-end test, including the related cases identified by the review.

In `@pnpm11/installing/deps-restorer/src/index.ts`:
- Around line 413-415: Reject configurations that enable both enablePnp and
packageProvider before provider materialization runs, using the existing
conflict validation pattern for enableGlobalVirtualStore. Update the relevant
validation around materializeThroughPackageProvider so writePnpFile cannot
generate mappings from virtualStoreDir when provider directories are used.

---

Outside diff comments:
In `@pnpm/crates/deps-restorer/src/link_root_component_members.rs`:
- Around line 242-248: Update the root-component sibling-link flow around
symlink_package so links are written to a writable overlay or through a
provider-aware linking path, rather than directly beneath slot_modules_dir when
it resolves to a provider package directory. Preserve the existing member and
sibling link behavior while ensuring provider-backed Bit root-component installs
do not write into read-only provider directories.

In `@pnpm11/installing/deps-installer/src/install/link.ts`:
- Around line 154-158: Update the `newCurrentLockfile` filtering in `link.ts` to
reuse `opts.skipped` instead of replacing it with a fresh set, so
provider-skipped optional packages stay excluded from the generated current
lockfile. Keep the existing `filterLockfileByImporters` call and its other
options intact, and add a focused test around the provider-backed install flow
that verifies the current lockfile reflects the skipped provider paths.

---

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/hoist/tests.rs`:
- Around line 664-671: Add a test case alongside the existing
update_stale_hoist_symlink tests that seeds a stale link, invokes
update_stale_hoist_symlink with pacquet_fs::symlink_dir_absolute, and verifies
std::fs::read_link(&dest) returns an absolute path; leave the existing
pacquet_fs::symlink_dir assertions unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 000938f1-2c97-4e22-89b1-1a53dccbb1c5

📥 Commits

Reviewing files that changed from the base of the PR and between e719786 and 73af45e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (62)
  • .changeset/nine-nix-doors-open.md
  • pnpm/crates/cli/src/cli_args/dedupe.rs
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/cli/src/cli_args/fetch.rs
  • pnpm/crates/cli/src/cli_args/import.rs
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/cli/src/cli_args/link.rs
  • pnpm/crates/cli/src/cli_args/prune.rs
  • pnpm/crates/cli/src/cli_args/rebuild.rs
  • pnpm/crates/cli/tests/package_provider.rs
  • pnpm/crates/config/src/config_types.rs
  • pnpm/crates/config/src/env_overlay.rs
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/workspace_yaml.rs
  • pnpm/crates/deps-restorer/src/create_symlink_layout.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store.rs
  • pnpm/crates/deps-restorer/src/hoist.rs
  • pnpm/crates/deps-restorer/src/hoist/tests.rs
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
  • pnpm/crates/deps-restorer/src/install_package_from_registry.rs
  • pnpm/crates/deps-restorer/src/install_package_from_registry/tests.rs
  • pnpm/crates/deps-restorer/src/lib.rs
  • pnpm/crates/deps-restorer/src/link_root_component_members.rs
  • pnpm/crates/deps-restorer/src/package_provider.rs
  • pnpm/crates/deps-restorer/src/package_provider/tests.rs
  • pnpm/crates/deps-restorer/src/symlink_direct_dependencies.rs
  • pnpm/crates/deps-restorer/src/symlink_package.rs
  • pnpm/crates/deps-restorer/src/virtual_store_layout.rs
  • pnpm/crates/fs/src/symlink_dir.rs
  • pnpm/crates/napi/src/install.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/linking.rs
  • pnpm/crates/package-manager/src/link_manifest_link_deps.rs
  • pnpm/crates/package-manager/src/remove.rs
  • pnpm/crates/package-manager/src/update.rs
  • pnpm11/config/reader/src/Config.ts
  • pnpm11/config/reader/src/configFileKey.ts
  • pnpm11/config/reader/src/types.ts
  • pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts
  • pnpm11/fs/symlink-dependency/src/forceAbsoluteSymlink.ts
  • pnpm11/fs/symlink-dependency/src/index.ts
  • pnpm11/installing/commands/src/install.ts
  • pnpm11/installing/deps-installer/package.json
  • pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/link.ts
  • pnpm11/installing/deps-installer/test/packageProvider.ts
  • pnpm11/installing/deps-installer/tsconfig.json
  • pnpm11/installing/deps-resolver/src/resolveDependencies.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts
  • pnpm11/installing/deps-restorer/package.json
  • pnpm11/installing/deps-restorer/src/index.ts
  • pnpm11/installing/deps-restorer/src/packageProvider.ts
  • pnpm11/installing/deps-restorer/tsconfig.json
  • pnpm11/installing/linking/direct-dep-linker/src/linkDirectDeps.ts
  • pnpm11/installing/linking/hoist/package.json
  • pnpm11/installing/linking/hoist/src/index.ts
  • pnpm11/installing/linking/hoist/tsconfig.json
  • pnpr/crates/pnpr/src/resolver/resolve.rs
🚧 Files skipped from review as they are similar to previous changes (15)
  • pnpm11/config/reader/src/Config.ts
  • pnpm11/installing/deps-installer/package.json
  • pnpm11/installing/deps-installer/tsconfig.json
  • .changeset/nine-nix-doors-open.md
  • pnpm11/installing/deps-restorer/tsconfig.json
  • pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts
  • pnpm11/installing/deps-restorer/package.json
  • pnpr/crates/pnpr/src/resolver/resolve.rs
  • pnpm11/installing/commands/src/install.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencies.ts
  • pnpm11/installing/deps-installer/src/install/extendInstallOptions.ts
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts
  • pnpm11/config/reader/src/configFileKey.ts
  • pnpm11/config/reader/src/types.ts

Cross-stack fixes from the pnpm#13639 review round:

- packageProvider now participates in the workspace-state settings
  comparison (TS) and the optimistic repeat-install drift check
  (pacquet), so enabling, disabling, or switching the provider
  invalidates the up-to-date fast path instead of leaving node_modules
  materialized by the previous backend.
- The frozen install no longer delegates to pacquet when a provider is
  configured, and configuring packageProvider together with pnprServer
  is rejected (ERR_PNPM_CONFIG_CONFLICT_PACKAGE_PROVIDER_PNPR_SERVER)
  in both stacks.
- Provider responses are validated before the graph is mutated: paths
  must be a plain object of absolute non-empty strings and skipped a
  string list, in both stacks.
- A provider that exits before reading its whole stdin no longer
  surfaces an unhandled EPIPE in the TypeScript client; the exit code
  drives the PACKAGE_PROVIDER_FAILED error, matching pacquet.
- Provider-skipped optionals are dropped from the current lockfile on
  the headless path (pacquet already filtered them), with a frozen
  install test.
- The pacquet frozen provider arm passes the publicly-hoisted alias
  list to the root importer's top-level bin link, same as
  run_build_phase.
- Both fake-provider fixtures freeze the returned trees read-only so
  the tests exercise the immutable-store contract; the TypeScript
  provider suite is skipped on Windows (shebang script), matching the
  pacquet cfg_attr gates.
- The changeset names pacquet per the Rust-product changeset policy.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018tFfCTLULzKh2KHmmgQcXj
Copilot AI review requested due to automatic review settings August 5, 2026 19:59
Comment on lines +27 to +30
if install.drivers.config.package_provider.is_some() {
super::link_provider_top_level_bins::<Reporter>(
&install,
phase.linked,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Provider builds bypass approval gates 📜 Skill insight ⛨ Security

The provider branches return without running the normal build phase, and the provider request
carries no AllowBuildPolicy or per-package approval decisions. When packageProvider is enabled,
lifecycle scripts for registry, directory, Git, and patched dependencies can therefore run outside
pnpm's approval and denial policy.
Agent Prompt
## Issue description
Package-provider materialization bypasses pnpm's lifecycle build approval policy and does not tell the provider which dependencies may run scripts.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/install_frozen_lockfile/materialization.rs[27-38]
- pnpm/crates/deps-restorer/src/package_provider/request.rs[43-50]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile/on_disk/building.rs[24-28]

## Recommended Fix
Apply the existing build policy before provider execution and include explicit per-package approval decisions in the provider protocol. Ensure every supported dependency source and both frozen and fresh install paths fail closed for unapproved lifecycle builds.

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

Comment on lines +115 to +116
source.git =
Some(ProviderGitSource { repo: git.repo.clone(), commit: git.commit.clone() });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Git subdirectory packages build wrong 📜 Skill insight ⛨ Security

populate_resolution reduces a Git resolution to repo and commit, omitting the existing path
component from the provider request. A dependency that selects a package below the repository root
is consequently materialized from a different location in both the Rust and TypeScript provider
paths.
Agent Prompt
## Issue description
Package-provider requests discard the subdirectory component of Git resolutions, changing the opaque dependency identity and selecting the repository root.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/package_provider/request.rs[109-117]
- pnpm/crates/deps-restorer/src/package_provider/types.rs[61-65]
- pnpm11/installing/deps-restorer/src/packageProvider.ts[97-101]

## Recommended Fix
Add the optional Git `path` field to both provider protocol implementations and copy it byte-for-byte from the lockfile resolution. Add tests in both stacks using a Git dependency whose package is in a repository subdirectory.

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

Comment on lines +168 to +171
let Some(v) = self.package_provider.take() else { return };
let is_path = v.contains('/') || v.contains(std::path::MAIN_SEPARATOR);
config.package_provider =
Some(if is_path { resolve(base_dir, &v).to_string_lossy().into_owned() } else { v });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Repositories execute code during install 🐞 Bug ⛨ Security

packageProvider is accepted from repository-controlled workspace or npm configuration and passed
directly to process creation without a trust or script-policy check. Opening an untrusted repository
and running an install therefore executes its selected program even when lifecycle scripts are
disabled.
Agent Prompt
## Issue description
Repository-controlled configuration can select a package-provider executable that pnpm runs during installation without confirmation or an execution-policy check.

## Fix Focus Areas
- pnpm/crates/config/src/workspace_yaml/apply.rs[164-171]
- pnpm/crates/deps-restorer/src/package_provider/response.rs[11-20]
- pnpm11/config/reader/src/configFileKey.ts[51-56]
- pnpm11/installing/deps-restorer/src/packageProvider.ts[168-194]

## Recommended Fix
Do not accept package providers from project-level `.npmrc` or `pnpm-workspace.yaml`. Restrict executable selection to trusted user/global configuration or an explicit CLI approval mechanism in both implementations, following the existing token-helper origin checks, and add tests proving repository configuration cannot launch a provider.

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

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to bf9e6e1

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Exclude skipped packages from install state

Remove provider-skipped optional packages from the currentLockfile. This aligns
with the headless path and ensures the lockfile accurately reflects the actual
installed state.

pnpm11/installing/deps-installer/src/install/link.ts [146-148]

   for (const depPath of providerSkipped) {
     opts.skipped.add(depPath)
+    if (currentLockfile.packages != null) {
+      delete currentLockfile.packages[depPath]
+    }
   }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: This fixes a critical logical inconsistency that could leave the lockfile in an invalid state, although the suggested code omits the opts. prefix before currentLockfile.

Medium
Prevent provider directory collisions

Use base64url encoding for directory mapping to prevent collisions.

pnpm/crates/cli/tests/package_provider.rs [26]

-const subdir = (depPath) => depPath.replace(/[^A-Za-z0-9._@-]/g, '+')
+const subdir = (depPath) => Buffer.from(depPath, 'utf8').toString('base64url')

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 4

__

Why: This is a minor improvement for a test utility to prevent potential directory collisions, though it is unlikely to cause issues in the current test cases.

Low
Security
Prevent protocol dictionary prototype pollution

Initialize protocol dictionaries with Object.create(null) instead of {}. This
prevents prototype pollution vulnerabilities from malicious dependency aliases.

pnpm11/installing/deps-restorer/src/packageProvider.ts [84-108]

-  const nodes: Record<string, ProviderRequestNode> = {}
+  const nodes: Record<string, ProviderRequestNode> = Object.create(null)
 ...
-    const deps: ProviderRequestNode['deps'] = {}
+    const deps: ProviderRequestNode['deps'] = Object.create(null)

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: Using Object.create(null) for dictionary objects is a good defense-in-depth practice to prevent prototype pollution from untrusted external keys.

Medium
Bound external provider response size

Enforce a maximum size limit on the external provider's response. Terminate the
child process if the limit is exceeded to prevent memory exhaustion.

pnpm11/installing/deps-restorer/src/packageProvider.ts [177-179]

-    child.stdout.on('data', (chunk) => {
+    const maxResponseBytes = 64 * 1024 * 1024
+    let outputBytes = 0
+    child.stdout.on('data', (chunk: string) => {
+      outputBytes += Buffer.byteLength(chunk)
+      if (outputBytes > maxResponseBytes) {
+        child.kill()
+        reject(new PnpmError(
+          'PACKAGE_PROVIDER_RESULT_INVALID',
+          `The package provider at "${packageProvider}" returned a response larger than ${maxResponseBytes} bytes`
+        ))
+        return
+      }
       output += chunk
     })

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: Enforcing a buffer size limit is a solid defensive measure against memory exhaustion if the external provider returns an unexpectedly large output.

Medium
General
Escape provider paths in YAML

Escape single quotes in the provider_bin path before appending it to the YAML
file.

pnpm/crates/cli/tests/package_provider.rs [115-120]

 fn set_package_provider(workspace: &Path, provider_bin: &Path) {
+    let provider_bin = provider_bin.to_string_lossy().replace('\'', "''");
     append_workspace_yaml(
         workspace,
-        &format!("packageProvider: '{}'\n", provider_bin.to_string_lossy()),
+        &format!("packageProvider: '{provider_bin}'\n"),
     );
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 4

__

Why: Escaping single quotes prevents potential invalid YAML formatting when paths contain ', which is a good edge-case consideration even though temporary test paths rarely contain them.

Low
Preserve fallback engine identity

Use engine_name as a fallback if the deferred engine task fails or is cancelled.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/on_disk/building.rs [167-175]

 pub(super) async fn settle_engine_name(
     deferred: Option<pnpm_deps_restorer::materialization_plan::DeferredEngineName>,
     engine_name: Option<String>,
 ) -> Option<String> {
     match deferred {
-        Some(deferred) => deferred.handle.await.ok().flatten(),
+        Some(deferred) => deferred.handle.await.ok().flatten().or(engine_name),
         None => engine_name,
     }
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 1

__

Why: The suggestion proposes a marginal fallback for a deferred probe failure, but altering the intended behavior of the copied settle_engine_name function provides negligible impact.

Low
  • Update

Previous suggestions

Suggestions up to commit 42116bf
CategorySuggestion                                                                                                                                    Impact
Possible issue
Require fully absolute provider paths

Replace has_root() with is_absolute() for correct absolute path validation on
Windows.

pnpm/crates/deps-restorer/src/package_provider/response.rs [84-89]

-if dir.is_empty() || !Path::new(dir).has_root() {
+if dir.is_empty() || !Path::new(dir).is_absolute() {
     return Err(PackageProviderError::RelativePath {
         dep_path: dep_path.clone(),
         dir: dir.clone(),
     });
 }
Suggestion importance[1-10]: 7

__

Why: Using is_absolute() ensures paths are properly absolute across all OSes, preventing potential path resolution bugs on Windows where has_root() behaves differently.

Medium
Validate materialized package directories

Verify that the paths returned by the package provider actually exist and
contain the required node_modules/ directory structure.

pnpm/crates/deps-restorer/src/package_provider/response.rs [90]

-out_paths.insert(key.clone(), PathBuf::from(dir));
+let dir = PathBuf::from(dir);
+let package_dir = dir.join("node_modules").join(key.name.to_string());
+if !package_dir.is_dir() {
+    return Err(PackageProviderError::InvalidPackagePath {
+        dep_path: dep_path.clone(),
+        path: package_dir,
+    });
+}
+out_paths.insert(key.clone(), dir);
Suggestion importance[1-10]: 4

__

Why: While validating the returned paths improves safety and failure isolation from bad provider outputs, adding blocking filesystem I/O (is_dir()) in this iteration loop could negatively impact performance.

Low
Suggestions up to commit f5f3738
CategorySuggestion                                                                                                                                    Impact
Security
Preserve frozen lockfile verification

Run standard lockfile verification even when verification_override is None.

pnpm/crates/deps-restorer/src/install_frozen_lockfile/provider_build.rs [59-61]

-if let Some(verification) = verification_override {
-    verification.await?;
-}
+super::verification::verify_before_materialization(
+    install,
+    verification_override,
+)
+.await?;
Suggestion importance[1-10]: 9

__

Why: Skipping lockfile verification in the provider branch creates a critical security loophole; ensuring standard verification always runs prevents untrusted package dependencies from being linked.

High
Possible issue
Reject skipped required dependencies

Validate that packages skipped by the provider are actually optional. Return an
error if a required dependency is skipped to prevent broken installations.

pnpm/crates/deps-restorer/src/installability/skipped_snapshots.rs [98-105]

-/// Record snapshots that a package provider failed to materialize.
-pub fn add_provider_failed(&mut self, keys: impl IntoIterator<Item = PackageKey>) {
+/// Record optional snapshots that a package provider failed to materialize.
+pub fn add_provider_failed(
+    &mut self,
+    keys: impl IntoIterator<Item = PackageKey>,
+    snapshots: &HashMap<PackageKey, SnapshotEntry>,
+) -> Result<(), PackageKey> {
+    let keys: Vec<_> = keys.into_iter().collect();
+    if let Some(key) = keys
+        .iter()
+        .find(|key| !snapshots.get(*key).is_some_and(|snapshot| snapshot.optional))
+    {
+        return Err(key.clone());
+    }
+
     for key in keys {
         self.fetch_failed.remove(&key);
         self.optional_excluded.remove(&key);
         self.installability.insert(key);
     }
+    Ok(())
 }
Suggestion importance[1-10]: 8

__

Why: This prevents package providers from silently skipping required dependencies, which could lead to broken installations and corrupted state.

Medium
Exclude skipped packages from lockfile

Remove skipped optional packages from currentLockfile.packages to prevent them
from being incorrectly recorded as installed. This ensures parity with the
headless install behavior.

pnpm11/installing/deps-installer/src/install/link.ts [142-150]

 if (opts.packageProvider) {
   const providerSkipped = await materializeThroughPackageProvider(opts.packageProvider, depGraph as unknown as Record<string, PackageProviderGraphNode>, {
     lockfileDir: opts.lockfileDir,
   })
   for (const depPath of providerSkipped) {
     opts.skipped.add(depPath)
+    if (currentLockfile.packages != null) {
+      delete currentLockfile.packages[depPath]
+    }
   }
 }
Suggestion importance[1-10]: 8

__

Why: This suggestion points out a critical bug where skipped optional packages would be incorrectly recorded in the current lockfile during a normal install, ensuring consistency with the headless install path.

Medium
Propagate provider input failures

Return and propagate the io::Result from the stdin writer thread to correctly
handle early closure or writing failures.

pnpm/crates/deps-restorer/src/package_provider/response.rs [22-29]

 let writer = std::thread::spawn(move || {
     use std::io::Write as _;
-    let _ = stdin.write_all(&request_json);
+    stdin.write_all(&request_json)
 });
 let output = child
     .wait_with_output()
     .map_err(|source| PackageProviderError::Spawn { provider: provider.to_string(), source })?;
-writer.join().expect("provider stdin writer must not panic");
+writer
+    .join()
+    .map_err(|_| PackageProviderError::Spawn {
+        provider: provider.to_string(),
+        source: std::io::Error::other("package provider stdin writer panicked"),
+    })?
+    .map_err(|source| PackageProviderError::Spawn {
+        provider: provider.to_string(),
+        source,
+    })?;
Suggestion importance[1-10]: 7

__

Why: Properly propagating I/O errors from the stdin writer prevents silent truncation bugs that could lead to unexpected or successful but invalid provider responses.

Medium
Reject missing provider slot paths

Panic or fail immediately if a missing key is encountered while in active
provider mode, rather than falling back to the default virtual-store slot.

pnpm/crates/deps-restorer/src/virtual_store_layout.rs [409-413]

-if let Some(provider_paths) = &self.provider_paths
-    && let Some(dir) = provider_paths.get(key)
-{
-    return dir.clone();
+if let Some(provider_paths) = &self.provider_paths {
+    return provider_paths
+        .get(key)
+        .unwrap_or_else(|| {
+            panic!("package provider returned no path for snapshot {key}")
+        })
+        .clone();
 }
Suggestion importance[1-10]: 7

__

Why: Failing immediately on missing provider keys prevents the program from silently falling back to potentially non-existent or stale fallback paths, avoiding hard-to-track bugs.

Medium
Suggestions up to commit 65b9186
CategorySuggestion                                                                                                                                    Impact
Possible issue
Reject invalid provider skips

Validate that provider-reported skipped packages are actually optional
dependencies.

pnpm/crates/deps-restorer/src/installability/skipped_snapshots.rs [98-105]

-/// Record snapshots that a package provider failed to materialize.
-pub fn add_provider_failed(&mut self, keys: impl IntoIterator<Item = PackageKey>) {
+/// Record optional snapshots that a package provider failed to materialize.
+pub fn add_provider_failed(
+    &mut self,
+    keys: impl IntoIterator<Item = PackageKey>,
+    snapshots: &HashMap<PackageKey, SnapshotEntry>,
+) -> Result<(), Vec<PackageKey>> {
+    let keys = keys.into_iter().collect::<Vec<_>>();
+    let invalid = keys
+        .iter()
+        .filter(|key| {
+            !snapshots
+                .get(*key)
+                .is_some_and(|snapshot| snapshot.optional)
+        })
+        .cloned()
+        .collect::<Vec<_>>();
+    if !invalid.is_empty() {
+        return Err(invalid);
+    }
+
     for key in keys {
         self.fetch_failed.remove(&key);
         self.optional_excluded.remove(&key);
         self.installability.insert(key);
     }
+    Ok(())
 }
Suggestion importance[1-10]: 8

__

Why: Validating provider-reported skipped keys against the lockfile prevents faulty or malicious providers from silently skipping required dependencies.

Medium
Preserve the fallback engine identifier

Add .or(engine_name) to preserve the fallback engine identifier when the
deferred probe fails.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/on_disk/building.rs [167-175]

 pub(super) async fn settle_engine_name(
     deferred: Option<pnpm_deps_restorer::materialization_plan::DeferredEngineName>,
     engine_name: Option<String>,
 ) -> Option<String> {
     match deferred {
-        Some(deferred) => deferred.handle.await.ok().flatten(),
+        Some(deferred) => deferred.handle.await.ok().flatten().or(engine_name),
         None => engine_name,
     }
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion fixes a potential logic bug where the synchronous engine_name is discarded if the deferred probe fails or returns None.

Medium
Preserve externally owned symlinks

Retain the external-link ownership check even when absolute links are enabled,
permitting replacement only if the existing symlink belongs to a managed
provider root.

pnpm11/installing/linking/hoist/src/index.ts [649-656]

-  if (!opts.absolute && !isSubdir(opts.virtualStoreDir, existingSymlink) && !isSubdir(opts.internalPnpmDir, existingSymlink)) {
+  const isManagedProviderLink = opts.providerRoots?.some((root) => isSubdir(root, existingSymlink)) ?? false
+  if (
+    !isSubdir(opts.virtualStoreDir, existingSymlink) &&
+    !isSubdir(opts.internalPnpmDir, existingSymlink) &&
+    !isManagedProviderLink
+  ) {
     hoistLogger.debug({
       skipped: dest,
       existingSymlink,
       reason: 'symlink_target_is_external',
     })
     return
   }
Suggestion importance[1-10]: 8

__

Why: Bypassing the external-link ownership check when absolute links are enabled is dangerous, as it allows overwriting arbitrary user-created symlinks.

Medium
Reject drive-relative provider paths

Replace has_root() with is_absolute() for path validation to properly handle
Windows paths.

pnpm/crates/deps-restorer/src/package_provider/response.rs [84-89]

-if dir.is_empty() || !Path::new(dir).has_root() {
+if dir.is_empty() || !Path::new(dir).is_absolute() {
     return Err(PackageProviderError::RelativePath {
         dep_path: dep_path.clone(),
         dir: dir.clone(),
     });
 }
Suggestion importance[1-10]: 7

__

Why: Using is_absolute() instead of has_root() prevents issues on Windows where paths can have a root without a drive letter, improving cross-platform reliability.

Medium
Guarantee absolute symlink targets

Ensure the target path is absolute by resolving it before creating the symlink.

pnpm11/fs/symlink-dependency/src/forceAbsoluteSymlink.ts [19-25]

 export async function forceAbsoluteSymlink (
   target: string,
   link: string,
   opts?: { overwrite?: boolean }
 ): Promise<{ reused: boolean }> {
+  target = path.resolve(target)
   try {
     await fs.symlink(target, link, SYMLINK_TYPE)
Suggestion importance[1-10]: 7

__

Why: Resolving the target path ensures it is absolute, guarding against callers passing relative paths and causing broken links.

Medium
Prune skipped dependency subgraphs

Prune all unreachable nodes from the dependency graph after removing
provider-skipped optional packages.

pnpm11/installing/deps-restorer/src/packageProvider.ts [146-154]

   skippedKeys.add(key!)
   delete depGraph[key!]
 }
 for (const node of Object.values(depGraph)) {
-  if (skippedKeys.size > 0) {
-    for (const [alias, childKey] of Object.entries(node.children)) {
-      if (skippedKeys.has(childKey)) delete node.children[alias]
-    }
+  for (const [alias, childKey] of Object.entries(node.children)) {
+    if (skippedKeys.has(childKey)) delete node.children[alias]
   }
+}
 
+const reachableKeys = collectReachableGraphKeys(depGraph, opts.rootKeys)
+for (const key of Object.keys(depGraph)) {
+  if (!reachableKeys.has(key)) delete depGraph[key]
+}
+
+for (const node of Object.values(depGraph)) {
+
Suggestion importance[1-10]: 7

__

Why: Failing to prune unreachable transitive dependencies of skipped optional packages can lead to them being hoisted and recorded unnecessarily.

Medium
General
Safely serialize provider paths

Serialize the packageProvider path to JSON to prevent YAML syntax errors.

pnpm/crates/cli/tests/package_provider.rs [115-120]

 fn set_package_provider(workspace: &Path, provider_bin: &Path) {
+    let provider = serde_json::to_string(&provider_bin.to_string_lossy())
+        .expect("serialize provider path");
     append_workspace_yaml(
         workspace,
-        &format!("packageProvider: '{}'\n", provider_bin.to_string_lossy()),
+        &format!("packageProvider: {provider}\n"),
     );
 }
Suggestion importance[1-10]: 4

__

Why: Using serde_json::to_string safely escapes paths in tests, avoiding potential test failures when paths contain single quotes.

Low
Prevent provider directory collisions

Use hexadecimal encoding for dependency paths in the test provider to prevent
directory name collisions.

pnpm/crates/cli/tests/package_provider.rs [26]

-const subdir = (depPath) => depPath.replace(/[^A-Za-z0-9._@-]/g, '+')
+const subdir = (depPath) => Buffer.from(depPath, 'utf8').toString('hex')
Suggestion importance[1-10]: 2

__

Why: While a lossy string replacement could hypothetically cause collisions in the fake test provider, it does not affect existing test scenarios, making this a very minor improvement.

Low

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 review overview

🟡 Changes recommended

Unresolved critical security/correctness findings and multiple moderate integration, parity, and release issues block approval.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity

Open (3)
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment on lines +17 to +23
#[display("The package provider does not support the resolution of {dep_path} ({kind})")]
#[diagnostic(code(ERR_PNPM_PACKAGE_PROVIDER_UNSUPPORTED))]
UnsupportedResolution {
#[error(not(source))]
dep_path: String,
kind: &'static str,
},
Comment on lines +493 to +500
for (const directDependencies of Object.values(directDependenciesByImporterId)) {
for (const [alias, dir] of Object.entries(directDependencies)) {
const node = graph[dir]
if (node != null) {
directDependencies[alias] = node.dir
} else if (dirsBefore.has(dir)) {
delete directDependencies[alias]
}
Comment on lines +26 to +29
skipped: &plan.skipped,
patches: patches.as_ref(),
engine: plan.engine_name.as_deref(),
config,
Copilot AI review requested due to automatic review settings September 26, 2026 02:37
@qodo-code-review

Copy link
Copy Markdown

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

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 review overview

🟡 Changes recommended

Unresolved critical and moderate findings remain, including build-policy bypasses and provider work before lockfile verification.

Review effort: Lite
Findings: 6 High severity · 1 Medium severity

Open (7)
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Add missing workspace.state and deps.status changesets

.changeset/​nine-nix-doors-open.md:5

This changeset omits the two published packages changed by the diff: @pnpm/workspace.state gains the persisted packageProvider setting, and @pnpm/deps.status now includes it in status checks. Existing changesets include these packages when their source changes (for example, .changeset/arch-change-invalidates-up-to-date.md and .changeset/quick-oranges-ignore-optionals.md), so add them with the appropriate bumps or their published artifacts will miss the release metadata.

Comment on lines +13 to +23
/// Inputs required to build and dispatch a package provider request.
pub struct PackageProviderInputs<'a> {
pub package_provider: &'a str,
pub lockfile_dir: &'a Path,
pub snapshots: Option<&'a HashMap<PackageKey, SnapshotEntry>>,
pub packages: Option<&'a HashMap<PackageKey, PackageMetadata>>,
pub skipped: &'a SkippedSnapshots,
pub patches: Option<&'a HashMap<PackageKey, ExtendedPatchInfo>>,
pub engine: Option<&'a str>,
pub config: &'static Config,
}
Comment on lines +209 to +215
self::provider::maybe_materialize_through_package_provider(
self.install.drivers.config,
self.install.projects.lockfile_dir,
scope.lockfile(built_lockfile),
self.resolved.patches.record.as_deref(),
plan,
)
Comment on lines +478 to +480
if (opts.packageProvider) {
const dirsBefore = new Set(Object.keys(graph))
const providerSkipped = await materializeThroughPackageProvider(opts.packageProvider, graph, { lockfileDir })
Comment on lines +76 to +82
export async function materializeThroughPackageProvider (
packageProvider: string,
depGraph: Record<string, PackageProviderGraphNode>,
opts: {
lockfileDir: string
}
): Promise<DepPath[]> {
Copilot AI review requested due to automatic review settings September 26, 2026 02:55
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 42116bf

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 review overview

🟡 Changes recommended

Unresolved critical and moderate provider protocol, path, and install-state issues remain.

Review effort: Lite
Findings: 9 High severity · 1 Medium severity

Open (10)
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Previously missed (2)

In code that hasn't changed since last review

Medium severity CLI package-provider override is silently dropped

pnpm/​crates/​config/​src/​config_types/​routing.rs:50

Adding this key to the config-file allowlist does not wire pacquet's --config.package-provider command-line override: ConfigOverrides has no package_provider field or setter/copy path, so the install-affecting setting is silently dropped when supplied through the generic CLI config syntax. Add it to the override layer (including the same path resolution) if command-line configuration is supported.

Medium severity Git prepare scripts are never detected

pnpm11/​installing/​deps-restorer/​src/​packageProvider.ts:100

prepare is never populated on the graph nodes built by lockfileToDepGraph (that constructor only carries the lockfile snapshot fields), so this check is always false in both the full and headless paths. A git dependency with a prepare script is therefore delegated even though the provider contract says it must be rejected, and the provider cannot reproduce pnpm's prepare/build step; thread the resolver's prepare metadata through the graph or reject this case from data that is actually available, with a regression test.

Comment on lines +71 to +76
let version = metadata.version
.clone()
.or_else(|| match key.suffix.version() {
VersionPart::Semver(_) => Some(key.suffix.version().to_string()),
VersionPart::RegistryQualified { version, .. } => Some(version.to_string()),
VersionPart::File(_) | VersionPart::NonSemver(_) => None,
Comment on lines +47 to +50
pub(crate) struct ProviderRequestNode {
pub(crate) name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) version: Option<String>,
Comment on lines +34 to +35
/** Git resolution, deterministic by commit. */
git?: { repo: string, commit: string }
@qodo-code-review

Copy link
Copy Markdown

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

@zkochan zkochan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! All 62 CI checks are green across Linux, Windows, and macOS, and all perfectionist lints and line limit constraints are satisfied.

wmertens and others added 2 commits September 28, 2026 14:47
# Conflicts:
#	pnpm/crates/cli/src/cli_args/install.rs
#	pnpm/crates/cli/src/cli_args/install/pnpr_resolution.rs
#	pnpm/crates/config/src/env_overlay.rs
#	pnpm/crates/deps-restorer/src/install_frozen_lockfile/materialization.rs
#	pnpm/crates/deps-restorer/src/install_frozen_lockfile/planning.rs
#	pnpm/crates/deps-restorer/src/symlink_direct_dependencies.rs
#	pnpm11/installing/linking/hoist/src/index.ts
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
wmertens and others added 2 commits September 29, 2026 21:41
…der as git sources

A github:/gitlab:/bitbucket: dependency resolves to a download tarball
whose lockfile entry has no integrity, so the provider bridge rejected it
on every install from the lockfile. Reuse building.policy's git-host URL
parser (now exported as parseGitHostedTarballUrl, returning repo and ref)
to pass it as the commit-addressed git source instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	pnpm/crates/package-manager/src/install_with_fresh_lockfile/materialization.rs
@vsumner

vsumner commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

This is great! Can I help land this? @zkochan @wmertens ?

@zkochan

zkochan commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

We already have side effects cache in pnpm. So, I am experimenting with remote side-effects cache. It was vibecoded. I did not try it yet myself but overall I think it should be part of core pnpm because it overlaps with a feature we had for years. It also could be part of the pnpr registry. But maybe we could support other providers too if needed.

@zkochan zkochan closed this Oct 1, 2026
@wmertens

wmertens commented Oct 1, 2026

Copy link
Copy Markdown
Author

@zkochan the idea is really that the files are kept in the Nix store, but with a side effects cache it would still be copied locally, no?

@zkochan

zkochan commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

I don't feel safe delegating so much of pnpm's work to another tool. We are getting a new package manager every week already. I don't want nix to be the next competitor of the project.

I would rather make the first move myself and compete with nix.

@vsumner

vsumner commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

I don't feel safe delegating so much of pnpm's work to another tool. We are getting a new package manager every week already. I don't want nix to be the next competitor of the project.

I would rather make the first move myself and compete with nix.

I completely agree. I want nix to own what is good at immutable repeatable builds/dependencies and pnpm to own the resolutions assembly.

If you look at https://casita.rs/ it has great examples of rust, but it encapsulates what I'm trying to accomplish.

@wmertens

wmertens commented Oct 2, 2026

Copy link
Copy Markdown
Author

@zkochan nix specifically has tooling to handle pnpm, it is not a competitor. This PR makes it so the modules are stored in nix, but pnpm still does the heavy lifting.

By cooperating with Nix, pnpm gains functionality it can never achieve:

  • system-wide pnpm caching
  • system-wide GC of unused modules
  • can leverage the Nix caching ecosystem for production deploys

Nix is the system-wide extension of pnpm.

@VanCoding

VanCoding commented Nov 19, 2026 •

Copy link
Copy Markdown

I agree with @wmertens nix is in no way a competitor to pnpm. Integrating the two tools would just make working with PNPM in Nix projects better and open up new possibilities.

If you consider Nix a competitor then not as a javascript package manager and rather as a storage layer (the Nix store). Nix has zero built in functionality to deal with javascript dependencies or to replace a package manager in the ecosystem. (so no commands to install packages, figure out dependency trees, or generating lock files). What nix can do, tough, is fetching files from the internet, checking their hash, and storing & de-duplicating them globally based on an already existing lockfile (where all the hashes are present).

This is why this is basically suggested as a storage interface. People would still need to use the normal pnpm cli (or npm, or yarn, if implemented there, too) for managing their dependencies, and wouldn't even know packages get stored in the nix store now.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants