A Node.js-compatible standard library for the Zun
platform. See PLAN.md for the architecture and the library roadmap.
A Node module lands here in whichever form fits what it actually does:
-
Native extension modules — a Rust
cdylibthat exportszun_register_v1and publishes its functions through the stablezun_abicontract. This is for modules that need the operating system, and it is how the lower half offsandosis written (src/fs/,src/os/): a syscall cannot be expressed in the language, so it is Rust and is loaded withzun run --ext <lib>. -
Zun TypeScript modules — written in the language the platform compiles, and run by the engine like any other program. This is for modules that are pure computation:
path(src/path/path.ts) is string manipulation end to end, so there is nothing to gain from crossing the ABI, and no--extis involved.querystring(src/querystring/querystring.ts),punycode(src/punycode/punycode.ts) andurl(src/url/url.tsplussrc/url/whatwg.ts) are the same kind;urlstands on the other two pluspath, and carries the WHATWG URL Standard — the parser, the hosts, the percent-encode sets, the setters andURLSearchParams— insrc/url/whatwg.tsrather than deferring to the engine's partial prelude classes.stream(src/stream/stream.ts) is the largest of them: pure computation overevents,process.nextTick, the globalBufferandstring_decoder— exactly the dependency setlib/internal/streams/*has.timers(src/timers/timers.ts) is the same kind for a different reason: it is not pure computation, but the capability it needs — the macrotask tier of the VM's unified event loop (NUCLEUS §9a) — is already inside the engine, so there is nothing for a native to do. It reaches that tier throughimport { timers } from "zun:core", and it declares the six timer globals itself, which is what gives Node's own signatures to every bundle.diagnostics_channel(src/diagnostics_channel/diagnostics_channel.ts) is pure computation again — a channel is a map, a list and a few calls — and it brings anAsyncLocalStoragewith it (src/async_hooks/async_hooks.ts), becauseChannel.bindStore/runStoresare defined in terms of one.console(src/console/console.ts) is the second module aftertimersthat has to be inlined into every bundle, and for the same kind of reason:consoleis a global in Node, while the engine's preludeconsolehas five of its nineteen methods and a compile error for the rest. The binding that shadows it is one file of its own (src/console/global.ts), so that a test declaring its ownconsolecan still be bundled.perf_hooks(src/perf_hooks/perf_hooks.ts) is the third global of that kind, and the clearest case of the seam being drawn by capability rather than by subject: a performance timeline is marks in a map, entries in three arrays and observers in a list — pure computation — and the one thing it cannot compute is a clock, whichprocessalready answers asprocess.hrtime. So it needs no native of its own and runs with or without--ext; the extension only sharpensperformance.now()from whole milliseconds to the platform monotonic clock.domain(src/domain/domain.ts) is the kind's limiting case: it computes nothing at all for itself — a domain is a stack, a member list and an error route — but Node implements it by monkey-patchingevents,processandtimers, which this engine has no prototype model to allow. So the three modules declare one hook record between them (__domainHooksinsrc/events/events.ts), every slot of it isnull, andsrc/domain/domain.tsis the only writer; seetest/domain/README.mdfor the table of what each slot replaces.vm(src/vm/vm.ts) is the kind's other limiting case, from the opposite side: compiling source text at run time sounds like the least library-expressible thing in Node, and it turns out the engine already owns the capability.new Function(...)is lowered to thefunctionConstructintrinsic and answered by an injectedEvalHostthat calls the project's own compiler, sovmneeds no syscall and no native — only the Node-shaped surface over that one primitive. It is the one module that must run without--ext, becausezun run --extinjects no such host; seetest/vm/README.md.consolecan still be bundled.readlineandreadline/promises(src/readline/) are pure computation overevents,stream,string_decoderandtimers— a line editor is string arithmetic, and the one thing a terminal adds,setRawMode, belongs to the input stream — and they are the first module written as three files: the shared base and everything around it insrc/readline/readline.ts, plus oneclass Interface extends __RlInterfacein each ofsrc/readline/callback.ts(the callbackquestion) andsrc/readline/promises.ts(the promise one), because the two module objects have to bind that one name to two different classes. Their tests are nevertheless run with--ext: three files in the corpus read their input from a file, which isfs. -
Zun TypeScript over natives — both, with the seam drawn where the capability changes.
osis the first: the facts it reports are syscalls (src/os/, Rust), while the module Node exposes is objects, arrays,constants, validation andERR_*errors (src/os/os.ts, Zun TypeScript), which reaches the natives withimport * as native from "node:os". Its tests are bundled like a TypeScript module and run with--ext. ABI v1 carries one scalar word per value, soosalso fixes how a structured result crosses — one status-prefixed, separator-delimited string per call, documented insrc/os/mod.rs.fsis the same shape:src/fs/*.rsfor the syscalls and the descriptor table,src/fs/fs.tsfor the Node API, with one additionosdid not need — a file's bytes cannot ride a NUL-terminated string carrier, so they cross base64 and the TypeScript side turns them into the engine's preludeBuffer.child_processis the third:src/child_process/*.rsspawns a child and either waits for it or streams it through the I/O loop (std::process::Command, a thread per pipe, a timeout with a chosen kill signal), whilesrc/child_process/child_process.tsholds the module Node exposes — the argument normalizers, the shell rules, thestdiogrammar, the result object, andfork()with its IPC channel (a loopback socket the child connects back to, JSON-framed). A spawn request cannot cross one scalar word at a time either, so it crosses as one delimited string in the same grammar, with the child's output base64 for the same reason a file's bytes are.processis the fourth, and the only module in three files:src/process/*.rsfor the pid, the clocks,getrusage,kill,chdir, the realumask, the environment block and the POSIX credentials;src/process/process.tsfor Node's object; andsrc/process/native.tsfor the import alone. The third file exists because every bundle in this library inlinesprocess.tswhile most of them run with no--extat all, so the import has to be separable —tools/bundle_node_test.shappendsnative.tsonly for a bundle that will get an extension, andprocess.tskeeps a documented fallback for every native-backed value (the table is in its header).zlibis the fifth:src/zlib/*.rsholds onez_stream(or Brotli or zstd encoder/decoder) per handle behind a small handle table, overlibz-rs-sys, thebrotlicrate andruzstd— all pure Rust, so the extension still builds with nothing but a Rust toolchain — whilesrc/zlib/zlib.tsholds the module Node exposes: elevenTransformclasses, thecreate*factories, the sync and callback convenience methods,constants/codesand the option validation. Compressed bytes cross base64, the same carrierfsuses and for the same reason.v8(src/v8/v8.ts) andtty(src/tty/tty.ts) are the last two of this kind so far, and both are the seam-by-capability case again.node:v8looks like the most engine-bound module in Node's library and is in fact almost entirely arithmetic: V8's value-serialization wire format is bytes over the engine'sBufferand aDataView, soserialize/deserializeare byte-identical to Node's here, while the readings that are V8's — heap spaces, a sampling profiler, a heap graph — have no isolate under them and are reported shape-true and content-empty, each row named in the resolution table in that file's header.node:ttyis the same split one level down:isatty(fd)is a real predicateprocessalready answers,getColorDepth/hasColorsisprocess.envarithmetic, the two terminal streams areDuplexes fromstream, and the four cursor methods arereadline's own functions reached through its module object — which is whyttyis the one module here that depends onreadlinerather than the other way round.netis the first module of this kind whose natives are not its own, and that is worth a paragraph, because what it needed first was notnetbut a piece of infrastructure this library did not have. Every native above blocks:osasks the kernel a question and gets an answer,fsreads a file,dnsresolves a name, and the asynchrony of Node's API is restored on the TypeScript side by delivering the result throughprocess.nextTick— the patternsrc/dns/dns.tsdocuments as "synchronous natives, asynchronous API". A socket cannot work that way: a server has to be waiting for a connection while the program runs, two sockets have to make progress at once, and a read has to complete after the call that armed it returned. ABI v1 gives an extension no way to complete a call later, so the direction is inverted instead — no native waits for a particular event (each one either completes or answers "not yet"), and one native waits for any registered handle. That is the readiness model (select/poll), and it is the only asynchronous I/O this ABI can express. So the lower half ofnetis notsrc/net/*.rsbutsrc/io/mod.rs+src/io/sys.rs— a table of non-blocking handles, the eleven verbs on one, andioPoll(timeoutMs)— published undernode:io, with its scheduling half insrc/io/io.ts:ref/unrefaccounting, the pump, and the dispatch to callbacks. Nothing in either file is socket-shaped beyond TCP's own verbs, becausedgram,child_process.spawn's pipes,fs' streams andhttpare meant to register with that same loop rather than start a second one.src/net/net.tsis thennetas Node exposes it:Socketas astream.Duplexwhose_read/_write/_final/_destroyare the loop's events,Serverover one listening handle, andisIP/BlockList/SocketAddress/the argument cascades as pure shape.io.tsis inlined into every bundle for the reasonprocess.tsandtimers.tsare — the harness asks it how many ref'd handles are live — so itsimportlives insrc/io/native.tsand is appended only for a bundle that gets--ext.
Support slices exist to run Node's own tests, and are Zun TypeScript for the
same reason: src/assert/assert.ts is the strict-mode assert surface the
tests assert with. src/util/util.ts and src/process/process.ts used to be
two more; both are modules in their own right now, and assert stands on util
rather than carrying its own copy of inspect and deepStrictEqual.
The bar is Node.js 25's own test suite, not tests written here. The workflow
.github/workflows/node-compat.yml
downloads the Node test/parallel/test-<module>*.js files at a pinned tag,
runs each through the Zun engine
(tools/run_node_tests.sh), and reports the share that
passes. The percentages below are that measurement — they climb as the library
grows.
The util, path, events, os and process numbers below were last
regenerated on Windows (the CI workflow runs on ubuntu-latest). One test differs between the two:
test-os-process-priority.js passes on Linux and fails on Windows
(zun#34), while
test-path-win32-normalize-device-names.js is only a real signal on Windows,
where it passes — on Linux it common.skips, which the harness scores as a
pass. So os reads 1/7 here, and should read 2/7 on Linux once CI runs again —
test-os-eol.js's fix is platform-independent and
test-os-process-priority.js already passed there.
Because the engine has no CommonJS require or module resolution
(zun#4), a Zun TypeScript module's
tests are first passed through
tools/bundle_node_test.sh, which inlines the
util/events/process/assert/path/querystring/punycode/url/timers/console
modules, src/process/native.ts when the bundle will be run with --ext, the
modules the test actually requires (os, buffer, string_decoder, stream,
fs, child_process, diagnostics_channel, domain) and the
common harness (plus node:test when the test requires it) ahead of the test body,
rewrites its require lines to the one object each
inlined module exposes (__node_events, __node_assert, …), and appends the
statement that settles the event loop and verifies the common.mustCall counts;
the resulting single file runs as zun run <bundle.ts>. Extension modules keep
the direct zun run --ext <lib> <test.js> path.
██████████████░░░░░░░░░░ 61.2% — 139 / 227 Node test-fs-* tests passing
fsis implemented as TS over natives, theoskind:src/fs/*.rsholds the syscalls and the descriptor table,src/fs/fs.tsholds the Node module — the whole synchronous surface with Node's option shapes,Stats/BigIntStats/Dirent/Dir/StatsFs,fs.constants, theERR_*and libuv-shaped errors, the callback API andfs.promises. Three more files complete it:src/fs/streams.tsisReadStream/WriteStreamoversrc/stream/stream.ts,src/fs/watchers.tsiswatch/watchFile/unwatchFile/fsPromises.watchas pollers — which is what libuv itself is forwatchFileand what Node's own recursive fallback is forwatch— andsrc/fs/internal.tsis theinternal/fs/utilssurface six of Node's tests drive directly. Onlyglob(no file in the corpus reaches it) andopenAsBlob(needsnode:buffer'sBlob) are still named gaps. What caps the number is not the library but one engine limit: aBufferis opaque throughany(zun#38), so a test file cannot call a method on one this module returns, nor pass ananytoBuffer.from/byteLength/alloc(zun#58) — which is how most of the corpus is written. Per-test breakdown and the full blocker table:test/fs/README.md,test/fs/RESULTS.md.
██████████░░░░░░░░░░░░░░ 42.3% — 11 / 26 Node test-util* tests passing
utilis implemented end to end —inspectwith every option Node documents (including the Node 25 regular-expression depth highlighter and thecompact/breakLengthline-breaking algorithm),format/formatWithOptions,isDeepStrictEqual,promisify,callbackify,deprecate,debuglog,types,styleText,stripVTControlCharacters,parseArgs,parseEnv,MIMEType, thegetSystemError*trio over libuv's 85-row table, and the abort helpers. It was taken beforestreambecausestreamcannot be written without it, and becauseassertnow formats its messages withutil.inspectand compares withutil.isDeepStrictEqual, the way Node'sassertdoes. No remaining failure is inutil.ts: eleven of the nineteen need a harness module that does not exist (vm,v8,worker_threads,url,node:fs,child_process,internal/test/binding,internal/errors), and the other eight are engine gaps — four of them found by this work: typed arrays andArrayBufferare completely opaque through ananylane, a symbol'sdescriptionpanics the interpreter there, assigning to a built-in namespace member (Object.keys = fn) panics, and a regex literal with a duplicate named capture group is rejected although ES2025 and Node 25 accept it — that last one is the only thing standing betweentest-util-inspect-regexp.jsand a pass, since all ~100 of its colour expectations match byte for byte without it. All four were re-probed against this engine build and all four still hold. One of the eight changed shape: accessors are reflectable now (a class or object-literal accessor's descriptor carries workingget/setslots), butdesc.get.apply(obj, [])aborts the interpreter andapplythreads no receiver, sogetters: truestill cannot invoke a getter that readsthis— which is whattest-util-inspect-getters-accessing-this.jsis about. The blocker-by-blocker table is intest/util/README.md, the per-test breakdown intest/util/RESULTS.md.One file joined the passing set without a line of
util.tschanging:test-util-deprecate.jsneeded a one-field fix one module over.ProcessWarning.codeinsrc/process/process.tswas declaredstring = "", so a warning raised with no code reported''where Node reportsundefined. A warning has acodeonly when one was passed, which is what the field says now (any = undefined).One
inspectbug came out of this engine update and is fixed here: afunctionBoxrecord reportstypeof === "function"now rather than"object", so the unwrap guard stopped opening it — and because a box is tagged[object Object]exactly like a class, every ordinary function reached through an array, an object property or ananylane printed as[class (anonymous)]. Functions print[Function (anonymous)]again ([Function: name]waits on zun#25) and classes print[class Foo]. A second one came for free: a function-valued property is visible toObject.keysnow, soinspect({ fn() {} })is{ fn: [Function (anonymous)] }rather than{}.
█████░░░░░░░░░░░░░░░░░░░ 21.4% — 3 / 14 Node test-assert* tests passing
assertis the module every other corpus runs through — eachtest/parallel/test-*.jsopens withconst assert = require('assert')— and it is now implemented end to end rather than as a harness slice: the callable module object,ok,equal/notEqual(loose, with Node 25'sNaN == NaNrule),strictEqual/notStrictEqual(Object.is, so0and-0differ),deepEqual/notDeepEqual(loose deep equality — it used to be aliased to the strict comparison, which was simply wrong),deepStrictEqual/notDeepStrictEqual,partialDeepStrictEqual,throws/doesNotThrow,rejects/doesNotReject,match/doesNotMatch,fail,ifError,assert.strict,require('assert/strict')and Node 25'sassert.Assertclass.AssertionErrorcomposes Node's own generated messages: thekReadableOperatorheaders, the+ actual - expectedMyers line diff with its.../"Skipped lines" collapsing (a port oflib/internal/assert/myers_diff.js, exported asinternal/assert/myers_diffbecause Node's own test file requires it), the shorta !== bform and the stacked form with its^indicator — verified byte for byte against Node.CallTrackerandfail's legacy four-argument form with DEP0094 are absent because Node 25 removed them, not as a gap. No remaining failure is inassert.ts. The dominant blocker is new and was found by this work:err instanceof assert.AssertionErrordoes not compile, because the right operand ofinstanceofmust be a literal class name — which takes outtest-assert.js,test-assert-async.jsandtest-assert-class.jsbetween them. The rest are typed arrays through ananylane (zun#38), a class method that cannot be read as a value (zun#19),err.stackhaving no setter,new Array(a, b, c)being rejected, and two files that needrequire()of a fixture module and a child process. The blocker-by-blocker table is intest/assert/README.md, the per-test breakdown intest/assert/RESULTS.md.
████████████████████████ 100.0% — 17 / 17 Node test-path* tests passing
pathruns the whole Node corpus and passes all of it. The notes are intest/path/README.md, the per-test breakdown with a failure note for each intest/path/RESULTS.md.test-path-parse-format.jspasses now: it needed a value that is callable and carriesstrictEqual& co., and a function can carry callable properties (zun#14 is closed), soassert.tsis a real function with the methods attached. The last one,test-path-resolve.js, re-executes a fixture throughchild_process.spawnSyncon Windows, so the corpus now runs with the extension.
████████████████░░░░░░░░ 68.5% — 24 / 35 Node test-event-emitter-*|test-events-* tests passing
eventsis implemented end to end — the wholeEventEmittersurface, every module static, and nowEventEmitter.prototypeas Node's own object:constructor, the three bookkeeping defaults and every instance method, each reachable and callable with a receiver, soEventEmitter.prototype.on.call(plainObject, 'x', fn)andEventEmitter.prototype.emit.apply(ee, args)both work andE.on === E.addListenerholds. That one addition is worth three files (get-max-listeners,method-names,once), and the trick behind it is that an object-literal method is the one callable this engine threads a receiver into —m.call(recv, a, b)bindsthisand passes the arguments, where a plain function value losesthis(zun#1) and a function in a class static field cannot be called at all. Two more files came from the bundler learning thatEventEmitter.onceandevents.onceare literally the same function in Node, which lets it route the five statics that collide with an instance method name through the module object (zun#20), and one from coercing every slot key the way ToPropertyKey does: a function stored under a numeric computed key is silently dropped by this engine, soee.on(123, fn)landed in a slot thatinandObject.keysreported and every read answeredundefinedfor.The number is still capped by the tests reaching for engine features rather than by the module being thin: five files need a bound
thisinside a listener or on a.call(zun#1), two stand on the single lineassert(!(e._events instanceof Object))—Object.create(null) instanceof Objectanswerstrue(zun#26) — three need the function-constructor/prototype model (zun#25), and three require Node'sinternal/event_targetand anEventTargetthe host does not let a library replace (class EventTargetis aduplicate class; the prelude's has no listener reader).test-event-emitter-error-monitor.jsis down to one line,.then(common.mustCall()):thensilently drops a boxed function handler (zun#71).test-event-emitter-special-event-names.jskeeps the storage layer honest —_eventsis a real null-prototype object, so an event namedtoString,__defineGetter__or__proto__is an ordinary key, which needs both engine regressions (#46, #47) compensated.Six more files came in with
stream, and none of them needed a line ofevents.ts: the bundler learned to collapse a renamed alias of a canonical binding —const { EventEmitter: EE } = require('events')andconst EE = require('events').EventEmitter;both leaveEEbound to the class now — because a class base must be the original class's own identifier (zun#21) andnew EE()over a class value answersundefinedat run time. A seventh came from the coded-error bases printing theircodeinString(err)the way Node's do, which is whatassert.throws(fn, /ERR_SOMETHING/)matches against. The full blocker-by-blocker table is intest/events/README.md, the per-test breakdown intest/events/RESULTS.md.
██████░░░░░░░░░░░░░░░░░░ 28.5% — 2 / 7 Node test-os* tests passing
osis complete — every function,constantsfor both platforms,EOL,devNull, the validation and theERR_SYSTEM_ERRORshape — and verified by a differential run against Node over 140 values (every string fact, the wholeconstantstable, every CPU row, every interface entry with its CIDR and scope id,userInfo()in both encodings, all eight validation messages and everytmpdir()environment rule): zero divergences on Windows and zero on Linux. The corpus number is low because the seven test files are unusually harness-hungry: two requireinternal/test/bindingto monkey-patch theosbinding, two re-run themselves throughchild_processto see a different environment, andtest-os.jsasserts`${os.hostname}` === os.hostname()for ten getters — template interpolation of a function value ignores the function's ownSymbol.toPrimitive/toString/valueOfand yields the literal[function](zun#36). That file used to be blocked ahead of #36 by needing a callableassert(zun#14, now closed —assert.tsis a real function carrying the methods), so its ownishelper runs now and #36 is all that is left.test-os-eol.jspasses:assert.throws(fn, TypeError)with the constructor as a value works now, becauseassert.tsmatches the standard error constructors by identity and spells theinstanceofagainst the literal class (zun#17 still leaves a constructor value with no.nameand unusable on the right of aninstanceof).test-os-process-priority.jspasses on Linux but not on Windows, where it needs a top-level destructuring declaration to be visible to a function body (zun#34) — the number above was measured on Windows. The blocker-by-blocker table is intest/os/README.md, the per-test breakdown intest/os/RESULTS.md.
██████████████░░░░░░░░░░ 60.9% — 39 / 64 Node test-buffer* tests passing
bufferis the first module whose central object is the engine's, not this library's: Node'sBufferis aUint8Arraysubclass, and Zun's is a nominal alias for theUint8Arraybyte-view floor — a realm global with its statics recognised by receiver name in the checker and its instance methods lowered to thenodeBufferintrinsics (NUCLEUS #21). Node'sbuffer.BufferandglobalThis.Bufferare the same object, sosrc/buffer/buffer.tsis the module surface around that global and never a second Buffer:Bufferis this module's canonical binding in the bundler, the wayEventEmitterisevents'. That surface is complete —kMaxLength,kStringMaxLength,constants,INSPECT_MAX_BYTESas Node's validating accessor pair, a strict WHATWGatob/btoa,isUtf8,isAscii,transcodewith ICU's exact substitution and strictness rules (verified over a 544-case matrix),Blob,File,resolveObjectURL(there is noSlowBuffer: Node removed it in v25) — and it carries the one piece of the inspector thatlib/buffer.jsowns, so a byte view prints as<Buffer 61 62 63>and, undercustomInspect: false, asBuffer(3) [Uint8Array] [ 97, 98, 99 ]. The number is low because every remaining failure is an engine gap, and the biggest one is a single rule: thenodeBufferintrinsics take machine integers, so a plainnumberis rejected at the call site (Buffer.alloc(n)wherenis a parameter does not compile), which costs 32 of the 64 tests on their first line. Behind it:compare/toJSON/entries/buffer/byteOffset/parent/isEncoding/of/allocUnsafeSloware absent and absent at compile time, a byte view is opaque throughany(onlyBuffer.isBufferandArrayBuffer.isViewsurvive that boundary), and — the serious one — the GC frees a live Buffer's backingArrayBuffer, reproducibly on the 256th class instance, because a view object carries type RID 0 and the mark phase has no reference slots for it; reached through a dynamically dispatched call that failure is silent and the read answersundefined. The four historical Buffer CVEs were checked one by one; two are unreachable rather than fixed, one (UCS-2writenear the end) writes a partial code unit though never past the end, and a fifth hazard turned up:Buffer.alloc(-1)panics the interpreter. The per-test blocker table, with a standalone repro for each group, is intest/buffer/README.md; the per-test breakdown intest/buffer/RESULTS.md.
████████░░░░░░░░░░░░░░░░ 33.3% — 1 / 3 Node test-string-decoder* tests passing
StringDecoderis implemented end to end over the globalBuffer—write,end,text,lastChar/lastNeed/lastTotal, for utf8, utf16le, ucs2, base64, base64url, hex, latin1 and ascii — following Node's own pure-JavaScript decoder (there is nointernalBinding('string_decoder')to wrap), with the two places Node 25's C++ decoder diverges from it handled: one U+FFFD per maximal subpart of an aborted sequence, and Node 25's shape for the legacytext(buf, offset). Beyond the corpus (test-string-decoder-end.jspasses), it is verified the wayosis — a differential run against Node overtest-string-decoder.js's own driver (33 byte sequences × every possible split across successivewrite()calls × 8 encodings = 1216 cases, including every invalid-UTF-8 vector in the file and both nodejs/node#22626 regressions) plus all 32testEndvectors oftest-string-decoder-end.js, and re-verified over a further 1056 cases compared code unit by code unit so a surrogate pair cannot hide a bug: zero divergences. The caller-supplied buffer is validated withBuffer.isBufferrather thanArrayBuffer.isView, which removes a latent crash — aUint16Arrayor aDataViewcannot have its bytes read in this engine, and trying is an uncatchable error. The two failures are engine gaps, none of them in the decoder: the fuzz oracleBuffer#toString('utf16le')destroys lone surrogates (zun#57), and a function called with one more argument than it declares is a compile error (zun#154). Table intest/string_decoder/README.md, breakdown intest/string_decoder/RESULTS.md.
████████████░░░░░░░░░░░░ 50.0% — 2 / 4 Node test-querystring* tests passing
querystringis implemented end to end —parse/decode,stringify/encode,escape,unescape,unescapeBuffer,maxKeys, customsep/eqof any length, and thedecodeURIComponent/encodeURIComponentoptions — following Node's own scanner instruction for instruction, including the quirks its tests pin (which empty segment spends amaxKeysslot, thatparse('a=b', [])drops the value, thatescapeconsumes the code unit after a high surrogate and masks it). Results are null-prototype objects, so a__proto__=1query yields an own key (throughObject.defineProperty, because zun#47 makes a plain__proto__assignment rewrite the prototype instead) and never reachesObject.prototype, and nothing in the module builds a RegExp — which is the structural reasonquerystringhas no CVEs of its own in Node's history. The two failures are not inquerystring.ts: both of Node's remaining files open theircheck()with the bare callable formassert(!(actual instanceof Object)), andinstanceof Objectanswerstruefor a null-prototype object on this engine (zun#26) — which is exactly what that line denies. With it removed,test-querystring-multichar-separator.jspasses in full. The callable-asserthalf of the old blocker (zun#14) no longer reproduces as of enginec4afcca4, andtest-querystring.js'svm.runInNewContext('({"foo": ["bar", "baz"]})')is served by the realnode:vmnow (src/vm/vm.ts). The blocker table is intest/querystring/README.md, the per-test breakdown intest/querystring/RESULTS.md.
████████████████████████ 100.0% — 1 / 1 Node test-punycode* tests passing
punycodepasses its whole corpus:encode,decode,toASCII,toUnicode,ucs2.decode/ucs2.encodeandversion, verified against all nineteen RFC 3492 test vectors plus the surrogate and email-address cases, and the DEP0040 deprecation warning that Node emits when the module is required — which is why theprocess.emitWarningcall lives in its ownsrc/punycode/deprecation.ts, inlined by the bundler only for a test that actually requirespunycode(src/url/url.tsuses the algorithms without being apunycoderequire). Getting there neededassert.throws(fn, regexp)fixed to matchString(err)the way Node's does, and the Bootstring state variables annotatednumber: a conditional whose branches mix an integer-typed constant with a float-typed expression yields anAny, and passing that to anumberparameter panics the interpreter (new bug, found by this work). Details intest/punycode/README.md.
█████████████████████░░░ 88.6% — 39 / 44 Node test-url*|test-whatwg-url-* tests passing
urlis implemented end to end, on both of its halves.src/url/url.tsis the legacy API —parse(withparseQueryStringandslashesDenoteHost),format(string, object andURLforms, plusformat(URL, options)),resolve,resolveObject, theUrlclass,domainToASCII/domainToUnicode,fileURLToPath/pathToFileURLfor both platforms andurlToHttpOptions— following Node'slib/url.jsandlib/internal/url.jsinstruction for instruction, becauseurl.parseis explicitly not standardized (that is what DEP0169 says) and its behaviour simply is that code. Every CVE guard is reproduced rather than simplified: the scheme is lower-cased before any protocol-set decision (CVE-2018-12123), the hostname is re-checked against the forbidden set after IDNA so a NUL can neither be accepted nor truncated away (the CVE-2026-48930 class), an empty post-IDNA hostname throwsERR_INVALID_URL, andparse(url, true)hands back a null-prototype query. Node's eight regular expressions here are eight hand-written scans, so the parser owns no backtracking engine.
src/url/whatwg.tsis the WHATWG URL Standard itself — the basic URL parser as its 21 states (stateOverrideincluded, which is what every setter runs), host parsing with the IPv4 and IPv6 parsers and serializers and IDNA, the eight percent-encode sets, the URL and origin serializers, every getter and setter,URL.canParse/URL.parse, andURLSearchParamsin full with the live link back to the URL that owns it. Measured against the WPT fixtures Node ships: 869 of 869urltestdata.jsonconstructor cases bar seven, and 270 of 270setters_tests.jsonsetter cases with no divergence at all — the seven are each one line of the UTS#46 mapping table this runtime has no ICU for. The classes are declaredNodeURL/NodeURLSearchParams, becauseURLandURLSearchParamsare prelude class names here and a user class of the same name is a "duplicate class" error; the bundler rewritesnew URL(…),URL.<static>andx instanceof URLto them, exactly as it already rewritesconsole,performanceandcrypto.Because the corpus now covers both prefixes (
test-url*andtest-whatwg-url-*, 44 files), and six of them cannot be bundled or expressed on this engine at all, the module is also checked directly against Node's own expectation tables: 89parseTestscases (all twelve fields, the whitespace-trimmed re-parse andformat(expected)), 29formatTestscases in both forms, all 194relativeTests2and 31relativeTestsresolve cases, the 51pathToFileURL/ 43fileURLToPathcases with their error paths, and 35URLSearchParamscases — zero divergences.test-url-relative.jstherefore fails on the engine, not onurl.ts: the run corrupts a long-lived array of strings after roughly 80url.resolvecalls and the interpreter panics on the loop counter (zun#67, re-confirmed onc4afcca4). TheURLPatternis implemented too (src/url/urlpattern.ts, the URL Pattern Standard over the same basic URL parser). The remaining failures are the function/prototype/descriptor model, symbol-keyed class members (Symbol.iterator,Symbol.toStringTag,util.inspect.custom), reading a class method as a value for themethod.call(undefined)brand checks,child_process,eval, and spread into a built-in. The blocker-by-blocker table is intest/url/README.md, the per-test breakdown intest/url/RESULTS.md.
███████████████░░░░░░░░░ 65.5% — 38 / 58 Node test-timers* tests passing
timersis the first module whose substance was already in the engine: the VM owns the event loop (NUCLEUS §9a — one unified loop that drains Promise microtasks and fires timers, on a virtual clock that fast-forwards to the next due time instead of sleeping). What Node adds on top is shape, and that is whatsrc/timers/timers.tsis — theTimeoutandImmediateobjects with Node's own enumerable fields,ref/unref/hasRef/refresh/close/[Symbol.toPrimitive], the delay coercion with its threeTimeout*Warnings,clearTimeoutby object or id, the DEP0096enroll/unenroll/activetrio, andtimers/promises'setTimeout/setImmediate/setInterval(an async generator) plusscheduler.wait/scheduler.yield, all withAbortSignaland therefoption. It is also where zun#29 gets its answer:setTimeout& co. are globals in Node and typed intrinsics in Zun, so Node's tests — which pass ananycallback and clear with an object — are rejected at compile time. Declaring the six names as top-level functions shadows the intrinsics program-wide, and the implementation reaches the loop throughimport { timers } from "zun:core"instead, where the native's callback parameter isOpaque. Beyond the corpus the module was checked against Node directly — one 33-assertion driver run unchanged undernodeand underzun run, zero divergences. The failures are not intimers.ts: thirteen files need a harness module that does not exist, nine are two new engine bugs (a barereturn;in a function whose return type was inferred asAnyis rejected; an explicitobj[Symbol.toPrimitive]()panics the interpreter although every implicit coercion works), three need a closure to see aconstinitialised by the statement it was created in, and one is an honest ordering deviation — libuv runs immediates in a check phase after the timers phase, while the VM has a single macrotask tier. A third new engine bug was found and worked around here:clearTimeout('16')panicked, because reading an undeclared property off a string held in ananyaborts the run. The harness gained something real in exchange: the settle loop now asks this module how many ref'd timers are armed and when the next one is due, so it stops guessing and jumps the virtual clock instead of spending a turn per millisecond, and it emitsprocess'beforeExit'. Blocker table:test/timers/README.md; per-test breakdown:test/timers/RESULTS.md.
██████████████░░░░░░░░░░ 60.4% — 58 / 96 Node test-process-* tests passing
processis the module every other bundle in this library stands on, and the only one in three files:src/process/*.rsfor the pid, the clocks,getrusage,kill,chdir, the realumask, the environment block and the POSIX credentials;src/process/process.tsfor Node's object; andsrc/process/native.tsfor the import alone, inlined only when a bundle will be run with--ext. The remaining failures are not a thin surface:processitself is complete, and 30 of the 54 are a harness module the bundler does not provide (net,v8,inspector,internal/test/binding,hijackstdio) or a test that re-runs itself asspawn(process.execPath, [__filename])— a child that would have to be Node. Blocker table, grouped by cause, with the three engine bugs this corpus found:test/process/README.md; per-test breakdown:test/process/RESULTS.md.
███████████░░░░░░░░░░░░░ 49.5% — 54 / 109 Node test-child-process* tests passing
child_processis TS over natives (theoskind), both halves, the asynchronous one over the shared I/O loop insrc/io/thatnetanddgramuse.src/child_process/spawn.rsruns one child to completion withstd::process::Commandplus the three thingsCommanddoes not do on its own (feed stdin from its own thread, enforce a timeout and kill with a chosen signal, and cap a pipe atmaxBufferwithENOBUFS) —spawnSync,execSync,execFileSync.src/child_process/asyncp.rsstarts a child and returns: each stdio pipe is drained by a small thread into a bounded buffer (a reader that falls behind makes the child block, which is real backpressure), a thread waits on the child, and every thread wakes the loop through one condition variable, because an anonymous pipe cannot be put in a Windowsselectset and a child's exit cannot be polled on POSIX either.child_process.tsis Node's shape on top of it:ChildProcess(anEventEmitterwithstdin/stdout/stderrasWritable/Readable,pid,exitCode,signalCode,kill,ref/unref,'spawn'/'exit'/'close'/'error'in Node's order),spawnwithtimeout/killSignal/signal,exec/execFilebuilt onspawnaslib/child_process.jsbuilds them,util.promisify,getValidStdio.fork()andstdio: [..., 'ipc']run over a loopback-socket IPC channel (JSON messages,sendcallbacks,disconnect,process.sendin the child; noadvancedserialization or handle passing),stdiois otherwise'pipe'/'ignore'/'inherit'/fd 0–2, and the stdio streams are notnet.Sockets. 47 files runprocess.execPathas a child, andzun runtakes neither a CommonJS file nor script arguments, soprocess.execPathis a launcher under the test runner:zun-node-run(src/bin/zun-node-run.rs) speaksnode <script.js>/-e/-p, bundles the script withtools/bundle_node_test.sh(cached) and runszun run --exton the bundle; the arguments travel inZUN_NODE_ARGV. The decision, and what it cost to get right (a stale bundle cache, a fork bomb), is intest/child_process/README.md; per-test breakdown:test/child_process/RESULTS.md. The POSIX half ofasyncp.rswas written but not compiled or run.
███████████████░░░░░░░░░ 63.2% — 129 / 204 Node test-stream-*|test-stream2-*|test-stream3-*|test-streams-*|test-readable-* tests passing
streamis the largest module here by a wide margin — 204 Node files againstsrc/stream/stream.ts— and it is implemented end to end:Streamwith the legacypipe,Readable(flowing and paused modes,read,push,unshift,setEncodingoverstring_decoder,pipe/unpipewith theawaitDrainWritersset, backpressure, objectMode,destroy, async iteration,Readable.from,wrap),Writable(write/end/cork/uncork,_writevbatching,_final,drain),Duplex(+Duplex.fromin all seven shapes),Transform,PassThrough,pipelinein both forms,finished,addAbortSignal,compose,destroy,duplexPair, theis*predicates, the default-high-water-mark pair,stream/promises, and all eleven async operators. The state machines are Node'slib/internal/streams/*.jstranscribed instruction for instruction, because which of'end','finish','close','error'and'drain'fires in whichprocess.nextTickturn is pinned by this corpus and derivable from nothing else — Node 25's bit-packedkStateis plain properties here only because the tests read two dozen state fields straight off the state object. Since most of the corpus is blocked before its first assertion, the module is verified the wayos,string_decoderandurlare: two differential runs against Node over 46 scenarios — the event order of every class, the whole error matrix,cork/_writev, the option flags,read(n)slicing, every operator, async iteration,pipeline,compose,duplexPair,addAbortSignal— with one divergence, an interleaving between two independent streams rather than a reordering inside one. Three real bugs came out of those runs rather than out of the corpus, which is the point of them.Two shapes the engine forces, both argued at the top of the file. The two states are plain objects, because a function assigned to a class field stops being callable (a new engine bug, one of five found here) and
onwrite, the eight option hooks and the parked Transform callback are all functions. And the eight overridable hooks (_read,_write,_writev,_final,_destroy,_construct,_transform,_flush) are accessor pairs overstate.fnsrather than methods: 51 of the 204 files assign a hook onto an instance and 26 subclass, a class member cannot be both, and the "is there an implementation?" question cannot be asked without making the call — so the dispatchers make it and read the engine's ownTypeError: _read is not a functionas the answer. One deliberate deviation: a byte-mode string chunk stays a string instead of becoming a Buffer, becauseBuffer.fromrejects anany(zun#58), a view is opaque through one (zun#38) and the GC frees its backing store (zun#55); the accounting still charges Node's UTF-8 byte length, so every high water mark anddrainthreshold agrees with Node.The number is what it is because the corpus reaches for language features rather than for stream features. Fourteen files still require a module that does not exist here (
http,http2,net,readline,async_hooks,internal/test/binding,internal/js_stream_socket);fs,child_processandtimers/promisesused to be on that list and are not any more, which is where most of the gap between the branch's 68 and this 79 comes from. The two largest remaining groups are new engine bugs found by this work: a derived class cannot introduce an instance field (10 files) (class MyReadable extends Readable { constructor() { super(); this.n = 0; } }does not compile — field inference from a constructor assignment is gated on the class having no base), and a constructor's declared parameters are all required (11 files;new MyWritable()on aconstructor(options)is a compile error, although zun#61 records that a plain function accepts too few). Behind them:setTimeout/setImmediatereject a dynamic callback (zun#29), anumbercannot be a Buffer size (zun#58),thisinside a listener isundefined(zun#1), there is no function-constructor model forReadable.call(this)(zun#25), and afunctionBoxhanded toPromise.prototype.thenis silently never called — which is whatpromise.then(common.mustCall())is, so the harness cannot verify those counts at all (a fifth new engine bug). Every failure traced so far lands outsidestream.ts— those groups account for every bundle failure and every compile error in the corpus.
streamalso brought three generic bundler rules for canonical bindings, all of them engine workarounds over the module table's new comma-separated third column: a member read through the module alias (stream.Readable→Readable, becausenew <object>.Ctor()answersundefined is not a functionat run time — zun#18), a renamed destructuring (const { Readable: R } = require('stream'), because a class base must be the original identifier — zun#21), and the renamed member spelling (const EE = require('events').EventEmitter). The last two liftedeventsfrom 6/35 to 12/35 on their own: six of its files were blocked on nothing but the alias. The blocker-by-blocker table is intest/stream/README.md, the per-test breakdown intest/stream/RESULTS.md.
The tracker always needs the zun binary from the engine checkout; it needs the
extension cdylib only for extension modules.
# from the Zun engine checkout containing this submodule
cargo build -p zun_cli # the `zun` binary
# a Zun TypeScript module: no --ext, each test is bundled first
bash zun-node/tools/run_node_tests.sh \
--zun target/debug/zun \
--module path # add --limit N to sample
# an extension module: build the cdylib and pass it with --ext
cargo build --manifest-path zun-node/Cargo.toml # the extension cdylib
bash zun-node/tools/run_node_tests.sh \
--zun target/debug/zun \
--ext zun-node/target/debug/libzun_node.so \
--module fs
# a Zun TypeScript module over natives: bundled *and* --ext
bash zun-node/tools/run_node_tests.sh \
--zun target/debug/zun \
--ext zun-node/target/debug/libzun_node.so \
--module osOn Windows the binary is target/debug/zun.exe and the extension is
zun-node/target/debug/zun_node.dll. Other flags: --tag v25.0.0 pins the Node
revision, --timeout 20 caps each test, --limit 0 (the default) means all
tests.
Each run rewrites this README's <!-- node-<module>:start --> block and
test/<module>/RESULTS.md.
To debug a single test by hand, bundle it and run the bundle:
bash zun-node/tools/bundle_node_test.sh path/to/test-path-join.js /tmp/bundle.ts
target/debug/zun run /tmp/bundle.ts████████░░░░░░░░░░░░░░░░ 36.7% — 18 / 49 Node test-diagnostics-channel* tests passing
██████████████████░░░░░░ 77.2% — 17 / 22 Node test-console* tests passing
██████░░░░░░░░░░░░░░░░░░ 25.0% — 5 / 20 Node test-perf-hooks-*|test-performance* tests passing
The whole surface is implemented —
performance(now,timeOrigin,mark/measurewithdetailand start/end/duration options, thegetEntriesBy*/clear*trio over Node's three separate global buffers,markResourceTimingwith the secondary buffer and its singleresourcetimingbufferfulldrain,timerify,eventLoopUtilization,nodeTiming,toJSON), the five entry classes,PerformanceObserverwith buffered observation andsetImmediate-delivered callbacks,createHistogramandmonitorEventLoopDelaywith every reading including the*BigIntvariants, andconstants. The bar is low because this corpus leans hard on things the VM does not publish: six of the twenty files neednode:worker_threads, three needinternalBindingor--expose-gc, and one is an ES module the bundler does not rewrite. Of the rest, two are blocked by a single engine gap —Object.definePropertydoes not storewritable: falsefor a symbol-keyed property, so Node'sSymbol.toStringTagdescriptor assertion fails; re-run with only that block removed,test-perf-hooks-usertiming.jspasses in full, which is the real measure of the user-timing half.test-performance-measure.jsis recorded as a pass but is not one: its assertion runs inside an observer callback, where the engine does not let a throw fail the run, and it would fail anyway because the VM's timer tier advances a virtual clock whileperformance.now()reads a real one. Five new engine findings came out of this module — BigInt identity lost across a value round-trip, the symbol-descriptor gap above, quadratic class-instance allocation, a throw inside a macrotask not failing the run, and a spread into a method call rejected inside a function body — each with a repro intest/perf_hooks/README.md, alongside the per-test blocker table; the per-test run is intest/perf_hooks/RESULTS.md.
██████████████████░░░░░░ 75.0% — 45 / 60 Node test-zlib* tests passing
zlibis implemented end to end, zstd included (overruzstd, one compression level): the elevenTransformclasses, thecreate*factories, the eleven*Syncand eleven callback convenience methods withmaxOutputLengthandinfo,crc32, the frozenconstants/codestables with Node's numeric reverse mapping and the legacy top-levelZ_*aliases,flush/params/reset/close,bytesWritten, and Node's whole error surface —checkRangesOrGetDefaultover every option,ERR_BROTLI_INVALID_PARAM,ERR_ZLIB_INITIALIZATION_FAILED,ERR_BUFFER_TOO_LARGE, and the compression errors with zlib's own messages (incorrect header check,unexpected end of file,Missing dictionaryvsBad dictionary). The engines arelibz-rs-sys(zlib-rs's C API, a memory-safe Rust rewrite of zlib with byte-identical output) and thebrotlicrate, andsrc/zlib/zstream.rsfollows Node's ownsrc/node_zlib.cccall for call — the per-modewindowBitsrewriting, theZ_NEED_DICTretry, the concatenated-gzip member loop, the error classification.The percentage is held down by one engine gap rather than by the module: a typed array is opaque through an
anybinding (zun#38), and everyBufferzlibreturns reaches a test through one — sozlib.gzipSync(x).lengthreadsundefinedand.toString()throws, and any test that compares bytes is blocked before it can look at them. The compression is verified the wayosandstreamare instead: 22 Rust tests over the engines (round trips in every mode, the empty-input byte sequences, blobs produced by the real zlib and the reference Brotli encoder, dictionaries, concatenated members,reset,paramsmid-stream, the four error classifications, thecrc32vectors) plus a differential pass in whichzlib.crc32— which stays inside the module and therefore sees realBuffers — confirms every round trip. Blocker table:test/zlib/README.md; per-test breakdown:test/zlib/RESULTS.md.
█████████████████░░░░░░░ 73.9% — 85 / 115 Node test-crypto* tests passing
cryptocovers the symmetric half of Node's module end to end:createHashandHash(MD5, SHA-1, the whole SHA-2 family withsha512-224/sha512-256, SHA-3 in four sizes, the two SHAKE XOFs withoptions.outputLength, RIPEMD-160, BLAKE2b-512, BLAKE2s-256, and OpenSSL's aliases for each) withupdate/digest/copyin every encoding,crypto.hash()'s one-shot in both of its third-argument forms,createHmac,createCipheriv/createDecipherivfor AES-128/192/256 in ECB, CBC, CTR and GCM plus ChaCha20 and ChaCha20-Poly1305 — withsetAutoPadding,setAAD,getAuthTag/setAuthTagand their per-mode length rules —pbkdf2,scryptandhkdfin sync and callback form, the wholerandom*family over the OS CSPRNG,timingSafeEqual, secretKeyObjects,generateKey,getHashes/getCiphers/getCurves/getCipherInfoover the real OpenSSL 3 table,constants, andsubtle.digest. The primitives are RustCrypto's (sha2,sha3,blake2,aes,ghash,poly1305,chacha20,scrypt,subtle,getrandom), all pure Rust, so the extension still builds with nothing but a Rust toolchain; HMAC, PBKDF2 and HKDF are written out over oneBox<dyn DynDigest>handle table rather than instantiated per digest.The percentage is held down by two things, neither of them the cryptography. The asymmetric half is not written —
generateKeyPair, sign/verify,publicEncrypt/privateDecrypt, Diffie-Hellman, ECDH, X.509, the post-quantum families — which 72 of the 115 files reach for; every one of those entry points is present and raisesERR_CRYPTO_UNSUPPORTED_OPERATIONrather than being absent. And zun#38 again: a typed array is opaque through ananybinding, sohash.digest(),randomBytes(32)andkey.export()reach a test as values whose.lengthreadsundefinedand whose.toString()throws — which is what stopstest-crypto-pbkdf2,test-crypto-hmacandtest-crypto-paddingeven though their bytes are right. The bytes are verified the wayzlib's are instead: 24 Rust tests against the published RFC/NIST/FIPS vectors (SHA/SHA-3/BLAKE2abc, RFC 4231 HMAC, RFC 6070 PBKDF2, RFC 5869 HKDF, RFC 7914 scrypt, FIPS 197 AES, SP 800-38A CTR, the NIST GCM cases including a 64-bit IV, RFC 8439 ChaCha20-Poly1305) plus a 165-value differential pass against the installed Node over every path that answers a string, which agrees everywhere. A third blocker was found and worked around: the prelude has acryptoof its own, and the checker resolvescrypto.<member>against it from inside afunctionbody even when a user declaration shadows the name — which is zun#85's second half, filed forconsole, landing on a second prelude namespace (standalone repro in the module's test README). The bundler rewritescryptoas a receiver to a second name, as it already does forconsoleandperformance. Blocker table:test/crypto/README.md; per-test breakdown:test/crypto/RESULTS.md.
█████████████░░░░░░░░░░░ 54.5% — 12 / 22 Node test-readline* tests passing
███████████░░░░░░░░░░░░░ 47.6% — 10 / 21 Node test-v8-* tests passing
node:v8is a window onto a V8 isolate, and Zun is not V8: the wire format ofserialize/deserializeis reproduced byte for byte (every value in the round-trip table intest/v8/README.mdmatches the hexnode -e "v8.serialize(...)"prints), while every heap, profiler and snapshot reading is shape-true and content-empty — the keys, types and file formats are Node's and the numbers are what this runtime can observe. The resolution table is in the header ofsrc/v8/v8.ts; blockers per test:test/v8/README.md; per-test breakdown:test/v8/RESULTS.md.
█████████░░░░░░░░░░░░░░░ 40.0% — 2 / 5 Node test-tty-*|test-ttywrap* tests passing
node:ttyanswersisatty(fd)for real (throughprocess' predicate) and implementsgetColorDepth/hasColors' whole environment table; the two terminal streams areDuplexes over fds 0–2 and raiseERR_TTY_INIT_FAILEDfor a descriptor that is not a terminal, which is what Node does too. Window size and raw mode have no capability under them here and are named as gaps. Blockers per test:test/tty/README.md; per-test breakdown:test/tty/RESULTS.md.
██████████████████████░░ 92.5% — 25 / 27 Node test-dns* tests passing
dnsis the sixth module written as Zun TypeScript over Rust natives, and the seam is the one Node itself draws betweenlib/dns.jsandsrc/cares_wrap.cc:src/dns/*.rsanswers the system resolver (getaddrinfo/getnameinfothroughlibcon POSIX andGetAddrInfoWon Windows, with theAI_*flags andNI_NAMEREQDlibuv passes), the machine's configured resolvers (/etc/resolv.conf,GetAdaptersAddresses) and the DNS wire protocol itself;src/dns/dns.tsholds the module Node exposes —isIP, thesetServersaddress grammar, thelookupargument cascade, bothResolverclasses,DNSExceptionwith its fabricatedENOTFOUND, the thirteen record shapes and the twenty-four error-code constants, fornode:dnsandnode:dns/promisesalike.The
resolve*family is a hand-written stub resolver (src/dns/resolve.rs), not a resolver crate, and the reason is the same principle that keeps a VM out of this extension: what the module needs is one question per query, no cache, no DNSSEC and a server list the caller owns, whilehickory-resolverin blocking mode still brings atokioreactor and some ninety transitive crates. RFC 1035 message format with §4.1.4 name decompression over UDP, with the §4.2.2 TCP retry on a truncated answer, is a few hundred lines overstd::netand no new dependency — and it is verified by 21 Rust tests that drive the encoder and the parser from hand-assembled messages (A/AAAA/MX/TXT/SOA/ANY records, a compression pointer, every RCODE, a truncated record and a compression loop).Six of the twenty-seven tests pass, and the shape of the remainder is worth stating because almost none of it is the module. Nine files need
node:dgramto stand up a fake DNS server (that module does not exist here yet); three need the--dns-result-orderCLI flag; and six are blocked by the one engine defect thestreamsection above already names — a callable handed toPromise.prototype.thenis silently never called, which is exactly what.then(common.mustCall())is. This corpus narrows it: the valuecommon.mustCall()hands back is degraded by the return of a dynamic call (from an object-literal method it even reportstypeof === "object"), it is still callable directly, and a class method's return is not degraded at all — so a harness whosecommonwere a class instance would unblock the pattern in every module's corpus. The repro is intest/dns/README.mdwith the other findings, alongside the per-test blocker table; the per-test run is intest/dns/RESULTS.md.
██████████████░░░░░░░░░░ 60.0% — 30 / 50 Node test-domain-* tests passing
node:domainis deprecated but fully specified, and it is the one module in this library whose implementation is defined by what it does to the other modules. Node'slib/domain.jsreplacesEventEmitter.init,EventEmitter.prototype.emitandprocess.setUncaughtExceptionCaptureCallback, redefinesprocess.domainas an accessor, and registers anasync_hookshook so that every scheduled callback re-enters the domain that created it. None of that is expressible here — there is no prototype to patch (zun#25), a class method cannot be read as a value (zun#19), and the VM has no async-hooks tier. So the direction is inverted:src/events/events.tsdeclares one record whose every slot isnull,src/process/process.tsstamps eachnextTickentry andsrc/timers/timers.tseachTimeout/Immediatewith the active domain, andsrc/domain/domain.ts— inlined only for a test that requires it — fills the slots. The cost to every other corpus is one null check per emit, per constructed emitter, per tick and per timer fire.The whole surface is implemented:
create/createDomain, theDomainclass withrun,add,remove,bind,intercept,enter,exit,membersand_errorHandler,domain._stack,domain.active,process.domain,events.usingDomains, the implicit binding of anEventEmitterconstructed inside a domain, the fullerror.domain/domainEmitter/domainBound/domainThrowndecoration, Node's stack-truncate-emit-restore dance inemit, the stack-clearinguncaughtExceptionlistener kept first throughprocess' ownnewListener/removeListenerevents, and the exclusive claim onprocess.setUncaughtExceptionCaptureCallback(ERR_DOMAIN_CALLBACK_NOT_AVAILABLE,ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE). A throw out of anextTickcallback, asetTimeout, asetImmediateand anfscallback is routed to the domain that scheduled it, through the capture-callback pathsrc/process/process.tsalready walks in Node's order.Twenty-two of the fifty files are not about any of that: fifteen spawn a child of the engine to watch what V8's
--abort-on-uncaught-exceptiondoes, five need a module this library does not have (http,inspector,net,vm), one needsvmplus the async-hooks tier and one needsasync_hooks.AsyncResourcewith--expose-gc. Of the twenty-eight that are the module, eighteen pass — including every file that pins the stack discipline. The other ten are one engine gap each, and two engine bugs were found here:Error'snameandstackbecome unreadable, even through anany, once the error carries any added own property — which makesconsole.error(err)die for every error a Node-styleerr.code = …has annotated — andError.stackTraceLimit = Infinitypanics the interpreter. There is noFunctionglobal either, soFunction.call.bind(Object.prototype.propertyIsEnumerable)is the sole blocker of three files. Deviations, repros and the blocker table:test/domain/README.md; per-test breakdown:test/domain/RESULTS.md.
████████████░░░░░░░░░░░░ 53.0% — 79 / 149 Node test-net-* tests passing
netis TS over natives, and the first module here whose natives are not its own. What it needed before it needed anything else was a piece of infrastructure this library did not have: an asynchronous-I/O readiness loop. Every other native in this repository blocks, with Node's asynchrony restored on the TypeScript side byprocess.nextTick(the patternsrc/dns/dns.tsdocuments). A socket cannot work that way, and ABI v1 cannot complete a call later — so the direction is inverted: no native waits for a particular event, and one native,ioPoll(timeoutMs), waits for any registered handle. That loop issrc/io/under the module keynode:io— a handle table and the eleven verbs on one (src/io/mod.rs), the raw non-blocking primitives withpoll(2)on POSIX andselecton Windows (src/io/sys.rs, notWSAPoll, which never reports a refused connection), the scheduling half withref/unrefand the pump (src/io/io.ts), and the one file that names the extension (src/io/native.ts). That loop deliberately owns no macrotask chain of its own: with the VM's virtual clock every armed task is due at once and the most recently armed one wins, so a pump that re-armed itself starved the whole program (a four-line probe showssetTimeout(f, 1)never firing while a server is registered; it cost 20 of the 149 tests). It exposes one turn and the existing loop driver calls it. Nothing in it is socket-shaped beyond TCP's own verbs, becausedgram,child_process.spawn's pipes,fs' streams andhttpare meant to register with the same loop. Thirteen Rust tests drive it below the ABI.src/net/net.tsis then the module Node exposes:Socketas astream.Duplexwhose_read/_write/_final/_destroyare the loop's events,Server,isIP*,BlockList,SocketAddress, the argument cascades,readyState,allowHalfOpen, the socket options,maxConnectionswith'drop', a real abortiveresetAndDestroy, andsocket._handlein libuv'sTCP-wrap shape because four files in the corpus replace a method on it. Named gaps: no pipes / Unix sockets, nofdadoption, blocking name resolution, and a sequential rather than raced Happy Eyeballs. The largest blocker is not in the module: Node'snettests constantly writeserver.listen(0, function () { this.address() }), andthisinside a listener isundefinedhere (zun#1) — this corpus narrows that issue to receiver threading alone, because the argument shifting it also describes is gone (apply/callnow pass the right arguments, just no receiver;binddoes not exist at all). Per-test breakdown and the full blocker table:test/net/README.md,test/net/RESULTS.md.
██████████░░░░░░░░░░░░░░ 45.6% — 42 / 92 Node test-vm-* tests passing
vmis the one module whose job is run-time compilation, so the first question was whether this platform has any. It does, and it is a real compile: the checker lowersnew Function(p1, …, body)to thefunctionConstructintrinsic, the interpreter hands the strings to an injectedEvalHost, and the driver answers with the project's own compiler (zun_compiler::compile_without_prelude), links the resulting methods into the live module and re-verifies them. There is noeval, direct or indirect, and no host/ABI entry that compiles —zun_abipublishes natives to the engine, never the other way — sonew Functionis the whole surface, andsrc/vm/vm.tsis built on it rather than on an imitation of it. EveryScripthere is compiled by the compiler and every run executes compiled code.Two gaps separate
new Function(body)fromvm.Script, and both are closed with the compiler as the authority instead of a guess. A completion value:__vmScanfinds the top-level statement boundaries — tracking comments, the three string forms, regular-expression literals and bracket depth — and the compile driver walks them backwards asking the compiler whether<prefix> __zunVmR = (<suffix>);compiles, keeping the first split it accepts; a bad proposal simply fails to compile and is discarded. And contextified globals: reading a free identifier lowers toglobalGet(name), but writing one is a compile error —unknown variable `foo`— and that diagnostic names every implicitly assigned global, so the names are read out of the message, declaredletat the top of the generated body from the active context and copied back in afinally, while reads are served by installing the context's own properties on the realm global for the duration. Top-levelvarandfunctiondeclarations go back to the context too, because in Node they become context-global properties whereletandconstdo not.What this cannot be is a second realm: the engine has one realm global, so a context cannot hide the host's globals, and
vm.runInNewContext('typeof process')answers"object"where Node answers"undefined". That is stated rather than papered over, and it is most of what the corpus measures — along with two engine findings that this work produced and that between them cost about twenty files:new Error("boom")inside dynamically compiled code evaluates to a function value rather than an error (the builtin class cannot be referenced, sonewon the realm class descriptor returns the descriptor, with no diagnostic), andthis.x = vin compiled code panics the interpreter instead of throwing aTypeError. A third finding is why the tracker kind iszun-ts:zun run --ext <lib> file.tsinjects noEvalHost, so loading any native extension silently removes run-time code generation from the program. Twenty-one more files need--experimental-vm-modules, whoseSourceTextModuleneeds a module compilation entry the engine does not expose — sovm.Moduleand friends are absent, exactly as they are in a Node run without that flag. There is no code cache either, soproduceCachedDatareportscachedDataProduced: false, a suppliedcachedDatais honestly rejected andcreateCachedData()throws with its reason; andtimeout/breakOnSigintare validated and then ignored, because nothing can interrupt a running frame. The file-by-file blocker table, with a standalone repro for each finding, is intest/vm/README.md; the per-test breakdown intest/vm/RESULTS.md.
█████████░░░░░░░░░░░░░░░ 40.7% — 22 / 54 Node test-module-*|test-require-* tests passing
moduleis the one module in this library that cannot reach 100%, and the reason is structural rather than a gap to close: the Zun engine compiles a program ahead of execution, so there is no runtime compiler, noevaland novm(zun#4), and arequirethat turns a JavaScript file into a module needs one. That single fact accounts for 17 of the 34 failures; nine more spawnprocess.execPathas if it were anodebinary and ask it to run a.jsmain.What is here is the whole half of
node:modulethat is computation over paths and files, and it is complete: the resolver (_resolveFilenamewithoptions.paths,_findPathwith_pathCacheand multi-dot extensions,_resolveLookupPaths,_nodeModulePathsfor both platforms,_initPaths/globalPaths,_stat, package.json"main"with its DEP0128 warning), the caches, the extension table with user-registered loaders,createRequire,findPackageJSON, a complete Source Map v3 reader (SourceMap,findEntry,findOrigin, index maps),Module.wrap,setSourceMapsSupport, the compile-cache trio reporting honest values, andstripTypeScriptTypesover a whitespace-preserving stripper written here rather than borrowed from SWC..jsonmodules load for real;.mjsanswersERR_REQUIRE_ESMand.nodeanswersERR_DLOPEN_FAILED, which are the honest errors rather than fabricated successes.It also needed a bundler mode. Every other corpus is built by rewriting
require(...)away into the inlined module objects, which is exactly wrong for the corpus whose subject isrequire:test-require-cache.jswritesrequire.cache.fsand then asks whatrequire('fs')answers. Sotools/run_node_tests.sh --module moduleexportsZUN_NODE_REQUIRE=1, under which the bundler leaves a builtin specifier for the run-timerequireto resolve, renames the body'srequireto__zunRequire— therequireof the bundled file's own module record — and emits one__modRegisterBuiltin("<specifier>", __node_<specifier>)call per module object the bundle carries. No other corpus' bundle changes by a byte.Two engine bugs were found here, both with standalone repros: a function expression assigned to an expando property of a function is given a synthetic leading
thisparameter — shifting every argument by one — as soon as the tokenthisappears anywhere in its source span, comments included (the same assignment onto a plain object is unaffected); andObject.definePropertyon a function value throws "called on non-object". Deviations, repros and the blocker table:test/module/README.md; per-test breakdown:test/module/RESULTS.md.
████████░░░░░░░░░░░░░░░░ 36.1% — 51 / 141 Node test-worker*|test-messagechannel*|test-messageport*|test-broadcastchannel* tests passing
node:worker_threadsis two things wearing one name, and the split decides everything. The message-port family —MessageChannel,MessagePort,MessageEvent,BroadcastChannel,receiveMessageOnPort, the transfer and structured-clone rules,markAsUntransferable/isMarkedAsUntransferable/markAsUncloneable,environmentData,SHARE_ENV,threadId,isMainThread,parentPort,workerData,resourceLimits,postMessageToThread— is in-process: a channel is two queues and a dispatch rule, and Node defines every one of those semantics without reference to a second thread. That half is implemented insrc/worker_threads/worker_threads.ts, including Node's hybridEventTarget/EventEmitterdispatch (a listener added withaddEventListenergets theEvent, one added withongets the raw value, and the event is created lazily soport.on('message', …)never allocates one), the port reference counting that makes the first'message'listener ref and start a port, the transfer-list validation order that leaves anArrayBufferalone when a later entry in the same list is a detached port, and theDataCloneErrormessages.
Workeris the other half, and it needs a second thread this VM does not have. 113 of the 141 files construct one. The constructor here is nevertheless the real Node constructor down to the last validation — everyERR_*a badfilename,execArgv,env,name,resourceLimitsorworkerDataraises is raised, in Node's order, which is what three of the passing files are — and only then does it report the one honest failure left. The design for the real thing is a child Zun process: the worker script bundled by the sametools/bundle_node_test.shmachinery, the handshake (isMainThread === false,threadId,workerData,environmentData) as the first frame on the child's stdin,parentPortas aMessagePortwhose sibling is the pipe, andsrc/v8/v8.ts' V8 value-serialization format as the framing — which is exactly what Node puts on a worker's channel. The missing piece is a non-blocking read of the child's pipe, i.e. a poll-based loop over it; this module deliberately grows no socket loop of its own, so when that landsWorkerneeds the reader and nothing else.Six engine bugs were found here, and three of them compound into one shape: a prelude class cannot be shadowed (a top-level
class MessageChannelisduplicate class, wheresrc/timers/timers.tscan shadow the timer intrinsics), a symbol-keyed own property on a class instance reads backundefined(so theutil.inspect.customhooklib/internal/worker/io.jsinstalls cannot be installed), and a class accessor's setter is not invoked through ananyreceiver while the getter is — which, with zun#78, leaves no slot on a class instance that plain JavaScript can write a handler function into. SoMessageChannelis bound to a second name andport.onmessage = fnis rewritten to the backing slot, both by the bundler, both semantics-preserving. A fourth aborts the VM outright: anumberfield of a class extending a prelude class, initialised from a top-levelconst …: number. The last two are about iteration: a generator method in an object literal returns nothing when called, so{ *[Symbol.iterator]() {} }is not iterable, andfor-of over a non-object aborts the process uncatchably. Repros, deviations and the blocker tables:test/worker_threads/README.md; per-test breakdown:test/worker_threads/RESULTS.md.
█████████████████████░░░ 89.4% — 68 / 76 Node test-dgram-* tests passing
dgramis the second consumer of the shared I/O loop and follows the patternnetset: the datagram verbs (socket(SOCK_DGRAM),sendto/recvfrom, connect/disconnect, broadcast, TTL, multicast membership including source-specific, buffer sizes) are natives insrc/io/udp.rsbeside the stream verbs, sharing the same handle table, readiness query andref/unrefaccounting; the Node API —createSocket,Socketas anEventEmitter, the bind/connect state machines, the queue that holds asend()until the socket is bound, thesend()argument cascades, Node's errors — issrc/dgram/dgram.ts. Of the 47 failures, 14 needinternal/dgram,clusteror../common/udp, 11 are rejected at compile time by their ownBuffer.alloc(<number>)bodies, and most of the rest hit the opaque-byte-view-through-anyceiling (a'message'handler'smsg.toString()is104,101,…). Deviations and the blocker table:test/dgram/README.md; per-test breakdown:test/dgram/RESULTS.md.
██████████████░░░░░░░░░░ 61.7% — 234 / 379 Node test-http-* tests passing
httpis Zun TypeScript overnet, with no natives of its own:src/http/http.tsholds an incremental HTTP/1.1 parser (request/status line, headers,Content-Length, chunked with trailers, until-close bodies, keep-alive and pipelining) where Node has llhttp, and on top of itcreateServer/Server,IncomingMessage(aReadablewhose backpressure pauses the socket),OutgoingMessage/ServerResponse(aWritablewith Node's implicit-header rules),ClientRequestwithrequest/get, anAgentwith a real socket pool (keepAlivereuse,maxSockets,lifo/fifo,'free'),METHODS,STATUS_CODESand the header validators;headersTimeout/requestTimeoutare enforced by Node's connection-checking sweep (408), and the parser rejects the smuggling cases the corpus checks. Documented deviations:http.Serveron the module object is a factory (a class cannot be called, andnew <module>.Ctor()does not reach a constructor); no Unix sockets / named pipes; the parser is not llhttp. Most of the 154 failures are not in the module: ~22 are rejected at compile time in the test body, ~25 needhttps/tls/cluster/internalBinding, and several hit engine identity gaps (err.constructor === Error, zun#140; built-in methods throughany, zun#17). Deviations, repros and the blocker table:test/http/README.md; per-test breakdown:test/http/RESULTS.md.
████████████░░░░░░░░░░░░ 50.0% — 21 / 42 Node test-runner-* tests passing
node:testis library code insrc/test/(it used to be a harness shim that ran every test synchronously at declaration): the suite tree with Node's ordering, hook inheritance andonly/name filtering,TestContext/SuiteContext, thespec/tap/dotreporters and summary,mock(functions, methods, accessors, properties, andmock.timersoversetTimeout/setInterval/setImmediate/Date/scheduler.wait), andrun(), which runs each file in a child process.zun-node-run --testis thenode --testCLI over it, including--test-isolation=none. Most remaining failures need things the engine cannot do yet — a function returned through a dynamic call loses its properties (zun#139, worked around formock.fn()by boxing, whichthen()then ignores, zun#71), spread calls into dynamic functions, source line/column locations, module loading at run time (custom reporters,mock.module, coverage). Implementation and gaps:test/test_runner/README.md; per-test breakdown:test/test_runner/RESULTS.md.
███████░░░░░░░░░░░░░░░░░ 30.6% — 64 / 209 Node test-tls-* tests passing
tlsis Zun TypeScript overnetand a rustls engine: the session is a rustls connection in the extension's handle table, driven as a memory BIO (src/tls/mod.rs, pure-Rustrustls-rustcryptoprovider), andTLSSocket/connect/createServer/createSecureContext/checkServerIdentityaresrc/tls/tls.ts. TLS 1.2/1.3 AEAD suites only; no session resumption, PFX or bundled CA roots. Details:test/tls/README.md.
██████████░░░░░░░░░░░░░░ 43.5% — 27 / 62 Node test-https-* tests passing
httpsishttpovertls(src/https/https.ts), with no natives of its own. Details:test/https/README.md.