Skip to content

Remove dead code from the streams bindings, node:http, bun_sys, lsquic_sys, and orphaned files - #38213

Merged
Jarred-Sumner merged 13 commits into
mainfrom
claude/farm/c48628f3/dead-code-streams-http-misctools
Aug 14, 2026
Merged

Remove dead code from the streams bindings, node:http, bun_sys, lsquic_sys, and orphaned files#38213
Jarred-Sumner merged 13 commits into
mainfrom
claude/farm/c48628f3/dead-code-streams-http-misctools

Conversation

@robobun

@robobun robobun commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

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_detached bitfields on JSReadableStream, JSWritableStream, JSTransformStream: never read or written.
  • $bunNativeType / $disturbed private-name accessors on ReadableStream.prototype (4 getters/setters, their installs, m_nativeType, the reset in ReadableStream__detach, the two BunBuiltinNames.h entries and builtins.d.ts declarations): no builtin, C++ or test referenced either name. $bunNativePtr is still used and stays.

TextEncoder

  • TextEncoder::encode / encodeInto / EncodeIntoResult and the convertDictionary<EncodeIntoResult> / convertDictionaryToJS specializations (TextEncoder.h, TextEncoder.cpp, JSTextEncoder.h, JSTextEncoder.cpp): the wrapper implements both methods through the Rust TextEncoder__encode* exports and only ever calls impl.encoding(), which is all that is left of the impl class.

node:crypto

  • JSKeyObject::create and JSKeyObject::subspaceFor plus the m_subspaceForJSKeyObject / m_clientSubspaceForJSKeyObject slots: every key object is one of the three final subclasses, each of which defines its own create/subspaceFor; the base class is only used as a downcast target.
  • Commented-out switch (m_curve) block in CryptoKeyOKP::algorithm() (2023).

Other bindings

  • WriteBarrierList::list(), the WeakRefFinalizeFn typedef in Weak.cpp, JSC_MAC_VERSION_TBA / JSC_IOS_VERSION_TBA in root.h (unused by every JSC header in the WebKit builds we ship against).
  • Bun__resolve host export (bun_resolve in BunObject.rs + the extern "C" declaration in ImportMetaObject.h): nothing in C++ or JS called it; the Bun__resolveSync* family is what is used.

node:http (src/js/node/_http_server.ts)

  • kDeprecatedReplySymbol is a module-private Symbol() in internal/http that nothing ever sets on a response's options, so the constructor branch that installed the fetch-Response based write/end was 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 an undefined-valued Symbol(deprecatedReply) own property to every ServerResponse.
  • The isNextIncomingMessageHTTPS save/set/restore around request dispatch: the flag's only reader was removed in c4a937c, so the calls had no effect.
  • A 2025 commented-out cluster._getServer block in Server.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, fdatasync and the non-Linux sendfile stub (both the posix and Windows arms), the Windows arms of fchown, chmod, chown, fsync, linkat, fchmodat, lchmod, lchown, futimens, lutimens, fcntl, socketpair, the Windows Name::as_zstr, c::kqueue / c::kevent / c::fork / c::fd_t, linux::Errno, darwin::OSLog::as_ptr, the non-macOS clonefile stub, the non-Windows get_fd_path_w stub, posix::sysctlbyname (the typed sysctl_read* helpers stay), posix::write; and the two helpers that became unreferenced as a result, linux_syscall::write_raw and the safe_libc::fdatasync import, plus windows::timespec_to_filetime. Tag::futimens is now #[cfg(not(windows))] like the other tags whose only users are posix-side (the Windows cargo check flagged it once its Windows user was gone).
  • bun_lsquic_sys: the Engine wrapper (struct, impl, Drop), Conn::{raw, set_ctx, ctx, n_avail_streams, sockaddr, status}, global_init, enable_logging, LSQVER_I001/I002, and the lsquic_conn_n_avail_streams extern. node:quic drives lsquic through the raw externs directly.
  • bun_spawn_sys: PosixSpawnResult::close and the non-Linux pifd_from_pid stub (the only call site is Linux-gated). The FdExt import that close was the last Windows user of is now #[cfg(unix)].
  • bun_tcc_sys: State::run and the tcc_run extern.
  • hawk.toml: the six bun_platform darwin::Category::* overrides, whose variants were deleted in Remove dead code from platform/darwin, webcrypto, sqlite, NodeVM, ast #36833 (hawk reports them as unknown_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.json line that sourced it; misctools/mime.js (emitted a Zig ComptimeStringMap; MIME types now come from src/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 node:crypto: move Sign and Verify to c++ #17692. Unlike every other file under patches/, no scripts/build/deps/*.ts applies it, and ncrypto.cpp/.h have changed many times since, so it no longer describes anything.
  • meta.json (stray --metafile output committed in feat(build): add --metafile-md CLI option for LLM-friendly bundle analysis #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 (WebKit make_event_factory.pl input; Bun's EventNames.h is hand-written), src/runtime/ffi/libtcc1.a.macos-aarch64 (superseded by the embedded libtcc1.c).
  • src/runtime/bake/client/JavaScriptSyntaxHighlighterComponent.tsx (its header says the client never uses it) and JavaScriptSyntaxHighlighter.css, which only it imported. The live JavaScriptSyntaxHighlighter.ts is untouched.
  • packages/bun-release/scripts/npm-exec.ts (upload-npm.ts bundles only npm-postinstall.ts and ships placeholder bins), packages/bun-usockets/misc/{manual.md,gen_test_certs.sh,layout.png} and packages/bun-usockets/module.modulemap (upstream leftovers, same class as the bun-uws/misc files removed in Remove dead code from bun-uws, the native BufferList class, and built-in JS #37659).

Verification

  • rg / git grep for every symbol and file name above across src/, scripts/, packages/, test/, vendor/WebKit/Source (for the C++ symbols) and freshly regenerated build/debug/codegen/.
  • Rust items come from a hawk dead_public report 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 bd builds, and the removed symbols are absent from the resulting binary / bundled JS / generated_host_exports.rs. bun bd test passes on test/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.* and test/js/node/quic/quic-stream.test.ts; test/js/node/http/node-http.test.ts passes except "request via http proxy, issue#4295", which fails identically with an unmodified bun in this container (ECONNREFUSED to its local proxy).
  • cargo check --workspace on the windows-msvc, darwin, freebsd, linux-musl, android and linux-gnu targets.
  • test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts pins 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 whole utf32 / big-endian wrapper tree (~150 lines, plus its externs and the matching shims in bun-simdutf.cpp) has no callers, but Remove dead code from libuv_sys, cares_sys, simdutf FFI, test_runner, and C++ bindings #37332 is editing the same extern block; worth a follow-up once that lands. Same story for the unused Loop / uv_stat_t / ReturnCode helpers in libuv_sys.
  • src/js/internal/http.ts: kDeprecatedReplySymbol, controllerSymbol, runSymbol, deferredSymbol, firstWriteSymbol and get/setIsNextIncomingMessageHTTPS lost their last users in this PR, but Remove dead code from C++ bindings, src/js builtins, CSS, and Rust util crates #35437 rewrites that exact region of the file.
  • The rest of the transferable-streams scaffolding: JSCrossRealmTransformState (never created; its only references are its FOR_EACH_WEB_STREAMS_INTERNAL_STRUCTURE entry and iso-subspace slots), CrossRealmTransform.cpp, and the SourceKind::CrossRealm / SinkKind::CrossRealm arms with their case labels. Remove dead code from libuv_sys, cares_sys, simdutf FFI, test_runner, and C++ bindings #37332 is already editing that cluster, so it is best removed as one unit once that lands.
  • misctools/gen-unicode-table.ts + unicode-generator.ts emit Zig source, but src/bun_core/string/identifier.rs still points at them as the generator to port; misctools/generate-cli-completions.ts + completions/bun-cli.json and completions/spec.yaml have no in-repo consumers but may have external ones.
  • src/runtime/bake/{incremental,memory}_visualizer.html (~800 lines): nothing serves them since the port, but DevServer still 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) and packages/bun-build-mdx-rs (2024 proof of concept) are unreferenced but are a product call.
  • bun_shim_impl::read_without_launch is the Windows bunx fast 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)

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 556b6077-ebf3-415c-87d4-014ed8e7f665

📥 Commits

Reviewing files that changed from the base of the PR and between b5afcac and 72cac7f.

⛔ Files ignored due to path filters (1)
  • packages/bun-usockets/misc/layout.png is excluded by !**/*.png
📒 Files selected for processing (45)
  • .vscode/launch.json
  • hawk.toml
  • meta.json
  • misctools/.gitignore
  • misctools/gdb/std_gdb_pretty_printers.py
  • misctools/mime.js
  • packages/bun-release/scripts/npm-exec.ts
  • packages/bun-usockets/misc/gen_test_certs.sh
  • packages/bun-usockets/misc/manual.md
  • packages/bun-usockets/module.modulemap
  • patches/ncrypto.patch
  • src/js/builtins.d.ts
  • src/js/builtins/BunBuiltinNames.h
  • src/js/node/_http_server.ts
  • src/jsc/bindings/ImportMetaObject.h
  • src/jsc/bindings/Weak.cpp
  • src/jsc/bindings/WriteBarrierList.h
  • src/jsc/bindings/node/crypto/JSKeyObject.h
  • src/jsc/bindings/root.h
  • src/jsc/bindings/v8-capture-stack-fixture.cjs
  • src/jsc/bindings/webcore/DOMClientIsoSubspaces.h
  • src/jsc/bindings/webcore/DOMIsoSubspaces.h
  • src/jsc/bindings/webcore/EventNames.in
  • src/jsc/bindings/webcore/JSTextEncoder.cpp
  • src/jsc/bindings/webcore/JSTextEncoder.h
  • src/jsc/bindings/webcore/TextEncoder.cpp
  • src/jsc/bindings/webcore/TextEncoder.h
  • src/jsc/bindings/webcore/streams/JSReadableStream.cpp
  • src/jsc/bindings/webcore/streams/JSReadableStream.h
  • src/jsc/bindings/webcore/streams/JSTransformStream.h
  • src/jsc/bindings/webcore/streams/JSWritableStream.h
  • src/jsc/bindings/webcore/streams/WebStreamsExports.cpp
  • src/jsc/bindings/webcrypto/CryptoKeyOKP.cpp
  • src/lsquic_sys/lib.rs
  • src/runtime/api/BunObject.rs
  • src/runtime/bake/client/JavaScriptSyntaxHighlighter.css
  • src/runtime/bake/client/JavaScriptSyntaxHighlighterComponent.tsx
  • src/runtime/ffi/libtcc1.a.macos-aarch64
  • src/runtime/node/node_os.rs
  • src/spawn_sys/spawn_process.rs
  • src/sys/lib.rs
  • src/sys/linux_syscall.rs
  • src/sys/windows/mod.rs
  • src/tcc_sys/tcc.rs
  • workspace.code-workspace

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

The pull request removes obsolete runtime bindings, system wrappers, FFI APIs, debugging tools, generated metadata, scripts, documentation, and workspace configuration. It also simplifies HTTP parser imports and updates one platform comment.

Changes

WebCore stream and encoder cleanup

Layer / File(s) Summary
Stream accessors and state
src/js/builtins.d.ts, src/js/builtins/BunBuiltinNames.h, src/jsc/bindings/webcore/streams/*, src/jsc/bindings/webcore/streams/WebStreamsExports.cpp
Removes $bunNativeType, $disturbed, m_nativeType, and unused detached-state fields. Detachment continues to invalidate the native pointer and mark the stream disturbed.
TextEncoder interface
src/jsc/bindings/webcore/TextEncoder.*, src/jsc/bindings/webcore/JSTextEncoder.*
Removes TextEncoder::encode, encodeInto, EncodeIntoResult, and their JavaScript dictionary conversions.

Runtime binding and helper removal

Layer / File(s) Summary
Runtime APIs and bindings
src/runtime/api/BunObject.rs, src/jsc/bindings/ImportMetaObject.h, src/jsc/bindings/WriteBarrierList.h
Removes asynchronous bun_resolve, the Bun__resolve declaration, and the mutable WriteBarrierList::list() accessor.
HTTP and compatibility cleanup
src/js/node/_http_server.ts, src/jsc/bindings/root.h, src/runtime/node/node_os.rs, src/jsc/bindings/webcrypto/CryptoKeyOKP.cpp
Removes obsolete HTTP support imports and compatibility macros. Updates parser cleanup imports and the syscall comment. Replaces a commented-out switch with an explanatory comment.

Platform syscall and process-interface cleanup

Layer / File(s) Summary
Process and syscall wrappers
src/spawn_sys/spawn_process.rs, src/sys/lib.rs, src/sys/linux_syscall.rs, src/sys/windows/mod.rs
Removes unused process cleanup, fallback, raw I/O, filesystem, socket, memory-mapping, platform, and time-conversion helpers.
ncrypto interface migration
patches/ncrypto.patch
Migrates ncrypto string, callback, span, assertion, and allocation declarations from STL interfaces to WTF interfaces.

QUIC and TinyCC FFI cleanup

Layer / File(s) Summary
lsquic wrappers
src/lsquic_sys/lib.rs
Removes obsolete constants, stream APIs, the Engine wrapper, connection accessors, and global initialization and logging helpers.
TinyCC execution API
src/tcc_sys/tcc.rs
Removes the tcc_run declaration and State::run; relocation and symbol lookup remain.

Development configuration cleanup

Layer / File(s) Summary
Debugging and dead-public checks
.vscode/launch.json, hawk.toml
Stops loading the deleted GDB pretty-printer and removes six dead-public Darwin category overrides.
Removed development artifacts
meta.json, workspace.code-workspace, misctools/.gitignore, misctools/gdb/std_gdb_pretty_printers.py, misctools/mime.js, packages/bun-release/scripts/npm-exec.ts, packages/bun-usockets/misc/*, src/runtime/bake/client/JavaScriptSyntaxHighlighter.css, src/runtime/bake/client/JavaScriptSyntaxHighlighterComponent.tsx
Deletes obsolete build metadata, workspace settings, ignore rules, helper scripts, certificate tooling, usockets documentation and module mapping, and the unused syntax-highlighter component and stylesheet.

Possibly related PRs

  • oven-sh/bun#37062: Removes related obsolete WebCore and JavaScript binding symbols.
  • oven-sh/bun#37767: Modifies the same HTTP server parser and connection lifecycle code.

Suggested reviewers: alii, jarred-sumner


Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 4:17 PM PT - Aug 13th, 2026

@robobun, your commit 59bf369d3ffa41236fb760599bcba406fc45c3cc passed in Build #94856! 🎉


🧪   To try this PR locally:

bunx bun-pr 38213

That installs a local version of the PR into your bun-38213 executable, so you can run:

bun-38213 --bun

Comment thread src/jsc/bindings/webcore/streams/JSReadableByteStreamController.h Outdated
Comment thread src/jsc/bindings/webcore/streams/JSStreamsRuntime.h Outdated
Comment thread src/jsc/bindings/webcore/streams/StreamQueue.h Outdated
Comment thread src/jsc/bindings/webcore/streams/StreamQueue.h Outdated
Comment thread src/jsc/bindings/webcore/streams/StreamQueue.h Outdated
Comment thread src/sys/lib.rs
Comment thread test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the two doc-comment nits and narrowing the hawk.toml guard in 59bf369. This run found no further issues. Given the scope — ~2.7k lines removed across 45 files spanning platform-gated bun_sys syscall arms, the WebCore streams bindings, and the node:http request path — a human pass is still worthwhile before landing.

What was reviewed:

  • Confirmed $disturbed / $bunNativeType have no remaining readers in src/js/; m_disturbed (the field) stays and is still written by ReadableStream__detach.
  • Confirmed Bun__resolve has no C++/JS callers (only the Bun__resolveSync* family remains).
  • Checked that OriginalWriteHeadFn/OriginalImplicitHeadFn are still consumed by the surviving flush path in _http_server.ts after drainHeadersIfObservable was removed.
  • Verified the link_w and node_os.rs doc comments no longer reference the removed functions, and the guard-test regex now matches only darwin::Category::.
Extended reasoning...

Overview

This PR is a scheduled dead-code sweep removing ~2.7k lines across 45 files. It deletes: unread m_detached/m_nativeType slots and the $bunNativeType/$disturbed private-name accessors from the WebCore streams cells; the WebCore TextEncoder::encode/encodeInto stubs and their dictionary converters; JSKeyObject::create/subspaceFor and their iso-subspace slots; the Bun__resolve host export; the unreachable kDeprecatedReplySymbol path (~200 lines) and the no-op isNextIncomingMessageHTTPS save/restore in _http_server.ts; a large set of bun_sys platform arms (posix link/fdatasync, the non-Linux sendfile stub, ~15 Windows-only wrappers, c::kqueue/kevent/fork, posix::sysctlbyname/write, clonefile/get_fd_path_w stubs); the lsquic_sys::Engine wrapper and several Conn accessors; PosixSpawnResult::close and the non-Linux pifd_from_pid stub; tcc_sys::State::run; six stale hawk.toml overrides; and 16 orphaned files (Zig-era misctools, patches/ncrypto.patch, meta.json, workspace.code-workspace, EventNames.in, the bake syntax-highlighter demo component, upstream uSockets misc/, etc.). It adds a source-lint guard test and three small #[cfg]/comment adjustments.

Prior review

My previous run flagged two stale doc comments (link_w in src/sys/lib.rs still cross-referencing the removed link/sys_uv::link, and node_os.rs still naming posix::sysctlbyname) and an over-broad bun_platform| alternative in the guard test's hawk.toml regex. All three were fixed in commit 59bf369 and the inline threads are resolved.

Security risks

None identified. This is pure removal of code confirmed to have no callers; no new code paths, no changed validation, no auth/crypto logic (the JSKeyObject change removes only the never-instantiated base-class allocation helpers — the three concrete subclasses each define their own create/subspaceFor).

Level of scrutiny

High. Although the change is mechanically simple (deletions), it spans many subsystems and includes platform-gated Rust where a missing arm only surfaces on that target's build. The PR description documents cargo check --workspace on all six target OS families, a hawk dead_public report across all 11 shipped targets, rg/git grep across the tree and regenerated codegen, and passing test suites for each touched area — which is strong evidence, but the removed bun_sys Windows arms and the ~200-line _http_server.ts deletion are the kind of change a maintainer familiar with those subsystems should confirm.

Other factors

I spot-checked the highest-risk deletions this run: no builtin references $disturbed or $bunNativeType; Bun__resolve has no remaining callers repo-wide; OriginalWriteHeadFn/OriginalImplicitHeadFn retain a live consumer after drainHeadersIfObservable was removed. The guard test follows the existing test/internal/source-lints/ pattern and reads HEAD via git ls-tree for the deleted-file check. Given the breadth (streams C++, node:http hot path, cross-platform syscall wrappers, orphaned-file deletions including a build patch), I'm deferring rather than approving.

@Jarred-Sumner
Jarred-Sumner merged commit 4c0c674 into main Aug 14, 2026
9 of 11 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/c48628f3/dead-code-streams-http-misctools branch August 14, 2026 22:04
Comment on lines 93 to 96
using WrapperClass = JSTextEncoder;
using ToWrappedReturnType = TextEncoder*;
};
template<> TextEncoder::EncodeIntoResult convertDictionary<TextEncoder::EncodeIntoResult>(JSC::JSGlobalObject&, JSC::JSValue);

JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, const TextEncoder::EncodeIntoResult&);

} // namespace WebCore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Removing the convertDictionary<EncodeIntoResult>/convertDictionaryToJS declarations here leaves #include "JSDOMConvertDictionary.h" (JSTextEncoder.h:25) with no remaining users; likewise TextEncoder.cpp now contains only return "utf-8"_s; but still includes <JavaScriptCore/GenericTypedArrayViewInlines.h> and <JavaScriptCore/JSCInlines.h> (lines 28-29). The PR already dropped the analogous now-dead includes from TextEncoder.h in the same commit, so these three were just missed — header hygiene only.

Extended reasoning...

What the issue is

This PR removes dead members from the WebCore TextEncoder binding but leaves behind three #include lines whose only users were the removed code. Per REVIEW.md's "Delete dead code in the same PR that makes it dead", these should go in the same PR — and the PR already applied exactly this cleanup to the sibling header, so this is the same class of change with three sites missed.

JSTextEncoder.h:25#include "JSDOMConvertDictionary.h". That header declares the primary convertDictionary<T> template and the IDLDictionary converter machinery. This PR removes the template<> TextEncoder::EncodeIntoResult convertDictionary<TextEncoder::EncodeIntoResult>(...) specialization declaration and the convertDictionaryToJS(..., const TextEncoder::EncodeIntoResult&) overload from the bottom of JSTextEncoder.h. Those were the only reason this include existed. The remaining header contents — JSDOMWrapper<TextEncoder>, JSTextEncoderOwner, the toJS/toJSNewlyCreated helpers, and JSDOMWrapperConverterTraits<TextEncoder> — are satisfied by JSDOMWrapper.h, TextEncoder.h, and <wtf/NeverDestroyed.h>.

TextEncoder.cpp:28-29#include <JavaScriptCore/GenericTypedArrayViewInlines.h> and #include <JavaScriptCore/JSCInlines.h>. After this PR strips TextEncoder::encode and TextEncoder::encodeInto, the entire remaining body of the translation unit is:

String TextEncoder::encoding() const { return "utf-8"_s; }

That needs only WTF::String and the _s literal operator, both of which arrive via TextEncoder.h<wtf/text/WTFString.h>. The two JSC includes existed solely for the removed bodies (Uint8Array::baseAddress/byteLength, U8_APPEND, StringView::codePoints) and are now dead.

Why this is inconsistent with the PR's own approach

The same commit removes #include "JSDOMConvertBufferSource.h" and #include <JavaScriptCore/Forward.h> from TextEncoder.h because they became dead when EncodeIntoResult/encode/encodeInto were removed. These three includes are the identical class of newly-dead include in the two sibling files, and were just missed.

Step-by-step proof (JSTextEncoder.h case)

  1. Before this PR, JSTextEncoder.h declared template<> TextEncoder::EncodeIntoResult convertDictionary<TextEncoder::EncodeIntoResult>(JSC::JSGlobalObject&, JSC::JSValue); at what is now line 96. convertDictionary<T> is the primary template declared in JSDOMConvertDictionary.h, so the specialization declaration required that include.
  2. The diff removes that declaration (and convertDictionaryToJS, and the corresponding definitions in JSTextEncoder.cpp).
  3. Grepping the post-PR JSTextEncoder.h for anything from JSDOMConvertDictionary.h (convertDictionary, IDLDictionary, DefaultConverter<IDLDictionary) yields nothing.
  4. The include on line 25 is now dead.

Impact

None at runtime. Unused includes in a .cpp translation unit have zero effect on the shipped binary and negligible build-time cost; a dead include in a header (JSTextEncoder.h) transitively pulls JSDOMConvertDictionary.h into every TU that includes it, but the effect is still build-time-only. This is header hygiene, mentioned only because the PR already did this cleanup for the sibling header and REVIEW.md explicitly asks for dead code to be deleted in the PR that makes it dead.

Fix

  • src/jsc/bindings/webcore/JSTextEncoder.h: drop line 25 (#include "JSDOMConvertDictionary.h").
  • src/jsc/bindings/webcore/TextEncoder.cpp: drop lines 28-29 (<JavaScriptCore/GenericTypedArrayViewInlines.h> and <JavaScriptCore/JSCInlines.h>).

Comment thread hawk.toml
Comment on lines 454 to 455

[[override]]
lint = "hawk::dead_public"
crate = "bun_platform"
item = "darwin::Category::PointsOfInterest"
kind = "enum_variant"
level = "expect"
reason = "external code table: OSLog signpost category values"

[[override]]
lint = "hawk::dead_public"
crate = "bun_platform"
item = "darwin::Category::Dynamicity"
kind = "enum_variant"
level = "expect"
reason = "external code table: OSLog signpost category values"

[[override]]
lint = "hawk::dead_public"
crate = "bun_platform"
item = "darwin::Category::SizeAndThroughput"
kind = "enum_variant"
level = "expect"
reason = "external code table: OSLog signpost category values"

[[override]]
lint = "hawk::dead_public"
crate = "bun_platform"
item = "darwin::Category::TimeProfile"
kind = "enum_variant"
level = "expect"
reason = "external code table: OSLog signpost category values"

[[override]]
lint = "hawk::dead_public"
crate = "bun_platform"
item = "darwin::Category::SystemReporting"
kind = "enum_variant"
level = "expect"
reason = "external code table: OSLog signpost category values"

[[override]]
lint = "hawk::dead_public"
crate = "bun_platform"
item = "darwin::Category::UserCustom"
kind = "enum_variant"
level = "expect"
reason = "external code table: OSLog signpost category values"

[[override]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 The PR description's Verification section still claims test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts "pins everything above; all 40 content checks and 16 deleted-file checks fail against main and pass here", but tip commit 72cac7f deletes that file (added earlier in this PR, edited in 59bf369 for the hawk.toml regex nit, then removed with no stated reason). Dropping the guard is likely correct per REVIEW.md ("Do not add tests to check dead code stays dead"), so the fix is just to update the Verification section — and optionally note why this sweep omits a guard where the sibling dead-symbols-*.test.ts files kept theirs.

Extended reasoning...

What the issue is

The tip commit of this PR is:

72cac7fa Delete test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts

That file was added in e183b85, edited in c1758fb and 59bf369 (the latter narrowed the hawk.toml regex from /bun_platform|darwin::Category::/ to /darwin::Category::/ in response to the now-resolved inline review on this hunk), and then deleted entirely in 72cac7f with a bare commit message and no explanation in the PR body. Because it was added and deleted within the same PR, the file does not appear in the net diff at all.

However, the PR description's Verification section still says:

test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts pins everything above; all 40 content checks and 16 deleted-file checks fail against main and pass here.

And the robobun evidence block ("fails on main / passes on PR") shows that test running at commit 59bf369 — one commit before it was deleted. So both the Verification bullet and the evidence block now describe verification that no longer exists at tip.

Step-by-step proof

  1. git log -- test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts shows: added e183b85 → edited c1758fb → edited 59bf369deleted 72cac7f (tip).
  2. ls test/internal/source-lints/ at tip: the file is absent, while dead-symbols-install-sql-bindings.test.ts and dead-symbols-pub-exports-sweep.test.ts (from earlier sweeps) remain.
  3. The PR description's Verification section (last bullet) and the robobun "fails on main" / "passes on PR" console blocks both name the deleted file and show it running at 59bf369d3.
  4. Commit 72cac7f's message is bare ("Delete test/internal/source-lints/...") with no rationale, and the PR body was not updated after that commit.

Why the deletion itself is probably fine

REVIEW.md's Code style section says explicitly: "Do not add tests to check dead code stays dead." The guard test was doing exactly that (regex-matching source files to prevent reintroduction of removed symbols), so a maintainer deleting it is consistent with current review guidance. The two sibling dead-symbols-*.test.ts files predate that guidance and are not necessarily precedent to follow. The dead-code removals themselves are already verified by the build succeeding, cargo check on all targets, and the functional test suites listed in the Verification section — the guard test was belt-and-suspenders, not load-bearing.

Why it's still worth a comment

  • The PR description is now factually incorrect about its own verification. A reviewer reading it would assume a 40-check + 16-deleted-file guard test exists and passed; it doesn't exist.
  • The resolved inline review on this file ("drop the bun_platform| half of the alternation") was addressed in 59bf369, but the entire file was then deleted in the very next commit — so the resolution is moot, and that's not obvious from the thread.
  • REVIEW.md also says "Every deletion needs a stated reason or replacement"; the deletion commit carries neither.

Impact

None at runtime — this is PR hygiene only. Nothing in the merged code would misbehave. Per the rubric, PR-description mismatches default to nit, and there is no indication the code (as opposed to the description) is wrong.

Fix

Update the PR description's Verification section to drop the last bullet about dead-symbols-streams-http-misctools.test.ts (and optionally the robobun evidence block, which is auto-generated and will refresh on the next push anyway). If the guard was dropped deliberately per the "do not add tests to check dead code stays dead" rule, a one-line note to that effect would explain the divergence from the two sibling dead-symbols-*.test.ts files that remain in the directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants