Remove dead code from the streams bindings, node:http, bun_sys, lsquic_sys, and orphaned files
Scheduled dead-code sweep. Areas were chosen to avoid the 17 dead-code PRs currently open (#35437 through #38005): every file below was either untouched by those PRs or, where a file is shared, the hunks are different symbols (checked mechanically against the open PR diffs; the only shared removed lines are level = "expect" style TOML boilerplate in unrelated hawk.toml blocks).
Net: 47 files, about 2.7k lines removed; the only additions are the guard test, three one-line #[cfg] / import adjustments, and two doc-comment fixes for functions that went away.
Removed
WebCore streams bindings (transferable streams were never implemented)
m_detachedbitfields onJSReadableStream,JSWritableStream,JSTransformStream: never read or written.$bunNativeType/$disturbedprivate-name accessors onReadableStream.prototype(4 getters/setters, their installs,m_nativeType, the reset inReadableStream__detach, the twoBunBuiltinNames.hentries andbuiltins.d.tsdeclarations): no builtin, C++ or test referenced either name.$bunNativePtris still used and stays.
TextEncoder
TextEncoder::encode/encodeInto/EncodeIntoResultand theconvertDictionary<EncodeIntoResult>/convertDictionaryToJSspecializations (TextEncoder.h,TextEncoder.cpp,JSTextEncoder.h,JSTextEncoder.cpp): the wrapper implements both methods through the RustTextEncoder__encode*exports and only ever callsimpl.encoding(), which is all that is left of the impl class.
node:crypto
JSKeyObject::createandJSKeyObject::subspaceForplus them_subspaceForJSKeyObject/m_clientSubspaceForJSKeyObjectslots: every key object is one of the three final subclasses, each of which defines its owncreate/subspaceFor; the base class is only used as a downcast target.- Commented-out
switch (m_curve)block inCryptoKeyOKP::algorithm()(2023).
Other bindings
WriteBarrierList::list(), theWeakRefFinalizeFntypedef inWeak.cpp,JSC_MAC_VERSION_TBA/JSC_IOS_VERSION_TBAinroot.h(unused by every JSC header in the WebKit builds we ship against).Bun__resolvehost export (bun_resolveinBunObject.rs+ theextern "C"declaration inImportMetaObject.h): nothing in C++ or JS called it; theBun__resolveSync*family is what is used.
node:http (src/js/node/_http_server.ts)
kDeprecatedReplySymbolis a module-privateSymbol()ininternal/httpthat nothing ever sets on a response's options, so the constructor branch that installed the fetch-Responsebasedwrite/endwas unreachable. Removed it together with everything only it reached:ServerResponse_writeDeprecated,ServerResponse_finalDeprecated,ensureReadableStreamController,drainHeadersIfObservable,emitRequestCloseNT,GlobalPromise, and the now-unused imports (controllerSymbol,firstWriteSymbol,deferredSymbol,runSymbol,emitErrorNextTickIfErrorListenerNT). This also stops adding anundefined-valuedSymbol(deprecatedReply)own property to everyServerResponse.- The
isNextIncomingMessageHTTPSsave/set/restore around request dispatch: the flag's only reader was removed in c4a937c53d, so the calls had no effect. - A 2025 commented-out
cluster._getServerblock inServer.prototype.listen.
Rust (cross-crate analysis with hawk per tools/hawk/README.md, then each item re-checked with rg; callers were confirmed to be platform-gated, e.g. node_fs uses sys_uv on Windows)
bun_sys:link,fdatasyncand the non-Linuxsendfilestub (both the posix and Windows arms), the Windows arms offchown,chmod,chown,fsync,linkat,fchmodat,lchmod,lchown,futimens,lutimens,fcntl,socketpair, the WindowsName::as_zstr,c::kqueue/c::kevent/c::fork/c::fd_t,linux::Errno,darwin::OSLog::as_ptr, the non-macOSclonefilestub, the non-Windowsget_fd_path_wstub,posix::sysctlbyname(the typedsysctl_read*helpers stay),posix::write; and the two helpers that became unreferenced as a result,linux_syscall::write_rawand thesafe_libc::fdatasyncimport, pluswindows::timespec_to_filetime.Tag::futimensis now#[cfg(not(windows))]like the other tags whose only users are posix-side (the Windowscargo checkflagged it once its Windows user was gone).bun_lsquic_sys: theEnginewrapper (struct, impl,Drop),Conn::{raw, set_ctx, ctx, n_avail_streams, sockaddr, status},global_init,enable_logging,LSQVER_I001/I002, and thelsquic_conn_n_avail_streamsextern.node:quicdrives lsquic through the raw externs directly.bun_spawn_sys:PosixSpawnResult::closeand the non-Linuxpifd_from_pidstub (the only call site is Linux-gated). TheFdExtimport thatclosewas the last Windows user of is now#[cfg(unix)].bun_tcc_sys:State::runand thetcc_runextern.hawk.toml: the sixbun_platformdarwin::Category::*overrides, whose variants were deleted in #36833 (hawk reports them asunknown_item).
Orphaned files (zero references repo-wide, searched with git grep including .github, .buildkite, .vscode, scripts/, packages/ and the generated build/debug/codegen/)
misctools/gdb/std_gdb_pretty_printers.py(Zig standard-library pretty printers; the repo has no Zig left) and the.vscode/launch.jsonline that sourced it;misctools/mime.js(emitted a ZigComptimeStringMap; MIME types now come fromsrc/http_types/mime_type_list.txt);misctools/.gitignore(ignored outputs of Zig programs deleted long ago).patches/ncrypto.patch: a one-off diff against Node's ncrypto committed with #17692. Unlike every other file underpatches/, noscripts/build/deps/*.tsapplies it, andncrypto.cpp/.hhave changed many times since, so it no longer describes anything.meta.json(stray--metafileoutput committed in #26441),workspace.code-workspace(2021 single-folder VS Code workspace with Zig settings;.vscode/is the live config).src/jsc/bindings/v8-capture-stack-fixture.cjs,src/jsc/bindings/webcore/EventNames.in(WebKitmake_event_factory.plinput; Bun'sEventNames.his hand-written),src/runtime/ffi/libtcc1.a.macos-aarch64(superseded by the embeddedlibtcc1.c).src/runtime/bake/client/JavaScriptSyntaxHighlighterComponent.tsx(its header says the client never uses it) andJavaScriptSyntaxHighlighter.css, which only it imported. The liveJavaScriptSyntaxHighlighter.tsis untouched.packages/bun-release/scripts/npm-exec.ts(upload-npm.tsbundles onlynpm-postinstall.tsand ships placeholder bins),packages/bun-usockets/misc/{manual.md,gen_test_certs.sh,layout.png}andpackages/bun-usockets/module.modulemap(upstream leftovers, same class as thebun-uws/miscfiles removed in #37659).
Verification
rg/git grepfor every symbol and file name above acrosssrc/,scripts/,packages/,test/,vendor/WebKit/Source(for the C++ symbols) and freshly regeneratedbuild/debug/codegen/.- Rust items come from a hawk
dead_publicreport on this tree (release profile, all 11 shipped targets), filtered to items no open PR deletes; findings that are FFI struct fields, code tables, or API added in the last week were deliberately left alone. bun bdbuilds, and the removed symbols are absent from the resulting binary / bundled JS /generated_host_exports.rs.bun bd testpasses ontest/js/web/streams/streams.test.js,test/js/web/encoding/text-encoder.test.js,test/js/node/crypto/crypto.key-objects.test.ts,test/js/node/fs/fs.test.ts,test/js/bun/resolve/import-meta*.test.*andtest/js/node/quic/quic-stream.test.ts;test/js/node/http/node-http.test.tspasses except "request via http proxy, issue#4295", which fails identically with an unmodified bun in this container (ECONNREFUSED to its local proxy).cargo check --workspaceon the windows-msvc, darwin, freebsd, linux-musl, android and linux-gnu targets.test/internal/source-lints/dead-symbols-streams-http-misctools.test.tspins everything above; all 40 content checks and 16 deleted-file checks fail against main and pass here.
Left alone (probably dead, not deleted)
src/simdutf_sys/simdutf.rs: the wholeutf32/ big-endian wrapper tree (~150 lines, plus its externs and the matching shims inbun-simdutf.cpp) has no callers, but #37332 is editing the same extern block; worth a follow-up once that lands. Same story for the unusedLoop/uv_stat_t/ReturnCodehelpers inlibuv_sys.src/js/internal/http.ts:kDeprecatedReplySymbol,controllerSymbol,runSymbol,deferredSymbol,firstWriteSymbolandget/setIsNextIncomingMessageHTTPSlost their last users in this PR, but #35437 rewrites that exact region of the file.- The rest of the transferable-streams scaffolding:
JSCrossRealmTransformState(never created; its only references are itsFOR_EACH_WEB_STREAMS_INTERNAL_STRUCTUREentry and iso-subspace slots),CrossRealmTransform.cpp, and theSourceKind::CrossRealm/SinkKind::CrossRealmarms with theircaselabels. #37332 is already editing that cluster, so it is best removed as one unit once that lands. misctools/gen-unicode-table.ts+unicode-generator.tsemit Zig source, butsrc/bun_core/string/identifier.rsstill points at them as the generator to port;misctools/generate-cli-completions.ts+completions/bun-cli.jsonandcompletions/spec.yamlhave no in-repo consumers but may have external ones.src/runtime/bake/{incremental,memory}_visualizer.html(~800 lines): nothing serves them since the port, butDevServerstill carries the message writers and stubs, so this looks like an unfinished port rather than dead code.packages/bun-inspector-frontend(build script points at a path that no longer exists) andpackages/bun-build-mdx-rs(2024 proof of concept) are unreferenced but are a product call.bun_shim_impl::read_without_launchis the Windowsbunxfast path that nothing calls any more; deleting it would drop a feature rather than a leftover.
[review] gate passed · iteration 1 · 47 files touched
fails on main (without fix)
ASAN without fix: 3 FAILED
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts
bun test v1.4.0 (59bf369d3)
test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts:
71 | // The Bun__resolve host export had no C++ or JS caller (only Bun__resolveSync
72 | // and its variants are used).
73 | ["src/jsc/bindings/ImportMetaObject.h", /\bBun__resolve\(/],
74 | ["src/runtime/api/BunObject.rs", /HOST_EXPORT\(Bun__resolve,|\bfn bun_resolve\b/],
75 | ]),
76 | ).toEqual([]);
^
error: expect(received).toEqual(expected)
- []
+ [
+ "src/jsc/bindings/webcore/streams/JSReadableStream.h: \bm_detached\b|\bm_nativeType\b",
+ "src/jsc/bindings/webcore/streams/JSTransformStream.h: \bm_detached\b",
+ "src/jsc/bindings/webcore/streams/JSWritableStream.h: \bm_detached\b",
+ "src/jsc/bindings/webcore/streams/JSReadableStream.cpp: bunNativeTypePrivateName|disturbedPrivateName",
+ "src/js/builtins/BunBuiltinNames.h: macro\((bunNativeType|disturbed)\)",
+ "src/jsc/bindings/webcore/TextEncoder.h: EncodeInto
... (truncated)
release without fix: 3 FAILED
bun test v1.4.0-canary.1 (da3851e57)
test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts:
71 | // The Bun__resolve host export had no C++ or JS caller (only Bun__resolveSync
72 | // and its variants are used).
73 | ["src/jsc/bindings/ImportMetaObject.h", /\bBun__resolve\(/],
74 | ["src/runtime/api/BunObject.rs", /HOST_EXPORT\(Bun__resolve,|\bfn bun_resolve\b/],
75 | ]),
76 | ).toEqual([]);
^
error: expect(received).toEqual(expected)
- []
+ [
+ "src/jsc/bindings/webcore/streams/JSReadableStream.h: \bm_detached\b|\bm_nativeType\b",
+ "src/jsc/bindings/webcore/streams/JSTransformStream.h: \bm_detached\b",
+ "src/jsc/bindings/webcore/streams/JSWritableStream.h: \bm_detached\b",
+ "src/jsc/bindings/webcore/streams/JSReadableStream.cpp: bunNativeTypePrivateName|disturbedPrivateName",
+ "src/js/builtins/BunBuiltinNames.h: macro\((bunNativeType|disturbed)\)",
+ "src/jsc/bindings/webcore/TextEncoder.h: EncodeIntoResult|\bencodeInto\b",
+ "src/jsc/bindings/webcore/TextEncoder.cpp: TextEncoder::encode(Into)?\(",
+ "src/jsc/bindings/webcore/JSTextEncoder.h: EncodeIntoResult",
+ "src/jsc/bindings/webco
... (truncated)
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts
bun test v1.4.0 (59bf369d3)
test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts:
(pass) dead stream slots and other dead C++ bindings do not reappear [33.31ms]
(pass) the deprecated-reply ServerResponse path stays out of node:http [21.74ms]
(pass) dead Rust wrappers do not reappear [63.04ms]
(pass) orphaned files stay deleted [545.87ms]
4 pass
0 fail
4 expect() calls
Ran 4 tests across 1 file. [3.00s]
__F:0:S:0
release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 662ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/130] gen bake.{client,server,error}.js
-> bake.client.js, bake.server.js, bake.error.js
[2/130] gen generated_host_exports.rs
generated_host_exports.rs: 92 exports (host=3, lazy=10, generic=79, rust=0); 239 extern-C blocks audited
[3/130] gen cpp.rs (cppbind)
[4/130] gen JS modules (bundle-modules)
Preprocess modules (9626ms)
Bundle modules (50ms)
Postprocesss modules (239ms)
Bundle Functions (777ms)
Generate Code (34ms)
[10.75s] Bundled "src/js" for production
2622 kb
197 internal modules
13 native modules
91 internal functions across 17 files
[4/129] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)
nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)
[1m[92m Compiling[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
[1m[92m Compiling[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
[1m[92m Compiling[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
[1m[92m Compiling[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src
... (truncated)
diff hotspot
.vscode/launch.json | 1 -
hawk.toml | 48 --
meta.json | 24 -
misctools/.gitignore | 10 -
misctools/gdb/std_gdb_pretty_printers.py | 142 ----
misctools/mime.js | 46 --
packages/bun-release/scripts/npm-exec.ts | 13 -
packages/bun-usockets/misc/gen_test_certs.sh | 51 --
packages/bun-usockets/misc/layout.png | Bin 10991 -> 0 bytes
packages/bun-usockets/misc/manual.md | 180 ----
packages/bun-usockets/module.modulemap | 4 -
patches/ncrypto.patch | 919 ---------------------
src/js/builtins.d.ts | 2 -
src/js/builtins/BunBuiltinNames.h | 2 -
src/js/node/_http_server.ts | 209 -----
src/jsc/bindings/ImportMetaObject.h | 1 -
src/jsc/bindings/Weak.cpp | 2 -
src/jsc/bindings/WriteBarrierList.h | 5 -
src/jsc/bindings/node/crypto/JSKeyObject.h | 20 -
src/jsc/bindings/root.h | 3 -
src/jsc/bindings/v8-capture-stack-fixture.cjs | 15 -
src/jsc/bindings/webcore/DOMClientIsoSubspaces.h | 1 -
src/jsc/bindings/webcore/DOMIsoSubspaces.h | 1 -
src/jsc/bindings/webcore/EventNames.in | 101 ---
src/jsc/bindings/webcore/JSTextEncoder.cpp | 56 --
src/jsc/bindings/webcore/JSTextEncoder.h | 4 -
src/jsc/bindings/webcore/TextEncoder.cpp | 36 -
src/jsc/bindings/webcore/TextEncoder.h | 9 -
.../bindings/webcore/streams/JSReadableStream.cpp | 60 +-
.../bindings/webcore/streams/JSReadableStream.h | 4 -
.../bindings/webcore/streams/JSTransformStream.h | 2 -
.../bindings/webcore/streams/JSWritableStream.h | 2 -
.../bindings
... (truncated)
gate history · 1 passed · 1 rejected · iteration 1
evidence per changed file
file reads edits tests
.vscode/launch.json 0 0 0
hawk.toml 0 0 0
meta.json 0 0 0
misctools/.gitignore 0 0 0
misctools/gdb/std_gdb_pretty_printers.py 0 0 0
misctools/mime.js 0 0 0
packages/bun-release/scripts/npm-exec.ts 0 0 0
packages/bun-usockets/misc/gen_test_certs.sh 0 0 0
packages/bun-usockets/misc/layout.png 0 0 0
packages/bun-usockets/misc/manual.md 0 0 0
packages/bun-usockets/module.modulemap 0 0 0
patches/ncrypto.patch 0 0 0
src/js/builtins.d.ts 0 0 0
src/js/builtins/BunBuiltinNames.h 0 0 0
src/js/node/_http_server.ts 5 0 0
src/jsc/bindings/ImportMetaObject.h 0 0 0
(+ 31 more files)