Skip to content

vfs: drop --vfs-mount, keep --vfs-load alone - #66162

Open
pipobscure wants to merge 1 commit into
nodejs:mainfrom
pipobscure:vfs-load-only
Open

pipobscure wants to merge 1 commit into
nodejs:mainfrom
pipobscure:vfs-load-only

Conversation

@pipobscure

@pipobscure pipobscure commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

vfs: drop --vfs-mount, pin the load mount point
--vfs-mount mounted a source without running it, and shared one ordered
list of sources with --vfs-load, so neither option could say which entry
it had contributed: the entry point was recovered from the position of
--vfs-load among the mounts, in a list NODE_OPTIONS could prepend to.
Nothing needs more than one mount from the command line: a program that
wants more can mount them itself through node:vfs, where it also gets
the instance.

Remove --vfs-mount, leaving --vfs-load with the single source it mounts
and runs, and reserve layer 0 for that source, numbering the file
systems a program mounts itself from 1. The source is then at the same
mount point in every thread, whatever else that thread mounts -
including a thread where a --require preload mounted a file system of
its own first - so a path into it stays valid in a worker.

A worker still does not run that entry point: it inherits the source but
not the decision to load from it. A worker created with its own execArgv
inherits neither, so the documentation now says that such a worker must
be given --experimental-vfs and --vfs-load again to run a script from
the mount, and that --experimental-vfs is also what makes node:vfs
available to the worker's own code.

ERR_VFS_INVALID_TARGET now names --vfs-load as the source's origin, and
the startup test moves to test-vfs-load.js, with the cases that covered
mounting without loading removed and cases for the reserved mount point
added.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Sep 20, 2026
@pipobscure

Copy link
Copy Markdown
Contributor Author

This is the alternate to #66119 so we can either have names for mounts, in which case --vfs-mount makes sense, or we go with this PR, which drops the idea of --vfs-mount entirely and just allows for --vfs-load.

@mcollina @jasnell @bakkot since you have been the most actively engaged on the topic and much more in tune with the philosophy of what should go into node-core, I'm asking for your guidance. I'm fine with either.

@bakkot bakkot 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.

Great, thanks, I think this ends up being a lot simpler/clearer.

Comment thread doc/api/cli.md Outdated
@pipobscure
pipobscure marked this pull request as ready for review September 21, 2026 09:15
@pipobscure
pipobscure marked this pull request as draft September 21, 2026 10:33
@pipobscure

Copy link
Copy Markdown
Contributor Author

I'm refactoring the reservation of layerId=0 into this branch and out of #66140. This way the two PRs are entirely independent of each other.

@pipobscure
pipobscure marked this pull request as ready for review September 21, 2026 11:15
@pipobscure

Copy link
Copy Markdown
Contributor Author

I'm refactoring the reservation of layerId=0 into this branch and out of #66140. This way the two PRs are entirely independent of each other. Plus I rebased on main and squashed.

@pipobscure

Copy link
Copy Markdown
Contributor Author

Note: this refactor makes #66162 and #66140 are now entirel independent of each other

@jasnell jasnell added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.52542% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.27%. Comparing base (36dd044) to head (e86cbc1).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/process/pre_execution.js 93.02% 3 Missing ⚠️
src/node.cc 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66162      +/-   ##
==========================================
- Coverage   90.29%   90.27%   -0.02%     
==========================================
  Files         790      790              
  Lines      272529   272495      -34     
  Branches    52031    52018      -13     
==========================================
- Hits       246083   246006      -77     
- Misses      16909    16954      +45     
+ Partials     9537     9535       -2     
Files with missing lines Coverage Δ
lib/internal/errors.js 98.81% <100.00%> (ø)
lib/internal/main/worker_thread.js 95.02% <100.00%> (ø)
lib/internal/vfs/file_system.js 99.62% <100.00%> (+<0.01%) ⬆️
lib/internal/vfs/provider_registry.js 93.68% <100.00%> (ø)
src/node_options.cc 80.68% <ø> (-0.27%) ⬇️
src/node_options.h 95.63% <ø> (ø)
src/node_worker.cc 81.77% <ø> (ø)
src/node.cc 77.36% <0.00%> (+0.22%) ⬆️
lib/internal/process/pre_execution.js 96.67% <93.02%> (+0.91%) ⬆️

... and 30 files with indirect coverage changes

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

@pipobscure

Copy link
Copy Markdown
Contributor Author

I’m seeing the same three jobs fail on #66127, #66140 and #66162 and given I ran test on Linux, Mac and Windows, I’m assuming it’s not related to these PRs. Could someone have a look.

@pipobscure

Copy link
Copy Markdown
Contributor Author

I have rebased on latest main in order to include:

Which were merged last night and hopefully deflake tests.

If someone can verify them and retrigger CI, I'd appreciate it.

--vfs-mount mounted a source without running it, and shared one ordered
list of sources with --vfs-load, so neither option could say which entry
it had contributed: the entry point was recovered from the position of
--vfs-load among the mounts, in a list NODE_OPTIONS could prepend to.
Nothing needs more than one mount from the command line: a program that
wants more can mount them itself through node:vfs, where it also gets
the instance.

Remove --vfs-mount, leaving --vfs-load with the single source it mounts
and runs, and reserve layer 0 for that source, numbering the file
systems a program mounts itself from 1. The source is then at the same
mount point in every thread, whatever else that thread mounts -
including a thread where a --require preload mounted a file system of
its own first - so a path into it stays valid in a worker.

A worker still does not run that entry point: it inherits the source but
not the decision to load from it. A worker created with its own execArgv
inherits neither, so the documentation now says that such a worker must
be given --experimental-vfs and --vfs-load again to run a script from
the mount, and that --experimental-vfs is also what makes node:vfs
available to the worker's own code.

ERR_VFS_INVALID_TARGET now names --vfs-load as the source's origin, and
the startup test moves to test-vfs-load.js, with the cases that covered
mounting without loading removed and cases for the reserved mount point
added.

Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
@pipobscure

Copy link
Copy Markdown
Contributor Author

Rebased on latest main as there was a conflict that wanted resolving.

@pipobscure
pipobscure requested a review from jasnell September 22, 2026 11:17
pipobscure added a commit to pipobscure/bundles that referenced this pull request Sep 22, 2026
--vfs-load shipped in v26.10.0 (nodejs/node#65748), so that is now the floor:
`engines` said >=26.0.0, which no version before 26.10 could satisfy for
anything that mounts.

Two things are also on their way out, and the code stops leaning on them now
rather than when they go:

  * --vfs-mount is removed in the next patch release (nodejs/node#66162), which
    leaves --vfs-load as the one flag that mounts anything and reserves layer 0
    for its source. Nothing here ran --vfs-mount any more; eleven comments still
    described it as the mechanism, and now describe --vfs-load instead. The
    recorder's note about several command-line mounts merging into one list
    goes with it — the command line mounts exactly one source now.
  * Named mounts are not going to happen (nodejs/node#66119, closed), and a
    mount point was never a caller's to choose either. The declaration said
    `mount(path?: PathLike)`; it is `mount(): string`, so the type stops
    offering an argument node will not take. Nothing here passed one.

And a test the recorder was missing: the README's recipe end to end, a preload
plus one real --vfs-load run, asserting that what the program read is listed and
what it never touched is not. Every other recorder test mounts by hand, which
checks the provider but never the flag and the preload meeting.

Against the released v26.10.0: typecheck clean, 127 of 128 pass. The one that
does not is sea.test.ts, which needs vfsArchive (#65810, not in 26.10) and says
so from its build-time self-test.
pipobscure added a commit to pipobscure/bundles that referenced this pull request Sep 22, 2026
… its way out

README, HISTORY, the example's README, the slides and their checklist now say
26.10 rather than 'the next 26.x', drop --vfs-mount from everything but the
note that explains its removal (nodejs/node#66162), record that layer 0 is the
--vfs-load source's and that named mounts (#66119) were closed. The release
workflow's header says what actually keeps it off now: it publishes.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 22, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 22, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants