Skip to content

fix(loaded-linker): materialize runtimes and ignore bundled node_modules files - #16644

Merged
zkochan merged 3 commits into
mainfrom
fix/loaded-linker-node-runtime-and-manifest
Oct 6, 2026
Merged

zkochan merged 3 commits into
mainfrom
fix/loaded-linker-node-runtime-and-manifest

Conversation

@zkochan

@zkochan zkochan commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

I found two bugs in the nodeLinker.type: loaded mode that shipped in 12.10.0 while trying to enable it in this repository. Each one breaks every Node.js script in the workspace.

  1. Runtime shim loops forever. In loaded mode the node@runtime: dependency (from devEngines.runtime) got the loader's JavaScript bin shim. That shim starts with #!/usr/bin/env node and is .pnpm/.bin/node, the first entry on the scripts' PATH. So env node found the shim again, and it re-executed itself (about 150k times under strace) until env: '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.
  2. One bundled node_modules file breaks every process. The loader checks every file in .pnpm-store.json at startup and rejects the whole manifest when any path has a node_modules segment. One such file in any package, such as [email protected]'s test/resolver/symlinked/_/node_modules/foo.js, made every node process fail with ERR_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, because pnpm store prune keeps 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_modules to find. That is a separate design limit, not part of this PR.

Squash Commit Body

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
rejected the manifest if a file path had 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 it now skips those files when it builds the virtual
filesystem. The manifest still lists them, because `pnpm store prune`
keeps only the CAS blobs a loader manifest references.

Checklist

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

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

  • Bug Fixes
    • Fixed an issue where packages containing files in their own node_modules directory could prevent Node.js processes from starting with the loaded linker.
    • Improved support for running package scripts with a downloaded Node.js runtime when using the loaded linker.
  • Documentation
    • Clarified that runtime packages and their dependencies are made available automatically, and that files within packages’ own node_modules directories are ignored.

…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]>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fc081ee5-a5df-4470-8eec-cea367b61fb0
📥 Commits

Reviewing files that changed from the base of the PR and between 248ac59 and 606129a.

📒 Files selected for processing (1)
  • pnpm/esm-loader/store.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The loaded linker now omits files under packages’ node_modules directories from its virtual filesystem and materializes runtime packages with their dependencies. Tests, documentation, and patch changesets cover these behaviors.

Changes

Loaded linker behavior

Layer / File(s) Summary
Filter package node_modules files
pnpm/esm-loader/store.mjs, pnpm/esm-loader/test/loader.test.mjs, pnpm/crates/cli/tests/suite/cas_linker.rs, pnpm/docs/store-loader.md, .changeset/loaded-linker-bundled-node-modules.md
The loader accepts filenames with a node_modules path component but omits those files when indexing. Tests check that regular package entry points load while nested node_modules files are not resolved.
Materialize runtime packages
pnpm/crates/deps-restorer/src/create_virtual_store/cas.rs, pnpm/crates/cli/tests/suite/install_runtimes.rs, pnpm/docs/store-loader.md, .changeset/loaded-linker-node-runtime.md
Runtime-prefixed snapshots are selected for materialization. Documentation describes runtime dependency materialization, and an integration test checks runtime installation and script execution.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to 60612

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
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

pnpm/esm-loader/store.mjs

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

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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]>
@zkochan zkochan changed the title fix(loaded-linker): materialize runtimes and omit bundled node_modules files fix(loaded-linker): materialize runtimes and ignore bundled node_modules files Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     13.0±0.28ms    28.9 MB/sec    1.04     13.4±0.36ms    27.8 MB/sec
packument/parse                                  1.03     44.1±0.36µs  1502.8 MB/sec    1.00     42.7±0.42µs  1555.0 MB/sec
tarball/download_dependency                      1.00      4.0±0.18ms  1084.0 KB/sec    1.28      5.1±0.92ms   846.9 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    210.0±7.83ms 76.2 KElem/sec    1.05   220.9±19.40ms 72.4 KElem/sec
version_pick/repeated_ranges_file                1.02      4.6±0.06ms  6.8 KElem/sec    1.00      4.5±0.16ms  6.9 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.7±0.07ms  6.7 KElem/sec    1.03      4.8±0.05ms  6.5 KElem/sec
workspace_resolution/hoist_heavy                 1.00    235.6±7.47ms        ? ?/sec    1.03    243.4±8.33ms        ? ?/sec
workspace_sort/chained_projects                  1.00     14.5±0.93ms        ? ?/sec    1.00     14.6±0.99ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

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

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2337.72 ms 2397.20 ms 2.5% 116.89 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1430.05 ms 1437.54 ms 0.5% 71.50 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 297.66 ms 317.18 ms 6.6% 14.88 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pnpr 315.35 ms 329.82 ms 4.6% 15.77 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 7.66 ms 8.03 ms 4.9% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 7.86 ms 7.91 ms 0.6% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.69 ms 8.86 ms 2.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 16.39 ms 9.98 ms -39.1% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2470.35 ms 2485.15 ms 0.6% 123.52 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1491.11 ms 1511.32 ms 1.4% 74.56 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 473.13 ms 451.43 ms -4.6% 23.66 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 295.00 ms 304.82 ms 3.3% 14.75 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1655.82 ms 1668.79 ms 0.8% 82.79 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 307.00 ms 299.07 ms -2.6% 15.35 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 223.29 ms 289.48 ms 29.6% 11.16 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 92.22 ms 88.12 ms -4.4% 4.61 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 231.94 ms 201.60 ms -13.1% 11.60 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 200.19 ms 198.99 ms -0.6% 10.01 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4635.68 ms 4522.37 ms -2.4% 231.78 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3631.13 ms 3833.51 ms 5.6% 181.56 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pacquet 151.32 ms 147.24 ms -2.7% 7.57 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 172.89 ms 170.13 ms -1.6% 8.64 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 606129a95082

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.436 ± 0.117 2.287 2.608 1.71 ± 0.14
pacquet@main 2.351 ± 0.053 2.265 2.447 1.65 ± 0.12
pnpr@HEAD 1.462 ± 0.116 1.322 1.678 1.03 ± 0.11
pnpr@main 1.426 ± 0.094 1.301 1.582 1.00
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 358.1 ± 85.1 293.0 531.5 1.20 ± 0.29
pacquet@main 299.3 ± 8.7 290.7 319.2 1.00
pnpr@HEAD 328.2 ± 12.2 304.9 346.1 1.10 ± 0.05
pnpr@main 316.5 ± 8.0 305.8 327.0 1.06 ± 0.04
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.2 ± 0.8 7.1 14.3 1.06 ± 0.12
pacquet@main 7.7 ± 0.3 7.0 9.8 1.00
pnpr@HEAD 8.0 ± 0.4 7.1 9.8 1.03 ± 0.07
pnpr@main 8.0 ± 0.5 7.1 10.7 1.04 ± 0.08
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.0 ± 0.7 7.4 11.8 1.02 ± 0.11
pacquet@main 8.8 ± 0.7 7.4 12.8 1.00
pnpr@HEAD 12.3 ± 4.3 7.6 24.5 1.40 ± 0.51
pnpr@main 16.5 ± 1.6 13.1 21.1 1.89 ± 0.23
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.549 ± 0.118 2.470 2.835 1.69 ± 0.12
pacquet@main 2.472 ± 0.021 2.439 2.506 1.64 ± 0.09
pnpr@HEAD 1.535 ± 0.128 1.394 1.748 1.02 ± 0.10
pnpr@main 1.509 ± 0.086 1.398 1.674 1.00
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 449.9 ± 25.6 409.4 486.9 1.54 ± 0.10
pacquet@main 482.7 ± 42.6 445.7 595.7 1.65 ± 0.15
pnpr@HEAD 334.7 ± 66.9 294.0 468.1 1.15 ± 0.23
pnpr@main 292.0 ± 7.6 278.6 303.5 1.00
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.670 ± 0.020 1.639 1.693 5.54 ± 0.32
pacquet@main 1.666 ± 0.036 1.627 1.741 5.53 ± 0.34
pnpr@HEAD 0.301 ± 0.017 0.276 0.324 1.00
pnpr@main 0.352 ± 0.075 0.277 0.461 1.17 ± 0.26
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 296.9 ± 31.0 264.8 352.4 3.31 ± 0.37
pacquet@main 227.9 ± 21.0 195.4 263.7 2.54 ± 0.25
pnpr@HEAD 89.7 ± 3.4 86.1 98.4 1.00
pnpr@main 91.8 ± 2.1 86.8 95.3 1.02 ± 0.05
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 202.5 ± 9.3 186.5 215.4 1.00
pacquet@main 232.5 ± 25.0 203.5 283.0 1.15 ± 0.13
pnpm@HEAD 3837.2 ± 254.7 3564.8 4447.6 18.95 ± 1.53
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 201.4 ± 4.5 197.5 210.8 1.00
pacquet@main 202.5 ± 5.6 195.9 213.6 1.01 ± 0.04
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.593 ± 0.193 4.390 4.905 1.25 ± 0.07
pacquet@main 4.658 ± 0.238 4.414 5.203 1.27 ± 0.08
pnpr@HEAD 3.806 ± 0.092 3.652 3.943 1.04 ± 0.05
pnpr@main 3.666 ± 0.141 3.532 3.902 1.00
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 store

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 147.1 ± 10.3 133.2 163.4 1.00
pacquet@main 152.0 ± 8.0 136.3 167.1 1.03 ± 0.09
pnpr@HEAD 171.3 ± 10.4 158.6 192.0 1.16 ± 0.11
pnpr@main 175.2 ± 11.2 156.5 202.7 1.19 ± 0.11
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-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.34%. Comparing base (68112ba) to head (606129a).
⚠️ Report is 1 commits behind head on main.

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

@zkochan
zkochan marked this pull request as ready for review October 6, 2026 09:46
Copilot AI balanced review requested due to automatic review settings October 6, 2026 09:46

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix loaded-linker runtime execution and bundled-file indexing

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Materialize downloaded Node runtimes so script shims execute the real binary instead of
 recursively invoking themselves.
• Ignore bundled node_modules files in the loader while retaining their manifest references for
 store pruning.
• Add regression tests and document both loaded-linker behaviors.
Diagram

graph TD
  S["Package snapshots"] --> D{"Materialize?"} -->|Yes| G["Global virtual store"] --> M["Store manifest"] --> L["ESM loader"] -->|Skip bundled paths| V["Virtual files"] --> N["Node scripts"]
  D -->|No, use CAS| M
  G -->|Runtime binary| N
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Omit bundled files from the manifest
  • ➕ Keeps the manifest smaller and avoids loader-side filtering.
  • ➖ Store pruning would lose references to those blobs and could drop the package's store index entry.
2. Materialize packages containing bundled files
  • ➕ Could expose bundled contents through a physical filesystem.
  • ➖ Expands materialization beyond the two startup fixes and changes the loaded linker's package-handling policy.

Recommendation: Keep the PR's approach: materialize native runtimes, but retain bundled-file references in the manifest and exclude those paths only when building the loader's virtual filesystem. This fixes both failures without compromising store pruning or promising support for bundled dependencies.

Files changed (8) +135 / -4

Bug fix (2) +6 / -2
cas.rsMaterialize runtime snapshots in loaded mode +3/-1

Materialize runtime snapshots in loaded mode

• Adds runtime-prefixed snapshots to the materialization selection alongside excluded and patched packages, so native runtime executables are linked from the global virtual store.

pnpm/crates/deps-restorer/src/create_virtual_store/cas.rs

store.mjsSkip bundled files when indexing the virtual filesystem +3/-1

Skip bundled files when indexing the virtual filesystem

• Validates each manifest file name and hash, then skips paths containing a 'node_modules' segment when indexing virtual files. Other malformed path segments remain invalid.

pnpm/esm-loader/store.mjs

Tests (3) +116 / -0
cas_linker.rsCover bundled files in a loaded-linker install +61/-0

Cover bundled files in a loaded-linker install

• Adds an end-to-end test that installs a tarball containing a nested 'node_modules' file, verifies that the manifest retains it, and confirms a Node process can load the package.

pnpm/crates/cli/tests/suite/cas_linker.rs

install_runtimes.rsCover script execution with a downloaded Node runtime +43/-0

Cover script execution with a downloaded Node runtime

• Adds a Unix end-to-end test for a loaded-linker workspace using 'devEngines.runtime'. It checks that the runtime is materialized and a script runs successfully with a restricted PATH.

pnpm/crates/cli/tests/suite/install_runtimes.rs

loader.test.mjsVerify bundled paths stay inaccessible +12/-0

Verify bundled paths stay inaccessible

• Adds a loader test confirming that a package with a bundled file imports normally while direct import of that bundled path fails resolution.

pnpm/esm-loader/test/loader.test.mjs

Documentation (3) +13 / -2
loaded-linker-bundled-node-modules.mdRecord the bundled-file loader fix +6/-0

Record the bundled-file loader fix

• Adds patch changesets for '@pnpm/esm-loader' and 'pacquet', noting that bundled 'node_modules' files no longer prevent Node processes from starting.

.changeset/loaded-linker-bundled-node-modules.md

loaded-linker-node-runtime.mdRecord the loaded-linker runtime fix +5/-0

Record the loaded-linker runtime fix

• Adds a 'pacquet' patch changeset describing restored script execution with runtimes installed through 'devEngines.runtime'.

.changeset/loaded-linker-node-runtime.md

store-loader.mdDocument runtime materialization and bundled-file behavior +2/-2

Document runtime materialization and bundled-file behavior

• Clarifies that runtimes are automatically materialized and that the loader ignores files within a package's bundled 'node_modules' directory.

pnpm/docs/store-loader.md

@qodo-code-review

qodo-code-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 🔗 Cross-repo conflicts (0) 📜 Skill insights (1)

Grey Divider


Remediation recommended

1. Loaded-linker notes use disallowed colons 📘 Rule violation ✧ Quality
Description
Both loaded-linker entries use nodeLinker.type: loaded, whose colon does not introduce a list or
example. The modified release notes therefore violate the required changeset punctuation format in
both files.
Code

.changeset/loaded-linker-bundled-node-modules.md[6]

+With `nodeLinker.type: loaded`, a package that ships files inside its own `node_modules` directory no longer stops every Node.js process from starting. The loader now ignores those files.
Relevance

●●● Strong

Changeset punctuation rules are enforced; removing or rephrasing the inline colon is a deterministic
documentation fix.

PR-#14932
PR-#15430

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset formatting rule requires every colon to introduce a list or example. Both newly added
release-note entries contain a colon in the inline setting reference nodeLinker.type: loaded,
which introduces neither.

Rule 3058313: Changeset text formatting conventions
.changeset/loaded-linker-bundled-node-modules.md[6-6]
.changeset/loaded-linker-node-runtime.md[5-5]

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

## Issue description
The loaded-linker changeset entries contain colons in `nodeLinker.type: loaded`, but changeset text may use colons only when introducing a list or example.

## Fix Focus Areas
- .changeset/loaded-linker-bundled-node-modules.md[6-6]
- .changeset/loaded-linker-node-runtime.md[5-5]

## Recommended Fix
Rewrite the setting reference without a colon, such as `nodeLinker.type is loaded`, while preserving the observable behavior described by each changeset.

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

Dismiss ↗ | View ↗


2. Windows path handling stays untested 📜 Skill insight ▣ Testability
Description
The new loader regression test covers only forward-slash node_modules paths and does not exercise
the changed filename validation with a Windows separator. This leaves Windows-specific manifest
handling and traversal behavior unverified for the loader's virtual filesystem.
Code

pnpm/esm-loader/test/loader.test.mjs[R182-192]

