Skip to content

Remove dead code from llhttp/api.h, C++ bindings helpers, bun_core/bun_jsc Rust - #36576

Merged
Jarred-Sumner merged 4 commits into
mainfrom
claude/farm/0d614497/dead-code-llhttp-helpers-install-ast
Aug 1, 2026
Merged

Remove dead code from llhttp/api.h, C++ bindings helpers, bun_core/bun_jsc Rust#36576
Jarred-Sumner merged 4 commits into
mainfrom
claude/farm/0d614497/dead-code-llhttp-helpers-install-ast

Conversation

@robobun

@robobun robobun commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

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 #included. 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 #includes ~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 #includes 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 #included. 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 Remove dead code from node/crypto C++, js_parser, js_printer, bundler, sql, server #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.

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

fails on main (without fix)
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 (6057ada72)

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 (91f57fe62)

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)
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts
bun test v1.4.0 (6057ada72)

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)
diff hotspot
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(-)

gate history · 1 passed · 1 rejected · iteration 2

evidence per changed file
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)

…erValues, JSDOMConvertJSON/WebGL, JSVMClientDataClient, headers-cpp.h, ares_build.h, TaskSource, headers-handwritten, JSDOMWrapper) and Rust (install LifecycleScriptTimeLog chain, bun_core String::github_action, jsc JSUint8Array::ptr/RefString::to_js/Errorable::value)

Net -1295 lines. Every removed symbol was verified with zero references
across src/ and build/debug/codegen/ (or, for whole files, zero #include
anywhere in the tree), then confirmed by a full debug build and
rust:check-all across all target triples.
@robobun

robobun commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Status: diff is green. Review nits addressed (WeakHashSet include, IDLJSON struct, sizegen.cpp description). Per Jarred's comment, reverted the src/install/ LifecycleScriptTimeLog removal in 6057ada (it is scaffolding for the #7719 slow-postinstall warning, which has regressed on main independently of this PR; handed off as a separate fix). Net now -1185 lines across 24 files, scoped to C++ bindings + bun_core::String/bun_jsc Rust helpers. Waiting on CI for 6057ada.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The pull request removes unused Rust APIs, JavaScriptCore and WebCore binding declarations, conversion helpers, generated headers, and lifecycle client tracking. It also adds source-tree lint checks for removed symbols.

Changes

Dead code cleanup

Layer / File(s) Summary
Remove unused Rust APIs
src/bun_core/string/mod.rs, src/jsc/Errorable.rs, src/jsc/JSUint8Array.rs, src/jsc/RefString.rs, src/jsc/sizes.rs
Removes unused constructors, formatters, JavaScript conversion methods, typed-array pointer access, and the related size constant.
Simplify JSC bindings and conversions
src/jsc/bindings/BunClientData.*, src/jsc/bindings/JSDOMWrapper.h, src/jsc/bindings/helpers.h, src/jsc/bindings/IDLTypes.h, src/jsc/bindings/webcore/*, src/jsc/bindings/node/http/llhttp/api.h, src/jsc/bindings/headers-*.h, src/jsc/bindings/ares_build.h, src/jsc/bindings/webcore/HTTPHeaderValues.*, src/jsc/headergen/sizegen.cpp
Removes unused client tracking, DOM constants, conversion helpers, IDL and WebGL converters, HTTP helpers, llhttp declarations, generated binding data, and related headers.
Add dead-symbol source checks
test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts
Adds source-lint assertions that prevent removed C++ and Rust symbols and references from returning.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the removal of dead code from llhttp, C++ bindings, and Rust APIs.
Description check ✅ Passed The description explains the changes and provides detailed verification results, including builds, checks, and tests.

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

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Beyond the two inline nits, I spot-checked the load-bearing deletion claims: addClient/JSVMClientDataClient have zero references; LifecycleScriptTimeLog/lifecycle_script_time_log are unreferenced; all four .github_action() call sites in VirtualMachine.rs are on jsc::ZigString (not bun_core::String); the removed helpers.h symbols, WritableEvent/ReadableEvent__, BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR, and the deleted headers (llhttp/api.h, TaskSource.h, ares_build.h, HTTPHeaderValues.h) have no remaining includers/callers; and the JSDocumentWrapperType group appears only in commented-out DOMJITHelpers.h lines. The one textPlainContentType grep hit in CommonAtomStrings.h is an unrelated atom-string macro entry, not a call into the deleted namespace.

Extended reasoning...

Spot-checked the deletion claims that back the highest-risk removals (BunClientData VM-lifecycle field, PackageManager struct field, bun_core::String method) against src/ — all hold. The two inline findings are cosmetic (an inaccurate PR-description parenthetical about an already-uncompilable non-built file, and a now-superfluous header include); neither affects the build or runtime. Deferring rather than approving given the breadth (26 files spanning JSC bindings + install crate + bun_core), which warrants a human glance even for pure deletions.

Comment thread src/jsc/headergen/sizegen.cpp
Comment thread src/jsc/bindings/BunClientData.h Outdated
Comment thread src/jsc/bindings/webcore/JSDOMConvert.h
…urce-lint: assert via surviving-file content, not file presence

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts`:
- Around line 22-28: Add direct regression assertions for the deleted
unreferenced headers api.h, ares_build.h, TaskSource.h, and HTTPHeaderValues.h
in the dead-symbols test, verifying each path is absent from the source tree.
Keep the existing indirect build-based checks for files with surviving
references unchanged.
🪄 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: ed252ea3-6963-4717-a9c3-5e66e51031f1

📥 Commits

Reviewing files that changed from the base of the PR and between f0727d3 and 23b3d1a.

📒 Files selected for processing (3)
  • src/jsc/bindings/BunClientData.h
  • src/jsc/bindings/IDLTypes.h
  • test/internal/source-lints/dead-symbols-llhttp-helpers-install.test.ts
💤 Files with no reviewable changes (2)
  • src/jsc/bindings/IDLTypes.h
  • src/jsc/bindings/BunClientData.h

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All three earlier nits are addressed (WeakHashSet.h include, sizegen.cpp description, IDLJSON) and I found nothing new this pass. Deferring to a human given the breadth — 27 files / -1.3k lines across core JSC bindings (BunClientData dtor, helpers.h, headers-handwritten.h, IDLTypes.h) plus a PackageManager struct field.

Spot-checked: addClient/JSVMClientDataClient, the removed helpers.h overloads, HTTPHeaderValues/TaskSource.h/ares_build.h includes, WritableEvent__/ReadableEvent__, and LifecycleScriptTimeLog — all zero live references.
Confirmed the JSDOMWrapper.h node-type constants only appear in commented-out DOMJITHelpers.h:173-178, and bun_core/lib.rs re-exports only the kept ZigStringGithubActionFormatter.
Checked llhttp/api.h has no includers and BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR has no remaining readers.

Extended reasoning...

Overview

Pure dead-code removal: -1296 / +80 across 27 files. Eight whole-file C++ header/source deletions (llhttp/api.h, headers-cpp.h, ares_build.h, TaskSource.h, HTTPHeaderValues.{h,cpp}, JSDOMConvertJSON.h, JSDOMConvertWebGL.{h,cpp}, JSVMClientDataClient.h), targeted symbol removals from helpers.h / headers-handwritten.h / JSDOMWrapper.h / BunClientData.{h,cpp} / IDLTypes.h, and Rust removals (LifecycleScriptTimeLog chain in install/, String::github_action, JSUint8Array::ptr, RefString::to_js, Errorable::value, one sizes.rs constant). A new source-lint test guards against reintroduction.

Security risks

None. This PR only deletes code and adds a read-only source-lint test; no new inputs, no auth/crypto/parsing surface touched.

Level of scrutiny

Medium-high, driven by breadth rather than logic complexity. Each individual removal is mechanically verifiable (grep + build), and the description documents per-item verification plus bun bd and rust:check-all across all targets. But the touched files are widely-included JSC bindings headers and a package-manager struct, so a wrong claim would have broad blast radius. I re-verified the load-bearing zero-reference claims (see message above) and all held; the only remaining live references to removed JSDOMWrapper.h constants are in commented-out code, matching the description.

Other factors

I've reviewed this PR three times previously; all three nits (stray <wtf/WeakHashSet.h> include, misleading "kept compilable" wording for sizegen.cpp, orphaned IDLJSON struct) were addressed in 91f57fe and 23b3d1a, and the source-lint test was extended to cover them. The bug-hunting system found nothing this run. The description also notes coordination with 11 other open dead-code PRs and a stated intent to leave the sizegen.cpp loop body for #36115 to rework. Given the scope and the number of core headers touched, a maintainer should give the final sign-off; I'm not blocking on anything specific.

@Jarred-Sumner Jarred-Sumner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we not log slow lifecycle scripts? We’re supposed to!

…ipt warning, not dead code

The chain is currently non-functional on main (timer never started, Entry is
empty, printAndDeinit was never ported from Zig) but it is the scaffolding for
the "X's postinstall script took Yms" warning from #7719, which should be
restored rather than deleted.
@robobun

robobun commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Good catch, reverted the src/install/ portion in 6057ada.

Worth flagging though: on current main that feature is already non-functional, independent of this PR. Tracing it back:

  • Originally landed in feat: print the longest postinstall if it took more than 500ms #7719: Zig LifecycleScriptTimeLog with Entry { package_name, script_id, duration } and a printAndDeinit that warned "{}'s {} script took {}" for the slowest entry.
  • In the Rust rewrite (Rewrite Bun in Rust #30412), three pieces went missing:
    1. LifecycleScriptTimeLogEntry became an empty struct {} (fields dropped).
    2. LifecycleScriptSubprocess.timer is declared Option<Timer>, initialised to None at the single construction site, and never set to Some, so maybe_duration is always None and append_concurrent is unreachable.
    3. printAndDeinit was never ported; nothing ever reads lifecycle_script_time_log.list.

So today bun install never prints the slow-postinstall warning. I've left the scaffolding in place here; restoring the timer start, the entry fields, and the print path is a separate fix outside the scope of a dead-code sweep.

PR is now net -1185 across 24 files (C++ bindings + bun_core::String/bun_jsc helpers only).

@robobun robobun changed the title Remove dead code from llhttp/api.h, C++ bindings helpers, install LifecycleScriptTimeLog Remove dead code from llhttp/api.h, C++ bindings helpers, bun_core/bun_jsc Rust Aug 1, 2026
@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

Can you implement it

@robobun

robobun commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Already on it: a separate PR is being spun up to restore the #7719 slow-postinstall warning (port Entry { package_name, script_id, duration }, start the timer in spawn_next_script, and port printAndDeinit to the Rust output layer with a call at the end of the install summary). Keeping it out of this PR so the deletion diff stays reviewable on its own; will link it here once it's open. This PR stays scoped to the C++ bindings + bun_core/bun_jsc deletions (net -1185).

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — all three earlier nits are addressed (WeakHashSet include dropped in 91f57fe, IDLJSON removed in 23b3d1a, sizegen.cpp wording fixed) and the src/install/ LifecycleScriptTimeLog revert in 6057ada resolves the maintainer feedback.

Spot-checked post-revert: StringGithubActionFormatter has zero refs (only the ZigString variant is re-exported from bun_core/lib.rs); Zig::toStringView(ZigString) / Zig::toAtomString(ZigString) don't collide with the surviving Bun::toStringView(StringView) / JSString::toAtomString; JSVMClientDataClient/willDestroyVM, BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR, and the deleted webcore headers all grep clean across src/. The ~JSVMClientData loop removal is provably a no-op since addClient() had no callers.

Extended reasoning...

Overview

Net -1185 lines across 24 files. Eight whole-file deletions under src/jsc/bindings/ (llhttp/api.h, headers-cpp.h, ares_build.h, TaskSource.h, HTTPHeaderValues.{h,cpp}, JSDOMConvertJSON.h, JSDOMConvertWebGL.{h,cpp}, JSVMClientDataClient.h), targeted symbol removals from helpers.h / headers-handwritten.h / JSDOMWrapper.h / BunClientData.{h,cpp} / IDLTypes.h, four Rust helper removals in bun_core::string / bun_jsc, and one new test/internal/source-lints/ regression test. The src/install/ LifecycleScriptTimeLog removal from an earlier revision was reverted in 6057ada per maintainer feedback, so no package-manager code is touched.

Security risks

None. Pure deletions of unreferenced declarations and never-included headers; no input parsing, no auth/crypto/permissions surface, no behavior change on any reachable path. The one non-trivial edit — dropping the m_clients.forEach(willDestroyVM) loop from ~JSVMClientData — is a provable no-op because addClient() had zero callers, so m_clients was always empty.

Level of scrutiny

Low-to-moderate. The change is large by line count but mechanically verifiable: each item is a grep-for-zero-references check plus a full build. I re-ran the reference checks for a representative sample across both languages (StringGithubActionFormatter, Zig::toStringView/toAtomString overload collision, JSVMClientDataClient, BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR, the deleted webcore headers, the JSDOMWrapper.h node-type constants, WritableEvent/ReadableEvent typedefs) and all came back clean against current src/. The bun_core/lib.rs re-export list only names ZigStringGithubActionFormatter, so removing the String variant doesn't break the public re-export.

Other factors

  • All three of my earlier inline nits are resolved (91f57fe, 23b3d1a, description update); the CodeRabbit source-lint suggestion was withdrawn; the maintainer's src/install/ concern was reverted in 6057ada. No outstanding threads.
  • bun bd and bun run rust:check-all pass per the description; a stale reference in either language would fail the build outright.
  • Follows the established test/internal/source-lints/dead-symbols-*.test.ts pattern used by the ~11 sibling dead-code PRs referenced in the description; the new test asserts against surviving-file content rather than existsSync() per the harness constraint documented at lines 22-28.
  • sizegen.cpp remains uncompilable but that's pre-existing (never in a build rule; loop referenced undefined names[] before this PR too) and is being reworked in #36115.

@Jarred-Sumner
Jarred-Sumner merged commit fd25110 into main Aug 1, 2026
50 of 54 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/0d614497/dead-code-llhttp-helpers-install-ast branch August 1, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants