Skip to content

Remove dead code from bun_url - #34965

Closed
robobun wants to merge 2 commits into
mainfrom
claude/farm/8379814f/dead-code-url
Closed

Remove dead code from bun_url#34965
robobun wants to merge 2 commits into
mainfrom
claude/farm/8379814f/dead-code-url

Conversation

@robobun

@robobun robobun commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Removes unreferenced items from src/url/lib.rs that were carried over from the Zig port but have no callers anywhere in the workspace.

Removed

  • URL::is_localhost(): zero references.
  • QueryStringMap::get_index(): only called by has(), which is itself unused.
  • QueryStringMap::get(): zero references.
  • QueryStringMap::has(): zero references.
  • QueryStringMap::get_all(): only called get_all_with_hash_from_offset(), zero external references.
  • QueryStringMap::get_all_with_hash_from_offset(): only called by get_all().
  • NAME_COUNT_BUF thread-local static: already annotated as unused, for the commented-out Zig path in get_name_count.
  • QueryStringMap.name_count field: set to None at all three construction sites and cloned, never read. Part of the same never-enabled caching mechanism as NAME_COUNT_BUF.
  • use core::cell::RefCell: only used by NAME_COUNT_BUF.
  • Commented-out Zig body inside get_name_count().

Also relaxes get_name_count(&mut self) to &self since the removed caching write was the only mutation.

The only out-of-crate consumer of QueryStringMap is src/runtime/api/filesystem_router.rs, which uses init, init_with_scanner, iter, get_name_count, and str only.

Verification

  • rg for each symbol across src/, build/debug/codegen/, and src/codegen/: zero hits outside src/url/lib.rs.
  • bun bd: builds clean.
  • bun run rust:check-all: all 10 targets pass.
  • bun bd test test/js/bun/util/filesystem_router.test.ts: 29 pass, 0 fail.

Net: 1 file changed, 1 insertion, 65 deletions.

Remove unreferenced items from src/url/lib.rs that were carried over
from the Zig port but have no callers anywhere in the workspace:

- URL::is_localhost()
- QueryStringMap::get_index()
- QueryStringMap::get()
- QueryStringMap::has()
- QueryStringMap::get_all()
- QueryStringMap::get_all_with_hash_from_offset()
- NAME_COUNT_BUF thread_local (already annotated as unused)
- commented-out Zig body in get_name_count()
- core::cell::RefCell import (only used by NAME_COUNT_BUF)

The only consumer of QueryStringMap is src/runtime/api/filesystem_router.rs,
which uses init/init_with_scanner/iter/get_name_count/str only.

Verified: rg across src/ and build/debug/codegen/, bun bd,
bun run rust:check-all (all 10 targets), filesystem_router.test.ts (29 pass).
@robobun

robobun commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 9:44 AM PT - Jul 21st, 2026

@robobun, your commit 9ccba66 has 2 failures in Build #76953 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 34965

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

bun-34965 --bun

@robobun

robobun commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

This is a pure dead-code removal: every deleted item has zero callers anywhere in the workspace (verified by rg across src/, build/debug/codegen/, and src/codegen/). There is no behavior change to regression-test; any test touching the remaining QueryStringMap surface (e.g. test/js/bun/util/filesystem_router.test.ts, 29/29 passing) passes identically before and after, so a fail-before check cannot distinguish the two builds.

The proof of correctness here is the build itself: bun bd and bun run rust:check-all (all 10 targets) both pass. Same shape as the recently-merged #34878 and #34837.

CI on 9ccba66 (build 76953, 193/196 passed): the two red tests are unrelated to this diff.

  • test/js/node/test/parallel/test-http2-reset-flood.js on debian-13 x64-asan: JSC ExceptionScope::assertNoException assertion in HTTP/2 flood handling. HTTP/2 does not use bun_url::QueryStringMap or URL::is_localhost, and removing unreferenced code cannot introduce an exception-scope leak.
  • test/cli/run/no-orphans.test.ts on darwin-14 x64: tagged as pre-existing on main.

The remaining entries (bun-upgrade, complex-workspace, webview-chrome, test-repl-close, bun-create, require-cache, 20144) all passed on retry.

@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 dead-code removal, verified each removed symbol has no remaining callers. The inline nit about name_count is optional cleanup, not blocking.

Extended reasoning...

Overview

Removes 59 lines of unreferenced code from src/url/lib.rs: URL::is_localhost, five QueryStringMap lookup methods (get_index, get, has, get_all, get_all_with_hash_from_offset), the NAME_COUNT_BUF thread-local, its RefCell import, and a commented-out Zig block inside get_name_count. Zero insertions.

Security risks

None. Nothing removed sits on a validation, auth, or input-handling path — is_localhost had no callers, and the QueryStringMap lookup helpers were entirely unreachable (the only out-of-crate consumer, filesystem_router.rs, uses init/init_with_scanner/iter/get_name_count/str only).

Level of scrutiny

Low. This is a mechanical dead-code sweep with no behavior change. I independently grepped src/ for each removed symbol: is_localhost has zero hits; the many get_index hits across the tree are on unrelated types (JSObject, array_hash_map, env maps, etc.) — QueryStringMap itself is imported nowhere outside filesystem_router.rs and url/lib.rs. The PR description reports bun bd, rust:check-all (all 10 targets), and filesystem_router.test.ts all pass, which is the right coverage for this change.

Other factors

The one inline finding — that the name_count: Option<usize> field and the &mut self receiver on get_name_count are now vestigial — is a fair completeness nit for a PR whose stated purpose is dead-code removal, but it was already dead before this change (the only "reader" was the comment being deleted) and has zero runtime impact. Fine to land as-is or fold in as a follow-up.

Comment thread src/url/lib.rs
…to &self

The name_count field was part of the same never-enabled caching mechanism
as NAME_COUNT_BUF and the commented-out get_name_count body: set to None
at all three construction sites, cloned, and never read. With the caching
write gone, get_name_count no longer mutates and can take &self.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next review available in: 3 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: 6311aff8-5acb-4545-8966-e99063051f2e

📥 Commits

Reviewing files that changed from the base of the PR and between e550f2c and 9ccba66.

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

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

@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 dead-code deletion, and the follow-up commit addressed the orphaned name_count field / &mut self nit.

What was reviewed:

  • Grepped src/ and src/codegen/ for every removed symbol (is_localhost, get_index/get/has/get_all/get_all_with_hash_from_offset on QueryStringMap, NAME_COUNT_BUF, name_count) — zero remaining references.
  • Confirmed the only out-of-crate QueryStringMap consumer (filesystem_router.rs) touches none of the removed surface; its get_name_count() call at line 952 is fine with the relaxed &self receiver.
  • wyhash import is still live via init/init_with_scanner.
Extended reasoning...

Overview

Deletion-only change to src/url/lib.rs: removes URL::is_localhost, five unused QueryStringMap lookup methods (get_index, get, has, get_all, get_all_with_hash_from_offset), the NAME_COUNT_BUF thread-local, its RefCell import, and the commented-out Zig memoization body in get_name_count. A second commit (9ccba66) addressed my earlier nit by also removing the never-read name_count: Option<usize> field from the struct/Clone/all three constructors and relaxing get_name_count to &self. Net: 0 insertions, ~65 deletions.

Security risks

None. This is an internal Rust crate (bun_url) with no user-facing surface change; only unreferenced items are removed, and the parsing/decoding paths (PercentEncoding, Scanner, init) are untouched.

Level of scrutiny

Low. Dead-code removal where correctness reduces to "does it still compile everywhere" — which rust:check-all across all 10 targets answers. I independently re-verified via grep that every removed symbol has zero callers in src/ and src/codegen/ (all get_index/.has(/.get( hits in the tree are on unrelated types — ArrayHashMap, JSObject, Strong, env loader, etc.). QueryStringMap appears in exactly two files; the sole external consumer (filesystem_router.rs) uses only init, init_with_scanner, iter, get_name_count, and str, none of which are touched beyond the &mut self&self loosening.

Other factors

  • The &mut self&self change on get_name_count is a strict relaxation; the one call site already had a mutable binding so no caller change is needed, and any future shared-borrow caller now works too.
  • Checked that wyhash is still used (by init/init_with_scanner) after the lookup methods that also used it were removed — no newly-dead imports.
  • My prior inline comment on this PR is resolved; no other reviewer comments are outstanding.
  • filesystem_router.test.ts (29/29) passing per the author covers the remaining live surface. Matches the shape of recently-merged #34878/#34837.

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