Skip to content

Remove dead code from FFI sys crates, bun_core, built-in JS, codegen, and build scripts - #36937

Merged
Jarred-Sumner merged 13 commits into
mainfrom
claude/farm/81d3ff4b/dead-code-pub-exports-sweep
Aug 5, 2026
Merged

Remove dead code from FFI sys crates, bun_core, built-in JS, codegen, and build scripts#36937
Jarred-Sumner merged 13 commits into
mainfrom
claude/farm/81d3ff4b/dead-code-pub-exports-sweep

Conversation

@robobun

@robobun robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Removes 2,255 lines (net -2,057) of verified-dead code across 116 files: unused pub items the dead_code lint cannot see (it treats every pub item as an external API root), unreferenced FFI declarations, orphaned files, stale commented-out C++ blocks, and dead build-script helpers.

Method: started from scripts/find-dead-exports.ts, narrowed 8,259 candidates to 1,039 whose name appears in exactly one file across src/, scripts/, test/, and regenerated build/debug/codegen/ output, then demoted each to private and let the workspace's dead_code = deny prove which were genuinely unreferenced. Items the compiler proved live (macro expansions, return-position escapes, cfg(windows)/cfg(darwin) usage, codegen references) were restored; the rest were deleted. Areas with open dead-code PRs (#36237, #35775, #36115, #35437, #35880) were excluded, and the one overlapping deletion found during final diffing (kGetNativeReadableProto, already in #35775) was dropped from this PR.

Removed

FFI declaration crates (unused imports of vendored C functions; declarations only, no link-time effect):

  • src/mimalloc_sys/mimalloc.rs: ~100 declarations (heap-local variants mi_heap_*, stats/options surface mi_stats_* mi_option_*, posix shims mi_posix_memalign/mi_valloc/mi_pvalloc, C++ mi_new_* family)
  • src/windows_sys/externs.rs: never-constructed WinsockError + ~100 WSA* error consts, GetBinaryTypeW, CreateJobObjectW, M128A kept (used by CONTEXT on windows)
  • src/zlib_sys/win32.rs: 44 declarations (gz* file API, deflateTune, inflateUndermine, zlibCompileFlags, ...)
  • src/cares_sys/c_ares.rs: 21 (option/server-config surface ares_set_servers*, ares_mkquery, ares_parse_txt_reply_ext, ...)
  • src/lsquic_sys/lib.rs: 11 (handshake/conn status consts, stream-ctx helpers)
  • src/brotli_sys, src/boringssl_sys, src/libdeflate_sys: 17 combined (BrotliEncoder* estimators, TLS_with_buffers_method, libdeflate_*_decompress, ...)

Rust runtime/support crates:

  • src/bun_core/env.rs: BuildTarget::Wasi variant + IS_WASI (never constructed; IS_BROWSER simplifies to IS_WASM)
  • src/jsc/HTTPServerAgent.rs: 5 unused Rust-side imports of Bun__HTTPServerAgent__notify* + 2 type aliases
  • src/runtime/test_runner/mod.rs: JSGlobalObjectTestExt::throw2 (duplicated throw_error)
  • src/runtime/server/NodeHTTPResponse.rs: unused pause_socket sibling cleanup; pause_socket_reads kept (referenced by generated bindings)
  • ~230 surviving demotions of file-local pub items to private across 60 crates, which moves them permanently under dead_code analysis
  • assorted single items: dead re-export lines in sql_jsc/sourcemap_jsc/bundler_jsc/runtime/api.rs, EventLoopGuard-adjacent aliases, unused imports

Built-in JS / codegen / build scripts:

  • src/node-fallbacks/timers.promises.js (238 lines): never registered in src/resolver/node_fallbacks.rs's 23-module registry, so it was built and compressed on every build but could never be served
  • src/js/internal/crypto/x509.ts + its row in ProcessBindingNatives.cpp: process.binding("crypto/x509") is implemented natively in BunProcess.cpp
  • src/js/internal/validators.ts: validateUndefined, validateSignalName/validatePlainFunction export entries
  • src/js/internal/{shared,tls,streams/utils}.ts: dead export-object entries (definitions stay where used in-file); primordials.js: 5 dead scalar-constructor keys (typed-array keys kept: util.inspect reaches them via computed primordials[tag] access)
  • src/codegen: camelCase, pascalCase, warnOnIdentifiersNotPresentAtRuntime, DOMJITReturnType, ownRow, cppPointer
  • scripts/build: explainFlags (no --explain-flags exists), assertDefined, depSourceStamp; root package.json bump script (its target was deleted in Everything is cmake #13427)

Orphaned files: src/fixtures_example.com.html, src/zlib.test.txt + src/zlib.test.gz (2021 inline-test fixtures), src/fallback.html (only fallback-backend.html is embedded), src/logo.svg, src/favicon.png

Stale commented-out C++ blocks (~243 lines, all >6 months old via git blame): minicoro scaffolding in coroutine.cpp (2022), pasted Node JS source in JSX509CertificatePrototype.cpp, commented BINDING_INTEGRITY vtable checks, InspectorInstrumentation calls in WebSocket.cpp, suspended-event-loop paths in JSDOMPromiseDeferred.cpp, commented-out function bodies in Performance.cpp/Event.cpp/DOMWrapperWorld.cpp/ErrorEvent.cpp and 8 more webcore files

Verification

cargo check --workspace            # green (dead_code/unreachable_pub/unused_* all deny)
bun run rust:check-all             # 10/10 targets (linux/macos/windows/freebsd/android x arches)
bun bd                             # full debug build with freshly regenerated codegen
bun test test/internal/source-lints/   # 65 pass (includes the new pin test below)
bun bd test test/js/node/fs/fs.test.ts            # 445 pass
bun bd test test/js/node/http/node-http.test.ts   # 144 pass, 1 env-dependent proxy failure also fails on released bun
bun bd test test/js/bun/glob/match.test.ts        # 29 pass
bun bd test test/js/bun/resolve/resolve.test.ts   # 50 pass

test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts pins representative removed symbols and the deleted files against reintroduction.

The compiler-driven loop caught and restored every false positive the textual scan missed: methods on types that escape only via return position (StdinReader::take_byte, HeaderSet::pairs, bitset iterators), macro-referenced items (comptime_string_map! statics, $crate:: paths), platform-gated items (EmptyCopyFileState on darwin/freebsd, M128A/WriteKind on windows), and generated-binding references (get_insecure_http_parser, pause_socket_reads) which only appear after codegen reruns.

Followups (not removed)

  • patches/ncrypto.patch (919 lines) is referenced by nothing in scripts/build/deps/*.ts while every other patch file is; src/jsc/bindings/ncrypto.{h,cpp} already exist in patched form. Possibly kept as upstream-sync documentation, so left alone.
  • The #if ENABLE(BINDING_INTEGRITY) extern vtable scaffolding in JSCustomEvent.cpp/JSPerformanceServerTiming.cpp lost its only (commented) consumer but matches upstream WebKit codegen shape; left in place.
  • .github/workflows/release.yml:2 references .buildkite/scripts/release.sh, which no longer exists (comment only).
  • src/react_compiler and src/ini were deliberately excluded: the former carries explicit not-yet-wired port markers, the latter's candidates proved live on inspection.

[decide:dep] gate passed · iteration 3 · 126 files touched

fails on main (without fix)
ASAN without fix: 2 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-pub-exports-sweep.test.ts
bun test v1.4.0 (a9da3237f)

test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts:
78 |     ["src/libdeflate_sys/libdeflate.rs", /\bfn libdeflate_gzip_decompress\b/],
79 |     ["src/brotli_sys/brotli_c.rs", /\bfn BrotliEncoderEstimatePeakMemoryUsage\b/],
80 |     ["src/boringssl_sys/boringssl.rs", /\bfn TLS_with_buffers_method\b/],
81 |   ];
82 |   const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`);
83 |   expect(resurrected).toEqual([]);
                           ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/windows_sys/externs.rs: \bfn GetBinaryTypeW\b",
+   "src/windows_sys/externs.rs: \bfn CreateJobObjectW\b",
+   "src/windows_sys/externs.rs: \bstruct WinsockError\b",
+   "src/windows_sys/externs.rs: \bWSA_QOS_ESHAPERATEOBJ\b",
+   "src/mimalloc_sys/mimalloc.rs: \bfn mi_stats_print\b",
+   "src/mimalloc_sys/mimalloc.rs: \bfn mi_reserve_huge_os_pages_interleave\b",
+   "src/
... (truncated)

release without fix: 2 FAILED
bun test v1.4.0-canary.1 (57ae5f0a5)

test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts:
78 |     ["src/libdeflate_sys/libdeflate.rs", /\bfn libdeflate_gzip_decompress\b/],
79 |     ["src/brotli_sys/brotli_c.rs", /\bfn BrotliEncoderEstimatePeakMemoryUsage\b/],
80 |     ["src/boringssl_sys/boringssl.rs", /\bfn TLS_with_buffers_method\b/],
81 |   ];
82 |   const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`);
83 |   expect(resurrected).toEqual([]);
                           ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/windows_sys/externs.rs: \bfn GetBinaryTypeW\b",
+   "src/windows_sys/externs.rs: \bfn CreateJobObjectW\b",
+   "src/windows_sys/externs.rs: \bstruct WinsockError\b",
+   "src/windows_sys/externs.rs: \bWSA_QOS_ESHAPERATEOBJ\b",
+   "src/mimalloc_sys/mimalloc.rs: \bfn mi_stats_print\b",
+   "src/mimalloc_sys/mimalloc.rs: \bfn mi_reserve_huge_os_pages_interleave\b",
+   "src/mimalloc_sys/mimalloc.rs: \bfn mi_heap_recalloc_aligned_at\b",
+   "src/mimalloc_sys/mimalloc.rs: \bfn mi_wdupenv_s\b",
+   "src/zlib_sys/win32.rs: \bfn gzprintf\b",
+   "src/zlib_sys/win32.
... (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-pub-exports-sweep.test.ts
bun test v1.4.0 (a9da3237f)

test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts:
(pass) dead FFI declarations (sys crates) do not reappear [37.66ms]
(pass) dead Rust symbols (bun_core, jsc, test_runner) do not reappear [9.84ms]
(pass) orphaned files stay deleted [566.74ms]
(pass) dead JS/codegen helpers do not reappear [56.45ms]
(pass) stale commented-out C++ blocks stay deleted [22.77ms]

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

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 658ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/133] gen ErrorCode+*.h
[2/133] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited
[3/133] gen ZigGeneratedClasses.{cpp,h,rs}
Found 2 classes from /workspace/bun/src/jsc/resolve_message.classes.ts
  - ResolveMessage (13 fields)
  - BuildMessage (10 fields)
Found 1 classes from /workspace/bun/src/runtime/api/Archive.classes.ts
  - Archive (4 fields, 1 class fields)
Found 2 classes from /workspace/bun/src/runtime/api/BunObject.classes.ts
  - ResourceUsage (8 fields)
  - Subprocess (20 fields)
Found 1 classes from /workspace/bun/src/runtime/api/cron.classes.ts
  - CronJob (5 fields)
Found 3 classes from /workspace/bun/src/runtime/api/filesystem_router.classes.ts
  - FileSystemRouter (5 fields)
  - FrameworkFileSystemRouter (2 fields)
  - MatchedRoute (8 fields)
Found 1 classes from /workspace/bun/src/runtime/api/Glob.classes.ts
  - Glob (5 fields)
Found 1 classes from /workspace/bun/src/runtime/api/h2.classes.ts
  - H2FrameP
... (truncated)
diff hotspot
package.json                                       |   1 -
 scripts/build/error.ts                             |  13 -
 scripts/build/flags.ts                             |  39 +-
 scripts/build/source.ts                            |   8 -
 src/ast/lib.rs                                     |   2 +-
 src/ast/nodes.rs                                   |   1 -
 src/base64/lib.rs                                  |   2 +-
 src/boringssl/lib.rs                               |   8 +-
 src/boringssl_sys/boringssl.rs                     |  12 +-
 src/brotli/lib.rs                                  |   4 +-
 src/brotli_sys/brotli_c.rs                         |  47 +-
 src/bun_alloc/lib.rs                               |  10 +-
 src/bun_core/Global.rs                             |   2 +-
 src/bun_core/env.rs                                |   6 +-
 src/bun_core/fmt.rs                                |  14 +-
 src/bundler/HTMLScanner.rs                         |   2 +-
 src/bundler_jsc/PluginRunner.rs                    |   4 -
 src/cares_sys/c_ares.rs                            | 126 +---
 src/codegen/generate-classes.ts                    |  33 --
 src/codegen/generate-js2native.ts                  |   4 -
 src/codegen/helpers.ts                             |  10 -
 src/codegen/replacements.ts                        |  10 -
 src/collections/array_hash_map.rs                  |   4 +-
 src/crash_handler/lib.rs                           |   8 +-
 src/event_loop/MiniEventLoop.rs                    |   4 +-
 src/fallback.html                                  |  28 -
 src/favicon.png                                    | Bin 7804 -> 0 bytes
 src/fixtures_example.com.html                      |  50 --
 src/glob/GlobWalker.rs                             |   4 +-
 src/http/lib.rs                                    |   6 +-
 src/install/lib.rs                                 |   8 +-
 src/install/lockfile.rs                            |   4 +-
 src/install/resolvers/fold
... (truncated)

gate history · 3 passed · 1 rejected · iteration 3

evidence per changed file
file                            reads  edits  tests
package.json                        0      0      0
scripts/build/error.ts              0      0      0
scripts/build/flags.ts              0      0      0
scripts/build/source.ts             0      0      0
src/ast/lib.rs                      0      0      0
src/ast/nodes.rs                    1      1      0
src/base64/lib.rs                   4      4      0
src/boringssl/lib.rs                1      1      0
src/boringssl_sys/boringssl.rs      1      2      0
src/brotli/lib.rs                   0      0      0
src/brotli_sys/brotli_c.rs          1      2      0
src/bun_alloc/lib.rs                1      1      0
src/bun_core/Global.rs              0      0      0
src/bun_core/env.rs                 1      1      0
src/bun_core/fmt.rs                 1      2      0
src/bundler/HTMLScanner.rs          0      0      0
(+ 110 more files)

… and build scripts

332 verified-unreferenced symbols, 8 orphaned files, and 21 stale
commented-out C++ blocks; 116 files, net -2057 lines. Every removal was
validated by cargo check on all 10 CI target triples and a full debug
build with freshly regenerated codegen.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This cleanup removes unused build, code-generation, JavaScript, Rust, FFI, and binding declarations. It narrows internal visibility, deletes stale commented code and obsolete files, and adds source-lint coverage.

Changes

Dead symbol and export cleanup

Layer / File(s) Summary
Build, code-generation, and JavaScript exports
scripts/build/..., src/codegen/..., src/js/internal/...
Unused helpers and internal JavaScript exports are removed or narrowed.
Core Rust visibility reduction
src/ast/..., src/bun_core/..., src/runtime/..., src/parsers/...
Internal structs, traits, aliases, constants, functions, and re-exports become private.
Compression, networking, and platform FFI
src/boringssl_sys/..., src/brotli_sys/..., src/cares_sys/..., src/mimalloc_sys/..., src/zlib_sys/..., src/windows_sys/...
Unused FFI declarations are removed and retained bindings receive narrower visibility.
Runtime API boundaries
src/runtime/api/..., src/runtime/node/..., src/runtime/webcore/..., src/jsc/...
Runtime implementation types, aliases, callbacks, and re-exports are restricted to internal use.
Binding and stale-code cleanup
src/jsc/bindings/...
Commented-out compatibility, instrumentation, coroutine, and serialization code is deleted.
Dead-symbol regression coverage
test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts
A source-tree lint checks that removed symbols, files, and commented blocks do not return.

Possibly related PRs

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 identifies the main change: removing dead code from FFI crates, bun_core, built-in JavaScript, codegen, and build scripts.
Description check ✅ Passed The description explains the scope, method, exclusions, verification steps, and follow-ups, although it does not use the exact template headings.

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

@robobun
robobun force-pushed the claude/farm/81d3ff4b/dead-code-pub-exports-sweep branch from 5c830b9 to bdfa0ec Compare August 5, 2026 06:20
@robobun

robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 1:49 AM PT - Aug 5th, 2026

@robobun, your commit a9da323 has 1 failures in Build #89123 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 36937

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

bun-36937 --bun

Comment thread src/bundler_jsc/PluginRunner.rs Outdated
Comment thread test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts Outdated
Comment thread src/js/internal/validators.ts
robobun added 2 commits August 5, 2026 06:37
…pins

Remove jsFunction_validateSignalName, jsFunction_validatePlainFunction and
jsFunction_validateUndefined from NodeValidator.cpp/.h; their only callers
were the $newCppFunction bindings this PR already removed. Drop the doc
comment orphaned by the MacroJsCtx re-export removal in PluginRunner.rs.
Make the source-lint pins read the committed tree for deleted files and
JS/C++ content so git stash round-trips that temporarily restore deleted
files cannot fail the lint, and fix a pin regex that did not match the
block it guards.
jsFunction_validateSignalName, jsFunction_validatePlainFunction and
jsFunction_validateUndefined lost their only callers when this PR removed
their $newCppFunction bindings from internal/validators.ts. Also drop the
doc comment orphaned by the MacroJsCtx re-export removal in PluginRunner.rs.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/shell_parser/braces.rs (1)

179-185: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Align the visibility of ShellCharIter and CharIter.

braces publicly exports ShellCharIter, but its methods and associated types come only from the private CharIter trait. External crates cannot use this public type. Make ShellCharIter private or make CharIter public.

🤖 Prompt for 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.

In `@src/shell_parser/braces.rs` around lines 179 - 185, Align the visibility of
the publicly exported ShellCharIter with its CharIter implementation: either
make ShellCharIter private or expose CharIter publicly, including its associated
types and methods as required for external use. Apply the change at the
CharIter/ShellCharIter declarations without altering their behavior.
🤖 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 `@src/sys/copy_file.rs`:
- Line 23: Align visibility with referenced types across the affected APIs: in
src/sys/copy_file.rs:23 expose InputType for the public copy functions; in
src/picohttp/lib.rs:195 make Header::curl private; in src/router/lib.rs:139
narrow Routes::list and at :1146 narrow Pattern::len, or make their referenced
types pub(crate); in src/url/lib.rs:38 use public route_param::List for
CombinedScanner::init; in src/zstd/lib.rs:340 make both ZstdReaderArrayList
constructors private; and in src/spawn/process.rs:935 narrow
WaiterThreadPosix::js_process or make ProcessQueue pub(crate).

In `@test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts`:
- Around line 71-87: Replace the direct existsSync-based resurrection check in
the “orphaned files stay deleted” test with surviving source-contract assertions
for deletions that have one, such as registry or embedding references. For paths
without a surviving contract, retain only explanatory deletion documentation and
remove them from the filesystem-absence assertion; do not use existsSync on
deleted paths.

---

Outside diff comments:
In `@src/shell_parser/braces.rs`:
- Around line 179-185: Align the visibility of the publicly exported
ShellCharIter with its CharIter implementation: either make ShellCharIter
private or expose CharIter publicly, including its associated types and methods
as required for external use. Apply the change at the CharIter/ShellCharIter
declarations without altering their 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: 8c64b9e6-bf02-4ecb-843a-8f94087f41ad

📥 Commits

Reviewing files that changed from the base of the PR and between d601782 and bdfa0ec.

⛔ Files ignored due to path filters (3)
  • src/favicon.png is excluded by !**/*.png
  • src/logo.svg is excluded by !**/*.svg
  • src/zlib.test.gz is excluded by !**/*.gz
📒 Files selected for processing (114)
  • package.json
  • scripts/build/error.ts
  • scripts/build/flags.ts
  • scripts/build/source.ts
  • src/ast/lib.rs
  • src/ast/nodes.rs
  • src/base64/lib.rs
  • src/boringssl/lib.rs
  • src/boringssl_sys/boringssl.rs
  • src/brotli/lib.rs
  • src/brotli_sys/brotli_c.rs
  • src/bun_alloc/lib.rs
  • src/bun_core/Global.rs
  • src/bun_core/env.rs
  • src/bun_core/fmt.rs
  • src/bundler/HTMLScanner.rs
  • src/bundler_jsc/PluginRunner.rs
  • src/cares_sys/c_ares.rs
  • src/codegen/generate-classes.ts
  • src/codegen/generate-js2native.ts
  • src/codegen/helpers.ts
  • src/codegen/replacements.ts
  • src/collections/array_hash_map.rs
  • src/crash_handler/lib.rs
  • src/event_loop/MiniEventLoop.rs
  • src/fallback.html
  • src/fixtures_example.com.html
  • src/glob/GlobWalker.rs
  • src/http/lib.rs
  • src/install/lib.rs
  • src/install/lockfile.rs
  • src/install/resolvers/folder_resolver.rs
  • src/install_jsc/hosted_git_info_jsc.rs
  • src/io/lib.rs
  • src/js/builtins/ConsoleObject.ts
  • src/js/internal/crypto/x509.ts
  • src/js/internal/fs/streams.ts
  • src/js/internal/primordials.js
  • src/js/internal/promisify.ts
  • src/js/internal/shared.ts
  • src/js/internal/streams/utils.ts
  • src/js/internal/tls.ts
  • src/js/internal/validators.ts
  • src/jsc/ConsoleObject.rs
  • src/jsc/FFI.rs
  • src/jsc/HTTPServerAgent.rs
  • src/jsc/bindings/BunClientData.h
  • src/jsc/bindings/DOMWrapperWorld.cpp
  • src/jsc/bindings/JSDOMWrapper.cpp
  • src/jsc/bindings/JSX509CertificatePrototype.cpp
  • src/jsc/bindings/ProcessBindingNatives.cpp
  • src/jsc/bindings/coroutine.cpp
  • src/jsc/bindings/webcore/ErrorEvent.cpp
  • src/jsc/bindings/webcore/Event.cpp
  • src/jsc/bindings/webcore/JSCustomEvent.cpp
  • src/jsc/bindings/webcore/JSDOMConvertPromise.h
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp
  • src/jsc/bindings/webcore/JSEventListener.cpp
  • src/jsc/bindings/webcore/JSPerformance.cpp
  • src/jsc/bindings/webcore/JSPerformanceServerTiming.cpp
  • src/jsc/bindings/webcore/Performance.cpp
  • src/jsc/bindings/webcore/PerformanceObserver.cpp
  • src/jsc/bindings/webcore/WebSocket.cpp
  • src/jsc/bindings/webcrypto/SubtleCrypto.cpp
  • src/libarchive/lib.rs
  • src/libdeflate_sys/libdeflate.rs
  • src/lsquic_sys/lib.rs
  • src/md/ansi_renderer.rs
  • src/md/inlines.rs
  • src/mimalloc_sys/mimalloc.rs
  • src/node-fallbacks/timers.promises.js
  • src/parsers/yaml.rs
  • src/patch/lib.rs
  • src/picohttp/lib.rs
  • src/ptr/ref_count.rs
  • src/resolver/package_json.rs
  • src/router/lib.rs
  • src/runtime/api.rs
  • src/runtime/api/BunObject.rs
  • src/runtime/api/bun/SSLContextCache.rs
  • src/runtime/api/bun/h2/hpack.rs
  • src/runtime/api/bun/h2/settings.rs
  • src/runtime/api/cron.rs
  • src/runtime/api/html_rewriter.rs
  • src/runtime/crypto/CryptoHasher.rs
  • src/runtime/crypto/PasswordObject.rs
  • src/runtime/dns_jsc/dns.rs
  • src/runtime/napi/napi_body.rs
  • src/runtime/node/node_crypto_binding.rs
  • src/runtime/node/node_fs.rs
  • src/runtime/server/RequestContext.rs
  • src/runtime/socket/uws_handlers.rs
  • src/runtime/test_runner/mod.rs
  • src/runtime/test_runner/pretty_format.rs
  • src/runtime/valkey_jsc/valkey.rs
  • src/runtime/webcore.rs
  • src/runtime/webcore/Blob.rs
  • src/runtime/webcore/blob/read_file.rs
  • src/runtime/webcore/streams.rs
  • src/s3_signing/credentials.rs
  • src/shell_parser/braces.rs
  • src/shell_parser/parse.rs
  • src/sourcemap_jsc/lib.rs
  • src/spawn/process.rs
  • src/sql_jsc/mysql/MySQLConnection.rs
  • src/sql_jsc/postgres.rs
  • src/sys/copy_file.rs
  • src/url/lib.rs
  • src/windows_sys/externs.rs
  • src/zlib.test.txt
  • src/zlib/lib.rs
  • src/zlib_sys/win32.rs
  • src/zstd/lib.rs
  • test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts
💤 Files with no reviewable changes (46)
  • package.json
  • src/jsc/bindings/DOMWrapperWorld.cpp
  • src/jsc/bindings/JSDOMWrapper.cpp
  • src/jsc/bindings/webcore/ErrorEvent.cpp
  • src/jsc/bindings/webcore/Event.cpp
  • src/sql_jsc/mysql/MySQLConnection.rs
  • src/bundler_jsc/PluginRunner.rs
  • src/fallback.html
  • src/jsc/bindings/BunClientData.h
  • src/fixtures_example.com.html
  • src/js/internal/primordials.js
  • src/jsc/bindings/ProcessBindingNatives.cpp
  • src/ast/nodes.rs
  • src/codegen/helpers.ts
  • src/js/internal/crypto/x509.ts
  • src/codegen/generate-js2native.ts
  • src/codegen/replacements.ts
  • src/js/internal/fs/streams.ts
  • src/jsc/bindings/webcore/JSEventListener.cpp
  • src/js/internal/tls.ts
  • scripts/build/error.ts
  • scripts/build/source.ts
  • src/js/internal/shared.ts
  • src/jsc/bindings/webcore/JSPerformanceServerTiming.cpp
  • src/jsc/bindings/webcore/Performance.cpp
  • src/zlib.test.txt
  • src/jsc/bindings/webcore/JSCustomEvent.cpp
  • src/node-fallbacks/timers.promises.js
  • src/jsc/bindings/webcore/JSDOMConvertPromise.h
  • src/js/builtins/ConsoleObject.ts
  • src/sourcemap_jsc/lib.rs
  • src/jsc/bindings/JSX509CertificatePrototype.cpp
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp
  • src/js/internal/streams/utils.ts
  • src/sql_jsc/postgres.rs
  • src/runtime/valkey_jsc/valkey.rs
  • src/js/internal/promisify.ts
  • src/jsc/bindings/webcore/PerformanceObserver.cpp
  • src/jsc/bindings/coroutine.cpp
  • src/jsc/bindings/webcore/WebSocket.cpp
  • src/jsc/bindings/webcrypto/SubtleCrypto.cpp
  • src/runtime/api.rs
  • src/jsc/bindings/webcore/JSPerformance.cpp
  • src/jsc/HTTPServerAgent.rs
  • src/libdeflate_sys/libdeflate.rs
  • src/codegen/generate-classes.ts

Comment thread src/sys/copy_file.rs
Comment thread test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts
Comment thread src/cares_sys/c_ares.rs Outdated
Comment thread src/mimalloc_sys/mimalloc.rs Outdated
Comment thread src/cares_sys/c_ares.rs 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-pub-exports-sweep.test.ts`:
- Around line 28-43: Update headFile and headTree to capture Git stderr and
throw descriptive errors whenever git show or git ls-tree exits unsuccessfully,
rather than returning empty results. Preserve intentional missing-path handling
only after a successful tree lookup, so repository, HEAD, Git, and I/O failures
propagate to the source-lint tests.
🪄 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: 2965d41d-fc7c-4478-8da7-d196c434e14f

📥 Commits

Reviewing files that changed from the base of the PR and between bdfa0ec and b43ee8f.

📒 Files selected for processing (4)
  • src/bundler_jsc/PluginRunner.rs
  • src/jsc/bindings/NodeValidator.cpp
  • src/jsc/bindings/NodeValidator.h
  • test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts
💤 Files with no reviewable changes (3)
  • src/bundler_jsc/PluginRunner.rs
  • src/jsc/bindings/NodeValidator.cpp
  • src/jsc/bindings/NodeValidator.h

Comment thread test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts
…d comments, align cfg-pair visibility

The deleted mi_theap_* declarations were THeap's only consumers, and the
deleted libdeflate_alloc_decompressor_ex was the only consumer of Options;
opaque_ffi!'s allow(dead_code) methods and the pub visibility kept the lint
quiet on both. Drop comments orphaned by removed declarations in c_ares,
libdeflate and HTTPServerAgent (plus its now-empty extern block), demote the
not(windows) arms of hostent_int and InputType to match their demoted windows
siblings, and make the source-lint git helpers throw on git failure instead
of silently passing.
Comment thread src/jsc/HTTPServerAgent.rs
Comment thread src/sql_jsc/postgres.rs Outdated
Comment thread src/jsc/bindings/NodeValidator.cpp
isSignalName's only callers were inside the removed
jsFunction_validateSignalName. Delete comments orphaned by removed items in
sql_jsc/postgres.rs, brotli_sys (encoder query-fns header) and boringssl_sys
(empty SSL_METHOD section), and reword three comments that still claimed
re-export or public status for items this PR made private (crash_handler
WriteStackTraceLimits, collections StringHashMapInner, lockfile
StringBuilderType).
Comment thread src/crash_handler/lib.rs Outdated
Comment thread src/boringssl/lib.rs
Comment thread src/jsc/bindings/NodeValidator.cpp
…ommented header declarations

Wildcards was only reachable through the already-demoted MatchOpts and
match_hostname. The removed jsFunction_validateSignalName held the only
UNKNOWN_SIGNAL call passing triedUppercase, so drop the parameter and its
branch, and the now-unused BunProcess.h include in NodeValidator.cpp. Delete
commented-out declarations whose commented definitions this PR removed
(DOMWrapperWorld.h, Performance.h, ErrorEvent.h, JSPerformance.cpp).
@robobun

robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI status: the only failing lane on the latest build (89115) is debian 13 x64-asan, failing on test/js/node/async_hooks/AsyncLocalStorage-tracking.test.ts, a pre-existing leak that also fails on main (BoringSSL RSA keygen allocation surfacing through node_crypto_binding.rs; this PR's only change near that area is pub-to-private visibility, and the failure has been reported for a separate fix). Every other failure across the last three runs was retry-passed flake or one-off CI infra (a tart VM ssh failure on the darwin 14 lane), none touching code this PR changes.

All review findings from the bot passes are addressed and resolved: orphaned C++ host functions, cascading helpers (isSignalName, THeap, libdeflate Options, UNKNOWN_SIGNAL's triedUppercase parameter), stale comments, cfg-pair visibility alignment, and hardened source-lint pins that read the committed tree.

Verification on the final head: cargo check green on all 10 CI target triples, full debug build with regenerated codegen, source-lint suite (65 tests), and smoke suites for fs, http, glob, resolve, spawn and signals. Ready for review.

Comment thread src/bun_core/fmt.rs
Comment thread src/install/lib.rs Outdated
Comment thread src/install/lib.rs
Comment thread src/jsc/bindings/webcrypto/SubtleCrypto.cpp

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

No new issues found on this pass — all earlier cascading-dead-code and stale-comment findings are addressed, and CI is green apart from the pre-existing ASAN leak on main. Deferring to a human because of scope: 124 files with ~230 pub→private demotions across 60 crates, a C++ signature change (UNKNOWN_SIGNAL drops triedUppercase), removals from internal JS module exports (validators, primordials, streams/utils, tls, shared), and deletion of src/ root assets (logo.svg, favicon.png, fallback.html) — worth a maintainer sign-off that none of those are load-bearing for external tooling or intended crate API surface.

What was reviewed:

  • Confirmed the removed primordials scalar-constructor keys have zero consumers (the repl.js Number destructure is from internal/repl/node-primordials, a different module).
  • Confirmed the removed validators/tls/shared/streams/utils export-object entries have no importers in src/js/; in-file uses of the definitions remain.
  • Verified the UNKNOWN_SIGNAL signature change: the sole remaining C++ caller (BunProcess.cpp) uses the three-arg form, so no observable message change.
  • Re-checked the earlier cascade sites (isSignalName, THeap, libdeflate::Options, header/decl pairs, orphaned comments) against the final diff — all cleaned up.
Extended reasoning...

Overview

This PR removes ~2,255 lines (net −2,057) of verified-dead code across 124 files: unused FFI extern declarations in the *_sys crates (mimalloc, cares, lsquic, zlib, brotli, boringssl, libdeflate, windows_sys), ~230 pub→private visibility demotions across ~60 Rust crates, dead exports from built-in JS internal modules and codegen scripts, orphaned fixture/asset files under src/, and ~243 lines of stale commented-out C++ in src/jsc/bindings/. It also removes the jsFunction_validateSignalName/validatePlainFunction/validateUndefined C++ host functions and their transitive orphans (isSignalName, the triedUppercase parameter on Bun::ERR::UNKNOWN_SIGNAL, the BunProcess.h include in NodeValidator.cpp). A new source-lint test pins representative removed symbols and deleted files against reintroduction.

The PR went through six rounds of prior bot review; every finding (cascading dead helpers, orphaned/now-false comments after visibility demotion, cfg-pair asymmetry, paired header declarations, vacuous pin regexes) was addressed in follow-up commits, and the final SubtleCrypto stub was intentionally kept for upstream-WebKit shape parity. This run's bug hunter found nothing new.

Security risks

None identified. This is deletion and visibility narrowing only. The one behavioral surface touched — dropping the " (signals must use all capital letters)" suffix from ERR_UNKNOWN_SIGNAL — was already unreachable (the only true caller was the removed jsFunction_validateSignalName, which was itself never bound after this PR's validators.ts change). No auth, crypto logic, permission, or input-validation paths change semantics; the boringssl/crypto edits are visibility demotions and dead-extern removals, not logic changes.

Level of scrutiny

High, on breadth rather than depth. Each individual edit is mechanically trivial (delete a declaration, drop pub, remove a commented block), and the Rust side is compiler-proven via dead_code = deny on all 10 CI target triples plus a full bun bd with regenerated codegen. But the aggregate touches the module boundary of ~60 crates, the export surface of five internal JS modules, a C++ error-code function signature, and deletes files in the src/ root. Whether e.g. logo.svg/favicon.png/fallback.html are referenced by out-of-tree tooling, or whether some of the demoted pub items were intentionally public API for downstream consumers, is a maintainer judgment call the compiler cannot make.

Other factors

  • CI on the latest build is green except a single AsyncLocalStorage-tracking.test.ts ASAN leak that also fails on main and is unrelated to any file this PR touches.
  • Spot-checked the JS export removals: primordials.{Array,Number,Object,RegExp,String} have zero src/js/ consumers (the repl.js Number destructure is from a different node-primordials module); the streams/utils, tls, shared, and validators removals are export-object entries only, with the definitions kept and still used in-file.
  • The brotli_sys BrotliEncoderParameter enum removal was flagged in the diff as carrying an "update kMaxBrotliParam in src/js/node/zlib.ts if this list changes" comment — but the enum was unused Rust-side (encoder param setting goes through raw c_uint), and the JS-side constant is independent, so the removal is safe.
  • No outstanding unresolved review threads; all comment-cop and prior bot findings are marked resolved with follow-up commits.

Given the guidelines (do not approve large changes touching many subsystems), I'm deferring rather than approving so a maintainer can sign off on the scope.

@Jarred-Sumner
Jarred-Sumner merged commit b58cd46 into main Aug 5, 2026
55 of 56 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/81d3ff4b/dead-code-pub-exports-sweep branch August 5, 2026 09:27
Jarred-Sumner pushed a commit that referenced this pull request Aug 6, 2026
…indings, and JS internals (#36970)

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

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

---

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

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

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

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 (5fd12c2)

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

</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-install-sql-bindings.test.ts
bun test v1.4.0 (fc376a3)

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

</details>

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

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

</details>

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

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

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

</details>

<!-- robobun:evidence:end -->
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