Skip to content

Ban <iostream> from release builds and drop it from bun-uws - #35256

Merged
Jarred-Sumner merged 13 commits into
mainfrom
farm/d433c90c/drop-uws-iostream
Jul 24, 2026
Merged

Ban <iostream> from release builds and drop it from bun-uws#35256
Jarred-Sumner merged 13 commits into
mainfrom
farm/d433c90c/drop-uws-iostream

Conversation

@robobun

@robobun robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

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 simdutf: remove unused <iostream> from scalar/base64.h amalgamation WebKit#320; upstream simdutf already dropped it in simpler approach to removing the C++ lib dependency at runtime 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

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.


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

fails on main (without fix)
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
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/source-lints/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)
diff hotspot
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(-)

gate history · 8 passed · 1 rejected · iteration 6

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

A single #include <iostream> anywhere in the release link pulls
libstdc++'s globals_io.o in: its _GLOBAL__sub_I.00090_globals_io.cc
static initializer constructs cin/cout/cerr/clog (char and wchar_t) and
references the full std::locale facet set, so roughly fifty libstdc++
functions (std::ios_base::Init, std::locale::_S_initialize,
std::locale::_Impl, ctype/numpunct/moneypunct/timepunct/messages) run
before main on every bun process.

There were two sources of the include: the vendored simdutf header in
WebKit (Source/WTF/wtf/simdutf/simdutf_impl.h, fixed in
oven-sh/WebKit#320) and five bun-uws headers. Three of the bun-uws
headers (AsyncSocket.h, HttpRouter.h, Loop.h) included it without using
it; App.h, HttpContext.h and TopicTree.h wrote fixed error strings via
std::cerr, now fputs(stderr).

The new src/banned-includes/iostream shim is prepended to the -I path
for release builds only, so any #include <iostream> resolves to a
#error with a pointer to this explanation. This also catches WebKit
headers that start including it (SIMDUTF.h etc. are pulled into Bun TUs
via helpers.h), so a future WebKit bump that regresses this fails the
release compile rather than silently re-adding the initializers. Debug
builds keep the real header for ad-hoc printf debugging;
-DBUN_ALLOW_IOSTREAM is the opt-out.

With both this change and the WebKit patch applied:

  nm build/release/bun-profile | grep ios_base4Init   -> empty
  _GLOBAL__sub_I.00090_globals_io.cc                  gone
  std::locale::_S_initialize / _Impl ctor             gone
  bun-profile: 547 KB smaller

The four remaining _GLOBAL__sub_I_*locale_inst.cc stubs are facet-id
guard-byte writes (a few dozen movb $1 each) pulled by Int128.cpp's
std::ostringstream; those are near-free and <sstream> does not emit the
static Init object.
@robobun

robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 10:05 PM PT - Jul 23rd, 2026

@Jarred-Sumner, your commit df60661 is building: #79248

Picks up oven-sh/WebKit#320 (removes the stray <iostream> from the
vendored simdutf amalgamation and bans <iostream> at compile time for
non-Debug USE_BUN_JSC_ADDITIONS builds) and oven-sh/WebKit#322 (skip
the eager timezone prewarm under USE_BUN_JSC_ADDITIONS).

With this bump the release build's src/banned-includes/iostream shim no
longer trips on the WebKit simdutf header, and no translation unit in
the final link carries a reference to std::ios_base_library_init.
@robobun
robobun marked this pull request as ready for review July 23, 2026 09:57
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

The PR bans unauthorized <iostream> includes in release builds, removes related uWebSockets includes and diagnostics, adds source-lint coverage, and exports a WebKit revision constant.

iostream enforcement

Layer / File(s) Summary
Release include guard
scripts/build/flags.ts, src/banned-includes/iostream
Release builds search src/banned-includes first, where <iostream> fails unless BUN_ALLOW_IOSTREAM is defined.
uWebSockets include and guard cleanup
packages/bun-uws/src/*.h
uWebSockets headers remove iostream dependencies; selected termination diagnostics are removed, and topic iteration misuse no longer terminates.
Source-lint coverage
test/internal/source-lints/no-iostream-include.test.ts
A test scans C++ sources and fails on unauthorized <iostream> directives.

WebKit version pin

Layer / File(s) Summary
WebKit revision export
scripts/build/deps/webkit.ts
Exports WEBKIT_VERSION with the selected WebKit revision and removes the previous explanatory comments.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: banning in release builds and removing it from bun-uws.
Description check ✅ Passed It includes the PR purpose and verification details, though it uses custom headings instead of the exact template headings.

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

Comment thread packages/bun-uws/src/App.h Outdated
The 2f7e89c84f autobuild hit a one-lane Windows x64 Release failure on
the main push (the PR preview build for the identical change passed all
38 lanes, so this is infrastructure noise). af2e8dc6 is the current
oven-sh/WebKit main HEAD and still contains #320 and #322.
@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

@robobun bump WebKit sha I mergedbmore WebKit PRs and this can close the other WebKit bumps

Bun validates idleTimeout/maxLifetime and the request-handler contract
before calling into uWS, so these paths are programmer errors rather
than user-facing conditions; std::terminate is enough.
@robobun

robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

Bumped WEBKIT_VERSION to af2e8dc6393ce244eb1865e34e7636225744cfba (current oven-sh/WebKit main HEAD), which rolls up oven-sh/WebKit#320 (simdutf <iostream> drop + compile-time ban), oven-sh/WebKit#321 (lazy WebAssembly namespace), and oven-sh/WebKit#322 (skip eager timezone prewarm). That subsumes the WEBKIT_VERSION change in #35258.

Also dropped the stderr logging at the five uWS validation sites per the review above; they now std::terminate() directly.

Heads up: the autobuild-af2e8dc6... release publish job is still uploading assets (Linux glibc variants are up; musl/macOS/Windows/FreeBSD/Android still pending), so those CI lanes will 404 on the prebuilt download until the upload finishes.

Comment thread packages/bun-uws/src/TopicTree.h
…r call sites

The stderr message they referred to was removed in the previous commit.
Comment thread test/internal/source-lints/no-iostream-include.test.ts
robobun added 2 commits July 23, 2026 11:25
…scans nothing

Matches the convention in the sibling lints (shim-stdint-includes,
unsound-erased-box, frozen-nonnull-reborrow, expect-call-counter).
@robobun

robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

CI on build 78668: 190/196 jobs passed. Every build-cpp and build-bun lane is green, so the src/banned-includes/iostream shim and the WebKit af2e8dc639 bump compile cleanly on Linux glibc/musl, macOS x64/arm64, Windows x64/arm64, FreeBSD, and Android.

The remaining red is unrelated to this diff:

  • test/js/bun/spawn/spawn.test.ts (ubuntu 25.04 x64, debian 13 x64, alpine 3.23 x64): same Expected: 100 / Received: 0 flake showing on builds 78654/78656/78659/78660 across other PRs in the same window. Nothing in this change touches Bun.spawn.
  • test/js/node/test/parallel/test-fs-promises-file-handle-readFile.js (debian 13 x64-asan): annotated [pre-existing]; the FileHandle-closed-during-GC error predates this change.

Ten other tests (webview-chrome, node-dns, napi, fastutf8stream-reopen, http-agent-keepalive, solc, no-orphans, fetch.stream, 20144, complex-workspace) went yellow and passed on retry.

Ready for review.

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

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

Inline comments:
In `@test/internal/source-lints/no-iostream-include.test.ts`:
- Around line 31-48: Update the scan in the test to track the number of matched
files separately for each configured root, and assert that every root in roots
has at least one scanned file. Replace the aggregate scanned > 0 guard with
per-root precondition assertions while preserving the existing violation
detection and allowlist behavior.
- Line 29: Replace the regex-based iostreamInclude check with preprocessor-aware
tokenization or the repository’s existing parser so comments and line-spliced
directives are recognized. Update the test coverage to include variants such as
`#/**/include <iostream>` and `#incl\\\nude <iostream>`, while preserving
detection of the standard spelling.
🪄 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: 594e6012-3af3-45df-84fd-1da2321254e6

📥 Commits

Reviewing files that changed from the base of the PR and between b39a270 and f58b0fd.

📒 Files selected for processing (10)
  • packages/bun-uws/src/App.h
  • 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
  • scripts/build/deps/webkit.ts
  • scripts/build/flags.ts
  • src/banned-includes/iostream
  • test/internal/source-lints/no-iostream-include.test.ts
💤 Files with no reviewable changes (7)
  • packages/bun-uws/src/HttpRouter.h
  • packages/bun-uws/src/Loop.h
  • packages/bun-uws/src/AsyncSocket.h
  • packages/bun-uws/src/HttpContext.h
  • packages/bun-uws/src/App.h
  • scripts/build/deps/webkit.ts
  • packages/bun-uws/src/TopicTree.h

Comment thread test/internal/source-lints/no-iostream-include.test.ts
Comment thread test/internal/source-lints/no-iostream-include.test.ts Outdated
So the guard still trips if one of the three roots is renamed while the
others still yield files.
Comment thread scripts/build/deps/webkit.ts Outdated
robobun added 2 commits July 23, 2026 22:40
The merge of main into this branch kept WEBKIT_VERSION = a40d462206
(correct: on oven-sh/WebKit main, a40d462206 is a descendant of
2f7e89c84f and therefore includes #320/#321/#322 as well as #315) but
dropped the descriptive comment from both parents. Restore it as the
union of the two sides.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — mechanical header cleanup plus a release-build enforcement shim, with the maintainer already having directed the shape of the changes.

What was reviewed:

  • bun-uws header edits are pure deletions of <iostream> includes and the five std::cerr messages; the std::terminate() calls (already present pre-PR) remain and compiled green on every build-cpp lane in #78668.
  • bunIncludes() prepends src/banned-includes only when cfg.release, so debug builds are unaffected; #include_next in the shim is fine since Bun builds exclusively with clang.
  • Net webkit.ts change vs main is the comment deletion only (per maintainer request); WEBKIT_VERSION stays at a40d462206, which robobun verified is a descendant of the #320 simdutf fix.
  • The source-lint test now asserts scanned > 0 per root and matches the sibling lints' convention.
Extended reasoning...

Overview

Ten files: six bun-uws headers drop #include <iostream> and the std::cerr << ... lines that were the only consumers (leaving the existing std::terminate() calls); scripts/build/flags.ts prepends src/banned-includes to the release -I list; src/banned-includes/iostream is a new #error shim with a BUN_ALLOW_IOSTREAM / #include_next opt-out; test/internal/source-lints/no-iostream-include.test.ts is a new debug-CI backstop; and scripts/build/deps/webkit.ts — after the main merge — nets out to deleting the 7-line why-comment above WEBKIT_VERSION (the sha itself is unchanged from main).

Security risks

None. No user-facing input handling, no auth/crypto, no runtime code paths — only build-system include ordering, vendored-header include hygiene, and a source-lint test. The deleted std::cerr messages sat on unreachable-in-Bun validation branches (Bun validates idleTimeout/maxLifetime etc. before calling into uWS) that already std::terminate()d.

Level of scrutiny

Low-to-moderate. The bun-uws edits are pure deletions verified by cross-platform compile (build #78668: every build-cpp/build-bun lane green across Linux glibc/musl, macOS, Windows, FreeBSD, Android). The flags.ts change is a single conditional array spread in bunIncludes() following the file's existing pattern. The shim uses #include_next, a clang/GCC extension — fine because Bun only builds with clang (per flags.ts). The webkit.ts merge story was checked: my earlier concern that a40d462206 predated oven-sh/WebKit#320 was refuted by robobun's git merge-base --is-ancestor check, so the release shim will not trip on the WebKit prebuilt.

Other factors

The maintainer has actively steered this PR three times ("Just don't log anything. Delete it.", "bump WebKit sha", "No. The why comment is unnecessary.") and every one of those directions is reflected in the current diff. All five prior review threads (mine and CodeRabbit's) are resolved. The only post-#78668 changes are the per-root scanned > 0 guard in the lint test and a comment restore+revert in webkit.ts — neither affects compilation. Build #78967 for the current HEAD is in progress; given the delta from the last green build is test-only + comment-only, that is not a reason to hold.

@robobun

robobun commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Build 78967 (post-merge, WEBKIT_VERSION = a40d462206): 193/196 passed. Every build-cpp/build-bun lane is green on all platforms, so the banned-includes shim compiles cleanly against the merged WebKit pin. The 3 red jobs are all test/js/bun/spawn/spawn.test.ts (debian 13 / ubuntu 25.04 / alpine 3.23 x64), the same fleet-wide flake showing on builds 78654/78656/78659/78660 across unrelated PRs. Nothing in this diff touches Bun.spawn.

@Jarred-Sumner
Jarred-Sumner merged commit 2609fa8 into main Jul 24, 2026
5 of 8 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the farm/d433c90c/drop-uws-iostream branch July 24, 2026 03:56

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — mechanical removal of <iostream> from bun-uws with compile-time and source-lint enforcement; all prior review feedback (Jarred's, mine, CodeRabbit's) has been applied.

What was reviewed:

  • Confirmed the five removed std::cerr sites guard unreachable paths: idleTimeout/maxLifetime are validated in WebSocketServerContext.rs (idleTimeout clamped to [8, 960]; maxLifetime is never read from JS and stays 0), and the HttpContext/TopicTree checks are Bun-internal programmer-error guards.
  • Verified scripts/build/deps/webkit.ts is no longer in the diff after df60661 — main's WEBKIT_VERSION = a40d462206 already contains oven-sh/WebKit#320, so the shim won't trip on the simdutf header.
  • Checked the bunIncludes() change prepends src/banned-includes only for cfg.release, matching the shim's stated debug-build opt-out.
  • The source-lint test now asserts scanned > 0 per root and matches the sibling lints' conventions.
Extended reasoning...

Overview

This PR eliminates <iostream> from Bun's release link so libstdc++'s globals_io.o (and its ~50-function locale facet initializer chain) no longer runs before main. It touches nine files: six bun-uws headers (drop the include and five std::cerr << ... << std::endl lines that preceded std::terminate()), scripts/build/flags.ts (prepend src/banned-includes to the release -I list), a new #error shim at src/banned-includes/iostream with a BUN_ALLOW_IOSTREAM / #include_next opt-out, and a new source-lint test. scripts/build/deps/webkit.ts dropped out of the diff after merging main — the current WEBKIT_VERSION on main already contains the simdutf fix (oven-sh/WebKit#320).

Security risks

None. No user-facing API surface, no auth/crypto/network parsing, no untrusted-input handling. The only behavioral change is that five programmer-error std::terminate() sites in vendored bun-uws no longer print an explanatory line to stderr first. I verified those sites are unreachable from Bun user input: WebSocketServerContext.rs:323-343 clamps idleTimeout to 0 or [8, 960] and throws on out-of-range values before calling into uWS; max_lifetime defaults to 0 and is never populated from the JS options object; the HttpContext.h and TopicTree.h checks guard invariants Bun's own request-handler and pub/sub glue must uphold. Jarred explicitly directed the deletion ("Just don't log anything. Delete it.").

Level of scrutiny

Low-to-medium. The bun-uws edits are pure deletions of unused includes and pre-terminate() prints. The build-system change is six lines adding a release-only -I entry; the shim it points at fails compilation loudly rather than silently changing behavior, and #include_next preserves an escape hatch. The lint test is a debug-CI backstop for the same property. Every build-cpp/build-bun lane on build 78967 (post-merge, post-shim) is green across Linux glibc/musl, macOS x64/arm64, Windows x64/arm64, FreeBSD, and Android, so the shim demonstrably compiles cleanly against the pinned WebKit on every platform.

Other factors

This PR has been through four review rounds with the maintainer directly engaged. Jarred gave two explicit directions (delete the stderr logging; drop the WEBKIT_VERSION why-comment) — both applied. My three prior inline findings (missing <cstdio> IWYU → mooted by the logging deletion; stale "Notify user" comments; vacuous-scan guard in the lint test) were all addressed and resolved. CodeRabbit's per-root scan guard was applied; its preprocessor-tokenization suggestion was correctly declined (the release #error shim is the authoritative enforcement and is preprocessor-aware). The one merge-conflict finding I raised on webkit.ts was half-right (the dropped comment) and half-wrong (the sha ancestry) — robobun verified via git merge-base --is-ancestor that a40d462206 already contains #320, and the file has since converged with main. The remaining CI red on 78967 is the fleet-wide spawn.test.ts flake unrelated to this diff.

robobun added a commit that referenced this pull request Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants