feat(fs): long-tail ops — fsync/fdatasync, f*/l* metadata, readv/writev, statfs, glob (#976, recovery to main)#1007
Merged
Merged
Conversation
…ev, statfs, glob (#976) Completes the fs long tail across sync/callback/promise in both modes (epic #968): - Durability: fsync/fsyncSync, fdatasync/fdatasyncSync. - fd-variant metadata: fchmod/fchown/futimes (routed through a new fdPath primitive to the path ops) + Sync forms. - symlink metadata: lchmod (BSD/macOS-only -> ENOSYS elsewhere), lutimes. - vectored I/O: readv/writev + Sync forms (loops over read/writeSync). - statfs/statfsSync/promises.statfs (+ {bigint}), from DriveInfo. - a minimal glob/globSync/promises.glob: `*`/`?`/`**` matcher over a recursive readdir walk; the promise form is an async iterator (Node 22+). - exists (deprecated, non-err-first callback). Approach B: only the genuinely native ops need primitives — fsyncSync, fdPath, and statfsRaw — added in interp (FsModuleInterpreter) and as BCL-only emitted IL (RuntimeEmitter.FsLongTail.cs) so compiled output stays standalone. Everything else is one TS implementation in fs.ts/fs/promises.ts shared by both modes. FileHandle.sync/datasync now do a real fd flush. Deferred (issue-optional): realpathSync.native (function-property expando is unsafe in compiled mode) and openAsBlob (needs Blob). Gotcha: __globWalk's `catch { return }` tripped the compiled InvalidProgramException (the #973 return-in-catch pattern); restructured to an assignment-only catch. Verified byte-identical interp==compiled (scratch smoke), standalone preserved, 5 dual-mode tests per family (10 cases). Full suite 14472/0; TS conformance unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recovery PR. #976 was approved/merged in #1006 but landed on the
wrk/issue-972-filehandlebranch instead ofmain(GitHub had not yet retargeted the stacked PR). #972 is now on main (via #1005), so this PR carries only the #976 long-tail diff.Completes the fs long tail (fsync/fdatasync, fchmod/fchown/futimes, lchmod/lutimes, readv/writev, statfs+bigint, glob/globSync/promises.glob, exists) across sync/callback/promise in both modes. 3 new dual-mode primitives (fsyncSync/fdPath/statfsRaw), standalone preserved. Full suite 14472/0.