Skip to content

Remove dead code from install, event_loop, dns, mysql protocol, C++ bindings, and JS internals - #36970

Merged
Jarred-Sumner merged 8 commits into
mainfrom
claude/farm/ffea5668/dead-code-install-sql-bindings
Aug 6, 2026
Merged

Remove dead code from install, event_loop, dns, mysql protocol, C++ bindings, and JS internals#36970
Jarred-Sumner merged 8 commits into
mainfrom
claude/farm/ffea5668/dead-code-install-sql-bindings

Conversation

@robobun

@robobun robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Removes code verified to have zero references across src/, scripts/, test/, and freshly regenerated build/debug/codegen/ output. Every candidate was grepped for bare-name, quoted-string, and $-prefixed references before deletion; items referenced from generated bindings, .classes.ts files, attribute-macro exports (uws_callback(export = ...)), or extern "C" surfaces were left alone. The vendored WebKit tree is part of the reference scan as well: Bun__errorInstance__finalize was initially removed here, then restored once the darwin LTO link surfaced its __attribute__((weak)) reference from JSC's ErrorInstance.cpp (weak references satisfy non-LTO links silently).

Rust

  • bun_install::Error: variants FileTooBig, ProcessFdQuotaExceeded, ReadOnlyFileSystem, FileSystem, FileBusy were never constructed (the same-named live variants belong to bun_runtime's separate error enum; node_fs.rs maps onto that one)
  • hosted_git_info::Representation::Ssh: every ssh-flavored protocol maps to Sshurl
  • FromTextLockfileError::InvalidSemver plus its only mention, an unreachable match arm in bun.lock.rs (ParseError::InvalidSemver stays and is still produced)
  • MigratePnpmLockfileError::{PnpmLockfileInvalidOverride, PnpmLockfileInvalidPatchedDependency}: never produced by the pnpm migration
  • windows-shim FailReason::InvalidShimDataSize: no size check produces it
  • bun_event_loop::EventLoopTimer::TimerCallback struct, its Tag variant, and the dispatch arm in runtime/dispatch.rs: nothing ever constructed one, so the tag could never be dispatched
  • bun_dns::Family::Unix: neither the string map nor the JS numeric mapping yields it (AF_UNIX on the result path is a different, live match)
  • MySQL wire structs: write-only fields OKPacket::{warnings, info, session_state_changes}, EOFPacket::warnings, StmtPrepareOKPacket::warning_count, LocalInfileRequest::filename. The wire reads stay so packet parsing consumes the same bytes; only the dead stores and their zero-initializers are gone.

C++ bindings

  • NodeValidator.cpp: host functions jsFunction_validateString / jsFunction_validateFunction / jsFunction_validateBoolean and their declarations. Their $newCppFunction bindings were removed in an earlier sweep (Remove dead code from FFI sys crates, bun_core, built-in JS, codegen, and build scripts #36937 removed the sibling trio); the V::validate* overloads they forwarded to are live and stay.
  • ImportMetaObject.cpp: jsFunctionRequireResolve and its only callee functionRequireResolve (static, 76 lines; the live require.resolve is built elsewhere)
  • BunString.cpp: BunString__toWTFString (no Rust-side caller; the regenerated cpp.rs drops the import)
  • sliceAnsi.cpp: never-instantiated struct HyperlinkInfo (wrapAnsi.cpp's HyperlinkState is the live one)
  • NodeFSStatFSBinding.cpp: getStatFSPrototype<bool>, a template with zero instantiations
  • Declarations with no definition: functionBunPeek / functionBunPeekStatus (BunObject.h), callBakeResponse / constructBakeResponse (JSBakeResponse.cpp), jsSqlStatementGetHasMultipleStatements (JSSQLStatement.cpp), bn_set_words (dh-primes.h)
  • Commented-out blocks from 2023-2024: the ErrorCaptureStackTrace experiment in BunProcess.cpp, the deleteProperty block in JSAbortSignal.cpp, the setOnEachMicrotaskTick block in BakeGlobalObject.cpp

Built-in JS internals

Export-default entries no requirer ever destructures (verified against every require() site, C++ getDirect lookups, and test/ imports of internal modules); backing functions that are still used in-file stay:

  • internal/repl/node-shims.js: isWritable, runScriptInThisContext, kEmptyObject, addAbortListener, promisify (none of repl.js / internal/repl/* touch them)
  • internal/streams/iter/from.ts: normalizeAsyncSource, normalizeSyncSource, normalizeSyncValue, primitiveToUint8Array
  • internal/sql/sqlite.ts: SQLCommand, commandToString, parseSQLQuery, SQLiteQueryHandle (sole requirer pulls only SQLiteAdapter)
  • internal/sql/shared.ts: parseDefinitelySqliteUrl, buildDefinedColumnsAndQuery, normalizeSSLMode
  • internal/http1_server_fallback.ts: createHttp1FallbackResponseHandle, kHttp1ActiveRequests
  • one-line entries: setTid (trace_events), FixedCircularBuffer (fixed_queue), EXECUTION_CONTEXT_ID (inspector/cdp), defineCustomPromisify (promisify), SQLQueryStatus (sql/query), allUint8Array (streams/iter/utils)

Build config and orphaned files

  • scripts/build/flags.ts: defines IS_BUILD, WITH_BORINGSSL=1, STATICALLY_LINKED_WITH_BMALLOC=1, BUN_SINGLE_THREADED_PER_VM_ENTRY_SCOPE=1 have zero readers in src/, packages/, or the pinned WebKit checkout (WebKit reads the lowercase STATICALLY_LINKED_WITH_bmalloc, which is not what we were defining)
  • src/runtime/ffi/libtcc1.a.macos-aarch64: prebuilt 30KB archive from 2022 with zero references (libtcc1.c is embedded via include_bytes! and compiled at runtime)

Verification

  • cargo check --workspace and bun run rust:check-all (10 ok, 0 failed) so platform-gated uses would have surfaced
  • full bun bd debug build, which regenerates codegen and relinks the C++ side
  • smoke tests: test/js/bun/repl/repl.test.ts (148 pass), test/cli/install/migration/migrate.test.ts (20 pass), test/js/sql/wire-frames.test.ts, test/js/sql/sql-mysql-clean-reentry.test.ts against MariaDB, test/js/sql/adapter-override.test.ts, fixed-queue node tests, plus module-load smokes for repl/stream/trace_events/http2/util
  • test/internal/source-lints/ suite passes, including the new dead-symbols-install-sql-bindings.test.ts that pins these removals
  • checked against all open robobun PRs at deletion granularity: a planned removal of the install lifecycle-script time log was dropped from this PR because install: restore the slow-lifecycle-script warning from #7719 #36587 restores that feature, and the mysql CharacterSet collation table plus the Bun__CryptoHasherExtern__* helpers were left alone after verification showed they are referenced (label() at MySQLConnection.rs:661, C++ wrappers in CryptoUtil.cpp)

Verified-dead but deliberately not removed (for a future pass, pending maintainer judgment)

  • windows-shim read_without_launch / FromBunShellContext (~120 lines): zero callers, but the crate docs describe it as the staged in-process path for the shell
  • src/runtime/bake/incremental_visualizer.html + memory_visualizer.html (~808 lines): the /_bun/incremental_visualizer route that served them was never ported from the Zig dev server, while the websocket topic plumbing they rely on is live and tested
  • src/jsc/bindings/webcrypto/*.idl (29 files, ~1055 lines): nothing in the build reads .idl, but they are maintained alongside the handwritten bindings as spec reference (SubtleCrypto.idl was edited in July)

[review] gate passed · iteration 2 · 43 files touched

fails on main (without fix)
ASAN without fix: 1 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-install-sql-bindings.test.ts
bun test v1.4.0 (fc376a388)

test/internal/source-lints/dead-symbols-install-sql-bindings.test.ts:
79 |   expect(reprEnd).toBeGreaterThan(reprStart);
80 |   const reprBody = hosted.slice(reprStart, reprEnd);
81 |   if (/^\s*Ssh,$/m.test(reprBody)) {
82 |     resurrected.push("src/install/hosted_git_info.rs: Representation::Ssh");
83 |   }
84 |   expect(resurrected).toEqual([]);
                           ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/install/error.rs: ^\s*FileTooBig,$",
+   "src/install/error.rs: ^\s*ProcessFdQuotaExceeded,$",
+   "src/install/error.rs: ^\s*ReadOnlyFileSystem,$",
+   "src/install/error.rs: ^\s*FileSystem,$",
+   "src/install/error.rs: ^\s*FileBusy,$",
+   "src/install/resolution.rs: \bInvalidSemver\b",
+   "src/install/pnpm.rs: PnpmLockfileInvalidOverride|PnpmLockfileInvalidPatchedDependency",
+   "src/install/windows-shim/bun_shim_impl.rs: \bInvalidShimDataSize\b",
+   "src/event_loop/EventLoopTimer.rs: \bTimerCallbac
... (truncated)

release without fix: 1 FAILED
bun test v1.4.0-canary.1 (5fd12c2c2)

test/internal/source-lints/dead-symbols-install-sql-bindings.test.ts:
79 |   expect(reprEnd).toBeGreaterThan(reprStart);
80 |   const reprBody = hosted.slice(reprStart, reprEnd);
81 |   if (/^\s*Ssh,$/m.test(reprBody)) {
82 |     resurrected.push("src/install/hosted_git_info.rs: Representation::Ssh");
83 |   }
84 |   expect(resurrected).toEqual([]);
                           ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/install/error.rs: ^\s*FileTooBig,$",
+   "src/install/error.rs: ^\s*ProcessFdQuotaExceeded,$",
+   "src/install/error.rs: ^\s*ReadOnlyFileSystem,$",
+   "src/install/error.rs: ^\s*FileSystem,$",
+   "src/install/error.rs: ^\s*FileBusy,$",
+   "src/install/resolution.rs: \bInvalidSemver\b",
+   "src/install/pnpm.rs: PnpmLockfileInvalidOverride|PnpmLockfileInvalidPatchedDependency",
+   "src/install/windows-shim/bun_shim_impl.rs: \bInvalidShimDataSize\b",
+   "src/event_loop/EventLoopTimer.rs: \bTimerCallback\b",
+   "src/runtime/dispatch.rs: \bTimerCallback\b",
+   "src/dns/lib.rs: ^\s*Unix,$",
+   "src/sql/mysql/protocol/OKPacket.rs: session_state_changes|pub info:|pub warnings:",
+   "src/sql/m
... (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-install-sql-bindings.test.ts
bun test v1.4.0 (fc376a388)

test/internal/source-lints/dead-symbols-install-sql-bindings.test.ts:
(pass) dead Rust symbols (install, event_loop, dns, mysql protocol) do not reappear [30.77ms]
(pass) dead C++ bindings do not reappear [66.65ms]
(pass) the WebKit weak error finalizer stays defined [5.74ms]
(pass) dead built-in JS exports and build defines do not reappear [32.43ms]

 4 pass
 0 fail
 6 expect() calls
Ran 4 tests across 1 file. [2.15s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 666ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/144] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited
[2/144] gen cpp.rs (cppbind)
[3/144] gen BunProcess.lut.h
Generating /workspace/bun/build/release/codegen/BunProcess.lut.h from /workspace/bun/src/jsc/bindings/BunProcess.cpp
[4/144] gen JS modules (bundle-modules)
Preprocess modules (8773ms)
Bundle modules (47ms)
Postprocesss modules (48ms)
Bundle Functions (653ms)
Generate Code (28ms)

[9.56s] Bundled "src/js" for production
  2571 kb
  193 internal modules
  13 native modules
  84 internal functions across 17 files
[4/143] 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   Compi
... (truncated)
diff hotspot
scripts/build/flags.ts                             |   4 -
 src/dns/lib.rs                                     |   2 -
 src/event_loop/EventLoopTimer.rs                   |   9 --
 src/install/error.rs                               |  15 ---
 src/install/hosted_git_info.rs                     |   2 -
 src/install/lockfile/bun.lock.rs                   |   8 --
 src/install/migration.rs                           |   2 -
 src/install/pnpm.rs                                |   4 -
 src/install/resolution.rs                          |   2 -
 src/install/windows-shim/bun_shim_impl.rs          |   2 -
 src/js/internal/fixed_queue.ts                     |   1 -
 src/js/internal/http1_server_fallback.ts           |   2 -
 src/js/internal/inspector/cdp.ts                   |   1 -
 src/js/internal/promisify.ts                       |   1 -
 src/js/internal/repl/node-shims.js                 |  23 ----
 src/js/internal/sql/query.ts                       |   1 -
 src/js/internal/sql/shared.ts                      |   3 -
 src/js/internal/sql/sqlite.ts                      |   4 -
 src/js/internal/streams/iter/from.ts               |   4 -
 src/js/internal/streams/iter/utils.ts              |   1 -
 src/js/internal/trace_events.ts                    |   1 -
 src/jsc/bindings/BunObject.h                       |   2 -
 src/jsc/bindings/BunProcess.cpp                    |  18 ---
 src/jsc/bindings/BunString.cpp                     |  21 ---
 src/jsc/bindings/ErrorStackTrace.cpp               |   1 +
 src/jsc/bindings/ImportMetaObject.cpp              |  89 -------------
 src/jsc/bindings/JSBakeResponse.cpp                |   3 -
 src/jsc/bindings/NodeFSStatFSBinding.cpp           |  10 --
 src/jsc/bindings/NodeValidator.cpp                 |  38 ------
 src/jsc/bindings/NodeValidator.h                   |   3 -
 src/jsc/bindings/dh-primes.h                       |   2 -
 src/jsc/bindings/headers-handwritten.h             |   1 -
 src/jsc/bindings/sliceAnsi.cpp     
... (truncated)

gate history · 4 passed · 1 rejected · iteration 2

evidence per changed file
file                                       reads  edits  tests
scripts/build/flags.ts                         1      1      0
src/dns/lib.rs                                 1      2      0
src/event_loop/EventLoopTimer.rs               1      4      0
src/install/error.rs                           2      3      0
src/install/hosted_git_info.rs                 1      1      0
src/install/lockfile/bun.lock.rs               1      1      0
src/install/migration.rs                       1      1      0
src/install/pnpm.rs                            1      1      0
src/install/resolution.rs                      1      1      0
src/install/windows-shim/bun_shim_impl.rs      1      2      0
src/js/internal/fixed_queue.ts                 1      1      0
src/js/internal/http1_server_fallback.ts       1      2      0
src/js/internal/inspector/cdp.ts               1      1      0
src/js/internal/promisify.ts                   1      1      0
src/js/internal/repl/node-shims.js             3      6      0
src/js/internal/sql/query.ts                   1      1      0
(+ 27 more files)

@github-actions github-actions Bot added the claude label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR removes unused symbols and export members across Rust, JavaScript, C++, build flags, and MySQL protocol code. It also updates related parsing and dispatch code, and adds source-lint tests that fail if the removed symbols return.

Changes

Dead symbol removal and regression coverage

Layer / File(s) Summary
Rust contract cleanup in install, DNS, and MySQL
src/dns/lib.rs, src/install/..., src/sql/mysql/protocol/*, src/sql_jsc/mysql/MySQLConnection.rs
Rust public enums, error variants, and MySQL packet fields remove unused members. The related conversion, migration, parser, decoder, and packet-construction code now stops matching or storing those removed values.
Timer owner and dispatch cleanup
src/event_loop/EventLoopTimer.rs, src/runtime/dispatch.rs
EventLoopTimer removes TimerCallback tag support and adds the exported impl_timer_owner! macro for owner recovery from embedded timer fields. Runtime timer dispatch removes the TimerCallback arm.
JS internal exports and build flag pruning
scripts/build/flags.ts, src/js/internal/...
The always-on define list removes four legacy defines. Several internal default-export objects now expose fewer members in REPL, SQL, streams, inspector, HTTP fallback, trace events, and utility modules.
C++ bindings and runtime dead code removal
src/jsc/bindings/..., src/runtime/bake/BakeGlobalObject.cpp
Bindings remove unused declarations, wrappers, helpers, and the internal require.resolve path. Runtime files remove stale commented code, and ErrorStackTrace.cpp adds a comment about the finalizer reference.
Dead symbol source-lint coverage
test/internal/source-lints/dead-symbols-install-sql-bindings.test.ts
A new source-lint test reads working-tree and committed files, then checks for removed Rust symbols, C++ binding symbols, JavaScript exports, and build defines. The test fails if any guarded symbol reappears.

Possibly related PRs

  • oven-sh/bun#36576: It also removes dead or unused APIs and symbols across Rust and C++ bindings, with similar cleanup patterns.
  • oven-sh/bun#36937: It also removes dead symbols and adds source-lint coverage, with overlapping cleanup in scripts/build/flags.ts.
  • oven-sh/bun#35437: It also removes dead public symbols and adds regression checks to prevent their return.

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 pull request's primary dead-code removal across the listed subsystems.
Description check ✅ Passed The description explains the changes and includes detailed verification results, satisfying both template requirements.

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

Comment thread src/jsc/bindings/ErrorStackTrace.cpp Outdated

@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: 1

🤖 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-install-sql-bindings.test.ts`:
- Around line 87-115: Extend the dead-symbol test around the checks array to
positively verify that ErrorStackTrace.cpp still defines
Bun__errorInstance__finalize, rather than only asserting deleted symbols are
absent. Add a source-presence assertion using the existing headFile/checking
pattern, or an equivalent Darwin link check, while preserving the current
resurrected-symbol behavior.
🪄 Autofix

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: 7b0571ee-1945-4683-88a6-8d7357936a4d

📥 Commits

Reviewing files that changed from the base of the PR and between b58cd46 and 0fe6269.

📒 Files selected for processing (43)
  • scripts/build/flags.ts
  • src/dns/lib.rs
  • src/event_loop/EventLoopTimer.rs
  • src/install/error.rs
  • src/install/hosted_git_info.rs
  • src/install/lockfile/bun.lock.rs
  • src/install/migration.rs
  • src/install/pnpm.rs
  • src/install/resolution.rs
  • src/install/windows-shim/bun_shim_impl.rs
  • src/js/internal/fixed_queue.ts
  • src/js/internal/http1_server_fallback.ts
  • src/js/internal/inspector/cdp.ts
  • src/js/internal/promisify.ts
  • src/js/internal/repl/node-shims.js
  • src/js/internal/sql/query.ts
  • src/js/internal/sql/shared.ts
  • src/js/internal/sql/sqlite.ts
  • src/js/internal/streams/iter/from.ts
  • src/js/internal/streams/iter/utils.ts
  • src/js/internal/trace_events.ts
  • src/jsc/bindings/BunObject.h
  • src/jsc/bindings/BunProcess.cpp
  • src/jsc/bindings/BunString.cpp
  • src/jsc/bindings/ErrorStackTrace.cpp
  • src/jsc/bindings/ImportMetaObject.cpp
  • src/jsc/bindings/JSBakeResponse.cpp
  • src/jsc/bindings/NodeFSStatFSBinding.cpp
  • src/jsc/bindings/NodeValidator.cpp
  • src/jsc/bindings/NodeValidator.h
  • src/jsc/bindings/dh-primes.h
  • src/jsc/bindings/headers-handwritten.h
  • src/jsc/bindings/sliceAnsi.cpp
  • src/jsc/bindings/sqlite/JSSQLStatement.cpp
  • src/jsc/bindings/webcore/JSAbortSignal.cpp
  • src/runtime/bake/BakeGlobalObject.cpp
  • src/runtime/dispatch.rs
  • src/sql/mysql/protocol/EOFPacket.rs
  • src/sql/mysql/protocol/LocalInfileRequest.rs
  • src/sql/mysql/protocol/OKPacket.rs
  • src/sql/mysql/protocol/StmtPrepareOKPacket.rs
  • src/sql_jsc/mysql/MySQLConnection.rs
  • test/internal/source-lints/dead-symbols-install-sql-bindings.test.ts
💤 Files with no reviewable changes (36)
  • src/js/internal/http1_server_fallback.ts
  • scripts/build/flags.ts
  • src/js/internal/streams/iter/utils.ts
  • src/js/internal/sql/query.ts
  • src/jsc/bindings/sqlite/JSSQLStatement.cpp
  • src/runtime/bake/BakeGlobalObject.cpp
  • src/jsc/bindings/headers-handwritten.h
  • src/jsc/bindings/JSBakeResponse.cpp
  • src/install/windows-shim/bun_shim_impl.rs
  • src/dns/lib.rs
  • src/jsc/bindings/NodeFSStatFSBinding.cpp
  • src/js/internal/inspector/cdp.ts
  • src/sql_jsc/mysql/MySQLConnection.rs
  • src/jsc/bindings/ImportMetaObject.cpp
  • src/jsc/bindings/webcore/JSAbortSignal.cpp
  • src/jsc/bindings/NodeValidator.h
  • src/install/resolution.rs
  • src/js/internal/streams/iter/from.ts
  • src/install/lockfile/bun.lock.rs
  • src/install/hosted_git_info.rs
  • src/jsc/bindings/dh-primes.h
  • src/js/internal/sql/shared.ts
  • src/install/error.rs
  • src/jsc/bindings/BunProcess.cpp
  • src/install/pnpm.rs
  • src/js/internal/promisify.ts
  • src/js/internal/trace_events.ts
  • src/js/internal/repl/node-shims.js
  • src/js/internal/sql/sqlite.ts
  • src/event_loop/EventLoopTimer.rs
  • src/jsc/bindings/BunObject.h
  • src/jsc/bindings/sliceAnsi.cpp
  • src/install/migration.rs
  • src/jsc/bindings/NodeValidator.cpp
  • src/jsc/bindings/BunString.cpp
  • src/js/internal/fixed_queue.ts

@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 the fix in d5567c6 — the Representation::Ssh slice is now anchored correctly and guarded against going vacuous. I didn't find further issues, but this is a 43-file dead-code sweep across install, the event loop, DNS, MySQL wire structs, C++ JSC bindings, built-in JS exports, and build defines, and the PR itself demonstrates the risk profile (the weak-referenced Bun__errorInstance__finalize was caught only by the darwin LTO link). A maintainer should sign off on the breadth here.

What was reviewed:

  • Confirmed the reworked reprStart/reprEnd slice with expect guards can fail when Ssh, is reintroduced.
  • Spot-checked BunString__toWTFString, WITH_BORINGSSL, and BUN_SINGLE_THREADED_PER_VM_ENTRY_SCOPE — no remaining references outside the new lint test.
  • Verified MySQL packet decoders still consume the same wire bytes (reads kept, only stores removed); LocalInfileRequest now uses #[derive(Default)] which zero-inits packet_size as before.
Extended reasoning...

Overview

This PR removes verified-unreferenced symbols across ~43 files: Rust enum variants and struct fields in bun_install, bun_event_loop, bun_dns, and the MySQL wire protocol; C++ host functions, forward declarations, and stale commented blocks in src/jsc/bindings/; unused export default entries in src/js/internal/; and four compile defines in scripts/build/flags.ts. It adds a source-lint test pinning each removal and a positive presence check for the WebKit weak-referenced finalizer.

Security risks

None identified. This is deletion-only apart from a one-line comment and the new lint test. No auth, crypto, permission, or input-validation surface is touched (the dh-primes.h change removes only an unused forward declaration).

Level of scrutiny

High. Individually each deletion is mechanical, but the aggregate spans build configuration, extern "C" link surface, and hot-path timer dispatch. The PR's own history shows why: Bun__errorInstance__finalize was initially removed and only restored after a platform-specific LTO link failure — exactly the class of reference (weak, cross-repo, platform-gated) that grep-based verification misses. The four removed build defines were checked against the pinned WebKit checkout per the description, but I could not independently verify that here (vendor/WebKit is not present in this checkout).

Other factors

  • All three prior review threads (comment-cop, my vacuous-slice finding, CodeRabbit's presence-check request) are resolved with corresponding commits.
  • The PR description explicitly lists three additional dead-but-not-removed items "pending maintainer judgment", which itself signals the author expects a human pass.
  • Verification per the description includes rust:check-all across 10 targets, a full bun bd build, and targeted smoke tests — reasonable coverage, but the breadth (43 files, ~430 lines removed) and the extern-C / build-define changes put this outside what I'll approve without a maintainer look.

@robobun

robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI state: the diff itself is green across lanes. The remaining red on debian 13 x64-asan is unrelated to this change: test/js/node/async_hooks/AsyncLocalStorage-tracking.test.ts is a pre-existing BoringSSL RSA keygen leak that also fails on main (reported separately), and test/js/node/test/parallel/test-worker-message-port-transfer-terminate.js hit a JSC exception-scope assert during worker terminate that does not reproduce locally under an ASAN debug build in 60 runs, touches no code in this diff, and does not appear in recent builds. The other failures passed on retry. Ready for review.

@Jarred-Sumner
Jarred-Sumner merged commit 9530797 into main Aug 6, 2026
54 of 55 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/ffea5668/dead-code-install-sql-bindings branch August 6, 2026 11:07
robobun added a commit that referenced this pull request Aug 6, 2026
…nd TS input types

- node-shims.js: remove kEmptyObject/isWritable/addAbortListener
  (zero requirers; main deleted them in #36970 and the source lint
  pins the removal)
- repl.test.ts: Bun-owned completion test for require("node:") and
  import("node:") (node:test offered, node:undici/node:bun:ffi not),
  and module-typescript/commonjs-typescript rows in the --input-type
  eval matrix
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