feat(fs): long-tail ops — fsync/fdatasync, f*/l* metadata, readv/writev, statfs, glob (#976)#1006
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.
Closes #976 (part of epic #968). Stacked on #1005 (#972) — merge that first.
Completes the fs long tail across sync/callback/promise in both modes:
fsync/fdatasync(+Sync)fchmod/fchown/futimes(+Sync, routed through a newfdPathprimitive)lchmod(→ENOSYS),lutimes(+Sync)readv/writev(+Sync)statfs/statfsSync/promises.statfs(+{bigint})glob/globSync/promises.glob(*/?/**matcher; promise form is an async iterator)exists(deprecated)Only 3 genuinely-native ops needed new dual-mode primitives (
fsyncSync,fdPath,statfsRaw) — interp + BCL-only emitted IL (RuntimeEmitter.FsLongTail.cs), standalone preserved. Everything else is one shared facade TS impl.FileHandle.sync/datasyncupgraded to a real fd flush.Deferred (issue-optional):
realpathSync.native,openAsBlob.Tests: 5 dual-mode (10 cases). Full suite 14472/0; TS conformance unchanged.