+test('ignores files under a package node_modules directory', context => {
+  const setup = fixture(context)
+  setup.add('example@1', {
+    'package.json': JSON.stringify({ name: 'example', type: 'module', main: 'index.js' }),
+    'index.js': 'export default 42',
+    'test/node_modules/fixture.js': 'export default 1',
+  })
+  setup.manifest.packages['.'].dependencies.example = 'example@1'
+  assert.equal(setup.run("import value from 'example'; console.log(value)").stdout.trim(), '42')
+  assert.match(setup.run("import 'example/test/node_modules/fixture.js'", { failure: true }).stderr, /Can't resolve 'example\/test\/node_modules\/fixture\.js'/)
+})
Relevance

●● Moderate

Windows-specific tests have been rejected elsewhere, but explicit path-validation coverage may still
be expected here.

PR-#16503

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed loader validates package file paths and now skips paths containing a node_modules
segment, while the added regression test covers only slash-separated paths. The compliance rule
requires explicit Windows separator coverage for path parsing changes.

pnpm/esm-loader/store.mjs[102-114]
pnpm/esm-loader/test/loader.test.mjs[182-192]
Skill: review-code

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

## Issue description
The loader's path parsing and filename validation changed, but the regression test only uses POSIX separators. Windows-style separators must be exercised to verify that bundled dependency paths remain safely rejected or ignored without permitting traversal.

## Fix Focus Areas
- pnpm/esm-loader/test/loader.test.mjs[182-192]

## Recommended Fix
Add a test case using a backslash-containing filename, including a traversal form such as `..\\escape` and a bundled-dependency form where appropriate, and assert the loader rejects or safely ignores it without escaping the package root.

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

Dismiss ↗ | View ↗


3. Loaded scripts reparse every store path ✓ Resolved
Description
indexFiles calls name.split('/') to validate each filename, then calls it again to check for
node_modules. Every loaded Node.js process indexes the entire store manifest at startup, so even
packages with no bundled files incur the extra parsing and allocation for every stored file.
Code

pnpm/esm-loader/store.mjs[103]

+    if (name.split('/').includes('node_modules')) continue
Relevance

●● Moderate

The duplicate parsing adds startup overhead, but this micro-optimization lacks a close acceptance
precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
openStore synchronously indexes every package when the loader registers. The validation and new
skip each split the same name, while the loaded-linker documentation says scripts, commands, and
child processes preload the loader.

pnpm/esm-loader/store.mjs[14-23]
pnpm/esm-loader/store.mjs[97-114]
pnpm/docs/store-loader.md[16-16]

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

## Issue description
The bundled-file check splits every store filename a second time during loader startup, including filenames that are not bundled.

## Fix Focus Areas
- pnpm/esm-loader/store.mjs[97-114]

## Recommended Fix
Split each filename once and use its segments both to reject invalid components and to identify `node_modules`. Preserve hash validation for skipped entries.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 66 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: 2457663d) — View relationship
  Explored: repo: pnpm/setup (sha: fbda4c85) — View relationship
  Explored: repo: pnpm/pnpm.io (sha: 5427ef7a) — View relationship
Review mode: Auto: ⚖️ Balanced: Security-sensitive manifest path validation warrants a careful single-pass review.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 606129a

Results up to commit 248ac59 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (1)


Remediation recommended
1. Loaded-linker notes use disallowed colons 📘 Rule violation ✧ Quality
Description
Both loaded-linker entries use nodeLinker.type: loaded, whose colon does not introduce a list or
example. The modified release notes therefore violate the required changeset punctuation format in
both files.
Code

.changeset/loaded-linker-bundled-node-modules.md[6]

+With `nodeLinker.type: loaded`, a package that ships files inside its own `node_modules` directory no longer stops every Node.js process from starting. The loader now ignores those files.
Relevance

●●● Strong

Changeset punctuation rules are enforced; removing or rephrasing the inline colon is a deterministic
documentation fix.

PR-#14932
PR-#15430

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset formatting rule requires every colon to introduce a list or example. Both newly added
release-note entries contain a colon in the inline setting reference nodeLinker.type: loaded,
which introduces neither.

Rule 3058313: Changeset text formatting conventions
.changeset/loaded-linker-bundled-node-modules.md[6-6]
.changeset/loaded-linker-node-runtime.md[5-5]

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

## Issue description
The loaded-linker changeset entries contain colons in `nodeLinker.type: loaded`, but changeset text may use colons only when introducing a list or example.

## Fix Focus Areas
- .changeset/loaded-linker-bundled-node-modules.md[6-6]
- .changeset/loaded-linker-node-runtime.md[5-5]

## Recommended Fix
Rewrite the setting reference without a colon, such as `nodeLinker.type is loaded`, while preserving the observable behavior described by each changeset.

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

Dismiss ↗ | View ↗


