Skip to content

Rename Zig-prefixed names in the JSC bindings to Bun equivalents - #31822

Open
robobun wants to merge 39 commits into
mainfrom
farm/50d63c3b/rename-zigglobalobject
Open

Rename Zig-prefixed names in the JSC bindings to Bun equivalents#31822
robobun wants to merge 39 commits into
mainfrom
farm/50d63c3b/rename-zigglobalobject

Conversation

@robobun

@robobun robobun commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

What

De-Zigs the JSC bindings layer, in two mechanical stages. The header carried // TODO: rename this to BunGlobalObject since April 2023 (aeb3bb9); the runtime port made the rest of the Zig-prefixed naming stale too.

Stage 1: the global object

  • Zig::GlobalObject and Zig::EvalGlobalObject move to namespace Bun
  • ZigGlobalObject.{h,cpp,lut.txt} become BunGlobalObject.{h,cpp,lut.txt}
  • extern "C" symbols: Zig__GlobalObject__* -> Bun__GlobalObject__*, ZigGlobalObject__* -> BunGlobalObject__*, Bun__ZigGlobalObject__uvLoop -> Bun__GlobalObject__uvLoop

Stage 2: the rest of namespace Zig and the Zig-prefixed binding files

  • namespace Zig is gone; all members (SourceProvider, JSFFIFunction, JSWrappingFunction, CallSite, ImportMetaObject, JSCStackTrace/JSCStackFrame, BunPlugin, string helpers) now live in namespace Bun
  • ZigSourceProvider.{h,cpp}, ZigException.cpp, ZigGeneratedCode.cpp, ZigLazyStaticFunctions{,-inlines}.h -> Bun*
  • C ABI exception types renamed on both C++ and Rust sides, including the Rust source files and modules: ZigException, ZigStackTrace, ZigStackFrame, ZigStackFramePosition, ZigStackFrameCode, ZigErrorType, ZigErrorCode -> Bun*
  • CommonStringsForZig -> CommonStringsForBun (and Bun__CommonStringsForZig__toJS -> Bun__CommonStringsForBun__toJS)
  • Zig_ErrorCodeParserError / Zig_ErrorCodeJSErrorObject -> Bun_*; zig__ModuleInfo* / zig__renderDiff -> bun__*
  • codegen templates (bundle-functions.ts, generate-classes.ts, cppbind.ts type maps), build scripts, $newCppFunction references, leaksan suppressions and docs updated to match

Relationship to #30747

#30747 is the full-codebase superset of this rename (same target names) but is currently conflicting and stacked on #30683. This PR lands the bindings-layer portion fresh against main. Still intentionally left for the bigger sweep: ZigString/ZigStringSlice and friends, ZIG_EXPORT/ZIG_DECL/ZIG_NONNULL, ZigGeneratedClasses (codegen artifact naming), and crate-internal zig_* names.

Non-mechanical bits

  • BunClientData.h forward-declared namespace Zig { class GlobalObject; } right before using namespace Zig;; both are now Bun
  • 20 headers forward-declared class GlobalObject; inside namespace Zig blocks; those decls moved to namespace Bun
  • unsafeEvalNoop was defined in both NodeVM.cpp and the formerly-Zig:: block of the global object cpp; the latter is now static to avoid a duplicate symbol after the namespace merge
  • the long-commented-out legacy destroy/visitChildrenImpl block in BunGlobalObject.cpp is deleted instead of renamed (the live implementations are earlier in the same file), and the stale bun__renderDiff home-path comment in phase_c_exports.rs now points at its actual definition in src/runtime/test_runner/diff_format.rs
  • JSWrappingFunction.cpp referenced Bun::NativeFunctionPtr for a type that then lived in namespace Zig; it only compiled because of unified-build include leakage, now consistent
  • napi.cpp needed one JSC::Exception qualification that became ambiguous once the using Exception = JSC::Exception alias moved into namespace Bun
  • the Module constructor in NodeModuleModule.cpp carried a TODO about static_casting the lexical global to the (renamed) class; it now uses defaultGlobalObject() so non-Bun globals (node:vm) fall back to the main global instead of reading through a bogus pointer

Verification

  • cargo check passes on the full workspace; full debug (ASAN) build passes
  • git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" comes back empty across the whole repo. Earlier revisions needed a caveat for the uncompiled .zig porting-reference sources, whose comments also matched; Remove the .zig porting-reference sources #32621 removed those from main and this branch has merged it, so the grep is unconditionally clean. The intentionally-kept ZigString family is a different name and never matched this pattern. The only hits a plain git grep "Zig::" still turns up are three CryptoHasherZig:: calls in src/runtime/crypto/CryptoHasher.rs, a pre-existing Zig-suffixed Rust struct (it names the non-OpenSSL hasher variant) that is identical on main and unrelated to the Zig C++ namespace.
  • smoke-tested the paths whose symbols or classes moved: streams.test.js, shadow.test.js, vm.test.ts, plugins.test.ts, worker_threads.test.ts, node-module-module.test.js, ffi.test.js, plus Error.prepareStackTrace CallSite formatting, uncaught-exception rendering, and bun build: all pass

No behavior change, so no new test; existing suites cover the renamed paths.


no test proof · iteration 63 · Platform-specific test(s) that do not run on this machine. Deferring to CI, which covers all platforms: test/js/web/broadcastchannel/broadcast-channel-worker-gc.test.ts test/regression/issue/29519.test.ts test/regression/issue/30205.test.ts

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR renames JSC-facing Zig-prefixed global object, exception, stack, source-provider, and related binding surfaces to Bun-prefixed names across generators, Rust, Zig, C++, headers, runtime modules, build scripts, and documentation.

Changes

Bun JSC runtime rename

Layer / File(s) Summary
Runtime and binding rename
.claude/skills/implementing-jsc-classes-cpp/SKILL.md, scripts/build/*, src/jsc/..., src/jsc/bindings/..., src/codegen/..., src/jsc/modules/..., src/bundler/..., src/bundler_jsc/..., src/ast_jsc/lib.rs, CLAUDE.md, .gitattributes
Generated code, FFI symbols, runtime wrappers, JSC bindings, headers, native modules, build wiring, and docs are retargeted from Zig-named global object and exception surfaces to Bun-named equivalents.

Suggested reviewers

  • Jarred-Sumner
  • alii
🚥 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 is concise and accurately summarizes the main rename in this PR.
Description check ✅ Passed The description includes both what changed and verification details, covering the template's required sections.

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

@github-actions github-actions Bot added the claude label Jun 4, 2026
@robobun

robobun commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 8:37 PM PT - Jul 15th, 2026

@robobun, your commit 54db3c3 has 3 failures in Build #73556 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 31822

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

bun-31822 --bun

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

This PR may be a duplicate of:

  1. Rename Zig-prefixed identifiers to Bun/Rust equivalents #30747 - Superset rename of all Zig-prefixed identifiers to Bun/Rust equivalents, which includes the same ZigGlobalObject → BunGlobalObject rename performed here

🤖 Generated with Claude Code

@robobun

robobun commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

Not a coincidence: #30747 is the superset rename (all Zig-prefixed identifiers) but it is currently conflicting and stacked on #30683. This PR is the same ZigGlobalObject -> BunGlobalObject naming, rebuilt fresh against main, and is being extended to cover the remaining Zig-prefixed files in src/jsc/bindings (SourceProvider, Exception, GeneratedCode, LazyStaticFunctions) plus the namespace Zig -> Bun merge, using the same target names as #30747. The ZigString -> UnsafeStringView and ZIG_EXPORT -> RUST_EXPORT sweeps remain in #30747's scope.

@robobun robobun changed the title Rename ZigGlobalObject to BunGlobalObject Rename Zig-prefixed names in the JSC bindings to Bun equivalents Jun 4, 2026
@robobun

robobun commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

Extended per request: namespace Zig is now fully merged into namespace Bun, and the remaining Zig-prefixed binding files (SourceProvider, Exception, GeneratedCode, LazyStaticFunctions) plus the C ABI exception types are renamed on both the C++ and Rust sides. ZigString and the ZIG_EXPORT macro family remain with #30747.

@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.

I didn't find any issues with the rename itself, but this is a 282-file change spanning the C++/Rust/Zig FFI boundary with a few hand-fixed non-mechanical bits (and CI is currently red on the musl build-cpp jobs), so it's worth a human pass before merge.

Extended reasoning...

Overview

This PR mechanically renames Zig::GlobalObjectBun::GlobalObject (and ZigGlobalObject.{h,cpp,lut.txt}BunGlobalObject.*, plus the Zig__GlobalObject__* / ZigGlobalObject__* extern "C" symbols) across 282 files. It touches the core JSC global object class, the codegen templates that emit references to it, the Rust/Zig FFI declarations, build scripts, leaksan suppressions, and docs. The diff is overwhelmingly mechanical find-and-replace, and the author confirmed git grep for the old names is now empty.

Security risks

None identified. This is a pure rename of an internal C++ class and its linker symbols; no auth, crypto, permission, or input-handling logic is changed. The one behavior change (NodeModuleModule's Module constructor now uses defaultGlobalObject() instead of static-casting the lexical global) is a defensive fix for node:vm contexts and is called out in the description.

Level of scrutiny

High, for two reasons. First, the global object is the most central type in Bun's JSC bindings — every extern "C" symbol rename must match on all three sides (C++, Rust, Zig) or the link fails or, worse, silently mismatches. Second, the PR explicitly mixes in several non-mechanical hand-fixes: the empty namespace Zig {} shim in BunClientData.h to keep using namespace Zig valid, making unsafeEvalNoop static to avoid an ODR collision with NodeVM.cpp, the Zig::NativeFunctionPtr qualification fix in JSWrappingFunction.cpp, and the defaultGlobalObject() change in NodeModuleModule. These are individually small but each one is the kind of thing that only shows up on specific build configurations.

Other factors

CI on commit 387b866 shows the musl build-cpp jobs failing (x64-musl, aarch64-musl, x64-musl-baseline); the latest commit ac64c4e may or may not have re-run yet. The author also noted in the thread that this PR is still being extended to cover more Zig-prefixed files, and it overlaps with the larger #30747. Given the scale, the cross-language symbol renames, the red CI, and the in-flight scope, this should get a human sign-off rather than a bot approval.

@robobun
robobun force-pushed the farm/50d63c3b/rename-zigglobalobject branch from ac64c4e to d846f74 Compare June 4, 2026 22:26
Comment thread CLAUDE.md
Comment thread src/jsc/BunException.rs Outdated
@robobun

robobun commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

CI status: every lane is green except :windows: x64-baseline verify-baseline, which is failing on main too (builds 60403 and 60365 fail identically): the Intel SDE download in that step returns a 0-byte sde.tar.xz and 7-Zip exits 2 before any test runs. Not related to this diff.

Summary for review: namespace Zig is fully merged into namespace Bun, the Zig-prefixed binding files and the C ABI exception types are renamed on both the C++ and Rust sides, and review feedback (stale CLAUDE.md mention, Zig*.zig reference-file paths in comments) is addressed. ZigString/ZigStringSlice, ZIG_EXPORT/ZIG_DECL, ZigGeneratedClasses and crate-internal zig_* names are intentionally left for #30747. Ready for a human pass.

Comment thread src/jsc/VirtualMachine.rs Outdated
Comment thread src/jsc/lib.rs Outdated
Comment thread src/jsc/VirtualMachine.rs Outdated
Comment thread src/jsc/bindings/JSBufferList.cpp Outdated
Comment thread src/jsc/bindings/ModuleLoader.cpp Outdated
@robobun

robobun commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI update: the test-bun lanes on build 60500 all fail on a single file, test/cli/install/bunx.test.ts ("should handle package that requires node 24"). This is external: @angular/cli@22.0.0 was just published with engines.node = "^22.22.3 || ^24.15.0 || >=26.0.0", and Bun reports Node v24.3.0, which satisfies none of those ranges, so the Angular CLI exits 3. The failure reproduces identically with the pre-rename release binary (USE_SYSTEM_BUN=1), so it is unrelated to this diff and will hit every branch including main on its next build. Fixing it likely means bumping REPORTED_NODEJS_VERSION or pinning the test to @angular/cli@21, either of which is a separate change.

The windows x64-baseline verify-baseline failure remains the known 0-byte Intel SDE download, also broken on main (builds 60403, 60365). Everything else is green.

@robobun
robobun force-pushed the farm/50d63c3b/rename-zigglobalobject branch from 27a6dec to c727d0d Compare June 5, 2026 01:21
Comment thread src/jsc/bindings/BunException.cpp Outdated

@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: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
src/jsc/ErrorCode.rs (1)

1503-1516: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Don't export placeholder parser/JSError sentinels under the new Bun_* ABI names.

The updated comment says C++ must not link against these Rust statics until they are derived from the same source as ErrorCode::from(), but Lines 1513 and 1516 still export exactly those Bun_* symbols. That means the rename carries forward a real behavior bug: C++ will compare against 0xFFFE/0xFFFD, while ErrorCode::from() never produces those values, so parser-error / JS-error-object detection silently stops matching. Either derive these exports from the same anyerror source as from(), or keep the C++ side on the existing authoritative source until that port lands.

🤖 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/jsc/ErrorCode.rs` around lines 1503 - 1516, The two Rust statics
Bun_ErrorCodeParserError and Bun_ErrorCodeJSErrorObject are being exported under
the new Bun_* ABI names but do not match ErrorCode::from() values, so stop
exporting these placeholder sentinels: remove or rename the #[unsafe(no_mangle)]
exports for Bun_ErrorCodeParserError and Bun_ErrorCodeJSErrorObject (i.e., make
them private/internal rust statics or drop the no_mangle so C++ cannot link
against them), or alternatively change their initialization to derive the same
anyerror-backed u16 that ErrorCode::from() uses (e.g., obtain the value from the
same bun_core::Error anyerror interning path) and only then retain the Bun_* ABI
export; reference symbols: Bun_ErrorCodeParserError, Bun_ErrorCodeJSErrorObject,
ErrorCode::PARSER_ERROR, ErrorCode::JS_ERROR_OBJECT, and ErrorCode::from().
src/jsc/bindings/ImportMetaObject.cpp (1)

295-306: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard nullable dynamicDowncast result before first dereference.

Line 295 uses dynamicDowncast, but Line 305 dereferences globalObject before the null-check at Line 317. That can crash on non-Bun globals.

🔧 Suggested fix
-    if (globalObject->onLoadPlugins.hasVirtualModules()) {
+    if (globalObject && globalObject->onLoadPlugins.hasVirtualModules()) {
         if (moduleName.isString()) {
             auto moduleString = moduleName.toWTFString(globalObject);
             if (auto resolvedString = globalObject->onLoadPlugins.resolveVirtualModule(moduleString, from.toWTFString(globalObject))) {
                 if (moduleString == resolvedString.value())
                     return JSC::JSValue::encode(moduleName);
                 return JSC::JSValue::encode(jsString(vm, resolvedString.value()));
             }
         }
     }
🤖 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/jsc/bindings/ImportMetaObject.cpp` around lines 295 - 306, The result of
dynamicDowncast<Bun::GlobalObject> stored in globalObject may be null and is
dereferenced later; add an immediate null check after the dynamicDowncast
(before any use of globalObject, e.g., before accessing
globalObject->onLoadPlugins) and handle the null case by returning early (using
the same error/exception flow as other early returns, e.g., via
RETURN_IF_EXCEPTION or an empty return) or throwing an appropriate JS exception
so we never dereference a null pointer in ImportMetaObject.cpp; update the logic
around the existing RETURN_IF_EXCEPTION and subsequent uses of
moduleName/from/isESM/isRequireDotResolve/userPathList to assume globalObject is
non-null after the guard.
src/jsc/bindings/BunGlobalObject.cpp (1)

3298-3327: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Delete the commented-out legacy GlobalObject implementation instead of renaming it.

This block is dead code, and keeping the renamed Zig-era implementation here makes the file harder to audit during the rest of this migration. Please remove it rather than updating identifiers inside the comments.

As per coding guidelines, "Delete dead code in the same PR that makes it dead" and "Comments carry only durable non-obvious content."

🤖 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/jsc/bindings/BunGlobalObject.cpp` around lines 3298 - 3327, Remove the
entire commented-out legacy GlobalObject implementation block (the commented
definitions for GlobalObject::destroy, GlobalObject::visitChildrenImpl, and the
trailing DEFINE_VISIT_CHILDREN(Bun::GlobalObject);) instead of editing
identifiers in comments; simply delete that dead-code comment region so only the
active Zig-era implementation remains, and run a quick grep for
GlobalObject::destroy, visitChildrenImpl, and DEFINE_VISIT_CHILDREN to ensure no
needed code was accidentally removed.
src/jsc/bindings/NodeFSStatFSBinding.cpp (1)

364-377: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use defaultGlobalObject() for the subclass realm.

getFunctionRealm() can return a non-Bun global here, so the static_cast<Bun::GlobalObject*> on Line 372 can read m_JSStatFS*ClassStructure from the wrong object layout. This is the same cross-realm bug class the PR already fixed elsewhere with defaultGlobalObject().

Suggested fix
-        auto* functionGlobalObject = static_cast<Bun::GlobalObject*>(
-            // ShadowRealm functions belong to a different global object.
-            getFunctionRealm(lexicalGlobalObject, newTarget));
+        auto* functionGlobalObject = defaultGlobalObject(
+            // ShadowRealm functions belong to a different global object.
+            getFunctionRealm(lexicalGlobalObject, newTarget));
🤖 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/jsc/bindings/NodeFSStatFSBinding.cpp` around lines 364 - 377, The code
currently static_casts the result of getFunctionRealm(lexicalGlobalObject,
newTarget) to Bun::GlobalObject*, which can yield a non-Bun layout; instead call
defaultGlobalObject on the realm returned by getFunctionRealm so you get a
Bun::GlobalObject* in the subclass path. Replace the static_cast line building
functionGlobalObject with something like: auto* functionGlobalObject =
defaultGlobalObject(getFunctionRealm(lexicalGlobalObject, newTarget)), then pass
that functionGlobalObject into getStatFSStructure<isBigInt> and
createSubclassStructure calls (symbols: getFunctionRealm, defaultGlobalObject,
functionGlobalObject, getStatFSStructure<isBigInt>, createSubclassStructure,
lexicalGlobalObject, newTarget).
🤖 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/codegen/generate-classes.ts`:
- Around line 659-663: The generated call() methods currently reinterpret_cast
the lexicalGlobalObject to Bun::GlobalObject and dereference Bun-only fields;
replace that with using Bun::defaultGlobalObject(lexicalGlobalObject) to obtain
a safe Bun::GlobalObject pointer (same approach as construct()), then get the VM
from that object and use DECLARE_THROW_SCOPE(vm); update the call()
implementations (and the other similar block around the other occurrence) to
mirror the construct() path by calling defaultGlobalObject(...) instead of
reinterpret_cast and proceed as before.
- Around line 773-775: The C++ thunks like ${typeName}__getConstructor must not
narrow their ABI parameter to Bun::GlobalObject*; revert the generated function
signatures to accept the generic JSC::JSGlobalObject* (or JSGlobalObject*) that
callers (Zig/Rust) expect so we don't downcast foreign globals; update the
signature for ${typeName}__getConstructor and apply the same pattern to
__createWithValues, __createWithInitialValues, and
__createWithValuesAndInitialValues so each uses the generic JSGlobalObject* and
then obtain the Bun-specific constructor via the
className(typeName)Constructor() accessor inside the function body.

In `@src/jsc/bindings/BunException.cpp`:
- Around line 2-5: Update the stale header that says “Zig exceptions” to reflect
the rename (e.g., “Bun exceptions” or “BunException”) in the top comment of
BunException.cpp and any other occurrences in this file; locate the header block
that begins with "BunException handling and error processing utilities" and
replace references to "Zig exceptions" with the correct term, and also sweep the
file for any other stray mentions of "Zig" (including function comments around
the exception conversion utilities) and update them to the new name.

In `@src/jsc/bindings/BunObject.cpp`:
- Line 623: Rename the misleading local variable zigGlobalObject to
bunGlobalObject wherever it's declared from
uncheckedDowncast<Bun::GlobalObject>(globalObject); specifically update the
declaration at the shown occurrence and the same pattern at the other
occurrences (lines referenced in the review) so any usage referring to
zigGlobalObject in functions that work with Bun::GlobalObject now use
bunGlobalObject for consistency with the type; ensure you update all variable
references and keep the uncheckedDowncast<Bun::GlobalObject>(globalObject)
expression unchanged.

In `@src/jsc/bindings/BunProcess.cpp`:
- Around line 392-395: Several public process host functions are directly
downcasting lexicalGlobalObject/globalObject_ to Bun::GlobalObject (e.g.,
Process_functionDlopen, Process_setUncaughtExceptionCaptureCallback,
Process_functionHRTime, Process_functionHRTimeBigInt, Process_emitWarning,
Process_functionGetReport, Process_functionBinding,
Process_functionLoadBuiltinModule); change those downcasts to normalize the
global object using defaultGlobalObject(...) (or add an inherits guard) like the
other process entry points do, then use the returned GlobalObject* (or bail
out/throw if null) before calling DECLARE_THROW_SCOPE/getVM or accessing
napiModuleRegisterCallCount to ensure safe, consistent global-object handling
across these functions.

In `@src/jsc/bindings/JSBufferList.cpp`:
- Line 467: The return contains an unnecessary static_cast of globalObject to
Bun::GlobalObject*; simply return globalObject->JSBufferList() instead. Update
the function in JSBufferList.cpp to remove static_cast<Bun::GlobalObject*> and
return globalObject->JSBufferList(), keeping the original return type unchanged
and relying on the existing globalObject parameter type.

In `@src/jsc/bindings/SQLClient.cpp`:
- Around line 138-139: Rename the local variable zigGlobal to reflect its actual
type Bun::GlobalObject* (e.g., bunGlobal or globalObjectPtr) wherever it's
declared and used; specifically update the declaration that currently reads
"Bun::GlobalObject* zigGlobal =
uncheckedDowncast<Bun::GlobalObject>(globalObject);" and all subsequent uses
such as the call to JSBufferSubclassStructure() and the other occurrences
mentioned (around the later block at the same file). Ensure you update every
reference (including the uses at the later 178-179 region) so grep/identifiers
are consistent with the new Bun::GlobalObject* type.

In `@src/jsc/VirtualMachine.rs`:
- Around line 3775-3777: Update the stale symbol name in the comment that
mentions the old constructor: replace `BunGlobalObject__create` with
`Bun__GlobalObject__create` in the comment block near the global-init logic (the
comment that explains routing through `init` then swapping the global), and
sweep the same PR for any other comments/JSDoc that still reference the old
`BunGlobalObject__create` symbol so all documentation matches the current
constructor name (`Bun__GlobalObject__create`).

---

Outside diff comments:
In `@src/jsc/bindings/BunGlobalObject.cpp`:
- Around line 3298-3327: Remove the entire commented-out legacy GlobalObject
implementation block (the commented definitions for GlobalObject::destroy,
GlobalObject::visitChildrenImpl, and the trailing
DEFINE_VISIT_CHILDREN(Bun::GlobalObject);) instead of editing identifiers in
comments; simply delete that dead-code comment region so only the active Zig-era
implementation remains, and run a quick grep for GlobalObject::destroy,
visitChildrenImpl, and DEFINE_VISIT_CHILDREN to ensure no needed code was
accidentally removed.

In `@src/jsc/bindings/ImportMetaObject.cpp`:
- Around line 295-306: The result of dynamicDowncast<Bun::GlobalObject> stored
in globalObject may be null and is dereferenced later; add an immediate null
check after the dynamicDowncast (before any use of globalObject, e.g., before
accessing globalObject->onLoadPlugins) and handle the null case by returning
early (using the same error/exception flow as other early returns, e.g., via
RETURN_IF_EXCEPTION or an empty return) or throwing an appropriate JS exception
so we never dereference a null pointer in ImportMetaObject.cpp; update the logic
around the existing RETURN_IF_EXCEPTION and subsequent uses of
moduleName/from/isESM/isRequireDotResolve/userPathList to assume globalObject is
non-null after the guard.

In `@src/jsc/bindings/NodeFSStatFSBinding.cpp`:
- Around line 364-377: The code currently static_casts the result of
getFunctionRealm(lexicalGlobalObject, newTarget) to Bun::GlobalObject*, which
can yield a non-Bun layout; instead call defaultGlobalObject on the realm
returned by getFunctionRealm so you get a Bun::GlobalObject* in the subclass
path. Replace the static_cast line building functionGlobalObject with something
like: auto* functionGlobalObject =
defaultGlobalObject(getFunctionRealm(lexicalGlobalObject, newTarget)), then pass
that functionGlobalObject into getStatFSStructure<isBigInt> and
createSubclassStructure calls (symbols: getFunctionRealm, defaultGlobalObject,
functionGlobalObject, getStatFSStructure<isBigInt>, createSubclassStructure,
lexicalGlobalObject, newTarget).

In `@src/jsc/ErrorCode.rs`:
- Around line 1503-1516: The two Rust statics Bun_ErrorCodeParserError and
Bun_ErrorCodeJSErrorObject are being exported under the new Bun_* ABI names but
do not match ErrorCode::from() values, so stop exporting these placeholder
sentinels: remove or rename the #[unsafe(no_mangle)] exports for
Bun_ErrorCodeParserError and Bun_ErrorCodeJSErrorObject (i.e., make them
private/internal rust statics or drop the no_mangle so C++ cannot link against
them), or alternatively change their initialization to derive the same
anyerror-backed u16 that ErrorCode::from() uses (e.g., obtain the value from the
same bun_core::Error anyerror interning path) and only then retain the Bun_* ABI
export; reference symbols: Bun_ErrorCodeParserError, Bun_ErrorCodeJSErrorObject,
ErrorCode::PARSER_ERROR, ErrorCode::JS_ERROR_OBJECT, and ErrorCode::from().
🪄 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: 2d5dd5c3-4e23-4ccc-920a-5a5d7b104d14

📥 Commits

Reviewing files that changed from the base of the PR and between ef89527 and b1cccec.

📒 Files selected for processing (300)
  • .claude/skills/implementing-jsc-classes-cpp/SKILL.md
  • .gitattributes
  • CLAUDE.md
  • scripts/build/codegen.ts
  • scripts/build/unified.ts
  • src/ast_jsc/lib.rs
  • src/bun_bin/phase_c_exports.rs
  • src/bun_core/string/mod.rs
  • src/bundler/analyze_transpiled_module.rs
  • src/bundler_jsc/analyze_jsc.rs
  • src/codegen/bundle-functions.ts
  • src/codegen/cppbind.ts
  • src/codegen/generate-classes.ts
  • src/codegen/generate-host-exports.ts
  • src/codegen/generate-js2native.ts
  • src/codegen/generate-jssink.ts
  • src/codegen/shared-types.ts
  • src/event_loop/README.md
  • src/http_jsc/websocket_client.rs
  • src/js/builtins/shell.ts
  • src/js/node/worker_threads.ts
  • src/jsc/BunErrorType.rs
  • src/jsc/BunException.rs
  • src/jsc/BunStackFrame.rs
  • src/jsc/BunStackFrameCode.rs
  • src/jsc/BunStackFramePosition.rs
  • src/jsc/BunStackTrace.rs
  • src/jsc/CommonStrings.rs
  • src/jsc/ConsoleObject.rs
  • src/jsc/DOMFormData.rs
  • src/jsc/Debugger.rs
  • src/jsc/ErrorCode.rs
  • src/jsc/Errorable.rs
  • src/jsc/Exception.rs
  • src/jsc/FetchHeaders.rs
  • src/jsc/JSGlobalObject.rs
  • src/jsc/JSGlobalObject.zig
  • src/jsc/JSValue.rs
  • src/jsc/ModuleLoader.rs
  • src/jsc/ResolvedSource.rs
  • src/jsc/RuntimeTranspilerStore.rs
  • src/jsc/SavedSourceMap.rs
  • src/jsc/VM.rs
  • src/jsc/VirtualMachine.rs
  • src/jsc/VirtualMachine.zig
  • src/jsc/array_buffer.rs
  • src/jsc/bindings/AsymmetricKeyValue.cpp
  • src/jsc/bindings/AsyncContextFrame.cpp
  • src/jsc/bindings/BakeAdditionsToGlobalObject.cpp
  • src/jsc/bindings/BunAnalyzeTranspiledModule.cpp
  • src/jsc/bindings/BunAnalyzeTranspiledModule.h
  • src/jsc/bindings/BunCPUProfiler.cpp
  • src/jsc/bindings/BunClientData.cpp
  • src/jsc/bindings/BunClientData.h
  • src/jsc/bindings/BunCommonStrings.cpp
  • src/jsc/bindings/BunDebugger.cpp
  • src/jsc/bindings/BunException.cpp
  • src/jsc/bindings/BunGeneratedCode.cpp
  • src/jsc/bindings/BunGlobalObject.cpp
  • src/jsc/bindings/BunGlobalObject.h
  • src/jsc/bindings/BunGlobalObject.lut.txt
  • src/jsc/bindings/BunGlobalScope.cpp
  • src/jsc/bindings/BunHttp2CommonStrings.cpp
  • src/jsc/bindings/BunLazyStaticFunctions-inlines.h
  • src/jsc/bindings/BunLazyStaticFunctions.h
  • src/jsc/bindings/BunMarkdownMeta.cpp
  • src/jsc/bindings/BunMarkdownMeta.h
  • src/jsc/bindings/BunMarkdownTagStrings.cpp
  • src/jsc/bindings/BunObject.cpp
  • src/jsc/bindings/BunPlugin.cpp
  • src/jsc/bindings/BunPlugin.h
  • src/jsc/bindings/BunProcess.cpp
  • src/jsc/bindings/BunProcess.h
  • src/jsc/bindings/BunProcessReportObjectWindows.cpp
  • src/jsc/bindings/BunSecureContextCache.cpp
  • src/jsc/bindings/BunSecureContextCache.h
  • src/jsc/bindings/BunSourceProvider.cpp
  • src/jsc/bindings/BunSourceProvider.h
  • src/jsc/bindings/BunString.cpp
  • src/jsc/bindings/BundlerMetafile.cpp
  • src/jsc/bindings/CallSite.cpp
  • src/jsc/bindings/CallSite.h
  • src/jsc/bindings/CallSitePrototype.cpp
  • src/jsc/bindings/CallSitePrototype.h
  • src/jsc/bindings/CodeCoverage.cpp
  • src/jsc/bindings/ConsoleObject.h
  • src/jsc/bindings/DOMWrapperWorld.cpp
  • src/jsc/bindings/DOMWrapperWorld.h
  • src/jsc/bindings/ErrorCode.cpp
  • src/jsc/bindings/ErrorCode.h
  • src/jsc/bindings/ErrorStackFrame.cpp
  • src/jsc/bindings/ErrorStackFrame.h
  • src/jsc/bindings/ErrorStackTrace.cpp
  • src/jsc/bindings/ErrorStackTrace.h
  • src/jsc/bindings/EventLoopTaskNoContext.h
  • src/jsc/bindings/ExposeNodeModuleGlobals.cpp
  • src/jsc/bindings/FormatStackTraceForJS.cpp
  • src/jsc/bindings/FormatStackTraceForJS.h
  • src/jsc/bindings/FuzzilliREPRL.cpp
  • src/jsc/bindings/HTMLEntryPoint.cpp
  • src/jsc/bindings/IPC.cpp
  • src/jsc/bindings/ImportMetaObject.cpp
  • src/jsc/bindings/ImportMetaObject.h
  • src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp
  • src/jsc/bindings/InspectorHTTPServerAgent.cpp
  • src/jsc/bindings/InspectorLifecycleAgent.cpp
  • src/jsc/bindings/InspectorLifecycleAgent.h
  • src/jsc/bindings/InspectorTestReporterAgent.cpp
  • src/jsc/bindings/InternalForTesting.cpp
  • src/jsc/bindings/InternalForTesting.h
  • src/jsc/bindings/InternalModuleRegistry.cpp
  • src/jsc/bindings/IsolatedModuleCache.cpp
  • src/jsc/bindings/IsolatedModuleCache.h
  • src/jsc/bindings/JS2Native.cpp
  • src/jsc/bindings/JSBakeResponse.cpp
  • src/jsc/bindings/JSBakeResponse.h
  • src/jsc/bindings/JSBuffer.cpp
  • src/jsc/bindings/JSBufferList.cpp
  • src/jsc/bindings/JSBufferList.h
  • src/jsc/bindings/JSBunRequest.cpp
  • src/jsc/bindings/JSBunRequest.h
  • src/jsc/bindings/JSBundlerPlugin.cpp
  • src/jsc/bindings/JSBundlerPlugin.h
  • src/jsc/bindings/JSCTestingHelpers.cpp
  • src/jsc/bindings/JSCTestingHelpers.h
  • src/jsc/bindings/JSCommonJSExtensions.cpp
  • src/jsc/bindings/JSCommonJSModule.cpp
  • src/jsc/bindings/JSCommonJSModule.h
  • src/jsc/bindings/JSDOMExceptionHandling.cpp
  • src/jsc/bindings/JSDOMFile.cpp
  • src/jsc/bindings/JSDOMGlobalObject.cpp
  • src/jsc/bindings/JSDOMGlobalObject.h
  • src/jsc/bindings/JSDOMWrapper.h
  • src/jsc/bindings/JSDOMWrapperCache.cpp
  • src/jsc/bindings/JSEnvironmentVariableMap.cpp
  • src/jsc/bindings/JSEnvironmentVariableMap.h
  • src/jsc/bindings/JSFFIFunction.cpp
  • src/jsc/bindings/JSFFIFunction.h
  • src/jsc/bindings/JSMockFunction.cpp
  • src/jsc/bindings/JSMockFunction.h
  • src/jsc/bindings/JSNodePerformanceHooksHistogram.cpp
  • src/jsc/bindings/JSNodePerformanceHooksHistogramConstructor.cpp
  • src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.h
  • src/jsc/bindings/JSPropertyIterator.cpp
  • src/jsc/bindings/JSReactElement.cpp
  • src/jsc/bindings/JSReactElement.h
  • src/jsc/bindings/JSS3File.cpp
  • src/jsc/bindings/JSS3File.h
  • src/jsc/bindings/JSSecrets.cpp
  • src/jsc/bindings/JSSocketAddressDTO.cpp
  • src/jsc/bindings/JSSocketAddressDTO.h
  • src/jsc/bindings/JSStringDecoder.cpp
  • src/jsc/bindings/JSWrappingFunction.cpp
  • src/jsc/bindings/JSWrappingFunction.h
  • src/jsc/bindings/JSX509Certificate.cpp
  • src/jsc/bindings/JSX509Certificate.h
  • src/jsc/bindings/JSX509CertificateConstructor.cpp
  • src/jsc/bindings/JSX509CertificateConstructor.h
  • src/jsc/bindings/JSX509CertificatePrototype.cpp
  • src/jsc/bindings/ModuleLoader.cpp
  • src/jsc/bindings/ModuleLoader.h
  • src/jsc/bindings/NapiClass.cpp
  • src/jsc/bindings/NapiRef.cpp
  • src/jsc/bindings/NapiWeakValue.cpp
  • src/jsc/bindings/NativePromiseContext.cpp
  • src/jsc/bindings/NodeAsyncHooks.cpp
  • src/jsc/bindings/NodeAsyncHooks.h
  • src/jsc/bindings/NodeDirent.cpp
  • src/jsc/bindings/NodeFSStatBinding.cpp
  • src/jsc/bindings/NodeFSStatFSBinding.cpp
  • src/jsc/bindings/NodeFetch.cpp
  • src/jsc/bindings/NodeFetch.h
  • src/jsc/bindings/NodeHTTP.cpp
  • src/jsc/bindings/NodeHTTP.h
  • src/jsc/bindings/NodeTLS.cpp
  • src/jsc/bindings/NodeTLS.h
  • src/jsc/bindings/NodeTimerObject.cpp
  • src/jsc/bindings/NodeURL.cpp
  • src/jsc/bindings/NodeURL.h
  • src/jsc/bindings/NodeVM.cpp
  • src/jsc/bindings/NodeVM.h
  • src/jsc/bindings/NodeValidator.cpp
  • src/jsc/bindings/NodeValidator.h
  • src/jsc/bindings/Path.cpp
  • src/jsc/bindings/Path.h
  • src/jsc/bindings/ProcessBindingFs.cpp
  • src/jsc/bindings/ProcessBindingHTTPParser.cpp
  • src/jsc/bindings/ProcessBindingTTYWrap.cpp
  • src/jsc/bindings/ProcessBindingTTYWrap.h
  • src/jsc/bindings/ProcessBindingUV.cpp
  • src/jsc/bindings/SQLClient.cpp
  • src/jsc/bindings/ScriptExecutionContext.cpp
  • src/jsc/bindings/ServerRouteList.cpp
  • src/jsc/bindings/ServerRouteList.h
  • src/jsc/bindings/ShellBindings.cpp
  • src/jsc/bindings/StrongRef.cpp
  • src/jsc/bindings/URLSearchParams.cpp
  • src/jsc/bindings/Undici.cpp
  • src/jsc/bindings/Undici.h
  • src/jsc/bindings/UtilInspect.cpp
  • src/jsc/bindings/bindings.cpp
  • src/jsc/bindings/headers-cpp.h
  • src/jsc/bindings/headers-handwritten.h
  • src/jsc/bindings/headers.h
  • src/jsc/bindings/helpers.h
  • src/jsc/bindings/napi.cpp
  • src/jsc/bindings/napi.h
  • src/jsc/bindings/napi_external.h
  • src/jsc/bindings/napi_handle_scope.cpp
  • src/jsc/bindings/napi_handle_scope.h
  • src/jsc/bindings/napi_type_tag.cpp
  • src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp
  • src/jsc/bindings/node/JSNodeHTTPServerSocket.h
  • src/jsc/bindings/node/JSNodeHTTPServerSocketPrototype.cpp
  • src/jsc/bindings/node/crypto/CryptoUtil.cpp
  • src/jsc/bindings/node/crypto/CryptoUtil.h
  • src/jsc/bindings/node/crypto/JSCipher.cpp
  • src/jsc/bindings/node/crypto/JSDiffieHellman.cpp
  • src/jsc/bindings/node/crypto/JSDiffieHellmanGroup.cpp
  • src/jsc/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp
  • src/jsc/bindings/node/crypto/JSECDH.cpp
  • src/jsc/bindings/node/crypto/JSKeyObject.cpp
  • src/jsc/bindings/node/crypto/JSKeyObjectConstructor.cpp
  • src/jsc/bindings/node/crypto/JSPrivateKeyObject.cpp
  • src/jsc/bindings/node/crypto/JSPublicKeyObject.cpp
  • src/jsc/bindings/node/crypto/JSSecretKeyObject.cpp
  • src/jsc/bindings/node/crypto/JSSign.cpp
  • src/jsc/bindings/node/crypto/JSVerify.cpp
  • src/jsc/bindings/node/crypto/KeyObject.cpp
  • src/jsc/bindings/node/crypto/node_crypto_binding.cpp
  • src/jsc/bindings/node/crypto/node_crypto_binding.h
  • src/jsc/bindings/node/http/JSConnectionsListConstructor.cpp
  • src/jsc/bindings/node/http/JSHTTPParserConstructor.cpp
  • src/jsc/bindings/node/http/JSHTTPParserPrototype.cpp
  • src/jsc/bindings/node/http/NodeHTTPParser.cpp
  • src/jsc/bindings/objects.h
  • src/jsc/bindings/root-pch.h
  • src/jsc/bindings/sqlite/JSSQLStatement.cpp
  • src/jsc/bindings/sqlite/JSSQLStatement.h
  • src/jsc/bindings/v8/V8Array.cpp
  • src/jsc/bindings/v8/V8Context.h
  • src/jsc/bindings/v8/V8Function.cpp
  • src/jsc/bindings/v8/V8Isolate.cpp
  • src/jsc/bindings/v8/V8Isolate.h
  • src/jsc/bindings/v8/V8Object.cpp
  • src/jsc/bindings/v8/shim/FunctionTemplate.cpp
  • src/jsc/bindings/v8/shim/GlobalInternals.cpp
  • src/jsc/bindings/v8/shim/GlobalInternals.h
  • src/jsc/bindings/v8/v8.h
  • src/jsc/bindings/webcore/AbortController.h
  • src/jsc/bindings/webcore/AbortSignal.h
  • src/jsc/bindings/webcore/DOMIsoSubspaces.h
  • src/jsc/bindings/webcore/JSCallbackData.cpp
  • src/jsc/bindings/webcore/JSDOMConstructorBase.h
  • src/jsc/bindings/webcore/JSDOMConvertBase.h
  • src/jsc/bindings/webcore/JSDOMGlobalObjectInlines.h
  • src/jsc/bindings/webcore/JSErrorEvent.cpp
  • src/jsc/bindings/webcore/JSEventEmitter.cpp
  • src/jsc/bindings/webcore/JSEventEmitterCustom.cpp
  • src/jsc/bindings/webcore/JSEventListener.cpp
  • src/jsc/bindings/webcore/JSEventTargetCustom.cpp
  • src/jsc/bindings/webcore/JSMIMEBindings.cpp
  • src/jsc/bindings/webcore/JSMIMEBindings.h
  • src/jsc/bindings/webcore/JSMIMEParams.cpp
  • src/jsc/bindings/webcore/JSMIMEParams.h
  • src/jsc/bindings/webcore/JSMIMEType.cpp
  • src/jsc/bindings/webcore/JSPerformance.cpp
  • src/jsc/bindings/webcore/JSPerformanceObserverCallback.cpp
  • src/jsc/bindings/webcore/JSReadableStream.cpp
  • src/jsc/bindings/webcore/JSWebSocket.cpp
  • src/jsc/bindings/webcore/JSWebSocket.h
  • src/jsc/bindings/webcore/MessagePort.cpp
  • src/jsc/bindings/webcore/PerformanceMark.cpp
  • src/jsc/bindings/webcore/PerformanceObserver.cpp
  • src/jsc/bindings/webcore/ReadableStream.cpp
  • src/jsc/bindings/webcore/SerializedScriptValue.cpp
  • src/jsc/bindings/webcore/WebSocket.cpp
  • src/jsc/bindings/webcore/Worker.cpp
  • src/jsc/bindings/webcore/Worker.h
  • src/jsc/bindings/xxhash3.cpp
  • src/jsc/bindings/xxhash3_testing.cpp
  • src/jsc/headergen/sizegen.cpp
  • src/jsc/host_fn.rs
  • src/jsc/jsc.zig
  • src/jsc/lib.rs
  • src/jsc/modules/AbortControllerModuleModule.h
  • src/jsc/modules/BunAppModule.h
  • src/jsc/modules/BunJSCModule.h
  • src/jsc/modules/BunObjectModule.h
  • src/jsc/modules/BunTestModule.h
  • src/jsc/modules/NodeBufferModule.h
  • src/jsc/modules/NodeConstantsModule.h
  • src/jsc/modules/NodeModuleModule.cpp
  • src/jsc/modules/NodeModuleModule.h
  • src/jsc/modules/NodeProcessModule.h
  • src/jsc/modules/NodeStringDecoderModule.h
  • src/jsc/modules/NodeTTYModule.cpp
  • src/jsc/modules/NodeTTYModule.h
  • src/jsc/modules/NodeUtilTypesModule.cpp
  • src/jsc/modules/NodeUtilTypesModule.h

Comment thread src/codegen/generate-classes.ts
Comment thread src/codegen/generate-classes.ts
Comment thread src/jsc/bindings/BunException.cpp
Comment thread src/jsc/bindings/BunObject.cpp Outdated
Comment thread src/jsc/bindings/BunProcess.cpp
Comment thread src/jsc/bindings/JSBufferList.cpp Outdated
Comment thread src/jsc/bindings/SQLClient.cpp Outdated
Comment thread src/jsc/VirtualMachine.rs
@robobun
robobun force-pushed the farm/50d63c3b/rename-zigglobalobject branch from fd6338b to 50d99c9 Compare June 5, 2026 03:53
@robobun

robobun commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Final CI status for build 60623 (50d99c9): every build lane passed on all platforms, and the only failure is windows x64-baseline verify-baseline. That lane fails identically on main: build 60590 at 8553428 (the exact commit this branch is rebased on) has the same single failure out of 30 statuses. The step's Intel SDE download returns a 0-byte sde.tar.xz and 7-Zip exits 2 before any test runs, so it cannot be related to this rename diff.

A retrigger was already spent on the same infra failure earlier, so I will not push another. The diff is green and review threads are resolved; this is ready for a maintainer.

Comment thread src/jsc/bindings/BakeAdditionsToGlobalObject.cpp Outdated
@robobun

robobun commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Same story on build 60643 (af18345, the bare zig local rename): every build lane passed and the only failure is windows x64-baseline verify-baseline, the known Intel SDE infra issue (0-byte sde.tar.xz download, 7-Zip exit 2) that fails identically on main's build 60590 at 8553428. Not caused by this diff and a retrigger was already spent on it earlier.

All review threads are resolved and the diff is green; ready for a maintainer.

@robobun

robobun commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Final tally for build 60643 (af18345) now that the test lanes finished. Every failure is pre-existing or infra, none touch this rename:

  • test/cli/install/bunx.test.ts on 12 lanes: the external @angular/cli@22.0.0 engines issue documented above (engines.node ^22.22.3 || ^24.15.0 || >=26.0.0 vs Bun's reported v24.3.0). Verified earlier to reproduce identically with the pre-rename release binary (USE_SYSTEM_BUN=1); it will hit every branch including main on its next build.
  • test/js/web/streams/streams-leak.test.ts on exactly 1 of ~20 lanes (Debian 13 x64-baseline): an RSS-threshold assertion (250 MB / 1.5x baseline); passed on every other lane including ASAN, and passed on all lanes in this PR's previous full run (build 60500). Runner memory-pressure flake.
  • windows x64-baseline verify-baseline: the known Intel SDE 0-byte download infra failure, identical on main (build 60590 at 8553428).
  • 3 darwin test lanes Expired: Buildkite agent availability, no tests ran.

All build lanes green on every platform, review threads resolved, retrigger already spent. The diff itself is green; ready for a maintainer.

robobun and others added 6 commits June 10, 2026 00:07
The class dates to when Bun's runtime was written in Zig and the "Zig"
prefix meant "the global object that bridges to Zig code". The runtime
has since been ported, the prefix is misleading, and the header carried
a TODO asking for this rename since 2023.

- Zig::GlobalObject and Zig::EvalGlobalObject move to namespace Bun
- ZigGlobalObject.{h,cpp,lut.txt} become BunGlobalObject.{h,cpp,lut.txt}
- extern "C" symbols Zig__GlobalObject__* become Bun__GlobalObject__*,
  ZigGlobalObject__* become BunGlobalObject__*, and
  Bun__ZigGlobalObject__uvLoop becomes Bun__GlobalObject__uvLoop
- codegen templates, build scripts, leak suppressions and docs updated

No behavior change.
The constructor static_cast the lexical global to Bun::GlobalObject,
which is wrong when invoked from a non-Bun global such as a node:vm
context. Use defaultGlobalObject() so those callers fall back to the
main global's CommonJSModule structure instead of reading through a
bogus pointer.
…xed binding files

Continues the rename started with ZigGlobalObject:

- namespace Zig is gone; all members (SourceProvider, JSFFIFunction,
  CallSite, ImportMetaObject, JSCStackTrace, string helpers, ...) now
  live in namespace Bun
- ZigSourceProvider.{h,cpp}, ZigException.cpp, ZigGeneratedCode.cpp and
  ZigLazyStaticFunctions{,-inlines}.h are renamed to Bun*
- the C ABI exception types (ZigException, ZigStackTrace, ZigStackFrame,
  ZigStackFramePosition, ZigStackFrameCode, ZigErrorType, ZigErrorCode)
  are renamed to Bun* on both the C++ and Rust sides, along with their
  Rust source files and modules
- CommonStringsForZig -> CommonStringsForBun, Zig_ErrorCode* ->
  Bun_ErrorCode*, zig__ModuleInfo* and zig__renderDiff -> bun__*

ZigString/ZigStringSlice, ZIG_EXPORT/ZIG_DECL and the crate-internal
zig_* names are left for the larger sweep in #30747.
CLAUDE.md gained another ZigGlobalObject mention upstream between the
two rename passes; update it. Also restore the "ported from" and inline
comment references in the renamed Rust exception files to point at the
Zig*.zig reference files, which keep their original names until they
are deleted.
Restore the two quoted zig_exception enum spellings in VirtualMachine.rs
doc comments, correct the closing-brace comments on WebCore namespace
blocks in JSBufferList.cpp and JSStringDecoder.cpp, and drop the
self-referential using namespace Bun directives in ModuleLoader.cpp and
KeyObject.cpp that the namespace merge made no-ops.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No remaining issues from my side — every thread I opened over the review cycle is resolved and the latest merge sweep looks clean. That said, this is a 300-file rename across the core JSC bindings layer (global object, C ABI symbols, namespace merge) with a handful of non-mechanical adjustments, so it warrants a maintainer pass before merge.

Extended reasoning...

Overview

This PR mechanically renames the Zig-prefixed surface of the JSC bindings layer to Bun equivalents: Zig::GlobalObjectBun::GlobalObject, ZigGlobalObject.{h,cpp,lut.txt}BunGlobalObject.*, namespace Zig merged into namespace Bun, and the ZigException/ZigStackFrame/ZigStackTrace/ZigSourceProvider family renamed on both the C++ and Rust sides — including the corresponding extern "C" symbol names, codegen templates, build scripts, and docs. It touches 300 files spanning src/jsc/bindings/, src/jsc/*.rs, src/codegen/, the v8 shim, webcore, napi, and node module bindings.

The PR description enumerates a small set of non-mechanical adjustments needed to make the namespace merge link cleanly: unsafeEvalNoop made static to avoid a duplicate symbol, one JSC::Exception qualification in napi.cpp, the Module constructor in NodeModuleModule.cpp switched to defaultGlobalObject(), removal of a long-dead commented block in BunGlobalObject.cpp, and ~20 forward-decl blocks moved between namespaces.

Security risks

None identified. This is a pure identifier/namespace rename. No auth, crypto, permission, or input-validation logic is altered; the crypto and TLS files in the diff only change #include paths and Zig::GlobalObject*Bun::GlobalObject* type spellings. The C ABI symbol renames are matched on both sides, and the binary-size annotation reports +0.0 KB on every target across multiple builds, which is the expected signature of a no-behavior-change refactor.

Level of scrutiny

This needs human review despite being mechanical. It rewrites the most load-bearing files in the runtime (the global object, module loader, exception path, source provider, and every generated-class/sink template), merges two C++ namespaces, and renames extern "C" symbols that the Rust side links against by exact name. A subtle mismatch — a missed rename on one side of the ABI, an ODR violation from the namespace merge, or an over-eager replace inside a string literal — would be easy to miss in a 300-file diff and could surface only at runtime on a less-exercised path. The author has done a thorough job (repeated git grep verifications, full debug/ASAN builds, targeted smoke tests after each main merge), and CI is green modulo unrelated infra flakes, but the blast radius justifies a maintainer skim of at least the non-mechanical bits and the codegen template changes.

Other factors

Over the PR's ~25-day lifetime I left roughly fifteen inline findings (stale doc references, over-eager comment rewrites, mismatched namespace closers, redundant adjacent namespace Bun blocks, leftover zig/zigGlobal locals, dead .gitattributes entry, and merge-reintroduced Zig:: references). Every one was addressed and resolved by the author, who also proactively swept for the same class beyond the specific sites I named. The current bug-hunting pass on 3ab5bda found nothing new. CodeRabbit's substantive concerns were either addressed or correctly identified as pre-existing behavior out of scope for a rename. The PR overlaps with #30747 (the full-codebase superset rename) by design and intentionally leaves ZigString, ZIG_EXPORT, and ZigGeneratedClasses for that follow-up.

@robobun

robobun commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

All 24 review threads from the automated passes are resolved, and there is nothing further outstanding on this side either. Summarizing the current state for whoever picks this up:

  • The head is 3ab5bda5db, merged with main as of f789198 and conflict-free; each main merge along the way is summarized in its own comment above.
  • At HEAD, git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" is empty across the whole repo. The ZigString family, ZIG_EXPORT, and ZigGeneratedClasses are intentionally left for the superset rename in Rename Zig-prefixed identifiers to Bun/Rust equivalents #30747.
  • Build 66368, the last run before the latest main merge, finished fully green: 286 passed, 1 skipped, 0 failed out of 287 jobs, with no infrastructure red at all. Build 66620, on the current head, finished with 282 passed and 4 failed; all four are analyzed in the failure breakdown below, and none of them comes from this branch (two are a fleet-wide failure on current main, one is a Windows-aarch64 crash on a platform that only this PR's CI exercises, and one is a Docker image-platform mismatch on an ARM Mac agent).
  • The binary-size annotation is green (inside the 0.50 MB guard) on every build, and on the fully-green build 66368 every non-Windows target was exactly +0.0 KB. Individual rows jitter by a few tens of KB in either direction from build to build against the moving main canary (66620 read +16 KB on three targets, 67336 reads -10 to -20 KB on a different set). The same source cannot deterministically be +0.0 KB on one build, +16 KB on the next, and -20 KB on the one after, so that is link-time alignment noise between independent builds, not a code-size change.

The handful of places where the rename required a judgment call rather than a substitution are called out individually in the description; those are the parts most worth a human look. Ready for a maintainer pass.

@robobun

robobun commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Build 66620 has finished: 282 passed, 1 skipped, 4 failed out of 287. None of the four failed lanes comes from this branch; each is below. For context, the previous build of this branch (66368, head 1e988b9) was fully green at 286 of 287 with zero failures, and the only difference between the two heads is the 24 main commits brought in by the latest merge plus two one-token type renames (Bun::NapiPrototype in SerializedScriptValue.cpp, Bun::GlobalObject in the new ReadableStream__errored in bindings.cpp).

1 and 2. test/js/node/test/parallel/test-net-connect-memleak.js on alpine 3.23 x64 and alpine 3.23 x64-baseline.

AssertionError: Expected values to be strictly equal: false !== true
  at test-net-connect-memleak.js:54  (assert.strictEqual(collected, true))

This is an active, branch-independent failure across the whole CI fleet: scanning the 59 most recent Buildkite builds, this exact test is failing on 20 of them, on at least ten different unrelated branches (dgram, buffer, console.table, HTMLRewriter, cookies, fs, and so on), all freshly synced with main. Within this build it passed on every Debian, Ubuntu, and alpine-aarch64 lane and failed only on the two alpine x64 (musl) lanes. Whatever is behind it (a listener-retention regression on main, or a GC-sensitive test that has gone hot), it is a property of current main and is hitting everybody.

3. test/js/node/test/parallel/test-debugger-invalid-json.mjs segfaults on windows 11 aarch64.

panic(thread 4692): Segmentation fault at address 0x16900000012
Bun Canary v1.4.0-canary.1 (3ab5bda5d) Windows arm64 / Windows v10.26100
Elapsed: 90ms
https://bun.report/1.4.0/W_23ab5bdagGikgoCg4rstBgwjg/CwhjhDCSntdll.dll4h8CCSntdll.dll4s1RCSntdll.dllokt5CoojzvCwjizvC4opxvCw/4vhCwvx4/Bgk13hCw4o79Bo+mu0Bwjks+CCYKERNEL32.DLLg0jCCSntdll.dllogs1BA2yWkB

One crash, in one test, in one of the eight Windows-aarch64 shards; the other seven passed on this build, and all eight passed on the previous build. The test is old (#15565) and has never failed on any of the 59 recent builds I scanned. None of main's last 10 builds contain any windows 11 aarch64 - test-bun jobs, so this PR's CI appears to be the only place these 24 commits have ever been test-run on Windows aarch64. The natural suspects among the 24 are the ones touching socket and teardown paths: #33006, #32991, #32986, #32921, and the string and buffer changes in #33014, #33019, and #32837. I cannot narrow it further: there is no Windows aarch64 environment available to me, and the test passes on every other platform in this build.

4. test/js/web/websocket/autobahn.test.ts on darwin 14 aarch64. Pure CI infrastructure, and self-describing:

Failed to start service autobahn:
  The requested image's platform (linux/amd64) does not match the detected
  host platform (linux/arm64/v8) and no specific platform was requested

The Autobahn WebSocket conformance suite runs in a Docker container whose image is amd64-only, and this shard landed on an ARM Mac agent that cannot run it, so the service coordinator in test/docker/index.ts aborted before the test started. (This was also the shard that lost its Buildkite agent twice and only ran on its third attempt.) Nothing to do with this PR.

Nothing on this branch needs to change for any of these. The same failures will appear on main, or on any branch that syncs with it, whenever main's CI exercises the same lanes. I will keep the branch merged with main, and once main is green again this PR will be too.

alii pushed a commit that referenced this pull request Jun 29, 2026
Fixes #31233

### What does this PR do?

#32621 removed the Zig sources; the Rust port is the only
implementation. The README, the docs site, and a couple of published
packages still describe Bun as written in Zig (#31233 reports the README
one). This updates them. Nothing in this PR reaches the compiler: it is
markdown, mdx, JSDoc, editor config, and a build-script comment.

**User-facing**

- `README.md`, `docs/index.mdx`, `packages/bun-vscode/README.md`: "It's
written in Zig and powered by JavaScriptCore" now says Rust.
- `docs/runtime/index.mdx`, `docs/bundler/esbuild.mdx`,
`docs/runtime/{shell,redis,json5,yaml,markdown}.mdx`: "written in Zig"
and "Zig-based" claims, each checked against the actual implementation
(`src/runtime/shell/`, `src/runtime/valkey_jsc/`,
`src/parsers/{json5,yaml}.rs`, `src/md/`).
- `docs/bundler/css.mdx`: the CSS bundler was described as "a direct
Rust → Zig port of LightningCSS", now "a direct port of LightningCSS".
- `docs/bundler/html-static.mdx`: "58,000 lines of Zig" becomes "70,000
lines of Rust" (`src/css/**/*.rs` is 71.7k lines today).
- `docs/runtime/utils.mdx`: the `Bun.stringWidth` SIMD implementation
lives in `src/jsc/bindings/stringWidth.cpp`, so this one says "native
code" rather than claiming Rust.
- `docs/runtime/ffi.mdx`: the C++ example was compiled with `zig
build-lib add.cpp`; it now shows `clang++` for Linux and macOS. The Zig
FFI example itself stays, since calling a Zig shared library through
`bun:ffi` is unrelated to Bun's implementation language.
- `packages/bun-types/bun.d.ts`: the `Bun.password` JSDoc credited the
Zig standard library. The implementation routes to the `rust-argon2` and
`bcrypt` crates (`src/runtime/crypto/pwhash.rs`), so it now says that.
- `LICENSE.md` and `docs/project/license.mdx` still told people to
relink WebKit with `git submodule update`, `make jsc`, and `zig build`,
none of which exist anymore. The steps now match
`docs/project/contributing.mdx`: clone the WebKit fork into
`vendor/WebKit`, check out `WEBKIT_VERSION`, run `bun run build:local`.
The esbuild credit is now "a port of esbuild".

**Developer-facing**

- `.vscode/tasks.json`: the "Build Bun" task had a zig-owner
problemMatcher for `file:line:col: error:` output. There is no Zig
compiler in the build, and the clang matcher next to it handles the same
single-line format, so the dead matcher is removed.
- `misctools/lldb/README.md`, `scripts/build/deps/nodejs-headers.ts`,
`test/js/web/fetch/H2_TEST_PORT_PLAN.md`: internal docs that described
`ZigString` as "the Zig string type", a Zig build flag that no longer
exists, and a deleted `.zig` path.

**Intentionally not changed**

- Identifiers that still exist in the code (`Zig::GlobalObject`,
`ZigString`, `$ZigGeneratedClasses`, `zig_mutex_t`). #31822 is the
rename pass for those.
- Comments inside compiled sources (the `src/codegen/*.ts` "written in
Zig" docblocks, the `packages/bun-usockets` header, a few `src/js`
notes). Those are code changes, not docs, and they fit better with the
identifier rename than with this prose pass.
- The `bun:ffi` docs listing Zig among the C ABI languages, and the Zig
FFI example.
- Comments that are deliberately historical: Cargo.toml rationale notes,
`bench/snippets/escapeHTML.mjs`, tests that explain a Zig-era bug.
- External links into other projects' `.zig` files, such as the
Tigerbeetle row in the license table.
- `process.versions.zig` is still exposed at runtime with a pinned
historical hash (`BunProcess.cpp` and
`scripts/build/depVersionsHeader.ts`). Removing a `process.versions` key
is a behavior change, not a docs fix, so it is left for a separate
decision.

### How did you verify your code works?

- This PR changes prose only; no compiled source is touched, so there is
no runtime behavior to regression-test.
- Every "written in Rust" claim was checked against the implementation
it describes before editing (paths above).
- `bun test test/integration/bun-types/bun-types.test.ts` passes with
the `bun.d.ts` edit.
- The docs preview deployment renders the changed pages.
…zigglobalobject

# Conflicts:
#	src/jsc/bindings/bindings.cpp
@robobun

robobun commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (86438b9, 31 main commits since the previous sync at f789198).

One content conflict, in src/jsc/bindings/bindings.cpp, inside WebCore__FetchHeaders__put. #33126 ("Response.redirect: parse and serialize the url into the Location header") replaced the Zig::toStringCopy(*arg2) call, the very call this branch had renamed, with arg2->toWTFString() (a refcount of the existing WTFStringImpl instead of a copy). Main's version no longer references the renamed name at all, so the resolution is main's side verbatim; nothing from the rename was left to preserve on that line.

The post-merge sweep caught one reintroduction that auto-merged without a textual conflict, for the third main merge in a row, and a new shape this time. #32966 ("node:fs: validate open() flag and mode strings like Node") added a new file-scope extern "C" helper to ErrorCode.cpp, Bun__ErrorCode__inspectForErrorMessage, whose exception path returns Zig::BunStringEmpty. That constant lives in namespace Bun on this branch (every other caller, and the codegen in bindgen-lib-internal.ts, already spells it Bun::BunStringEmpty), so the line would not have compiled; it is now Bun::BunStringEmpty. The sweep and the final check both ran against the committed tree (HEAD), and after the fix git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" is still empty across the repo, with git grep "Zig::" still matching only the pre-existing, out-of-scope CryptoHasherZig.

Verification: the full debug build passes, and bun bd test on test/js/web/fetch/headers.test.ts, test/js/web/fetch/fetch_headers.test.js, test/js/web/fetch/response.test.ts (the three files #33126 extended, which exercise the resolved FetchHeaders::put), test/js/node/fs/fs.test.ts (which #32966 extended, exercising the renamed helper), and test/js/bun/util/reportError.test.ts gives 472 of 482 passing. The four that did not pass are all readdir({recursive: true}) x 100 stress tests inside fs.test.ts: three of them time out against the 10 second per-test budget under the local debug ASAN build (they took 29 to 298 seconds there, and none of the 31 merged commits touches any source mentioning readdir, so a regression in them is not possible from this merge), and the fourth fails only as a cascade from the timed-out sibling that runs immediately before it and passes in isolation. All four are green on CI's release binaries.

On the two open CI failures from the previous build: none of the 31 new main commits touches node:net, the uSockets connect path, or test-net-connect-memleak.js, so the fleet-wide test-net-connect-memleak failure documented in the comment above is still on main and will still be red on the next build, and the Windows aarch64 debugger crash is likewise unaddressed upstream. Both remain independent of this branch.

@robobun

robobun commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Build 67336 (86438b9, the latest main merge) has finished: 282 passed, 1 skipped, 4 failed out of 287. None of the four comes from this branch. Good news first.

The Windows aarch64 test-debugger-invalid-json.mjs segfault from build 66620 did not reproduce: every windows 11 aarch64 - test-bun shard passed on this build. So that was a one-shot race, or something one of the 31 newly merged main commits happened to resolve; either way it is not a persistent crash and is no longer a concern.

The four failures:

  1. :darwin: 26 aarch64 - test-bun never ran a test. Agent darwin-aarch64-26.5.1-1 hit buildkite-agent artifact download timed out after 120s (exit 1, zero test output, no test annotation). This is the third build of this PR to land on that specific agent and fail in exactly that way (also builds 64340 and 64953); the sibling shard on a healthy agent passed.
  2. test/js/bun/terminal/terminal.test.ts on darwin 14 x64. One PTY test, Bun.spawn with terminal option > creates subprocess with terminal attached, hung for its full 90 second timeout; the other 88 tests in the file passed. The same test also failed on an unrelated branch's build (#67324) within the last 60 CI runs, and it passed on both of this branch's previous builds, so it is an intermittent hang rather than anything a logic-free rename could cause.
  3. and 4. test/js/node/test/parallel/test-net-connect-memleak.js on both alpine x64 lanes: the fleet-wide failure already documented two comments up (failing on 20 of the 59 recent builds I scanned, across more than ten unrelated branches). As the merge comment above predicted, none of the 31 new main commits touched node:net or the uSockets connect path, so it is still present. It remains main's to fix.

The binary-size annotation is green (all targets within the 0.50 MB guard), with the usual build-to-build jitter of a few tens of KB in either direction against the moving main canary.

Nothing on this branch needs to change and there is nothing left for me to push. Across the last three builds, every red lane has been CI infrastructure, a fleet-wide failure on main, or an intermittent test that also fails on other branches, while this branch's own content has held at 282 to 286 of 287 green throughout. Ready whenever a maintainer is; the remaining red belongs to main.

…zigglobalobject

# Conflicts:
#	src/codegen/generate-jssink.ts
#	src/jsc/bindings/BunException.cpp
#	src/jsc/bindings/BunGlobalObject.cpp
#	src/jsc/bindings/BunGlobalObject.lut.txt
#	src/jsc/bindings/JSMockFunction.cpp
#	src/jsc/bindings/bindings.cpp
#	src/jsc/bindings/webcore/JSReadableStream.cpp
#	src/jsc/bindings/webcore/ReadableStream.cpp
@robobun

robobun commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (d8386c3, 88 main commits since the previous sync at a50f1f3). This is the largest sync so far, because main landed #33193, the rewrite of ReadableStream, WritableStream, and TransformStream in C++. That rewrite deleted much of the stream bridge code this branch had renamed and added a whole new src/jsc/bindings/webcore/streams/ directory written under the old Zig names, so almost all of the work below is applying the rename to that new directory.

Conflicts (8). Five were main deleting code that this branch had only renamed, so the resolution is main's deletion with nothing of the rename left to preserve:

Three were real content changes on a line this branch had renamed:

Post-merge sweep reintroductions. All from #33193's new src/jsc/bindings/webcore/streams/ directory (plus three stray lines from #33374, #31824, and #33193 in JSMockFunction.cpp, ExposeNodeModuleGlobals.cpp, and BunGlobalObject.cpp respectively), and all renamed in the same commit:

  • 22 #include "ZigGlobalObject.h" across the new .cpp files, retargeted to BunGlobalObject.h.
  • Zig::GlobalObject* parameters and casts in JSStreamsRuntime.{h,cpp}, WebStreamsExports.cpp, WebStreamsInternals.h, and StreamsForward.h.
  • The namespace Zig { class GlobalObject; } forward declaration in StreamsForward.h, moved to namespace Bun.
  • The zigGlobalObject locals in four of the new .cpp files, renamed to bunGlobalObject per this branch's convention.
  • The seven ZigGlobalObject__* extern "C" symbols in WebStreamsExports.cpp and WebStreamsInternals.h (createNativeReadableStream and the six readableStreamTo*), renamed to BunGlobalObject__*. On this branch the Rust side (JSGlobalObject.rs, ReadableStream.rs) and BunGlobalObject.h already declare them under the Bun names, so leaving the definitions at Zig would have been a link error.
  • ZigGlobalObject mentions inside comments in JSStreamsRuntime.h and StreamsForward.h.

After all of it, git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" is still empty across the whole repo, and git grep "Zig::" still matches only the pre-existing, out-of-scope CryptoHasherZig. Both checks were run against the committed tree (HEAD).

Verification. The full debug build passes. bun bd test across test/js/web/streams/streams.test.js, test/js/bun/util/readablestreamtoarraybuffer.test.ts, test/js/bun/test/mock-fn.test.js, and test/js/bun/util/reportError.test.ts gives 214 of 216 passing. The two that did not are both in streams.test.js and both time out against the 5 second per-test budget under the local debug ASAN build (Bun.file().stream() read text from large file at 8.7 s and handles exceptions during empty stream creation at 9.8 s, a stack-exhaustion stress test that calls Blob().stream() at every recursion level); both pass in isolation with a longer timeout, so the stream implementation is correct and they are green on CI's release binaries.

On the open CI failures from the previous build: none of the 88 new main commits touched src/js/node/net.ts, the uSockets connect path, or test-net-connect-memleak.js, so the fleet-wide test-net-connect-memleak failure is still on main. The Windows aarch64 debugger segfault did not reproduce on the previous build of this branch and is closed.

@robobun

robobun commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Build 69899 (a552c6b, the 88-commit main merge plus autofix-ci's blank-line cleanup) has finished: 285 passed, 1 skipped, 1 failed out of 287. Zero test failures have been recorded on this build; there is no error-level annotation at all.

The one failed job is the chronically broken agent darwin-aarch64-26.5.1-1, hitting buildkite-agent artifact download timed out after 120s (exit 1, zero test output, no test annotation) for the fourth build of this PR in a row (also 64340, 64953, and 67336). The sibling darwin 26 aarch64 shard on a healthy agent passed. The four darwin-14 shards each needed several lost-agent retries but all ultimately passed.

This result validates the most consequential merge so far: the rename now covers #33193's new src/jsc/bindings/webcore/streams/ directory, including its seven extern "C" symbols whose Rust side was already on the renamed names. Every build lane links and every test lane is green, across all 40 alpine x64 and x64-baseline shards, all 8 Windows aarch64 shards, and the rest. Two things that were open on the previous builds are now closed here:

  • The fleet-wide test-net-connect-memleak.js failure that hit builds 66620 and 67336 (and dozens of unrelated branches) no longer reproduces: all 40 alpine x64 shards passed. Something among the 88 main commits resolved it.
  • The Windows aarch64 test-debugger-invalid-json.mjs segfault from build 66620 has not reproduced on either subsequent build.

The binary-size annotation is green: six rows read ±1 to 16 KB against the main #69776 canary and nine read +0.0 KB, the usual per-build alignment jitter.

Nothing on this branch needs to change. If a green check is wanted, retrying the one darwin-aarch64-26.5.1-1 shard (or more durably, quarantining that agent) is enough; no build of this branch has produced a failure attributable to the diff. Ready for a maintainer.

@robobun

robobun commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (e82f8fe, 36 main commits since the previous sync at 3f5d816). This one auto-merged with zero conflicts.

The post-merge sweep caught a single reintroduction, the smallest yet. #31859 ("socket: hold Bun.listen/Bun.connect callbacks in a GC-visited internal-fields cell") added a new file, src/jsc/bindings/JSSocketHandlers.cpp, whose includes list ZigGlobalObject.h. That header is BunGlobalObject.h on this branch. The file does not otherwise name Zig:: anything; retargeting the one include is the whole of it. After the fix, git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" is still empty across the repo and git grep "Zig::" still matches only the pre-existing CryptoHasherZig. Both checks were run against the committed tree (HEAD).

Verification: the full debug build passes. bun bd test on test/js/bun/net/socket.test.ts, test/js/bun/net/socket-dns-error.test.ts, and test/js/bun/util/reportError.test.ts gives 39 of 50 passing. The ones that did not are the nine socket.test.ts cases that Bun.connect to the test's own Bun.listen({ port: 0, hostname: "localhost" }) server, each failing with ECONNREFUSED. These are the known environmental failures in this container that the #33006 commit message documents as reproducing identically on unmodified main ("plain TCP ECONNREFUSED to the just-bound port"), and none of the 40 most recent CI builds across every branch has a socket.test.ts annotation, so they pass on CI. The only change this merge makes to JSSocketHandlers.cpp is the header path, which is a preprocessor-level no-op once the build succeeds.

@robobun

robobun commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Build 70843 (e82f8fe, the 36-commit clean merge) has finished: 283 passed, 1 skipped, 3 failed out of 287. None of the three comes from this branch, whose only change this merge is one #include path.

  1. test/js/sql/postgres-binary-array-bounds.test.ts on windows 2019 x64-baseline: ERR_POSTGRES_CONNECTION_REFUSED. The Postgres Docker container on the Windows agent was not reachable. This is an active, branch-independent CI infrastructure failure: it appears on 21 of the 39 most recent builds across many unrelated branches.

  2. test/regression/issue/26030.test.ts on alpine 3.23 x64-baseline: the mysql:8.4 Docker container never passed its healthcheck, so test/docker/index.ts aborted before any test ran (the same pattern documented on build 64961). Also an active, branch-independent infrastructure failure: 18 of the 39 most recent builds across many branches.

  3. test/integration/next-pages/test/dev-server.test.ts on darwin 14 aarch64: Puppeteer could not attach to the Chromium it downloaded (WebSocket connection to '.../devtools/browser/...' failed: Connection ended, retried three times). The Next.js dev server itself started cleanly under bun (Ready in 1311ms); the failure is the externally-launched browser process on the macOS agent, not bun's code. This shard also went through two lost-agent retries before running; the other darwin-14-aarch64 shard passed.

The rest of the build is green. In particular, socket.test.ts passed on every CI lane, which confirms that the nine local ECONNREFUSED failures noted in the merge comment above are environmental to the build container. All eight Windows aarch64 shards passed, and the agent darwin-aarch64-26.5.1-1 did not fail this build. Binary size is green: eleven targets at +0.0 KB, one at -16.0 KB, three Windows rows within ±1.5 KB of the main #70779 canary.

Nothing on this branch needs to change. Both database failures are currently hitting everyone who syncs with main, and the Puppeteer browser-launch failure is integration-test infra. Ready for a maintainer.

…zigglobalobject

# Conflicts:
#	src/jsc/bindings/webcore/streams/JSStreamsRuntime.cpp
@robobun

robobun commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (45916a9, 7 main commits since the previous sync at b05b4fa).

One content conflict, in src/jsc/bindings/webcore/streams/JSStreamsRuntime.cpp: #33830 ("Wire up HeapAnalyzer for Web Streams cell classes") added a #include "WebStreamsHeapAnalyzer.h" directly above the ZigGlobalObject.h include this branch had retargeted to BunGlobalObject.h. The resolution keeps both: main's new include and the renamed one.

The post-merge sweep caught one reintroduction from the same PR: its new file src/jsc/bindings/webcore/streams/WebStreamsInspectCustom.cpp includes ZigGlobalObject.h, which is BunGlobalObject.h on this branch. Retargeted. After the fix, git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" is still empty across the repo and git grep "Zig::" still matches only the pre-existing CryptoHasherZig. Both checks were run against the committed tree (HEAD).

Verification: the full debug build passes, and bun bd test on test/js/node/util/custom-inspect.test.js (which #33830 extended with the Web Streams [nodejs.util.inspect.custom] suite that exercises the retargeted WebStreamsInspectCustom.cpp) and test/js/bun/util/reportError.test.ts gives 44 pass, 0 fail.

@robobun

robobun commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Build 71003 (45916a9, the 7-commit merge) has finished: 284 passed, 1 skipped, 2 failed out of 287. Both failures are recurrences of the fleet-wide CI infrastructure issues documented on the previous build:

  1. test/napi/napi.test.ts on windows 2019 x64-baseline: an active, branch-independent failure hitting 23 of the 39 most recent builds across many unrelated branches.
  2. test/regression/issue/26030.test.ts on alpine 3.23 x64-baseline: the mysql:8.4 Docker container healthcheck timeout (test/docker/index.ts aborts before any test runs), 18 of 39 recent builds across many branches, same as on build 70843.

Every darwin and Windows-aarch64 shard passed, and the Postgres CONNECTION_REFUSED from the previous build did not recur. Binary size is green: eleven targets at +0.0 KB, one at -16.0 KB, three Windows rows within ±2.0 KB of the main #70986 canary.

Nothing on this branch needs to change; both red lanes are on everyone currently synced with main. Ready for a maintainer.

…zigglobalobject

# Conflicts:
#	src/jsc/lib.rs
@robobun

robobun commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (a6f714d, 5 main commits since the previous sync at fc865b3).

One content conflict, in src/jsc/lib.rs. #33731 ("jsc: delete javascript_core_c_api.rs and remove all JSC C API usage from Rust") removed the #[path = "javascript_core_c_api.rs"] pub mod c_api; declaration, which on this branch sits directly below the three bun_exception / bun_stack_frame / bun_stack_trace module declarations (the renames of zig_*, which sort alphabetically to that position). The resolution keeps the three bun_* declarations and drops c_api, matching main's deletion.

The post-merge sweep found zero reintroductions, the first time in this PR's history. After the merge, git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider" is still empty across the repo and git grep "Zig::" still matches only the pre-existing CryptoHasherZig. Both checks were run against the committed tree (HEAD).

Verification: the full debug build passes, and bun bd test on test/js/bun/util/reportError.test.ts (which exercises BunStackFrame.rs's NameFormatter, via the module declarations the conflict touched) and test/js/bun/util/readablestreamtoarraybuffer.test.ts (a streams smoke, since #33833 auto-merged changes into webcore/streams/) gives 4 pass, 0 fail.

@robobun

robobun commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Build 71253 (a6f714d, the 5-commit merge) has finished: 285 passed, 1 skipped, 1 failed out of 287.

The one failed job is darwin 14 x64 on test/js/bun/http/proxy-stress-concurrent.test.ts: the https-proxy → https-origin mode=redirect ×1200 stress probe had 1 of its 1200 requests fail (expected 0, received 1); the other 30 subtests in that file passed. This is a cross-branch intermittent (8 of the 39 most recent builds on many unrelated branches, and this branch's previous build was green on that shard). This branch's only change this merge is a module-declaration reordering in src/jsc/lib.rs, which is not reachable from the HTTP proxy path.

Everything else is green: every darwin-aarch64, Windows-aarch64, alpine, and x64-asan shard passed. The three fleet-wide CI failures from the previous two builds (napi.test.ts on Windows, postgres-binary-array-bounds.test.ts on Windows, and test/regression/issue/26030.test.ts on alpine) did not reproduce here. Binary size is green: twelve targets at +0.0 KB, one at -16.1 KB, two Windows rows within ±2.5 KB of the main #71241 canary.

Nothing on this branch needs to change. Ready for a maintainer.

…zigglobalobject

# Conflicts:
#	src/bun_bin/phase_c_exports.rs
#	src/jsc/ErrorCode.rs
#	src/jsc/Errorable.rs
#	src/jsc/VirtualMachine.rs
#	src/jsc/bindings/JSEnvironmentVariableMap.cpp
#	src/jsc/bindings/JSFFIFunction.cpp
#	src/jsc/bindings/headers-handwritten.h
#	src/jsc/bindings/napi.cpp
#	src/jsc/bindings/napi_handle_scope.cpp
#	src/jsc/bindings/webcore/Worker.cpp
#	src/jsc/lib.rs
#	src/runtime/bake/DevServerSourceProvider.h
#	src/runtime/ffi_imports.rs
@robobun

robobun commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (2a510e7, 118 main commits since the previous sync at 86caf6e). This is the largest conflict count so far, mostly from #31216 (the worker_threads / SHARE_ENV / MessagePort rollup) and the napi hardening work, both of which rewrote sizeable blocks this branch had renamed.

Conflicts (13). Two were modify/delete where this branch had only renamed comment text, so main's deletion is taken:

  • src/bun_bin/phase_c_exports.rs and src/runtime/ffi_imports.rs.

For the eleven content conflicts (ErrorCode.rs, Errorable.rs, VirtualMachine.rs, lib.rs, JSEnvironmentVariableMap.cpp, JSFFIFunction.cpp, headers-handwritten.h, napi.cpp with nine hunks, napi_handle_scope.cpp, Worker.cpp, DevServerSourceProvider.h), I verified that on every one this branch's side differed from the merge base by the mechanical rename only. So each was resolved by taking main's file verbatim and re-applying the rename (Zig:: to Bun::, ZigGlobalObject.h to BunGlobalObject.h, ZigException/ZigStackFrame*/ZigErrorType/ZigErrorCode to Bun*, Zig__GlobalObject__* to Bun__GlobalObject__*, and the Rust module-name equivalents). I then diffed each result against origin/main and confirmed the only differences are those token swaps.

Two of this branch's non-mechanical Stage 2 adjustments sit in files that were overwritten, so they were re-applied explicitly: the JSC::Exception qualification in napi.cpp (main's refactor added a fresh bare Exception that is ambiguous under using namespace Bun; after the namespace merge) and the } // namespace Bun closer in JSFFIFunction.cpp (the review fix from f0420a5; main still has the pre-existing wrong } // namespace JSC on that closer).

Post-merge sweep reintroductions, all from auto-merged files with new main code that did not conflict, and all renamed in the same commit: JSEnvironmentVariableMap.h (two Zig::GlobalObject* on the new SHARE_ENV store API), webcore/MessagePort.cpp (three Zig::GlobalObject sites in the new unref-warning path), webcore/JSStructuredSerializeOptions.cpp (the ZigGlobalObject.h include on a new file), and two comment mentions in src/js/internal/worker/messaging.ts and test/bake/dev/server-sourcemap.test.ts. After all of it, git grep -E "namespace Zig|ZigGlobalObject|ZigException|ZigStackFrame|ZigStackTrace|ZigSourceProvider|ZigErrorType|ZigErrorCode|Zig__GlobalObject|zig_exception|zig_stack_" is empty across the repo and git grep "Zig::" matches only the pre-existing CryptoHasherZig. Both checks were run against the committed tree (HEAD).

Verification. The full debug build passes. bun bd test across reportError.test.ts, ffi.test.js, worker_threads.test.ts, and custom-inspect.test.js gives 132 of 147 passing. The nine that did not are all tests in the new SHARE_ENV shares the spawning thread's env describe block from #31216, each of which spawns nested worker chains and times out against the 5 second per-test budget under the local debug ASAN build; running one in isolation it passes at 6.4 seconds. They are functionally correct and will be green on CI's release binaries.

Comment thread src/jsc/VirtualMachine.rs Outdated
The 2a510e7 merge overwrote VirtualMachine.rs with main's version and
re-applied the rename sed. Main's copy of this comment has the
pre-existing single-underscore typo ZigGlobalObject__create, so the sed
produced BunGlobalObject__create, regressing 50d99c9 which had
corrected the comment to name the actual Bun__GlobalObject__create
symbol (matching lines 105, 113, 1944, 2137, 2163, 3100 and the
definition in BunGlobalObject.cpp). This was the only such occurrence.
@robobun

robobun commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

Build 73209 (c6065fc, the 118-commit main merge plus autofix-ci's rustfmt and the review-fix commit) has finished: 283 passed, 1 skipped, 3 failed out of 287. None of the three comes from this branch.

  1. and 2. test/js/node/test/parallel/test-net-connect-memleak.js on alpine 3.23 x64 and alpine 3.23 x64-baseline: the recurring fleet-wide GC intermittent documented on builds 66620 and 67336, which had cleared on 69899 and is now back; it is currently hitting 10 of the 39 most recent builds across many unrelated branches.

  2. test/js/third_party/grpc-js/test-tonic.test.ts on darwin 14 aarch64: CI infrastructure, and self-describing. The test compiles and runs a Rust tonic server via cargo build, and the agent darwin-aarch64-15.1-1 has no default rustup toolchain:

error: rustup could not choose a version of cargo to run, because one wasn't
specified explicitly, and no default is configured.

so beforeAll never produced a server, the 150 s timeout fired, and afterAll's server.kill() hit undefined. Three other recent builds on unrelated branches show the same failure on that agent.

Every build lane passed, which validates the 118-commit merge on every platform (including the main-verbatim-plus-rename-sed resolution of napi.cpp, Worker.cpp, JSEnvironmentVariableMap.cpp, headers-handwritten.h, and lib.rs, and the re-applied JSC::Exception qualification and JSFFIFunction.cpp namespace closer). The SHARE_ENV worker-chain tests that timed out locally under debug ASAN are green on CI's release binaries. Binary size is green: nine targets at +0.0 KB, four read ±16 KB, two Windows rows within ±6.5 KB of the main #73198 canary.

Nothing on this branch needs to change. Ready for a maintainer.

@robobun

robobun commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch again (54db3c3, 16 main commits since the previous sync at aa327ab). This one auto-merged with zero conflicts, and the post-merge sweep found zero reintroductions; both the full pattern set and the BunGlobalObject__create symbol-family check (the class the previous review caught) come back clean against the committed tree.

Verification: the full debug build passes, and bun bd test on test/js/node/v8/capture-stack-trace.test.js (main touched FormatStackTraceForJS.cpp, the BunStackFrame formatting path) and test/js/bun/util/reportError.test.ts gives 45 pass, 0 fail.

@robobun

robobun commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

Build 73556 (54db3c3, the 16-commit clean merge) has finished: 266 passed, 1 skipped, 20 failed out of 287. That is the highest failed-lane count in this PR's history, and every one of them is main-side.

  • test/bundler/transpiler/transpiler.test.js on 16 lanes (every Linux, Windows, and macOS config): a var vs let output assertion mismatch from one of the recently landed js_parser changes. This is a fleet-wide break on main, currently hitting 13 of the last 39 builds across many unrelated branches. The merge from this branch is zero-conflict with zero reintroductions and touches nothing in src/js_parser/ or the bundler. The break is being handled separately.
  • test/js/node/test/parallel/test-net-connect-memleak.js on two of those 16 shards (alpine 3.23 x64 and x64-baseline): the recurring fleet-wide GC intermittent, 10 of 39 recent builds.
  • test/js/node/test/parallel/test-worker-message-port-transfer-terminate.js on one of those 16 shards (debian 13 x64-asan): a JSC exception-check assertion under ASAN (ASSERTION FAILED: !scope.exception() || !result in JSObject::getOwnPropertyDescriptor), 5 of 39 recent builds across unrelated branches. The 118-commit merge that touched Worker.cpp and MessagePort.cpp was validated on build 73209 (283 of 287) where this test did not fire. Also being handled separately.
  • One darwin 26 aarch64 shard exited -1 (agent lost before completing).

Binary size is green: nine targets at +0.0 KB, three at ±16 KB, three Windows rows within ±4 KB of the main #73555 canary.

Nothing on this branch needs to change. Main is currently broken (the transpiler failure alone takes out a test lane on every platform for every branch synced to it); once that is fixed on main, the next merge here should be green again.

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.

1 participant