vfs: drop --vfs-mount, keep --vfs-load alone - #66162
pipobscure wants to merge 1 commit into
Conversation
|
Review requested:
|
|
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. |
1e49322 to
0abd2c8
Compare
bakkot
left a comment
There was a problem hiding this comment.
Great, thanks, I think this ends up being a lot simpler/clearer.
|
I'm refactoring the reservation of |
1831297 to
bd8627c
Compare
|
I'm refactoring the reservation of |
Codecov Report❌ Patch coverage is
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
🚀 New features to boost your workflow:
|
bd8627c to
49f2d1f
Compare
--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>
49f2d1f to
e86cbc1
Compare
|
Rebased on latest main as there was a conflict that wanted resolving. |
--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.
… 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.
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.