Repository navigation
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughRead-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. ChangesWritable package projections
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
Possibly related issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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-copyand 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_writableflag 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.
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (22)
.changeset/writable-build-projections.mdpnpm/crates/cli/src/cli_args/deploy.rspnpm/crates/fs/Cargo.tomlpnpm/crates/fs/src/file_mode.rspnpm/crates/package-manager/src/build_modules.rspnpm/crates/package-manager/src/build_modules/tests.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rspnpm/crates/package-manager/src/create_virtual_store.rspnpm/crates/package-manager/src/import_indexed_dir.rspnpm/crates/package-manager/src/import_indexed_dir/tests.rspnpm/crates/package-manager/src/link_hoisted_modules.rspnpm/crates/package-manager/src/link_hoisted_modules/tests.rspnpm/crates/package-manager/src/patch.rspnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.tspnpm11/fetching/tarball-fetcher/test/fetch.tspnpm11/fs/indexed-pkg-importer/src/importIndexedDir.tspnpm11/fs/indexed-pkg-importer/src/index.tspnpm11/patching/commands/src/writePackage.tspnpm11/patching/commands/test/patch.test.tspnpm11/store/controller/test/index.tspnpm11/store/create-cafs-store/src/index.ts
Confidence Score: 4/5Safe to merge for Linux and macOS; the 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 |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
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
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
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
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
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
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
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
]
}
]
} |
|
| Branch | pr/13060 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,705.49 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 279.13 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 284.67 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 82.56 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,681.68 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,595.39 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 324.39 ms |
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
pnpm/crates/fs/src/file_mode.rspnpm/crates/package-manager/src/build_modules/tests.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rspnpm/crates/package-manager/src/import_indexed_dir/tests.rspnpm/crates/package-manager/src/link_hoisted_modules/tests.rspnpm11/fetching/tarball-fetcher/test/fetch.tspnpm11/store/controller/test/index.tspnpm11/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
7e2ba54 to
6f3a0db
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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 winDo not treat package-import failures as clone capability failures.
The
tryincludesrawClonePkg(to, opts), so errors such asEACCES,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
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (20)
.changeset/writable-build-projections.mdpnpm/crates/config/src/lib.rspnpm/crates/fs/Cargo.tomlpnpm/crates/fs/src/file_mode.rspnpm/crates/fs/src/file_mode/tests.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot/tests.rspnpm/crates/package-manager/src/create_virtual_store.rspnpm/crates/package-manager/src/import_indexed_dir.rspnpm/crates/package-manager/src/import_indexed_dir/tests.rspnpm/crates/package-manager/src/link_hoisted_modules.rspnpm/crates/package-manager/src/link_hoisted_modules/tests.rspnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.tspnpm11/fetching/tarball-fetcher/test/fetch.tspnpm11/fs/indexed-pkg-importer/src/importIndexedDir.tspnpm11/fs/indexed-pkg-importer/src/index.tspnpm11/fs/indexed-pkg-importer/test/importIndexedDir.test.tspnpm11/fs/indexed-pkg-importer/test/writableProjection.test.tspnpm11/patching/commands/test/patch.test.tspnpm11/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
|
@zkochan I'd love your thoughts on this PR - Happy to take it in another direction if you want |
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-copybehavior: 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
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Codex, GPT-5).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
Bug Fixes