Repository navigation
Conversation
…s, and bun_runtime - generate-classes.ts: stop emitting the js<Class>Constructor custom getter. Nothing installs it on a prototype or references it. It was generated for all 67 constructible classes. - generate-jssink.ts: stop emitting function<Sink>__getter for the 7 sinks. Nothing references it. - ZigGlobalObject.h: remove the six sink constructor accessors that only the sink getter called. ArrayBufferSink() stays, BunObject.cpp and BunStreamConsumers.cpp call it. - WebStreamsMisc.cpp: remove createStreamsBoundHandler. Its last caller went away in #41894. - BunProcess.cpp: remove the empty POSIX signalHandler(int). Only the Windows overload is referenced. - BunBuiltinNames.h: remove onClose and onDrain. - CPUProfilerConfig::interval and MultiPartUpload::global_this: written at construction, never read. - runtime/image/mod.rs, runtime/node.rs: trim re-exports that nothing names.
|
Updated 8:34 PM PT - Sep 10th, 2026
✅ @robobun, your commit 552d3876fb16173cf496407d7faa856b11bb04fe passed in 🧪 To try this PR locally: bunx bun-pr 42266That installs a local version of the PR into your bun-42266 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughThe changes remove obsolete generated getters and stream helpers, narrow runtime public exports, remove profiler configuration state, specialize signal handling for Windows, and remove ChangesRuntime binding and API cleanup
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The cleanup preserves the S3 upload lifetime guarantees and introduces no identified runtime or data-integrity risk. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
Status
|
There was a problem hiding this comment.
LGTM — mechanical dead-code sweep, all removals check out.
What was reviewed:
- Grepped for every removed symbol: the six sink constructor accessors,
createStreamsBoundHandler,onClose/onDrainprivate names, and the removed Rust re-exports have zero remaining references insrc/. &signalHandlerat BunProcess.cpp:1652 is inside the#elseof#if !OS(WINDOWS), so the POSIX overload was genuinely dead.- Confirmed
global_staticinupload_streamis still consumed byS3UploadStreamWrapper.global(line 957), so the updated JSC_BORROW comment is accurate;writable_streamno longer needs one. js${typeName}Constructoris not referenced by any HashTableValue emitter in generate-classes.ts — the prototype'sconstructorcomes fromLazyClassStructure/createConstructor.
Extended reasoning...
Overview
This PR is a targeted dead-code sweep across 13 files (+4/−79). It removes two unreferenced codegen templates (js${typeName}Constructor custom getter in generate-classes.ts, function${name}__getter in generate-jssink.ts), the six ZigGlobalObject sink-constructor accessors that only those getters called, an empty POSIX signalHandler(int) overload, the unused createStreamsBoundHandler helper, two builtin-name macros, and a handful of unread Rust struct fields and re-exports (CPUProfilerConfig::interval, MultiPartUpload::global_this, image/node module re-exports). No behavior is added; every hunk is a deletion or a struct-init-site adjustment for a deleted field.
Security risks
None. Nothing here touches auth, crypto, input parsing, or any user-reachable validation path. Deleting an unread GlobalRef field on MultiPartUpload cannot affect GC rooting because GlobalRef is a borrow of the process-lifetime global object, not a JS heap root, and the S3 wrapper still holds its own global field where needed.
Level of scrutiny
Low-to-moderate. The change is mechanical and the PR description documents a rigorous verification method (--gc-sections --print-gc-sections relink for C++, per-crate pub(crate) + #[deprecated] sweep across 9 Rust targets, bun bd link, rust:check-all 12/12). I independently grepped the tree for every removed symbol and confirmed zero remaining call sites; spot-checked that the sole &signalHandler reference is Windows-gated; confirmed the removed js<Type>Constructor getter is not wired into any prototype HashTableValue (constructor linkage goes through LazyClassStructure::setConstructor instead); and verified mode_from_js callers in node_fs.rs go through types::mode_from_js directly, not the removed top-level re-export.
Other factors
No CODEOWNERS entries cover the changed paths. The two bot inline threads at client.rs:902 were addressed by commit 552d387, which corrected the JSC_BORROW comment to name the actual storage site (S3UploadStreamWrapper) after the MultiPartUpload field was dropped — that fix is correct. REVIEW.md explicitly requires deleting dead code and naming the deletions in the description, which this PR does thoroughly. The change is small, self-contained, and compiles/links on all targets per the description; there is nothing here a human reviewer would need to weigh in on.
Problem
src/codegen/generate-classes.tsemits ajs<Class>Constructorcustom getter for each of the 67 constructible generated classes. Nothing installs it on a prototype and nothing references it.src/codegen/generate-jssink.tshas the same pattern:function<Sink>__getterfor the 7 sinks, with no reference.createStreamsBoundHandler(last caller removed in Bun.serve direct streams: flush on controller.close(), end the response once, call cancel() only on a client abort #41894), the empty POSIXsignalHandler(int), two builtin names, two write-only struct fields, and some re-exports.Fix
ZigGeneratedClasses.cppshrinks by 871 lines,JSSink.cppandJSSink.hby 63.ZigGlobalObject.hthat only the sink getter called, and the other items listed in Notes. Each one has zero references insrc/,packages/, the codegen scripts and the generated output.bun bdbuilds and links.bun run rust:check-allis 12 of 12 ok.arraybuffersink.test.ts,streams.test.js,cpu-prof.test.tsandtest/internal/source-lints/pass.X.prototype.constructor === Xholds for the generated classes, before and after.test/internal/source-lints/CLAUDE.mdasks for no tests for dead symbols.Background
generate-classes.tsturns each*.classes.tsdefinition into a C++ wrapper class, a prototype class and a constructor class. Theconstructorproperty of a prototype comes from the constructor class, not from this getter.generate-jssink.tsdoes the same for theJSSinkstream sink classes.ZigGlobalObject.h, so one of the two needs a rebase after the other merges.Notes
Removed symbols:
js${typeName}Constructorgetter template (generate-classes.ts). A relink of the debug binary with--gc-sections --print-gc-sectionsdrops all 67 instances.function${name}__gettertemplate (generate-jssink.ts). The same relink drops all 7.Zig::GlobalObject::FileSink(),HTTPResponseSink(),HTTPSResponseSink(),NetworkSink(),FetchRequestBodySink(),HTMLRewriterSink().ArrayBufferSink()stays,BunObject.cppandBunStreamConsumers.cppcall it. The*Structure()accessors stay,JSSink.cppcalls them.Bun::WebStreams::createStreamsBoundHandler(WebStreamsMisc.cpp,WebStreamsInternals.h).Bun::signalHandler(int)inBunProcess.cpp. The body was empty on POSIX. The only reference,&signalHandler, is inside the Windows branch and takes theuv_signal_t*overload, which stays.onCloseandonDraininBunBuiltinNames.h. No$onCloseor$onDraininsrc/js, noonClosePublicName,onClosePrivateName,onDrainPublicNameoronDrainPrivateNamein C++.bundle-functions.tsadds a private name on its own when a builtin starts to use one.CPUProfilerConfig::interval.run_command.rspasses the interval toset_sampling_intervaldirectly.MultiPartUpload::global_this. Both constructors wrote it, nothing read it.runtime/image/mod.rs,mode_from_jsanddirent::Direntinruntime/node.rs.Test counts:
streams.test.js549,arraybuffersink.test.ts14,cpu-prof.test.ts12,test/internal/source-lints/172.Method: one pass that marks every
pubitempub(crate)per crate and reads thedead_codeoutput, then a second pass that tags each hit#[deprecated]and collects the use sites fromcargo check --workspaceon 9 targets. For C++, the--print-gc-sectionslist from a relink, thenrgfor each name.Found but left alone:
mockedFunctioninBunBuiltinNames.hlooks unused torg, butBunCommonStrings.cppbuilds the accessor name with##. The build caught it.Featurevariants insrc/css/compat.rsare never constructed. The file is generated from upstream data, so this PR does not edit it.