Skip to content

Remove dead code from bun_router - #34759

Closed
robobun wants to merge 5 commits into
mainfrom
claude/farm/fc1a37e7/dead-code-router
Closed

Remove dead code from bun_router#34759
robobun wants to merge 5 commits into
mainfrom
claude/farm/fc1a37e7/dead-code-router

Conversation

@robobun

@robobun robobun commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Dead-code sweep of src/router/lib.rs. Each removed item has zero references across src/, build/debug/codegen/, src/codegen/, src/js/, and packages/ (verified with rg -w). None are #[no_mangle]/extern "C", none appear in any .classes.ts, and none are referenced by string name.

Item Why it's dead
RouteConfig::from_loaded_routes Zig fromLoadedRoutes; its only caller was the old dev-server config loader which goes through from_api in Rust
Router::get_public_paths Zig getPublicPaths; no Rust caller
Router::route_index_by_hash Zig routeIndexByHash; no Rust caller
TinyPtr::to_string_pointer Zig toStringPointer; no Rust caller
type RoutePtr = TinyPtr unused alias (Route.Ptr in Zig, moved to module level for the port, never referenced)
Match::params_iterator Zig paramsIterator; Rust filesystem_router.rs builds params via PathnameScanner directly
Match::name_with_basename Zig nameWithBasename; no Rust caller
RouteIndexList::items_public_path cascade: only caller was get_public_paths
RouteIndexList::items_hash cascade: only caller was route_index_by_hash (the other items_hash hits in the tree are on the watcher's unrelated SoA types)
RouteIndexList.public_path / .hash columns, RouteIndex.public_path / .hash fields cascade: write-only once both accessors are gone
Routes.index_id field cascade: only reader was route_index_by_hash's INDEX_ROUTE_HASH fast path (the load_all local of the same name stays; it feeds dynamic_len)
Route.public_path field cascade: only reader was the RouteIndex push in load_all; the index-route arm's DirnameStore append existed only to populate it
api::StringPointer re-export, PathnameScanner import cascade: orphaned by to_string_pointer / params_iterator

Verification

  • rg -w <symbol> across the full repo returns only the definition for each primary item
  • cargo check -p bun_router and cargo check -p bun_bundler pass, including --target x86_64-pc-windows-msvc (a #[cfg(windows)] debug_assert block was touched)
  • bun run rust:check-all: bun_router checks clean on all 10 targets (the bun_jsc build-script failure there is pre-existing on main, unrelated to this change)
  • bun bd builds
  • bun bd test test/js/bun/util/filesystem_router.test.ts: 29 pass
  • bun bd test test/bake/framework-router.test.ts: 35 pass

No test added: this is pure dead-code removal with no observable behavior change, so there is no fail-before case a regression test could cover. The existing router suites above exercise every surviving code path.

Net: -102 lines.

@robobun

robobun commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 42ece06a-013d-4045-82c6-a4e567cfc1af

📥 Commits

Reviewing files that changed from the base of the PR and between 09379f8 and 27d5ee2.

📒 Files selected for processing (1)
  • src/router/lib.rs

Walkthrough

Changes

The router module narrows configuration ingestion, removes route metadata storage and public helper APIs, and refactors route name parsing to derive names directly through DirnameStore.

Router API and route representation reduction

Layer / File(s) Summary
Configuration and index storage narrowing
src/router/lib.rs
Configuration ingestion, route index storage, and loaded route state no longer retain or expose removed path, hash, or index metadata.
Route representation and name parsing
src/router/lib.rs
Route drops public_path, while parsing derives name and match_name through DirnameStore and updates related assertions.
Pointer and match helper removal
src/router/lib.rs
TinyPtr::to_string_pointer, RoutePtr, Match::params_iterator, and Match::name_with_basename are removed. PathnameScanner is no longer imported.

Possibly related PRs

  • oven-sh/bun#34276: Both changes modify Route::parse and DirnameStore route name interning.
  • oven-sh/bun#34284: Both changes modify route path and name slice creation in Route::parse.

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 is concise and accurately summarizes the main change: removing dead code from bun_router.
Description check ✅ Passed It covers the change scope and verification steps, even though it doesn't use the exact template headings.

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

@robobun

robobun commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: this is a deletion-only dead-code sweep (unreferenced pub items, -61 +0), so there is no runtime behavior change a regression test could observe. The fail-before requirement cannot be met when the removed code is never executed on any path.

Verification that was done locally: repo-wide rg -w for each symbol returns only the definition; bun bd builds; bun_router type-checks on all 10 cross targets; test/js/bun/util/filesystem_router.test.ts (29/29) and test/bake/framework-router.test.ts (35/35) pass with the change applied.

The branch claude/farm/fc1a37e7/dead-code-router is left in place in case a maintainer wants to merge it directly.

@robobun robobun closed this Jul 20, 2026

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

LGTM — pure deletions of unreferenced Zig-port leftovers; verified each removed symbol has zero callers repo-wide. The inline nit about items_hash() and the now write-only public_path/hash columns is a further cascade opportunity, not a blocker.

Extended reasoning...

Overview

Dead-code sweep of src/router/lib.rs: removes 7 public items (RouteConfig::from_loaded_routes, Router::get_public_paths, Router::route_index_by_hash, TinyPtr::to_string_pointer, RoutePtr alias, Match::params_iterator, Match::name_with_basename) plus 3 cascade items (RouteIndexList::items_public_path, the api::StringPointer re-export, and the PathnameScanner import). Net -61/+0. No control-flow changes; every hunk is a whole-item deletion or an import trim.

Verification

I re-ran rg across src/ for every removed symbol name — zero hits remain. api::LoadedRouteConfig is still consumed by RouteConfig::to_api, so keeping that re-export is correct. PathnameScanner no longer appears in the file after params_iterator is gone. None of the removed items are #[no_mangle]/extern "C" or referenced from .classes.ts/codegen, so there's no FFI or string-name lookup risk.

Security risks

None. Deletions only; no new code paths, no input handling, no unsafe blocks touched.

Level of scrutiny

Low. This is mechanical dead-code removal in a single crate with a well-documented per-item audit table. The PR description shows cargo check, rust:check-all, a full bun bd build, and both router test suites passing. The only risk class for this shape of change — a symbol that looks dead but is reached via FFI export or string-name lookup — was explicitly checked and does not apply.

Other factors

The bug-hunting system flagged one nit: removing route_index_by_hash orphans RouteIndexList::items_hash() (confirmed — the only remaining items_hash hits repo-wide are on unrelated Watcher types), and one level further the RouteIndexList.public_path/.hash columns become write-only. That's a valid observation about cascade completeness but is a further cleanup opportunity, not a correctness issue — leaving them in place changes no behavior. Approving with the nit as an inline comment for the author to fold in if desired.

Comment thread src/router/lib.rs Outdated
@Jarred-Sumner Jarred-Sumner reopened this Jul 20, 2026
Comment thread src/router/lib.rs
@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

@robobun resume removing

Removes pub items in bun_router that have no callers anywhere in the
workspace, in generated code, or across the FFI boundary. These were
ported from the Zig router but their call sites were never ported (or
went through a different path in Rust).

- RouteConfig::from_loaded_routes
- Router::get_public_paths
- Router::route_index_by_hash
- TinyPtr::to_string_pointer
- type RoutePtr
- Match::params_iterator
- Match::name_with_basename
- RouteIndexList::items_public_path (only caller was get_public_paths)
- api::StringPointer re-export + PathnameScanner import (orphaned by above)
@robobun
robobun force-pushed the claude/farm/fc1a37e7/dead-code-router branch from 28830db to 5fc6ede Compare July 21, 2026 04:04
@robobun

robobun commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto current main and re-verified: all eight removed symbols still have zero references repo-wide, cargo check -p bun_router and -p bun_bundler pass. Keeping this scoped to bun_router so it stays small; happy to do follow-up sweeps on other crates separately.

route_index_by_hash's removal orphaned RouteIndexList::items_hash and
left Routes.index_id write-only; with items_public_path gone the
public_path/hash SoA columns (and the RouteIndex and Route fields
feeding them) were write-only too.
@robobun

robobun commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Review feedback is fully applied as of 27d5ee2 (cascaded dead items, direct name interning, comment trim); all threads resolved. CI on the latest run is red only on Windows lanes unrelated to this router-only diff: a $.braces expectation failure that exists independently of this change (reported for triage) and a few tests that passed on retry. The router suites pass locally (filesystem_router 29/29, framework-router 35/35) and the crate checks clean on all targets. Ready for maintainer review.

Comment thread src/router/lib.rs Outdated
…path

With Route.public_path removed, the full public_path intern existed only
as a substrate to rebuild name via pointer offsets.

@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 `@src/router/lib.rs`:
- Around line 1031-1034: Trim both new borrowck NOTE comment blocks near the
post-if bindings and the corresponding block around the alternate route handling
to three lines or fewer, preserving only the essential explanation of the borrow
lifetime reshaping.
🪄 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: 2b711040-78bc-4b46-b492-59f03d6e9709

📥 Commits

Reviewing files that changed from the base of the PR and between 5fc6ede and 09379f8.

📒 Files selected for processing (1)
  • src/router/lib.rs

Comment thread src/router/lib.rs Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — dead-code sweep with all cascade findings from earlier rounds now applied.

What was reviewed:

  • Re-grepped every removed symbol repo-wide; remaining items_hash/public_path hits are on unrelated types (Watcher SoA, bundler options).
  • Traced the Route::parse non-index arm refactor: interning name directly yields byte-identical name/match_name; has_uppercase still scans the pre-intern buffer; NLL drops the route_file_buf borrow before the abs-path block reborrows it.
  • Confirmed api::LoadedRouteConfig re-export stays live via to_api(), and the sole remaining PathnameScanner hit in this file is a comment.
Extended reasoning...

Overview

Single-file dead-code sweep of src/router/lib.rs (-102 lines). Removes eight unreferenced pub items ported from Zig that never gained Rust callers, plus the write-only fields/columns they cascaded to (RouteIndexList.public_path/.hash, RouteIndex fields, Routes.index_id, Route.public_path). The only non-pure-deletion hunk is in Route::parse: the non-index arm now interns name directly into DirnameStore instead of interning the full public_path and re-slicing — a mechanical simplification that follows from dropping Route.public_path.

Security risks

None. No parsing of untrusted input changes, no auth/crypto/permissions surface. The router's request-matching path (match_page, Pattern::match_) is untouched.

Level of scrutiny

Moderate. Most hunks are pure deletions where the compiler is the proof. The Route::parse refactor deserved a manual trace since it touches the route-construction hot path and involves borrow-lifetime reasoning around route_file_buf — I walked it and the resulting name/match_name bytes are identical, has_uppercase still reads the buffer-backed public_path local (unchanged), and NLL ends the public_path borrow at its last use before the mutable reborrow below. The index arm now skips a DirnameStore append that only fed the removed field.

Other factors

  • All three cascade findings I raised in earlier passes (items_hash, Routes.index_id, direct-name interning) and the CodeRabbit comment-length nit are addressed and marked resolved; nothing outstanding on the thread.
  • Maintainer explicitly asked to resume the sweep.
  • Author reports filesystem_router.test.ts (29/29) and framework-router.test.ts (35/35) pass, plus bun_router cross-target checks including the Windows #[cfg] block that lost a debug_assert.
  • I re-verified via grep that none of the removed symbols have callers outside this file; the surviving items_hash/.public_path hits are on unrelated Watcher/bundler types, and filesystem_router.rs uses bun_object::get_public_path (different symbol).
  • No new test is expected here per REVIEW.md's rationale — pure dead-code removal has no fail-before case.

Jarred-Sumner pushed a commit that referenced this pull request Aug 1, 2026
…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 -->
Jarred-Sumner added a commit that referenced this pull request Aug 1, 2026
…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>
Jarred-Sumner added a commit that referenced this pull request Aug 2, 2026
…_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>
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