Remove dead code from webcore, jsc, bundler, ast, install, spawn, resolver, libarchive - #35559
Remove dead code from webcore, jsc, bundler, ast, install, spawn, resolver, libarchive#35559robobun wants to merge 1 commit into
Conversation
WalkthroughChangesThe pull request removes obsolete public APIs and FFI bindings across AST, bundler, JSCore, WebCore, runtime, installation, resolver, archive, and process modules. It also removes the inline blob implementation and adds source-lint tests preventing deleted symbols from returning. Dead symbol cleanup
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
Updated 1:58 AM PT - Jul 31st, 2026
✅ @robobun, your commit c5973b0d0b5ad3a152b027b2bdf1326e054e9df6 passed in 🧪 To try this PR locally: bunx bun-pr 35559That installs a local version of the PR into your bun-35559 --bun |
There was a problem hiding this comment.
Beyond the two inline nits, I also checked: the removed PathTemplate/PathTemplateConst Display impls have no {}-formatted callers (all sites use .print(&mut buf, ..) directly); the removed ResultTask::<T>::run_from_main_thread_mini is distinct from the still-used ResultTaskMini::<T>::run_from_main_thread_mini at process.rs:1091/1217; and the FsReturn impls for Null/StatOrNotFound inline their bodies rather than calling the removed to_js methods.
Extended reasoning...
The two inline findings are completeness-of-cleanup nits (newly-dead ref_count field; orphaned C++ extern definitions), not correctness bugs. Given the 29-file / 9-crate scope touching GC-handle code (Strong/Weak/DeprecatedStrong), deferring to a human on whether to require the additional cleanup before merge.
There was a problem hiding this comment.
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-35559.test.ts`:
- Around line 33-36: Update the regex checks for is_done and init in the
dead-symbols test to match their function declarations, including the relevant
enclosing type where needed, rather than their implementation formatting. Apply
the same declaration-focused matching to the additional checks referenced by the
comment, while preserving coverage that detects reintroduced symbols.
🪄 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: dbce7eca-1a78-4e38-8b63-737810700810
📒 Files selected for processing (33)
src/ast/expr.rssrc/ast/lib.rssrc/bundler/options.rssrc/install/PackageManager/ProgressStrings.rssrc/install/PackageManager/security_scanner.rssrc/install/bin.rssrc/install/lockfile/Package/Scripts.rssrc/jsc/DeprecatedStrong.rssrc/jsc/JSPropertyIterator.rssrc/jsc/JSString.rssrc/jsc/Strong.rssrc/jsc/URLSearchParams.rssrc/jsc/Weak.rssrc/jsc/bindings/URLSearchParams.cppsrc/jsc/bindings/bindings.cppsrc/jsc/bindings/headers.hsrc/libarchive/lib.rssrc/resolver/dir_info.rssrc/resolver/fs.rssrc/runtime/error.rssrc/runtime/node/dir_iterator.rssrc/runtime/node/node_fs.rssrc/runtime/node/types.rssrc/runtime/server/RequestContext.rssrc/runtime/webcore/Blob.rssrc/runtime/webcore/Body.rssrc/runtime/webcore/FileReader.rssrc/runtime/webcore/ReadableStream.rssrc/runtime/webcore/Response.rssrc/runtime/webcore/streams.rssrc/spawn/process.rssrc/spawn/static_pipe_writer.rstest/internal/source-lints/dead-symbols-35559.test.ts
💤 Files with no reviewable changes (27)
- src/jsc/JSPropertyIterator.rs
- src/install/lockfile/Package/Scripts.rs
- src/runtime/webcore/ReadableStream.rs
- src/runtime/webcore/FileReader.rs
- src/runtime/node/types.rs
- src/ast/expr.rs
- src/jsc/Weak.rs
- src/jsc/bindings/headers.h
- src/jsc/bindings/URLSearchParams.cpp
- src/jsc/JSString.rs
- src/runtime/webcore/Blob.rs
- src/spawn/process.rs
- src/jsc/bindings/bindings.cpp
- src/libarchive/lib.rs
- src/resolver/fs.rs
- src/spawn/static_pipe_writer.rs
- src/runtime/error.rs
- src/runtime/node/dir_iterator.rs
- src/resolver/dir_info.rs
- src/jsc/Strong.rs
- src/install/bin.rs
- src/ast/lib.rs
- src/runtime/node/node_fs.rs
- src/runtime/server/RequestContext.rs
- src/install/PackageManager/ProgressStrings.rs
- src/runtime/webcore/streams.rs
- src/bundler/options.rs
There was a problem hiding this comment.
LGTM — mechanical dead-code removal, all prior review rounds addressed.
What was reviewed:
- Spot-checked
Expr::is_boolean(all remaining.is_boolean()callers are onJSValue),ResultTask::run_from_main_thread_mini(only the separateResultTaskMinivariant remains wired),blob::Inline/InlineBlob(zero refs post-removal), and thePathTemplate/PathTemplateConstDisplayimpls (every call site uses.print(&mut buf, ..)directly — no{}formatting). - Verified the C++ sides of the removed externs (
JSC__JSString__eql,URLSearchParams__create) and the transitively-deadSafetyData::ref_count/ stale doc comments were cleaned up in af28f9b and fb08cb5 per earlier feedback. - The new source-lint test follows the existing
test/internal/source-lints/convention.
Extended reasoning...
Overview
Net −418 LOC dead-code sweep across 33 files in 9 crates (webcore, jsc, bundler, ast, install, spawn, resolver, libarchive, runtime/node). Every removal is a pub fn/type/const/enum-variant with zero callers, verified via repo-wide rg across src/, build/debug/codegen/, and src/codegen/, plus bun bd and rust:check-all across all 10 targets (which covers cfg-gated code). A source-lint regression test guards against reintroduction.
Three prior review rounds from me raised nits about transitively-dead scaffolding (SafetyData::ref_count), orphaned C++ extern definitions, and stale doc comments; all were addressed in af28f9b and fb08cb5 and the threads are resolved. The one remaining comment-cop notice on Response.rs:331 was correctly rebutted (pre-existing safety-invariant doc; the diff only updates the call-site count).
Security risks
None. No security checks, validation, or auth/crypto paths are removed. The jsc changes (Strong, Weak, DeprecatedStrong) remove unused GC-root wrappers; the live protect/unprotect and Drop paths are untouched. The DeprecatedStrong::unref() removal is safe because no ref() counterpart ever existed and the sole user only uses init + Drop.
Level of scrutiny
Medium-low. Dead-code removal in Rust is compiler-enforced: if any removed symbol were referenced (including via macros, trait dispatch, or cfg-gated code on any of the 10 targets), rust:check-all would fail. The remaining risk — dynamic dispatch by string name, or codegen consumers — was covered by the author's grep of build/debug/codegen/ and src/codegen/, and by my spot checks of the removals most likely to have hidden callers (self-recursive is_boolean, macro-wired run_from_main_thread_mini, Display-via-{} on PathTemplate).
Other factors
- The
blob::Inlinestruct (~82 LOC) was never constructed; everyBody::Value::InlineBlobreference in the tree was already a commented-out match arm, so removing those comments is pure noise reduction. - The
Error::DirIteratorvariant removal is safe:IteratorErrorwas never constructed (the iterator returnsbun_sys::Error), and thename()match arm is removed alongside the variant so the match stays exhaustive. - Smoke tests (
blob.test.ts46/46,body.test.ts, fs stat subset) pass per the PR description. - No overlap with the other open dead-code PRs; the one file shared with #35399 (Blob.rs) touches disjoint line ranges.
There was a problem hiding this comment.
No issues found — all three prior review threads (SafetyData::ref_count, orphaned C++ externs, stale doc comments) were addressed in af28f9b/fb08cb50, and the source-lint regex anchoring from 3ea2c2d looks correct. That said, this touches 33 files across GC-adjacent (DeprecatedStrong/Strong/Weak), webcore body/blob, spawn, and C++ bindings, so worth a human skim before merge.
What was reviewed:
- Confirmed
blob::Inline/InlineBlobhave zero remaining references insrc/; theBody::Valuematch arms it backed were all comment-only. path_template_needs/path_template_printfree fns are still consumed byPathTemplate::{needs,print}— only thePathTemplateConstinherent impl and bothDisplayimpls are gone.Error::DirIteratorvariant removal: remainingDirIteratorhits are module aliases (use ... as DirIterator), not the removedIteratorErrortype.- Verified the C++ sides of
JSC__JSString__eql/URLSearchParams__createwere removed alongside the Rust externs.
Extended reasoning...
Overview
Dead-code sweep across 9 crates, net -418 LOC over 33 files. Removes never-called helper methods, an unconstructed struct (blob::Inline), an unconstructed error enum + its runtime::Error variant, two Rust extern imports plus their now-orphaned C++ extern "C" definitions, three Display impls, and assorted commented-out match arms. A new test/internal/source-lints/dead-symbols-35559.test.ts guards against reintroduction via anchored regexes. Verification per the description: repo-wide rg over src/, build/debug/codegen/, src/codegen/; bun bd clean; rust:check-all on all 10 targets.
Security risks
None identified. Pure deletions of unreferenced code; no auth, crypto, permission, or input-validation logic touched. The one C++ removal (URLSearchParams__create, JSC__JSString__eql) deletes FFI shims with no callers on either side.
Level of scrutiny
Medium-high. Individually each removal is mechanical and compiler-verified (unused Rust items would not break the build, but rust:check-all across all targets rules out cfg-gated callers, and the codegen dir was grepped). However, the breadth — JSC Strong/Weak/DeprecatedStrong (GC lifetime), Body/Blob/Response (hot request path), spawn/process.rs, C++ bindings — puts this outside the "simple config tweak" auto-approve bucket. REVIEW.md's own "before deleting odd-looking code, git-blame why it was written" applies to several of these (e.g. blob::Inline was a planned-but-never-wired optimization).
Other factors
All three prior claude[bot] nits and the CodeRabbit regex-robustness comment are resolved and marked as such in the timeline. The bug-hunting system found nothing this run. I spot-checked that InlineBlob has zero remaining src/ references, that the shared path_template_* free fns keep their live PathTemplate caller, and that the removed IteratorError type is distinct from the surviving DirIterator module aliases. Deferring rather than approving because 33 files across critical subsystems exceeds the "simple and self-contained" threshold, not because of any specific concern.
There was a problem hiding this comment.
LGTM — pure dead-code removal, all prior review feedback (three rounds) addressed.
What was reviewed:
- Spot-checked that
path_template_{needs,print}free fns are still called byPathTemplateafter thePathTemplateConstimpl removal (options.rs:2213/2285). - Verified
Expr::is_booleanwas only self-recursive — every remaining.is_boolean()insrc/is onJSValue. - Confirmed
InlineBlobanddir_iterator::IteratorErrorhave zero remaining references; theDirIteratorgrep hits are the module alias, not the removed error enum. - Source-lint test follows the existing
test/internal/source-lints/pattern; theimpl Writableanchor correctly avoids the liveStreamResult::is_done.
Extended reasoning...
Overview
Net -418 LOC across 33 files in 9 crates: deletes ~40 unreferenced pub functions, types, consts, and enum variants from webcore (Blob/Body/streams/Response/ReadableStream/FileReader), jsc (Strong/Weak/DeprecatedStrong/JSString/URLSearchParams/JSPropertyIterator + C++ bindings), bundler, ast, install, spawn, resolver, libarchive, and runtime/node. Adds a source-lint test guarding against reintroduction. The PR went through three follow-up commits addressing my earlier feedback (transitively-dead SafetyData::ref_count, orphaned C++ extern definitions, stale doc comments) plus a CodeRabbit fix to anchor the lint-test regexes.
Security risks
None. Every change is subtractive removal of code with zero call sites — no new inputs, no changed validation, no altered control flow on any reachable path. The compiler and rust:check-all across 10 targets confirm nothing references the removed symbols.
Level of scrutiny
Medium breadth, low depth. 33 files is wide, but each hunk is a mechanical deletion of an unreferenced item. The strongest correctness proof for this PR class is that it builds: Rust's pub items escape dead-code lints, but a full workspace build + all-targets check would fail on any remaining reference — including cfg-gated and codegen'd code, which the PR description explicitly covers (rg across src/, build/debug/codegen/, src/codegen/). I spot-checked the removals most likely to have hidden consumers (Expr::is_boolean name-collides with JSValue::is_boolean; path_template_* shared bodies; InlineBlob scattered as commented arms; IteratorError vs the DirIterator module alias) and each held up.
Other factors
All four inline threads from prior runs are resolved and the fixes are visible in the diff (C++ JSC__JSString__eql/URLSearchParams__create removed from bindings.cpp/headers.h/URLSearchParams.cpp; ref_count gone from SafetyData; DirInfoRef and Response::init_mut doc comments updated; lint-test regexes anchored to the enclosing impl). The comment-cop bot flags on DeprecatedStrong.rs and Response.rs were both addressed — the former by deleting the stale contract comment, the latter correctly dismissed as a pre-existing safety-invariant doc that this PR only trimmed. The new dead-symbols-35559.test.ts follows the established test/internal/source-lints/ convention (10 sibling files exist). The PR description also documents non-overlap with three other open dead-code PRs and disjoint line ranges with #35399 in Blob.rs.
|
CI status: the diff is green. The three CI runs on this branch hit unrelated infra:
Verified locally: Ready for a maintainer to re-run CI or merge. |
|
@robobun rebase |
…ntime/node Removes unreferenced functions, types, and stale commented-out code verified via repo-wide search, full build, and rust:check-all across all targets. Adds test/internal/source-lints/dead-symbols-35559.test.ts which fails against main and passes here. webcore: - blob::Inline struct and impl (never constructed; the InlineBlob body variant it backed exists only as commented-out match arms) - Stale commented-out InlineBlob match arms in Body.rs and RequestContext.rs - BufferAction::get (consumed only via fulfill/reject/value/swap) - file_reader::TAG const - Response: drop stale [header] from init_mut() doc call-site list jsc: - DeprecatedStrong::unref and SafetyData::ref_count (the only user uses init + Drop; no ref() counterpart exists) - C++ extern definitions for JSC__JSString__eql (bindings.cpp, headers.h) and URLSearchParams__create (URLSearchParams.cpp), orphaned after the Rust extern imports were removed on main bundler: - PathTemplateConst::print and Display impls for both PathTemplate types (every call site uses PathTemplate::print directly) install: - bin.rs: orphan comment left after Context alias removal runtime/node: - dir_iterator::IteratorError enum and its runtime::Error variant (iterator returns bun_sys::Error, never constructs these) - StatOrNotFound::to_js (duplicate of to_js_newly_created) - Null::to_js, VectorArrayBuffer::to_js (FsReturn impls inline the body) resolver: - dir_info.rs: drop as_ptr() paragraph from DirInfoRef doc block - fs.rs: commented-out Zig stubs libarchive: - ReadArchive/WriteArchive/OwnedEntry as_ptr (callers use Deref)
9ba151e to
c5973b0
Compare
|
Rebased onto main (c5973b0). Main had independently absorbed most of the original removals via the |
There was a problem hiding this comment.
LGTM — pure dead-code removal, all prior review rounds addressed, rebased cleanly onto main per maintainer request.
What was reviewed: Verified via repo-wide grep that blob::Inline/InlineBlob, IteratorError/Error::DirIterator, JSC__JSString__eql, URLSearchParams__create, and BufferAction::get have zero remaining references. Confirmed Null and VectorArrayBuffer retain their live FsReturn/release consumers after to_js removal. Checked all 13 files the source-lint test references outside the diff exist on main and none match the guard patterns, so the new test passes as-is. path_template_needs/path_template_print remain live via PathTemplate::{needs,print} after the PathTemplateConst impl removal.
Extended reasoning...
Overview
Net -123 LOC across 20 files after rebase (down from 33 files pre-rebase; main independently absorbed the ast/spawn/jsc-Rust removals). Every hunk is a pure deletion of an unreferenced symbol, a stale comment describing a removed symbol, or a commented-out InlineBlob match arm. One new file: test/internal/source-lints/dead-symbols-35559.test.ts, following the established dead-symbols-*.test.ts convention alongside dead-symbols-react-compiler.test.ts.
Security risks
None. No logic changes, no new code paths, no input handling. The C++ deletions (JSC__JSString__eql, URLSearchParams__create) are extern-C shims whose only Rust callers were removed in earlier commits of this PR — no C++ caller exists.
Level of scrutiny
Low-to-moderate. Dead-code removal is mechanical, and the compiler/linker are the primary correctness oracle (bun bd + rust:check-all 10/10 targets pass per the rebase note). The breadth (20 files, 9 crates) warranted spot-checking that each removal is genuinely unreferenced rather than trusting the description; I re-grepped ~15 of the removed symbols against src/ and confirmed zero hits. The Error::DirIterator variant removal is safe: IteratorError was never constructed, and the only DirIterator grep hits are the unrelated bun_sys::dir_iterator as DirIterator module alias.
Other factors
- Three prior review rounds by me (orphaned C++ shims, dead
SafetyData::ref_count, stale doc comments onDirInfoRef/Response::init_mut) — all addressed and threads resolved. - Maintainer (Jarred-Sumner) requested the rebase, signaling intent to merge.
- The source-lint test references 13 files not in this diff (items main already removed); I confirmed all exist and none match the guard regexes, so the test won't false-fail.
- CI on the rebased commit hasn't reported yet, but the pre-rebase failures were all infra (
step failed outside runner, queue expiry), and the rebase note confirms local build + cross-target check pass.
…n_jsc Rust (#36576) Net **-1185 lines** (+68 / -1253) across 24 files. Every removed item was verified to have zero references across `src/` and `build/debug/codegen/`, then confirmed by a full `bun bd` build and `bun run rust:check-all`. No overlap with the 11 open dead-code PRs (checked file lists of #34965 #34759 #36474 #36178 #36237 #35559 #35775 #36318 #36115 #35437 #35880). ### Whole-file deletions (C++, 1107 lines) | File | LOC | Verification | |---|---|---| | `src/jsc/bindings/node/http/llhttp/api.h` | 357 | Never `#include`d. Vendored upstream copy artifact; all 41 `LLHTTP_EXPORT` decls are duplicated verbatim in `llhttp.h`, and `api.c` includes `llhttp.h` not `api.h`. Only mentioned in `llhttp/README.md`. | | `src/jsc/bindings/webcore/JSDOMConvertWebGL.{h,cpp}` | 317 | Entire body guarded by `#if ENABLE(WEBGL)`. The .cpp `#include`s ~40 headers (`JSANGLEInstancedArrays.h` etc.) that don't exist in the repo, so the guard is provably inactive on every bun target. `IDLWebGLAny`/`IDLWebGLExtension` used nowhere else. | | `src/jsc/bindings/headers-cpp.h` | 190 | Only includer is `headergen/sizegen.cpp`, which isn't in any build rule. File itself has syntax errors (line 166 `#include ""ConsoleObject.h""`, lines 172-182 `#include ""`), so it cannot be compiling anywhere. | | `src/jsc/bindings/webcore/HTTPHeaderValues.{h,cpp}` | 108 | Header only included by its own .cpp; none of the five declared functions (`textPlainContentType`, `formURLEncodedContentType`, `applicationJSONContentType`, `noCache`, `maxAge0`) are called anywhere. | | `src/jsc/bindings/webcore/JSDOMConvertJSON.h` | 51 | Sole includer is the umbrella `JSDOMConvert.h`. `IDLJSON` is referenced nowhere outside `IDLTypes.h` (type decl) and this file. | | `src/jsc/bindings/ares_build.h` | 42 | Zero `#include`s anywhere under `src/`. Superseded by the generated `build/<profile>/deps/cares/ares_build.h` emitted by `scripts/build/deps/cares.ts`. | | `src/jsc/bindings/webcore/TaskSource.h` | 29 | Never `#include`d. Only referenced in commented-out code in `WebSocket.cpp` / `JSDOMPromiseDeferred.cpp`. | | `src/jsc/bindings/JSVMClientDataClient.h` | 13 | See `BunClientData` below. | ### C++ symbol removals - **`helpers.h`** (38 lines): `Zig::toAtomString(ZigString)`, `toStringNotConst`, `__dot_char`/`ZigStringCwd`/`BunStringCwd`, `toZigString(WTF::String*)`, `toZigString(JSC::Identifier&)` + `(JSC::Identifier*)`, `Zig::toStringView(ZigString)`. rg across src/ and codegen shows zero callers for each. - **`headers-handwritten.h`** (22 lines): `WritableEvent` typedef + 8 consts, `ReadableEvent` typedef + 9 consts. Zero references anywhere. - **`JSDOMWrapper.h`** (8 lines): `JSTextNodeType`, `JSProcessingInstructionNodeType`, `JSDocumentTypeNodeType`, `JSDocumentFragmentNodeType`, `JSDocumentWrapperType`, `JSCommentNodeType`, `JSCDATASectionNodeType`, `JSAttrNodeType`. Only referenced in commented-out code at `webcore/DOMJITHelpers.h:163-178`. (`JSNodeType`/`JSNodeTypeMask`/`JSElementType`/`JSAsJSONType` kept.) - **`BunClientData.{h,cpp}`** (9 lines): `addClient()` is never called, so `m_clients` is always empty and the `~JSVMClientData` `forEach`/`clear` loop is a no-op. Removed `addClient`, `m_clients`, the dtor loop, and the include of `JSVMClientDataClient.h`. - **`JSDOMConvert.h`** (2 lines): removed `#include` of the two deleted headers. - **`headergen/sizegen.cpp`** (2 lines): removed `#include "headers-cpp.h"`. The file is not in any build rule and was already uncompilable (its loop references `names[]`/`sizes[]`/`aligns[]`, none of which were ever fully defined); leaving the loop untouched to minimise conflict with #36115.. ### Rust removals - **`bun_core::String::github_action` + `StringGithubActionFormatter`** (22 lines): all four `.github_action()` call sites in `VirtualMachine.rs` are on `jsc::ZigString`, not `bun_core::String`. The `ZigString` variant is kept. - **`bun_jsc::JSUint8Array::ptr()` + `sizes::BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR`** (14 lines): zero callers. - **`bun_jsc::RefString::to_js()`** (9 lines): the sole external `RefString` user (`filesystem_router.rs`) never calls `.to_js()`. Removed along with now-unused `JSGlobalObject`/`JSValue`/`JsResult`/`StringJsc` imports. - **`bun_jsc::Errorable::value()`** (7 lines): identical body to `Errorable::ok()`; every caller uses `ok()`. ### Verification - `bun bd` passes - `bun run rust:check-all` passes on all targets - `bun bd test test/internal/source-lints/` passes (62 tests) - `bun bd test test/js/node/inspector/` passes (67 tests; exercises `BunDebugger.cpp`) - `bun bd test test/cli/install/bun-install-lifecycle-scripts.test.ts` passes (3 pre-existing env failures unrelated to this diff, reproduced on main) ### Followups (not in this diff) - `src/jsc/bindings/CachedScript.h` is semantically vestigial (empty class, all callers pass `nullptr`) but removing it requires editing signatures in `ScriptExecutionContext.h` / `JSDOMExceptionHandling.{h,cpp}`. - `src/ast/lib.rs` `StringBuilder` stub + the `count()` method chain is a no-op cluster but removing it requires dropping the `&mut StringBuilder` parameter from three `clone_with_builder` signatures. - `src/runtime/api/bun/h2/connection.rs` `send_header_block`/`send_push_promise`/`send_data`/`encode_header`/`begin_header_block` (~173 LOC) are only called from `#[cfg(test)]`; intentionally staged per the `h2/mod.rs` module doc for a future rewrite, so left alone. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 2 · 24 files touched <details><summary>fails on main (without fix)</summary> ```console 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-llhttp-helpers-install.test.ts bun test v1.4.0 (6057ada) test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts: 50 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertWebGL\.h/], 51 | ["src/jsc/bindings/IDLTypes.h", /\bIDLJSON\b/], 52 | ["src/jsc/headergen/sizegen.cpp", /headers-cpp\.h/], 53 | ]; 54 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 55 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/helpers.h: static WTF::AtomString toAtomString\(ZigString", + "src/jsc/bindings/helpers.h: \btoStringNotConst\b", + "src/jsc/bindings/helpers.h: \b__dot_char\b", + "src/jsc/bindings/helpers.h: \bZigStringCwd\b", + "src/jsc/bindings/helpers.h: \bBunStringCwd\b", + "src/jsc/bindings/helpers.h: toZigString\(WTF::String\*", + "src/jsc/bindings/helpers.h: toZigString\(JSC::Identifier&", + "src/ ... (truncated) release without fix: 2 FAILED bun test v1.4.0-canary.1 (91f57fe) test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts: 50 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertWebGL\.h/], 51 | ["src/jsc/bindings/IDLTypes.h", /\bIDLJSON\b/], 52 | ["src/jsc/headergen/sizegen.cpp", /headers-cpp\.h/], 53 | ]; 54 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 55 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/helpers.h: static WTF::AtomString toAtomString\(ZigString", + "src/jsc/bindings/helpers.h: \btoStringNotConst\b", + "src/jsc/bindings/helpers.h: \b__dot_char\b", + "src/jsc/bindings/helpers.h: \bZigStringCwd\b", + "src/jsc/bindings/helpers.h: \bBunStringCwd\b", + "src/jsc/bindings/helpers.h: toZigString\(WTF::String\*", + "src/jsc/bindings/helpers.h: toZigString\(JSC::Identifier&", + "src/jsc/bindings/helpers.h: toZigString\(JSC::Identifier\*", + "src/jsc/bindings/helpers.h: static WTF::StringView toStringView\(ZigString", + "src/jsc/bindings/headers-handwritten.h: \bWritableE ... (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-llhttp-helpers-install.test.ts bun test v1.4.0 (6057ada) test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts: (pass) dead C++ symbols in helpers.h / headers-handwritten.h / JSDOMWrapper.h / BunClientData do not reappear [37.66ms] (pass) dead Rust symbols in bun_core / jsc do not reappear [9.99ms] 2 pass 0 fail 2 expect() calls Ran 2 tests across 1 file. [2.03s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 647ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/122] gen cpp.rs (cppbind) [2/122] 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/122] gen JS modules (bundle-modules) Preprocess modules (8812ms) Bundle modules (38ms) Postprocesss modules (34ms) Bundle Functions (748ms) Generate Code (19ms) [9.67s] Bundled "src/js" for production 2569 kb 193 internal modules 13 native modules 90 internal functions across 19 files [3/121] 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) �[1m� ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/bun_core/string/mod.rs | 22 -- src/jsc/Errorable.rs | 7 - src/jsc/JSUint8Array.rs | 13 - src/jsc/RefString.rs | 9 - src/jsc/bindings/BunClientData.cpp | 5 - src/jsc/bindings/BunClientData.h | 5 - src/jsc/bindings/IDLTypes.h | 12 - src/jsc/bindings/JSDOMWrapper.h | 8 - src/jsc/bindings/JSVMClientDataClient.h | 13 - src/jsc/bindings/ares_build.h | 42 --- src/jsc/bindings/headers-cpp.h | 190 ----------- src/jsc/bindings/headers-handwritten.h | 22 -- src/jsc/bindings/helpers.h | 38 --- src/jsc/bindings/node/http/llhttp/api.h | 357 --------------------- src/jsc/bindings/webcore/HTTPHeaderValues.cpp | 68 ---- src/jsc/bindings/webcore/HTTPHeaderValues.h | 40 --- src/jsc/bindings/webcore/JSDOMConvert.h | 2 - src/jsc/bindings/webcore/JSDOMConvertJSON.h | 51 --- src/jsc/bindings/webcore/JSDOMConvertWebGL.cpp | 249 -------------- src/jsc/bindings/webcore/JSDOMConvertWebGL.h | 68 ---- src/jsc/bindings/webcore/TaskSource.h | 29 -- src/jsc/headergen/sizegen.cpp | 2 - src/jsc/sizes.rs | 1 - .../dead-symbols-llhttp-helpers-install.test.ts | 68 ++++ 24 files changed, 68 insertions(+), 1253 deletions(-) ``` </details> **gate history** · 1 passed · 1 rejected · iteration 2 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/bun_core/string/mod.rs 1 2 0 src/jsc/Errorable.rs 1 1 0 src/jsc/JSUint8Array.rs 1 2 0 src/jsc/RefString.rs 2 2 0 src/jsc/bindings/BunClientData.cpp 1 1 0 src/jsc/bindings/BunClientData.h 2 2 0 src/jsc/bindings/IDLTypes.h 1 1 0 src/jsc/bindings/JSDOMWrapper.h 1 1 0 src/jsc/bindings/JSVMClientDataClient.h 0 0 0 src/jsc/bindings/ares_build.h 0 0 0 src/jsc/bindings/headers-cpp.h 0 0 0 src/jsc/bindings/headers-handwritten.h 1 1 0 src/jsc/bindings/helpers.h 2 2 0 src/jsc/bindings/node/http/llhttp/api.h 0 0 0 src/jsc/bindings/webcore/HTTPHeaderValues.cpp 0 0 0 src/jsc/bindings/webcore/HTTPHeaderValues.h 0 0 0 (+ 8 more files) ``` </details> <!-- robobun:evidence:end -->
…JSDOMConvert*, rescle, wasi (#36474) Net: **-3673 LOC** (30 files, +177 / -3850). No behavior change. Nothing here overlaps with the other open dead-code PRs (#34965, #34759, #36426, #36178, #36237, #35775, #35559, #36318, #36115, #35437, #35880); every touched file was checked against their file lists. ### SerializedScriptValue.cpp / .h (7239 → 5090, 413 → 202) - All `#if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)`, `#if ENABLE(WEB_RTC)`, `#if ENABLE(WEB_CODECS)`, `#if ENABLE(PREDEFINED_COLOR_SPACE_DISPLAY_P3)` blocks. Bun's JSCOnly `cmakeconfig.h` sets all four to 0 on every target, and the referenced types (`OffscreenCanvas`, `RTCCertificate`, `DetachedRTCDataChannel`, `WebCodecsVideoFrame`, ...) have no headers anywhere under `src/`, so the guarded bodies could not compile if the macros flipped. - ~1200 lines of long-commented-out serialization paths for DOM geometry (`DOMPoint`/`DOMRect`/`DOMMatrix`/`DOMQuad`), `ImageBitmap`, `File`/`FileList`, `Blob`, `ImageData`, blob-URL/IDB helpers, and alternate ctors. All date to 2022. - Uncalled public methods (`rg` across `src/` and `build/debug/codegen/`): `create(StringView)`, `create(JSContextRef, JSValueRef, JSValueRef*)`, `deserialize(JSContextRef, JSValueRef*)`, `toString()`, `nullValue()`, `wireFormatVersion()`, and the never-instantiated `encode<Encoder>()` / `decode<Decoder>()` templates. Plus their private-only helpers `CloneSerializer::serialize(StringView, Vector<uint8_t>&)`, `CloneDeserializer::deserializeString()`, `blobFilePathForBlobURL()`, `wrapCryptoKey()`, `unwrapCryptoKey()`, `write/read(DestinationColorSpaceTag)`, the `PLATFORM(COCOA)` `CFDataRef` helpers, and the `fillTransferMap(const Vector<Ref<T>>&, ...)` overload. - Orphaned enums `PredefinedColorSpaceTag`, `DestinationColorSpaceTag`, `ImageDataPoolTag`, `m_transferredImageBitmaps`, and 18 `SerializationTag` values that are no longer written or read in live code (`FileTag`, `FileListTag`, `ImageDataTag`, `BlobTag`, `DOMPoint*/Rect*/Matrix*/QuadTag`, `ImageBitmap*Tag`, `OffscreenCanvasTransferTag`, `RTC*Tag`, `WebCodecs*Tag`). The grammar-comment documentation block is kept. Followup note: `m_blobURLs` / `m_blobFilePaths` are now write-only (their sole reader `blobFilePathForBlobURL` is gone), but removing them cascades through the live `CloneDeserializer` ctor params and the public `deserialize(..., blobURLs, blobFilePaths, ...)` overload. Left as-is. ### WebSocket.cpp / .h (-212) - Uncalled `create(ctx, url, protocols, headers, bool)` 5-arg overload and the three `connect(const String&[, ...])` overloads (all `JSWebSocket.cpp` paths use the 2/3/8/9-arg `create` and the 4-arg `connect`). - `didUpdateBufferedAmount(unsigned)`, the decl-only `didReceiveData(const char*, size_t)` and `WebSocket(ScriptExecutionContext&, const String&)`, and the uncalled `offerPerMessageDeflate()` getter. - 2022-era commented-out blocks: CSP/portAllowed, `ResourceLoadObserver`/`MixedContentChecker`, `ENABLE(INTELLIGENT_TRACKING_PREVENTION)`, `contextDestroyed`/`suspend`/`resume`/`stop`/`activeDOMObjectName`, four `ConnectedWebSocketKind::Server` case blocks, and the commented `#include`s. - `m_dispatchedErrorEvent` (only read by the removed `suspend`/`resume` block). ### JSDOMConvert{Sequences,Strings,Record,Union}.h / .cpp (-381) - `NumericSequenceConverter` and the five `SequenceConverter<IDL{Long,Float,UnrestrictedFloat,Double,UnrestrictedDouble}>` specializations. `IDLSequence<T>` is only instantiated with string / enum / interface / dictionary / object element types in Bun (`rg 'IDLSequence<IDL(Long|Float|Double|Unrestricted)' src/ build/debug/codegen/` = 0). - `Converter<IDLFrozenArray<T>>` (only the `JSConverter` side is used), `JSConverter<IDLRecord<K,V>>` (only the `Converter` side is used), and the `IDLAllowSharedAdaptor<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>>` specs (webcrypto uses the un-wrapped union). - `propertyNameToString` / `propertyNameToAtomString`, the `IDLLegacyNullToEmpty{,Atom}StringAdaptor` and `IDLAtomStringAdaptor<IDL{USV,Byte}String>` converters, and `valueToByteAtomString` / `valueToUSVAtomString` (their only callers). ### windows/rescle.cpp / .h (-278) The only entry point `rescle__setWindowsMetadata` (from `src/sys/windows/mod.rs`) uses `Load`, `SetIcon`, `SetVersionString`, `SetFileVersion`, `SetProductVersion`, `Commit`. Removed `SetExecutionLevel`, `IsExecutionLevelSet`, `SetApplicationManifest`, `IsApplicationManifestSet`, `GetVersionString`×2, `ChangeString`×2, `ChangeRcData`, `GetString`×2, `OnEnumResourceManifest` + its `Load()` registration, the now-always-false execution-level and manifest branches in `Commit()`, `ReadFileToString`, the `executionLevel_`/`originalExecutionLevel_`/`applicationManifestPath_`/`manifestString_` members, and five unused `RU_VS_*` macros. Followup note: with `ChangeString`/`ChangeRcData` gone, `stringTableMap_` and `rcDataLngMap_` are now populated by `Load()` and written back unchanged by `Commit()`. That round-trip was already a semantic no-op on `main` (the removed mutators had zero callers there too), but removing it touches a live Windows `bun build --compile` path rather than an unreferenced helper, so it is deferred rather than folded into this sweep. ### Performance.cpp / .h + PerformanceObserver.h (-154) - `addResourceTiming(ResourceTiming&&)` (no callers; Bun's fetch produces `PerformanceResourceTiming` via `queueEntry` directly), `isResourceTimingBufferFull()`, `m_backupResourceTimingBuffer`, `m_waitingForBackupBufferToBeProcessed`. - `allowHighPrecisionTime()` + `highTimePrecision`, `timeResolution()`, `relativeTimeFromTimeOriginInReducedResolution(MonotonicTime)` (no callers). - 2024-era commented-out `navigation()`, `reportFirstContentfulPaint`/`addNavigationTiming`/`navigationFinished`, `resourceTimingBufferFullTimerFired()`. - `PerformanceObserver.h`: `hasNavigationTiming`/`addedNavigationTiming`/`m_hasNavigationTiming` (only referenced from the commented-out code above). ### EventTarget.cpp / .h + EventListenerMap (-51) - `isPaymentRequest()` virtual (no callers, no overriders). - `legacyType(const Event&)` static, which unconditionally returned `nullAtom()` since 2022, and the legacy-fallback block in `fireEventListeners` it made unreachable. - `hasCapturingEventListeners(const AtomString&)` (no callers) and its only callee `EventListenerMap::containsCapturing`. - Decl-only `invalidateJSEventListeners(JSC::JSObject*)`. ### src/js/node/wasi.ts (-280) - The four `exports.X = exports.Y = ... = void 0;` pre-declaration chains (186 LOC). These are tsc emit artifacts from the original `wasi-js` npm bundle; every property is re-assigned to its real value immediately after. - `WASIExitError` / `WASIKillError` classes (the `types` module is only consumed as `types_1.WASIError`). - `exports.SOCKET_DEFAULT_RIGHTS` (written once, never read). - `initWasiFdInfo()` (never called; contains five debug `console.log` calls). - `if (log.enabled) { ... }` blocks and bare `log(...)` / `logOpen(...)` calls (`log` is hard-coded to `() => {}` and never reassigned). ### src/js/thirdparty/ws.js (-19) - Long-commented-out `secWebSocketExtensions` / `PerMessageDeflate` block (May 2023). ### Rust (-22) - `bun_http`: `PRINT_EVERY` / `PRINT_EVERY_I` debug scaffolding and the `if PRINT_EVERY != 0 { ... }` block it made always-dead. - `bun_threading`: drop `GuardedBy`, `RawMutex`, `RwLockReadGuard`, `RwLockWriteGuard` from the crate re-export list (zero `bun_threading::X` references; the backing types stay for `Guarded`'s impl). - `bun_standalone_graph`: `Error::UnsupportedTarget` variant (never constructed; `download_to_path` returns other variants). - `bun_bunfig`: the unused `OfflineMode` re-export. ### Verification - `rg -w <symbol> src/ build/debug/codegen/ src/codegen/` returned only the definition for each deleted item. - `bun bd` builds clean. - `bun run rust:check-all` passes on all 10 targets (linux/macos/windows × x64/aarch64, plus musl). - Smoke tests pass: `structured-clone.test.ts` (231/231), `structuredClone-classes.test.ts`, `worker_threads.test.ts` (91/91), `websocket-client.test.ts`, `abort.test.ts`, `performance-entries.test.ts`, `wasi.test.js`, `deno/event/event-target.test.ts`. - New `test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts` guards against reintroduction: fails (7/7) with `src/` at `main`, passes (7/7) with this diff. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 1 · 30 files touched <details><summary>fails on main (without fix)</summary> ```console ASAN without fix: 7 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-ssv-wasi-webcore.test.ts bun test v1.4.0 (e0122fc) test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts: 47 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static Ref<SerializedScriptValue> nullValue\(\)/], 48 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static uint32_t wireFormatVersion\(\)/], 49 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /void encode\(Encoder&\) const/], 50 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static RefPtr<SerializedScriptValue> decode\(Decoder&/], 51 | ]; 52 | expect(resurrected(checks)).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(OFFSCREEN_CANVAS_IN_WORKERS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_RTC\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_CODECS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ... (truncated) release without fix: 7 FAILED bun test v1.4.0-canary.1 (754b4fe) test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts: 47 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static Ref<SerializedScriptValue> nullValue\(\)/], 48 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static uint32_t wireFormatVersion\(\)/], 49 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /void encode\(Encoder&\) const/], 50 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static RefPtr<SerializedScriptValue> decode\(Decoder&/], 51 | ]; 52 | expect(resurrected(checks)).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(OFFSCREEN_CANVAS_IN_WORKERS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_RTC\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_CODECS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: readRTCCertificate", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: readOffscreenCanvas", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: readWebCodecsVideoFrame", + " ... (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-ssv-wasi-webcore.test.ts bun test v1.4.0 (e0122fc) test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts: (pass) dead SerializedScriptValue ENABLE() blocks and unused public methods do not reappear [71.54ms] (pass) dead WebSocket create/connect overloads and commented-out WebKit blocks do not reappear [23.13ms] (pass) dead Performance/PerformanceObserver/EventTarget members do not reappear [22.29ms] (pass) dead JSDOMConvert* template specializations do not reappear [16.77ms] (pass) dead windows/rescle.cpp resource-editing methods do not reappear [19.33ms] (pass) dead wasi.ts bundle artifacts and debug scaffolding do not reappear [14.77ms] (pass) dead Rust http/threading/standalone_graph/bunfig items do not reappear [8.79ms] 7 pass 0 fail 7 expect() calls Ran 7 tests across 1 file. [2.27s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 718ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/138] gen ErrorCode+*.h [2/138] gen bake.{client,server,error}.js -> bake.client.js, bake.server.js, bake.error.js [3/138] gen JSEvent.lut.h Generating /workspace/bun/build/release/codegen/JSEvent.lut.h from /workspace/bun/src/jsc/bindings/webcore/JSEvent.cpp [4/138] gen JSBuffer.lut.h Generating /workspace/bun/build/release/codegen/JSBuffer.lut.h from /workspace/bun/src/jsc/bindings/JSBuffer.cpp [5/138] gen cpp.rs (cppbind) [6/138] gen JSSink.{cpp,h,lut.h,rs} generated_jssink.rs: 6 sinks, 72 exported symbols Generating /workspace/bun/build/release/codegen/JSSink.lut.h from /workspace/bun/build/release/codegen/JSSink.lut.txt [7/138] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [8/138] gen JS modules (bundle-modules) Preprocess modules (9054ms) Bundle modules (45ms) Postprocesss modules (217ms) Bundle Functions (732ms) Generate Code (35ms) [10.10s] Bundled "src/js" for production 2561 kb 193 internal modules 1 ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/bunfig/bunfig.rs | 2 - src/http/lib.rs | 12 - src/js/node/wasi.ts | 282 +-- src/js/thirdparty/ws.js | 19 - src/jsc/bindings/IDLTypes.h | 8 - src/jsc/bindings/webcore/Event.h | 1 - src/jsc/bindings/webcore/EventListenerMap.cpp | 13 - src/jsc/bindings/webcore/EventListenerMap.h | 1 - src/jsc/bindings/webcore/EventTarget.cpp | 29 +- src/jsc/bindings/webcore/EventTarget.h | 9 - src/jsc/bindings/webcore/JSDOMConvertNumbers.h | 30 - src/jsc/bindings/webcore/JSDOMConvertRecord.h | 31 - src/jsc/bindings/webcore/JSDOMConvertSequences.h | 209 -- src/jsc/bindings/webcore/JSDOMConvertStrings.cpp | 25 - src/jsc/bindings/webcore/JSDOMConvertStrings.h | 95 - src/jsc/bindings/webcore/JSDOMConvertUnion.h | 21 - src/jsc/bindings/webcore/Performance.cpp | 165 +- src/jsc/bindings/webcore/Performance.h | 27 +- src/jsc/bindings/webcore/PerformanceObserver.cpp | 2 +- src/jsc/bindings/webcore/PerformanceObserver.h | 4 - src/jsc/bindings/webcore/SerializedScriptValue.cpp | 2163 +------------------- src/jsc/bindings/webcore/SerializedScriptValue.h | 213 +- src/jsc/bindings/webcore/WebSocket.cpp | 197 -- src/jsc/bindings/webcore/WebSocket.h | 15 - src/jsc/bindings/windows/rescle.cpp | 261 --- src/jsc/bindings/windows/rescle.h | 21 - src/standalone_graph/StandaloneModuleGraph.rs | 4 - src/standalone_graph/error.rs | 3 - src/threading/lib.rs | 5 +- .../dead-symbols-ssv-wasi-webcore.test.ts | 160 ++ 30 files changed, 177 insertions(+), 3850 deletions(-) ``` </details> **gate history** · 7 passed · 0 rejected · iteration 1 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/bunfig/bunfig.rs 0 0 0 src/http/lib.rs 0 0 0 src/js/node/wasi.ts 0 0 0 src/js/thirdparty/ws.js 0 0 0 src/jsc/bindings/IDLTypes.h 1 1 0 src/jsc/bindings/webcore/Event.h 1 1 0 src/jsc/bindings/webcore/EventListenerMap.cpp 1 1 0 src/jsc/bindings/webcore/EventListenerMap.h 1 1 0 src/jsc/bindings/webcore/EventTarget.cpp 0 0 0 src/jsc/bindings/webcore/EventTarget.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertNumbers.h 2 1 0 src/jsc/bindings/webcore/JSDOMConvertRecord.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertSequences.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertStrings.cpp 0 0 0 src/jsc/bindings/webcore/JSDOMConvertStrings.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertUnion.h 0 0 0 (+ 14 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>
…C++ bindings (#36756) Removes 741 net LOC of unreferenced C++ from `src/jsc/bindings/` and `src/jsc/bindings/webcore/`. Every symbol was verified to have zero callers across `src/` and `build/debug/codegen/`, and the full debug build links cleanly. No overlap with any open dead-code PR (#35437, #35559, #35775, #35880, #36115, #36178, #36237, #36318, #36621, #36742). ### Whole files deleted - `webcore/DOMJITCheckDOM.h` (98 LOC): only includer was `JSEventDOMJIT.cpp` - `webcore/JSEventDOMJIT.cpp` (43 LOC): defined `checkSubClassSnippetForJSEvent`, whose sole reference in `JSEvent.cpp:242` was behind `#if 0` (nullptr used instead) - `webcore/DOMJITHelpers.cpp` (57 LOC): every function body was already commented out; compiled to an empty namespace - `webcore/JSDOMConvertSerializedScriptValue.h` (50 LOC): only includer was the `JSDOMConvert.h` umbrella; `IDLSerializedScriptValue<>` was never instantiated anywhere ### webcore/DOMJITHelpers.h Removed the entire `WebCore::DOMJIT` namespace body (~184 LOC: `branchIf*`, `toWrapper`, `tryLookUpWrapperCache`, `operationToJSNode`/`operationToJSContainerNode` declarations, and ~60 LOC of commented-out helpers). All 7 remaining includers (`generate-classes.ts` output, `JSBuffer.cpp`, `JSPerformance.cpp`, `JSTextEncoder.cpp`, `JSFFIFunction.cpp`, `JSSQLStatement.cpp`, `ZigGeneratedCode.cpp`) use only `JSC::DOMJIT::*` from JavaScriptCore headers, never `WebCore::DOMJIT::*`. The transitive `#include`s are kept. ### webcore/EventContext.{h,cpp} Removed `handleLocalEvents`, `node()`, `relatedTarget()`, `setRelatedTarget`, `isMouseOrFocusEventContext`, `isTouchEventContext`, `isWindowContext`, `isUnreachableNode`, the `(Type, Node&, ...)` constructor overload, the `Type` enum and `m_type` field, `m_relatedTarget`, `m_contextNodeIsFormElement`, and all `TOUCH_EVENTS` / commented-out blocks. Only `currentTarget()` / `closedShadowDepth()` / `target()` are reachable (via `EventPath::computePathUnclosedToTarget`). ### webcore/EventPath.{h,cpp} Removed the empty `EventPath(Node&, Event&)` constructor, `contextAt`, `eventTargetRespectingTargetRules`, the `buildPath` / `setRelatedTarget` declarations (never defined), the `Touch` forward decl and `TOUCH_EVENTS` block. ### webcore/EventListenerMap.{h,cpp} Removed `removeFirstEventListenerCreatedFromMarkup`, `copyEventListenersNotCreatedFromMarkupToTarget`, and their file-local static helpers. WebKit markup-listener transfer helpers with zero callers in Bun. ### ErrorCode.{h,cpp} - `Bun::toJS(JSGlobalObject*, ErrorCode)`: declared, never defined, never called - `INVALID_FILE_URL_HOST(..., const ASCIILiteral)` overload: not declared in the header, so the two call sites in `BunObject.cpp` bind to the `const WTF::String&` overload - `CRYPTO_JWK_UNSUPPORTED_CURVE(..., const WTF::String&)` overload: the only call site in `KeyObject.cpp` passes `(ASCIILiteral, const char*)`, matching the other overload - `Message::ERR_INVALID_ARG_TYPE(..., const ZigString*, const ZigString*, JSValue)` overload: zero callers ### DOMException.{h,cpp} Removed `create(const Exception&)` (zero callers) and the static `name(ExceptionCode)` / `message(ExceptionCode)` helpers (zero callers; `description(ec).name` is used directly where needed). ### CookieMap.{h,cpp} Removed `struct CookieStoreGetOptions` (zero references), `getAll()` (not in the `JSCookieMap` prototype table; `toJSON()` enumerates directly), and the private `CookieMap(Vector<Ref<Cookie>>&&)` constructor (zero `adoptRef` sites use it). ### DOMFormData.{h,cpp} Removed `clone()`; zero callers. ### Single-line declarations - `Cookie.h`: `isValidCookieValue` (declared, never defined; the trailing comment already said "this isn't needed") - `ImportMetaObject.h`: `createRequireFunction` (declared, never defined) - `JSCommonJSModule.h`: `setSourceCode` (declared, never defined), `clearSourceCode`, `idOrDot` - `Sink.h`: `numberOfSinkIDs` constexpr - `ProcessBindingTTYWrap.cpp`: duplicate forward declaration of `Process_functionInternalGetWindowSize` (already declared via `JSC_DECLARE_HOST_FUNCTION` in the header) ### Also scanned, nothing confidently dead `src/http/`, `src/ast/`, `src/semver/`, `src/event_loop/`, `src/bun_core/`, `src/threading/`, `src/runtime/bake/dev_server/`, `src/js/thirdparty/`. All recently swept and clean. ### Intentionally not touched (possible followups) - `InspectorHTTPServerAgent::{requestWillBeSent,responseReceived,bodyChunkReceived,requestFinished,requestHandlerException}` and `InspectorBunFrontendDevServerAgent::{clientErrorReported,graphUpdate}`: look like in-progress inspector scaffolding with matching Rust-side extern declarations; left alone - `webcore/streams/CrossRealmTransform.cpp` stubs: explicitly documented as frozen-ABI placeholders for transferable streams - `JSEventListener::wasCreatedFromMarkup()` and `m_wasCreatedFromMarkup`: now the only readers are gone, but removing the bitfield changes class layout; left for a separate pass - `webcore/ResourceLoadTiming.h`: only includers are `ResourceTiming.{h,cpp}` which #36621 modifies; avoided to prevent merge conflicts ### Verification - `rg -w <symbol> src/ build/debug/codegen/` returned only the definition for every removed item - `bun bd` builds and links - Smoke tests: `test/js/bun/cookie/cookie-map.test.ts`, `test/js/bun/globals.test.js`, `test/js/web/abort/abort.test.ts`, `test/js/web/fetch/body.test.ts -t FormData` all pass - `test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts` asserts the removed symbols do not reappear <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 4 · 29 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-domjit-eventpath-errorcode.test.ts bun test v1.4.0 (1752533) test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts: 28 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertSerializedScriptValue\.h/], 29 | ["src/jsc/bindings/webcore/JSEvent.cpp", /checkSubClassSnippetForJSEvent/], 30 | ["src/jsc/bindings/webcore/JSEvent.h", /checkSubClassSnippetForJSEvent/], 31 | ]; 32 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 33 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/DOMJITHelpers.h: namespace DOMJIT\b", + "src/jsc/bindings/webcore/DOMJITHelpers.h: branchIfNotWorldIsNormal|branchIfNotEvent|operationToJSNode", + "src/jsc/bindings/webcore/JSDOMConvert.h: JSDOMConvertSerializedScriptValue\.h", + "src/jsc/bindings/webcore/JSEvent.cpp: checkSubClassSnippetForJSEvent", + "src/jsc/bind ... (truncated) release without fix: 3 FAILED bun test v1.4.0-canary.1 (8fc0aeb) test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts: 28 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertSerializedScriptValue\.h/], 29 | ["src/jsc/bindings/webcore/JSEvent.cpp", /checkSubClassSnippetForJSEvent/], 30 | ["src/jsc/bindings/webcore/JSEvent.h", /checkSubClassSnippetForJSEvent/], 31 | ]; 32 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 33 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/DOMJITHelpers.h: namespace DOMJIT\b", + "src/jsc/bindings/webcore/DOMJITHelpers.h: branchIfNotWorldIsNormal|branchIfNotEvent|operationToJSNode", + "src/jsc/bindings/webcore/JSDOMConvert.h: JSDOMConvertSerializedScriptValue\.h", + "src/jsc/bindings/webcore/JSEvent.cpp: checkSubClassSnippetForJSEvent", + "src/jsc/bindings/webcore/JSEvent.h: checkSubClassSnippetForJSEvent", + ] - Expected - 1 + Received + 7 at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode. ... (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-domjit-eventpath-errorcode.test.ts bun test v1.4.0 (1752533) test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts: (pass) webcore DOMJIT dead files and helpers do not reappear [15.85ms] (pass) webcore EventPath/EventContext/EventListenerMap dead members do not reappear [19.37ms] (pass) misc C++ bindings dead declarations do not reappear [28.64ms] 3 pass 0 fail 3 expect() calls Ran 3 tests across 1 file. [2.08s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 645ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/83] gen ErrorCode+*.h [2/83] gen JSEvent.lut.h Generating /workspace/bun/build/release/codegen/JSEvent.lut.h from /workspace/bun/src/jsc/bindings/webcore/JSEvent.cpp [3/83] cxx obj/unified/UnifiedSource-src_jsc_bindings_node-0.cpp.o [4/83] cxx obj/unified/UnifiedSource-src_jsc_bindings_v8-0.cpp.o [5/83] cxx obj/unified/UnifiedSource-src_jsc_bindings_node_http-0.cpp.o [6/83] cxx obj/unified/UnifiedSource-src_jsc_bindings-5.cpp.o [7/83] gen cpp.rs (cppbind) [8/83] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [8/83] 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 ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/jsc/bindings/Cookie.h | 1 - src/jsc/bindings/CookieMap.cpp | 18 -- src/jsc/bindings/CookieMap.h | 7 - src/jsc/bindings/DOMException.cpp | 8 - src/jsc/bindings/DOMException.h | 6 - src/jsc/bindings/DOMFormData.cpp | 8 - src/jsc/bindings/DOMFormData.h | 1 - src/jsc/bindings/ErrorCode.cpp | 29 ---- src/jsc/bindings/ErrorCode.h | 2 - src/jsc/bindings/IDLTypes.h | 2 - src/jsc/bindings/ImportMetaObject.h | 2 - src/jsc/bindings/JSCommonJSModule.h | 5 - src/jsc/bindings/ProcessBindingTTYWrap.cpp | 2 - src/jsc/bindings/Sink.h | 2 - src/jsc/bindings/webcore/DOMJITCheckDOM.h | 98 +---------- src/jsc/bindings/webcore/DOMJITHelpers.cpp | 57 +------ src/jsc/bindings/webcore/DOMJITHelpers.h | 185 --------------------- src/jsc/bindings/webcore/EventContext.cpp | 34 ---- src/jsc/bindings/webcore/EventContext.h | 116 +------------ src/jsc/bindings/webcore/EventListenerMap.cpp | 45 ----- src/jsc/bindings/webcore/EventListenerMap.h | 5 - src/jsc/bindings/webcore/EventPath.cpp | 18 +- src/jsc/bindings/webcore/EventPath.h | 37 ----- src/jsc/bindings/webcore/JSDOMConvert.h | 1 - .../webcore/JSDOMConvertSerializedScriptValue.h | 50 +----- src/jsc/bindings/webcore/JSEvent.cpp | 10 +- src/jsc/bindings/webcore/JSEvent.h | 4 - src/jsc/bindings/webcore/JSEventDOMJIT.cpp | 43 +---- ...dead-symbols-domjit-eventpath-errorcode.test.ts | 90 ++++++++++ 29 files changed, 101 insertions(+), 785 deletions(-) ``` </details> **gate history** · 5 passed · 2 rejected · iteration 4 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/jsc/bindings/Cookie.h 2 1 0 src/jsc/bindings/CookieMap.cpp 2 1 0 src/jsc/bindings/CookieMap.h 2 3 0 src/jsc/bindings/DOMException.cpp 2 3 0 src/jsc/bindings/DOMException.h 2 3 0 src/jsc/bindings/DOMFormData.cpp 1 1 0 src/jsc/bindings/DOMFormData.h 1 1 0 src/jsc/bindings/ErrorCode.cpp 1 1 0 src/jsc/bindings/ErrorCode.h 1 1 0 src/jsc/bindings/IDLTypes.h 1 1 0 src/jsc/bindings/ImportMetaObject.h 2 1 0 src/jsc/bindings/JSCommonJSModule.h 1 2 0 src/jsc/bindings/ProcessBindingTTYWrap.cpp 2 1 0 src/jsc/bindings/Sink.h 2 1 0 src/jsc/bindings/webcore/DOMJITCheckDOM.h 0 1 0 src/jsc/bindings/webcore/DOMJITHelpers.cpp 1 1 0 (+ 13 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>
|
conflicts |
…_types, sql/postgres (#36318) Net -1029 lines (1181 deletions, 152 insertions including the source-lint test). No file overlaps with the other open dead-code PRs (#34965, #34759, #35437, #35559, #35775, #35880, #36115, #36178, #36237). ## C++ bindings (~620 lines) - **`DecodeEscapeSequences.h`** (whole file, 187 lines): only `#include` was `TextEncoding.cpp`, whose only consumer `decodeURLEscapeSequences()` is itself dead. - **`TextEncoding.{cpp,h}`**: `domName`, `usesVisualOrdering`, `isJapanese`, `isNonByteBasedEncoding`, `isUTF7Encoding`, `closestByteBasedEquivalent`, `encodingForFormSubmissionOrURLParsing`, `ASCIIEncoding`, `Latin1Encoding`, `UTF16BigEndianEncoding`, `UTF16LittleEndianEncoding`, `WindowsLatin1Encoding`, `decodeURLEscapeSequences`, `UTF7Encoding`, `isByteBasedEncoding`. These formed a closed call graph with no outside caller; only `UTF8Encoding()` remains. - **`TextEncodingRegistry.{cpp,h}`**: `isJapaneseEncoding` + `japaneseEncodings()` static set + its 14 `addEncodingName` calls, `noExtendedTextEncodingNameUsed`, `defaultTextEncodingNameForSystemLanguage`, `webDefaultCFStringEncoding` decl, and the `CoreFoundation.h` include. All were only reached from the removed `TextEncoding` methods. - **`JSDOMExceptionHandling.{cpp,h}`**: `retrieveErrorMessageWithoutName`, `reportCurrentException`, `throwNotSupportedError`, `throwInvalidStateError`, `throwSecurityError`, `throwAttributeTypeError`, `makeUnsupportedIndexedSetterErrorMessage`, `throwDOMSyntaxError`, `reportExceptionIfJSDOMWindow`, and the now-orphaned static `throwTypeError` helper. `rg` across `src/` and `build/debug/codegen/` shows zero callers outside decl/defn. - **`DOMURL.{cpp,h}`**: `DOMURL::createObjectURL`/`revokeObjectURL`/`createPublicURL` C++ stubs, the `URLRegistrable`/`Blob` placeholder classes, and the commented-out includes. Real implementations are `Bun__createObjectURL`/`Bun__revokeObjectURL` in Rust; the C++ stubs were only referenced from commented-out code in `JSDOMURL.cpp`. - **`webcore/JSDOMURL.cpp`**: `jsDOMURLConstructorFunction_createObjectURL` / `_revokeObjectURL` / `_createObjectURL1Body` / `_revokeObjectURLBody` / `_createObjectURLOverloadDispatcher` and their forward decls. The hash table at `:140-141` routes to `Bun__createObjectURL`/`Bun__revokeObjectURL` instead. - **`DOMWrapperWorld-class.h` / `DOMWrapperWorld.cpp`**: `clearWrappers`, `didCreateWindowProxy`, `didDestroyWindowProxy`, `setShadowRootIsAlwaysOpen`/`shadowRootIsAlwaysOpen`, `disableLegacyOverrideBuiltInsBehavior`/`shouldDisableLegacyOverrideBuiltInsBehavior`, `m_jsWindowProxies`, `m_shadowRootIsAlwaysOpen`, `m_shouldDisableLegacyOverrideBuiltInsBehavior`, `class WindowProxy` fwd decl. `WindowProxy` is never defined. - **`ActiveDOMCallback.{cpp,h}`**: `activeDOMObjectsAreSuspended`/`activeDOMObjectAreStopped`. Only external references are in commented-out code in `JSDOMPromiseDeferred.cpp` and `ActiveDOMObject.cpp`. ## src/js internals (~370 lines) - **`internal/assert/utils.ts`**: 230 lines of commented-out acorn-based source-parsing scaffolding (`findColumn`/`getCode`/`parseCode`/`escapeSequencesRegExp`/`meta`/`escapeFn`) plus the `getErrMessage()` body, which always returned `undefined`. Inlined `undefined` at its one call site. Blame: 2025-01-10. - **`internal/util/inspect.js`**: commented-out `stylizeWithColor`/`stylizeWithHTML`/`entities`/`escapeHTML` block annotated "unused without stylizeWithHTML". Blame: 2023-09-28. - **`node/_http_server.ts`**: commented-out `fetch(req, _server)` handler inside `Bun.serve({...})`, superseded by native dispatch. Commented out 2025-04-21. - **`internal/cluster/primary.ts`**: commented-out `inspectPort`/`isUsingInspector` block. Blame: 2024-08-18. - **`internal/streams/utils.ts`**: `isReadableEnded` (exported from an internal module, zero consumers across `src/` and codegen). - **`internal/sql/shared.ts`**: `isOptionsOfAdapter`/`assertIsOptionsOfAdapter` (zero consumers). - **`internal/primordials.js`**: `SafePromiseAll` + `arrayToSafePromiseIterable` + `PromiseAll` + `ArrayPrototypeMap`. Only `SafePromiseAllReturnVoid`/`ReturnArrayLike` are consumed, via `safePromiseAllCollect` which does not use these. - **`internal/validators.ts`**: `validateInternalField` + its `ObjectPrototypeHasOwnProperty` capture (zero consumers). ## Rust (~190 lines) - **`http_types/h2.rs`**: `FullSettingsPayload` (struct + `Pod`/`Zeroable`/`Default`/`BYTE_SIZE`, ~50 lines). `pub(crate)` with zero references; `runtime/api/bun/h2_frame_parser.rs` has its own local copy and does not import this one. Also `StreamPriority::from` + its `Pod`/`Zeroable` impls, `UInt31WithReserved::init`, and `SettingsType::SETTINGS_ENABLE_CONNECT_PROTOCOL` (only used by the removed `FullSettingsPayload::default`). - **`http_types/mime_type_list_enum.rs`**: `MimeTypeList::{as_str, len}`. Callers use `<&'static str>::from(entry)` and slice `.len()` on `Table::ALL` instead. - **`sql/postgres/protocol/*`**: `impl Default` for `StartupMessage`/`SASLInitialResponse`/`PasswordMessage`/`FieldDescription`/`ReadyForQuery`. Each struct is constructed with all fields explicit at its call site(s) in `PostgresSQLConnection.rs`; `::default()` is never called and no `T: Default` bound needs them. `TransactionStatusIndicator::I` goes with them (only used by the removed `ReadyForQuery::default`). - **`runtime/valkey_jsc/index.rs`** (whole file) + `mod index` decl + `ValkeyCommand` re-export alias in `mod.rs`. Every re-export in `index.rs` was already re-exported by `mod.rs` itself; zero external imports resolve through `valkey_jsc::index::` or `::ValkeyCommand`. - **`bun_core/string/MutableString.rs`**: `index_of`, `eql`. - **`s3_signing/credentials.rs`**: a stale "DELETED" reminder comment. ## Verification For each symbol: `rg` across `src/` and `build/debug/codegen/` showed zero references outside its own definition (or only references from other removed symbols). None are `#[no_mangle]`/`extern "C"`/`#[export_name]`, none are named by string in `.classes.ts` or `src/codegen/*.ts`, none are trait impls required by a live trait bound. `bun bd` and `bun run rust:check-all` (all 10 targets including windows x64/aarch64, macOS, musl, freebsd, android) pass. Smoke tests pass for `text-decoder.test.js`, `url.test.ts`, node assert, `util-inspect.test.js`, `node-http.test.ts` (the one proxy failure there also reproduces on the system bun), node stream, and cluster. `test/internal/source-lints/dead-symbols-text-encoding-domurl.test.ts` guards against reintroduction. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 7 · 31 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-text-encoding-domurl.test.ts bun test v1.4.0 (fec8e5e) test/internal/source-lints/dead-symbols-text-encoding-domurl.test.ts: 22 | ["src/jsc/bindings/webcore/JSDOMURL.cpp", /jsDOMURLConstructorFunction_createObjectURL\b/], 23 | ["src/jsc/bindings/DOMWrapperWorld-class.h", /clearWrappers|didCreateWindowProxy|m_jsWindowProxies/], 24 | ["src/jsc/bindings/ActiveDOMCallback.cpp", /ActiveDOMCallback::activeDOMObjectsAreSuspended/], 25 | ]; 26 | const found = checks.filter(([f, re]) => re.test(src(f))).map(([f, re]) => `${f}: ${re.source}`); 27 | expect(found).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/TextEncoding.cpp: decodeURLEscapeSequences|UTF7Encoding|domName", + "src/jsc/bindings/TextEncoding.cpp: encodingForFormSubmissionOrURLParsing|WindowsLatin1Encoding", + "src/jsc/bindings/TextEncodingRegistry.cpp: isJapaneseEncoding|defaultTextEncodingNameForSystemLanguage", + "src/jsc/bindings/JSDOMExceptionHandlin ... (truncated) release without fix: 3 FAILED bun test v1.4.0-canary.1 (3a6d57a) test/internal/source-lints/dead-symbols-text-encoding-domurl.test.ts: 22 | ["src/jsc/bindings/webcore/JSDOMURL.cpp", /jsDOMURLConstructorFunction_createObjectURL\b/], 23 | ["src/jsc/bindings/DOMWrapperWorld-class.h", /clearWrappers|didCreateWindowProxy|m_jsWindowProxies/], 24 | ["src/jsc/bindings/ActiveDOMCallback.cpp", /ActiveDOMCallback::activeDOMObjectsAreSuspended/], 25 | ]; 26 | const found = checks.filter(([f, re]) => re.test(src(f))).map(([f, re]) => `${f}: ${re.source}`); 27 | expect(found).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/TextEncoding.cpp: decodeURLEscapeSequences|UTF7Encoding|domName", + "src/jsc/bindings/TextEncoding.cpp: encodingForFormSubmissionOrURLParsing|WindowsLatin1Encoding", + "src/jsc/bindings/TextEncodingRegistry.cpp: isJapaneseEncoding|defaultTextEncodingNameForSystemLanguage", + "src/jsc/bindings/JSDOMExceptionHandling.cpp: throwNotSupportedError|throwSecurityError|throwDOMSyntaxError", + "src/jsc/bindings/JSDOMExceptionHandling.cpp: retrieveErrorMessageWithoutName|reportCurrentException", + "src/jsc/bi ... (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-text-encoding-domurl.test.ts bun test v1.4.0 (fec8e5e) test/internal/source-lints/dead-symbols-text-encoding-domurl.test.ts: (pass) dead TextEncoding/DOMURL/JSDOMExceptionHandling C++ does not reappear [26.22ms] (pass) dead src/js internal helpers and commented-out blocks do not reappear [16.15ms] (pass) dead http_types/h2 and postgres Default impls do not reappear [9.38ms] 3 pass 0 fail 3 expect() calls Ran 3 tests across 1 file. [2.06s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) target linux-x64-gnu build type Release build dir ./build/release revision fec8e5e features baseline 22 deps, 108 codegen, 1171 objects in 725ms ninja: Entering directory `/workspace/bun/build/release' [1/138] gen ErrorCode+*.h [2/138] gen bake.{client,server,error}.js -> bake.client.js, bake.server.js, bake.error.js [3/138] gen JSEvent.lut.h Generating /workspace/bun/build/release/codegen/JSEvent.lut.h from /workspace/bun/src/jsc/bindings/webcore/JSEvent.cpp [4/138] gen JSBuffer.lut.h Generating /workspace/bun/build/release/codegen/JSBuffer.lut.h from /workspace/bun/src/jsc/bindings/JSBuffer.cpp [5/138] gen cpp.rs (cppbind) [6/138] gen JSSink.{cpp,h,lut.h,rs} generated_jssink.rs: 6 sinks, 72 exported symbols Generating /workspace/bun/build/release/codegen/JSSink.lut.h from /workspace/bun/build/release/codegen/JSSink.lut.txt [7/138] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [8/138] gen JS modules (bundle-modules) Preprocess modules (8754ms) Bundle modules (3 ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/http_types/h2.rs | 63 ------ src/js/internal/assert/utils.ts | 240 +-------------------- src/js/internal/cluster/primary.ts | 7 - src/js/internal/primordials.js | 13 -- src/js/internal/sql/shared.ts | 18 -- src/js/internal/streams/utils.ts | 11 - src/js/internal/util/inspect.js | 26 --- src/js/internal/validators.ts | 11 +- src/js/node/_http_server.ts | 53 ----- src/jsc/bindings/ActiveDOMCallback.cpp | 12 -- src/jsc/bindings/ActiveDOMCallback.h | 3 - src/jsc/bindings/DOMURL.cpp | 51 ----- src/jsc/bindings/DOMURL.h | 8 - src/jsc/bindings/DOMWrapperWorld-class.h | 18 -- src/jsc/bindings/DOMWrapperWorld.cpp | 5 - src/jsc/bindings/DecodeEscapeSequences.h | 187 ---------------- src/jsc/bindings/JSDOMExceptionHandling.cpp | 67 ------ src/jsc/bindings/JSDOMExceptionHandling.h | 10 - src/jsc/bindings/TextEncoding.cpp | 108 ---------- src/jsc/bindings/TextEncoding.h | 22 -- src/jsc/bindings/TextEncodingRegistry.cpp | 61 ------ src/jsc/bindings/TextEncodingRegistry.h | 12 -- src/jsc/bindings/webcore/JSDOMURL.cpp | 65 ------ src/runtime/valkey_jsc/index.rs | 20 -- src/runtime/valkey_jsc/mod.rs | 11 - src/s3_signing/credentials.rs | 3 - src/sql/postgres/protocol/FieldDescription.rs | 10 - src/sql/postgres/protocol/PasswordMessage.rs | 11 - src/sql/postgres/protocol/SASLInitialResponse.rs | 12 -- src/sql/postgres/protocol/StartupMessage.rs | 10 - .../dead-symbols-text-encoding-domurl.test.ts | 54 +++++ 31 files changed, 57 insertions(+), 1145 deletions(-) ``` </details> **gate history** · 3 passed · 2 rejected · iteration 7 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/http_types/h2.rs 3 7 0 src/js/internal/assert/utils.ts 1 1 0 src/js/internal/cluster/primary.ts 1 1 0 src/js/internal/primordials.js 1 2 0 src/js/internal/sql/shared.ts 1 2 0 src/js/internal/streams/utils.ts 1 2 0 src/js/internal/util/inspect.js 1 1 0 src/js/internal/validators.ts 2 4 0 src/js/node/_http_server.ts 1 1 0 src/jsc/bindings/ActiveDOMCallback.cpp 1 1 0 src/jsc/bindings/ActiveDOMCallback.h 1 1 0 src/jsc/bindings/DOMURL.cpp 4 6 0 src/jsc/bindings/DOMURL.h 2 3 0 src/jsc/bindings/DOMWrapperWorld-class.h 1 3 0 src/jsc/bindings/DOMWrapperWorld.cpp 1 1 0 src/jsc/bindings/DecodeEscapeSequences.h 1 3 0 (+ 15 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>
|
Rebased onto main (66eba5e). Single conflict in Body.rs from the |
Net -418 LOC across 29 files (9 crates). Every removed symbol was verified unreferenced via repo-wide
rgacrosssrc/,build/debug/codegen/, andsrc/codegen/, then confirmed by a fullbun bdbuild andrust:check-all(all 10 targets).webcore
blob::Inlinestruct + impl (Blob.rs, ~82 LOC): never constructed. TheInlineBlobbody variant it was meant to back exists only as commented-out match arms throughout Body.rs and RequestContext.rs; those stale comments are removed too.streams::Writable::is_done,streams::Signal::init,BufferAction::{resolve, get}: zero callers.BufferActionis only consumed viafulfill/reject/value/swapin ByteStream.rs.Response::header,response::from_js_direct: zero callers. Header reads go throughFetchHeaders::fast_getdirectly; the free-fnfrom_js_directduplicated the trait method.NewSource::{unref, start}(ReadableStream.rs): zero callers;set_ref(false)andon_start_from_jscover these.file_reader::TAGconst:readable_stream::Tag::Fileis referenced directly everywhere.jsc
DeprecatedStrong::unref(~31 LOC including the stale contract comment): noref()counterpart exists and the sole user (test_runner/Collection.rs) usesinit+Droponly, as the deleted comment already noted.strong::Optional::call,Weak::{init, has},JSPropertyIterator::reset: zero callers.JSString::eql+JSC__JSString__eqlextern import: zero Rust callers.URLSearchParams::create+ extern import: onlyfrom_js/to_stringare used.bundler
PathTemplateConst::{print, needs}and theDisplayimpls for bothPathTemplateConstandPathTemplate(~43 LOC): every call site usesPathTemplate::print(&mut buf, ..)directly; nothing formats either type via{}.ast
Expr::is_boolean(~23 LOC): only self-recursive. External.is_boolean()calls are onJSValue.Log::init_comptime: zero callers.install
ProgressStrings::extract()and its three backing consts: zero callers.EXTRACT_EMOJI(used in runTasks.rs) is kept.bin::Contexttype alias: callers namePriorityQueueContextdirectly.SecurityScanSubprocess::event_loop: the macro wiring bypasses it viaevent_loop_handle.as_event_loop_ctx().Scripts::List::first: zero callers.spawn
StaticPipeWriter::{get_buffer, flush, loop_, event_loop}: theimpl_buffered_writer_parent!macro wires direct field access; no external caller.ResultTask::<T>::run_from_main_thread_mini: the Mini variant has its own; this one is orphaned.runtime/node
dir_iterator::IteratorErrorenum and itsruntime::Error::DirIteratorvariant: never constructed. The iterator returnsbun_sys::Error.StatOrNotFound::to_js(identical toto_js_newly_created),Null::to_js,VectorArrayBuffer::to_js: theFsReturnimpls inline the bodies and never call these.resolver
DirInfoRef::as_ptr: the internal.as_ptr()calls go throughBackRef/NonNull, not this wrapper.libarchive
ReadArchive::as_ptr,WriteArchive::as_ptr,OwnedEntry::as_ptr: every consumer usesDerefto&Archive/&Entry.Verification
bun bdbuilds clean.bun run rust:check-all: 10 ok, 0 failed (linux/macos/windows/freebsd/android, x64 + aarch64).test/js/web/fetch/blob.test.ts(46/46),test/js/web/fetch/body.test.ts+fs.test.tsstat subset pass.No overlap with open dead-code PRs #34965, #34759, #35437. One touched file (Blob.rs) overlaps with #35399 at disjoint line ranges (that PR edits lines 605-643; this removes 6856-6937).
[review] gate passed · iteration 6 · 20 files touched
fails on main (without fix)
passes on PR (with fix)
diff hotspot
gate history · 1 passed · 1 rejected · iteration 6
evidence per changed file