Skip to content

Remove dead code from platform/darwin, webcrypto, sqlite, NodeVM, ast - #36833

Merged
Jarred-Sumner merged 4 commits into
mainfrom
claude/farm/63d8870a/dead-code-platform-webcrypto-sqlite-vm-ast
Aug 3, 2026
Merged

Remove dead code from platform/darwin, webcrypto, sqlite, NodeVM, ast#36833
Jarred-Sumner merged 4 commits into
mainfrom
claude/farm/63d8870a/dead-code-platform-webcrypto-sqlite-vm-ast

Conversation

@robobun

@robobun robobun commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Net -285 LOC (349 deletions, 64 insertions including the source-lint test).

Each symbol was verified with rg -w <symbol> src/ build/debug/codegen/ to have zero references outside its own definition, then confirmed by a full bun bd build and bun run rust:check-all across all 10 targets.

src/platform/darwin.rs (whole file, 210 LOC)

The entire file duplicates bun_sys::darwin: the OSLog/Signpost/Interval API and the nocancel extern block have zero callers. bun_perf (the only signpost consumer) imports bun_sys::darwin::OSLog and bun_sys::darwin::os_log::signpost::*. bun_platform is force-linked only for linux.rs's #[no_mangle] export. Also drops the now-unused bun_opaque/strum deps from bun_platform/Cargo.toml and the stale doc comment in src/sys/lib.rs that pointed here.

webcrypto C++

  • CryptoKeyHMAC::create + const-ref ctor, CryptoKeyAES::create + const-ref ctor: never called; generate/importRaw/importJwk all construct via the rvalue ctor directly.
  • JSCryptoKey::fromJS: declared, never defined, never called.
  • JSSubtleCrypto::toWrapped: only reachable via convert<IDLInterface<SubtleCrypto>>; no such call exists.
  • OpenSSLCryptoUniquePtr.h: X509Ptr/BIOPtr aliases (zero refs) and the OPENSSL_VERSION_NUMBER >= 0x30000000L block (BoringSSL defines 0x1010107f, so it never compiles, and no code references OsslParamBldPtr/OsslParamPtr/EVPKDFCtxPtr/EVPKDFPtr).
  • CommonCryptoDERUtilities.h: extraBytesNeededForEncodedLength is only called from the same TU; header decl removed, made static in the .cpp.
  • ScriptExecutionContext.h: wrapCryptoKey/unwrapCryptoKey stubs plus the commented-out virtual decls; leftover from the earlier SerializedCryptoKeyWrap removal.

sqlite / NodeVM C++

  • lazy_sqlite3.h: sqlite3_column_int / sqlite3_memory_used / sqlite3_prepare16_v3 typedef+var+define+dlsym lines (code uses sqlite3_column_int64, tracks memory via sqlite_malloc_amount, uses sqlite3_prepare_v3).
  • SQLiteSingleton::schema_versions: never read, never appended to.
  • JSStatementSync::allowBareNamedParams/allowUnknownNamedParams/rowStructure getters: members are accessed directly.
  • DOMIsoSubspaces/DOMClientIsoSubspaces::m_*subspaceForJSSQLStatementConstructor: JSSQLStatementConstructor lives in JSFunction's subspace per the static_assert in JSSQLStatement.h.
  • NodeVMGlobalObject::sigintReceived: not virtual, never called; SigintWatcher::signalAll invokes vm().notifyNeedTermination() directly.
  • NodeVMModuleRequest::specifier/importAttributes getters: toJS reads m_specifier/m_importAttributes directly.

Rust

  • bun_ast::PartTag::{JsxImport, CjsImports, ReactFastRefresh}: never assigned or compared.
  • bun_ast::flags::JSXElement::HasAnyDynamic: never inserted or tested.
  • bun_ast::import_record::Tag::Tailwind: last variant, never constructed or matched.
  • bun_ast::BindingNodeList type alias + its unused re-export in bun_js_parser::parser.
  • bun_ast::StoreAstAllocHeap::reset: callers invoke the free fn store_ast_alloc_heap::reset() directly.
  • bun_jsc::JSPromise::reject_task: sibling resolve_task has 4 callers, reject_task has zero.
  • bun_jsc::JSRuntimeType::UNDEFINED: only NOTHING is referenced.

src/js

  • readline.js: unused ObjectSetPrototypeOf primordial destructure.
  • repl.js: unused ArrayPrototypeSlice primordial destructure.
  • zlib.ts: collapse redundant ArrayBufferIsView intermediate alias.

Verification

  • bun bd builds clean
  • bun run rust:check-all passes all 10 targets (incl. aarch64-apple-darwin for the bun_platform change)
  • Smoke tests pass: web-crypto.test.ts, sqlite.test.js, node-sqlite.test.ts, zlib.test.js, transpiler.test.js
  • test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts fails on main, passes on this branch

Followups (not deleted; left for review)


[review] gate passed · iteration 0 · 34 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-platform-webcrypto-sqlite-vm.test.ts
bun test v1.4.0 (e2a9bd907)

test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:
19 | function src(p: string): string {
20 |   return readFileSync(path.join(repoRoot, p), "utf8");
21 | }
22 | 
23 | test("bun_platform no longer declares a darwin module (duplicated bun_sys::darwin)", () => {
24 |   expect(src("src/platform/lib.rs")).not.toMatch(/pub mod darwin;/);
                                              ^
error: expect(received).not.toMatch(expected)

Expected substring or pattern: not /pub mod darwin;/
Received: "#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]\n#![warn(unused_must_use)]\n//! Per-OS APIs that don't fit in `bun_sys` (signposts, the `sys_epoll_pwait2` export).\n\n// Android is listed alongside Linux so the `#[no_mangle]` C exports\n// (`sys_epoll_pwait2`, …) reach the linker on the `*-linux-android` targets.\n#[cfg(target_os = \"macos\")]\npub mod darwin;\n#[cfg(any(target_os = \"linux\", t
... (truncated)

release without fix: 3 FAILED
bun test v1.4.0-canary.1 (1498d7b77)

test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:
19 | function src(p: string): string {
20 |   return readFileSync(path.join(repoRoot, p), "utf8");
21 | }
22 | 
23 | test("bun_platform no longer declares a darwin module (duplicated bun_sys::darwin)", () => {
24 |   expect(src("src/platform/lib.rs")).not.toMatch(/pub mod darwin;/);
                                              ^
error: expect(received).not.toMatch(expected)

Expected substring or pattern: not /pub mod darwin;/
Received: "#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]\n#![warn(unused_must_use)]\n//! Per-OS APIs that don't fit in `bun_sys` (signposts, the `sys_epoll_pwait2` export).\n\n// Android is listed alongside Linux so the `#[no_mangle]` C exports\n// (`sys_epoll_pwait2`, …) reach the linker on the `*-linux-android` targets.\n#[cfg(target_os = \"macos\")]\npub mod darwin;\n#[cfg(any(target_os = \"linux\", target_os = \"android\"))]\npub(crate) mod linux;\n"

      at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:24:42)
(fail) bun_platform no long
... (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-platform-webcrypto-sqlite-vm.test.ts
bun test v1.4.0 (e2a9bd907)

test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:
(pass) bun_platform no longer declares a darwin module (duplicated bun_sys::darwin) [10.05ms]
(pass) dead C++ symbols in webcrypto/sqlite/NodeVM do not reappear [23.34ms]
(pass) dead Rust symbols in ast/jsc do not reappear [14.33ms]

 3 pass
 0 fail
 3 expect() calls
Ran 3 tests across 1 file. [2.09s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 733ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/139] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 238 extern-C blocks audited
[2/139] gen cpp.rs (cppbind)
[3/139] gen JS modules (bundle-modules)
Preprocess modules (9279ms)
Bundle modules (59ms)
Postprocesss modules (259ms)
Bundle Functions (943ms)
Generate Code (32ms)

[10.59s] Bundled "src/js" for production
  2558 kb
  193 internal modules
  13 native modules
  90 internal functions across 19 files
[3/138] 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/boringssl_sys)
�[1m�[92m   Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
�[1
... (truncated)
diff hotspot
Cargo.lock                                         |   2 -
 src/ast/import_record.rs                           |   2 -
 src/ast/lib.rs                                     |   7 +-
 src/ast/nodes.rs                                   |   6 +-
 src/js/node/readline.js                            |   1 -
 src/js/node/repl.js                                |   1 -
 src/js/node/zlib.ts                                |   3 +-
 src/js_parser/parser.rs                            |   4 +-
 src/jsc/JSPromise.rs                               |  12 --
 src/jsc/JSRuntimeType.rs                           |   1 -
 src/jsc/bindings/NodeVM.cpp                        |   5 -
 src/jsc/bindings/NodeVM.h                          |   1 -
 src/jsc/bindings/NodeVMModule.h                    |   3 -
 src/jsc/bindings/ScriptExecutionContext.h          |  16 --
 src/jsc/bindings/sqlite/JSSQLStatement.cpp         |   2 -
 src/jsc/bindings/sqlite/NodeSqlite.h               |   3 -
 src/jsc/bindings/sqlite/lazy_sqlite3.h             |  18 --
 src/jsc/bindings/webcore/DOMClientIsoSubspaces.h   |   1 -
 src/jsc/bindings/webcore/DOMIsoSubspaces.h         |   1 -
 .../webcrypto/CommonCryptoDERUtilities.cpp         |   2 +-
 .../bindings/webcrypto/CommonCryptoDERUtilities.h  |   1 -
 src/jsc/bindings/webcrypto/CryptoKeyAES.cpp        |   7 -
 src/jsc/bindings/webcrypto/CryptoKeyAES.h          |   5 -
 src/jsc/bindings/webcrypto/CryptoKeyHMAC.cpp       |   7 -
 src/jsc/bindings/webcrypto/CryptoKeyHMAC.h         |   6 -
 src/jsc/bindings/webcrypto/JSCryptoKey.h           |   2 -
 src/jsc/bindings/webcrypto/JSSubtleCrypto.cpp      |   7 -
 src/jsc/bindings/webcrypto/JSSubtleCrypto.h        |   1 -
 .../bindings/webcrypto/OpenSSLCryptoUniquePtr.h    |  13 --
 src/platform/Cargo.toml                            |   2 -
 src/platform/darwin.rs                             | 210 ---------------------
 src/platform/lib.rs                                |   4 +-
 src/sys/lib.rs                    
... (truncated)

gate history · 1 passed · 0 rejected · iteration 0

evidence per changed file
file                                        reads  edits  tests
Cargo.lock                                      0      0      0
src/ast/import_record.rs                        1      1      0
src/ast/lib.rs                                  3      3      0
src/ast/nodes.rs                                2      2      0
src/js/node/readline.js                         1      1      0
src/js/node/repl.js                             1      1      0
src/js/node/zlib.ts                             1      1      0
src/js_parser/parser.rs                         1      1      0
src/jsc/JSPromise.rs                            1      1      0
src/jsc/JSRuntimeType.rs                        1      1      0
src/jsc/bindings/NodeVM.cpp                     1      1      0
src/jsc/bindings/NodeVM.h                       1      1      0
src/jsc/bindings/NodeVMModule.h                 1      1      0
src/jsc/bindings/ScriptExecutionContext.h       2      1      0
src/jsc/bindings/sqlite/JSSQLStatement.cpp      1      1      0
src/jsc/bindings/sqlite/NodeSqlite.h            2      2      0
(+ 18 more files)

src/platform/darwin.rs (210 LOC): the OSLog/Signpost API and nocancel
extern block duplicate bun_sys::darwin and have zero callers; bun_perf
imports from bun_sys. Drops bun_opaque/strum from bun_platform.

webcrypto: CryptoKeyHMAC::create / CryptoKeyAES::create and their
const-ref constructors (generate/importRaw use the rvalue ctor);
JSCryptoKey::fromJS (declared, never defined); JSSubtleCrypto::toWrapped
(no IDLInterface<SubtleCrypto> converters call it); X509Ptr/BIOPtr and
the OpenSSL>=3 unique_ptr block (BoringSSL defines 0x1010107f);
ScriptExecutionContext::wrapCryptoKey/unwrapCryptoKey stubs;
extraBytesNeededForEncodedLength made file-static.

sqlite: lazy_sqlite3 entries for sqlite3_column_int / sqlite3_memory_used
/ sqlite3_prepare16_v3 (never called; code uses column_int64 /
sqlite_malloc_amount / prepare_v3); SQLiteSingleton::schema_versions
(never read); JSStatementSync::allowBareNamedParams/allowUnknownNamedParams
/rowStructure getters (members accessed directly);
m_subspaceForJSSQLStatementConstructor (constructor lives in JSFunction's
subspace).

NodeVM: NodeVMGlobalObject::sigintReceived (SigintWatcher::signalAll
calls vm().notifyNeedTermination() directly);
NodeVMModuleRequest::specifier/importAttributes getters (toJS reads
m_specifier/m_importAttributes directly).

bun_ast: PartTag::{JsxImport,CjsImports,ReactFastRefresh} (never
assigned or compared); flags::JSXElement::HasAnyDynamic (never set or
read); import_record::Tag::Tailwind; BindingNodeList type alias;
StoreAstAllocHeap::reset (callers use the free fn).

bun_jsc: JSPromise::reject_task (resolve_task is used, reject_task is
not); JSRuntimeType::UNDEFINED.

src/js: unused primordial destructures in readline.js/repl.js; collapse
redundant ArrayBufferIsView alias in zlib.ts.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

Dead symbol cleanup

Layer / File(s) Summary
AST and JavaScript cleanup
src/ast/*, src/js_parser/parser.rs, src/js/node/*, src/jsc/JSRuntimeType.rs
Removed unused AST and JSC symbols, a parser re-export, a primordial import, and an intermediate ArrayBuffer.isView alias.
Darwin platform removal
src/platform/*, src/sys/lib.rs
Removed Darwin signpost and nocancel support, related dependencies, module wiring, and obsolete documentation.
JSC, VM, and SQLite cleanup
src/jsc/bindings/NodeVM.*, src/jsc/bindings/ScriptExecutionContext.h, src/jsc/bindings/sqlite/*, src/jsc/bindings/webcore/*
Removed unused VM methods, SQLite state and lazy symbols, and JSSQLStatement subspace members.
WebCrypto API and ownership cleanup
src/jsc/bindings/webcrypto/*
Removed unused conversion helpers and OpenSSL aliases. AES and HMAC constructors now move key vectors.
Dead symbol source lint
test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts
Added source checks for removed platform, WebCrypto, SQLite, NodeVM, WebCore, AST, and JSC symbols.

Possibly related PRs

  • oven-sh/bun#35880: Removes unused dependencies and dead symbols in overlapping platform and source-lint areas.
  • oven-sh/bun#36178: Removes dead WebCrypto and SQLite symbols in overlapping binding files.
  • oven-sh/bun#36390: Removes dead WebCore binding state in overlapping subspace classes.

Suggested reviewers: jarred-sumner

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: removing dead code across the listed platform and subsystem areas.
Description check ✅ Passed The description explains the changes, provides rationale by subsystem, and documents builds, checks, smoke tests, and lint verification.

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts`:
- Line 54: Update the dead-symbol pattern entry for src/jsc/JSPromise.rs to
scope the reject_task method match to the enclosing impl JSPromise block,
combining the type context and method signature in one pattern instead of
matching any pub fn reject_task declaration.
- Line 14: Remove the existsSync import and assertion from the dead-symbols
test, including the check for the deleted Rust file. Preserve the
readFileSync-based assertion that verifies src/platform/lib.rs no longer
declares pub mod darwin;
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7297449a-b8a9-4ebf-9a08-830edc690561

📥 Commits

Reviewing files that changed from the base of the PR and between 074656d and 520cf23.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (33)
  • src/ast/import_record.rs
  • src/ast/lib.rs
  • src/ast/nodes.rs
  • src/js/node/readline.js
  • src/js/node/repl.js
  • src/js/node/zlib.ts
  • src/js_parser/parser.rs
  • src/jsc/JSPromise.rs
  • src/jsc/JSRuntimeType.rs
  • src/jsc/bindings/NodeVM.cpp
  • src/jsc/bindings/NodeVM.h
  • src/jsc/bindings/NodeVMModule.h
  • src/jsc/bindings/ScriptExecutionContext.h
  • src/jsc/bindings/sqlite/JSSQLStatement.cpp
  • src/jsc/bindings/sqlite/NodeSqlite.h
  • src/jsc/bindings/sqlite/lazy_sqlite3.h
  • src/jsc/bindings/webcore/DOMClientIsoSubspaces.h
  • src/jsc/bindings/webcore/DOMIsoSubspaces.h
  • src/jsc/bindings/webcrypto/CommonCryptoDERUtilities.cpp
  • src/jsc/bindings/webcrypto/CommonCryptoDERUtilities.h
  • src/jsc/bindings/webcrypto/CryptoKeyAES.cpp
  • src/jsc/bindings/webcrypto/CryptoKeyAES.h
  • src/jsc/bindings/webcrypto/CryptoKeyHMAC.cpp
  • src/jsc/bindings/webcrypto/CryptoKeyHMAC.h
  • src/jsc/bindings/webcrypto/JSCryptoKey.h
  • src/jsc/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/jsc/bindings/webcrypto/JSSubtleCrypto.h
  • src/jsc/bindings/webcrypto/OpenSSLCryptoUniquePtr.h
  • src/platform/Cargo.toml
  • src/platform/darwin.rs
  • src/platform/lib.rs
  • src/sys/lib.rs
  • test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts
💤 Files with no reviewable changes (28)
  • src/jsc/bindings/webcore/DOMClientIsoSubspaces.h
  • src/jsc/bindings/webcore/DOMIsoSubspaces.h
  • src/jsc/JSRuntimeType.rs
  • src/ast/import_record.rs
  • src/jsc/JSPromise.rs
  • src/jsc/bindings/NodeVMModule.h
  • src/jsc/bindings/NodeVM.cpp
  • src/jsc/bindings/NodeVM.h
  • src/ast/lib.rs
  • src/jsc/bindings/webcrypto/JSCryptoKey.h
  • src/platform/Cargo.toml
  • src/ast/nodes.rs
  • src/jsc/bindings/webcrypto/JSSubtleCrypto.h
  • src/jsc/bindings/sqlite/JSSQLStatement.cpp
  • src/jsc/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/jsc/bindings/webcrypto/CryptoKeyHMAC.cpp
  • src/js/node/repl.js
  • src/sys/lib.rs
  • src/platform/darwin.rs
  • src/jsc/bindings/webcrypto/CryptoKeyHMAC.h
  • src/jsc/bindings/ScriptExecutionContext.h
  • src/js/node/readline.js
  • src/jsc/bindings/sqlite/NodeSqlite.h
  • src/jsc/bindings/webcrypto/CryptoKeyAES.cpp
  • src/jsc/bindings/webcrypto/CommonCryptoDERUtilities.h
  • src/jsc/bindings/sqlite/lazy_sqlite3.h
  • src/jsc/bindings/webcrypto/CryptoKeyAES.h
  • src/jsc/bindings/webcrypto/OpenSSLCryptoUniquePtr.h

Comment thread test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts Outdated
The pub mod darwin; check in src/platform/lib.rs is the meaningful
assertion; whether the .rs file exists on disk is a worktree-state
detail that can produce spurious failures when a stray untracked copy
is present.
Comment thread src/ast/lib.rs
Comment thread src/ast/nodes.rs
@robobun
robobun force-pushed the claude/farm/63d8870a/dead-code-platform-webcrypto-sqlite-vm-ast branch from 57b12e1 to e2a9bd9 Compare August 3, 2026 16:45
Comment thread src/platform/Cargo.toml
@Jarred-Sumner
Jarred-Sumner merged commit 1f447a7 into main Aug 3, 2026
56 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/63d8870a/dead-code-platform-webcrypto-sqlite-vm-ast branch August 3, 2026 20:25
springmin pushed a commit to springmin/bun that referenced this pull request Aug 3, 2026
…oven-sh#36833)

Net -285 LOC (349 deletions, 64 insertions including the source-lint
test).

Each symbol was verified with `rg -w <symbol> src/ build/debug/codegen/`
to have zero references outside its own definition, then confirmed by a
full `bun bd` build and `bun run rust:check-all` across all 10 targets.

### `src/platform/darwin.rs` (whole file, 210 LOC)

The entire file duplicates `bun_sys::darwin`: the
`OSLog`/`Signpost`/`Interval` API and the `nocancel` extern block have
zero callers. `bun_perf` (the only signpost consumer) imports
`bun_sys::darwin::OSLog` and `bun_sys::darwin::os_log::signpost::*`.
`bun_platform` is force-linked only for `linux.rs`'s `#[no_mangle]`
export. Also drops the now-unused `bun_opaque`/`strum` deps from
`bun_platform/Cargo.toml` and the stale doc comment in `src/sys/lib.rs`
that pointed here.

### webcrypto C++

- `CryptoKeyHMAC::create` + const-ref ctor, `CryptoKeyAES::create` +
const-ref ctor: never called; `generate`/`importRaw`/`importJwk` all
construct via the rvalue ctor directly.
- `JSCryptoKey::fromJS`: declared, never defined, never called.
- `JSSubtleCrypto::toWrapped`: only reachable via
`convert<IDLInterface<SubtleCrypto>>`; no such call exists.
- `OpenSSLCryptoUniquePtr.h`: `X509Ptr`/`BIOPtr` aliases (zero refs) and
the `OPENSSL_VERSION_NUMBER >= 0x30000000L` block (BoringSSL defines
`0x1010107f`, so it never compiles, and no code references
`OsslParamBldPtr`/`OsslParamPtr`/`EVPKDFCtxPtr`/`EVPKDFPtr`).
- `CommonCryptoDERUtilities.h`: `extraBytesNeededForEncodedLength` is
only called from the same TU; header decl removed, made `static` in the
.cpp.
- `ScriptExecutionContext.h`: `wrapCryptoKey`/`unwrapCryptoKey` stubs
plus the commented-out virtual decls; leftover from the earlier
`SerializedCryptoKeyWrap` removal.

### sqlite / NodeVM C++

- `lazy_sqlite3.h`: `sqlite3_column_int` / `sqlite3_memory_used` /
`sqlite3_prepare16_v3` typedef+var+define+dlsym lines (code uses
`sqlite3_column_int64`, tracks memory via `sqlite_malloc_amount`, uses
`sqlite3_prepare_v3`).
- `SQLiteSingleton::schema_versions`: never read, never appended to.
-
`JSStatementSync::allowBareNamedParams`/`allowUnknownNamedParams`/`rowStructure`
getters: members are accessed directly.
-
`DOMIsoSubspaces`/`DOMClientIsoSubspaces::m_*subspaceForJSSQLStatementConstructor`:
`JSSQLStatementConstructor` lives in `JSFunction`'s subspace per the
`static_assert` in `JSSQLStatement.h`.
- `NodeVMGlobalObject::sigintReceived`: not virtual, never called;
`SigintWatcher::signalAll` invokes `vm().notifyNeedTermination()`
directly.
- `NodeVMModuleRequest::specifier`/`importAttributes` getters: `toJS`
reads `m_specifier`/`m_importAttributes` directly.

### Rust

- `bun_ast::PartTag::{JsxImport, CjsImports, ReactFastRefresh}`: never
assigned or compared.
- `bun_ast::flags::JSXElement::HasAnyDynamic`: never inserted or tested.
- `bun_ast::import_record::Tag::Tailwind`: last variant, never
constructed or matched.
- `bun_ast::BindingNodeList` type alias + its unused re-export in
`bun_js_parser::parser`.
- `bun_ast::StoreAstAllocHeap::reset`: callers invoke the free fn
`store_ast_alloc_heap::reset()` directly.
- `bun_jsc::JSPromise::reject_task`: sibling `resolve_task` has 4
callers, `reject_task` has zero.
- `bun_jsc::JSRuntimeType::UNDEFINED`: only `NOTHING` is referenced.

### src/js

- `readline.js`: unused `ObjectSetPrototypeOf` primordial destructure.
- `repl.js`: unused `ArrayPrototypeSlice` primordial destructure.
- `zlib.ts`: collapse redundant `ArrayBufferIsView` intermediate alias.

### Verification

- `bun bd` builds clean
- `bun run rust:check-all` passes all 10 targets (incl.
`aarch64-apple-darwin` for the `bun_platform` change)
- Smoke tests pass: `web-crypto.test.ts`, `sqlite.test.js`,
`node-sqlite.test.ts`, `zlib.test.js`, `transpiler.test.js`
-
`test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts`
fails on main, passes on this branch

### Followups (not deleted; left for review)

- `src/runtime/api/bun/h2/connection.rs:1731-1941` outbound-stream API
(`begin_header_block`/`encode_header`/`send_header_block`/`send_data`/`send_push_promise`
+ transitively `SendWindow::{available,consume}`,
`Coder::{take_pending_size_update,encode}`, `write_table_size_update`,
~215 LOC): only called from `#[cfg(test)]`. File carries
`#![allow(dead_code)]` and was authored in oven-sh#31584; likely intentional
WIP scaffolding for migrating `h2_frame_parser`'s outbound path.
- `src/jsc/bindings/webcrypto/*.idl` (29 files, ~1055 LOC): not
processed by any build step (`scripts/glob-sources.ts` globs only
`*.cpp`), but oven-sh#34838 edited them recently so they may be maintained as
documentation.
- `src/jsc/ErrorCode.rs`: `Zig_ErrorCodeJSErrorObject` `#[no_mangle]`
static with zero refs in any `.cpp`/`.h` (sibling
`Zig_ErrorCodeParserError` is declared in `headers-handwritten.h`; this
one is not).

<!-- robobun:evidence:begin -->

---

**[review]** gate passed · iteration 0 · 34 files touched

<details><summary>fails on main (without fix)</summary>

```console
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-platform-webcrypto-sqlite-vm.test.ts
bun test v1.4.0 (e2a9bd9)

test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:
19 | function src(p: string): string {
20 |   return readFileSync(path.join(repoRoot, p), "utf8");
21 | }
22 | 
23 | test("bun_platform no longer declares a darwin module (duplicated bun_sys::darwin)", () => {
24 |   expect(src("src/platform/lib.rs")).not.toMatch(/pub mod darwin;/);
                                              ^
error: expect(received).not.toMatch(expected)

Expected substring or pattern: not /pub mod darwin;/
Received: "#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]\n#![warn(unused_must_use)]\n//! Per-OS APIs that don't fit in `bun_sys` (signposts, the `sys_epoll_pwait2` export).\n\n// Android is listed alongside Linux so the `#[no_mangle]` C exports\n// (`sys_epoll_pwait2`, …) reach the linker on the `*-linux-android` targets.\n#[cfg(target_os = \"macos\")]\npub mod darwin;\n#[cfg(any(target_os = \"linux\", t
... (truncated)

release without fix: 3 FAILED
bun test v1.4.0-canary.1 (1498d7b)

test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:
19 | function src(p: string): string {
20 |   return readFileSync(path.join(repoRoot, p), "utf8");
21 | }
22 | 
23 | test("bun_platform no longer declares a darwin module (duplicated bun_sys::darwin)", () => {
24 |   expect(src("src/platform/lib.rs")).not.toMatch(/pub mod darwin;/);
                                              ^
error: expect(received).not.toMatch(expected)

Expected substring or pattern: not /pub mod darwin;/
Received: "#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]\n#![warn(unused_must_use)]\n//! Per-OS APIs that don't fit in `bun_sys` (signposts, the `sys_epoll_pwait2` export).\n\n// Android is listed alongside Linux so the `#[no_mangle]` C exports\n// (`sys_epoll_pwait2`, …) reach the linker on the `*-linux-android` targets.\n#[cfg(target_os = \"macos\")]\npub mod darwin;\n#[cfg(any(target_os = \"linux\", target_os = \"android\"))]\npub(crate) mod linux;\n"

      at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:24:42)
(fail) bun_platform no long
... (truncated)
```

</details>

<details><summary>passes on PR (with fix)</summary>

```console
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-platform-webcrypto-sqlite-vm.test.ts
bun test v1.4.0 (e2a9bd9)

test/internal/source-lints/dead-symbols-platform-webcrypto-sqlite-vm.test.ts:
(pass) bun_platform no longer declares a darwin module (duplicated bun_sys::darwin) [10.05ms]
(pass) dead C++ symbols in webcrypto/sqlite/NodeVM do not reappear [23.34ms]
(pass) dead Rust symbols in ast/jsc do not reappear [14.33ms]

 3 pass
 0 fail
 3 expect() calls
Ran 3 tests across 1 file. [2.09s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 733ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/139] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 238 extern-C blocks audited
[2/139] gen cpp.rs (cppbind)
[3/139] gen JS modules (bundle-modules)
Preprocess modules (9279ms)
Bundle modules (59ms)
Postprocesss modules (259ms)
Bundle Functions (943ms)
Generate Code (32ms)

[10.59s] Bundled "src/js" for production
  2558 kb
  193 internal modules
  13 native modules
  90 internal functions across 19 files
[3/138] 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/boringssl_sys)
�[1m�[92m   Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
�[1
... (truncated)
```

</details>

<details><summary>diff hotspot</summary>

```
Cargo.lock                                         |   2 -
 src/ast/import_record.rs                           |   2 -
 src/ast/lib.rs                                     |   7 +-
 src/ast/nodes.rs                                   |   6 +-
 src/js/node/readline.js                            |   1 -
 src/js/node/repl.js                                |   1 -
 src/js/node/zlib.ts                                |   3 +-
 src/js_parser/parser.rs                            |   4 +-
 src/jsc/JSPromise.rs                               |  12 --
 src/jsc/JSRuntimeType.rs                           |   1 -
 src/jsc/bindings/NodeVM.cpp                        |   5 -
 src/jsc/bindings/NodeVM.h                          |   1 -
 src/jsc/bindings/NodeVMModule.h                    |   3 -
 src/jsc/bindings/ScriptExecutionContext.h          |  16 --
 src/jsc/bindings/sqlite/JSSQLStatement.cpp         |   2 -
 src/jsc/bindings/sqlite/NodeSqlite.h               |   3 -
 src/jsc/bindings/sqlite/lazy_sqlite3.h             |  18 --
 src/jsc/bindings/webcore/DOMClientIsoSubspaces.h   |   1 -
 src/jsc/bindings/webcore/DOMIsoSubspaces.h         |   1 -
 .../webcrypto/CommonCryptoDERUtilities.cpp         |   2 +-
 .../bindings/webcrypto/CommonCryptoDERUtilities.h  |   1 -
 src/jsc/bindings/webcrypto/CryptoKeyAES.cpp        |   7 -
 src/jsc/bindings/webcrypto/CryptoKeyAES.h          |   5 -
 src/jsc/bindings/webcrypto/CryptoKeyHMAC.cpp       |   7 -
 src/jsc/bindings/webcrypto/CryptoKeyHMAC.h         |   6 -
 src/jsc/bindings/webcrypto/JSCryptoKey.h           |   2 -
 src/jsc/bindings/webcrypto/JSSubtleCrypto.cpp      |   7 -
 src/jsc/bindings/webcrypto/JSSubtleCrypto.h        |   1 -
 .../bindings/webcrypto/OpenSSLCryptoUniquePtr.h    |  13 --
 src/platform/Cargo.toml                            |   2 -
 src/platform/darwin.rs                             | 210 ---------------------
 src/platform/lib.rs                                |   4 +-
 src/sys/lib.rs                    
... (truncated)
```

</details>

**gate history** · 1 passed · 0 rejected · iteration 0

<details><summary>evidence per changed file</summary>

```
file                                        reads  edits  tests
Cargo.lock                                      0      0      0
src/ast/import_record.rs                        1      1      0
src/ast/lib.rs                                  3      3      0
src/ast/nodes.rs                                2      2      0
src/js/node/readline.js                         1      1      0
src/js/node/repl.js                             1      1      0
src/js/node/zlib.ts                             1      1      0
src/js_parser/parser.rs                         1      1      0
src/jsc/JSPromise.rs                            1      1      0
src/jsc/JSRuntimeType.rs                        1      1      0
src/jsc/bindings/NodeVM.cpp                     1      1      0
src/jsc/bindings/NodeVM.h                       1      1      0
src/jsc/bindings/NodeVMModule.h                 1      1      0
src/jsc/bindings/ScriptExecutionContext.h       2      1      0
src/jsc/bindings/sqlite/JSSQLStatement.cpp      1      1      0
src/jsc/bindings/sqlite/NodeSqlite.h            2      2      0
(+ 18 more files)
```

</details>

<!-- robobun:evidence:end -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
robobun added a commit that referenced this pull request Aug 4, 2026
The mechanical gate rejects src/** changes without a test/** change.
Prior dead-code PRs (#36803, #36833, #36053) landed with an equivalent
test and 4d14836 swept them afterwards; this follows that path so the
gate can re-derive the fail-before/pass-after proof.
dylan-conway pushed a commit that referenced this pull request Aug 8, 2026
### What does this PR do?

Main at 6089d0e does not compile:

```
error[E0599]: no variant, associated function, or constant named `JsxImport` found for enum `PartTag`
    --> src/js_parser/p.rs:1917:45
```

(also at `src/js_parser/parse/parse_entry.rs:1966` and `:1981`)

This is a semantic conflict between two PRs that each passed CI on their
own merge base:

- #36833 removed the then-unused `JsxImport`, `CjsImports`, and
`ReactFastRefresh` variants from `PartTag` in `src/ast/nodes.rs` as dead
code.
- #35472, written before that removal, started tagging synthesized JSX
runtime imports with `PartTag::JsxImport` in the parser and matching on
it in `LinkerContext.rs`.

The fix re-adds the `JsxImport` variant in its old position. The other
two removed variants are still unused and stay gone. `PartTag` has no
explicit `repr` and is never serialized, so the variant's position
carries no meaning; matching the old order keeps the diff minimal
against history.

### Why a test change?

The build failure itself is the regression, so any test proves
fail-before. The added test pins the one path of #35472's feature the
suite did not cover: transpile-only output (`--no-bundle`, the same
single-file path the runtime transpiler uses) never tree-shakes parts,
so the synthesized JSX runtime import must survive even when every JSX
expression is dead. Verified the other direction (bundler drops the
import for dead JSX) is already covered by the `autoImportTreeShaking`
tests from #35472, which now compile and pass again.

### Verification

- `cargo check -p bun_js_parser` fails with 3x E0599 before, clean after
- `bun bd` builds
- `bun bd test test/bundler/bundler_jsx.test.ts`: 48 pass, 4 todo
(pre-existing), 0 fail
springmin pushed a commit to springmin/bun that referenced this pull request Aug 8, 2026
### What does this PR do?

Main at 6089d0e does not compile:

```
error[E0599]: no variant, associated function, or constant named `JsxImport` found for enum `PartTag`
    --> src/js_parser/p.rs:1917:45
```

(also at `src/js_parser/parse/parse_entry.rs:1966` and `:1981`)

This is a semantic conflict between two PRs that each passed CI on their
own merge base:

- oven-sh#36833 removed the then-unused `JsxImport`, `CjsImports`, and
`ReactFastRefresh` variants from `PartTag` in `src/ast/nodes.rs` as dead
code.
- oven-sh#35472, written before that removal, started tagging synthesized JSX
runtime imports with `PartTag::JsxImport` in the parser and matching on
it in `LinkerContext.rs`.

The fix re-adds the `JsxImport` variant in its old position. The other
two removed variants are still unused and stay gone. `PartTag` has no
explicit `repr` and is never serialized, so the variant's position
carries no meaning; matching the old order keeps the diff minimal
against history.

### Why a test change?

The build failure itself is the regression, so any test proves
fail-before. The added test pins the one path of oven-sh#35472's feature the
suite did not cover: transpile-only output (`--no-bundle`, the same
single-file path the runtime transpiler uses) never tree-shakes parts,
so the synthesized JSX runtime import must survive even when every JSX
expression is dead. Verified the other direction (bundler drops the
import for dead JSX) is already covered by the `autoImportTreeShaking`
tests from oven-sh#35472, which now compile and pass again.

### Verification

- `cargo check -p bun_js_parser` fails with 3x E0599 before, clean after
- `bun bd` builds
- `bun bd test test/bundler/bundler_jsx.test.ts`: 48 pass, 4 todo
(pre-existing), 0 fail
Jarred-Sumner added a commit that referenced this pull request Aug 14, 2026
…c_sys, and orphaned files (#38213)

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 #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 #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 #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 #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 #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 #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. #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.

<!-- robobun:evidence:begin -->

---

**[review]** gate passed · iteration 1 · 47 files touched

<details><summary>fails on main (without fix)</summary>

```console
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 (59bf369)

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 (da3851e)

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)
```

</details>

<details><summary>passes on PR (with fix)</summary>

```console
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 (59bf369)

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)
```

</details>

<details><summary>diff hotspot</summary>

```
.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)
```

</details>

**gate history** · 1 passed · 1 rejected · iteration 1

<details><summary>evidence per changed file</summary>

```
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)
```

</details>

<!-- robobun:evidence:end -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
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