Repository navigation
fix(loaded-linker): materialize runtimes and ignore bundled node_modules files - #16644
Conversation
…s files Two defects made `nodeLinker.type: loaded` unusable in a real workspace. Runtime dependencies (`node@runtime:`, from `devEngines.runtime`) were loaded from CAS like any other package, so their bins got the loader's JavaScript `runMain` shim. That shim starts with `#!/usr/bin/env node` and sits first on the scripts' PATH as `.pnpm/.bin/node`, so `env node` resolved back to the shim and re-executed it until execve failed with E2BIG. A runtime's executables are native binaries the loader cannot run, so runtime snapshots now join patched packages in the set the loaded linker always materializes in the global virtual store. The loader validates every file of every package when it starts and rejects the manifest if a file path has a `node_modules` segment. One package shipping such a file, such as the test fixtures of [email protected], made every Node.js process fail with ERR_PNPM_LOADER_MANIFEST. Bundled dependencies are not supported by the loader, so pnpm now leaves those files out of the manifest it writes. The loader keeps its strict validation for hand-written manifests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe loaded linker now omits files under packages’ ChangesLoaded linker behavior
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested labels: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains in the reviewed changes; the reported loader and runtime behaviors are covered by the inspected implementation and tests. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
pnpm/esm-loader/store.mjsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. 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 |
Leaving these files out of `.pnpm-store.json` let `pnpm store prune` delete their blobs, because prune keeps only the CAS files a loader manifest references. Prune then dropped the package's store index entry for referencing a removed blob, so the next install had to fetch the package again. The manifest now lists every file again, and the loader skips a file with a `node_modules` segment when it builds the virtual filesystem. Malformed names such as `..` are still rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.43623560876,
"stddev": 0.11672891707016919,
"median": 2.3972045466600003,
"user": 1.5189553999999998,
"system": 1.49709998,
"min": 2.2869715731599998,
"max": 2.60765013916
},
{
"command": "pacquet@main",
"mean": 2.3509665581599997,
"stddev": 0.05304247803301533,
"median": 2.3377196851599997,
"user": 1.5447964999999997,
"system": 1.4897730799999997,
"min": 2.26456119716,
"max": 2.44740134616
},
{
"command": "pnpr@HEAD",
"mean": 1.4622355737600004,
"stddev": 0.11602010930739483,
"median": 1.4375420926600002,
"user": 1.421182,
"system": 1.4285551799999996,
"min": 1.3223726161600002,
"max": 1.6779289921600002
},
{
"command": "pnpr@main",
"mean": 1.42616791916,
"stddev": 0.09443488179323713,
"median": 1.4300532856600001,
"user": 1.3588094,
"system": 1.3491477799999998,
"min": 1.3005303621600002,
"max": 1.58233052016
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.35806242272000005,
"stddev": 0.08507069100180893,
"median": 0.31718073582000006,
"user": 0.4184444199999999,
"system": 0.8967696799999999,
"min": 0.29296263082,
"max": 0.5314944588200001
},
{
"command": "pacquet@main",
"mean": 0.29928531952,
"stddev": 0.008661221341123616,
"median": 0.29765826032,
"user": 0.34867091999999994,
"system": 0.7800468799999999,
"min": 0.29065428682,
"max": 0.31924581182
},
{
"command": "pnpr@HEAD",
"mean": 0.32822038362000006,
"stddev": 0.01222830078241276,
"median": 0.32982489582,
"user": 0.37877681999999996,
"system": 0.7650223799999999,
"min": 0.30486950582,
"max": 0.34607419382
},
{
"command": "pnpr@main",
"mean": 0.31652394092,
"stddev": 0.007961052244266104,
"median": 0.31534725682,
"user": 0.35152511999999997,
"system": 0.77654988,
"min": 0.30580136182,
"max": 0.32703869482000003
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.008175304971940292,
"stddev": 0.0008327468978624237,
"median": 0.00803176336,
"user": 0.005010648656716418,
"system": 0.003899828358208955,
"min": 0.0070879103600000005,
"max": 0.01428206336
},
{
"command": "pacquet@main",
"mean": 0.007684697719872605,
"stddev": 0.00033995953637286125,
"median": 0.007658737860000001,
"user": 0.0047927143949044616,
"system": 0.0035400608917197413,
"min": 0.007009753360000001,
"max": 0.00982745536
},
{
"command": "pnpr@HEAD",
"mean": 0.00795031203092651,
"stddev": 0.00041132017840295567,
"median": 0.007908632359999999,
"user": 0.004618645175718847,
"system": 0.004076708753993612,
"min": 0.00710285836,
"max": 0.00975071136
},
{
"command": "pnpr@main",
"mean": 0.007959656632189347,
"stddev": 0.0005212446697154726,
"median": 0.00785868886,
"user": 0.0046630013017751465,
"system": 0.004006166863905323,
"min": 0.0070875593600000005,
"max": 0.01070183836
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.008970241273070865,
"stddev": 0.0006876428978569981,
"median": 0.008863847340000001,
"user": 0.005463682913385826,
"system": 0.0042434444094488185,
"min": 0.007414788340000001,
"max": 0.011822218340000001
},
{
"command": "pacquet@main",
"mean": 0.008764777691851853,
"stddev": 0.0006669130044210318,
"median": 0.00868664434,
"user": 0.0052892836296296285,
"system": 0.004245435555555554,
"min": 0.007422292340000001,
"max": 0.01278126834
},
{
"command": "pnpr@HEAD",
"mean": 0.012304059718676465,
"stddev": 0.004334938346422325,
"median": 0.00997591934,
"user": 0.007241846397058827,
"system": 0.005979145735294118,
"min": 0.007618500340000001,
"max": 0.02446426134
},
{
"command": "pnpr@main",
"mean": 0.016543265631044784,
"stddev": 0.001554540333605238,
"median": 0.016389614339999997,
"user": 0.009359834925373135,
"system": 0.008470245970149254,
"min": 0.01311990334,
"max": 0.02110924534
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.54934725822,
"stddev": 0.11816340871407623,
"median": 2.4851455268200002,
"user": 1.9301791599999998,
"system": 1.7086462199999999,
"min": 2.47033563232,
"max": 2.83460573532
},
{
"command": "pacquet@main",
"mean": 2.4722524110200004,
"stddev": 0.021407398191330092,
"median": 2.47034713382,
"user": 1.6944852599999998,
"system": 1.4932641199999999,
"min": 2.43942905032,
"max": 2.5064561253199997
},
{
"command": "pnpr@HEAD",
"mean": 1.5350093054199998,
"stddev": 0.12806929987183704,
"median": 1.51131534232,
"user": 1.1365908599999999,
"system": 1.24876372,
"min": 1.39359179732,
"max": 1.74810380232
},
{
"command": "pnpr@main",
"mean": 1.50879276732,
"stddev": 0.08613372832034207,
"median": 1.49111203532,
"user": 1.19457826,
"system": 1.2695428199999996,
"min": 1.39814964332,
"max": 1.67446645432
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.44987201198000004,
"stddev": 0.02562236527631895,
"median": 0.45142514548,
"user": 0.63137358,
"system": 0.72755626,
"min": 0.40943579548000003,
"max": 0.48691556648000006
},
{
"command": "pacquet@main",
"mean": 0.48268123048000006,
"stddev": 0.04255814602391538,
"median": 0.47312540448000007,
"user": 0.64307158,
"system": 0.73944546,
"min": 0.44574479248000004,
"max": 0.59573698448
},
{
"command": "pnpr@HEAD",
"mean": 0.3347019143800001,
"stddev": 0.06686117604994614,
"median": 0.30481863348000005,
"user": 0.30643478,
"system": 0.6641347599999999,
"min": 0.29399518148000003,
"max": 0.46809785148000005
},
{
"command": "pnpr@main",
"mean": 0.2920096959800001,
"stddev": 0.007582007583776321,
"median": 0.29500125548000006,
"user": 0.26016288,
"system": 0.55553026,
"min": 0.27855221848000006,
"max": 0.30351516648000004
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.6695595362000002,
"stddev": 0.019914775585363698,
"median": 1.6687858852000002,
"user": 0.97603902,
"system": 0.8756018399999999,
"min": 1.6393885607,
"max": 1.6926898707000002
},
{
"command": "pacquet@main",
"mean": 1.6655331852,
"stddev": 0.03599494678158018,
"median": 1.6558159902000003,
"user": 1.00503222,
"system": 0.86932654,
"min": 1.6267668507000002,
"max": 1.7414051977000002
},
{
"command": "pnpr@HEAD",
"mean": 0.30120779480000004,
"stddev": 0.017192158654240446,
"median": 0.2990724752,
"user": 0.27684552,
"system": 0.5643941399999999,
"min": 0.2757687777,
"max": 0.3238703917
},
{
"command": "pnpr@main",
"mean": 0.3515231368,
"stddev": 0.07493652544850078,
"median": 0.3070037152,
"user": 0.32066752000000004,
"system": 0.66457264,
"min": 0.2766952417,
"max": 0.4611982007
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2969451823,
"stddev": 0.030978914808678374,
"median": 0.2894820574,
"user": 0.2873983,
"system": 0.11769693999999997,
"min": 0.2647993604,
"max": 0.3523799464
},
{
"command": "pacquet@main",
"mean": 0.22794754203636367,
"stddev": 0.021033812112366403,
"median": 0.22328525940000002,
"user": 0.20014569999999995,
"system": 0.09900775818181819,
"min": 0.1953717694,
"max": 0.26371665839999997
},
{
"command": "pnpr@HEAD",
"mean": 0.08973974076363637,
"stddev": 0.0033652928190845807,
"median": 0.0881175084,
"user": 0.032543942424242425,
"system": 0.012501032727272729,
"min": 0.0860760364,
"max": 0.0983940714
},
{
"command": "pnpr@main",
"mean": 0.0918050820451613,
"stddev": 0.0021263258907567397,
"median": 0.09221898440000001,
"user": 0.0315535064516129,
"system": 0.01375684322580645,
"min": 0.0867718824,
"max": 0.09531398940000001
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20249099577555557,
"stddev": 0.009250014725518809,
"median": 0.20160126622000002,
"user": 0.2033154822222222,
"system": 0.04981447333333333,
"min": 0.18649517922,
"max": 0.21540633122
},
{
"command": "pacquet@main",
"mean": 0.23245325310888887,
"stddev": 0.025000730873753135,
"median": 0.23193890422000002,
"user": 0.24420725999999998,
"system": 0.04495313999999999,
"min": 0.20347899022000002,
"max": 0.28297637622
},
{
"command": "pnpm@HEAD",
"mean": 3.837207732997778,
"stddev": 0.25472145615414515,
"median": 3.8177606502200003,
"user": 5.944455148888888,
"system": 0.38007091777777785,
"min": 3.56478888522,
"max": 4.447611434220001
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20135006917714288,
"stddev": 0.004522563492731831,
"median": 0.19899048982000003,
"user": 0.15894542285714292,
"system": 0.07681694571428573,
"min": 0.19751686782000002,
"max": 0.21080357382000003
},
{
"command": "pacquet@main",
"mean": 0.2024709077485715,
"stddev": 0.005639287567624681,
"median": 0.20018567332000003,
"user": 0.15872828,
"system": 0.0795429457142857,
"min": 0.19587378282,
"max": 0.21357040882000003
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.592761878580001,
"stddev": 0.19307816672787712,
"median": 4.52236651788,
"user": 1.75979496,
"system": 1.64983012,
"min": 4.38962102138,
"max": 4.90465406238
},
{
"command": "pacquet@main",
"mean": 4.65790354428,
"stddev": 0.23812817436890404,
"median": 4.63567702138,
"user": 1.9095527599999993,
"system": 1.78519722,
"min": 4.41361632138,
"max": 5.20323303038
},
{
"command": "pnpr@HEAD",
"mean": 3.8061418233800004,
"stddev": 0.0916447029466571,
"median": 3.83350553288,
"user": 2.19235666,
"system": 2.04432132,
"min": 3.65180744138,
"max": 3.9434669423799997
},
{
"command": "pnpr@main",
"mean": 3.6664179714800005,
"stddev": 0.14138690310331,
"median": 3.6311267888799996,
"user": 1.73735936,
"system": 1.69285402,
"min": 3.53243905638,
"max": 3.9018303033799997
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.14708769586888892,
"stddev": 0.010282285922382266,
"median": 0.14723982098000002,
"user": 0.17958623555555556,
"system": 0.1522680288888889,
"min": 0.13321018048000002,
"max": 0.16343422448000003
},
{
"command": "pacquet@main",
"mean": 0.15196735028000002,
"stddev": 0.007951627614199212,
"median": 0.15131509048000003,
"user": 0.17527621333333335,
"system": 0.17032710666666664,
"min": 0.13628162248,
"max": 0.16706842448
},
{
"command": "pnpr@HEAD",
"mean": 0.17127177148000006,
"stddev": 0.010407758783457243,
"median": 0.17013127548,
"user": 0.19928153714285715,
"system": 0.16591156857142855,
"min": 0.15859235848000003,
"max": 0.19195758348000003
},
{
"command": "pnpr@main",
"mean": 0.17521052908,
"stddev": 0.011229840849098562,
"median": 0.17288714748,
"user": 0.19465754666666665,
"system": 0.18631404000000001,
"min": 0.15647714048000003,
"max": 0.20273792748000002
}
]
} |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16644 +/- ##
==========================================
- Coverage 92.34% 92.34% -0.01%
==========================================
Files 1589 1589
Lines 209969 209970 +1
==========================================
- Hits 193906 193892 -14
- Misses 16063 16078 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoFix loaded-linker runtime execution and bundled-file indexing
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1. Loaded-linker notes use disallowed colons
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Replies to the Qodo review of 248ac59:
Written by an agent (Claude Code, claude-opus-5-5). |
|
Code review by qodo was updated up to the latest commit 606129a |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
I found two bugs in the
nodeLinker.type: loadedmode that shipped in 12.10.0 while trying to enable it in this repository. Each one breaks every Node.js script in the workspace.node@runtime:dependency (fromdevEngines.runtime) got the loader's JavaScript bin shim. That shim starts with#!/usr/bin/env nodeand is.pnpm/.bin/node, the first entry on the scripts' PATH. Soenv nodefound the shim again, and it re-executed itself (about 150k times under strace) untilenv: 'node': Argument list too long. Runtime snapshots are now always materialized in the global virtual store, as patched packages already are. The runtime's real binary is then linked.node_modulesfile breaks every process. The loader checks every file in.pnpm-store.jsonat startup and rejects the whole manifest when any path has anode_modulessegment. One such file in any package, such as[email protected]'stest/resolver/symlinked/_/node_modules/foo.js, made everynodeprocess fail withERR_PNPM_LOADER_MANIFEST. The loader doesn't support bundled dependencies anyway, so it now skips these files when it builds its virtual filesystem. Malformed names such as..are still rejected. The manifest keeps listing the files, becausepnpm store prunekeeps only the blobs a loader manifest references. Leaving the files out would let prune delete them and then drop the package's store index entry.Each fix has an e2e test in
pnpm-cli, and the loader fix also has a unit test in@pnpm/esm-loader. Each test fails with its fix reverted.This doesn't make this repository work with the loaded linker. esbuild, tsgo and Jest resolve dependencies through the filesystem, and there is no project
node_modulesto find. That is a separate design limit, not part of this PR.Squash Commit Body
Checklist
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
The loaded linker exists only in v12, so v11 is unaffected.
Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code
Summary by CodeRabbit
node_modulesdirectory could prevent Node.js processes from starting with the loaded linker.node_modulesdirectories are ignored.