2. Windows path handling stays untested 📜 Skill insight ▣ Testability
Description
The new loader regression test covers only forward-slash node_modules paths and does not exercise
the changed filename validation with a Windows separator. This leaves Windows-specific manifest
handling and traversal behavior unverified for the loader's virtual filesystem.
Code

pnpm/esm-loader/test/loader.test.mjs[R182-192]

+test('ignores files under a package node_modules directory', context => {
+  const setup = fixture(context)
+  setup.add('example@1', {
+    'package.json': JSON.stringify({ name: 'example', type: 'module', main: 'index.js' }),
+    'index.js': 'export default 42',
+    'test/node_modules/fixture.js': 'export default 1',
+  })
+  setup.manifest.packages['.'].dependencies.example = 'example@1'
+  assert.equal(setup.run("import value from 'example'; console.log(value)").stdout.trim(), '42')
+  assert.match(setup.run("import 'example/test/node_modules/fixture.js'", { failure: true }).stderr, /Can't resolve 'example\/test\/node_modules\/fixture\.js'/)
+})
Relevance

●● Moderate

Windows-specific tests have been rejected elsewhere, but explicit path-validation coverage may still
be expected here.

PR-#16503

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed loader validates package file paths and now skips paths containing a node_modules
segment, while the added regression test covers only slash-separated paths. The compliance rule
requires explicit Windows separator coverage for path parsing changes.

pnpm/esm-loader/store.mjs[102-114]
pnpm/esm-loader/test/loader.test.mjs[182-192]
Skill: review-code

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

## Issue description
The loader's path parsing and filename validation changed, but the regression test only uses POSIX separators. Windows-style separators must be exercised to verify that bundled dependency paths remain safely rejected or ignored without permitting traversal.

## Fix Focus Areas
- pnpm/esm-loader/test/loader.test.mjs[182-192]

## Recommended Fix
Add a test case using a backslash-containing filename, including a traversal form such as `..\\escape` and a bundled-dependency form where appropriate, and assert the loader rejects or safely ignores it without escaping the package root.

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

Dismiss ↗ | View ↗


3. Loaded scripts reparse every store path ✓ Resolved
Description
indexFiles calls name.split('/') to validate each filename, then calls it again to check for
node_modules. Every loaded Node.js process indexes the entire store manifest at startup, so even
packages with no bundled files incur the extra parsing and allocation for every stored file.
Code

pnpm/esm-loader/store.mjs[103]

+    if (name.split('/').includes('node_modules')) continue
Relevance

●● Moderate

The duplicate parsing adds startup overhead, but this micro-optimization lacks a close acceptance
precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
openStore synchronously indexes every package when the loader registers. The validation and new
skip each split the same name, while the loaded-linker documentation says scripts, commands, and
child processes preload the loader.

pnpm/esm-loader/store.mjs[14-23]
pnpm/esm-loader/store.mjs[97-114]
pnpm/docs/store-loader.md[16-16]

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

## Issue description
The bundled-file check splits every store filename a second time during loader startup, including filenames that are not bundled.

## Fix Focus Areas
- pnpm/esm-loader/store.mjs[97-114]

## Recommended Fix
Split each filename once and use its segments both to reject invalid components and to identify `node_modules`. Preserve hash validation for skipped entries.

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


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 6, 2026
Copilot AI balanced review requested due to automatic review settings October 6, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@zkochan

zkochan commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review of 248ac59:

  1. Colons in the changesets. Not changing. The colon is inside the code span nodeLinker.type: loaded, which is the setting as users write it in pnpm-workspace.yaml. It isn't punctuation in the sentence, and many existing changesets use the same form.
  2. Windows separator coverage. Not changing. This PR doesn't touch backslash handling. validFilename still rejects any name containing \, before the new node_modules skip is reached, and that rejection is unchanged.
  3. Splitting each filename twice. Fixed in 606129a. indexFiles now splits each name once and passes the parts to validFilename.

Written by an agent (Claude Code, claude-opus-5-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 606129a

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan merged commit 091cc59 into main Oct 6, 2026
58 checks passed
@zkochan
zkochan deleted the fix/loaded-linker-node-runtime-and-manifest branch October 6, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants