Skip to content

Make the WebAssembly namespace object lazy - #321

Merged
Jarred-Sumner merged 1 commit into
mainfrom
farm/8141f6fe/lazy-webassembly-namespace
Jul 23, 2026
Merged

Jarred-Sumner merged 1 commit into
mainfrom
farm/8141f6fe/lazy-webassembly-namespace

Conversation

@robobun

@robobun robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

JSGlobalObject::init() was constructing the WebAssembly namespace object eagerly on every global, even though the four supporting structures immediately above it (m_webAssemblyModuleRecordStructure, m_webAssemblyFunctionStructure, m_webAssemblyWrapperFunctionStructure, m_webAssemblyJSTag) and every sub-constructor are already initLater. Because useJSPI defaults to true, this also force-initialized the Suspending and SuspendError LazyClassStructures (prototype + structure + constructor each) on every global that never touches wasm.

Change

  • Add WebAssembly to globalObjectTable as a PropertyCallback, matching Math / JSON / Reflect / Atomics.
  • Move the Suspending / SuspendError putDirectWithoutTransition calls into JSWebAssembly::finishCreation, next to the existing useJSPI-gated promising function.
  • The callback falls through to jsUndefined() when !Wasm::isSupported(). Bun forces useWasm = true in JSCInitialize, so that branch is unreachable in practice; for a JSC shell started with --useWasm=0 the property now exists as undefined rather than being absent.

Verified

gdb breakpoint on JSC::JSWebAssembly::create:

before: bun -e 'console.log(1)'                -> fires
after:  bun -e 'console.log(1)'                -> does not fire
after:  bun -e 'console.log(typeof WebAssembly)' -> fires, prints "object"
  • typeof WebAssembly is "object".
  • Object.getOwnPropertyDescriptor(globalThis, "WebAssembly") is { writable: true, enumerable: false, configurable: true } (unchanged).
  • Object.getOwnPropertyNames(WebAssembly).sort() is unchanged (includes Suspending, SuspendError).
  • delete globalThis.WebAssembly and reassignment work.
  • node:vm context created with codeGeneration: { wasm: false } still sees typeof WebAssembly === "object" and hits the gating path in NodeVMGlobalObject (it reads the property via get(), which reifies the LUT entry).
  • test/js/web/fetch/wasm-streaming.test.ts: 33/33 pass.
  • test/js/node/vm/vm.test.ts: 207/207 pass.

Observable change

Object.getOwnPropertyNames(globalThis) order: WebAssembly moves from the tail structure-property group (after Intl / Temporal) into the static-LUT group next to Atomics / console. Same treatment Math / JSON / Reflect / Atomics already get; no spec requirement on position and nothing in Bun's tests snapshots this.

JSGlobalObject::init() was constructing the WebAssembly namespace object
eagerly on every global, even though the four supporting structures right
above it and every sub-constructor are already initLater. Because useJSPI
defaults to true, this also force-initialized the Suspending and SuspendError
LazyClassStructures (prototype + structure + constructor each) on every
global that never touches wasm.

Move WebAssembly into globalObjectTable as a PropertyCallback alongside
Math/JSON/Reflect/Atomics, and fold the Suspending/SuspendError puts into
JSWebAssembly::finishCreation next to the existing useJSPI-gated promising
function. The callback falls through to jsUndefined() when
Wasm::isSupported() is false; Bun forces useWasm=true so that branch is
unreachable in practice.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a1d5c4a3-a3be-4c67-83dc-4e4b7870d8e6

📥 Commits

Reviewing files that changed from the base of the PR and between c9296e3 and 483b532.

📒 Files selected for processing (2)
  • Source/JavaScriptCore/runtime/JSGlobalObject.cpp
  • Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp

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

@claude claude Bot left a comment

Copy link
Copy Markdown

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 — the change cleanly follows the Math/JSON/Atomics PropertyCallback pattern and the Suspending/SuspendError move is safe (the LazyClassStructure initLaters are registered in init() before any LUT reification can fire). Deferring to a human anyway since this touches JSGlobalObject::init() and intentionally changes the !Wasm::isSupported() shape (undefined vs. absent), which is worth a maintainer sign-off.

What was reviewed:

  • createWebAssemblyProperty matches createMathProperty/createAtomicsProperty exactly, including objectPrototype() use.
  • webAssemblySuspending{,Error}Constructor() are LazyClassStructure accessors set up via FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE before the callback can run — no ordering hazard.
  • No remaining JSC code looks up "WebAssembly" on the global by string, so nothing depends on eager presence.
  • Attributes (DontEnum|PropertyCallback) yield the same descriptor as the removed putDirectWithoutTransition.
Extended reasoning...

Overview

This PR converts the WebAssembly namespace object on JSGlobalObject from an eager putDirectWithoutTransition in init() to a lazy PropertyCallback entry in the static globalObjectTable LUT, mirroring Math, JSON, Reflect, Atomics, and console. The two Suspending/SuspendError constructor installs (gated on useJSPI) move from init() into JSWebAssembly::finishCreation, next to the existing promising install. Net diff is ~20 lines across JSGlobalObject.cpp and JSWebAssembly.cpp.

Security risks

None identified. This is an initialization-timing change; no new inputs are parsed, no auth/crypto/permissions surfaces are touched. The lazy accessors (webAssemblySuspendingConstructor(), webAssemblySuspendErrorConstructor()) resolve through LazyClassStructure::constructor(this), which is the same mechanism the eager path used — just deferred.

Level of scrutiny

Moderate-to-high. The mechanical change is small and pattern-following, but JSGlobalObject::init() is one of the most load-bearing paths in the engine — every global for every realm goes through it, and lazy-vs-eager initialization has historically been a source of subtle ordering bugs. I verified: (a) the initLater registrations for the wasm LazyClassStructures happen in init() and thus precede any possible LUT reification of WebAssembly; (b) global->objectPrototype() is safe at callback time (all sibling callbacks use it); (c) no other JSC code reads the "WebAssembly" identifier off the global directly, so nothing depends on eager materialization.

Other factors

The author's verification is unusually thorough (gdb breakpoint confirmation, descriptor equivalence, getOwnPropertyNames diff, delete/reassign, node:vm wasm: false gating, two passing test suites). The one intentional behavior change — globalThis.WebAssembly === undefined instead of absent when !Wasm::isSupported() / !ENABLE(WEBASSEMBLY) — is clearly documented and unreachable in Bun's production config, but it's the kind of engine-visible semantic shift a maintainer should explicitly accept rather than a bot. That, plus the general sensitivity of JSGlobalObject init, is why I'm deferring rather than approving.

@github-actions

Copy link
Copy Markdown

Preview Builds

Commit Release Date
483b5324 autobuild-preview-pr-321-483b5324 2026-07-23 09:32:31 UTC

@Jarred-Sumner
Jarred-Sumner merged commit af2e8dc into main Jul 23, 2026
43 checks passed
Jarred-Sumner added a commit to oven-sh/bun that referenced this pull request Jul 24, 2026
## Problem

Every Bun process runs libstdc++'s iostream and locale static
initializers before `main`. From the release `bun-profile`:

```
_GLOBAL__sub_I.00090_globals_io.cc
_GLOBAL__sub_I_cxx11_locale_inst.cc
_GLOBAL__sub_I_cxx11_wlocale_inst.cc
_GLOBAL__sub_I_locale_inst.cc
_GLOBAL__sub_I_wlocale_inst.cc
```

`std::ios_base::Init`, `std::locale::_S_initialize`,
`std::locale::_Impl`, and construction of
ctype/numpunct/moneypunct/timepunct/messages for both `char` and
`wchar_t`: roughly fifty functions out of libstdc++ that sit ahead of
`main` in the `bun run orderfile` trace. Bun never uses C++ iostreams.

## Cause

On libstdc++, `<iostream>` (and only `<iostream>`; not
`<ostream>`/`<istream>`/`<sstream>`) emits an undefined reference to
`_ZSt21ios_base_library_initv` in every TU that includes it. One such
reference anywhere in the link pulls `globals_io.o` from libstdc++.a,
whose initializer constructs `cin`/`cout`/`cerr`/`clog` and their
`wchar_t` siblings, which in turn reference the full locale facet set.

There are two sources:

1. **WebKit's vendored simdutf**
(`Source/WTF/wtf/simdutf/simdutf_impl.h:9949`, an unused include in the
`scalar/base64.h` section). Because `SIMDUTF.h` is included from
`src/jsc/bindings/helpers.h`, ~70 Bun TUs carry the reference. Fixed in
oven-sh/WebKit#320; upstream simdutf already dropped it in
simdutf/simdutf#962.
2. **bun-uws headers**: `AsyncSocket.h`, `HttpRouter.h`, `Loop.h`
include it without using it; `App.h`, `HttpContext.h`, `TopicTree.h`
write fixed error strings via `std::cerr`. 7 Bun TUs carry the reference
via `<bun-uws/src/App.h>`.

## Changes

- `scripts/build/deps/webkit.ts`: bump `WEBKIT_VERSION` to `af2e8dc639`
(oven-sh/WebKit#320: drop the simdutf `<iostream>` include and ban it at
compile time for non-Debug `USE_BUN_JSC_ADDITIONS` builds; also picks up
oven-sh/WebKit#321 lazy WebAssembly namespace and oven-sh/WebKit#322
skip eager timezone prewarm). Subsumes the `WEBKIT_VERSION` change in
#35258.
- `packages/bun-uws`: drop the `<iostream>` include from
`AsyncSocket.h`, `HttpContext.h`, `HttpRouter.h`, `Loop.h`,
`TopicTree.h`; delete the five `std::cerr << ...` validation messages
(Bun validates these inputs before calling into uWS, so the paths are
unreachable programmer errors and `std::terminate()` alone is enough).
- `src/banned-includes/iostream`: a `#error` shim prepended to the `-I`
search path for release builds. Any `#include <iostream>` in a Bun TU
(including transitively from a WebKit header) fails the release compile
with an explanation pointing here. Debug builds keep the real header for
ad-hoc printf debugging; `-DBUN_ALLOW_IOSTREAM` is the opt-out.
- `test/internal/source-lints/no-iostream-include.test.ts`: scans
`src/`, `packages/bun-uws`, `packages/bun-usockets` for the include so
debug CI also catches it.

## Verification

With both oven-sh/WebKit#320 and this change applied to a release build:

```
nm build/release/bun-profile | grep ios_base4Init      -> empty
nm build/release/bun-profile | grep _S_initialize      -> empty
_GLOBAL__sub_I.00090_globals_io.cc                     gone
bun-profile                                            547 KB smaller
```

Four `_GLOBAL__sub_I_*locale_inst.cc` stubs remain: these are the
libstdc++ facet-id guard-byte initializers (a few dozen `movb $1,(%rax)`
each) pulled by `Int128.cpp`'s `std::ostringstream`. `<sstream>` does
not emit the static `Init` object and those stubs are near-free.

## Int128.cpp

`Source/WTF/wtf/Int128.cpp` includes `<sstream>` and `<ostream>`. Both
are load-bearing (`UInt128ToFormattedString`'s `std::ostringstream` and
the `operator<<(std::ostream&, ...)` overloads) and neither emits the
static `ios_base::Init` object, so they are left alone.

<!-- robobun:evidence:begin -->

---

**[decide:webkit]** gate passed · iteration 6 · 10 files touched

<details><summary>fails on main (without fix)</summary>

```console
ASAN without fix: 1 FAILED
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/no-iostream-include.test.ts
bun test v1.4.0 (eba02a1)

test/internal/source-lints/no-iostream-include.test.ts:
45 |     // root going away, which would make the ban below pass vacuously.
46 |     expect(scanned).toBeGreaterThan(0);
47 |   }
48 | 
49 |   violations.sort();
50 |   expect(violations).toEqual([]);
                          ^
error: expect(received).toEqual(expected)

- []
+ [
+   "packages/bun-uws/src/AsyncSocket.h",
+   "packages/bun-uws/src/HttpContext.h",
+   "packages/bun-uws/src/HttpRouter.h",
+   "packages/bun-uws/src/Loop.h",
+   "packages/bun-uws/src/TopicTree.h",
+ ]

- Expected  - 1
+ Received  + 7

      at <anonymous> (/workspace/bun/test/internal/source-lints/no-iostream-include.test.ts:50:22)
(fail) C++ sources compiled into Bun do not include <iostream> [748.19ms]

 0 pass
 1 fail
 4 expect() calls
Ran 1 test across 1 file. [3.00s]
error: script "bd" exited with code 1
__F:1:S:0

release without fix: 1 FAILED
bun test v1.4.0-canary.1 (507ab81)

test/internal/source-lints/no-iostream-include.test.ts:
45 |     // root going away, which would make the ban below pass vacuously.
46 |     expect(scanned).toBeGreaterThan(0);
47 |   }
48 | 
49 |   violations.sort();
50 |   expect(violations).toEqual([]);
                          ^
error: expect(received).toEqual(expected)

- []
+ [
+   "packages/bun-uws/src/AsyncSocket.h",
+   "packages/bun-uws/src/HttpContext.h",
+   "packages/bun-uws/src/HttpRouter.h",
+   "packages/bun-uws/src/Loop.h",
+   "packages/bun-uws/src/TopicTree.h",
+ ]

- Expected  - 1
+ Received  + 7

      at <anonymous> (/workspace/bun/test/internal/source-lints/no-iostream-include.test.ts:50:22)
(fail) C++ sources compiled into Bun do not include <iostream> [59.52ms]

 0 pass
 1 fail
 4 expect() calls
Ran 1 test across 1 file. [213.00ms]
__F:1:S:0
```

</details>

<details><summary>passes on PR (with fix)</summary>

```console
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/no-iostream-include.test.ts
bun test v1.4.0 (eba02a1)

test/internal/source-lints/no-iostream-include.test.ts:
(pass) C++ sources compiled into Bun do not include <iostream> [885.41ms]

 1 pass
 0 fail
 4 expect() calls
Ran 1 test across 1 file. [3.41s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 1174ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[0/1] reconfigure
[0/13] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

�[1m�[92m   Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
�[1m�[92m   Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
�[1m�[92m   Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
�[1m�[92m   Compiling�[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/boringssl_sys)
�[1m�[92m   Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
�[1m�[92m   Compiling�[0m bun_zlib_sys v0.0.0 (/workspace/bun/src/zlib_sys)
�[1m�[92m   Compiling�[0m bun_cares_sys v0.0.0 (/workspace/bun/src/cares_sys)
�[1m�[92m   Compiling�[0m bun_zstd v0.0.0 (/workspace/bun/src/zstd)
�[1m�[92m   Compiling�[0m bun_picohttp v0.0.0 (/workspace/bun/src/picohttp)
�[1m�[92m   Compiling�[0m bun_output v0.0.0 (/workspace/bun/src/output)
�[1m�[92m   Compiling�[0m bun_clap v0.0.0 (/workspace/bun/src/clap)
�[1m�[92m   Compili
... (truncated)
```

</details>

<details><summary>diff hotspot</summary>

```
packages/bun-uws/src/App.h                         |  3 --
 packages/bun-uws/src/AsyncSocket.h                 |  1 -
 packages/bun-uws/src/HttpContext.h                 |  3 --
 packages/bun-uws/src/HttpRouter.h                  |  1 -
 packages/bun-uws/src/Loop.h                        |  1 -
 packages/bun-uws/src/TopicTree.h                   |  5 ---
 scripts/build/deps/webkit.ts                       |  7 ---
 scripts/build/flags.ts                             |  6 +++
 src/banned-includes/iostream                       | 27 ++++++++++++
 .../source-lints/no-iostream-include.test.ts       | 51 ++++++++++++++++++++++
 10 files changed, 84 insertions(+), 21 deletions(-)
```

</details>

**gate history** · 8 passed · 1 rejected · iteration 6

<details><summary>evidence per changed file</summary>

```
file                                                    reads  edits  tests
packages/bun-uws/src/App.h                                  4      3      0
packages/bun-uws/src/AsyncSocket.h                          1      1      0
packages/bun-uws/src/HttpContext.h                          2      2      0
packages/bun-uws/src/HttpRouter.h                           1      1      0
packages/bun-uws/src/Loop.h                                 1      1      0
packages/bun-uws/src/TopicTree.h                            4      4      0
scripts/build/deps/webkit.ts                                2      3      0
scripts/build/flags.ts                                      1      1      0
src/banned-includes/iostream                                0      1      0
test/internal/source-lints/no-iostream-include.test.ts      2      3      0
```

</details>

<!-- robobun:evidence:end -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <[email protected]>
liooil pushed a commit to liooil/poly that referenced this pull request Aug 7, 2026
## Problem

Every Bun process runs libstdc++'s iostream and locale static
initializers before `main`. From the release `bun-profile`:

```
_GLOBAL__sub_I.00090_globals_io.cc
_GLOBAL__sub_I_cxx11_locale_inst.cc
_GLOBAL__sub_I_cxx11_wlocale_inst.cc
_GLOBAL__sub_I_locale_inst.cc
_GLOBAL__sub_I_wlocale_inst.cc
```

`std::ios_base::Init`, `std::locale::_S_initialize`,
`std::locale::_Impl`, and construction of
ctype/numpunct/moneypunct/timepunct/messages for both `char` and
`wchar_t`: roughly fifty functions out of libstdc++ that sit ahead of
`main` in the `bun run orderfile` trace. Bun never uses C++ iostreams.

## Cause

On libstdc++, `<iostream>` (and only `<iostream>`; not
`<ostream>`/`<istream>`/`<sstream>`) emits an undefined reference to
`_ZSt21ios_base_library_initv` in every TU that includes it. One such
reference anywhere in the link pulls `globals_io.o` from libstdc++.a,
whose initializer constructs `cin`/`cout`/`cerr`/`clog` and their
`wchar_t` siblings, which in turn reference the full locale facet set.

There are two sources:

1. **WebKit's vendored simdutf**
(`Source/WTF/wtf/simdutf/simdutf_impl.h:9949`, an unused include in the
`scalar/base64.h` section). Because `SIMDUTF.h` is included from
`src/jsc/bindings/helpers.h`, ~70 Bun TUs carry the reference. Fixed in
oven-sh/WebKit#320; upstream simdutf already dropped it in
simdutf/simdutf#962.
2. **bun-uws headers**: `AsyncSocket.h`, `HttpRouter.h`, `Loop.h`
include it without using it; `App.h`, `HttpContext.h`, `TopicTree.h`
write fixed error strings via `std::cerr`. 7 Bun TUs carry the reference
via `<bun-uws/src/App.h>`.

## Changes

- `scripts/build/deps/webkit.ts`: bump `WEBKIT_VERSION` to `af2e8dc639`
(oven-sh/WebKit#320: drop the simdutf `<iostream>` include and ban it at
compile time for non-Debug `USE_BUN_JSC_ADDITIONS` builds; also picks up
oven-sh/WebKit#321 lazy WebAssembly namespace and oven-sh/WebKit#322
skip eager timezone prewarm). Subsumes the `WEBKIT_VERSION` change in
#35258.
- `packages/bun-uws`: drop the `<iostream>` include from
`AsyncSocket.h`, `HttpContext.h`, `HttpRouter.h`, `Loop.h`,
`TopicTree.h`; delete the five `std::cerr << ...` validation messages
(Bun validates these inputs before calling into uWS, so the paths are
unreachable programmer errors and `std::terminate()` alone is enough).
- `src/banned-includes/iostream`: a `#error` shim prepended to the `-I`
search path for release builds. Any `#include <iostream>` in a Bun TU
(including transitively from a WebKit header) fails the release compile
with an explanation pointing here. Debug builds keep the real header for
ad-hoc printf debugging; `-DBUN_ALLOW_IOSTREAM` is the opt-out.
- `test/internal/source-lints/no-iostream-include.test.ts`: scans
`src/`, `packages/bun-uws`, `packages/bun-usockets` for the include so
debug CI also catches it.

## Verification

With both oven-sh/WebKit#320 and this change applied to a release build:

```
nm build/release/bun-profile | grep ios_base4Init      -> empty
nm build/release/bun-profile | grep _S_initialize      -> empty
_GLOBAL__sub_I.00090_globals_io.cc                     gone
bun-profile                                            547 KB smaller
```

Four `_GLOBAL__sub_I_*locale_inst.cc` stubs remain: these are the
libstdc++ facet-id guard-byte initializers (a few dozen `movb $1,(%rax)`
each) pulled by `Int128.cpp`'s `std::ostringstream`. `<sstream>` does
not emit the static `Init` object and those stubs are near-free.

## Int128.cpp

`Source/WTF/wtf/Int128.cpp` includes `<sstream>` and `<ostream>`. Both
are load-bearing (`UInt128ToFormattedString`'s `std::ostringstream` and
the `operator<<(std::ostream&, ...)` overloads) and neither emits the
static `ios_base::Init` object, so they are left alone.

<!-- robobun:evidence:begin -->

---

**[decide:webkit]** gate passed · iteration 6 · 10 files touched

<details><summary>fails on main (without fix)</summary>

```console
ASAN without fix: 1 FAILED
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/no-iostream-include.test.ts
bun test v1.4.0 (eba02a1f6)

test/internal/source-lints/no-iostream-include.test.ts:
45 |     // root going away, which would make the ban below pass vacuously.
46 |     expect(scanned).toBeGreaterThan(0);
47 |   }
48 | 
49 |   violations.sort();
50 |   expect(violations).toEqual([]);
                          ^
error: expect(received).toEqual(expected)

- []
+ [
+   "packages/bun-uws/src/AsyncSocket.h",
+   "packages/bun-uws/src/HttpContext.h",
+   "packages/bun-uws/src/HttpRouter.h",
+   "packages/bun-uws/src/Loop.h",
+   "packages/bun-uws/src/TopicTree.h",
+ ]

- Expected  - 1
+ Received  + 7

      at <anonymous> (/workspace/bun/test/internal/source-lints/no-iostream-include.test.ts:50:22)
(fail) C++ sources compiled into Bun do not include <iostream> [748.19ms]

 0 pass
 1 fail
 4 expect() calls
Ran 1 test across 1 file. [3.00s]
error: script "bd" exited with code 1
__F:1:S:0

release without fix: 1 FAILED
bun test v1.4.0-canary.1 (507ab8113)

test/internal/source-lints/no-iostream-include.test.ts:
45 |     // root going away, which would make the ban below pass vacuously.
46 |     expect(scanned).toBeGreaterThan(0);
47 |   }
48 | 
49 |   violations.sort();
50 |   expect(violations).toEqual([]);
                          ^
error: expect(received).toEqual(expected)

- []
+ [
+   "packages/bun-uws/src/AsyncSocket.h",
+   "packages/bun-uws/src/HttpContext.h",
+   "packages/bun-uws/src/HttpRouter.h",
+   "packages/bun-uws/src/Loop.h",
+   "packages/bun-uws/src/TopicTree.h",
+ ]

- Expected  - 1
+ Received  + 7

      at <anonymous> (/workspace/bun/test/internal/source-lints/no-iostream-include.test.ts:50:22)
(fail) C++ sources compiled into Bun do not include <iostream> [59.52ms]

 0 pass
 1 fail
 4 expect() calls
Ran 1 test across 1 file. [213.00ms]
__F:1:S:0
```

</details>

<details><summary>passes on PR (with fix)</summary>

```console
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/no-iostream-include.test.ts
bun test v1.4.0 (eba02a1f6)

test/internal/source-lints/no-iostream-include.test.ts:
(pass) C++ sources compiled into Bun do not include <iostream> [885.41ms]

 1 pass
 0 fail
 4 expect() calls
Ran 1 test across 1 file. [3.41s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 1174ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[0/1] reconfigure
[0/13] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

�[1m�[92m   Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
�[1m�[92m   Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
�[1m�[92m   Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
�[1m�[92m   Compiling�[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/boringssl_sys)
�[1m�[92m   Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
�[1m�[92m   Compiling�[0m bun_zlib_sys v0.0.0 (/workspace/bun/src/zlib_sys)
�[1m�[92m   Compiling�[0m bun_cares_sys v0.0.0 (/workspace/bun/src/cares_sys)
�[1m�[92m   Compiling�[0m bun_zstd v0.0.0 (/workspace/bun/src/zstd)
�[1m�[92m   Compiling�[0m bun_picohttp v0.0.0 (/workspace/bun/src/picohttp)
�[1m�[92m   Compiling�[0m bun_output v0.0.0 (/workspace/bun/src/output)
�[1m�[92m   Compiling�[0m bun_clap v0.0.0 (/workspace/bun/src/clap)
�[1m�[92m   Compili
... (truncated)
```

</details>

<details><summary>diff hotspot</summary>

```
packages/bun-uws/src/App.h                         |  3 --
 packages/bun-uws/src/AsyncSocket.h                 |  1 -
 packages/bun-uws/src/HttpContext.h                 |  3 --
 packages/bun-uws/src/HttpRouter.h                  |  1 -
 packages/bun-uws/src/Loop.h                        |  1 -
 packages/bun-uws/src/TopicTree.h                   |  5 ---
 scripts/build/deps/webkit.ts                       |  7 ---
 scripts/build/flags.ts                             |  6 +++
 src/banned-includes/iostream                       | 27 ++++++++++++
 .../source-lints/no-iostream-include.test.ts       | 51 ++++++++++++++++++++++
 10 files changed, 84 insertions(+), 21 deletions(-)
```

</details>

**gate history** · 8 passed · 1 rejected · iteration 6

<details><summary>evidence per changed file</summary>

```
file                                                    reads  edits  tests
packages/bun-uws/src/App.h                                  4      3      0
packages/bun-uws/src/AsyncSocket.h                          1      1      0
packages/bun-uws/src/HttpContext.h                          2      2      0
packages/bun-uws/src/HttpRouter.h                           1      1      0
packages/bun-uws/src/Loop.h                                 1      1      0
packages/bun-uws/src/TopicTree.h                            4      4      0
scripts/build/deps/webkit.ts                                2      3      0
scripts/build/flags.ts                                      1      1      0
src/banned-includes/iostream                                0      1      0
test/internal/source-lints/no-iostream-include.test.ts      2      3      0
```

</details>

<!-- robobun:evidence:end -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants