Skip to content

Remove dead code from webcore C++, highway_strings, inspector agents, InlineBlob, Ipc.ts - #36791

Merged
Jarred-Sumner merged 11 commits into
mainfrom
claude/farm/4f89a6cf/dead-code-webcore-inline-extern
Aug 3, 2026
Merged

Remove dead code from webcore C++, highway_strings, inspector agents, InlineBlob, Ipc.ts#36791
Jarred-Sumner merged 11 commits into
mainfrom
claude/farm/4f89a6cf/dead-code-webcore-inline-extern

Conversation

@robobun

@robobun robobun commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Net -817 lines (+82 / -899) across 39 files. Every removed symbol was verified via rg across src/ and build/debug/codegen/ to have zero remaining references; bun bd and bun run rust:check-all (all CI target triples) pass.

Whole-file deletions (C++ headers)

  • src/jsc/bindings/TextCodecASCIIFastPath.h (78 lines): never #included anywhere under src/, scripts/, cmake/, or generated code. Defines PAL::UCharByteFiller / PAL::copyASCIIMachineWord, neither referenced.
  • src/jsc/bindings/webcore/Node.h (108 lines): defines WebCore::Node which is never instantiated, subclassed, or referenced as a type. No WTF_MAKE_TZONE_ALLOCATED_IMPL(Node) exists so it could never link. Removed the two #include "Node.h" lines in WebCoreOpaqueRoot.h and EventTargetHeaders.h (neither file uses the type).
  • src/jsc/bindings/webcore/JSDOMWindow.h, JSServiceWorker.h, JSWindowProxy.h: one-line stub headers. Removed their #include sites in JSMessageEvent.cpp, JSMessageEventCustom.cpp, and the commented-out includes in JSEventTargetCustom.cpp.

Dead extern "C" exports (lost their Rust caller in #35002)

  • highway_strings.cpp: highway_char_frequency + ScanCharFrequencyImpl (69-line SIMD body) + HWY_EXPORT. Whole-repo rg -w highway_char_frequency = 1 hit (its own definition).
  • TextCodecWrapper.cpp: Bun__isEncodingSupported, Bun__getCanonicalEncodingName. Whole-repo rg = 1 hit each.
  • StrongRef.cpp / .h: Bun__StrongRef__get, Bun__StrongRef__clear. src/jsc/Strong.rs only declares new/set/delete; reads go through a direct pointer load per the comment at StrongRef.cpp:19-26. Also removed StrongRootBlock::clearValue which was only called from Bun__StrongRef__clear.
  • InspectorLifecycleAgent.cpp: Bun__LifecycleAgentReportReload wrapper + InspectorLifecycleAgent::reportReload() method + header decl. No Rust caller.
  • InspectorBunFrontendDevServerAgent.cpp: InspectorBunFrontendDevServerAgent__notifyClientErrorReported / notifyGraphUpdate wrappers + clientErrorReported() / graphUpdate() class methods + header decls. inspector_agent.rs declares the 7 sibling notify* wrappers but not these two.
  • InspectorBunFrontendDevServerAgent.h: removed the stale 9-entry extern "C" block that declared BunFrontendDevServerAgent__notify* (no Inspector prefix), which never matched the actual InspectorBunFrontendDevServerAgent__notify* definitions or the Rust imports.
  • JSS3File.cpp: static bool customHasInstance(...) is a file-scope static function, never referenced in the file. JSS3File's StructureFlags is Base::StructureFlags with no ImplementsHasInstance, so CREATE_METHOD_TABLE cannot pick it up. Removed the matching JSS3File__hasInstance forward decl, the has_instance helper in S3File.rs, and its #[no_mangle] export whose only caller was this static.

Commented-out C++ (>6 months stale per git blame)

  • JSTextEncoder.cpp: disabled DOMJIT declarations, DOMJIT::Signature statics, HashTableValue entries, and two JSC_DEFINE_JIT_OPERATION bodies (83 lines total). Commented out since 2024-09; the non-DOMJIT encode/encodeInto entries remain.
  • JSURLSearchParams.cpp, JSErrorEvent.cpp, JSDOMException.cpp: #if ENABLE(BINDING_INTEGRITY) vtable-pointer scaffolding inside and before toJSNewlyCreated. Commented out since 2022-03.
  • JSPerformance.cpp, JSDOMURL.cpp: JSDOMWindowBase-gated deleteProperty paths in finishCreation/initializeProperties. Commented out since 2024.
  • JSWorkerOptions.cpp: credentials/type dictionary-member parsing. Commented out since 2023-07 / 2025-01.
  • JSEventListener.cpp: handleBeforeUnloadEventReturnValue helper and its call site. Commented out since 2022-03.
  • PerformanceUserTiming.cpp: restrictedMarkFunctions lookup inside convertMarkToTimestamp. Commented out since 2024-01.

Rust

  • Blob.rs: pub struct Inline + impl Inline + impl Default for Inline (48 lines). rg 'InlineBlob|blob::Inline' shows every reference is inside a // comment; the Any enum at Blob.rs:6353 has no Inline variant.
  • Body.rs, server/RequestContext.rs: removed the commented-out InlineBlob match arms that referenced the deleted struct.
  • S3File.rs: has_instance + JSS3File__hasInstance export (only caller was the removed C++ static; see above).
  • streams.rs: BufferAction::get (zero callers; all .get() calls on buffer_action resolve to JsCell::get).
  • FileReader.rs: pub const TAG (zero references).

src/js (>6 months stale per git blame)

  • builtins/Ipc.ts: 131-line commented-out handleConversion map (net.Server/net.Socket/dgram.*). Blame 2025-05-06.
  • internal/fs/streams.ts: commented-out fastPath._getFd() block. Blame 2025-01-25.
  • node/worker_threads.ts: two commented-out type imports. Blame 2023-08-07.

Verification

  • bun bd: builds clean
  • bun run rust:check-all: 10 ok, 0 failed (all target triples)
  • Smoke tests pass: text-encoder.test.js (42 pass), worker_threads.test.ts (91 pass), body.test.ts (448 pass), url.test.ts (18 pass), performance.test.js (7 pass)
  • test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts added: fails on main (every check matches), passes after this diff

Followups (not in this diff)

  • BunFrontendDevServerFrontendDispatcher::clientErrorReported/graphUpdate and LifecycleReporterFrontendDispatcher::reload in the generated inspector protocol are now unreferenced from C++; trimming those lives in the protocol JSON, out of scope here. Downstream consumers that were already inert before this PR (no Rust producer ever existed): the LifecycleReporter.reload listener in packages/bun-vscode/src/features/diagnostics/diagnostics.ts, the ReloadEvent type in packages/bun-inspector-protocol/src/protocol/jsc/index.d.ts, and the two test.todo blocks waiting on clientErrorReported/graphUpdate in test/cli/inspect/BunFrontendDevServer.test.ts.

Scanned and found clean (no confident dead symbols): src/install/ (lockfile/npm/migration/yarn/bin/isolated_install), src/sql/postgres/, src/http/ (websocket, h3_client, AsyncHTTP, HTTPThread, etc.), src/semver/, src/resolver/, src/ast/, src/collections/, src/bun_core/, src/runtime/api/, src/runtime/node/, src/dotenv/, src/patch/, src/glob/, src/event_loop/, src/threading/, src/uws/, src/crash_handler/, src/valkey/, src/runtime/socket/.


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

fails on main (without fix)
ASAN without fix: 5 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-webcore-inline-extern.test.ts
bun test v1.4.0 (e434f18b3)

test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts:
23 |     ["src/jsc/bindings/webcore/JSMessageEventCustom.cpp", /#include "JSDOMWindow\.h"/],
24 |     ["src/jsc/bindings/webcore/JSMessageEvent.cpp", /#include "JSServiceWorker\.h"|#include "JSWindowProxy\.h"/],
25 |     ["src/jsc/bindings/webcore/JSEventTargetCustom.cpp", /"JSDOMWindow\.h"|"JSWindowProxy\.h"/],
26 |   ];
27 |   const found = checks.filter(([f, re]) => re.test(src(f))).map(([f, re]) => `${f}: ${re.source}`);
28 |   expect(found).toEqual([]);
                     ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/jsc/bindings/WebCoreOpaqueRoot.h: #include "Node\.h"",
+   "src/jsc/bindings/webcore/EventTargetHeaders.h: #include "Node\.h"",
+   "src/jsc/bindings/webcore/JSMessageEventCustom.cpp: #include "JSDOMWindow\.h"",
+   "src/jsc/bindings/webcore/JSMessageEvent.cpp: #include "JSServiceWorker\.h"|#include "JSWindowProxy\.h"",
+   "src/jsc
... (truncated)

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

test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts:
23 |     ["src/jsc/bindings/webcore/JSMessageEventCustom.cpp", /#include "JSDOMWindow\.h"/],
24 |     ["src/jsc/bindings/webcore/JSMessageEvent.cpp", /#include "JSServiceWorker\.h"|#include "JSWindowProxy\.h"/],
25 |     ["src/jsc/bindings/webcore/JSEventTargetCustom.cpp", /"JSDOMWindow\.h"|"JSWindowProxy\.h"/],
26 |   ];
27 |   const found = checks.filter(([f, re]) => re.test(src(f))).map(([f, re]) => `${f}: ${re.source}`);
28 |   expect(found).toEqual([]);
                     ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/jsc/bindings/WebCoreOpaqueRoot.h: #include "Node\.h"",
+   "src/jsc/bindings/webcore/EventTargetHeaders.h: #include "Node\.h"",
+   "src/jsc/bindings/webcore/JSMessageEventCustom.cpp: #include "JSDOMWindow\.h"",
+   "src/jsc/bindings/webcore/JSMessageEvent.cpp: #include "JSServiceWorker\.h"|#include "JSWindowProxy\.h"",
+   "src/jsc/bindings/webcore/JSEventTargetCustom.cpp: "JSDOMWindow\.h"|"JSWindowProxy\.h"",
+ ]

- Expected  - 1
+ Received  + 7

      at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbol
... (truncated)
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts
bun test v1.4.0 (e434f18b3)

test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts:
(pass) #includes of deleted webcore/bindings headers do not reappear [16.17ms]
(pass) dead extern C wrappers and cascaded methods do not reappear [17.51ms]
(pass) commented-out DOMJIT/BINDING_INTEGRITY blocks in webcore do not reappear [17.74ms]
(pass) dead InlineBlob struct and S3File hasInstance do not reappear [22.02ms]
(pass) commented-out handleConversion/fs-stream blocks in src/js do not reappear [7.89ms]

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

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 723ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/39] gen cpp.rs (cppbind)
[2/39] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 238 extern-C blocks audited
[3/39] gen JS modules (bundle-modules)
Preprocess modules (8651ms)
Bundle modules (39ms)
Postprocesss modules (34ms)
Bundle Functions (673ms)
Generate Code (18ms)

[9.43s] Bundled "src/js" for production
  2559 kb
  193 internal modules
  13 native modules
  90 internal functions across 19 files
[3/29] 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�[92m
... (truncated)
diff hotspot
src/js/builtins/Ipc.ts                             | 131 ---------------------
 src/js/internal/fs/streams.ts                      |  13 --
 src/js/node/worker_threads.ts                      |   2 -
 src/jsc/bindings/DOMWrapperWorld.cpp               |   2 -
 .../InspectorBunFrontendDevServerAgent.cpp         |  28 -----
 .../bindings/InspectorBunFrontendDevServerAgent.h  |  16 ---
 src/jsc/bindings/InspectorLifecycleAgent.cpp       |  13 --
 src/jsc/bindings/InspectorLifecycleAgent.h         |   1 -
 src/jsc/bindings/JSDOMWrapper.cpp                  |   7 --
 src/jsc/bindings/JSS3File.cpp                      |  26 ----
 src/jsc/bindings/JSS3File.h                        |   2 -
 src/jsc/bindings/StrongRef.cpp                     |  10 --
 src/jsc/bindings/StrongRef.h                       |   2 -
 src/jsc/bindings/StrongRootBlock.h                 |  15 ---
 src/jsc/bindings/TextCodecASCIIFastPath.h          |  78 ------------
 src/jsc/bindings/TextCodecWrapper.cpp              |  26 ----
 src/jsc/bindings/WebCoreOpaqueRoot.h               |   2 -
 src/jsc/bindings/highway_strings.cpp               |  78 ------------
 src/jsc/bindings/webcore/EventTargetHeaders.h      |   1 -
 src/jsc/bindings/webcore/JSDOMException.cpp        |  30 -----
 src/jsc/bindings/webcore/JSDOMPromise.cpp          |   2 -
 src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp  |   4 -
 src/jsc/bindings/webcore/JSDOMURL.cpp              |  12 --
 src/jsc/bindings/webcore/JSDOMWindow.h             |   1 -
 src/jsc/bindings/webcore/JSErrorEvent.cpp          |  29 -----
 src/jsc/bindings/webcore/JSErrorHandler.cpp        |   3 -
 src/jsc/bindings/webcore/JSEventListener.cpp       |  27 -----
 src/jsc/bindings/webcore/JSEventTargetCustom.cpp   |   5 -
 src/jsc/bindings/webcore/JSMessageEvent.cpp        |   2 -
 src/jsc/bindings/webcore/JSMessageEventCustom.cpp  |   3 -
 src/jsc/bindings/webcore/JSPerformance.cpp         |  17 ---
 src/jsc/bindings/webcore/JSServiceWorker.h       
... (truncated)

gate history · 3 passed · 1 rejected · iteration 2

evidence per changed file
file                                                     reads  edits  tests
src/js/builtins/Ipc.ts                                       1      1      0
src/js/internal/fs/streams.ts                                1      1      0
src/js/node/worker_threads.ts                                1      1      0
src/jsc/bindings/DOMWrapperWorld.cpp                         1      1      0
src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp      2      2      0
src/jsc/bindings/InspectorBunFrontendDevServerAgent.h        1      1      0
src/jsc/bindings/InspectorLifecycleAgent.cpp                 2      2      0
src/jsc/bindings/InspectorLifecycleAgent.h                   1      1      0
src/jsc/bindings/JSDOMWrapper.cpp                            1      1      0
src/jsc/bindings/JSS3File.cpp                                3      3      0
src/jsc/bindings/JSS3File.h                                  1      1      0
src/jsc/bindings/StrongRef.cpp                               1      1      0
src/jsc/bindings/StrongRef.h                                 1      1      0
src/jsc/bindings/StrongRootBlock.h                           2      2      0
src/jsc/bindings/TextCodecASCIIFastPath.h                    1      0      0
src/jsc/bindings/TextCodecWrapper.cpp                        1      1      0
(+ 30 more files)

… InlineBlob, Ipc.ts

C++ bindings:
- Delete TextCodecASCIIFastPath.h (78 lines, never #included)
- Delete webcore/Node.h (108 lines, WebCore::Node never instantiated or subclassed) and its two #include sites
- Delete stub headers JSDOMWindow.h, JSServiceWorker.h, JSWindowProxy.h and their #include sites
- highway_strings.cpp: remove ScanCharFrequencyImpl, HWY_EXPORT, and highway_char_frequency (no Rust caller since #35002)
- TextCodecWrapper.cpp: remove Bun__isEncodingSupported and Bun__getCanonicalEncodingName (no Rust caller since #35002)
- StrongRef: remove Bun__StrongRef__get, Bun__StrongRef__clear, StrongRootBlock::clearValue (Rust reads the slot directly)
- InspectorLifecycleAgent: remove Bun__LifecycleAgentReportReload wrapper and reportReload() method (no Rust caller)
- InspectorBunFrontendDevServerAgent: remove notifyClientErrorReported/notifyGraphUpdate wrappers, their class methods, and the stale mismatched-prefix extern block in the header
- JSS3File.cpp: remove file-scope static customHasInstance (never wired to a method table; StructureFlags has no ImplementsHasInstance)

C++ commented-out code (>6 months stale per git blame):
- JSTextEncoder.cpp: disabled DOMJIT declarations, signatures, hash-table entries and JSC_DEFINE_JIT_OPERATION bodies
- JSURLSearchParams/JSErrorEvent/JSDOMException: BINDING_INTEGRITY vtable-check scaffolding
- JSPerformance/JSDOMURL/JSWorkerOptions: JSDOMWindowBase-gated property-deletion paths
- JSEventListener: beforeunload return-value handling (helper definition and call site)
- PerformanceUserTiming: restrictedMarkFunctions lookup in convertMarkToTimestamp

Rust:
- Blob.rs: remove struct Inline and its impls (every reference in Body.rs/RequestContext.rs is commented out; Any enum has no Inline variant)
- Body.rs, RequestContext.rs: remove the commented-out InlineBlob match arms that referenced it
- S3File.rs: remove has_instance and the JSS3File__hasInstance export (its only C++ caller is the removed customHasInstance)
- streams.rs: remove BufferAction::get (zero callers)
- FileReader.rs: remove unused TAG const

src/js (>6 months stale per git blame):
- builtins/Ipc.ts: remove 131-line commented-out handleConversion map
- internal/fs/streams.ts: remove commented-out fastPath._getFd block
- node/worker_threads.ts: remove commented-out type imports

Verified: rg across src/ and build/debug/codegen/ shows zero remaining references for every removed symbol; bun bd and rust:check-all (all targets) pass.
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This cleanup removes obsolete native APIs, runtime types, commented-out implementations, unused includes, and deleted headers. It also adds source-lint checks that prevent removed symbols and code blocks from returning.

Changes

Obsolete code and symbol cleanup

Layer / File(s) Summary
Native binding and inspector API removal
src/jsc/bindings/...
Removed obsolete inspector notifications, reload reporting, S3 construction and instance checks, StrongRef operations, root-block methods, and text codec query exports.
Runtime type and stream cleanup
src/runtime/webcore/..., src/runtime/server/RequestContext.rs
Removed the Inline blob representation, inactive InlineBlob paths, the FileReader stream tag, and BufferAction::get.
WebCore and JavaScript source cleanup
src/jsc/bindings/webcore/..., src/js/internal/fs/streams.ts
Removed obsolete commented implementations, headers, validation scaffolding, disabled behavior, performance scaffolding, and inactive stream logic.
Dead-symbol regression coverage
test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts
Added checks for deleted headers, wrappers, runtime symbols, conversion blocks, and filesystem-stream code.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: removal of dead code across WebCore, inspector agents, InlineBlob, highway_strings, and Ipc.ts.
Description check ✅ Passed The description explains the changes, lists affected areas, documents verification results, and includes follow-up scope details.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts`:
- Line 51: Update the JSDOMURL.cpp regex entry in the dead-symbol lint test to
match only the known commented-out createObjectURL/DeletePropertyMode block,
anchoring it to the expected commented lines or reproducing the exact removed
block. Do not use a broad pattern that begins at arbitrary comments or spans
unrelated content.
- Around line 15-25: Update the deleted-header check in the “deleted
webcore/bindings header files do not reappear” test to determine whether each
path exists in Git’s tracked tree via git ls-tree, rather than using the
working-tree exists helper. Preserve the deleted list and empty-result
assertion, and adapt the filtering logic to the Git-state lookup.
🪄 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: 083425f0-8aaf-4156-8b24-7a0de5748baf

📥 Commits

Reviewing files that changed from the base of the PR and between 54bbd5d and e252638.

📒 Files selected for processing (39)
  • src/js/builtins/Ipc.ts
  • src/js/internal/fs/streams.ts
  • src/js/node/worker_threads.ts
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.h
  • src/jsc/bindings/InspectorLifecycleAgent.cpp
  • src/jsc/bindings/InspectorLifecycleAgent.h
  • src/jsc/bindings/JSS3File.cpp
  • src/jsc/bindings/StrongRef.cpp
  • src/jsc/bindings/StrongRef.h
  • src/jsc/bindings/StrongRootBlock.h
  • src/jsc/bindings/TextCodecASCIIFastPath.h
  • src/jsc/bindings/TextCodecWrapper.cpp
  • src/jsc/bindings/WebCoreOpaqueRoot.h
  • src/jsc/bindings/highway_strings.cpp
  • src/jsc/bindings/webcore/EventTargetHeaders.h
  • src/jsc/bindings/webcore/JSDOMException.cpp
  • src/jsc/bindings/webcore/JSDOMURL.cpp
  • src/jsc/bindings/webcore/JSDOMWindow.h
  • src/jsc/bindings/webcore/JSErrorEvent.cpp
  • src/jsc/bindings/webcore/JSEventListener.cpp
  • src/jsc/bindings/webcore/JSEventTargetCustom.cpp
  • src/jsc/bindings/webcore/JSMessageEvent.cpp
  • src/jsc/bindings/webcore/JSMessageEventCustom.cpp
  • src/jsc/bindings/webcore/JSPerformance.cpp
  • src/jsc/bindings/webcore/JSServiceWorker.h
  • src/jsc/bindings/webcore/JSTextEncoder.cpp
  • src/jsc/bindings/webcore/JSURLSearchParams.cpp
  • src/jsc/bindings/webcore/JSWindowProxy.h
  • src/jsc/bindings/webcore/JSWorkerOptions.cpp
  • src/jsc/bindings/webcore/Node.h
  • src/jsc/bindings/webcore/PerformanceUserTiming.cpp
  • src/runtime/server/RequestContext.rs
  • src/runtime/webcore/Blob.rs
  • src/runtime/webcore/Body.rs
  • src/runtime/webcore/FileReader.rs
  • src/runtime/webcore/S3File.rs
  • src/runtime/webcore/streams.rs
  • test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts
💤 Files with no reviewable changes (37)
  • src/jsc/bindings/WebCoreOpaqueRoot.h
  • src/jsc/bindings/webcore/JSDOMException.cpp
  • src/jsc/bindings/webcore/JSEventTargetCustom.cpp
  • src/jsc/bindings/webcore/JSServiceWorker.h
  • src/runtime/webcore/streams.rs
  • src/jsc/bindings/webcore/JSTextEncoder.cpp
  • src/jsc/bindings/webcore/JSDOMWindow.h
  • src/jsc/bindings/webcore/JSMessageEvent.cpp
  • src/jsc/bindings/StrongRootBlock.h
  • src/js/node/worker_threads.ts
  • src/jsc/bindings/StrongRef.cpp
  • src/jsc/bindings/webcore/JSDOMURL.cpp
  • src/jsc/bindings/webcore/JSEventListener.cpp
  • src/jsc/bindings/webcore/JSWorkerOptions.cpp
  • src/jsc/bindings/StrongRef.h
  • src/jsc/bindings/InspectorLifecycleAgent.h
  • src/jsc/bindings/webcore/PerformanceUserTiming.cpp
  • src/jsc/bindings/webcore/JSMessageEventCustom.cpp
  • src/jsc/bindings/webcore/JSURLSearchParams.cpp
  • src/jsc/bindings/webcore/JSWindowProxy.h
  • src/js/builtins/Ipc.ts
  • src/jsc/bindings/webcore/JSPerformance.cpp
  • src/runtime/webcore/FileReader.rs
  • src/jsc/bindings/webcore/Node.h
  • src/jsc/bindings/TextCodecWrapper.cpp
  • src/jsc/bindings/TextCodecASCIIFastPath.h
  • src/jsc/bindings/JSS3File.cpp
  • src/jsc/bindings/webcore/EventTargetHeaders.h
  • src/jsc/bindings/webcore/JSErrorEvent.cpp
  • src/js/internal/fs/streams.ts
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.h
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp
  • src/runtime/server/RequestContext.rs
  • src/jsc/bindings/InspectorLifecycleAgent.cpp
  • src/runtime/webcore/S3File.rs
  • src/jsc/bindings/highway_strings.cpp
  • src/runtime/webcore/Blob.rs

Comment thread test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts Outdated
Comment thread test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts Outdated
robobun added 2 commits August 2, 2026 16:21
Replace the /s-flagged multi-line pattern with a single-token anchor
(JSDedicatedWorkerGlobalScope) that appeared only in the removed block,
so an unrelated // comment elsewhere in the file can never match.
The verification harness's stash-based src/ revert does not reliably
re-delete whole files (same limitation noted on the MessagePortChannel*.h
stubs), so asserting worktree absence with existsSync fails the with-fix
run. Check the #include lines in surviving files instead, which the
harness applies as ordinary content edits.
Comment thread src/jsc/bindings/webcore/JSTextEncoder.cpp
Comment thread src/jsc/bindings/webcore/PerformanceUserTiming.cpp
Comment thread src/jsc/bindings/StrongRootBlock.h
…, JSTextEncoder

PerformanceUserTiming: the restrictedMarkFunctions map, NavigationTimingFunction
typedef, and isRestrictedMarkName() had zero callers (the only consumer was
the commented-out convertMarkToTimestamp block already removed). Drops the
now-unused PerformanceTiming.h and SortedArrayMap.h includes with them.

StrongRootBlock: read(unsigned) was only called from Bun__StrongRef__get
(removed earlier); same cascade as clearValue().

JSTextEncoder: the DOMJIT*/DFGAbstractHeap includes and using-directive
existed only for the commented-out JSC_DEFINE_JIT_OPERATION bodies.
@robobun

robobun commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 11:14 AM PT - Aug 2nd, 2026

@robobun, your commit e434f18 has 2 failures in Build #87910 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 36791

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

bun-36791 --bun

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts`:
- Line 25: Update the regex entry for JSEventTargetCustom.cpp in the dead-symbol
guard to match an actual preprocessor include directive for JSDOMWindow.h or
JSWindowProxy.h, rather than matching those names anywhere in the file. Keep the
pattern narrowly scoped and consistent with the exact include-line matching used
by the neighboring entries.
🪄 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: 644f494e-f938-4b43-a81c-c832064d1042

📥 Commits

Reviewing files that changed from the base of the PR and between 65c85f1 and ed63b16.

📒 Files selected for processing (5)
  • src/jsc/bindings/StrongRootBlock.h
  • src/jsc/bindings/webcore/JSTextEncoder.cpp
  • src/jsc/bindings/webcore/PerformanceUserTiming.cpp
  • src/jsc/bindings/webcore/PerformanceUserTiming.h
  • test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts
💤 Files with no reviewable changes (4)
  • src/jsc/bindings/webcore/PerformanceUserTiming.h
  • src/jsc/bindings/webcore/JSTextEncoder.cpp
  • src/jsc/bindings/webcore/PerformanceUserTiming.cpp
  • src/jsc/bindings/StrongRootBlock.h

Comment thread test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts Outdated
Narrow the pattern to the quoted include form so a prose comment mentioning
the header name cannot false-positive. The removed lines in this file were
commented-out includes, so the quoted form still catches both live and
commented #include directives.
Comment thread src/jsc/bindings/InspectorBunFrontendDevServerAgent.h
Comment thread src/jsc/bindings/JSS3File.cpp
Comment thread src/runtime/server/RequestContext.rs
Comment thread src/jsc/bindings/webcore/JSEventTargetCustom.cpp
robobun and others added 2 commits August 2, 2026 17:11
JSS3File: BUN__createJSS3File has zero callers (born dead in #36588; only
BUN__createJSS3FileUnsafely is wired to Rust). Remove it, constructS3File,
the JSS3File__construct extern decl, and the Rust construct/construct_internal
chain plus its now-unused PathLikeExt import.

InspectorBunFrontendDevServerAgent.cpp: drop orphaned m_globalobject
initializer comment and redundant UNUSED_PARAM (parameter is used).

RequestContext.rs: drop stale TODO referencing the deleted InlineBlob type.

Remove commented-out #include "JSDOMWindow.h" from the 5 remaining
sibling files (DOMWrapperWorld, JSDOMWrapper, JSErrorHandler,
JSDOMPromise, JSDOMPromiseDeferred).

source-lints: add \b anchor so BunFrontendDevServerAgent__notify doesn't
match the live InspectorBunFrontendDevServerAgent__notify* wrappers;
broaden RequestContext/S3File guards to cover the new deletions.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts`:
- Line 81: Update the Rust method regex guards in the dead-symbol test for
S3File so each removed method pattern is constrained to its owning impl block,
while still matching the intended construct_internal_js symbol and avoiding
unrelated methods or comments elsewhere in the file. Preserve the existing
JavaScript symbol checks and scope changes to the pattern entry for
src/runtime/webcore/S3File.rs.
🪄 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: cc1ab9e3-d18a-443a-8cc1-0475302fac47

📥 Commits

Reviewing files that changed from the base of the PR and between e8b189f and a9daf04.

📒 Files selected for processing (11)
  • src/jsc/bindings/DOMWrapperWorld.cpp
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp
  • src/jsc/bindings/JSDOMWrapper.cpp
  • src/jsc/bindings/JSS3File.cpp
  • src/jsc/bindings/JSS3File.h
  • src/jsc/bindings/webcore/JSDOMPromise.cpp
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp
  • src/jsc/bindings/webcore/JSErrorHandler.cpp
  • src/runtime/server/RequestContext.rs
  • src/runtime/webcore/S3File.rs
  • test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts
💤 Files with no reviewable changes (10)
  • src/jsc/bindings/DOMWrapperWorld.cpp
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp
  • src/jsc/bindings/webcore/JSDOMPromise.cpp
  • src/jsc/bindings/webcore/JSErrorHandler.cpp
  • src/jsc/bindings/JSDOMWrapper.cpp
  • src/jsc/bindings/JSS3File.h
  • src/runtime/server/RequestContext.rs
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp
  • src/jsc/bindings/JSS3File.cpp
  • src/runtime/webcore/S3File.rs

Comment thread test/internal/source-lints/dead-symbols-webcore-inline-extern.test.ts Outdated
Comment thread src/jsc/bindings/InspectorLifecycleAgent.cpp
Comment thread src/jsc/bindings/webcore/JSWorkerOptions.cpp
JSWorkerOptions.cpp: JSFetchRequestCredentials.h / JSWorkerType.h (paired with
the removed credentials/type parsing blocks).

JSEventListener.cpp: BeforeUnloadEvent.h and adjacent commented-out includes
(paired with the removed handleBeforeUnloadEventReturnValue helper).
@robobun

robobun commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI status: the diff is green on the code it touches. Remaining failures are unrelated to this change:

  • test/js/bun/spawn/spawn-maxbuf.test.ts on linux aarch64 (builds 87906, 87910): expect(timeEnd - timeStart).toBeGreaterThan(100) received exactly 100 (boundary flake in a timing assertion), plus a separate Failed to start File Watcher: EAGAIN panic (inotify resource exhaustion on the CI box). This diff touches nothing under src/runtime/api/bun/subprocess/, src/spawn/, or src/watcher/. The test was unquarantined in 862a285 (this PR's base commit).
  • test/cli/run/run-crash-handler.test.ts on Windows 2019 x64 (builds 87906, 87910): PowerShell crash-report upload timed out (expect(sent).toBe(true) after a 2s wait). This diff touches nothing under src/crash_handler/ or Windows spawn paths.
  • Everything else marked [flaky] passed on retry.

Both [new] failures have been reported to main-break triage. Ready for review; needs a maintainer to merge past the unrelated lane failures.

Comment thread src/jsc/bindings/webcore/JSWorkerOptions.cpp
Jarred-Sumner pushed a commit that referenced this pull request Aug 3, 2026
… and resolver/fs (#36803)

Net: +47 / -1160.

## Removed

- **`src/runtime/node/nodejs_error_code.rs`** (1113 lines): a
340-variant `enum Code` mirroring the Node.js `ERR_*` table. The sole
reference outside its own module was `node_os.rs:269` doing `<&'static
str>::from(ErrorCode::ERR_SYSTEM_ERROR)`, which just produces the string
`"ERR_SYSTEM_ERROR"`. Three other call sites in the same file
(`node_os.rs:938/1220/1539`) already use
`BunString::static_("ERR_SYSTEM_ERROR")` directly, so the remaining one
now does the same. The `jsc::ErrorCode` type (backed by
`ErrorCode.generated.rs`) is the live `ERR_*` table; this enum was a
parallel dead one.
- `rg -n 'nodejs_error_code' src/ build/debug/codegen/ src/codegen/` →
only the `mod` declaration and two explanatory comments (both updated).
- **`dir_iterator::IteratorError`** (11 lines) +
**`runtime::Error::DirIterator`** variant (3 lines): the enum is never
constructed (`rg 'IteratorError::' src/ build/debug/codegen/` → 0 hits),
so the `#[from]` on `Error::DirIterator` can never fire either.
- **`VectorArrayBuffer::to_js`** (4 lines): every caller reads `.value`
directly; `to_js` was never invoked and is not a trait impl.
- **`src/resolver/fs.rs`** commented-out Zig stubs
`statBatch/stat/readFile/readDir` (9 lines): never implemented.

## Verification

```
rg -w <symbol> src/ build/debug/codegen/ src/codegen/
bun bd
bun run rust:check-all   # 10 ok, 0 failed
bun bd test test/js/node/os/ test/js/node/fs/fs.test.ts -t readdir
bun bd test test/bundler/bundler_loader.test.ts
bun bd test test/internal/source-lints/
```

A source-lint test
(`test/internal/source-lints/dead-symbols-nodejs-error-code.test.ts`)
asserts none of these reappear.

## Also scanned (nothing removed)

`src/http/**` (36 files), `src/install/**`, `src/resolver/**`,
`src/ast/**`, `src/semver/**`, `src/valkey/**`, `src/sql/postgres/**`,
`src/collections/**`. Several initial candidates turned out to have
callers under a different crate or via method-call syntax:
`collections::StringMap` (sql_jsc), `semver::string::ArrayHashContext`
(install/lockfile), `NewWriter::{int8,f64,bun_string}` (sql_jsc),
`Level::{gt,eql}` (js_parser), `SinglyLinkedList::len`
(bake/memory_cost), `Target::is_node` (resolve_builtins),
`{Parse,Decode}DataURLError::name()` (bundler/transpiler).

No overlap with open dead-code PRs #36237, #35775, #36791, #36115,
#35437, #35880.

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

---

**[review]** gate passed · iteration 1 · 10 files touched

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

```console
ASAN without fix: 1 FAILED
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-nodejs-error-code.test.ts
bun test v1.4.0 (6071f67)

test/internal/source-lints/dead-symbols-nodejs-error-code.test.ts:
24 |     ["src/runtime/error.rs", /\bDirIterator\b/],
25 |     ["src/runtime/node/types.rs", /impl VectorArrayBuffer \{\n    pub fn to_js\(/],
26 |     ["src/resolver/fs.rs", /pub fn statBatch\(fs: \*FileSystemEntry/],
27 |   ];
28 |   const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`);
29 |   expect(resurrected).toEqual([]);
                           ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/runtime/node.rs: \bnodejs_error_code\b",
+   "src/runtime/node/node_os.rs: crate::node::ErrorCode",
+   "src/runtime/node/dir_iterator.rs: \benum IteratorError\b",
+   "src/runtime/error.rs: \bDirIterator\b",
+   "src/runtime/node/types.rs: impl VectorArrayBuffer \{\n    pub fn to_js\(",
+   "src/resolver/fs.rs: pub fn statBatch\(fs: \*FileSystemEntry",
+ ]

- Expected  - 1
+ Received  + 8

      at <ano
... (truncated)

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

test/internal/source-lints/dead-symbols-nodejs-error-code.test.ts:
24 |     ["src/runtime/error.rs", /\bDirIterator\b/],
25 |     ["src/runtime/node/types.rs", /impl VectorArrayBuffer \{\n    pub fn to_js\(/],
26 |     ["src/resolver/fs.rs", /pub fn statBatch\(fs: \*FileSystemEntry/],
27 |   ];
28 |   const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`);
29 |   expect(resurrected).toEqual([]);
                           ^
error: expect(received).toEqual(expected)

- []
+ [
+   "src/runtime/node.rs: \bnodejs_error_code\b",
+   "src/runtime/node/node_os.rs: crate::node::ErrorCode",
+   "src/runtime/node/dir_iterator.rs: \benum IteratorError\b",
+   "src/runtime/error.rs: \bDirIterator\b",
+   "src/runtime/node/types.rs: impl VectorArrayBuffer \{\n    pub fn to_js\(",
+   "src/resolver/fs.rs: pub fn statBatch\(fs: \*FileSystemEntry",
+ ]

- Expected  - 1
+ Received  + 8

      at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-nodejs-error-code.test.ts:29:23)
(fail) dead Rust symbols in runtime/node + resolver do not reappear [0.74ms]

 0 pass
 1 fail
... (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-nodejs-error-code.test.ts
bun test v1.4.0 (6071f67)

test/internal/source-lints/dead-symbols-nodejs-error-code.test.ts:
(pass) dead Rust symbols in runtime/node + resolver do not reappear [30.31ms]

 1 pass
 0 fail
 1 expect() calls
Ran 1 test across 1 file. [2.02s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 652ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/73] gen ErrorCode+*.h
[2/11] gen cpp.rs (cppbind)
[3/11] gen BunProcess.lut.h
Generating /workspace/bun/build/release/codegen/BunProcess.lut.h from /workspace/bun/src/jsc/bindings/BunProcess.cpp
[4/11] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 238 extern-C blocks audited
[4/11] 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_resolver v0.0.0 (/workspace/bun/src/resolver)
�[1m�[92m   Compiling�[0m bun_router v0.0.0 (/workspace/bun/src/router)
�[1m�[92m   Compiling�[0m bun_bundler v0.0.0 (/workspace/bun/src/bundler)
�[1m�[92m   Compiling�[0m bun_standalone_graph v0.0.0 (/workspace/bun/src/standalone_graph)
�[1m�[92m   Compiling�[0m bun_transpiler v0.0.0 (/workspace/bun/src/transpiler)
�[1m�[92m   Compiling�[0m bun_bunfig v0.0.0 (/workspace/bun/src/bunfig)
�[1m�[92m   Compiling�[0m bun_instal
... (truncated)
```

</details>

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

```
src/jsc/ErrorCode.rs                               |   14 +-
 src/jsc/lib.rs                                     |    4 +-
 src/resolver/fs.rs                                 |    9 -
 src/runtime/error.rs                               |    3 -
 src/runtime/node.rs                                |    4 -
 src/runtime/node/dir_iterator.rs                   |   11 -
 src/runtime/node/node_os.rs                        |    4 +-
 src/runtime/node/nodejs_error_code.rs              | 1113 --------------------
 src/runtime/node/types.rs                          |    4 -
 .../dead-symbols-nodejs-error-code.test.ts         |   30 +
 10 files changed, 35 insertions(+), 1161 deletions(-)
```

</details>

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

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

```
file                                                      reads  edits  tests
src/jsc/ErrorCode.rs                                          3      3      0
src/jsc/lib.rs                                                1      1      0
src/resolver/fs.rs                                            1      1      0
src/runtime/error.rs                                          1      1      0
src/runtime/node.rs                                           1      1      0
src/runtime/node/dir_iterator.rs                              1      1      0
src/runtime/node/node_os.rs                                   1      1      0
src/runtime/node/nodejs_error_code.rs                         0      0      0
src/runtime/node/types.rs                                     1      1      0
…nal/source-lints/dead-symbols-nodejs-error-code.test.ts      2      4      0
```

</details>

<!-- robobun:evidence:end -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@Jarred-Sumner
Jarred-Sumner merged commit e71f6c3 into main Aug 3, 2026
52 of 55 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/4f89a6cf/dead-code-webcore-inline-extern branch August 3, 2026 07:53
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