Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughChangesThe pull request removes deprecated Rust, CSS, JavaScript, HTTP, JSON, and native binding APIs. It also removes unused workspace dependencies and adds source-lint tests for deleted symbols. ChangesAPI and binding cleanup
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/collections/hive_array.rs (1)
676-693: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRemove stale references to the deleted
getAPIs.
put_rawandputstill document heap slots as coming from the removedgetfamily (Lines 715, 727, and 758). Update those contracts to refer toclaim,get_init, andemplace, so unsafe callers are not directed to nonexistent APIs.As per coding guidelines, comments must contain only durable non-obvious information.
🤖 Prompt for 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. In `@src/collections/hive_array.rs` around lines 676 - 693, Update the documentation comments for put_raw, put, and the related heap-slot contract to remove references to deleted get APIs. Refer instead to the current claim, get_init, and emplace entry points, preserving only durable, non-obvious ownership and safety details.Source: Coding guidelines
🤖 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/css/printer.rs`:
- Around line 233-234: Update the lifecycle comment near the arena-backed
scratchbuf and indentation_buf fields to remove the historical “deinit()
dropped” reference. Retain only the current ownership invariant that these
BumpVec buffers are freed in bulk by arena.reset() and require no explicit Drop
implementation.
---
Outside diff comments:
In `@src/collections/hive_array.rs`:
- Around line 676-693: Update the documentation comments for put_raw, put, and
the related heap-slot contract to remove references to deleted get APIs. Refer
instead to the current claim, get_init, and emplace entry points, preserving
only durable, non-obvious ownership and safety details.
🪄 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: 2ea68c4d-27e2-4256-8457-6b31ccd5cab3
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (50)
src/bun_core/env_var.rssrc/bun_core/util.rssrc/collections/Cargo.tomlsrc/collections/hive_array.rssrc/collections/pool.rssrc/css/Cargo.tomlsrc/css/css_modules.rssrc/css/css_parser.rssrc/css/dependencies.rssrc/css/error.rssrc/css/lib.rssrc/css/printer.rssrc/css/properties/custom.rssrc/css/rules/import.rssrc/css/rules/mod.rssrc/css/selectors/selector.rssrc/css/values/image.rssrc/css/values/url.rssrc/dns/lib.rssrc/glob/Cargo.tomlsrc/io/Cargo.tomlsrc/js/builtins.d.tssrc/js/builtins/BunBuiltinNames.hsrc/js/builtins/CommonJS.tssrc/js/builtins/JSBufferPrototype.tssrc/js/internal/http.tssrc/jsc/DOMFormData.rssrc/jsc/FetchHeaders.rssrc/jsc/bindings/BakeAdditionsToGlobalObject.cppsrc/jsc/bindings/BunAnalyzeTranspiledModule.cppsrc/jsc/bindings/BunString.cppsrc/jsc/bindings/Cookie.cppsrc/jsc/bindings/JSBundlerPlugin.cppsrc/jsc/bindings/NodeFSStatFSBinding.cppsrc/jsc/bindings/RegularExpression.cppsrc/jsc/bindings/SQLClient.cppsrc/jsc/bindings/ScriptExecutionContext.cppsrc/jsc/bindings/StringBuilderBinding.cppsrc/jsc/bindings/TextCodecASCIIFastPath.hsrc/jsc/bindings/ZigGlobalObject.cppsrc/jsc/bindings/ZigLazyStaticFunctions-inlines.hsrc/jsc/bindings/ZigLazyStaticFunctions.hsrc/jsc/bindings/bindings.cppsrc/jsc/bindings/c-bindings.cppsrc/jsc/bindings/headers.hsrc/jsc/bindings/highway_json.cppsrc/jsc/bindings/objects.hsrc/paths/Cargo.tomlsrc/sys/lib.rstest/internal/source-lints/dead-symbols-35437.test.ts
💤 Files with no reviewable changes (39)
- src/paths/Cargo.toml
- src/jsc/bindings/ZigLazyStaticFunctions.h
- src/css/Cargo.toml
- src/jsc/bindings/Cookie.cpp
- src/js/builtins/JSBufferPrototype.ts
- src/jsc/bindings/BunString.cpp
- src/glob/Cargo.toml
- src/dns/lib.rs
- src/jsc/bindings/ZigLazyStaticFunctions-inlines.h
- src/jsc/bindings/NodeFSStatFSBinding.cpp
- src/jsc/bindings/TextCodecASCIIFastPath.h
- src/jsc/bindings/BakeAdditionsToGlobalObject.cpp
- src/jsc/bindings/JSBundlerPlugin.cpp
- src/js/builtins/BunBuiltinNames.h
- src/jsc/bindings/BunAnalyzeTranspiledModule.cpp
- src/js/builtins.d.ts
- src/jsc/bindings/ScriptExecutionContext.cpp
- src/jsc/bindings/objects.h
- src/collections/Cargo.toml
- src/jsc/bindings/c-bindings.cpp
- src/io/Cargo.toml
- src/jsc/bindings/RegularExpression.cpp
- src/js/builtins/CommonJS.ts
- src/css/rules/mod.rs
- src/css/error.rs
- src/collections/pool.rs
- src/css/values/url.rs
- src/jsc/bindings/StringBuilderBinding.cpp
- src/bun_core/env_var.rs
- src/jsc/bindings/SQLClient.cpp
- src/css/css_modules.rs
- src/jsc/bindings/highway_json.cpp
- src/css/properties/custom.rs
- src/css/dependencies.rs
- src/jsc/bindings/headers.h
- src/jsc/bindings/ZigGlobalObject.cpp
- src/jsc/bindings/bindings.cpp
- src/bun_core/util.rs
- src/js/internal/http.ts
There was a problem hiding this comment.
The follow-up commit addressed both orphan findings from my earlier pass (the jsFetchHeaders_getRawKeys C++ body/decl and the Url::is_absolute + stale doc comments in src/css/). I found nothing further, but at ~1.6k lines deleted across 53 files — including extern "C" ABI surface, builtins codegen inputs, and PrinterOptions/ToCssResult field removals — this is worth a human skim before merge.
What was reviewed:
- Re-grepped every removed
src/js/internal/http.tsexport againstsrc/js/— no remaining importers. - Verified
dependencies::Location(the one surviving type independencies.rs) is still consumed viaproperties/custom.rsandvalues/url.rs, so the module isn't dead. - Spot-checked
setBigUint64,FdOptional,JSBundlerPlugin__onVirtualModulePlugin,Bun__startLoop, and the CSSanalyze_dependencies/PseudoClasseschain — no remaining references insrc/.
Extended reasoning...
Overview
Dead-code sweep across 53 files: ~700 lines of unreferenced extern "C" functions and orphaned headers in src/jsc/bindings/, ~260 lines of unreferenced builtins/symbols in src/js/, ~430 lines of unreachable PrinterOptions.analyze_dependencies / pseudo_classes option chains in src/css/, ~150 lines of unused Rust util-crate items, and 22 unused Cargo dependencies. A source-lint test guards against reintroduction. My earlier review flagged two orphans this PR itself created (jsFetchHeaders_getRawKeys and Url::is_absolute + two stale doc comments); commit db8e765 addressed all of them.
Security risks
None identified. Pure deletions of unreachable code; no auth, crypto, or input-validation paths touched. The removed bun_ignore_sigpipe / Bun__disableSOLinger were unreferenced C helpers, not live signal/socket setup.
Level of scrutiny
High, due to breadth. extern "C" symbols can be referenced from generated code (build/debug/codegen/) or via WebKit weak-override, and src/js/builtins/*.ts exports are consumed by string name through the codegen bundler — both are exactly the class of "public items escape dead-code lints" that a compiler won't catch. The PR description documents grepping all four surfaces (src/, vendor/, packages/, build/debug/codegen/) and explicitly notes the one weak-override case it caught (Bun__analyzeTranspiledModule) and left alone. I spot-checked a representative sample and found the methodology holds.
Other factors
- The CSS changes remove public fields from
PrinterOptions,ToCssResult, andcss_modules::Configand dropPseudoClassesfrom the crate re-export list. Every in-tree construction site uses..Default::default()so this compiles, but it's a public-API shape change a maintainer should be aware of. hive_array.rsremovesHiveRefHandle::into_raw/get_mutand rewrites the round-trip test to useas_ptr()+mem::forget()— behaviorally equivalent, and thefrom_rawdoc was updated to match.- The PR states
bun bdbuilds clean andrust:check-allpasses on all 10 targets, plus the listed test files pass; that's the right verification for a deletion sweep but doesn't substitute for a maintainer glance at which surfaces were pruned.
Deferring given the scale and the number of ABI/codegen-adjacent surfaces touched.
|
Updated 6:51 AM PT - Aug 2nd, 2026
✅ @robobun, your commit 0506a51ec5fa9345e2b0e94a7e19862701aed60d passed in 🧪 To try this PR locally: bunx bun-pr 35437That installs a local version of the PR into your bun-35437 --bun |
There was a problem hiding this comment.
The two orphan issues from the earlier pass (jsFetchHeaders_getRawKeys, Url::is_absolute + stale doc comments) are addressed in db8e765, and I found no further problems — but at ~1560 lines deleted across 53 files spanning C++ bindings, JS builtins, the CSS printer, and several Rust util crates, this is broad enough that a maintainer should sign off.
What was reviewed:
- Spot-checked removed
extern "C"symbols, http.ts symbol exports,setBigUint64, andFdOptional— no remaining references insrc/. - CSS
analyze_dependencies/pseudo_classeschain removal: the survivingto_cssbodies in url.rs/image.rs/import.rs/custom.rs match the pre-PR default-option (no-dependencies) path. - The
$fulfillModuleSyncbuiltin removal is consistent across BunBuiltinNames.h, builtins.d.ts, ZigGlobalObject.cpp, and CommonJS.ts.
Extended reasoning...
Overview
This PR deletes ~1560 lines of provably-dead code across 53 files: unused extern "C" bindings and orphan headers in src/jsc/bindings/, a commented-out legacy block and unreferenced symbol exports in src/js/, the never-exercised analyze_dependencies/pseudo_classes option chains in src/css/, unused pub items in bun_collections/bun_core, and ~22 unused Cargo dependency entries. It also adds a source-lint test guarding against reintroduction.
Security risks
None identified. All changes are deletions of unreachable code plus a read-only test; no new inputs, no behavior change on any live path.
Level of scrutiny
High, purely due to breadth. Each individual deletion is mechanical, but the correctness of the whole PR rests on the claim that every symbol was grepped against src/, vendor/, packages/, and build/debug/codegen/ with no hits. extern "C" symbols in particular can be referenced via weak-override from WebKit (the description notes Bun__analyzeTranspiledModule was caught this way and left alone) or via codegen string lookup ($newCppFunction). I spot-checked a representative sample and found no dangling references, and the PR description states bun bd and rust:check-all on all 10 targets pass, but exhaustive verification of ~30 extern symbols and ~30 JS exports is beyond what I can guarantee.
Other factors
My earlier review flagged two orphans this PR itself created (jsFetchHeaders_getRawKeys C++ body, Url::is_absolute + stale module docs); db8e765 addressed both, and the follow-up commits are cosmetic (source-lint test tweak, CI retrigger). The CSS chain removal is the least mechanical part — it collapses several if dest.dependencies.is_some() branches into their else-arm — and while the surviving code matches the pre-PR default path exactly, a maintainer familiar with the lightningcss port should confirm the option chain was genuinely never intended to be wired up.
#36426) Net: +140 / -2783 lines across 55 files. ## What changed ### Dead headers removed (5 files) - `src/jsc/bindings/webcore/ActiveDOMObject.h` (170 lines): every line was a `//` comment; the 38 `#include "ActiveDOMObject.h"` sites (plus one in `src/codegen/generate-jssink.ts`) pulled in nothing. All include lines removed. - `src/jsc/bindings/webcore/EventDispatcher.h` (41 lines): `rg -wn EventDispatcher src/ build/debug/codegen/` finds only a code comment in EventTarget.cpp and an unrelated WebKit `RemoteLayerTreeEventDispatcher` mention. - `src/jsc/bindings/webcore/{EventModifierInit.h,JSEventModifierInit.h,UIEventInit.h}` (125 lines): a closed dead cluster; `convertDictionary<EventModifierInit>` is never called and the files only reference each other. ### Dead .cpp bodies emptied (4 files, ~700 lines removed) `ActiveDOMObject.cpp`, `EventDispatcher.cpp`, `JSEventModifierInit.cpp`, `ncrpyto_engine.cpp` reduced to `#include "config.h"` only. Kept as files so `scripts/build/unified.ts` bundle composition (32 .cpp per TU in release) stays stable for the other ~300 files in those directories. ### `HTTPParsers.{h,cpp}` (~1012 lines removed) Bun only calls `isValidHTTPHeaderValue`, `isValidHTTPToken`, `isHTTPSpace`, and `Bun__writeHTTPDate` from this file (callers: FetchHeaders.cpp, JSCookie.cpp, Cookie.cpp, and `src/http_types/ETag.rs`). Removed: `isValidReasonPhrase`, `isValidAcceptHeaderValue`, `isValidLanguageHeaderValue`, `isValidUserAgentHeaderValue` (+ the entire `#if USE(GLIB)` block; `USE(GLIB)` is never defined in Bun), `parseHTTPDate`, `filenameFromHTTPContentDisposition`, `extractMIMETypeFromMediaType`, `extractCharsetFromMediaType`, `parseXSSProtectionHeader`, `extractReasonPhraseFromHTTPStatusLine`, `parseXFrameOptionsHeader`, `parseStructuredFieldValue`, `parseRange` (both overloads), `parseContentTypeOptionsHeader`, `parseHTTPHeader`, `parseHTTPRequestBody`, `isForbiddenHeaderName`, `isForbiddenHeader`, `isNoCORSSafelistedRequestHeaderName`, `isPriviledgedNoCORSRequestHeaderName`, `isForbiddenResponseHeaderName`, `isForbiddenMethod`, `isSimpleHeader`, `isCrossOriginSafeRequestHeader`, `normalizeHTTPMethod`, `isSafeMethod`, `parseCrossOriginResourcePolicyHeader`, their 7 static helpers (`skipWhile`, `skipWhiteSpace`, `skipToken`, `skipEquals`, `skipValue`, `trimInputSample`, `isValidHeaderNameCharacter`), and the 6 enum types that only those functions use (`XSSProtectionDisposition`, `ContentTypeOptionsDisposition`, `XFrameOptionsDisposition`, `CrossOriginResourcePolicy`, `RangeAllowWhitespace`, `HTTPHeaderSet`). ### `ncrypto.{h,cpp}` (~609 lines removed) Removed `SSLPointer`, `SSLCtxPointer`, `X509Name` (+ `X509Name::Iterator`), `EnginePointer`, `StackOfX509`/`StackOfX509Deleter`, `SSLSessionPointer`, and their dependents (`X509View::From(SSLPointer/SSLCtxPointer)`, `X509View::getSubjectName/getIssuerName`, `X509Pointer::IssuerFrom` both overloads, `X509Pointer::PeerFrom`). `rg -wn 'SSLPointer|SSLCtxPointer|EnginePointer|X509Name\b|StackOfX509' src/ build/debug/codegen/` outside ncrypto itself finds nothing. Bun's TLS goes through usockets/boringssl directly; these ncrypto wrappers were never wired up. `X509View` and `X509Pointer` themselves stay (JSX509Certificate uses them). ### Smaller items - `JSBufferEncodingType.{h,cpp}`: `validateBufferEncoding<bool>()` template + two explicit specializations, never called (`rg -wn validateBufferEncoding src/ build/debug/codegen/` finds only the definitions). - `src/js/node/dgram.ts`: removed the commented-out `_createSocketHandle` block; the live implementation is in `src/js/internal/dgram.ts` and is what `internal/cluster/SharedHandle.ts` imports. ## Verification - `rg` for each removed symbol across `src/`, `build/debug/codegen/`, `src/codegen/`: zero hits outside own definition. - `bun bd`: builds clean. - Smoke tests pass: `test/js/web/fetch/headers.test.ts`, `test/js/node/crypto/crypto.test.ts`, `test/js/node/crypto/x509.test.ts`, `test/js/bun/http/bun-serve-cookies.test.ts`, `test/js/sql/sql-close-pending-connection.test.ts`. - `test/internal/source-lints/dead-symbols-httpparsers-ncrypto.test.ts` asserts the removed symbols/files do not reappear. ## Dropped from the original push after CI bisection The first push also removed `kServerSocket`/`kpendingRead` from `src/js/node/net.ts`, removed `m_clients`/`addClient`/`JSVMClientDataClient` from `BunClientData`, and deleted the four .cpp files outright. That build crashed `test/js/sql/sql-close-pending-connection.test.ts` and `test/js/sql/sql.test.ts` on every CI lane with `RELEASE_ASSERT(m_heap.m_mutatorState == MutatorState::Running)` (allocation during GC sweep), not reproducible locally on debug+asan or release. Reverting those three groups clears it; narrowing which one is the trigger is left for a follow-up since each is ~10 lines. ## Followups (not in this diff) `patches/ncrypto.patch` (the reference diff for re-deriving ncrypto.{h,cpp} from upstream Node ncrypto) still contains hunks for SSLPointer/SSLCtxPointer/X509Name/EnginePointer; it is not applied by any build step, so it needs regenerating on the next upstream sync. Emptying `EventDispatcher.cpp` orphans `EventContext::handleLocalEvents()` (EventContext.h:62 / .cpp:43) and `Node::defaultEventHandler()` (Node.h:52); left for a follow-up sweep alongside the rest of the Event*/EventPath cascade rather than widening this diff mid-CI-bisection. More dead ncrypto found but left for a focused PR: `#include <openssl/ssl.h>` at ncrypto.h:23 (orphaned by the SSLPointer/SSLCtxPointer removal, same class as the engine.h include dropped here), `setFipsEnabled`/`testFipsEnabled`, `hashDigest`, `checkScryptParams`/`scrypt`/`pbkdf2`, `Cipher::ForEach`, `Rsa::encrypt/decrypt`, the unused `Cipher::AES_*_CTR/GCM/KW` getters, `DataPointer::TryInitSecureHeap/SecureAlloc/GetSecureHeapUsed`, `EVPKeyCtxPointer::setRsaImplicitRejection/publicCheck/privateCheck`, `X509View::enumUsages/ifRsa/ifEc`, `X509Pointer::ErrorReason`, `BIOPointer::NewSecMem/NewFile/NewFp`, `BignumPointer::NewSub/NewLShift` (~300 lines). Also found but overlap with open dead-code PRs so left alone: `headers-cpp.h`/`sizegen.cpp` (tangled with #36115), `objects.h`/`TextCodecASCIIFastPath.h`/`ZigLazyStaticFunctions*.h` (#35437), `JSCInlines.h` (#36237), `EventSender.h` (#35775). <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 2 · 57 files touched <details><summary>fails on main (without fix)</summary> ```console 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-httpparsers-ncrypto.test.ts bun test v1.4.0 (4fba9c1) test/internal/source-lints/dead-symbols-httpparsers-ncrypto.test.ts: 53 | const t = l.trim(); 54 | return t !== "" && !t.startsWith("//") && t !== allowed; 55 | }); 56 | }) 57 | .map(([p]) => p); 58 | expect(nonStub).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/EventDispatcher.h", + "src/jsc/bindings/webcore/EventModifierInit.h", + "src/jsc/bindings/webcore/JSEventModifierInit.h", + "src/jsc/bindings/webcore/UIEventInit.h", + "src/jsc/bindings/webcore/EventDispatcher.cpp", + "src/jsc/bindings/webcore/JSEventModifierInit.cpp", + "src/jsc/bindings/ncrpyto_engine.cpp", + ] - Expected - 1 + Received + 9 at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-httpparsers-ncrypto.test.ts:58:19) (fail) emptied dead C++ files stay empty [47.32ms] 78 | ["src/jsc/bindings/webcore/HTTPParsers.cpp", / ... (truncated) release without fix: 5 FAILED bun test v1.4.0-canary.1 (5cea549) test/internal/source-lints/dead-symbols-httpparsers-ncrypto.test.ts: 53 | const t = l.trim(); 54 | return t !== "" && !t.startsWith("//") && t !== allowed; 55 | }); 56 | }) 57 | .map(([p]) => p); 58 | expect(nonStub).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/EventDispatcher.h", + "src/jsc/bindings/webcore/EventModifierInit.h", + "src/jsc/bindings/webcore/JSEventModifierInit.h", + "src/jsc/bindings/webcore/UIEventInit.h", + "src/jsc/bindings/webcore/EventDispatcher.cpp", + "src/jsc/bindings/webcore/JSEventModifierInit.cpp", + "src/jsc/bindings/ncrpyto_engine.cpp", + ] - Expected - 1 + Received + 9 at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-httpparsers-ncrypto.test.ts:58:19) (fail) emptied dead C++ files stay empty [1.13ms] 78 | ["src/jsc/bindings/webcore/HTTPParsers.cpp", /\bisCrossOriginSafeRequestHeader\b/], 79 | ["src/jsc/bindings/webcore/HTTPParsers.cpp", /\bnormalizeHTTPMethod\b/], 80 | ["src/jsc/bindings/webcore/HTTPParsers.cpp", /\bparseXFrameOptio ... (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-httpparsers-ncrypto.test.ts bun test v1.4.0 (4fba9c1) test/internal/source-lints/dead-symbols-httpparsers-ncrypto.test.ts: (pass) emptied dead C++ files stay empty [19.36ms] (pass) dead HTTPParsers functions do not reappear [20.51ms] (pass) dead ncrypto SSL/Engine/X509Name wrappers do not reappear [16.23ms] (pass) dead misc C++ symbols do not reappear [8.75ms] (pass) dead src/js symbols do not reappear [2.81ms] 5 pass 0 fail 5 expect() calls Ran 5 tests across 1 file. [2.20s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 640ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [0/1] reconfigure [1/104] gen JSEvent.lut.h Generating /workspace/bun/build/release/codegen/JSEvent.lut.h from /workspace/bun/src/jsc/bindings/webcore/JSEvent.cpp [2/104] gen JSBuffer.lut.h Generating /workspace/bun/build/release/codegen/JSBuffer.lut.h from /workspace/bun/src/jsc/bindings/JSBuffer.cpp [3/104] gen cpp.rs (cppbind) [4/104] 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 [5/104] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [6/104] gen JS modules (bundle-modules) Preprocess modules (10243ms) Bundle modules (49ms) Postprocesss modules (196ms) Bundle Functions (855ms) Generate Code (36ms) [11.40s] Bundled "src/js" for production 2569 kb 193 internal modules 13 native modules 90 internal functions across 19 files [6/103] cargo bun_bin → libbun_rust.a ( ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` scripts/build/unified.ts | 2 + src/codegen/generate-jssink.ts | 1 - src/js/node/dgram.ts | 41 - src/jsc/bindings/DOMURL.cpp | 1 - src/jsc/bindings/ImportMetaObject.cpp | 1 - src/jsc/bindings/JSBuffer.cpp | 1 - src/jsc/bindings/JSBufferEncodingType.cpp | 26 - src/jsc/bindings/JSBufferEncodingType.h | 3 - src/jsc/bindings/ScriptExecutionContext.h | 1 - src/jsc/bindings/ncrpyto_engine.cpp | 108 +-- src/jsc/bindings/ncrypto.cpp | 431 ---------- src/jsc/bindings/ncrypto.h | 181 ----- src/jsc/bindings/webcore/ActiveDOMObject.cpp | 197 +---- src/jsc/bindings/webcore/ActiveDOMObject.h | 172 +--- src/jsc/bindings/webcore/EventDispatcher.cpp | 239 +----- src/jsc/bindings/webcore/EventDispatcher.h | 41 +- src/jsc/bindings/webcore/EventModifierInit.h | 42 +- src/jsc/bindings/webcore/HTTPParsers.cpp | 884 --------------------- src/jsc/bindings/webcore/HTTPParsers.h | 128 --- src/jsc/bindings/webcore/JSAbortController.cpp | 1 - src/jsc/bindings/webcore/JSAbortSignal.cpp | 1 - src/jsc/bindings/webcore/JSBroadcastChannel.cpp | 1 - src/jsc/bindings/webcore/JSCloseEvent.cpp | 1 - src/jsc/bindings/webcore/JSCustomEvent.cpp | 1 - src/jsc/bindings/webcore/JSDOMException.cpp | 1 - src/jsc/bindings/webcore/JSDOMFormData.cpp | 1 - src/jsc/bindings/webcore/JSDOMURL.cpp | 1 - src/jsc/bindings/webcore/JSErrorEvent.cpp | 1 - src/jsc/bindings/webcore/JSEvent.cpp | 1 - src/jsc/bindings/webcore/JSEventEmitter.cpp | 1 - src/jsc/bindings/webcore/JSEventModifierInit.cpp | 180 +---- src/jsc/bindings/webcore/JSEventModifierInit.h | 30 +- src/jsc/ ... (truncated) ``` </details> **gate history** · 1 passed · 2 rejected · iteration 2 <details><summary>evidence per changed file</summary> ``` file reads edits tests scripts/build/unified.ts 1 1 0 src/codegen/generate-jssink.ts 0 0 0 src/js/node/dgram.ts 1 1 0 src/jsc/bindings/DOMURL.cpp 0 0 0 src/jsc/bindings/ImportMetaObject.cpp 0 0 0 src/jsc/bindings/JSBuffer.cpp 0 0 0 src/jsc/bindings/JSBufferEncodingType.cpp 2 3 0 src/jsc/bindings/JSBufferEncodingType.h 1 1 0 src/jsc/bindings/ScriptExecutionContext.h 0 0 0 src/jsc/bindings/ncrpyto_engine.cpp 0 4 0 src/jsc/bindings/ncrypto.cpp 2 6 0 src/jsc/bindings/ncrypto.h 5 8 0 src/jsc/bindings/webcore/ActiveDOMObject.cpp 0 3 0 src/jsc/bindings/webcore/ActiveDOMObject.h 1 3 0 src/jsc/bindings/webcore/EventDispatcher.cpp 0 4 0 src/jsc/bindings/webcore/EventDispatcher.h 1 3 0 (+ 41 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>
…n_jsc Rust (#36576) Net **-1185 lines** (+68 / -1253) across 24 files. Every removed item was verified to have zero references across `src/` and `build/debug/codegen/`, then confirmed by a full `bun bd` build and `bun run rust:check-all`. No overlap with the 11 open dead-code PRs (checked file lists of #34965 #34759 #36474 #36178 #36237 #35559 #35775 #36318 #36115 #35437 #35880). ### Whole-file deletions (C++, 1107 lines) | File | LOC | Verification | |---|---|---| | `src/jsc/bindings/node/http/llhttp/api.h` | 357 | Never `#include`d. Vendored upstream copy artifact; all 41 `LLHTTP_EXPORT` decls are duplicated verbatim in `llhttp.h`, and `api.c` includes `llhttp.h` not `api.h`. Only mentioned in `llhttp/README.md`. | | `src/jsc/bindings/webcore/JSDOMConvertWebGL.{h,cpp}` | 317 | Entire body guarded by `#if ENABLE(WEBGL)`. The .cpp `#include`s ~40 headers (`JSANGLEInstancedArrays.h` etc.) that don't exist in the repo, so the guard is provably inactive on every bun target. `IDLWebGLAny`/`IDLWebGLExtension` used nowhere else. | | `src/jsc/bindings/headers-cpp.h` | 190 | Only includer is `headergen/sizegen.cpp`, which isn't in any build rule. File itself has syntax errors (line 166 `#include ""ConsoleObject.h""`, lines 172-182 `#include ""`), so it cannot be compiling anywhere. | | `src/jsc/bindings/webcore/HTTPHeaderValues.{h,cpp}` | 108 | Header only included by its own .cpp; none of the five declared functions (`textPlainContentType`, `formURLEncodedContentType`, `applicationJSONContentType`, `noCache`, `maxAge0`) are called anywhere. | | `src/jsc/bindings/webcore/JSDOMConvertJSON.h` | 51 | Sole includer is the umbrella `JSDOMConvert.h`. `IDLJSON` is referenced nowhere outside `IDLTypes.h` (type decl) and this file. | | `src/jsc/bindings/ares_build.h` | 42 | Zero `#include`s anywhere under `src/`. Superseded by the generated `build/<profile>/deps/cares/ares_build.h` emitted by `scripts/build/deps/cares.ts`. | | `src/jsc/bindings/webcore/TaskSource.h` | 29 | Never `#include`d. Only referenced in commented-out code in `WebSocket.cpp` / `JSDOMPromiseDeferred.cpp`. | | `src/jsc/bindings/JSVMClientDataClient.h` | 13 | See `BunClientData` below. | ### C++ symbol removals - **`helpers.h`** (38 lines): `Zig::toAtomString(ZigString)`, `toStringNotConst`, `__dot_char`/`ZigStringCwd`/`BunStringCwd`, `toZigString(WTF::String*)`, `toZigString(JSC::Identifier&)` + `(JSC::Identifier*)`, `Zig::toStringView(ZigString)`. rg across src/ and codegen shows zero callers for each. - **`headers-handwritten.h`** (22 lines): `WritableEvent` typedef + 8 consts, `ReadableEvent` typedef + 9 consts. Zero references anywhere. - **`JSDOMWrapper.h`** (8 lines): `JSTextNodeType`, `JSProcessingInstructionNodeType`, `JSDocumentTypeNodeType`, `JSDocumentFragmentNodeType`, `JSDocumentWrapperType`, `JSCommentNodeType`, `JSCDATASectionNodeType`, `JSAttrNodeType`. Only referenced in commented-out code at `webcore/DOMJITHelpers.h:163-178`. (`JSNodeType`/`JSNodeTypeMask`/`JSElementType`/`JSAsJSONType` kept.) - **`BunClientData.{h,cpp}`** (9 lines): `addClient()` is never called, so `m_clients` is always empty and the `~JSVMClientData` `forEach`/`clear` loop is a no-op. Removed `addClient`, `m_clients`, the dtor loop, and the include of `JSVMClientDataClient.h`. - **`JSDOMConvert.h`** (2 lines): removed `#include` of the two deleted headers. - **`headergen/sizegen.cpp`** (2 lines): removed `#include "headers-cpp.h"`. The file is not in any build rule and was already uncompilable (its loop references `names[]`/`sizes[]`/`aligns[]`, none of which were ever fully defined); leaving the loop untouched to minimise conflict with #36115.. ### Rust removals - **`bun_core::String::github_action` + `StringGithubActionFormatter`** (22 lines): all four `.github_action()` call sites in `VirtualMachine.rs` are on `jsc::ZigString`, not `bun_core::String`. The `ZigString` variant is kept. - **`bun_jsc::JSUint8Array::ptr()` + `sizes::BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR`** (14 lines): zero callers. - **`bun_jsc::RefString::to_js()`** (9 lines): the sole external `RefString` user (`filesystem_router.rs`) never calls `.to_js()`. Removed along with now-unused `JSGlobalObject`/`JSValue`/`JsResult`/`StringJsc` imports. - **`bun_jsc::Errorable::value()`** (7 lines): identical body to `Errorable::ok()`; every caller uses `ok()`. ### Verification - `bun bd` passes - `bun run rust:check-all` passes on all targets - `bun bd test test/internal/source-lints/` passes (62 tests) - `bun bd test test/js/node/inspector/` passes (67 tests; exercises `BunDebugger.cpp`) - `bun bd test test/cli/install/bun-install-lifecycle-scripts.test.ts` passes (3 pre-existing env failures unrelated to this diff, reproduced on main) ### Followups (not in this diff) - `src/jsc/bindings/CachedScript.h` is semantically vestigial (empty class, all callers pass `nullptr`) but removing it requires editing signatures in `ScriptExecutionContext.h` / `JSDOMExceptionHandling.{h,cpp}`. - `src/ast/lib.rs` `StringBuilder` stub + the `count()` method chain is a no-op cluster but removing it requires dropping the `&mut StringBuilder` parameter from three `clone_with_builder` signatures. - `src/runtime/api/bun/h2/connection.rs` `send_header_block`/`send_push_promise`/`send_data`/`encode_header`/`begin_header_block` (~173 LOC) are only called from `#[cfg(test)]`; intentionally staged per the `h2/mod.rs` module doc for a future rewrite, so left alone. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 2 · 24 files touched <details><summary>fails on main (without fix)</summary> ```console ASAN without fix: 2 FAILED $ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts bun test v1.4.0 (6057ada) test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts: 50 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertWebGL\.h/], 51 | ["src/jsc/bindings/IDLTypes.h", /\bIDLJSON\b/], 52 | ["src/jsc/headergen/sizegen.cpp", /headers-cpp\.h/], 53 | ]; 54 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 55 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/helpers.h: static WTF::AtomString toAtomString\(ZigString", + "src/jsc/bindings/helpers.h: \btoStringNotConst\b", + "src/jsc/bindings/helpers.h: \b__dot_char\b", + "src/jsc/bindings/helpers.h: \bZigStringCwd\b", + "src/jsc/bindings/helpers.h: \bBunStringCwd\b", + "src/jsc/bindings/helpers.h: toZigString\(WTF::String\*", + "src/jsc/bindings/helpers.h: toZigString\(JSC::Identifier&", + "src/ ... (truncated) release without fix: 2 FAILED bun test v1.4.0-canary.1 (91f57fe) test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts: 50 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertWebGL\.h/], 51 | ["src/jsc/bindings/IDLTypes.h", /\bIDLJSON\b/], 52 | ["src/jsc/headergen/sizegen.cpp", /headers-cpp\.h/], 53 | ]; 54 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 55 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/helpers.h: static WTF::AtomString toAtomString\(ZigString", + "src/jsc/bindings/helpers.h: \btoStringNotConst\b", + "src/jsc/bindings/helpers.h: \b__dot_char\b", + "src/jsc/bindings/helpers.h: \bZigStringCwd\b", + "src/jsc/bindings/helpers.h: \bBunStringCwd\b", + "src/jsc/bindings/helpers.h: toZigString\(WTF::String\*", + "src/jsc/bindings/helpers.h: toZigString\(JSC::Identifier&", + "src/jsc/bindings/helpers.h: toZigString\(JSC::Identifier\*", + "src/jsc/bindings/helpers.h: static WTF::StringView toStringView\(ZigString", + "src/jsc/bindings/headers-handwritten.h: \bWritableE ... (truncated) ``` </details> <details><summary>passes on PR (with fix)</summary> ```console ASAN with fix: all passed $ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts bun test v1.4.0 (6057ada) test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts: (pass) dead C++ symbols in helpers.h / headers-handwritten.h / JSDOMWrapper.h / BunClientData do not reappear [37.66ms] (pass) dead Rust symbols in bun_core / jsc do not reappear [9.99ms] 2 pass 0 fail 2 expect() calls Ran 2 tests across 1 file. [2.03s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 647ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/122] gen cpp.rs (cppbind) [2/122] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [3/122] gen JS modules (bundle-modules) Preprocess modules (8812ms) Bundle modules (38ms) Postprocesss modules (34ms) Bundle Functions (748ms) Generate Code (19ms) [9.67s] Bundled "src/js" for production 2569 kb 193 internal modules 13 native modules 90 internal functions across 19 files [3/121] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu) nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19) �[1m�[92m Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core) �[1m�[92m Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno) �[1m�[92m Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr) �[1m�[92m Compiling�[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/boringssl_sys) �[1m�[92m Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety) �[1m� ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/bun_core/string/mod.rs | 22 -- src/jsc/Errorable.rs | 7 - src/jsc/JSUint8Array.rs | 13 - src/jsc/RefString.rs | 9 - src/jsc/bindings/BunClientData.cpp | 5 - src/jsc/bindings/BunClientData.h | 5 - src/jsc/bindings/IDLTypes.h | 12 - src/jsc/bindings/JSDOMWrapper.h | 8 - src/jsc/bindings/JSVMClientDataClient.h | 13 - src/jsc/bindings/ares_build.h | 42 --- src/jsc/bindings/headers-cpp.h | 190 ----------- src/jsc/bindings/headers-handwritten.h | 22 -- src/jsc/bindings/helpers.h | 38 --- src/jsc/bindings/node/http/llhttp/api.h | 357 --------------------- src/jsc/bindings/webcore/HTTPHeaderValues.cpp | 68 ---- src/jsc/bindings/webcore/HTTPHeaderValues.h | 40 --- src/jsc/bindings/webcore/JSDOMConvert.h | 2 - src/jsc/bindings/webcore/JSDOMConvertJSON.h | 51 --- src/jsc/bindings/webcore/JSDOMConvertWebGL.cpp | 249 -------------- src/jsc/bindings/webcore/JSDOMConvertWebGL.h | 68 ---- src/jsc/bindings/webcore/TaskSource.h | 29 -- src/jsc/headergen/sizegen.cpp | 2 - src/jsc/sizes.rs | 1 - .../dead-symbols-llhttp-helpers-install.test.ts | 68 ++++ 24 files changed, 68 insertions(+), 1253 deletions(-) ``` </details> **gate history** · 1 passed · 1 rejected · iteration 2 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/bun_core/string/mod.rs 1 2 0 src/jsc/Errorable.rs 1 1 0 src/jsc/JSUint8Array.rs 1 2 0 src/jsc/RefString.rs 2 2 0 src/jsc/bindings/BunClientData.cpp 1 1 0 src/jsc/bindings/BunClientData.h 2 2 0 src/jsc/bindings/IDLTypes.h 1 1 0 src/jsc/bindings/JSDOMWrapper.h 1 1 0 src/jsc/bindings/JSVMClientDataClient.h 0 0 0 src/jsc/bindings/ares_build.h 0 0 0 src/jsc/bindings/headers-cpp.h 0 0 0 src/jsc/bindings/headers-handwritten.h 1 1 0 src/jsc/bindings/helpers.h 2 2 0 src/jsc/bindings/node/http/llhttp/api.h 0 0 0 src/jsc/bindings/webcore/HTTPHeaderValues.cpp 0 0 0 src/jsc/bindings/webcore/HTTPHeaderValues.h 0 0 0 (+ 8 more files) ``` </details> <!-- robobun:evidence:end -->
…JSDOMConvert*, rescle, wasi (#36474) Net: **-3673 LOC** (30 files, +177 / -3850). No behavior change. Nothing here overlaps with the other open dead-code PRs (#34965, #34759, #36426, #36178, #36237, #35775, #35559, #36318, #36115, #35437, #35880); every touched file was checked against their file lists. ### SerializedScriptValue.cpp / .h (7239 → 5090, 413 → 202) - All `#if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)`, `#if ENABLE(WEB_RTC)`, `#if ENABLE(WEB_CODECS)`, `#if ENABLE(PREDEFINED_COLOR_SPACE_DISPLAY_P3)` blocks. Bun's JSCOnly `cmakeconfig.h` sets all four to 0 on every target, and the referenced types (`OffscreenCanvas`, `RTCCertificate`, `DetachedRTCDataChannel`, `WebCodecsVideoFrame`, ...) have no headers anywhere under `src/`, so the guarded bodies could not compile if the macros flipped. - ~1200 lines of long-commented-out serialization paths for DOM geometry (`DOMPoint`/`DOMRect`/`DOMMatrix`/`DOMQuad`), `ImageBitmap`, `File`/`FileList`, `Blob`, `ImageData`, blob-URL/IDB helpers, and alternate ctors. All date to 2022. - Uncalled public methods (`rg` across `src/` and `build/debug/codegen/`): `create(StringView)`, `create(JSContextRef, JSValueRef, JSValueRef*)`, `deserialize(JSContextRef, JSValueRef*)`, `toString()`, `nullValue()`, `wireFormatVersion()`, and the never-instantiated `encode<Encoder>()` / `decode<Decoder>()` templates. Plus their private-only helpers `CloneSerializer::serialize(StringView, Vector<uint8_t>&)`, `CloneDeserializer::deserializeString()`, `blobFilePathForBlobURL()`, `wrapCryptoKey()`, `unwrapCryptoKey()`, `write/read(DestinationColorSpaceTag)`, the `PLATFORM(COCOA)` `CFDataRef` helpers, and the `fillTransferMap(const Vector<Ref<T>>&, ...)` overload. - Orphaned enums `PredefinedColorSpaceTag`, `DestinationColorSpaceTag`, `ImageDataPoolTag`, `m_transferredImageBitmaps`, and 18 `SerializationTag` values that are no longer written or read in live code (`FileTag`, `FileListTag`, `ImageDataTag`, `BlobTag`, `DOMPoint*/Rect*/Matrix*/QuadTag`, `ImageBitmap*Tag`, `OffscreenCanvasTransferTag`, `RTC*Tag`, `WebCodecs*Tag`). The grammar-comment documentation block is kept. Followup note: `m_blobURLs` / `m_blobFilePaths` are now write-only (their sole reader `blobFilePathForBlobURL` is gone), but removing them cascades through the live `CloneDeserializer` ctor params and the public `deserialize(..., blobURLs, blobFilePaths, ...)` overload. Left as-is. ### WebSocket.cpp / .h (-212) - Uncalled `create(ctx, url, protocols, headers, bool)` 5-arg overload and the three `connect(const String&[, ...])` overloads (all `JSWebSocket.cpp` paths use the 2/3/8/9-arg `create` and the 4-arg `connect`). - `didUpdateBufferedAmount(unsigned)`, the decl-only `didReceiveData(const char*, size_t)` and `WebSocket(ScriptExecutionContext&, const String&)`, and the uncalled `offerPerMessageDeflate()` getter. - 2022-era commented-out blocks: CSP/portAllowed, `ResourceLoadObserver`/`MixedContentChecker`, `ENABLE(INTELLIGENT_TRACKING_PREVENTION)`, `contextDestroyed`/`suspend`/`resume`/`stop`/`activeDOMObjectName`, four `ConnectedWebSocketKind::Server` case blocks, and the commented `#include`s. - `m_dispatchedErrorEvent` (only read by the removed `suspend`/`resume` block). ### JSDOMConvert{Sequences,Strings,Record,Union}.h / .cpp (-381) - `NumericSequenceConverter` and the five `SequenceConverter<IDL{Long,Float,UnrestrictedFloat,Double,UnrestrictedDouble}>` specializations. `IDLSequence<T>` is only instantiated with string / enum / interface / dictionary / object element types in Bun (`rg 'IDLSequence<IDL(Long|Float|Double|Unrestricted)' src/ build/debug/codegen/` = 0). - `Converter<IDLFrozenArray<T>>` (only the `JSConverter` side is used), `JSConverter<IDLRecord<K,V>>` (only the `Converter` side is used), and the `IDLAllowSharedAdaptor<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>>` specs (webcrypto uses the un-wrapped union). - `propertyNameToString` / `propertyNameToAtomString`, the `IDLLegacyNullToEmpty{,Atom}StringAdaptor` and `IDLAtomStringAdaptor<IDL{USV,Byte}String>` converters, and `valueToByteAtomString` / `valueToUSVAtomString` (their only callers). ### windows/rescle.cpp / .h (-278) The only entry point `rescle__setWindowsMetadata` (from `src/sys/windows/mod.rs`) uses `Load`, `SetIcon`, `SetVersionString`, `SetFileVersion`, `SetProductVersion`, `Commit`. Removed `SetExecutionLevel`, `IsExecutionLevelSet`, `SetApplicationManifest`, `IsApplicationManifestSet`, `GetVersionString`×2, `ChangeString`×2, `ChangeRcData`, `GetString`×2, `OnEnumResourceManifest` + its `Load()` registration, the now-always-false execution-level and manifest branches in `Commit()`, `ReadFileToString`, the `executionLevel_`/`originalExecutionLevel_`/`applicationManifestPath_`/`manifestString_` members, and five unused `RU_VS_*` macros. Followup note: with `ChangeString`/`ChangeRcData` gone, `stringTableMap_` and `rcDataLngMap_` are now populated by `Load()` and written back unchanged by `Commit()`. That round-trip was already a semantic no-op on `main` (the removed mutators had zero callers there too), but removing it touches a live Windows `bun build --compile` path rather than an unreferenced helper, so it is deferred rather than folded into this sweep. ### Performance.cpp / .h + PerformanceObserver.h (-154) - `addResourceTiming(ResourceTiming&&)` (no callers; Bun's fetch produces `PerformanceResourceTiming` via `queueEntry` directly), `isResourceTimingBufferFull()`, `m_backupResourceTimingBuffer`, `m_waitingForBackupBufferToBeProcessed`. - `allowHighPrecisionTime()` + `highTimePrecision`, `timeResolution()`, `relativeTimeFromTimeOriginInReducedResolution(MonotonicTime)` (no callers). - 2024-era commented-out `navigation()`, `reportFirstContentfulPaint`/`addNavigationTiming`/`navigationFinished`, `resourceTimingBufferFullTimerFired()`. - `PerformanceObserver.h`: `hasNavigationTiming`/`addedNavigationTiming`/`m_hasNavigationTiming` (only referenced from the commented-out code above). ### EventTarget.cpp / .h + EventListenerMap (-51) - `isPaymentRequest()` virtual (no callers, no overriders). - `legacyType(const Event&)` static, which unconditionally returned `nullAtom()` since 2022, and the legacy-fallback block in `fireEventListeners` it made unreachable. - `hasCapturingEventListeners(const AtomString&)` (no callers) and its only callee `EventListenerMap::containsCapturing`. - Decl-only `invalidateJSEventListeners(JSC::JSObject*)`. ### src/js/node/wasi.ts (-280) - The four `exports.X = exports.Y = ... = void 0;` pre-declaration chains (186 LOC). These are tsc emit artifacts from the original `wasi-js` npm bundle; every property is re-assigned to its real value immediately after. - `WASIExitError` / `WASIKillError` classes (the `types` module is only consumed as `types_1.WASIError`). - `exports.SOCKET_DEFAULT_RIGHTS` (written once, never read). - `initWasiFdInfo()` (never called; contains five debug `console.log` calls). - `if (log.enabled) { ... }` blocks and bare `log(...)` / `logOpen(...)` calls (`log` is hard-coded to `() => {}` and never reassigned). ### src/js/thirdparty/ws.js (-19) - Long-commented-out `secWebSocketExtensions` / `PerMessageDeflate` block (May 2023). ### Rust (-22) - `bun_http`: `PRINT_EVERY` / `PRINT_EVERY_I` debug scaffolding and the `if PRINT_EVERY != 0 { ... }` block it made always-dead. - `bun_threading`: drop `GuardedBy`, `RawMutex`, `RwLockReadGuard`, `RwLockWriteGuard` from the crate re-export list (zero `bun_threading::X` references; the backing types stay for `Guarded`'s impl). - `bun_standalone_graph`: `Error::UnsupportedTarget` variant (never constructed; `download_to_path` returns other variants). - `bun_bunfig`: the unused `OfflineMode` re-export. ### Verification - `rg -w <symbol> src/ build/debug/codegen/ src/codegen/` returned only the definition for each deleted item. - `bun bd` builds clean. - `bun run rust:check-all` passes on all 10 targets (linux/macos/windows × x64/aarch64, plus musl). - Smoke tests pass: `structured-clone.test.ts` (231/231), `structuredClone-classes.test.ts`, `worker_threads.test.ts` (91/91), `websocket-client.test.ts`, `abort.test.ts`, `performance-entries.test.ts`, `wasi.test.js`, `deno/event/event-target.test.ts`. - New `test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts` guards against reintroduction: fails (7/7) with `src/` at `main`, passes (7/7) with this diff. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 1 · 30 files touched <details><summary>fails on main (without fix)</summary> ```console ASAN without fix: 7 FAILED $ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts bun test v1.4.0 (e0122fc) test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts: 47 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static Ref<SerializedScriptValue> nullValue\(\)/], 48 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static uint32_t wireFormatVersion\(\)/], 49 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /void encode\(Encoder&\) const/], 50 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static RefPtr<SerializedScriptValue> decode\(Decoder&/], 51 | ]; 52 | expect(resurrected(checks)).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(OFFSCREEN_CANVAS_IN_WORKERS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_RTC\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_CODECS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ... (truncated) release without fix: 7 FAILED bun test v1.4.0-canary.1 (754b4fe) test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts: 47 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static Ref<SerializedScriptValue> nullValue\(\)/], 48 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static uint32_t wireFormatVersion\(\)/], 49 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /void encode\(Encoder&\) const/], 50 | ["src/jsc/bindings/webcore/SerializedScriptValue.h", /static RefPtr<SerializedScriptValue> decode\(Decoder&/], 51 | ]; 52 | expect(resurrected(checks)).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(OFFSCREEN_CANVAS_IN_WORKERS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_RTC\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: ENABLE\(WEB_CODECS\)", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: readRTCCertificate", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: readOffscreenCanvas", + "src/jsc/bindings/webcore/SerializedScriptValue.cpp: readWebCodecsVideoFrame", + " ... (truncated) ``` </details> <details><summary>passes on PR (with fix)</summary> ```console ASAN with fix: all passed $ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts bun test v1.4.0 (e0122fc) test/internal/source-lints/dead-symbols-ssv-wasi-webcore.test.ts: (pass) dead SerializedScriptValue ENABLE() blocks and unused public methods do not reappear [71.54ms] (pass) dead WebSocket create/connect overloads and commented-out WebKit blocks do not reappear [23.13ms] (pass) dead Performance/PerformanceObserver/EventTarget members do not reappear [22.29ms] (pass) dead JSDOMConvert* template specializations do not reappear [16.77ms] (pass) dead windows/rescle.cpp resource-editing methods do not reappear [19.33ms] (pass) dead wasi.ts bundle artifacts and debug scaffolding do not reappear [14.77ms] (pass) dead Rust http/threading/standalone_graph/bunfig items do not reappear [8.79ms] 7 pass 0 fail 7 expect() calls Ran 7 tests across 1 file. [2.27s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 718ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/138] gen ErrorCode+*.h [2/138] gen bake.{client,server,error}.js -> bake.client.js, bake.server.js, bake.error.js [3/138] gen JSEvent.lut.h Generating /workspace/bun/build/release/codegen/JSEvent.lut.h from /workspace/bun/src/jsc/bindings/webcore/JSEvent.cpp [4/138] gen JSBuffer.lut.h Generating /workspace/bun/build/release/codegen/JSBuffer.lut.h from /workspace/bun/src/jsc/bindings/JSBuffer.cpp [5/138] gen cpp.rs (cppbind) [6/138] gen JSSink.{cpp,h,lut.h,rs} generated_jssink.rs: 6 sinks, 72 exported symbols Generating /workspace/bun/build/release/codegen/JSSink.lut.h from /workspace/bun/build/release/codegen/JSSink.lut.txt [7/138] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [8/138] gen JS modules (bundle-modules) Preprocess modules (9054ms) Bundle modules (45ms) Postprocesss modules (217ms) Bundle Functions (732ms) Generate Code (35ms) [10.10s] Bundled "src/js" for production 2561 kb 193 internal modules 1 ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/bunfig/bunfig.rs | 2 - src/http/lib.rs | 12 - src/js/node/wasi.ts | 282 +-- src/js/thirdparty/ws.js | 19 - src/jsc/bindings/IDLTypes.h | 8 - src/jsc/bindings/webcore/Event.h | 1 - src/jsc/bindings/webcore/EventListenerMap.cpp | 13 - src/jsc/bindings/webcore/EventListenerMap.h | 1 - src/jsc/bindings/webcore/EventTarget.cpp | 29 +- src/jsc/bindings/webcore/EventTarget.h | 9 - src/jsc/bindings/webcore/JSDOMConvertNumbers.h | 30 - src/jsc/bindings/webcore/JSDOMConvertRecord.h | 31 - src/jsc/bindings/webcore/JSDOMConvertSequences.h | 209 -- src/jsc/bindings/webcore/JSDOMConvertStrings.cpp | 25 - src/jsc/bindings/webcore/JSDOMConvertStrings.h | 95 - src/jsc/bindings/webcore/JSDOMConvertUnion.h | 21 - src/jsc/bindings/webcore/Performance.cpp | 165 +- src/jsc/bindings/webcore/Performance.h | 27 +- src/jsc/bindings/webcore/PerformanceObserver.cpp | 2 +- src/jsc/bindings/webcore/PerformanceObserver.h | 4 - src/jsc/bindings/webcore/SerializedScriptValue.cpp | 2163 +------------------- src/jsc/bindings/webcore/SerializedScriptValue.h | 213 +- src/jsc/bindings/webcore/WebSocket.cpp | 197 -- src/jsc/bindings/webcore/WebSocket.h | 15 - src/jsc/bindings/windows/rescle.cpp | 261 --- src/jsc/bindings/windows/rescle.h | 21 - src/standalone_graph/StandaloneModuleGraph.rs | 4 - src/standalone_graph/error.rs | 3 - src/threading/lib.rs | 5 +- .../dead-symbols-ssv-wasi-webcore.test.ts | 160 ++ 30 files changed, 177 insertions(+), 3850 deletions(-) ``` </details> **gate history** · 7 passed · 0 rejected · iteration 1 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/bunfig/bunfig.rs 0 0 0 src/http/lib.rs 0 0 0 src/js/node/wasi.ts 0 0 0 src/js/thirdparty/ws.js 0 0 0 src/jsc/bindings/IDLTypes.h 1 1 0 src/jsc/bindings/webcore/Event.h 1 1 0 src/jsc/bindings/webcore/EventListenerMap.cpp 1 1 0 src/jsc/bindings/webcore/EventListenerMap.h 1 1 0 src/jsc/bindings/webcore/EventTarget.cpp 0 0 0 src/jsc/bindings/webcore/EventTarget.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertNumbers.h 2 1 0 src/jsc/bindings/webcore/JSDOMConvertRecord.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertSequences.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertStrings.cpp 0 0 0 src/jsc/bindings/webcore/JSDOMConvertStrings.h 0 0 0 src/jsc/bindings/webcore/JSDOMConvertUnion.h 0 0 0 (+ 14 more files) ``` </details> <!-- robobun:evidence:end --> --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
…C++ bindings (#36756) Removes 741 net LOC of unreferenced C++ from `src/jsc/bindings/` and `src/jsc/bindings/webcore/`. Every symbol was verified to have zero callers across `src/` and `build/debug/codegen/`, and the full debug build links cleanly. No overlap with any open dead-code PR (#35437, #35559, #35775, #35880, #36115, #36178, #36237, #36318, #36621, #36742). ### Whole files deleted - `webcore/DOMJITCheckDOM.h` (98 LOC): only includer was `JSEventDOMJIT.cpp` - `webcore/JSEventDOMJIT.cpp` (43 LOC): defined `checkSubClassSnippetForJSEvent`, whose sole reference in `JSEvent.cpp:242` was behind `#if 0` (nullptr used instead) - `webcore/DOMJITHelpers.cpp` (57 LOC): every function body was already commented out; compiled to an empty namespace - `webcore/JSDOMConvertSerializedScriptValue.h` (50 LOC): only includer was the `JSDOMConvert.h` umbrella; `IDLSerializedScriptValue<>` was never instantiated anywhere ### webcore/DOMJITHelpers.h Removed the entire `WebCore::DOMJIT` namespace body (~184 LOC: `branchIf*`, `toWrapper`, `tryLookUpWrapperCache`, `operationToJSNode`/`operationToJSContainerNode` declarations, and ~60 LOC of commented-out helpers). All 7 remaining includers (`generate-classes.ts` output, `JSBuffer.cpp`, `JSPerformance.cpp`, `JSTextEncoder.cpp`, `JSFFIFunction.cpp`, `JSSQLStatement.cpp`, `ZigGeneratedCode.cpp`) use only `JSC::DOMJIT::*` from JavaScriptCore headers, never `WebCore::DOMJIT::*`. The transitive `#include`s are kept. ### webcore/EventContext.{h,cpp} Removed `handleLocalEvents`, `node()`, `relatedTarget()`, `setRelatedTarget`, `isMouseOrFocusEventContext`, `isTouchEventContext`, `isWindowContext`, `isUnreachableNode`, the `(Type, Node&, ...)` constructor overload, the `Type` enum and `m_type` field, `m_relatedTarget`, `m_contextNodeIsFormElement`, and all `TOUCH_EVENTS` / commented-out blocks. Only `currentTarget()` / `closedShadowDepth()` / `target()` are reachable (via `EventPath::computePathUnclosedToTarget`). ### webcore/EventPath.{h,cpp} Removed the empty `EventPath(Node&, Event&)` constructor, `contextAt`, `eventTargetRespectingTargetRules`, the `buildPath` / `setRelatedTarget` declarations (never defined), the `Touch` forward decl and `TOUCH_EVENTS` block. ### webcore/EventListenerMap.{h,cpp} Removed `removeFirstEventListenerCreatedFromMarkup`, `copyEventListenersNotCreatedFromMarkupToTarget`, and their file-local static helpers. WebKit markup-listener transfer helpers with zero callers in Bun. ### ErrorCode.{h,cpp} - `Bun::toJS(JSGlobalObject*, ErrorCode)`: declared, never defined, never called - `INVALID_FILE_URL_HOST(..., const ASCIILiteral)` overload: not declared in the header, so the two call sites in `BunObject.cpp` bind to the `const WTF::String&` overload - `CRYPTO_JWK_UNSUPPORTED_CURVE(..., const WTF::String&)` overload: the only call site in `KeyObject.cpp` passes `(ASCIILiteral, const char*)`, matching the other overload - `Message::ERR_INVALID_ARG_TYPE(..., const ZigString*, const ZigString*, JSValue)` overload: zero callers ### DOMException.{h,cpp} Removed `create(const Exception&)` (zero callers) and the static `name(ExceptionCode)` / `message(ExceptionCode)` helpers (zero callers; `description(ec).name` is used directly where needed). ### CookieMap.{h,cpp} Removed `struct CookieStoreGetOptions` (zero references), `getAll()` (not in the `JSCookieMap` prototype table; `toJSON()` enumerates directly), and the private `CookieMap(Vector<Ref<Cookie>>&&)` constructor (zero `adoptRef` sites use it). ### DOMFormData.{h,cpp} Removed `clone()`; zero callers. ### Single-line declarations - `Cookie.h`: `isValidCookieValue` (declared, never defined; the trailing comment already said "this isn't needed") - `ImportMetaObject.h`: `createRequireFunction` (declared, never defined) - `JSCommonJSModule.h`: `setSourceCode` (declared, never defined), `clearSourceCode`, `idOrDot` - `Sink.h`: `numberOfSinkIDs` constexpr - `ProcessBindingTTYWrap.cpp`: duplicate forward declaration of `Process_functionInternalGetWindowSize` (already declared via `JSC_DECLARE_HOST_FUNCTION` in the header) ### Also scanned, nothing confidently dead `src/http/`, `src/ast/`, `src/semver/`, `src/event_loop/`, `src/bun_core/`, `src/threading/`, `src/runtime/bake/dev_server/`, `src/js/thirdparty/`. All recently swept and clean. ### Intentionally not touched (possible followups) - `InspectorHTTPServerAgent::{requestWillBeSent,responseReceived,bodyChunkReceived,requestFinished,requestHandlerException}` and `InspectorBunFrontendDevServerAgent::{clientErrorReported,graphUpdate}`: look like in-progress inspector scaffolding with matching Rust-side extern declarations; left alone - `webcore/streams/CrossRealmTransform.cpp` stubs: explicitly documented as frozen-ABI placeholders for transferable streams - `JSEventListener::wasCreatedFromMarkup()` and `m_wasCreatedFromMarkup`: now the only readers are gone, but removing the bitfield changes class layout; left for a separate pass - `webcore/ResourceLoadTiming.h`: only includers are `ResourceTiming.{h,cpp}` which #36621 modifies; avoided to prevent merge conflicts ### Verification - `rg -w <symbol> src/ build/debug/codegen/` returned only the definition for every removed item - `bun bd` builds and links - Smoke tests: `test/js/bun/cookie/cookie-map.test.ts`, `test/js/bun/globals.test.js`, `test/js/web/abort/abort.test.ts`, `test/js/web/fetch/body.test.ts -t FormData` all pass - `test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts` asserts the removed symbols do not reappear <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 4 · 29 files touched <details><summary>fails on main (without fix)</summary> ```console ASAN without fix: 3 FAILED $ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts bun test v1.4.0 (1752533) test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts: 28 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertSerializedScriptValue\.h/], 29 | ["src/jsc/bindings/webcore/JSEvent.cpp", /checkSubClassSnippetForJSEvent/], 30 | ["src/jsc/bindings/webcore/JSEvent.h", /checkSubClassSnippetForJSEvent/], 31 | ]; 32 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 33 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/DOMJITHelpers.h: namespace DOMJIT\b", + "src/jsc/bindings/webcore/DOMJITHelpers.h: branchIfNotWorldIsNormal|branchIfNotEvent|operationToJSNode", + "src/jsc/bindings/webcore/JSDOMConvert.h: JSDOMConvertSerializedScriptValue\.h", + "src/jsc/bindings/webcore/JSEvent.cpp: checkSubClassSnippetForJSEvent", + "src/jsc/bind ... (truncated) release without fix: 3 FAILED bun test v1.4.0-canary.1 (8fc0aeb) test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts: 28 | ["src/jsc/bindings/webcore/JSDOMConvert.h", /JSDOMConvertSerializedScriptValue\.h/], 29 | ["src/jsc/bindings/webcore/JSEvent.cpp", /checkSubClassSnippetForJSEvent/], 30 | ["src/jsc/bindings/webcore/JSEvent.h", /checkSubClassSnippetForJSEvent/], 31 | ]; 32 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 33 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/DOMJITHelpers.h: namespace DOMJIT\b", + "src/jsc/bindings/webcore/DOMJITHelpers.h: branchIfNotWorldIsNormal|branchIfNotEvent|operationToJSNode", + "src/jsc/bindings/webcore/JSDOMConvert.h: JSDOMConvertSerializedScriptValue\.h", + "src/jsc/bindings/webcore/JSEvent.cpp: checkSubClassSnippetForJSEvent", + "src/jsc/bindings/webcore/JSEvent.h: checkSubClassSnippetForJSEvent", + ] - Expected - 1 + Received + 7 at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode. ... (truncated) ``` </details> <details><summary>passes on PR (with fix)</summary> ```console ASAN with fix: all passed $ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts bun test v1.4.0 (1752533) test/internal/source-lints/dead-symbols-domjit-eventpath-errorcode.test.ts: (pass) webcore DOMJIT dead files and helpers do not reappear [15.85ms] (pass) webcore EventPath/EventContext/EventListenerMap dead members do not reappear [19.37ms] (pass) misc C++ bindings dead declarations do not reappear [28.64ms] 3 pass 0 fail 3 expect() calls Ran 3 tests across 1 file. [2.08s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 645ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/83] gen ErrorCode+*.h [2/83] gen JSEvent.lut.h Generating /workspace/bun/build/release/codegen/JSEvent.lut.h from /workspace/bun/src/jsc/bindings/webcore/JSEvent.cpp [3/83] cxx obj/unified/UnifiedSource-src_jsc_bindings_node-0.cpp.o [4/83] cxx obj/unified/UnifiedSource-src_jsc_bindings_v8-0.cpp.o [5/83] cxx obj/unified/UnifiedSource-src_jsc_bindings_node_http-0.cpp.o [6/83] cxx obj/unified/UnifiedSource-src_jsc_bindings-5.cpp.o [7/83] gen cpp.rs (cppbind) [8/83] gen generated_host_exports.rs generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 239 extern-C blocks audited [8/83] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu) nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19) �[1m�[92m Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core) �[1m�[92m Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno) �[1m�[92m Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr) �[1m�[92m Compiling�[0m bun ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` src/jsc/bindings/Cookie.h | 1 - src/jsc/bindings/CookieMap.cpp | 18 -- src/jsc/bindings/CookieMap.h | 7 - src/jsc/bindings/DOMException.cpp | 8 - src/jsc/bindings/DOMException.h | 6 - src/jsc/bindings/DOMFormData.cpp | 8 - src/jsc/bindings/DOMFormData.h | 1 - src/jsc/bindings/ErrorCode.cpp | 29 ---- src/jsc/bindings/ErrorCode.h | 2 - src/jsc/bindings/IDLTypes.h | 2 - src/jsc/bindings/ImportMetaObject.h | 2 - src/jsc/bindings/JSCommonJSModule.h | 5 - src/jsc/bindings/ProcessBindingTTYWrap.cpp | 2 - src/jsc/bindings/Sink.h | 2 - src/jsc/bindings/webcore/DOMJITCheckDOM.h | 98 +---------- src/jsc/bindings/webcore/DOMJITHelpers.cpp | 57 +------ src/jsc/bindings/webcore/DOMJITHelpers.h | 185 --------------------- src/jsc/bindings/webcore/EventContext.cpp | 34 ---- src/jsc/bindings/webcore/EventContext.h | 116 +------------ src/jsc/bindings/webcore/EventListenerMap.cpp | 45 ----- src/jsc/bindings/webcore/EventListenerMap.h | 5 - src/jsc/bindings/webcore/EventPath.cpp | 18 +- src/jsc/bindings/webcore/EventPath.h | 37 ----- src/jsc/bindings/webcore/JSDOMConvert.h | 1 - .../webcore/JSDOMConvertSerializedScriptValue.h | 50 +----- src/jsc/bindings/webcore/JSEvent.cpp | 10 +- src/jsc/bindings/webcore/JSEvent.h | 4 - src/jsc/bindings/webcore/JSEventDOMJIT.cpp | 43 +---- ...dead-symbols-domjit-eventpath-errorcode.test.ts | 90 ++++++++++ 29 files changed, 101 insertions(+), 785 deletions(-) ``` </details> **gate history** · 5 passed · 2 rejected · iteration 4 <details><summary>evidence per changed file</summary> ``` file reads edits tests src/jsc/bindings/Cookie.h 2 1 0 src/jsc/bindings/CookieMap.cpp 2 1 0 src/jsc/bindings/CookieMap.h 2 3 0 src/jsc/bindings/DOMException.cpp 2 3 0 src/jsc/bindings/DOMException.h 2 3 0 src/jsc/bindings/DOMFormData.cpp 1 1 0 src/jsc/bindings/DOMFormData.h 1 1 0 src/jsc/bindings/ErrorCode.cpp 1 1 0 src/jsc/bindings/ErrorCode.h 1 1 0 src/jsc/bindings/IDLTypes.h 1 1 0 src/jsc/bindings/ImportMetaObject.h 2 1 0 src/jsc/bindings/JSCommonJSModule.h 1 2 0 src/jsc/bindings/ProcessBindingTTYWrap.cpp 2 1 0 src/jsc/bindings/Sink.h 2 1 0 src/jsc/bindings/webcore/DOMJITCheckDOM.h 0 1 0 src/jsc/bindings/webcore/DOMJITHelpers.cpp 1 1 0 (+ 13 more files) ``` </details> <!-- robobun:evidence:end --> --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
|
too many conflicts |
|
Rebasing onto main now. |
…_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>
… and build scripts (#36937) Removes 2,255 lines (net -2,057) of verified-dead code across 116 files: unused `pub` items the `dead_code` lint cannot see (it treats every `pub` item as an external API root), unreferenced FFI declarations, orphaned files, stale commented-out C++ blocks, and dead build-script helpers. Method: started from `scripts/find-dead-exports.ts`, narrowed 8,259 candidates to 1,039 whose name appears in exactly one file across src/, scripts/, test/, and regenerated `build/debug/codegen/` output, then demoted each to private and let the workspace's `dead_code = deny` prove which were genuinely unreferenced. Items the compiler proved live (macro expansions, return-position escapes, cfg(windows)/cfg(darwin) usage, codegen references) were restored; the rest were deleted. Areas with open dead-code PRs (#36237, #35775, #36115, #35437, #35880) were excluded, and the one overlapping deletion found during final diffing (`kGetNativeReadableProto`, already in #35775) was dropped from this PR. ### Removed **FFI declaration crates** (unused imports of vendored C functions; declarations only, no link-time effect): - `src/mimalloc_sys/mimalloc.rs`: ~100 declarations (heap-local variants `mi_heap_*`, stats/options surface `mi_stats_*` `mi_option_*`, posix shims `mi_posix_memalign`/`mi_valloc`/`mi_pvalloc`, C++ `mi_new_*` family) - `src/windows_sys/externs.rs`: never-constructed `WinsockError` + ~100 `WSA*` error consts, `GetBinaryTypeW`, `CreateJobObjectW`, `M128A` kept (used by `CONTEXT` on windows) - `src/zlib_sys/win32.rs`: 44 declarations (`gz*` file API, `deflateTune`, `inflateUndermine`, `zlibCompileFlags`, ...) - `src/cares_sys/c_ares.rs`: 21 (option/server-config surface `ares_set_servers*`, `ares_mkquery`, `ares_parse_txt_reply_ext`, ...) - `src/lsquic_sys/lib.rs`: 11 (handshake/conn status consts, stream-ctx helpers) - `src/brotli_sys`, `src/boringssl_sys`, `src/libdeflate_sys`: 17 combined (`BrotliEncoder*` estimators, `TLS_with_buffers_method`, `libdeflate_*_decompress`, ...) **Rust runtime/support crates**: - `src/bun_core/env.rs`: `BuildTarget::Wasi` variant + `IS_WASI` (never constructed; `IS_BROWSER` simplifies to `IS_WASM`) - `src/jsc/HTTPServerAgent.rs`: 5 unused Rust-side imports of `Bun__HTTPServerAgent__notify*` + 2 type aliases - `src/runtime/test_runner/mod.rs`: `JSGlobalObjectTestExt::throw2` (duplicated `throw_error`) - `src/runtime/server/NodeHTTPResponse.rs`: unused `pause_socket` sibling cleanup; `pause_socket_reads` kept (referenced by generated bindings) - ~230 surviving demotions of file-local `pub` items to private across 60 crates, which moves them permanently under `dead_code` analysis - assorted single items: dead re-export lines in `sql_jsc`/`sourcemap_jsc`/`bundler_jsc`/`runtime/api.rs`, `EventLoopGuard`-adjacent aliases, unused imports **Built-in JS / codegen / build scripts**: - `src/node-fallbacks/timers.promises.js` (238 lines): never registered in `src/resolver/node_fallbacks.rs`'s 23-module registry, so it was built and compressed on every build but could never be served - `src/js/internal/crypto/x509.ts` + its row in `ProcessBindingNatives.cpp`: `process.binding("crypto/x509")` is implemented natively in `BunProcess.cpp` - `src/js/internal/validators.ts`: `validateUndefined`, `validateSignalName`/`validatePlainFunction` export entries - `src/js/internal/{shared,tls,streams/utils}.ts`: dead export-object entries (definitions stay where used in-file); `primordials.js`: 5 dead scalar-constructor keys (typed-array keys kept: `util.inspect` reaches them via computed `primordials[tag]` access) - `src/codegen`: `camelCase`, `pascalCase`, `warnOnIdentifiersNotPresentAtRuntime`, `DOMJITReturnType`, `ownRow`, `cppPointer` - `scripts/build`: `explainFlags` (no `--explain-flags` exists), `assertDefined`, `depSourceStamp`; root `package.json` `bump` script (its target was deleted in #13427) **Orphaned files**: `src/fixtures_example.com.html`, `src/zlib.test.txt` + `src/zlib.test.gz` (2021 inline-test fixtures), `src/fallback.html` (only `fallback-backend.html` is embedded), `src/logo.svg`, `src/favicon.png` **Stale commented-out C++ blocks** (~243 lines, all >6 months old via git blame): minicoro scaffolding in `coroutine.cpp` (2022), pasted Node JS source in `JSX509CertificatePrototype.cpp`, commented `BINDING_INTEGRITY` vtable checks, `InspectorInstrumentation` calls in `WebSocket.cpp`, suspended-event-loop paths in `JSDOMPromiseDeferred.cpp`, commented-out function bodies in `Performance.cpp`/`Event.cpp`/`DOMWrapperWorld.cpp`/`ErrorEvent.cpp` and 8 more webcore files ### Verification ``` cargo check --workspace # green (dead_code/unreachable_pub/unused_* all deny) bun run rust:check-all # 10/10 targets (linux/macos/windows/freebsd/android x arches) bun bd # full debug build with freshly regenerated codegen bun test test/internal/source-lints/ # 65 pass (includes the new pin test below) bun bd test test/js/node/fs/fs.test.ts # 445 pass bun bd test test/js/node/http/node-http.test.ts # 144 pass, 1 env-dependent proxy failure also fails on released bun bun bd test test/js/bun/glob/match.test.ts # 29 pass bun bd test test/js/bun/resolve/resolve.test.ts # 50 pass ``` `test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts` pins representative removed symbols and the deleted files against reintroduction. The compiler-driven loop caught and restored every false positive the textual scan missed: methods on types that escape only via return position (`StdinReader::take_byte`, `HeaderSet::pairs`, bitset iterators), macro-referenced items (`comptime_string_map!` statics, `$crate::` paths), platform-gated items (`EmptyCopyFileState` on darwin/freebsd, `M128A`/`WriteKind` on windows), and generated-binding references (`get_insecure_http_parser`, `pause_socket_reads`) which only appear after codegen reruns. ### Followups (not removed) - `patches/ncrypto.patch` (919 lines) is referenced by nothing in `scripts/build/deps/*.ts` while every other patch file is; `src/jsc/bindings/ncrypto.{h,cpp}` already exist in patched form. Possibly kept as upstream-sync documentation, so left alone. - The `#if ENABLE(BINDING_INTEGRITY)` extern vtable scaffolding in `JSCustomEvent.cpp`/`JSPerformanceServerTiming.cpp` lost its only (commented) consumer but matches upstream WebKit codegen shape; left in place. - `.github/workflows/release.yml:2` references `.buildkite/scripts/release.sh`, which no longer exists (comment only). - `src/react_compiler` and `src/ini` were deliberately excluded: the former carries explicit not-yet-wired port markers, the latter's candidates proved live on inspection. <!-- robobun:evidence:begin --> --- **[decide:dep]** gate passed · iteration 3 · 126 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-pub-exports-sweep.test.ts bun test v1.4.0 (a9da323) test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts: 78 | ["src/libdeflate_sys/libdeflate.rs", /\bfn libdeflate_gzip_decompress\b/], 79 | ["src/brotli_sys/brotli_c.rs", /\bfn BrotliEncoderEstimatePeakMemoryUsage\b/], 80 | ["src/boringssl_sys/boringssl.rs", /\bfn TLS_with_buffers_method\b/], 81 | ]; 82 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 83 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/windows_sys/externs.rs: \bfn GetBinaryTypeW\b", + "src/windows_sys/externs.rs: \bfn CreateJobObjectW\b", + "src/windows_sys/externs.rs: \bstruct WinsockError\b", + "src/windows_sys/externs.rs: \bWSA_QOS_ESHAPERATEOBJ\b", + "src/mimalloc_sys/mimalloc.rs: \bfn mi_stats_print\b", + "src/mimalloc_sys/mimalloc.rs: \bfn mi_reserve_huge_os_pages_interleave\b", + "src/ ... (truncated) release without fix: 2 FAILED bun test v1.4.0-canary.1 (57ae5f0) test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts: 78 | ["src/libdeflate_sys/libdeflate.rs", /\bfn libdeflate_gzip_decompress\b/], 79 | ["src/brotli_sys/brotli_c.rs", /\bfn BrotliEncoderEstimatePeakMemoryUsage\b/], 80 | ["src/boringssl_sys/boringssl.rs", /\bfn TLS_with_buffers_method\b/], 81 | ]; 82 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 83 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/windows_sys/externs.rs: \bfn GetBinaryTypeW\b", + "src/windows_sys/externs.rs: \bfn CreateJobObjectW\b", + "src/windows_sys/externs.rs: \bstruct WinsockError\b", + "src/windows_sys/externs.rs: \bWSA_QOS_ESHAPERATEOBJ\b", + "src/mimalloc_sys/mimalloc.rs: \bfn mi_stats_print\b", + "src/mimalloc_sys/mimalloc.rs: \bfn mi_reserve_huge_os_pages_interleave\b", + "src/mimalloc_sys/mimalloc.rs: \bfn mi_heap_recalloc_aligned_at\b", + "src/mimalloc_sys/mimalloc.rs: \bfn mi_wdupenv_s\b", + "src/zlib_sys/win32.rs: \bfn gzprintf\b", + "src/zlib_sys/win32. ... (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-pub-exports-sweep.test.ts bun test v1.4.0 (a9da323) test/internal/source-lints/dead-symbols-pub-exports-sweep.test.ts: (pass) dead FFI declarations (sys crates) do not reappear [37.66ms] (pass) dead Rust symbols (bun_core, jsc, test_runner) do not reappear [9.84ms] (pass) orphaned files stay deleted [566.74ms] (pass) dead JS/codegen helpers do not reappear [56.45ms] (pass) stale commented-out C++ blocks stay deleted [22.77ms] 5 pass 0 fail 5 expect() calls Ran 5 tests across 1 file. [2.71s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 658ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/133] gen ErrorCode+*.h [2/133] 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/133] gen ZigGeneratedClasses.{cpp,h,rs} Found 2 classes from /workspace/bun/src/jsc/resolve_message.classes.ts - ResolveMessage (13 fields) - BuildMessage (10 fields) Found 1 classes from /workspace/bun/src/runtime/api/Archive.classes.ts - Archive (4 fields, 1 class fields) Found 2 classes from /workspace/bun/src/runtime/api/BunObject.classes.ts - ResourceUsage (8 fields) - Subprocess (20 fields) Found 1 classes from /workspace/bun/src/runtime/api/cron.classes.ts - CronJob (5 fields) Found 3 classes from /workspace/bun/src/runtime/api/filesystem_router.classes.ts - FileSystemRouter (5 fields) - FrameworkFileSystemRouter (2 fields) - MatchedRoute (8 fields) Found 1 classes from /workspace/bun/src/runtime/api/Glob.classes.ts - Glob (5 fields) Found 1 classes from /workspace/bun/src/runtime/api/h2.classes.ts - H2FrameP ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` package.json | 1 - scripts/build/error.ts | 13 - scripts/build/flags.ts | 39 +- scripts/build/source.ts | 8 - src/ast/lib.rs | 2 +- src/ast/nodes.rs | 1 - src/base64/lib.rs | 2 +- src/boringssl/lib.rs | 8 +- src/boringssl_sys/boringssl.rs | 12 +- src/brotli/lib.rs | 4 +- src/brotli_sys/brotli_c.rs | 47 +- src/bun_alloc/lib.rs | 10 +- src/bun_core/Global.rs | 2 +- src/bun_core/env.rs | 6 +- src/bun_core/fmt.rs | 14 +- src/bundler/HTMLScanner.rs | 2 +- src/bundler_jsc/PluginRunner.rs | 4 - src/cares_sys/c_ares.rs | 126 +--- src/codegen/generate-classes.ts | 33 -- src/codegen/generate-js2native.ts | 4 - src/codegen/helpers.ts | 10 - src/codegen/replacements.ts | 10 - src/collections/array_hash_map.rs | 4 +- src/crash_handler/lib.rs | 8 +- src/event_loop/MiniEventLoop.rs | 4 +- src/fallback.html | 28 - src/favicon.png | Bin 7804 -> 0 bytes src/fixtures_example.com.html | 50 -- src/glob/GlobWalker.rs | 4 +- src/http/lib.rs | 6 +- src/install/lib.rs | 8 +- src/install/lockfile.rs | 4 +- src/install/resolvers/fold ... (truncated) ``` </details> **gate history** · 3 passed · 1 rejected · iteration 3 <details><summary>evidence per changed file</summary> ``` file reads edits tests package.json 0 0 0 scripts/build/error.ts 0 0 0 scripts/build/flags.ts 0 0 0 scripts/build/source.ts 0 0 0 src/ast/lib.rs 0 0 0 src/ast/nodes.rs 1 1 0 src/base64/lib.rs 4 4 0 src/boringssl/lib.rs 1 1 0 src/boringssl_sys/boringssl.rs 1 2 0 src/brotli/lib.rs 0 0 0 src/brotli_sys/brotli_c.rs 1 2 0 src/bun_alloc/lib.rs 1 1 0 src/bun_core/Global.rs 0 0 0 src/bun_core/env.rs 1 1 0 src/bun_core/fmt.rs 1 2 0 src/bundler/HTMLScanner.rs 0 0 0 (+ 110 more files) ``` </details> <!-- robobun:evidence:end --> --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…c_sys, and orphaned files (#38213) Scheduled dead-code sweep. Areas were chosen to avoid the 17 dead-code PRs currently open (#35437 through #38005): every file below was either untouched by those PRs or, where a file is shared, the hunks are different symbols (checked mechanically against the open PR diffs; the only shared removed lines are `level = "expect"` style TOML boilerplate in unrelated `hawk.toml` blocks). Net: 47 files, about 2.7k lines removed; the only additions are the guard test, three one-line `#[cfg]` / import adjustments, and two doc-comment fixes for functions that went away. ### Removed **WebCore streams bindings (transferable streams were never implemented)** - `m_detached` bitfields on `JSReadableStream`, `JSWritableStream`, `JSTransformStream`: never read or written. - `$bunNativeType` / `$disturbed` private-name accessors on `ReadableStream.prototype` (4 getters/setters, their installs, `m_nativeType`, the reset in `ReadableStream__detach`, the two `BunBuiltinNames.h` entries and `builtins.d.ts` declarations): no builtin, C++ or test referenced either name. `$bunNativePtr` is still used and stays. **TextEncoder** - `TextEncoder::encode` / `encodeInto` / `EncodeIntoResult` and the `convertDictionary<EncodeIntoResult>` / `convertDictionaryToJS` specializations (`TextEncoder.h`, `TextEncoder.cpp`, `JSTextEncoder.h`, `JSTextEncoder.cpp`): the wrapper implements both methods through the Rust `TextEncoder__encode*` exports and only ever calls `impl.encoding()`, which is all that is left of the impl class. **node:crypto** - `JSKeyObject::create` and `JSKeyObject::subspaceFor` plus the `m_subspaceForJSKeyObject` / `m_clientSubspaceForJSKeyObject` slots: every key object is one of the three final subclasses, each of which defines its own `create`/`subspaceFor`; the base class is only used as a downcast target. - Commented-out `switch (m_curve)` block in `CryptoKeyOKP::algorithm()` (2023). **Other bindings** - `WriteBarrierList::list()`, the `WeakRefFinalizeFn` typedef in `Weak.cpp`, `JSC_MAC_VERSION_TBA` / `JSC_IOS_VERSION_TBA` in `root.h` (unused by every JSC header in the WebKit builds we ship against). - `Bun__resolve` host export (`bun_resolve` in `BunObject.rs` + the `extern "C"` declaration in `ImportMetaObject.h`): nothing in C++ or JS called it; the `Bun__resolveSync*` family is what is used. **node:http (`src/js/node/_http_server.ts`)** - `kDeprecatedReplySymbol` is a module-private `Symbol()` in `internal/http` that nothing ever sets on a response's options, so the constructor branch that installed the fetch-`Response` based `write`/`end` was unreachable. Removed it together with everything only it reached: `ServerResponse_writeDeprecated`, `ServerResponse_finalDeprecated`, `ensureReadableStreamController`, `drainHeadersIfObservable`, `emitRequestCloseNT`, `GlobalPromise`, and the now-unused imports (`controllerSymbol`, `firstWriteSymbol`, `deferredSymbol`, `runSymbol`, `emitErrorNextTickIfErrorListenerNT`). This also stops adding an `undefined`-valued `Symbol(deprecatedReply)` own property to every `ServerResponse`. - The `isNextIncomingMessageHTTPS` save/set/restore around request dispatch: the flag's only reader was removed in c4a937c, so the calls had no effect. - A 2025 commented-out `cluster._getServer` block in `Server.prototype.listen`. **Rust** (cross-crate analysis with hawk per `tools/hawk/README.md`, then each item re-checked with `rg`; callers were confirmed to be platform-gated, e.g. `node_fs` uses `sys_uv` on Windows) - `bun_sys`: `link`, `fdatasync` and the non-Linux `sendfile` stub (both the posix and Windows arms), the Windows arms of `fchown`, `chmod`, `chown`, `fsync`, `linkat`, `fchmodat`, `lchmod`, `lchown`, `futimens`, `lutimens`, `fcntl`, `socketpair`, the Windows `Name::as_zstr`, `c::kqueue` / `c::kevent` / `c::fork` / `c::fd_t`, `linux::Errno`, `darwin::OSLog::as_ptr`, the non-macOS `clonefile` stub, the non-Windows `get_fd_path_w` stub, `posix::sysctlbyname` (the typed `sysctl_read*` helpers stay), `posix::write`; and the two helpers that became unreferenced as a result, `linux_syscall::write_raw` and the `safe_libc::fdatasync` import, plus `windows::timespec_to_filetime`. `Tag::futimens` is now `#[cfg(not(windows))]` like the other tags whose only users are posix-side (the Windows `cargo check` flagged it once its Windows user was gone). - `bun_lsquic_sys`: the `Engine` wrapper (struct, impl, `Drop`), `Conn::{raw, set_ctx, ctx, n_avail_streams, sockaddr, status}`, `global_init`, `enable_logging`, `LSQVER_I001/I002`, and the `lsquic_conn_n_avail_streams` extern. `node:quic` drives lsquic through the raw externs directly. - `bun_spawn_sys`: `PosixSpawnResult::close` and the non-Linux `pifd_from_pid` stub (the only call site is Linux-gated). The `FdExt` import that `close` was the last Windows user of is now `#[cfg(unix)]`. - `bun_tcc_sys`: `State::run` and the `tcc_run` extern. - `hawk.toml`: the six `bun_platform` `darwin::Category::*` overrides, whose variants were deleted in #36833 (hawk reports them as `unknown_item`). **Orphaned files** (zero references repo-wide, searched with `git grep` including `.github`, `.buildkite`, `.vscode`, `scripts/`, `packages/` and the generated `build/debug/codegen/`) - `misctools/gdb/std_gdb_pretty_printers.py` (Zig standard-library pretty printers; the repo has no Zig left) and the `.vscode/launch.json` line that sourced it; `misctools/mime.js` (emitted a Zig `ComptimeStringMap`; MIME types now come from `src/http_types/mime_type_list.txt`); `misctools/.gitignore` (ignored outputs of Zig programs deleted long ago). - `patches/ncrypto.patch`: a one-off diff against Node's ncrypto committed with #17692. Unlike every other file under `patches/`, no `scripts/build/deps/*.ts` applies it, and `ncrypto.cpp`/`.h` have changed many times since, so it no longer describes anything. - `meta.json` (stray `--metafile` output committed in #26441), `workspace.code-workspace` (2021 single-folder VS Code workspace with Zig settings; `.vscode/` is the live config). - `src/jsc/bindings/v8-capture-stack-fixture.cjs`, `src/jsc/bindings/webcore/EventNames.in` (WebKit `make_event_factory.pl` input; Bun's `EventNames.h` is hand-written), `src/runtime/ffi/libtcc1.a.macos-aarch64` (superseded by the embedded `libtcc1.c`). - `src/runtime/bake/client/JavaScriptSyntaxHighlighterComponent.tsx` (its header says the client never uses it) and `JavaScriptSyntaxHighlighter.css`, which only it imported. The live `JavaScriptSyntaxHighlighter.ts` is untouched. - `packages/bun-release/scripts/npm-exec.ts` (`upload-npm.ts` bundles only `npm-postinstall.ts` and ships placeholder bins), `packages/bun-usockets/misc/{manual.md,gen_test_certs.sh,layout.png}` and `packages/bun-usockets/module.modulemap` (upstream leftovers, same class as the `bun-uws/misc` files removed in #37659). ### Verification - `rg` / `git grep` for every symbol and file name above across `src/`, `scripts/`, `packages/`, `test/`, `vendor/WebKit/Source` (for the C++ symbols) and freshly regenerated `build/debug/codegen/`. - Rust items come from a hawk `dead_public` report on this tree (release profile, all 11 shipped targets), filtered to items no open PR deletes; findings that are FFI struct fields, code tables, or API added in the last week were deliberately left alone. - `bun bd` builds, and the removed symbols are absent from the resulting binary / bundled JS / `generated_host_exports.rs`. `bun bd test` passes on `test/js/web/streams/streams.test.js`, `test/js/web/encoding/text-encoder.test.js`, `test/js/node/crypto/crypto.key-objects.test.ts`, `test/js/node/fs/fs.test.ts`, `test/js/bun/resolve/import-meta*.test.*` and `test/js/node/quic/quic-stream.test.ts`; `test/js/node/http/node-http.test.ts` passes except "request via http proxy, issue#4295", which fails identically with an unmodified bun in this container (ECONNREFUSED to its local proxy). - `cargo check --workspace` on the windows-msvc, darwin, freebsd, linux-musl, android and linux-gnu targets. - `test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts` pins everything above; all 40 content checks and 16 deleted-file checks fail against main and pass here. ### Left alone (probably dead, not deleted) - `src/simdutf_sys/simdutf.rs`: the whole `utf32` / big-endian wrapper tree (~150 lines, plus its externs and the matching shims in `bun-simdutf.cpp`) has no callers, but #37332 is editing the same extern block; worth a follow-up once that lands. Same story for the unused `Loop` / `uv_stat_t` / `ReturnCode` helpers in `libuv_sys`. - `src/js/internal/http.ts`: `kDeprecatedReplySymbol`, `controllerSymbol`, `runSymbol`, `deferredSymbol`, `firstWriteSymbol` and `get/setIsNextIncomingMessageHTTPS` lost their last users in this PR, but #35437 rewrites that exact region of the file. - The rest of the transferable-streams scaffolding: `JSCrossRealmTransformState` (never created; its only references are its `FOR_EACH_WEB_STREAMS_INTERNAL_STRUCTURE` entry and iso-subspace slots), `CrossRealmTransform.cpp`, and the `SourceKind::CrossRealm` / `SinkKind::CrossRealm` arms with their `case` labels. #37332 is already editing that cluster, so it is best removed as one unit once that lands. - `misctools/gen-unicode-table.ts` + `unicode-generator.ts` emit Zig source, but `src/bun_core/string/identifier.rs` still points at them as the generator to port; `misctools/generate-cli-completions.ts` + `completions/bun-cli.json` and `completions/spec.yaml` have no in-repo consumers but may have external ones. - `src/runtime/bake/{incremental,memory}_visualizer.html` (~800 lines): nothing serves them since the port, but `DevServer` still carries the message writers and stubs, so this looks like an unfinished port rather than dead code. - `packages/bun-inspector-frontend` (build script points at a path that no longer exists) and `packages/bun-build-mdx-rs` (2024 proof of concept) are unreferenced but are a product call. - `bun_shim_impl::read_without_launch` is the Windows `bunx` fast path that nothing calls any more; deleting it would drop a feature rather than a leftover. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 1 · 47 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-streams-http-misctools.test.ts bun test v1.4.0 (59bf369) test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts: 71 | // The Bun__resolve host export had no C++ or JS caller (only Bun__resolveSync 72 | // and its variants are used). 73 | ["src/jsc/bindings/ImportMetaObject.h", /\bBun__resolve\(/], 74 | ["src/runtime/api/BunObject.rs", /HOST_EXPORT\(Bun__resolve,|\bfn bun_resolve\b/], 75 | ]), 76 | ).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/streams/JSReadableStream.h: \bm_detached\b|\bm_nativeType\b", + "src/jsc/bindings/webcore/streams/JSTransformStream.h: \bm_detached\b", + "src/jsc/bindings/webcore/streams/JSWritableStream.h: \bm_detached\b", + "src/jsc/bindings/webcore/streams/JSReadableStream.cpp: bunNativeTypePrivateName|disturbedPrivateName", + "src/js/builtins/BunBuiltinNames.h: macro\((bunNativeType|disturbed)\)", + "src/jsc/bindings/webcore/TextEncoder.h: EncodeInto ... (truncated) release without fix: 3 FAILED bun test v1.4.0-canary.1 (da3851e) test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts: 71 | // The Bun__resolve host export had no C++ or JS caller (only Bun__resolveSync 72 | // and its variants are used). 73 | ["src/jsc/bindings/ImportMetaObject.h", /\bBun__resolve\(/], 74 | ["src/runtime/api/BunObject.rs", /HOST_EXPORT\(Bun__resolve,|\bfn bun_resolve\b/], 75 | ]), 76 | ).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/jsc/bindings/webcore/streams/JSReadableStream.h: \bm_detached\b|\bm_nativeType\b", + "src/jsc/bindings/webcore/streams/JSTransformStream.h: \bm_detached\b", + "src/jsc/bindings/webcore/streams/JSWritableStream.h: \bm_detached\b", + "src/jsc/bindings/webcore/streams/JSReadableStream.cpp: bunNativeTypePrivateName|disturbedPrivateName", + "src/js/builtins/BunBuiltinNames.h: macro\((bunNativeType|disturbed)\)", + "src/jsc/bindings/webcore/TextEncoder.h: EncodeIntoResult|\bencodeInto\b", + "src/jsc/bindings/webcore/TextEncoder.cpp: TextEncoder::encode(Into)?\(", + "src/jsc/bindings/webcore/JSTextEncoder.h: EncodeIntoResult", + "src/jsc/bindings/webco ... (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-streams-http-misctools.test.ts bun test v1.4.0 (59bf369) test/internal/source-lints/dead-symbols-streams-http-misctools.test.ts: (pass) dead stream slots and other dead C++ bindings do not reappear [33.31ms] (pass) the deprecated-reply ServerResponse path stays out of node:http [21.74ms] (pass) dead Rust wrappers do not reappear [63.04ms] (pass) orphaned files stay deleted [545.87ms] 4 pass 0 fail 4 expect() calls Ran 4 tests across 1 file. [3.00s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 662ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/130] gen bake.{client,server,error}.js -> bake.client.js, bake.server.js, bake.error.js [2/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 [3/130] gen cpp.rs (cppbind) [4/130] gen JS modules (bundle-modules) Preprocess modules (9626ms) Bundle modules (50ms) Postprocesss modules (239ms) Bundle Functions (777ms) Generate Code (34ms) [10.75s] Bundled "src/js" for production 2622 kb 197 internal modules 13 native modules 91 internal functions across 17 files [4/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_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 ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` .vscode/launch.json | 1 - hawk.toml | 48 -- meta.json | 24 - misctools/.gitignore | 10 - misctools/gdb/std_gdb_pretty_printers.py | 142 ---- misctools/mime.js | 46 -- packages/bun-release/scripts/npm-exec.ts | 13 - packages/bun-usockets/misc/gen_test_certs.sh | 51 -- packages/bun-usockets/misc/layout.png | Bin 10991 -> 0 bytes packages/bun-usockets/misc/manual.md | 180 ---- packages/bun-usockets/module.modulemap | 4 - patches/ncrypto.patch | 919 --------------------- src/js/builtins.d.ts | 2 - src/js/builtins/BunBuiltinNames.h | 2 - src/js/node/_http_server.ts | 209 ----- src/jsc/bindings/ImportMetaObject.h | 1 - src/jsc/bindings/Weak.cpp | 2 - src/jsc/bindings/WriteBarrierList.h | 5 - src/jsc/bindings/node/crypto/JSKeyObject.h | 20 - src/jsc/bindings/root.h | 3 - src/jsc/bindings/v8-capture-stack-fixture.cjs | 15 - src/jsc/bindings/webcore/DOMClientIsoSubspaces.h | 1 - src/jsc/bindings/webcore/DOMIsoSubspaces.h | 1 - src/jsc/bindings/webcore/EventNames.in | 101 --- src/jsc/bindings/webcore/JSTextEncoder.cpp | 56 -- src/jsc/bindings/webcore/JSTextEncoder.h | 4 - src/jsc/bindings/webcore/TextEncoder.cpp | 36 - src/jsc/bindings/webcore/TextEncoder.h | 9 - .../bindings/webcore/streams/JSReadableStream.cpp | 60 +- .../bindings/webcore/streams/JSReadableStream.h | 4 - .../bindings/webcore/streams/JSTransformStream.h | 2 - .../bindings/webcore/streams/JSWritableStream.h | 2 - .../bindings ... (truncated) ``` </details> **gate history** · 1 passed · 1 rejected · iteration 1 <details><summary>evidence per changed file</summary> ``` file reads edits tests .vscode/launch.json 0 0 0 hawk.toml 0 0 0 meta.json 0 0 0 misctools/.gitignore 0 0 0 misctools/gdb/std_gdb_pretty_printers.py 0 0 0 misctools/mime.js 0 0 0 packages/bun-release/scripts/npm-exec.ts 0 0 0 packages/bun-usockets/misc/gen_test_certs.sh 0 0 0 packages/bun-usockets/misc/layout.png 0 0 0 packages/bun-usockets/misc/manual.md 0 0 0 packages/bun-usockets/module.modulemap 0 0 0 patches/ncrypto.patch 0 0 0 src/js/builtins.d.ts 0 0 0 src/js/builtins/BunBuiltinNames.h 0 0 0 src/js/node/_http_server.ts 5 0 0 src/jsc/bindings/ImportMetaObject.h 0 0 0 (+ 31 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>
…egen, build scripts, and misc crates (#39249) Removes 2772 lines that nothing references (136 lines of signature, import and formatting adjustments added, plus a 214-line source lint pinning the removed symbols) across the WebCrypto bindings, the node:http internal binding and the C++/Rust behind it, the class code generator, the build scripts, and four Rust crates. No behavior change. ### Problem **WebCrypto (`src/jsc/bindings/webcrypto/`, about 560 lines)** - `SubtleCrypto.cpp` has had `isRSAESPKCSWebCryptoDeprecated()` returning `true` unconditionally since 2023, so every RSAES-PKCS1-v1_5 operation is rejected with `NotSupportedError` before the algorithm class is reached. Its `encrypt`/`decrypt`/`generateKey`/`importKey`/`exportKey` overrides, the whole of `CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp`, and `JSRsaKeyGenParams.{cpp,h}` (whose only caller was the unreachable generateKey branch) were dead. `isSafeCurvesEnabled()` is the same shape: always `true`, one never-taken branch. - `CryptoAlgorithmEcdsaParams::encoding` (DER signatures) and the `padding` fields of `RsaPssParams`/`RsaOaepParams` were only ever set by the old `src/bun.js/bindings/KeyObject.cpp`, deleted in April 2025. Since then the DER branches in `CryptoAlgorithmECDSAOpenSSL.cpp`, the padding branches in the PSS/OAEP OpenSSL files, and `platformEncryptWithHash`/`platformDecryptWithHash` ran on constant inputs. The same file left behind the `ignoreExtAndKeyOps` parameter of `convertDictionaryToJS(JsonWebKey)` (no caller passes `true`) and include blocks copied verbatim into `node_crypto_binding.cpp` and `AsymmetricKeyValue.cpp` (neither file uses any of them). - `CryptoAlgorithmMlDsaParams::isolatedCopy()` has no `crossThreadCopy` instantiation, `CryptoAlgorithm::VoidCallback` has no user, `SubtleCrypto::addAuthenticatedEncryptionWarningIfNecessary` is an empty body with two calls, and `CryptoKey.cpp`/`CryptoAlgorithmX25519.cpp` carried includes nothing in the file uses. **node:http binding (`src/js/internal/http.ts`, `NodeHTTP.cpp`, and the Rust it reached, about 880 lines)** - `internal/http.ts` destructures the object returned by `createNodeHTTPInternalBinding` and re-exports the members, but no module imports `getHeader`, `setHeader`, `Headers`, `assignHeaders`, `setRequestTimeout`, `headersTuple`, `webRequestOrResponseHasBodyValue` or `getCompleteWebRequestOrResponseBodyValueAsArrayBuffer` (the last users left with the http client rewrite); `assignEventCallback`, `Request`, `Response` and `Blob` were registered but not even destructured. A few symbols (`kDeprecatedReplySymbol`, `controllerSymbol`, `runSymbol`, `deferredSymbol`, `firstWriteSymbol`, `kEmptyObject`) and `isAbortError`/`get|setIsNextIncomingMessageHTTPS` lost their last reader in earlier sweeps. - That binding object is the only way into `NodeHTTP.cpp`'s `jsHTTPAssignHeaders`, `jsHTTPAssignEventCallback`, `jsHTTPSetTimeout`, `jsHTTPGetHeader` and `jsHTTPSetHeader`, which in turn were the only callers of `assignHeadersFromFetchHeaders`, `assignHeadersFromUWebSockets` (the `...ForCall` variant used by the request path stays) and the `RequestHeaderKind` helpers: about 600 lines of C++. - Those host functions were the only callers of the Rust exports `jsFunctionRequestOrResponseHasBodyValue`, `jsFunctionGetCompleteRequestOrResponseBodyValueAsArrayBuffer` (`Response.rs`), `Request__getUWSRequest`, `Request__setInternalEventCallback`, `Request__setTimeout` (`Request.rs`) and `NodeHTTPResponse__setTimeout` (`NodeHTTPResponse.rs`). `Request__setInternalEventCallback` was the only writer of `Request::internal_event_callback`, and the JS side stopped calling it in 2024, so `InternalJSEventCallback`, the `RequestContext::on_timeout` handler, `set_timeout_handler`, the `HAS_TIMEOUT_HANDLER` flag and its three clear sites, and `AnyRequestContext::enable_timeout_events` have not been reachable since then; `Body::Value::is_definitely_empty` was only used by the removed host function. **Code generators and build scripts (about 1000 lines)** - `generate-classes.ts`/`class-definitions.ts` still emitted code for `.classes.ts` keys no class file sets: `own` (and the `ZigGeneratedClasses.lut.txt` -> `.lut.h` build step in `scripts/build/codegen.ts`, whose output was an empty header), `callbacks`, the `accessor` field variant, `supportsObjectCreate`, `custom`, `zigOnly`, `defaultValue`, plus the `ONLY_ZIG` and `BUN_SILENT` environment switches nothing sets (`git grep` over all 30 `*.classes.ts` files, and `git log -G` for the keys that ever existed). `bundle-functions.ts` handled `$nakedConstructor`, `$sloppy` and `$intrinsic` directives no file in `src/js/builtins` uses, and tracked write-only fields; `generate-jssink.ts`, `replacements.ts` (`OutOfMemoryError` rewrite, no builtin throws it) and `cppbind.ts` had smaller leftovers. `src/runtime/bake/bake.bind.ts` was 100% comments and produced an empty `GeneratedBake.h` nothing includes. - `scripts/utils.mjs` (379 lines: `downloadTarget` and its helpers, `getBuildArtifacts` and its helpers, `getChangedFiles`, `isDocumentation`, `getPullRequestRepository`, `getRepositoryOwner`, `escapeYaml`, `escapeGitHubAction`, `parseNumber`, `getUser`, `isArm64`) and `scripts/runner.node.mjs` (`listArtifactsFromBuildKite`, a local `escapeGitHubAction`) exported functions none of the 11 importers import. `glob-sources.ts` globbed two patterns that have never matched a file; `flags.ts` defined `LIBUS_USE_BORINGSSL`, which nothing in `src/`, `packages/` or `vendor/` reads; `config.ts` carried three resolved fields nothing reads (the `PartialConfig` inputs stay); `depVersionsHeader.ts` and five `deps/*.ts` emitted seven version macros with no consumer in `BunProcess.cpp`, the header's only includer. **Rust crates (about 140 lines)** - `CssModuleReference::Local`/`Global` are never constructed (only `Dependency` is) and `eql` has no caller; `bun_sys` duplicated `NT_UNC_OBJECT_PREFIX`/`_U8` (the live copies are in `bun_paths`) and two Windows send-flag constants the wrappers do not use; `cares_sys::AddrInfo::name` has no caller; `libuv_sys` kept `Loop::{ref_, unref, unref_count, run, tick_with_timeout, wakeup}`, `uv_write_t::write_raw`, `uv_async_t::send`, `Process::get_pid`, `uv_stat_t::{atime, ctime}`, `ReturnCode::from_raw`, `ReturnCodeI64::init`, five type aliases and the two externs only those methods used. These come from the workspace reachability analysis in `tools/hawk/`, run for linux-gnu, darwin and windows-msvc and then re-checked by hand; the items it reported that are used only from `debug_assertions` code (which the release-profile analysis does not see) or only on FreeBSD were kept. ### Fix - Deletes the items above. The only non-deletion edits are the ones the deletions force: the three RSAES rejections in `SubtleCrypto.cpp` become unconditional (same error strings, pinned by `test/js/web/crypto/web-crypto.test.ts`), `isSupportedExportKey` loses an unused parameter, `platformEncrypt`/`platformDecrypt` in RSA-OAEP absorb their one-line `WithHash` wrappers, `RequestContext::set_timeout` keeps its `clear_timeout()` for `0`, one `const` destructure in `internal/http.ts` is reflowed, and `generate-classes.ts` conditions that became constant are folded. - Generator changes were verified by re-running `generate-classes.ts`, `generate-jssink.ts` and `bundle-modules.ts` into a scratch directory and comparing with the output generated before the change: byte-identical except for the dropped `#include "ZigGeneratedClasses.lut.h"` line and the two deleted webcrypto files disappearing from the `NativeFilenameCPP` union. `bun scripts/build.ts --configure-only` confirms `build.ninja` no longer references `GeneratedBake.h`, the `.lut` pair, or `LIBUS_USE_BORINGSSL`, and that the C++ source list changed only by the three deleted files. - Verified: `bun bd` builds; `bun run rust:check-all` passes on all 12 target triples; `cargo fmt --check`, prettier and clang-format are clean. `bun bd test` passes on `test/js/web/crypto/web-crypto.test.ts` (94), `test/js/node/crypto/{crypto.key-objects,crypto-rsa,sign-jwk-ieee-p1363,crypto-pqc,x509}` (162), `test/js/node/http/{node-http,node-http-server-timeouts,node-http-server-abort-events,node-http-res-settimeout-unref}` (151; the one failure, the http proxy test, fails identically with the released binary in this container), `test/js/bun/http/serve.test.ts` (283; the 4 failures, requestIP v6, root-range port, #6583 and /bun:info, fail identically with the released binary here), `test/js/node/http2/node-http2.test.js`, `test/js/node/fs/fs-leak.test.js`, `test/js/bun/udp/dgram.test.ts`, `test/js/node/readline/readline.node.test.ts`, `test/bundler/css/css-modules.test.ts`, `test/js/node/process/process.test.js` (dependency version assertions pass; the `USER` env assertion fails on both binaries here), the nine `test/internal/build-*`/`bindgen`/`macos-cross-config`/`rust-*` tests, `test/js/bun/perf/linker-order.test.ts`, and all of `test/internal/source-lints/` (166). The new `dead-symbols-webcrypto-nodehttp-codegen.test.ts` fails on main and passes here. - Cross-checked against the 19 open dead-code PRs at the line level: no deleted line here is deleted by any of them, except boilerplate lines (`auto& vm = ...`) that #35437 also deletes from a different function in `NodeHTTP.cpp`. Hunks adjacent to open PRs, which will need a trivial rebase on whichever side lands second: the `internal/http.ts` destructure and `NodeHTTP.cpp` registration block (#35437 removes `setServerIdleTimeout` there), the `CryptoKey.cpp` include block (#38005 removes the neighbouring line), `CryptoAlgorithmRSA_PSSOpenSSL.cpp` (#38005's hunk still applies), `class-definitions.ts` (#37208 removes `isEventEmitter`), `generate-classes.ts` (#37149 removes four DOMJIT includes), and `c_ares.rs` (#38703 removes a method 30 lines below). ### Background - `createNodeHTTPInternalBinding` is the C++ function behind `$cpp("NodeHTTP.cpp", ...)` in `internal/http.ts`; it builds a plain object whose properties are JS functions wrapping C++ host functions. A host function registered there is reachable only if some builtin reads the property, which is why the JS import graph decides what is dead in the C++ file. - Rust functions marked `export_name`/`uws_callback(export = ...)` exist for C++ callers; `cppbind`/js2native codegen emits the glue from the sources, so once the last C++ caller is gone they are unreachable, and the workspace lints (`dead_code`/`unused_imports` are `deny`) then flag whatever only they called, which is how the `Request.rs`/`RequestContext.rs` cascade was found and bounded. - `Request::internal_event_callback` was the hook node:http used to be told about per-request timeouts and aborts; `RequestContext::set_timeout_handler` registered the uWS timeout callback only when that hook was set. With no setter, the flag was never set and the handler never registered, so removing them changes nothing at runtime; `server.timeout()` still arms the socket timeout and the abort path is untouched. - `generate-classes.ts` reads every `src/**/*.classes.ts` and emits `ZigGeneratedClasses.{h,cpp}` plus `generated_classes.rs`; a feature of the class definition format that no class uses is dead code in the generator, and its removal is checkable by diffing the generated files. - `tools/hawk/README.md` describes the workspace-wide reachability analysis used for the Rust items: rustc's per-crate `dead_code` lint treats every `pub` item of a library crate as live, so cross-crate dead `pub` items need this separate pass. <details> <summary>Found dead but deliberately left alone</summary> - `bun_shim_impl::read_without_launch` and `FromBunShellContext` (`src/install/windows-shim/bun_shim_impl.rs`) have no caller, but the `LauncherMode::ReadWithoutLaunch` mode is threaded through the launcher, so removing it cleanly means de-generifying `launcher()`; better as its own change. - The write-only `CssModule::references` map itself (this PR removes only the never-constructed variants); the `#[cfg(target_arch = "wasm32")]` branches scattered through the parser/output code (no wasm32 target is built, but earlier commits describe it as "not built yet", so that is a product call); `windows_errno::posix::{mode_t, E}` and `bun_sys::File::write` (unused, but intentional API parity with the POSIX side); `WindowsLoop::{wait, unref}` and the Windows `us_socket_t::write_fd` stub (8 and 7 lines in files three open PRs are editing). - `AnyResponse::on_timeout` / `uws_res_on_timeout` in `bun_uws_sys` lose their last caller with this PR (`set_timeout_handler` was it); left for the next pass since those files are in open PRs. - DOMJIT support in `generate-classes.ts` is disabled on purpose (`define()` strips it), not dead; the split CI build modes in `scripts/build/profiles.ts` were explicitly kept by #37733 four days ago; the `*.idl` files in webcrypto are kept as documentation as in the previous sweeps; the AES-GCM `> UINT64_MAX` checks are upstream-identical. - Every item carrying `#[allow(dead_code)]` in the tree was re-verified and is live on some platform or under `debug_assertions` (the inventory in `dead-code-escape-limits.json` is accurate), so nothing was taken from there. - `CryptoAlgorithmAKPShared.h` does not include `CryptoAlgorithmParameters.h`, so `CryptoAlgorithmMLDSA.cpp` only compiles inside its unified bundle; pre-existing and unrelated to this change. </details> --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
### Problem - mordant's `unchecked_construction` lint has one finding in `src/runtime/server/mod.rs`, recorded in `mordant-baseline.toml` as `"unchecked_construction:src/runtime/server/mod.rs" = 1`: `NewServer::set_idle_timeout` writes `config.idle_timeout` directly, a field that `ServerConfig::from_js` validates (`idleTimeout` must be an integer of 255 or less). - The code behind it is unreachable. `set_idle_timeout` is only called from the exported `Server__setIdleTimeout` (`src/runtime/server/server_body.rs`), which is only called from `jsHTTPSetServerIdleTimeout`, which `createNodeHTTPInternalBinding` (`src/jsc/bindings/NodeHTTP.cpp`) exposes as `setServerIdleTimeout`. `src/js/internal/http.ts` re-exports that function and nothing imports it: its one caller, `Server.prototype.setTimeout`, stopped using it in #32488, which moved node:http's server timeouts into JS and passes `idleTimeout: 0` to the native server (`src/js/node/_http_server.ts`). ### Fix - Removes the chain end to end: the `internal/http` re-export and binding type, the C++ host function and its `putDirect`, the Rust export with its helper, and `NewServer::set_idle_timeout`. `idle_timeout` is now only set by `ServerConfig::from_js`, so the baseline line goes as well. 77 lines removed, no replacement code. - No user-visible behavior changes: the binding was only reachable from built-in modules, and none used it. Verified with `bun bd test` on `test/js/node/http/node-http-server-timeouts.test.ts`, `node-http-res-settimeout-unref.test.ts` and `node-http.test.ts` (one test there, `request via http proxy`, fails with `ECONNREFUSED` identically on the unmodified release build in this environment), plus a smoke check that `server.setTimeout()` on a node:http server and `idleTimeout` on `Bun.serve()` still work. `cargo fmt`, `clang-format` and prettier are clean. - The same deletion is part of the much larger #35437, which is currently conflicting; this is only that slice. ### Background - `createNodeHTTPInternalBinding` is the object `internal/http.ts` gets from `$cpp(...)`: native helpers that node:http's JS implementation calls on the underlying `Bun.serve` server. A function on it that no built-in module reads is dead code, since user code cannot reach internal modules. - `unchecked_construction` flags a write to a field outside the constructor that validates it. The baseline is a ratchet: CI tolerates the recorded number of findings per lint and file and fails on more, so removing the code behind an entry lets the entry be removed.
… and misc crates (#39574) ### Problem - `src/jsc/bindings/libuv/` is only on the include path for non-Windows builds (`scripts/build/flags.ts`, "libuv stubs for unix"). `uv/win.h` (703 lines) and `uv/tree.h` (512 lines, included only by `win.h`) are never reached. - `uv/sunos.h`, `uv/os390.h`, `uv/aix.h` and `uv/posix.h` are selected by `uv/unix.h` only on Solaris, z/OS, AIX, IBM i, Cygwin, Haiku, QNX and Hurd. Bun builds for linux, macOS and FreeBSD. - `packages/bun-error` is embedded in the dev error page (`src/runtime/server/dev-error-page.html`). The page calls the function behind `Symbol.for("Bun__renderFallbackError")` and nothing else. `renderRuntimeError`, the abort state `dismissError` kept for it, and the two modules only it imported (`sourcemap.ts`, `stack-trace-parser.ts`) have no callers. #37081 lists this path as a follow-up. - `bun_zlib_sys::posix` and `bun_zlib_sys::win32` declare zlib functions that nothing calls. `bun_zlib` declares its own. The only use of the two modules was as re-exports of the types in `shared.rs`. - A set of `pub` items in other crates has no user in any crate. rustc cannot report them because `pub` items count as used. ### Fix - Delete the six libuv headers. `uv.h` now includes `uv/unix.h` directly. `uv/unix.h` keeps the linux, darwin and BSD branches. `uv-posix-polyfills.c` drops the commented-out copies of the removed branches. - Delete `renderRuntimeError`, `sourcemap.ts` and `stack-trace-parser.ts`. `dismissError` keeps the part that removes the overlay. `runtime-error.ts` stays (it has a test). - Delete `bun_zlib_sys/posix.rs` and `win32.rs`. `bun_zlib` imports the types from `bun_zlib_sys::shared`, which is where the removed modules took them from. - Delete the unused Rust items listed below, plus the trait implementations and imports that only they needed. Verification: - Every Rust item was found by making the unexported items crate-private and compiling the workspace. An item is deleted only if rustc reports it dead on x86_64 linux (dev, release, and with the `bun_debug` and `bun_asan` cfgs), aarch64 linux, x86_64 musl, x86_64 Windows and aarch64 macOS. - Each removed name was also searched in `src/codegen/`, the `*.classes.ts` files, `src/js/` and the C++ bindings. Items that a codegen template can emit were kept. - `bun run rust:check-all`: 12 of 12 targets pass. `cargo check --workspace --all-targets` passes (benches and unit tests still compile). `cargo check -p bun_shim_impl --features shim_standalone` for the Windows target passes. - `bun bd` builds. The build recompiles `uv-posix-stubs.c` and `uv-posix-polyfills.c` against the trimmed `uv.h`, and rebuilds the bun-error bundle, which no longer exports `renderRuntimeError`. - New test in `test/js/bun/http/serve.test.ts`: it takes the bun-error bundle out of a real 500 page, evaluates it outside a browser, and checks that the bundle registers the renderer and that `dismissError` is a no-op when nothing is rendered. This is the surface the `packages/bun-error` change touches. - `bun bd test` passes for `test/js/bun/http/serve.test.ts -t "dev error page"` (including the new test), `test/js/bun/runtime-error.test.ts`, `test/js/bun/util/{zstd,arraybuffersink,filesink}.test.ts`, `test/js/node/zlib/deflate-streaming.test.ts`, `test/js/web/encoding/text-{encoder,decoder}.test.*`, `test/js/workerd/html-rewriter.test.js`, `test/js/bun/css/nth-anplusb-ident.test.ts`, `test/js/web/fetch/blob.test.ts` and `test/internal/source-lints/dead-code-escapes.test.ts`. - `cargo fmt --check`, clang-format on the touched C file and prettier on the touched TypeScript files pass. <details> <summary>Removed Rust items</summary> - `bun_zlib_sys`: modules `posix` and `win32` (`struct_gz_header_s`, `gz_header`, `gz_headerp`, `in_func`, `out_func`, and the `deflate*`, `inflate*`, `compress*`, `uncompress`, `adler32`, `crc32`, `zlibVersion` declarations), `shared::voidpf`. - `bun_zlib`: declarations `compress`, `compressBound`, `uncompress`, and the `internal` module that selected between the two removed modules. - `bun_zstd`: `decompress` (every caller uses `decompress_append`). - `bun_libdeflate_sys`: `libdeflate_deflate_decompress` (the `_ex` variant is the one in use). - `bun_mimalloc_sys`: `mi_strdup`, `mi_heap_collect`, `mi_thread_set_in_threadpool`. - `bun_cares_sys`: `ares_strerror`. - `bun_windows_sys`: `SetHandleInformation`, `closesocket`. - `bun_alloc`: `default_alloc::calloc`. - `bun_core`: `GenericIndexInt::from_usize` and its macro-generated implementations. - `bun_css`: the four deprecated `to_css` methods on `GenericSelectorList`, `GenericSelector`, `GenericComponent` and `Combinator`. Their bodies were `unreachable!()`; the serializer functions replaced them. - `bun_runtime`: `JsSinkType::done` and its six overrides, `FileCloser::update` and its implementations, `ReadableStream::to_js`, `node_fs::Null::to_js`. </details> <details> <summary>Overlap with open pull requests</summary> The deletions here were checked against the open dead-code pull requests (#35437, #35775, #35880, #36115, #36237, #37012, #37149, #37181, #37208, #37301, #37454, #37659, #37788, #38005, #38900, #39319, #39561) and against #38958 and #35075. Nothing deleted here is deleted by any of them. Candidates they already cover were left out: `src/jsc/bindgen.rs` (#37149), the dead `pub use` re-exports (#39319), the simdutf big-endian and UTF-32 wrappers (#38958), and the items named in the skip lists of the others. Some files here (`bun_alloc/lib.rs`, `bun_core/util.rs`, `libdeflate.rs`, `mimalloc.rs`, `node_fs.rs`, `Blob.rs`, `FileSink.rs`, `ReadableStream.rs`, `streams.rs`, `windows_sys/externs.rs`) are also touched by open pull requests in different hunks. #36437 edits `packages/bun-error` from a base that predates #37081; it changes one import line in `stack-trace-parser.ts` and keeps `renderRuntimeError`, so it does not overlap with this deletion but will need a rebase. </details> <details> <summary>Found but not deleted (judgment calls for a maintainer)</summary> - `packages/bun-inspector-protocol/src/protocol/v8/` (about 32,600 lines): not exported by the package index since 2023 and regenerated only with the opt-in `--v8` flag of `scripts/generate-protocol.ts`. #39110 kept the flag, so this needs a decision. - `packages/h3blast` (1,468 lines) and `packages/bun-build-mdx-rs` (558 lines): nothing in the repository references them. They may be kept on purpose as a load generator and a proof of concept. - `packages/bun-error/runtime-error.ts` is unused by the page but covered by `test/js/bun/runtime-error.test.ts`. The four images in `packages/bun-error/img/` are referenced only by the source glob in `scripts/glob-sources.ts`. - `HotReloadTaskView` in `src/jsc/hot_reloader.rs`: both `reload` implementations ignore the task, and `VirtualMachine::reload` ignores its `Option<HotReloadTask>` argument. Removing the plumbing is a small refactor rather than a deletion. - `react_compiler/compile_result.rs` has constructors and fields with no users, but the file says the types are waiting to be wired up. - The streams-era private globals in `BunBuiltinNames.h` (`makeGetterTypeError`, `makeDOMException`, `addAbortAlgorithmToSignal`, `removeAbortAlgorithmFromSignal`, `isAbortSignal`, `createUninitializedArrayBuffer`, about 100 lines of `ZigGlobalObject.cpp`) have no JS callers. Both files are being edited by several open dead-code pull requests, so they were left for a later run. </details> ### Background - rustc's `dead_code` lint treats every `pub` item in a library crate as used, because another crate could import it. In this workspace every crate is an implementation detail of one binary, so a `pub` item with no importer in any crate is dead in the same sense as a private one. Making such items crate-private for one compile lets rustc report the ones with no users at all. The visibility changes themselves are not part of this pull request. - On POSIX, bun does not link libuv. Node-API addons that reference libuv symbols get `uv-posix-stubs.c` and `uv-posix-polyfills*.c`, which are compiled against the copied headers in `src/jsc/bindings/libuv/`. On Windows the real libuv is linked and that directory is not used. - `JsSinkType` is the Rust trait behind the native sink classes (`FileSink`, `ArrayBufferSink`, the HTTP response sinks). Its methods are called from the shared sink glue in `Sink.rs`; `done` was declared there but the glue never called it. <!-- robobun:evidence:begin --> --- **no test proof** · iteration 1 · Platform-specific test(s) that do not run on this machine. Deferring to CI, which covers all platforms: test/js/bun/http/serve.test.ts <!-- robobun:evidence:end -->
|
Stale |
…cy edges (#37301) Scheduled dead-code sweep. This run scanned areas not claimed by the open dead-code PRs (#37208, #37272, #37229, #37181, #37149, #37089, #37062, #37012, #36237, #36115, #35880, #35775, #35437): src/runtime/crypto, src/runtime/node, src/runtime/webcore, src/runtime/api, src/runtime/socket, src/runtime/image, src/runtime/webview, src/http, src/dns, src/dotenv, src/which, src/glob, src/s3_signing, src/patch, src/router, src/semver, src/paths, src/threading, src/event_loop, src/io, src/transpiler, src/sourcemap, src/ast, src/parsers, src/options_types, src/platform, src/analytics, src/base64, src/standalone_graph, src/shell_parser, src/md, src/output, src/ptr, src/safety, src/perf, src/dispatch, src/uws, all 697 headers and 572 cpp files under src/jsc/bindings, src/js, scripts/, and commented-out blocks repo wide. The yield is small because the workspace denies `dead_code` and `unreachable_pub`, and prior sweeps plus the 13 open PRs hold everything else. Everything that survived verification: ## Removed - `ToJSError::MacroError` (src/ast/nodes.rs): never constructed anywhere; its only mention was a defensive match arm in src/runtime/api/YAMLObject.rs, now folded into the remaining defensive arm. (The `MacroError` enum in src/js_parser_jsc/Macro.rs is a different, live type.) - `pub use crate::webview::chrome_process as ChromeProcess` (src/runtime/api.rs): zero references to the alias; the module stays reachable via `crate::webview::chrome_process` and its `host_fn` exports. - `strum::IntoStaticStr`, `PartialEq`, `Eq` derives on `Algorithm` (src/runtime/crypto/PasswordObject.rs): the generated `From<Algorithm> for &'static str` and equality impls have zero call sites. Name parsing goes through `algorithm_from_zig_string` and hash-string formatting through `pwhash`. - Commented-out `globalThis.ASSERT` draft (src/runtime/bake/debug.ts lines 1-11): superseded verbatim by the live `globalThis.DEBUG.ASSERT` directly below it. - Unused Cargo dependency edges: `bun_runtime` does not reference `bun_css` (only `bun_css_jsc`) or `bun_transpiler`; `bun_spawn` does not reference `bstr`. Verified by zero textual references including cfg-gated code; note `rust-argon2` looks unreferenced by the same textual check but is live via `use ::argon2 as vendor` (lib name differs from package name), so it stays. ## Verification - rg zero references for each symbol across src/, scripts/, packages/, and build/debug/codegen output - `bun bd` builds clean - `bun scripts/rust-check-all.ts`: 10 ok, 0 failed, 0 skipped - `bun bd test` on password.test.ts (71 pass), yaml.test.ts (642 pass), bake/deinitialization.test.ts (1 pass) ## Not removed (follow-up notes) - src/runtime/webcore/TextEncoder.rs defines `unsafe extern "C" fn c`, a byte-identical duplicate of the adjacent `TextEncoder__encode16`, exported under the global symbol name `c`. No C++ declaration or caller was found, but extern "C" items are excluded from this sweep on principle. Looks like a rename accident worth a human look. - The h2 send-side cluster in src/runtime/api/bun/h2/connection.rs (~200 LOC, test-only callers) is scaffolding for the node:http2 rewrite, as already noted in #35880. - scripts/find-dead-exports.ts and scripts/trace.sh have no in-repo referencers but look like manual dev tools; left alone. - The boilerplate dep edges in src/{collections,css,glob,io,paths,router}/Cargo.toml are already removed by #35437 and #37229, so they are deliberately not duplicated here. <!-- robobun:evidence:begin --> --- **[review]** gate passed · iteration 0 · 9 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-runtime-ast-deps.test.ts bun test v1.4.0 (3cadf9f48) test/internal/source-lints/dead-symbols-runtime-ast-deps.test.ts: 33 | // hash-string formatting goes through pwhash); PartialEq/Eq were likewise 34 | // never used. 35 | ["src/runtime/crypto/PasswordObject.rs", /\bstrum\b/], 36 | ]; 37 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 38 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/ast/nodes.rs: \bMacroError\b", + "src/runtime/api/YAMLObject.rs: Up::MacroError", + "src/runtime/api.rs: chrome_process as ChromeProcess", + "src/runtime/crypto/PasswordObject.rs: \bstrum\b", + ] - Expected - 1 + Received + 6 at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-runtime-ast-deps.test.ts:38:23) (fail) dead Rust symbols (ast, runtime) do not reappear [38.66ms] 48 | }); 49 | 50 | test("dead built-in JS co ... (truncated) release without fix: 3 FAILED bun test v1.4.0-canary.1 (9008ae7) test/internal/source-lints/dead-symbols-runtime-ast-deps.test.ts: 33 | // hash-string formatting goes through pwhash); PartialEq/Eq were likewise 34 | // never used. 35 | ["src/runtime/crypto/PasswordObject.rs", /\bstrum\b/], 36 | ]; 37 | const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); 38 | expect(resurrected).toEqual([]); ^ error: expect(received).toEqual(expected) - [] + [ + "src/ast/nodes.rs: \bMacroError\b", + "src/runtime/api/YAMLObject.rs: Up::MacroError", + "src/runtime/api.rs: chrome_process as ChromeProcess", + "src/runtime/crypto/PasswordObject.rs: \bstrum\b", + ] - Expected - 1 + Received + 6 at <anonymous> (/workspace/bun/test/internal/source-lints/dead-symbols-runtime-ast-deps.test.ts:38:23) (fail) dead Rust symbols (ast, runtime) do not reappear [0.59ms] 48 | }); 49 | 50 | test("dead built-in JS code does not reappear", () => { 51 | // bake/debug.ts: commented-out globalThis.ASSERT draft superseded verbatim 52 | // by the live globalThis.DEBUG.ASSERT directly below it. 53 | expe ... (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-runtime-ast-deps.test.ts bun test v1.4.0 (3cadf9f48) test/internal/source-lints/dead-symbols-runtime-ast-deps.test.ts: (pass) dead Rust symbols (ast, runtime) do not reappear [33.71ms] (pass) dead built-in JS code does not reappear [2.28ms] (pass) unused Cargo dependency edges do not reappear [5.20ms] 3 pass 0 fail 7 expect() calls Ran 3 tests across 1 file. [2.35s] __F:0:S:0 release with fix: all passed $ bun scripts/build.ts --profile=release [configured] bun-profile → bun (stripped) in 669ms (unchanged) ninja: Entering directory `/workspace/bun/build/release' [1/119] gen bake.{client,server,error}.js -> bake.client.js, bake.server.js, bake.error.js [2/119] gen generated_host_exports.rs generated_host_exports.rs: 93 exports (host=3, lazy=10, generic=80, rust=0); 239 extern-C blocks audited [2/119] 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 Compiling^[[0m bun_zlib_sys v0.0.0 (/workspace/bun/src/zlib_sys) ^[[1m^[[92m Compiling^[[0m bun_cares_sys v0.0.0 (/workspace/bun/src/cares_sys) ^[[1m^[[92m Compiling^[[0m bun_zstd v0.0.0 (/workspace/bun/src/zstd) ^[[1m^[[92m Compili ... (truncated) ``` </details> <details><summary>diff hotspot</summary> ``` Cargo.lock | 3 -- src/ast/nodes.rs | 1 - src/runtime/Cargo.toml | 2 - src/runtime/api.rs | 2 - src/runtime/api/YAMLObject.rs | 9 ++-- src/runtime/bake/debug.ts | 11 ---- src/runtime/crypto/PasswordObject.rs | 6 +-- src/spawn/Cargo.toml | 1 - .../dead-symbols-runtime-ast-deps.test.ts | 63 ++++++++++++++++++++++ 9 files changed, 68 insertions(+), 30 deletions(-) ``` </details> **gate history** · 1 passed · 0 rejected · iteration 0 <details><summary>evidence per changed file</summary> ``` file reads edits tests Cargo.lock 0 0 0 src/ast/nodes.rs 1 1 0 src/runtime/Cargo.toml 1 1 0 src/runtime/api.rs 1 1 0 src/runtime/api/YAMLObject.rs 2 3 0 src/runtime/bake/debug.ts 1 1 0 src/runtime/crypto/PasswordObject.rs 1 1 0 src/spawn/Cargo.toml 1 1 0 …rnal/source-lints/dead-symbols-runtime-ast-deps.test.ts 0 2 0 ``` </details> <!-- robobun:evidence:end --> --------- Co-authored-by: Alistair Smith <hi@alistair.sh>
…uilt-in JS, bindgen, uSockets, and 66 Cargo manifests (#39732) ### Problem - The tree carries code that nothing references: FFI shims with no caller on either side, enum variants that are never constructed, write-only fields, exports that no module imports, and Cargo dependency edges that no source file uses. - 16 dead-code PRs that removed much of this were closed as stale after merge conflicts. Their deletions were never re-applied (list in the notes). ### Fix - Re-apply the deletions that still apply to current main and add new ones in the same areas: `simdutf_sys`, `ncrypto` and the WebCore bindings, `js_parser`, `bundler`, `js_printer`, `bun_install`, built-in JS, bindgen, uSockets, and 66 Cargo manifests. 176 files, +95 / -3129 (`Cargo.lock` is -436 of that). - Every deletion was checked again with `rg` over `src/`, `packages/`, `src/codegen/` and the generated code. Items that became live again since the old PRs stay (examples in the notes). - No deletion duplicates an open dead-code PR. Deletions that need #39618 or #39697 to land first are listed as follow-ups in the notes. - Verified: `bun bd`, `bun run rust:check-all` (12 targets pass), byte-identical bindgen output, `test/internal/source-lints`, and the test files of the touched areas (list in the notes). New tests in `transpiler.test.js` and `bundler_edgecase.test.ts` pin the two diagnostics that `mark_strict_mode_feature` still emits and the class body printing that `visit_class` still does. ### Background - A Rust `extern "C"` declaration with no call site creates no link reference, so a dead FFI chain is removed on both sides at once. Three C++ definitions whose Rust side #39618 removes stay until that PR lands. - `cargo check` covers the host target only. `rust:check-all` repeats it for every shipped target, which proves the `#[cfg]`-gated deletions and the Windows-only dependency removal (`bun_sys` -> `bun_output`). - The dependency removals are manifest-only. `Cargo.lock` loses the matching entries and nothing else: no version changes. <details><summary>Notes</summary> **Closed PRs re-applied**: #35437, #35559, #35775, #35880, #36115, #36237, #37012, #37062, #37089, #37208, #37272, #37454, #37788, #38005, #38439, #38703. **Kept because they are live again on main**: `GenericIndexOptional::{get, is_some, is_none}`, the WebSocket deflate `OutOfMemory` variants, `V8Local::reinterpret`, `SystemErrno::MAX`, `MarkPopErrorOnReturn::peekError`, `ResourceTiming::populateServerTiming`, `UvHandle` in `test/parallel/Channel.rs`, the `h2::FrameType` entries that `hawk.toml` marks as a code table. **Tests run**: node-http, node-http2, fetch headers, streams, readable-stream-blob-consumed, filesink, transpiler, buffer, url, FormData, TextEncoder, MessageChannel, serve-direct-readable-stream, serve-body-leak, crypto key objects, crypto-rsa, scrypt, pbkdf2, sqlite-sql, local-sql, postgres-simple-query-pipeline, sql-helpers-validation, bun-outdated, websocket-server, test/internal (bindgen, codegen outputs, source lints). The `localhost` proxy test in node-http and the concurrent WebSocket send tests fail the same way on unmodified main in this environment (the first is a `localhost` resolution issue, the second is the 300k-message benchmark starving its concurrent neighbours in a debug build). **By kind**: C/C++ -1327, Rust -702 (+75, mostly signature updates at call sites), built-in JS/TS -130, codegen TS -75 (+13), Cargo manifests -459, `Cargo.lock` -436. **simdutf_sys** (`simdutf.rs`, `bun-simdutf.cpp`, `parsers/benches/support/simdutf_shim.cpp`): 16 shim chains with no caller, each removed as Rust wrapper + `extern` declaration + C++ definition: `simdutf__convert_utf8_to_utf16le`, `_utf16be`, `_utf16be_with_errors`, `convert_utf8_to_utf32_with_errors`, `convert_valid_utf8_to_utf32`, `convert_utf16be_to_utf8_with_errors`, `convert_valid_utf16be_to_utf8`, `convert_utf32_to_utf8_with_errors`, `convert_valid_utf32_to_utf8`, `convert_utf32_to_utf16be_with_errors`, `convert_valid_utf32_to_utf16be`, `convert_utf16be_to_utf32_with_errors`, `convert_valid_utf16be_to_utf32`, `utf8_length_from_utf16be`, `utf32_length_from_utf16be`, `utf32_length_from_utf8`, plus the now empty `utf32` modules and the `be` wrappers. **ncrypto** (`ncrypto.h/.cpp`): `BignumPointer::isOne`, `X509View::ifRsa`, `X509View::ifEc`, `BIOPointer::NewFp`, `checkScryptParams`, `scrypt`, `pbkdf2`, `EVPKeyCtxPointer::setRsaMgf1Md`, `Rsa::encrypt`, `Rsa::decrypt` and the `RSA_Cipher` template, `Cipher::ForEach` with `CipherCallbackContext`/`array_push_back`, `NCRYPTO_REQUIRE`, `NCRYPTO_VERSION` and the version enum. **JSC / WebCore bindings**: `ZigGlobalObject`: `functionFulfillModuleSync` (and the `fulfillModuleSync` builtin name plus `$fulfillModuleSync` stub), `JSDOMFileConstructor_getter/_setter`, `navigatorObject`, `functionLazyNavigatorGetter`, `GlobalObject_getPerformanceObject`, `hasNapiFinalizers`, `jsFunctionNotImplemented`, `jsFunctionCreateFunctionThatMasqueradesAsUndefined`, `Zig__GlobalObject__getModuleRegistryMap`/`resetModuleRegistryMap`, `NodeVM*ModulePrototype()` accessors, `ZIG_GLOBAL_OBJECT_DEFINED`. `BunString.cpp`: `Bun__WTFStringImpl__ref`/`deref` definitions (Rust inlines these; #39618 removes the declarations). `JSBuffer.cpp`: the `JSValue`-name `validateOffset` overload and the three unused `jsBufferConstructorAlloc*WithoutTypeChecks` JIT operations. `NodeValidator`: `validateString(JSValue name)` and `validateOneOf(span<ASCIILiteral>)`. `ScriptExecutionContext`: `ensureOnMainThread`, `executionContext`. `napi.h`: `hasFinalizers`, `currentFinalizer`, `isVMTerminating`. `IDLTypes.h`: `IDLDate`, the `NullableTypeWithLessPadding` helpers and two includes. `BunProcess.cpp`: three unused `*CodeGenerator` aliases. `c-bindings.cpp`: `HNS_PER_SEC`, `NS_PER_HNS`, `HNS_PER_US`. `BunCommonStrings.h`: `ConnectionWasClosed`, `ec`, `ed25519`, `rsa`, `rsaPss`, `jwkDsa`, `jwkG`, `systemError`, `x25519`. `BakeAdditionsToGlobalObject.h`: the never-read `m_bakeGetAsyncLocalStorage` lazy property (the function is still installed directly) and the `LazyPropertyOfGlobalObject` alias. `JSBundlerPlugin.cpp`: the `JSBundlerPlugin__onVirtualModulePlugin` declaration, which has no definition. WebCore: `DeferredPromise::whenSettled` and the `PromiseFunction`/`BindingPromiseFunction` adapters, `JSEventListener::sourceURL/sourcePosition`, `Event::receivedTarget`, `toJS(PerformanceObserverCallback)` and `callbackData()`, `jsFetchHeaders_getRawKeys` (its only caller in `internal/http.ts` is removed too), stale forward declarations in `Performance.h`/`ResourceTiming.h`, and the commented-out `BINDING_INTEGRITY` blocks in 8 generated-style files. `node/crypto`: `JSPrivateKeyObjectConstructor` and `JSPublicKeyObjectConstructor` (4 files, superseded by `JSKeyObjectConstructor`). Bake: `BakeRegisterProductionChunk`, `BakeProdSourceMap`, `BakeProduction.h`, the `IncrementalGraph` log scope. **uSockets**: `us_poll_ext`, `us_loop_iteration_number`, `us_socket_is_tls`, `us_connecting_socket_get_loop`, `us_udp_packet_buffer_local_ip` / `bsd_udp_packet_buffer_local_ip`. **Rust**: `js_parser`: the six `StrictModeFeature` variants that are never constructed (and the `can_be_transformed` branch), `FnOnlyDataVisit::{class_name_ref, should_replace_this_with_class_name_ref, is_inside_async_arrow_fn}` with the `this` substitution path that was gated on the always-false flag (the `shadow_ref` arena cell becomes a plain `Ref`). `bundler`: `Linker::{resolver, hashed_filenames}`, `IS_CACHE_ENABLED`, `InputFileFlags::IS_PLUGIN_FILE`, `parse_task::Step::ReadFile`. `js_printer`: the write-only `Options::transform_only`. `bun_install`: `CacheBehavior`/`ManifestLoad` (every caller passed `LoadFromMemoryFallbackToDisk`, so the parameter and the memory-only branch are gone from `by_name`, `by_name_hash` and `by_name_hash_allow_expired`), `pub use patch_install as patch`. `webcore`: `ReadableStream::detach_if_possible` (empty) and the `global` parameter of `done()`, `BlobExt::{on_structured_clone_transfer, get_mime_type}`, six `StartTag` variants that no sink uses. `server`: `AnyRoute::ref_`, the write-only `OPENED_BIT`. `bun_core`: `concat`, `ExternalShared::as_ptr`, `QuoteEscapeFormatFlags::ascii_only`. `bun_io`: stale `Waker`/`Closer` re-exports. `bun_sys`: `UTIME_OMIT`. `cli`: the never-read `IS_MAIN_THREAD` thread local. `css`: `DeclarationContext::Keyframes`, the empty `generated_color_conversions` module. `html_rewriter`: the `EndTag.replace` host function that `html_rewriter.classes.ts` does not expose. **Built-in JS/TS**: `internal/http.ts`: 29 unused symbol constants, `filterEnvForProxies`, `getRawKeys`, `emitCloseNTAndComplete`, `ClientRequestEmitState`. `node/http2.ts`: `kSettingNames`, three unused primordials. `internal/sql/query.ts` and `internal/repl/node-shims.js`: export entries nothing imports, and the `BuiltinModule` shim methods nothing calls. `builtins.d.ts`: 8 stubs for builtin names that no longer exist. **bindgen** (`src/codegen/bindgen*.ts`): `allFunctions`, `ArgStrategyChildItem`, `Variant.argStruct`, `Struct.namespace`/`toString`, `FuncMetadata`/`exposedOn`/`ExposedOn`, `FuncWithoutOverloads`, the dead `debug` binding, two shadowed duplicate `case` labels and an unreachable `return`. Generated output is byte-identical. **Cargo**: 459 dependency lines across 66 manifests (mostly the `strum`/`bstr`/`scopeguard`/`const_format`/`enum-map`/`enumset`/`libc`/`bitflags` boilerplate block, plus 94 `bun_*` edges such as `bun_jsc -> bun_simdutf_sys` and `bun_bundler_jsc -> 8 crates`). One dev-dependency (`bun_router -> bun_js_parser`, checked with `cargo check -p bun_router --tests`). The manifests that #39618 and #39697 already edit (`collections`, `io`, `paths`, `css`, `shell_parser`, `sql`, `sql_jsc`) were left alone. **Rebase note**: main restructured the private builtin function registration in `ZigGlobalObject::addBuiltinGlobals` into a table (#39770). The conflict was resolved by dropping the `k_fulfillModuleSync` row from the new table, which is the same registration the first version of this PR removed. #39770 also touched the two `JS*KeyObjectConstructor.h` files before this PR deletes them; they are still unreferenced on main, so the deletion stands. Re-verified after the rebase: `bun bd`, `rust:check-all` 12/12, and the test files listed above. **Follow-ups once open PRs land** (not done here to avoid duplicating them): after #39618: the C++ definitions of `URL__fromJS` (BunString.cpp) and `Bun__allocUint8ArrayForCopy` (ZigGlobalObject.cpp), the seven `<Sink>()` constructor accessors in `ZigGlobalObject.h` that only the generated `__getter` functions use, the Rust `extern` declarations of `Bun__WTFStringImpl__ref/deref`, and `BufferWriter::append_null_byte` (no writer ever sets it to true). After #39697: the root `[workspace.dependencies] typed-arena` entry. Independently of those: the `DeferredPromise::{promise, resolve(), reject(...)}` overloads and `DOMPromise::whenPromiseIsSettled` have no callers but sit next to code #39618 edits. </details> <!-- robobun:evidence:begin --> --- **no test proof** · iteration 1 · Platform-specific test(s) that do not run on this machine. Deferring to CI, which covers all platforms: test/bundler/bundler_edgecase.test.ts <!-- robobun:evidence:end -->
Deletes ~1170 net lines of dead code across 46 files. Follows #35002 into areas that sweep didn't reach (C++ bindings, built-in JS) plus CSS option chains that are provably unreachable.
C++ bindings (
src/jsc/bindings/, ~610 lines)Whole headers with zero
#includereferences:objects.h(254 lines, entirely commented-out since the initial port)ZigLazyStaticFunctions-inlines.hextern "C"functions with zero callers acrosssrc/**/*.rs,vendor/,packages/, andbuild/debug/codegen/:JSC__JSValue__fastGetOwn,JSC__JSValue__createRopeString,JSC__VM__externalMemorySize,JSC__JSValue__dateInstanceFromNullTerminatedString,JSC__JSValue__DateNowISOString,DOMFormData__toQueryString,Bun__REPL__formatValue,bun_ignore_sigpipe,Bun__disableSOLinger,getJSCBytecodeCacheVersion,Zig__GlobalObject__getModuleRegistryMap,Zig__GlobalObject__resetModuleRegistryMap,JSGlobalObject__requestTermination,functionFulfillModuleSync,JSC__createEmptyObjectWithStructure,JSC__putDirectOffset,highway_json_index,Bake__getSSRResponseConstructor,StringBuilder__appendUtf16,StringBuilder__appendQuotedJsonString,Bun__JSBigIntStatFSObjectConstructor,Bun__JSStatFSObjectConstructor,ScriptExecutionContextIdentifier__forGlobalObject,Yarr__RegularExpression__matchedLength,Yarr__RegularExpression__searchRev,Cookie__fromJS,jsFetchHeaders_getRawKeysBuilt-in JS (
src/js/, ~260 lines)builtins/CommonJS.ts: 131-line commented-outloadEsmIntoCjs__deadblock (legacy pre-module-loader-rewrite implementation)builtins/JSBufferPrototype.ts:setBigUint64(nojsBufferPrototypeSetBigUint64CodeGeneratorconsumer in C++)internal/http.ts: 27Symbolconsts that are declared and exported but never imported anywhere, plusgetRawKeys,emitCloseNTAndComplete,ClientRequestEmitState$fulfillModuleSyncprivate builtin (only referenced from the removed CommonJS.ts block)CSS option chains (
src/css/, ~350 lines)Every
PrinterOptionsconstruction in the tree uses..Default::default()with onlyminifyandtargetsset. These option fields are never set to non-default, so their downstream branches are unreachable:PrinterOptions.analyze_dependencies:DependencyOptions,Dependency,ImportDependency,UrlDependency,Printer.dependencies,Printer.remove_imports, and the dep-collection branches inrules/import.rs,rules/mod.rs,properties/custom.rs,values/url.rs,values/image.rs; alsoUrl::is_absolute(only caller was a removed branch).dependencies::Locationstays (live users).PrinterOptions.pseudo_classes: thePseudoClassesstruct and thepseudo!macro indirection inselectors/selector.rsPrinterErrorKind::ambiguous_url_in_custom_propertyand::invalid_css_modules_pattern_in_grid(never constructed)Rust util crates (~25 lines)
bun_core/util.rs:FdOptional(unused; only re-exported)bun_core/env_var.rs:BUN_NEEDS_PROC_SELF_WORKAROUND,MI_VERBOSE,TODIUMCargo.toml
Unused dependencies dropped from
collections,paths,io,glob,css(21 entries).Verification
bun bdbuilds clean (no warnings)bun run rust:check-allpasses on all 10 targetscss.test.ts,css-modules.test.ts,css-loader.test.ts, node:http smoke test,dead-code-escapes.test.tsall passextern "C"symbol grepped againstvendor/WebKit/(caughtBun__analyzeTranspiledModule, which is live via weak-override and was left alone)Not removed
src/react_compiler/has ~3.4k lines of unreferenced debug/print modules, butDESIGN.mdmarkshir/,diagnostics/,validation/as byte-for-byte upstream ports kept for the sync workflow; left untouched.MinifyOptions.unused_symbolschain (~95 lines): also provably unreachable, but removing it cascades aparent_is_unused: boolparameter through ~20minify()signatures. Left for a separate change.[review] gate passed · iteration 2 · 66 files touched
fails on main (without fix)
passes on PR (with fix)
diff hotspot
gate history · 8 passed · 0 rejected · iteration 2
evidence per changed file
root cause · written by the author bot
The bug was residual dead code left behind by an API cleanup that applied its own removal criterion inconsistently:
PrinterOptions.project_rootwas never set to a non-default value at any construction site, so its entire downstream chain throughCssModule::newwas unreachable, and similar dead surface remained in the unusedis_custom_propertyparameter and stale comments referencing the removed hiveget()API. The fix removesproject_rootalong with its capture, parameter, and argument chain, the unreachable branch in css_modules.rs, and the struct's now-unneeded lifetime paramete…