Skip to content

Fix builds and patches with read-only package stores - #13060

Closed
vsumner wants to merge 10 commits into
pnpm:mainfrom
vsumner:codex/writable-build-projections
Closed

vsumner wants to merge 10 commits into
pnpm:mainfrom
vsumner:codex/writable-build-projections

Conversation

@vsumner

@vsumner vsumner commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Packages that are about to run build scripts, or are opened by pnpm patch, need to change files after pnpm imports them from the store. With a read-only store, those project files could stay read-only or remain hardlinked to the store.

This change completes pnpm's existing clone-or-copy behavior: it creates private, owner-writable package files before publishing the completed import. A healthy private copy is reused, while a read-only, hardlinked, or otherwise unsafe target is replaced through the existing staging path.

Installers select that behavior only for packages that will actually be patched or built. Packages restored from an existing side-effects cache stay on the ordinary import path because their build has already finished. The same rule covers isolated and hoisted installs, git-hosted preparation, patch workspaces, and deploy output. Shared store files stay unchanged.

The same behavior is implemented in the TypeScript CLI and Pacquet.

Related to #11703.

Squash Commit Body

Complete the existing clone-or-copy import method so it produces private, owner-writable package files before publishing the completion marker. Reuse a healthy private projection, but replace targets that are read-only, hardlinked, symlinked, or otherwise unsafe.

Select clone-or-copy only for packages that are about to be patched or built. Already-built side-effects cache entries stay on the ordinary import path. Apply the same rule to isolated and hoisted installs, patch workspaces, git-hosted preparation directories, deploy output, and bundled dependencies.

Pacquet follows the same ownership rules. Platform-specific permission and hard-link checks live in its existing filesystem crate, and stale package trees are replaced without changing the immutable source store.

Related to pnpm/pnpm#11703.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

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


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Packages requiring patching or build steps are now installed through private, owner-writable projections.
    • Original read-only package store files remain unchanged during installation and preparation.
    • Writable projections are safely recreated when permissions change or existing files are shared with the store.
  • Bug Fixes

    • Improved handling of read-only files, symlinks, junctions, and preserved dependencies during package imports.
    • Enhanced merging of bundled and preserved dependencies, including scoped packages.

@coderabbitai

coderabbitai Bot commented Jul 15, 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

Read-only package stores now produce private owner-writable projections for patched and build-required packages. Rust and JavaScript importers add permission handling, clone-or-copy behavior, symlink protection, merge recovery, and platform-specific tests.

Changes

Writable package projections

Layer / File(s) Summary
Filesystem permission support
pnpm/crates/fs/*
Adds cross-platform owner-writable path handling, hard-link inspection, and symlink-safe filesystem operations.
Rust indexed-directory writable imports
pnpm/crates/package-manager/src/import_indexed_dir*, pnpm/crates/config/src/lib.rs
Clone-or-copy imports create and maintain private writable package trees, repair read-only projections, and preserve or merge node_modules during staging recovery.
JavaScript clone-or-copy importer
pnpm11/fs/indexed-pkg-importer/src/*, pnpm11/fs/indexed-pkg-importer/test/*
Clone-or-copy imports create writable projections, reuse valid projections, replace invalid ones, sanitize projected paths, and merge scoped modules.
Rust package-manager routing
pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rs, pnpm/crates/package-manager/src/link_hoisted_modules.rs, pnpm/crates/package-manager/src/*/tests.rs
Patched and build-from-CAS packages use the effective CloneOrCopy method, with progress reporting and tests updated accordingly.
Build, patch, and cross-platform validation
pnpm11/fetching/*, pnpm11/patching/*, pnpm11/store/*, .changeset/*
Git-hosted imports record build requirements; tests exercise read-only sources and verify unchanged stores and writable projections; package patch metadata is added.

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

Sequence Diagram(s)

sequenceDiagram
  participant PackageManager
  participant IndexedImporter
  participant ReadOnlyStore
  participant WritableProjection
  PackageManager->>IndexedImporter: import patched or build-required package
  IndexedImporter->>ReadOnlyStore: read package files
  IndexedImporter->>WritableProjection: clone or copy with owner-write permissions
  WritableProjection-->>PackageManager: writable installed package
  PackageManager->>WritableProjection: apply patch or build changes
  ReadOnlyStore-->>PackageManager: unchanged source content
Loading

Possibly related issues

  • pnpm/pnpm#11633 — The changes support the Rust pacquet installer’s build, patched dependency, and installation parity work.

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

Suggested reviewers: zkochan, copilot

✨ Finishing Touches
🧪 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.

@vsumner
vsumner marked this pull request as ready for review July 15, 2026 22:48
@vsumner
vsumner requested a review from zkochan as a code owner July 15, 2026 22:48
Copilot AI review requested due to automatic review settings July 15, 2026 22:48
@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 →

@codecov-commenter

codecov-commenter commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.50336% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.55%. Comparing base (f15d67c) to head (f8852d8).
⚠️ Report is 85 commits behind head on main.

Files with missing lines Patch % Lines
...m/crates/package-manager/src/import_indexed_dir.rs 72.76% 73 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13060      +/-   ##
==========================================
+ Coverage   85.54%   85.55%   +0.01%     
==========================================
  Files         499      499              
  Lines       79884    80199     +315     
==========================================
+ Hits        68339    68618     +279     
- Misses      11545    11581      +36     

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

This PR updates pnpm v11 (TypeScript) and pacquet (Rust) to ensure packages that may be modified after being imported from the content-addressable store (build-script candidates, patch workspaces, cached side effects, git-hosted prepare dirs, deploy output, etc.) get a private owner-writable projection without changing permissions or contents of the shared store files (related to #11703).

Changes:

  • Switch mutation candidates to clone-or-copy and ensure their on-disk projections are owner-writable while keeping store objects read-only.
  • Extend coverage to patching, git-hosted prepare flow, cached build output, and deploy output; add/adjust tests for read-only store scenarios.
  • Implement equivalent “make writable” behavior in pacquet by threading a make_writable flag through import/link paths and adding a safe chmod helper.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm11/store/create-cafs-store/src/index.ts Selects clone-or-copy for mutation candidates and applies owner-write to imported projections.
pnpm11/store/controller/test/index.ts Adds tests ensuring writable projections don’t mutate read-only store files and respects custom import hooks.
pnpm11/patching/commands/test/patch.test.ts Makes patch tests validate behavior when store files are read-only.
pnpm11/patching/commands/src/writePackage.ts Imports patch workspaces as build/mutation candidates to get writable projections.
pnpm11/fs/indexed-pkg-importer/src/index.ts Exports sanitizeFilenamePath for reuse by store logic.
pnpm11/fs/indexed-pkg-importer/src/importIndexedDir.ts Extracts sanitizeFilenamePath helper and uses it for sanitized import retries.
pnpm11/fetching/tarball-fetcher/test/fetch.ts Adds coverage ensuring git-hosted fetch doesn’t mutate read-only sources.
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts Imports git-hosted prepare dirs as writable projections.
pnpm/crates/package-manager/src/patch.rs Enables writable projections for patch workspaces in pacquet.
pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs Adds test ensuring hoisted build candidates are writable and private vs CAS.
pnpm/crates/package-manager/src/link_hoisted_modules.rs Enables make_writable for hoisted patch/build candidates.
pnpm/crates/package-manager/src/import_indexed_dir/tests.rs Adds test verifying writable imports replace store hardlinks with private writable copies.
pnpm/crates/package-manager/src/import_indexed_dir.rs Threads make_writable through import, forces clone-or-copy, and chmods via safe helper.
pnpm/crates/package-manager/src/create_virtual_store.rs Exposes build-candidate detection helper for reuse.
pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs Adds tests for writable projections for build and patched snapshots.
pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rs Chooses effective import method and make_writable per snapshot (patch/build).
pnpm/crates/package-manager/src/build_modules/tests.rs Ensures cached side effects remain writable and don’t mutate the source blob.
pnpm/crates/package-manager/src/build_modules.rs Materializes side effects using writable import options.
pnpm/crates/fs/src/file_mode.rs Adds cross-platform “make owner writable” helpers (fd-based on Unix).
pnpm/crates/fs/Cargo.toml Adds libc dependency for Unix O_NOFOLLOW usage.
pnpm/crates/cli/src/cli_args/deploy.rs Ensures deploy output import uses writable projections.
Cargo.lock Records new libc dependency resolution.
.changeset/writable-build-projections.md Adds a changeset describing the read-only-store fix across pnpm and pacquet.

💡 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: 5

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

Inline comments:
In `@pnpm/crates/package-manager/src/build_modules/tests.rs`:
- Around line 829-834: Update the test setup at
pnpm/crates/package-manager/src/build_modules/tests.rs:829-834 to use
cross-platform Permissions::set_readonly() instead of Unix-only PermissionsExt.
At pnpm/crates/package-manager/src/build_modules/tests.rs:902-911, assert
readonly status on all platforms for the original store/CAS and writable status
for projected files, while keeping only the inode assertion Unix-specific and
removing the unnecessary PermissionsExt import.

In `@pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs`:
- Around line 244-260: Extend the writable-projection tests with the required
cross-platform assertions: in
pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs at lines
244-260, add Windows readonly checks for package_json and target; at lines
302-308, add Unix inode/permission checks and Windows readonly checks for both
store and projection. In
pnpm/crates/package-manager/src/import_indexed_dir/tests.rs at lines 100-113,
assert package_json remains readonly in the existing Windows block. In
pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs at lines 174-187,
add Windows checks that store_file is readonly and installed is writable.

In `@pnpm11/fetching/tarball-fetcher/test/fetch.ts`:
- Around line 707-719: Update the readOnlyCafs setup around importPackage and
the fetch.gitHostedTarball assertion to record each source file’s original mode,
then restore those modes in a finally block that always runs after the
fetch/assertion. Preserve the original CAFS source/store contents and executable
bits rather than restoring every file to a fixed 0o644 mode.

In `@pnpm11/store/create-cafs-store/src/index.ts`:
- Around line 41-52: Update createPackageImporterAsync to use asynchronous
helper variants for writable-import filesystem checks and permission updates
instead of synchronous existsSync/statSync/openSync/fstatSync/fchmodSync
operations. Implement the async variants using concurrent filesystem work where
independent, and route the makeWritable path through them while preserving the
existing synchronous helpers for the sync importer.
- Around line 137-149: The hasStoreHardlinks function must resolve invalid
filenames to the same sanitized fallback path used by makePackageWritable before
checking existence or inode identity. Reuse that existing sanitization logic,
treat missing or unresolvable targets conservatively as hardlinks, and ensure
the check prevents makePackageWritable from modifying shared store/CAS inodes.
🪄 Autofix (Beta)

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: b1c6d8fd-50ae-446b-be20-61326e9e1278

📥 Commits

Reviewing files that changed from the base of the PR and between ca66b76 and bf46735.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (22)
  • .changeset/writable-build-projections.md
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/fs/Cargo.toml
  • pnpm/crates/fs/src/file_mode.rs
  • pnpm/crates/package-manager/src/build_modules.rs
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rs
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs
  • pnpm/crates/package-manager/src/create_virtual_store.rs
  • pnpm/crates/package-manager/src/import_indexed_dir.rs
  • pnpm/crates/package-manager/src/import_indexed_dir/tests.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs
  • pnpm/crates/package-manager/src/patch.rs
  • pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts
  • pnpm11/fetching/tarball-fetcher/test/fetch.ts
  • pnpm11/fs/indexed-pkg-importer/src/importIndexedDir.ts
  • pnpm11/fs/indexed-pkg-importer/src/index.ts
  • pnpm11/patching/commands/src/writePackage.ts
  • pnpm11/patching/commands/test/patch.test.ts
  • pnpm11/store/controller/test/index.ts
  • pnpm11/store/create-cafs-store/src/index.ts

@greptile-apps

greptile-apps Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

Safe to merge for Linux and macOS; the clone-or-copy path is broken on Windows for read-only store files due to a missing access right on the file descriptor passed to fchmodSync.

The core logic is sound and well-tested. One P1 bug affects Windows users of the new clone-or-copy mode when store files are read-only, which is the common case. The Rust counterpart has the correct fix, confirming the intent. All other paths (clone, hardlink, copy) are unaffected.

pnpm11/fs/indexed-pkg-importer/src/index.ts — specifically the makeOwnerWritable function and its Windows branch.

Reviews (9): Last reviewed commit: "fix(store): harden writable projection r..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: f8852d8918e4

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.688 ± 0.175 2.492 2.981 1.65 ± 0.17
pacquet@main 2.680 ± 0.153 2.527 2.994 1.64 ± 0.16
pnpr@HEAD 1.682 ± 0.195 1.397 1.965 1.03 ± 0.14
pnpr@main 1.631 ± 0.124 1.480 1.885 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6880553117200003,
      "stddev": 0.1746387813186477,
      "median": 2.62670793772,
      "user": 2.2569752,
      "system": 1.8386310200000004,
      "min": 2.49234633772,
      "max": 2.98123124572,
      "times": [
        2.58622506072,
        2.5326826207199997,
        2.60205620272,
        2.54757288772,
        2.49234633772,
        2.71861938872,
        2.95257947172,
        2.65135967272,
        2.98123124572,
        2.8158802287199998
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.67997277652,
      "stddev": 0.1525031915842343,
      "median": 2.61416462772,
      "user": 2.3401204,
      "system": 1.7785724199999997,
      "min": 2.52699167572,
      "max": 2.99394449872,
      "times": [
        2.9038085427199998,
        2.52699167572,
        2.60416822572,
        2.69985004372,
        2.61970076272,
        2.99394449872,
        2.60377660872,
        2.68736361672,
        2.55149529772,
        2.60862849272
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6816774772199998,
      "stddev": 0.19489435813324119,
      "median": 1.6813624972199999,
      "user": 1.5163237999999999,
      "system": 1.6413051199999997,
      "min": 1.39650622172,
      "max": 1.96542988972,
      "times": [
        1.7096767447199999,
        1.92206865372,
        1.63879693972,
        1.6530482497199999,
        1.39650622172,
        1.78546596672,
        1.46485459472,
        1.47075132772,
        1.96542988972,
        1.8101761837199999
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.63134347152,
      "stddev": 0.12438655393210347,
      "median": 1.61854233022,
      "user": 1.4980071000000001,
      "system": 1.62779162,
      "min": 1.4795046647199999,
      "max": 1.88530213572,
      "times": [
        1.58471644872,
        1.48269824372,
        1.88530213572,
        1.61014070972,
        1.6501495477199999,
        1.6269439507199999,
        1.66680924872,
        1.55572107072,
        1.77144869472,
        1.4795046647199999
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 332.9 ± 45.4 283.0 436.6 1.12 ± 0.19
pacquet@main 296.8 ± 28.6 244.7 350.1 1.00
pnpr@HEAD 324.4 ± 42.6 266.4 414.2 1.09 ± 0.18
pnpr@main 335.1 ± 40.1 254.3 379.0 1.13 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.33289518144,
      "stddev": 0.04542015807411336,
      "median": 0.32568860574,
      "user": 0.33869657999999997,
      "system": 0.8813401999999998,
      "min": 0.28298960774000004,
      "max": 0.43659780274000004,
      "times": [
        0.33059932474000003,
        0.30505547874000005,
        0.28298960774000004,
        0.32077788674,
        0.34223503274000006,
        0.37705212274000005,
        0.43659780274000004,
        0.33428818274000005,
        0.30831595274,
        0.29104042274
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.29681978274,
      "stddev": 0.028552252422506787,
      "median": 0.29956048124,
      "user": 0.28093087999999994,
      "system": 0.7566999999999999,
      "min": 0.24465698474000003,
      "max": 0.35012939474000004,
      "times": [
        0.24465698474000003,
        0.29161426374000005,
        0.26396186174,
        0.31776232274000005,
        0.29015526874,
        0.29622688974000005,
        0.30527925974000003,
        0.35012939474000004,
        0.30551750874000005,
        0.30289407274
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32438543404000003,
      "stddev": 0.04259159888353684,
      "median": 0.32318130274,
      "user": 0.33370817999999997,
      "system": 0.8287828999999999,
      "min": 0.26635609574,
      "max": 0.41418415674000003,
      "times": [
        0.26635609574,
        0.32125110674,
        0.36278035274000003,
        0.29853714574,
        0.29486516774000004,
        0.34177553974,
        0.41418415674000003,
        0.28577623974000005,
        0.32511149874,
        0.33321703674
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.33508554754000003,
      "stddev": 0.04006497415245031,
      "median": 0.34123020174,
      "user": 0.3126378799999999,
      "system": 0.8170691999999999,
      "min": 0.25431508374,
      "max": 0.37895919974000003,
      "times": [
        0.32876921974,
        0.33625743674,
        0.34620296674,
        0.37001085574000003,
        0.37514728874000003,
        0.35981697874,
        0.37895919974000003,
        0.29678488974,
        0.30459155574,
        0.25431508374
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.184 ± 0.086 3.069 3.364 1.95 ± 0.21
pacquet@main 3.134 ± 0.082 3.001 3.283 1.92 ± 0.21
pnpr@HEAD 1.705 ± 0.103 1.576 1.914 1.04 ± 0.13
pnpr@main 1.636 ± 0.172 1.468 1.941 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.1842000970800006,
      "stddev": 0.08551353052532935,
      "median": 3.17507535988,
      "user": 2.67623378,
      "system": 2.0050592600000003,
      "min": 3.06926116588,
      "max": 3.3638909048800003,
      "times": [
        3.18653712088,
        3.2190789098800003,
        3.12125243388,
        3.26749430088,
        3.11426604088,
        3.13387209088,
        3.06926116588,
        3.16361359888,
        3.20273440388,
        3.3638909048800003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.13433578738,
      "stddev": 0.08198474157232269,
      "median": 3.14150064838,
      "user": 2.52527688,
      "system": 1.8431621599999999,
      "min": 3.00113670188,
      "max": 3.28310454488,
      "times": [
        3.16419357888,
        3.22562820688,
        3.08931697088,
        3.08977017288,
        3.13886191888,
        3.15544516988,
        3.05176123088,
        3.00113670188,
        3.14413937788,
        3.28310454488
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.70549368478,
      "stddev": 0.10261423144938997,
      "median": 1.6982479073799999,
      "user": 1.58669508,
      "system": 1.86626096,
      "min": 1.57632065488,
      "max": 1.9143554408799999,
      "times": [
        1.77019138788,
        1.62154007988,
        1.57632065488,
        1.6814308788799999,
        1.7898855168799999,
        1.58266127888,
        1.69295106288,
        1.70354475188,
        1.72205579488,
        1.9143554408799999
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6355194208800001,
      "stddev": 0.17222961432632602,
      "median": 1.5762445568799999,
      "user": 1.4406555799999998,
      "system": 1.6579209599999998,
      "min": 1.46765067188,
      "max": 1.94100117388,
      "times": [
        1.6101160158799999,
        1.9164102678800001,
        1.94100117388,
        1.6990665028799998,
        1.51416834888,
        1.46765067188,
        1.5423730978799999,
        1.53565174688,
        1.46849522088,
        1.66026116188
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 583.6 ± 29.1 545.3 639.3 2.19 ± 0.13
pacquet@main 694.0 ± 57.1 616.7 782.6 2.61 ± 0.23
pnpr@HEAD 284.7 ± 13.6 268.2 314.0 1.07 ± 0.06
pnpr@main 266.0 ± 9.3 251.5 281.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5836476109800002,
      "stddev": 0.02906117491094941,
      "median": 0.58514950028,
      "user": 0.71350668,
      "system": 0.7453809399999999,
      "min": 0.54528921478,
      "max": 0.6392747307800001,
      "times": [
        0.55197827178,
        0.58484602878,
        0.5855301167800001,
        0.6187464007800001,
        0.54528921478,
        0.5946708407800001,
        0.56482439378,
        0.56586313978,
        0.5854529717800001,
        0.6392747307800001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6940472010800001,
      "stddev": 0.05705019078566592,
      "median": 0.6907936967800001,
      "user": 0.86459658,
      "system": 0.76893024,
      "min": 0.6166951377800001,
      "max": 0.7826385367800001,
      "times": [
        0.6880808527800001,
        0.6935065407800001,
        0.7826385367800001,
        0.7692162487800001,
        0.6692996037800001,
        0.74630481278,
        0.69431811978,
        0.62241045078,
        0.6166951377800001,
        0.65800170678
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28466649898,
      "stddev": 0.013615839935195273,
      "median": 0.28320761678000006,
      "user": 0.24282518,
      "system": 0.61953774,
      "min": 0.26819043578000007,
      "max": 0.31401639678000004,
      "times": [
        0.28248028678000003,
        0.28393494678000003,
        0.27473556178,
        0.27710798878000004,
        0.26819043578000007,
        0.28516043378000006,
        0.28940183178000006,
        0.27260394778,
        0.31401639678000004,
        0.29903315978000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26600155598,
      "stddev": 0.009284160148683053,
      "median": 0.2655506602800001,
      "user": 0.20187638000000002,
      "system": 0.5536394399999999,
      "min": 0.25151457178000003,
      "max": 0.28158518078000006,
      "times": [
        0.26576476878000005,
        0.25151457178000003,
        0.28158518078000006,
        0.27443791178000004,
        0.26257787678000005,
        0.26533655178000004,
        0.27362202478000003,
        0.26344811478,
        0.25304533478,
        0.26868322378000004
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.004 ± 0.102 1.887 2.170 7.45 ± 0.85
pacquet@main 2.032 ± 0.142 1.874 2.272 7.56 ± 0.94
pnpr@HEAD 0.279 ± 0.024 0.267 0.348 1.04 ± 0.14
pnpr@main 0.269 ± 0.027 0.244 0.330 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.0036239455200002,
      "stddev": 0.10212126236997815,
      "median": 1.98321219692,
      "user": 1.1658970599999998,
      "system": 0.8616149,
      "min": 1.8866918469200002,
      "max": 2.16966065092,
      "times": [
        2.0789231309200003,
        2.14067144792,
        2.16966065092,
        2.04596984292,
        1.95163468992,
        1.8866918469200002,
        1.8968803949200002,
        2.00017976092,
        1.96624463292,
        1.89938305692
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.03226212832,
      "stddev": 0.14193716648242224,
      "median": 1.9906656079200002,
      "user": 1.1929842599999998,
      "system": 0.8638763999999999,
      "min": 1.8744962899200002,
      "max": 2.27170559292,
      "times": [
        1.8744962899200002,
        1.9284022969200003,
        1.9375360779200002,
        1.9738571189200003,
        1.8925017989200001,
        2.0074740969200002,
        2.07944439292,
        2.25180358392,
        2.27170559292,
        2.10540003392
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27913418881999996,
      "stddev": 0.02430429766166306,
      "median": 0.27229196342,
      "user": 0.22960446,
      "system": 0.6297374,
      "min": 0.26682118092,
      "max": 0.34760228892,
      "times": [
        0.27202784592,
        0.27867031492,
        0.26955158292,
        0.34760228892,
        0.27255608092,
        0.26682118092,
        0.26976179892,
        0.27264777292,
        0.26739715492,
        0.27430586692
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26879396461999994,
      "stddev": 0.02749759819982735,
      "median": 0.25849705392,
      "user": 0.17473186000000002,
      "system": 0.5977378999999999,
      "min": 0.24420273492000003,
      "max": 0.32990808792,
      "times": [
        0.26284607392,
        0.25420918991999997,
        0.25749733092,
        0.24964576592,
        0.25881412092,
        0.24420273492000003,
        0.25817998692,
        0.26514524492,
        0.32990808792,
        0.30749110992
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 332.7 ± 6.9 321.0 343.7 4.03 ± 0.14
pacquet@main 359.3 ± 24.1 327.1 396.9 4.35 ± 0.32
pnpr@HEAD 82.6 ± 2.3 78.7 88.7 1.00
pnpr@main 83.4 ± 6.3 79.9 116.7 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.33270944407999997,
      "stddev": 0.006886821955465241,
      "median": 0.33431620528000006,
      "user": 0.32053370000000003,
      "system": 0.06025973999999999,
      "min": 0.32096679428,
      "max": 0.34370284728,
      "times": [
        0.32669090828,
        0.33292222728,
        0.33421933728000003,
        0.33887472028,
        0.32096679428,
        0.32419820628,
        0.33441307328000003,
        0.33568479628000003,
        0.33542153028,
        0.34370284728
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.35930737527999995,
      "stddev": 0.024075444475815916,
      "median": 0.36806233278,
      "user": 0.34816959999999997,
      "system": 0.05884754,
      "min": 0.32714598428,
      "max": 0.39685015328,
      "times": [
        0.32793336628,
        0.33360566228,
        0.34563876228,
        0.39685015328,
        0.37551841228,
        0.32714598428,
        0.37627245228,
        0.36476320828000003,
        0.37136145728000003,
        0.37398429428
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08255789560352941,
      "stddev": 0.002310188431492479,
      "median": 0.08208032078000001,
      "user": 0.016594011764705884,
      "system": 0.009543603529411764,
      "min": 0.07869061528,
      "max": 0.08868113928,
      "times": [
        0.08298956728000001,
        0.08215633828,
        0.08048407128000001,
        0.08136469928000001,
        0.08206055828,
        0.08422686528000001,
        0.08594280528,
        0.08040076328000001,
        0.08224607828000001,
        0.08086785428000001,
        0.08221338528000001,
        0.08240846228000001,
        0.08098731828000001,
        0.08138029828000001,
        0.08371000228,
        0.08421400128,
        0.08789383728000001,
        0.08143509028000001,
        0.08868113928,
        0.08008591228,
        0.08809526728000001,
        0.08090854928,
        0.08500681428000001,
        0.07869061528,
        0.08367523728000001,
        0.08073105728,
        0.08163216228,
        0.08210008328000001,
        0.08236153428000001,
        0.08085980928000001,
        0.08264210228,
        0.08176916928000001,
        0.08105450528000001,
        0.08169249628000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08337439915878789,
      "stddev": 0.006329354437101845,
      "median": 0.08161472928,
      "user": 0.015237357575757572,
      "system": 0.01179204606060606,
      "min": 0.07992569928000001,
      "max": 0.11669224328000001,
      "times": [
        0.08586189328,
        0.08079203028000001,
        0.08131371228,
        0.08139184028,
        0.08237235528,
        0.08272513928000001,
        0.08122262128,
        0.08693462228000001,
        0.11669224328000001,
        0.08931626528000002,
        0.07992569928000001,
        0.08228840728,
        0.08132835028,
        0.08073865028,
        0.08276067528,
        0.08151264628,
        0.08178821628,
        0.08028803228,
        0.08254531028,
        0.08682051728000001,
        0.08110619128,
        0.08147078828000001,
        0.08129743228000001,
        0.08398779528000001,
        0.08054062728000001,
        0.08156025728,
        0.08094154328000001,
        0.08161472928,
        0.08195563028000001,
        0.08197404628,
        0.08303821928,
        0.08136628128000001,
        0.08188240328
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.608 ± 0.140 4.500 4.931 1.28 ± 0.05
pacquet@main 4.547 ± 0.103 4.459 4.781 1.26 ± 0.04
pnpr@HEAD 3.595 ± 0.078 3.502 3.755 1.00
pnpr@main 3.643 ± 0.101 3.554 3.911 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.60797786096,
      "stddev": 0.14011591479384966,
      "median": 4.540294147159999,
      "user": 2.00808472,
      "system": 1.66612762,
      "min": 4.50037103516,
      "max": 4.93056324416,
      "times": [
        4.51224197816,
        4.72015457716,
        4.50638726916,
        4.50037103516,
        4.93056324416,
        4.51209727616,
        4.62016172016,
        4.69972423816,
        4.5683463161599995,
        4.50973095516
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.546961038060001,
      "stddev": 0.10276135751587497,
      "median": 4.50596944616,
      "user": 1.94085152,
      "system": 1.55204292,
      "min": 4.45949188616,
      "max": 4.78137664916,
      "times": [
        4.55140460516,
        4.48049283516,
        4.45949188616,
        4.65677679116,
        4.48990978516,
        4.52202910716,
        4.48608349516,
        4.46181051316,
        4.78137664916,
        4.58023471316
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5953947157600004,
      "stddev": 0.07755799857152527,
      "median": 3.60147923566,
      "user": 1.43988292,
      "system": 1.47333372,
      "min": 3.50222387416,
      "max": 3.75467763116,
      "times": [
        3.61849522316,
        3.50537840916,
        3.50222387416,
        3.6532511791599998,
        3.5235065731599997,
        3.56078008516,
        3.75467763116,
        3.63267571116,
        3.61312833616,
        3.5898301351599997
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.64286642396,
      "stddev": 0.10114039534466875,
      "median": 3.61815671916,
      "user": 1.5455448200000002,
      "system": 1.56876402,
      "min": 3.55405634416,
      "max": 3.91122280416,
      "times": [
        3.62715035316,
        3.59483773516,
        3.58371387816,
        3.63565075516,
        3.60916308516,
        3.58274436416,
        3.91122280416,
        3.6777371301599997,
        3.55405634416,
        3.6523877901599997
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13060
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
3,184.20 ms
(-10.64%)Baseline: 3,563.40 ms
4,276.08 ms
(74.47%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
2,003.62 ms
(-20.80%)Baseline: 2,529.84 ms
3,035.81 ms
(66.00%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
583.65 ms
(-44.03%)Baseline: 1,042.80 ms
1,251.37 ms
(46.64%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
332.71 ms
(-36.37%)Baseline: 522.86 ms
627.43 ms
(53.03%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,688.06 ms
(-16.70%)Baseline: 3,226.93 ms
3,872.32 ms
(69.42%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,607.98 ms
(-21.35%)Baseline: 5,858.62 ms
7,030.34 ms
(65.54%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
332.90 ms
(-26.84%)Baseline: 455.01 ms
546.01 ms
(60.97%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13060
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,705.49 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
279.13 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
284.67 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
82.56 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,681.68 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,595.39 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
324.39 ms
🐰 View full continuous benchmarking report in Bencher

Copilot AI review requested due to automatic review settings July 15, 2026 23:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@pnpm11/store/controller/test/index.ts`:
- Around line 208-224: Update the filesMap entry in the affected importPackage
test to use filename.js, matching the manually created hardlink instead of
file?name.js. Add assertions for the replaced importTo/filename.js file
verifying its write bit is set and, on non-Windows platforms, its inode differs
from storeInvalidFile.
🪄 Autofix (Beta)

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: 0b82c980-55d5-4a58-a455-cf4a8ad81280

📥 Commits

Reviewing files that changed from the base of the PR and between bf46735 and e20f17d.

📒 Files selected for processing (8)
  • pnpm/crates/fs/src/file_mode.rs
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs
  • pnpm/crates/package-manager/src/import_indexed_dir/tests.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs
  • pnpm11/fetching/tarball-fetcher/test/fetch.ts
  • pnpm11/store/controller/test/index.ts
  • pnpm11/store/create-cafs-store/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • pnpm/crates/fs/src/file_mode.rs
  • pnpm/crates/package-manager/src/import_indexed_dir/tests.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm11/store/create-cafs-store/src/index.ts

Comment thread pnpm11/store/controller/test/index.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

Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings July 15, 2026 23:57
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 15, 2026

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 22 out of 23 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 16, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Copilot AI review requested due to automatic review settings July 16, 2026 02:59
Copilot AI review requested due to automatic review settings July 16, 2026 17:48
@vsumner
vsumner force-pushed the codex/writable-build-projections branch from 7e2ba54 to 6f3a0db Compare July 16, 2026 17:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 16, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Copilot AI review requested due to automatic review settings July 16, 2026 18:35
@vsumner

vsumner commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 20 out of 21 changed files in this pull request and generated 1 comment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (1)
pnpm11/fs/indexed-pkg-importer/src/index.ts (1)

112-124: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not treat package-import failures as clone capability failures.

The try includes rawClonePkg(to, opts), so errors such as EACCES, ENOSPC, or writable-projection validation failures are swallowed and permanently switch this importer to copying. Catch only clone initialization/capability errors, then run the package import outside the catch so unexpected errors propagate.

Proposed structure
-    try {
+    let rawClonePkg: ImportIndexedPackage
+    try {
       const clone = createCloneFunction()
-      const rawClonePkg = createPrivateWritablePkg(clone, 'clone')
-      if (!rawClonePkg(to, opts)) return undefined
-      packageImportMethodLogger.debug({ method: 'clone' })
-      auto = createPrivateWritablePkg(createCloneImporter().importFile, 'clone')
-      return 'clone'
+      rawClonePkg = createPrivateWritablePkg(clone, 'clone')
     } catch {
-      // ignore
+      packageImportMethodLogger.debug({ method: 'copy' })
+      auto = copyPkg
+      return auto(to, opts)
     }
-    packageImportMethodLogger.debug({ method: 'copy' })
-    auto = copyPkg
-    return auto(to, opts)
+    if (!rawClonePkg(to, opts)) return undefined
+    packageImportMethodLogger.debug({ method: 'clone' })
+    auto = createPrivateWritablePkg(createCloneImporter().importFile, 'clone')
+    return 'clone'

As per coding guidelines, “never swallow unexpected errors.”

🤖 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/fs/indexed-pkg-importer/src/index.ts` around lines 112 - 124, Limit
the try/catch in the clone setup flow to clone initialization and capability
detection only, excluding the rawClonePkg(to, opts) package import call. After
clone capability setup succeeds, invoke rawClonePkg outside the catch so errors
such as permission, space, or validation failures propagate; retain the fallback
to copyPkg only when clone initialization fails.

Source: Coding guidelines

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

Inline comments:
In `@pnpm/crates/package-manager/src/import_indexed_dir.rs`:
- Around line 408-428: Prevent failed swaps from leaking staged bundled
dependencies: in pnpm/crates/package-manager/src/import_indexed_dir.rs:408-428,
preserve the existing node_modules content separately instead of merging it into
the staged tree before the swap succeeds; in
pnpm/crates/package-manager/src/import_indexed_dir.rs:599-657, restore only
content originating from the old target; and in
pnpm/crates/package-manager/src/import_indexed_dir/tests.rs:670-671, assert that
node_modules/bundled is absent after the expected failure.

In `@pnpm/crates/package-manager/src/import_indexed_dir/tests.rs`:
- Around line 670-671: Update the test around the bundled dependency fixture to
assert that the staged bundled dependency is absent after the failed swap. Keep
the existing assertion verifying the old dependency survives, and add a negative
filesystem/content assertion for node_modules/bundled so the test validates
atomic restoration.

In `@pnpm11/fs/indexed-pkg-importer/src/importIndexedDir.ts`:
- Around line 316-321: Update the scope-handling branch in importIndexedDir
around moveMissingEntries to atomically rename the preserved srcScope into a
private staging location before inspecting or traversing it, eliminating the
lstatSync-to-reopen TOCTOU window. Reject captured symlink entries, then merge
only the safely captured directory into destScope using moveMissingEntries;
ensure the staging location is private and cleaned up appropriately.

---

Outside diff comments:
In `@pnpm11/fs/indexed-pkg-importer/src/index.ts`:
- Around line 112-124: Limit the try/catch in the clone setup flow to clone
initialization and capability detection only, excluding the rawClonePkg(to,
opts) package import call. After clone capability setup succeeds, invoke
rawClonePkg outside the catch so errors such as permission, space, or validation
failures propagate; retain the fallback to copyPkg only when clone
initialization fails.
🪄 Autofix (Beta)

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: 45447785-679f-4943-876e-80137487ce74

📥 Commits

Reviewing files that changed from the base of the PR and between ac4c5f8 and e47712d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (20)
  • .changeset/writable-build-projections.md
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/fs/Cargo.toml
  • pnpm/crates/fs/src/file_mode.rs
  • pnpm/crates/fs/src/file_mode/tests.rs
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rs
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs
  • pnpm/crates/package-manager/src/create_virtual_store.rs
  • pnpm/crates/package-manager/src/import_indexed_dir.rs
  • pnpm/crates/package-manager/src/import_indexed_dir/tests.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs
  • pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts
  • pnpm11/fetching/tarball-fetcher/test/fetch.ts
  • pnpm11/fs/indexed-pkg-importer/src/importIndexedDir.ts
  • pnpm11/fs/indexed-pkg-importer/src/index.ts
  • pnpm11/fs/indexed-pkg-importer/test/importIndexedDir.test.ts
  • pnpm11/fs/indexed-pkg-importer/test/writableProjection.test.ts
  • pnpm11/patching/commands/test/patch.test.ts
  • pnpm11/store/controller/test/index.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • pnpm/crates/package-manager/src/create_virtual_store.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs
  • pnpm11/patching/commands/test/patch.test.ts
  • pnpm/crates/fs/Cargo.toml
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rs
  • .changeset/writable-build-projections.md
  • pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rs
  • pnpm/crates/fs/src/file_mode.rs

Copilot AI review requested due to automatic review settings July 16, 2026 19:42

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 21 out of 22 changed files in this pull request and generated no new comments.

@vsumner

vsumner commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@zkochan I'd love your thoughts on this PR - Happy to take it in another direction if you want

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

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants