Skip to content

Remove dead code from webcore bindings, watcher, node-fallbacks, and misc crates - #37062

Open
robobun wants to merge 9 commits into
mainfrom
claude/farm/919b0a02/dead-code-webcore-codegen-misc
Open

Remove dead code from webcore bindings, watcher, node-fallbacks, and misc crates#37062
robobun wants to merge 9 commits into
mainfrom
claude/farm/919b0a02/dead-code-webcore-codegen-misc

Conversation

@robobun

@robobun robobun commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Scheduled dead-code sweep. Net -1,936 lines across 82 files (+177/-2,113). Areas were chosen to avoid overlap with the open dead-code PRs (#35437, #35775, #35880, #36115, #36237, #37012); all hunks were diffed against those PRs and none of the deletions coincide.

What was removed

webcore C++ bindings (~900 lines)

  • JSDOMConvertBufferSource.h: 11 unused typed-array IDL types (IDLInt8Array, IDLFloat64Array, IDLBigUint64Array, ...) with their Converter/JSConverter specializations and 25 toPossiblyShared*/toUnshared* helpers. Only IDLUint8Array, IDLArrayBuffer, IDLDataView, and IDLArrayBufferView have consumers.
  • IDLTypes.h: IDLDate, IDLUnsupportedType, IDLError, IDLDOMException, IDLScheduledAction, IDLIDBKey/IDLIDBKeyData/IDLIDBValue, the ENABLE(WEBGL) block, and dead forward declarations.
  • JSDOMPromiseDeferred.h/.cpp: the DOMPromiseDeferredBase/DOMPromiseDeferred<T> class cluster, resolveWithJSValue, resolveWithNewlyCreated, resolveCallbackValueWithNewlyCreated, fulfillPromiseWithJSON + parseAsJSON.
  • NetworkLoadMetrics.h: AdditionalNetworkLoadMetricsForWebInspector, PrivacyStance, NetworkLoadPriority, the write-only connection flags, and the PLATFORM(COCOA) copyTimingData decls.
  • Event.h/.cpp: write-only m_defaultHandled/m_isDefaultEventHandlerIgnored bits and their accessors, the now-empty resetBeforeDispatch, and never-overridden relatedTarget virtuals.
  • Smaller: IDLOperationReturningPromise::callReturningOwnPromise/callStaticReturningOwnPromise, IDLAttribute::setPassingPropertyName/setStatic, HTTPHeaderIdentifiers::identifierFor + its pointer-to-member table, EventTarget::isNode, ContextDestructionObserver::protectedScriptExecutionContext, PerformanceTiming::monotonicTimeToIntegerMilliseconds, BufferSource::mutableData, toBufferSource, FetchHeaders::fastSet, ScriptWrappable::offsetOfWrapper, and friends.
  • JSDOMConvertDate.h/.cpp, JSMIMEBindings.h/.cpp, and JSDOMIterator.cpp are stubbed out following the existing convention for superseded files (see the stub comment in MessagePortChannel.h).

build/codegen

  • src/codegen/generate-unified-source-bundles.rb (392 lines): CMake-era ruby script; scripts/build/unified.ts is the live reimplementation and nothing invokes ruby.

node-fallbacks

  • util.js: 270-line commented-out legacy util.types body (stale since 2025).
  • package.json/bun.lock: 13 dependencies no fallback imports (the force-externalized builtin names never resolve to node_modules), including esbuild. tsconfig.json paths trimmed to match.

file watcher

  • WatchItem.loader was write-only: every add_file path stored it, no MultiArrayList column accessor ever read it. Removed the column, the bun_watcher::Loader cycle-break newtype, its drift-guard assert, and the loader parameter from the whole add_file/add_file_by_path_slow chain (watcher, hot_reloader, bundler, jsc_hooks, RuntimeTranspilerStore, AsyncModule, VirtualMachine, test_command). AsyncModule.loader and InitOpts.loader fell out as dead once the watcher stopped storing it.

Rust crates

  • sha_hmac: unused OpenSSL-3-deprecated hashers (hashers::SHA512/SHA384/SHA512_256/RIPEMD160) and the never-wired MD5_SHA1/Blake2 EVP wrappers.
  • csrf: Error::InvalidToken/ExpiredToken/DecodingFailed, never constructed (verify() returns bool).
  • valkey: six RedisError variants the parser never produces (InvalidArgument, InvalidArray, InvalidBigNumber, InvalidErrorString, InvalidNull, InvalidSimpleString); the one string-parse site feeds from the runtime error name set, which contains none of them.
  • picohttp: write-only Request.minor_version/bytes_read fields (Response keeps both).
  • windows_sys: consts, types, and extern decls whose only references were unused re-exports (SetFileInformationByHandle, ResumeThread, FILE_ATTRIBUTE_*, CTRL_LOGOFF_EVENT, PebView, Curdir, STATUS_SUCCESS, ...), plus those re-export lines.
  • zlib/zlib_sys: deflateInit_/inflateInit_ decls (all code uses the *2_ variants).
  • libarchive, css_jsc: commented-out Zig code left from the port.
  • opaque: the opaque_mut_nn macro arm (zero call sites across ~180 instantiations).
  • bake: BakeProdSourceMap no_mangle export C++ never declares or calls.
  • BunObject: the Rust nanoseconds host_fn shadowed by the C++ functionBunNanoseconds the lut actually uses, plus stale macro(...) entries in BunObject+exports.h.
  • Misc: exe_format InputIsSigned, md Setextheader, myers_diff OutOfMemory, node_fs unused trait method, unused re-export tokens in node.rs/sql_jsc/resolver.

built-in JS

  • internal/repl/node-primordials.js: 14 export keys none of the 13 repl/readline consumers reference, with their backing captures.
  • internal-for-testing.ts: npa, npmTag, lsanDoLeakCheck (plus its C++ backing), all with zero references in test/, bench/, or scripts/.
  • Unused export keys in internal/fs/watch.ts and internal/readline/interface.js.

Verification

  • Every symbol rg'd across src/, packages/, test/, and build/debug/codegen before deletion, including token-pasted C++ names, $zig/$cpp string references, and strum string-construction paths.
  • cargo check --workspace on all 10 CI target triples (bun run rust:check-all): 10 ok, 0 failed.
  • Full bun bd debug build passes.
  • The dead-code escape inventory (dead-code-escape-limits.json) was regenerated. A source-lint file pinning the removals was part of earlier revisions and removed during review.
  • Smoke tests pass: fetch headers, performance entries, abort GC, CryptoHasher, CSRF, watch mode, browser bundling (node-fallbacks), readline. 582 tests, 0 failures.

[review] gate passed · iteration 1 · 89 files touched

fails on main (without fix)
ASAN without fix: 4 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-watcher-fallbacks.test.ts
bun test v1.4.0 (c16c60eb6)

test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:
19 |   return readFileSync(path.join(repoRoot, p), "utf8");
20 | }
21 | 
22 | function expectAbsent(checks: Array<[string, RegExp]>) {
23 |   for (const [file, re] of checks) {
24 |     expect(re.test(src(file)), `${file} should not match ${re}`).toBe(false);
                                                                      ^
error: src/jsc/bindings/webcore/JSDOMConvertBufferSource.h should not match /\bIDLBigUint64Array\b/

Expected: false
Received: true

      at expectAbsent (/workspace/bun/test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:24:66)
      at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:29:3)
(fail) dead webcore C++ symbols do not reappear [24.52ms]
19 |   return readFileSync(path.join(repoRoot, p), "utf8");
20 | }
21 | 
22 | function expectAbsent(checks: Array<
... (truncated)

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

test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:
19 |   return readFileSync(path.join(repoRoot, p), "utf8");
20 | }
21 | 
22 | function expectAbsent(checks: Array<[string, RegExp]>) {
23 |   for (const [file, re] of checks) {
24 |     expect(re.test(src(file)), `${file} should not match ${re}`).toBe(false);
                                                                      ^
error: src/jsc/bindings/webcore/JSDOMConvertBufferSource.h should not match /\bIDLBigUint64Array\b/

Expected: false
Received: true

      at expectAbsent (/workspace/bun/test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:24:66)
      at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:29:3)
(fail) dead webcore C++ symbols do not reappear [0.39ms]
19 |   return readFileSync(path.join(repoRoot, p), "utf8");
20 | }
21 | 
22 | function expectAbsent(checks: Array<[string, RegExp]>) {
23 |   for (const [file, re] of checks) {
24 |     expect(re.test(src(file)), `${file} should not match ${re}`).toBe(false);
                                                     
... (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-watcher-fallbacks.test.ts
bun test v1.4.0 (c16c60eb6)

test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts:
(pass) dead webcore C++ symbols do not reappear [43.13ms]
(pass) watcher loader column stays deleted [5.67ms]
(pass) dead Rust symbols do not reappear [46.06ms]
(pass) dead JS builtin exports do not reappear [9.41ms]

 4 pass
 0 fail
 60 expect() calls
Ran 4 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 673ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/130] install /workspace/bun/src/node-fallbacks
bun install v1.4.0-canary.1 (5c4db5bde)

Checked 111 installs across 104 packages (no changes) [3.00ms]
[2/130] gen node-fallbacks/react-refresh.js
Bundled 1 module in 3ms

  react-refresh.js  4.81 KB  (entry point)

[3/130] gen ErrorCode+*.h
[4/130] gen generated_host_exports.rs
generated_host_exports.rs: 92 exports (host=3, lazy=10, generic=79, rust=0); 239 extern-C blocks audited
[5/130] gen node-fallbacks/*.js
[6/130] gen cpp.rs (cppbind)
[7/130] gen JS modules (bundle-modules)
Preprocess modules (8633ms)
Bundle modules (47ms)
Postprocesss modules (258ms)
Bundle Functions (650ms)
Generate Code (23ms)

[9.63s] Bundled "src/js" for production
  2569 kb
  193 internal modules
  13 native modules
  84 internal functions across 17 files
[7/129] 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_opaque v0.0.0 (
... (truncated)
diff hotspot
src/bun_core/windows_sys.rs                        |   2 +-
 src/bundler/bundle_v2.rs                           |   5 +-
 src/codegen/generate-js2native.ts                  |   1 -
 src/codegen/generate-unified-source-bundles.rb     | 392 ---------------------
 src/csrf/lib.rs                                    |   3 -
 src/css_jsc/css_internals.rs                       |  11 -
 src/exe_format/pe.rs                               |   2 -
 src/http/lib.rs                                    |   4 -
 src/install_jsc/dependency_jsc.rs                  | 211 -----------
 src/install_jsc/lib.rs                             |   8 +-
 src/install_jsc/update_request_jsc.rs              |  91 -----
 src/js/internal-for-testing.ts                     |  11 -
 src/js/internal/fs/watch.ts                        |   2 +-
 src/js/internal/readline/interface.js              |   1 -
 src/js/internal/repl/node-primordials.js           |  23 +-
 src/jsc/AsyncModule.rs                             |   6 -
 src/jsc/RuntimeTranspilerStore.rs                  |   2 -
 src/jsc/VirtualMachine.rs                          |   4 +-
 src/jsc/bindings/BunObject+exports.h               |   6 -
 src/jsc/bindings/ErrorCode.ts                      |   4 -
 src/jsc/bindings/IDLTypes.h                        |  50 +--
 src/jsc/bindings/InternalForTesting.cpp            |  15 +-
 src/jsc/bindings/InternalForTesting.h              |   1 -
 src/jsc/bindings/ZigGlobalObject.cpp               |   1 -
 src/jsc/bindings/webcore/BufferSource.h            |  13 -
 .../webcore/ContextDestructionObserver.cpp         |   5 -
 .../bindings/webcore/ContextDestructionObserver.h  |   1 -
 src/jsc/bindings/webcore/Event.cpp                 |   7 -
 src/jsc/bindings/webcore/Event.h                   |  12 -
 src/jsc/bindings/webcore/EventTarget.cpp           |   6 -
 src/jsc/bindings/webcore/EventTarget.h             |   2 -
 src/jsc/bindings/webcore/FetchHeaders.h            |   1 -
 src/jsc/bindings/webc
... (truncated)

gate history · 2 passed · 1 rejected · iteration 1

evidence per changed file
file                                            reads  edits  tests
src/bun_core/windows_sys.rs                         0      0      0
src/bundler/bundle_v2.rs                            0      0      0
src/codegen/generate-js2native.ts                   0      0      0
src/codegen/generate-unified-source-bundles.rb      0      0      0
src/csrf/lib.rs                                     0      0      0
src/css_jsc/css_internals.rs                        0      0      0
src/exe_format/pe.rs                                0      0      0
src/http/lib.rs                                     0      0      0
src/install_jsc/dependency_jsc.rs                   0      0      0
src/install_jsc/lib.rs                              0      0      0
src/install_jsc/update_request_jsc.rs               0      0      0
src/js/internal-for-testing.ts                      0      0      0
src/js/internal/fs/watch.ts                         0      0      0
src/js/internal/readline/interface.js               0      0      0
src/js/internal/repl/node-primordials.js            1      0      0
src/jsc/AsyncModule.rs                              0      0      0
(+ 73 more files)

…misc crates

Net -1936 lines across 82 files. Every deleted symbol was verified to have
zero references across src/, packages/, test/, and regenerated codegen
output; removals were validated by cargo check on all 10 target triples
and a full debug build.

Superseded compiled files (JSDOMConvertDate, JSMIMEBindings,
JSDOMIterator.cpp) follow the existing one-line stub convention instead
of deletion.
@github-actions github-actions Bot added the claude label Aug 6, 2026
Stash round-trips can temporarily restore files a branch deletes, so an
existsSync assertion on the deleted ruby script is unreliable; the
content checks carry the lint.
@coderabbitai

coderabbitai Bot commented Aug 6, 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

The pull request removes obsolete APIs, exports, loader metadata, binding implementations, platform declarations, fallback code, and dead-code exceptions. It adds source-lint checks for deleted symbols.

Changes

Watcher loader removal

Layer / File(s) Summary
Watcher registration API and callers
src/watcher/*, src/jsc/*, src/runtime/*, src/bundler/bundle_v2.rs
Watcher registration APIs and call sites no longer pass or store loader metadata.

WebCore binding cleanup

Layer / File(s) Summary
Binding types and conversions
src/jsc/bindings/IDLTypes.h, src/jsc/bindings/webcore/JSDOMConvert*, src/jsc/bindings/webcore/BufferSource.h
Obsolete IDL types, date conversion, typed-array conversions, and buffer helpers were removed.
WebCore APIs and exports
src/jsc/bindings/webcore/*, src/jsc/bindings/BunObject+exports.h, src/js/internal/*
Unused event, promise, MIME, iterator, metrics, timing, header, wrapper, callback, and internal APIs were removed or stubbed.

Runtime and platform cleanup

Layer / File(s) Summary
Runtime, fallback, and data APIs
src/runtime/*, src/node-fallbacks/*, src/http/lib.rs, src/picohttp/lib.rs, src/valkey/*, src/sha_hmac/*
Unused exports, fields, error variants, fallback mappings, protocol mappings, hashers, and source-map access were removed.
Platform and support declarations
src/windows_sys/*, src/sys/windows/mod.rs, src/zlib_sys/*, src/opaque/lib.rs, src/libarchive/lib.rs
Unused platform symbols, FFI declarations, opaque-handle accessors, and obsolete commented code were removed.

Dead-symbol regression coverage

Layer / File(s) Summary
Source-lint validation
test/internal/source-lints/*
Source-lint checks verify that deleted symbols and fallback code remain absent.

Possibly related PRs

Suggested reviewers: jarred-sumner

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: removing dead code across WebCore bindings, the watcher, node fallbacks, and related crates.
Description check ✅ Passed The description explains the removals and provides detailed verification results, including builds, checks, and smoke tests.

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 `@src/jsc/bindings/InternalForTesting.cpp`:
- Around line 51-52: Remove the obsolete jsFunction_lsanDoLeakCheck declaration
from InternalForTesting.h, leaving the remaining testing bindings unchanged
since no implementation or registration exists.

In `@test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts`:
- Around line 137-140: Replace the deleted-path existsSync assertion in the test
“the CMake-era unified-source ruby script stays deleted” with a stable surviving
source contract, such as verifying the live TypeScript implementation or build
references no longer invoke Ruby. If no reliable contract is available, remove
this assertion and leave deletion verification to the appropriate external
mechanism.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 200f545f-63e1-4283-aa7e-3edd78434c05

📥 Commits

Reviewing files that changed from the base of the PR and between d18ddfc and 47546b8.

⛔ Files ignored due to path filters (1)
  • src/node-fallbacks/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (81)
  • src/bun_core/windows_sys.rs
  • src/bundler/bundle_v2.rs
  • src/codegen/generate-unified-source-bundles.rb
  • src/csrf/lib.rs
  • src/css_jsc/css_internals.rs
  • src/exe_format/pe.rs
  • src/http/lib.rs
  • src/js/internal-for-testing.ts
  • src/js/internal/fs/watch.ts
  • src/js/internal/readline/interface.js
  • src/js/internal/repl/node-primordials.js
  • src/jsc/AsyncModule.rs
  • src/jsc/RuntimeTranspilerStore.rs
  • src/jsc/VirtualMachine.rs
  • src/jsc/bindings/BunObject+exports.h
  • src/jsc/bindings/IDLTypes.h
  • src/jsc/bindings/InternalForTesting.cpp
  • src/jsc/bindings/ZigGlobalObject.cpp
  • src/jsc/bindings/webcore/BufferSource.h
  • src/jsc/bindings/webcore/ContextDestructionObserver.cpp
  • src/jsc/bindings/webcore/ContextDestructionObserver.h
  • src/jsc/bindings/webcore/Event.cpp
  • src/jsc/bindings/webcore/Event.h
  • src/jsc/bindings/webcore/EventTarget.cpp
  • src/jsc/bindings/webcore/EventTarget.h
  • src/jsc/bindings/webcore/FetchHeaders.h
  • src/jsc/bindings/webcore/HTTPHeaderIdentifiers.cpp
  • src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h
  • src/jsc/bindings/webcore/JSCookieMap.cpp
  • src/jsc/bindings/webcore/JSDOMAttribute.h
  • src/jsc/bindings/webcore/JSDOMConvert.h
  • src/jsc/bindings/webcore/JSDOMConvertBufferSource.h
  • src/jsc/bindings/webcore/JSDOMConvertDate.cpp
  • src/jsc/bindings/webcore/JSDOMConvertDate.h
  • src/jsc/bindings/webcore/JSDOMIterator.cpp
  • src/jsc/bindings/webcore/JSDOMIterator.h
  • src/jsc/bindings/webcore/JSDOMOperationReturningPromise.h
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.h
  • src/jsc/bindings/webcore/JSEventListener.h
  • src/jsc/bindings/webcore/JSMIMEBindings.cpp
  • src/jsc/bindings/webcore/JSMIMEBindings.h
  • src/jsc/bindings/webcore/NetworkLoadMetrics.h
  • src/jsc/bindings/webcore/PerformanceTiming.cpp
  • src/jsc/bindings/webcore/PerformanceTiming.h
  • src/jsc/bindings/webcore/ResourceLoadTiming.h
  • src/jsc/bindings/webcore/ScriptWrappable.h
  • src/jsc/bindings/webcore/SerializedScriptValue.cpp
  • src/jsc/hot_reloader.rs
  • src/libarchive/lib.rs
  • src/md/types.rs
  • src/node-fallbacks/package.json
  • src/node-fallbacks/tsconfig.json
  • src/node-fallbacks/util.js
  • src/opaque/lib.rs
  • src/picohttp/lib.rs
  • src/resolver/lib.rs
  • src/runtime/api/BunObject.rs
  • src/runtime/api/csrf_jsc.rs
  • src/runtime/bake/production.rs
  • src/runtime/cli/test_command.rs
  • src/runtime/jsc_hooks.rs
  • src/runtime/node.rs
  • src/runtime/node/assert/myers_diff.rs
  • src/runtime/node/fs_events.rs
  • src/runtime/node/node_assert.rs
  • src/runtime/node/node_cluster_binding.rs
  • src/runtime/valkey_jsc/protocol_jsc.rs
  • src/sha_hmac/lib.rs
  • src/sha_hmac/sha.rs
  • src/sql_jsc/jsc.rs
  • src/sys/windows/mod.rs
  • src/valkey/valkey_protocol.rs
  • src/watcher/Watcher.rs
  • src/watcher/lib.rs
  • src/windows_sys/externs.rs
  • src/zlib/lib.rs
  • src/zlib_sys/posix.rs
  • src/zlib_sys/win32.rs
  • test/internal/source-lints/dead-code-escape-limits.json
  • test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts
💤 Files with no reviewable changes (55)
  • src/jsc/bindings/webcore/JSDOMConvert.h
  • src/node-fallbacks/tsconfig.json
  • src/runtime/valkey_jsc/protocol_jsc.rs
  • src/jsc/bindings/webcore/FetchHeaders.h
  • src/codegen/generate-unified-source-bundles.rb
  • src/opaque/lib.rs
  • src/jsc/bindings/webcore/ContextDestructionObserver.cpp
  • src/jsc/bindings/webcore/ScriptWrappable.h
  • src/jsc/bindings/webcore/ResourceLoadTiming.h
  • src/jsc/bindings/webcore/EventTarget.cpp
  • src/runtime/node/node_cluster_binding.rs
  • src/exe_format/pe.rs
  • src/jsc/bindings/webcore/JSEventListener.h
  • src/jsc/bindings/webcore/JSCookieMap.cpp
  • src/jsc/bindings/webcore/JSDOMIterator.h
  • src/jsc/bindings/webcore/BufferSource.h
  • src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h
  • src/js/internal-for-testing.ts
  • src/runtime/api/csrf_jsc.rs
  • src/jsc/bindings/webcore/PerformanceTiming.cpp
  • src/md/types.rs
  • src/zlib_sys/posix.rs
  • src/jsc/bindings/webcore/PerformanceTiming.h
  • src/jsc/bindings/webcore/HTTPHeaderIdentifiers.cpp
  • src/http/lib.rs
  • src/jsc/bindings/webcore/JSDOMAttribute.h
  • src/jsc/bindings/ZigGlobalObject.cpp
  • src/runtime/node/assert/myers_diff.rs
  • src/valkey/valkey_protocol.rs
  • src/jsc/bindings/webcore/SerializedScriptValue.cpp
  • src/js/internal/readline/interface.js
  • src/zlib/lib.rs
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp
  • src/libarchive/lib.rs
  • src/zlib_sys/win32.rs
  • src/csrf/lib.rs
  • src/jsc/bindings/webcore/ContextDestructionObserver.h
  • src/runtime/bake/production.rs
  • src/css_jsc/css_internals.rs
  • src/watcher/lib.rs
  • src/jsc/bindings/BunObject+exports.h
  • src/runtime/api/BunObject.rs
  • src/jsc/bindings/webcore/JSDOMOperationReturningPromise.h
  • src/jsc/AsyncModule.rs
  • src/jsc/bindings/webcore/JSDOMPromiseDeferred.h
  • src/runtime/node/node_assert.rs
  • src/jsc/bindings/webcore/EventTarget.h
  • src/jsc/bindings/webcore/Event.cpp
  • src/jsc/bindings/webcore/NetworkLoadMetrics.h
  • src/jsc/bindings/webcore/JSDOMConvertBufferSource.h
  • src/runtime/jsc_hooks.rs
  • src/windows_sys/externs.rs
  • src/jsc/RuntimeTranspilerStore.rs
  • src/picohttp/lib.rs
  • src/jsc/bindings/webcore/Event.h

Comment thread src/jsc/bindings/InternalForTesting.cpp
Comment thread test/internal/source-lints/dead-symbols-webcore-watcher-fallbacks.test.ts Outdated
Comment thread src/runtime/node/fs_events.rs Outdated
The jsFunction_lsanDoLeakCheck declaration in InternalForTesting.h
outlived the deleted definition, and two attribute removals in
fs_events.rs left their fn signatures over-indented. Also rustfmt
fallout in hot_reloader, jsc_hooks, and sha_hmac.
@robobun

robobun commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the review feedback in bc50337:

  • Removed the stale jsFunction_lsanDoLeakCheck declaration from InternalForTesting.h (the definition was deleted in the initial commit; the regenerated js2native table no longer references the symbol).
  • Fixed the over-indented fn signatures in fs_events.rs left behind by the attribute removals, and ran cargo fmt --all, which also normalized the other edit sites. cargo fmt --all --check is clean.

The existsSync assertion flagged on the lint test was already replaced with content-based checks in 0f8f22e. Debug build and the source-lint suite pass after the changes.

Comment thread src/jsc/bindings/InternalForTesting.cpp
Comment thread src/js/internal-for-testing.ts
Comment thread src/runtime/valkey_jsc/protocol_jsc.rs
Comment thread src/jsc/bindings/IDLTypes.h
Deleting the two internal-for-testing exports left dependency_from_js and
tag_infer_from_js with no generated callers. Removing them also kills
update_request_jsc::from_js (sole caller was dependency_from_js) and the
version_to_js/log_to_js helpers, so both modules go, along with the
dispatch_js2native re-exports, the dependency.rs codegen path mapping,
and the four ERR_REDIS_INVALID_* codes only the deleted RedisError match
arms produced.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No bugs found this pass — all five earlier findings were addressed (or deliberately deferred to #35775). Deferring to a human because of scope: 89 files / -1.9k lines spanning webcore C++ (Event/IDL/promise-deferred struct and vtable changes), a signature change threaded through the watcher/bundler/VM/hot-reloader chain, node-fallbacks dependency pruning, and a cascading two-file deletion in install_jsc added in the final commit.

What was reviewed:

  • Watcher loader column removal traced through all 8 call sites; add_file/add_file_by_path_slow signatures updated consistently.
  • Event::resetBeforeDispatch removal from dispatchEvent — confirmed the body only touched the removed m_defaultHandled bit.
  • FSWatcher/kRestorePreviousState export removals — confirmed no external consumers via grep of src/js/.
  • csrf__generate/map_diff_error match arms stay exhaustive after variant deletions.
Extended reasoning...

Overview

Scheduled dead-code sweep removing ~2,100 lines across 89 files: webcore C++ bindings (unused IDL typed-array types, DOMPromiseDeferred cluster, NetworkLoadMetrics inspector fields, write-only Event bitfields), the CMake-era ruby unified-source script, the watcher's write-only WatchItem.loader column and its bun_watcher::Loader cycle-break newtype (threaded through bundler/hot_reloader/VirtualMachine/jsc_hooks/RuntimeTranspilerStore/AsyncModule/test_command), unused Rust error variants and hashers across sha_hmac/csrf/valkey/picohttp/windows_sys/zlib, 13 node-fallbacks dependencies, unused built-in JS primordial exports, and the npa/npmTag/lsanDoLeakCheck internal-for-testing bindings plus their now-orphaned Rust/C++/codegen landing pads.

Security risks

None identified. No auth, crypto (the sha_hmac deletions are unused hasher instantiations, not algorithm changes), or permission logic touched. The node-fallbacks dependency pruning only removes packages the fallback bundle never imports.

Level of scrutiny

High. This is not a mechanical deletion PR: it changes struct layouts in C++ (Event bitfields, NetworkLoadMetrics), removes a call from the EventTarget::dispatchEvent hot path, threads a parameter removal through ~8 files in the watcher/transpiler chain, prunes package.json dependencies that affect browser-target bundling, and — in the final commit — cascaded into deleting two entire install_jsc files the author hadn't originally scoped. Each individual hunk looks correct, but the breadth and the number of subsystems touched put it outside what I'd approve without a human glance.

Other factors

Five prior review findings (fs_events indent, InternalForTesting.h decl, npa/npmTag landing pads, ErrorCode.ts REDIS entries, JSDOMConvertScheduledAction.h) were all addressed in bc50337/5c4db5b/c16c60eb or explicitly deferred to open PR #35775. Verification is solid (rust:check-all on 10 targets, full debug build, 582 smoke tests, source-lint pinning removals). The bug hunting system found nothing new this run. Spot-checked that removed JS exports (FSWatcher, kRestorePreviousState) have no external consumers, and that match arms in csrf_jsc/node_assert remain exhaustive after variant deletions.

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

@robobun conflicts

…dead-code-webcore-codegen-misc

# Conflicts:
#	src/bundler/bundle_v2.rs
#	src/jsc/AsyncModule.rs
#	src/jsc/hot_reloader.rs
#	src/runtime/jsc_hooks.rs
@robobun

robobun commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Merged main in 70de266. The conflicts were between this PR's watcher loader-parameter removal and #37050's fd-ownership refactor on the same call sites (hot_reloader, jsc_hooks, bundle_v2, AsyncModule); resolved by keeping the FdOwnership semantics from main with the loader argument dropped. AsyncModule took main's version outright since #37050 removed its watcher registration entirely. cargo check across the workspace, a full debug build, and the hot/watch test suites pass on the merge.

Comment thread src/install_jsc/lib.rs

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found in this pass, but deferring to a human given the breadth: 91 files across watcher, hot-reloader, bundler, webcore bindings, node-fallbacks, and a dozen misc crates, plus a non-trivial merge with #37050 that combined the fd-ownership refactor with the loader-column removal on the same watcher call sites.

What was reviewed:

  • Watcher loader column removal traced through all callers (hot_reloader, jsc_hooks, bundle_v2, RuntimeTranspilerStore, VirtualMachine, test_command); no remaining reads of the column.
  • FSWatcher/kRestorePreviousState export removals — both symbols still defined and used internally; no external importers.
  • node-fallbacks dep removals — build-fallbacks.ts uses bun build with force-externalized builtins, not the removed npm packages; entry files are self-contained.
  • RedisError variant removals — no remaining constructors or string-parse paths in src/valkey/; ErrorCode.ts entries removed to match.
Extended reasoning...

Overview

This is a scheduled dead-code sweep removing ~2,000 lines across 91 files. The bulk is pure deletion of provably-unreferenced symbols: unused IDL typed-array converters and IDL types in webcore C++ headers, the CMake-era ruby unified-source script, write-only WatchItem.loader and its cycle-break newtype, unused error-enum variants (csrf, valkey, exe_format, myers_diff), unused OpenSSL-3-deprecated hasher wrappers, unused Windows FFI decls/re-exports, commented-out Zig leftovers, and unused export keys in built-in JS modules. Three rounds of prior review found and fixed cascading orphans (InternalForTesting.h decl, dependency_jsc/update_request_jsc, ErrorCode.ts entries), plus a rustfmt indentation drift.

Security risks

None identified. All changes are removals of unreferenced symbols or write-only fields; no validation, auth, crypto, or path-handling logic is weakened. The csrf::Error variant removals leave the actual generate/verify paths untouched (verify already returned bool). The sha_hmac deletions remove only the never-wired MD5_SHA1/Blake2 EVP wrappers and the deprecated raw-hasher variants; the live evp::* types and Algorithm enum are unchanged.

Level of scrutiny

High, for two reasons. First, sheer breadth — 91 files across watcher, hot-reloader, bundler, HTTP client, event dispatch, JSC bindings, and node-fallbacks means a subtle behavioral removal (e.g., a virtual override actually reached, a struct field read via C++ ABI offset) would be easy to miss. Second, the merge with #37050 in 70de266 combined two independent refactors on the same watcher add_file call sites (fd-ownership + loader-parameter removal); the resolution looks correct on read-through, but that class of merge is exactly where silent regressions hide.

Other factors

  • All three prior rounds of my inline nits were addressed (bc50337, c16c60e), and CodeRabbit's two findings were addressed (0f8f22e, bc50337). One was intentionally skipped with a stated reason (JSDOMConvertScheduledAction.h owned by open PR #35775).
  • The github-actions comment-cop fired on install_jsc/lib.rs and robobun declined it with a reasonable justification (crate-level doc comment, not a workaround).
  • The PR description claims rust:check-all (10 targets), full debug build, and 582 smoke tests pass, and the source-lint test that pinned the removals was itself removed during review.
  • Spot-checked this pass: FSWatcher export key (only .watch/.createIgnoreMatcher consumed externally), kRestorePreviousState (only referenced within interface.js), Bun__Process__queueNextTick1 (canonical decl still lives in JSValue.rs), node-fallbacks build script (uses bun build, not esbuild; removed deps genuinely unimported), and the RedisError variants (no constructors remain in src/valkey/).

Given the scale and the merge-conflict resolution on hot-reloader/watcher, this warrants a human sign-off even with zero findings.

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