Skip to content

Navigation Menu

Sign in
Sign up

Fixture: oven-sh/bun#30412 - #1

Open
shftlvch wants to merge 6755 commits into
pr-30412-base from
pr-30412-head
Open

Fixture: oven-sh/bun#30412 #1
shftlvch wants to merge 6755 commits into
pr-30412-base from
pr-30412-head

Conversation

@shftlvch

@shftlvch shftlvch commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Temporary fixture PR for testing Shmak diff viewer migration. Recreates oven-sh#30412 using base 0d9b296 and head ed1a70f.

Jarred Sumner and others added 30 commits May 12, 2026 21:29
...tackFallback (build, transpile)
...nstead of full reset per part_range (build/elysia)
...i_heaps (server/elysia RSS -12%)
...bunVM FFI hop (server/node-http)
...c/ptr) (−1634 LOC, 56 sites)
- bun_core/util.rs: dotted-version-parse, std-time-timestamp, time-unit-constants
- bun_core/fmt.rs: hex encode/decode, json u-escape, parse-decimal, itoa, digit-count
- bun_core/lib.rs: eq_ignore_ascii_case, is_sep/is_absolute, basename, intrusive_field!, wtf8 length table, encode_wtf8_rune, vec drain-front, allocated-slice-ffi
- bun_core/string/immutable.rs: prefix-ci-eq, lexer next_codepoint/peek-n, utf8→utf16, contains-non-bmp
- bun_core/string/immutable/unicode.rs: decode_wtf8_rune_t, BOM detect/convert
- bun_core/string/immutable/escapeHTML.rs: html-entity-escape map
- bun_core/env.rs: cfg-current-os-name
- bun_core/output.rs: declare_scope!/define_scoped_log
- bun_core/result.rs: coreutils MESSAGES phf, named_error_set! From impls
- bun_core/thread_id.rs: native thread-id cfg ladder
- bun_alloc/lib.rs: ZigString dual-def, buf_print! local dup
- bun_output_tags/lib.rs: ansi SGR escape constants
- collections/vec_ext.rs: bitwise prepend, drain-front trait forwarder
- paths/lib.rs: path join, NODE_MODULES const, tmpname hex bufprint
- paths/string_paths.rs: without-leading-slash
- ptr/lib.rs: AsCtxPtr blanket trait (19 inherent stamps), r2-laundered-self-ptr
- ptr/owned.rs: Box::from_slice helper
...404 LOC, 33 sites)
- css/lib.rs: match_ignore_ascii_case! over if-else CI ladders, vendor-prefix CI ladder
- css/values/ident.rs: css-wide-keyword check
- css/generics.rs: css-trivial-eql self==other zigleak
- css_derive: CssHash discriminant-hash unit-variant arm
- css/values/color.rs: ColorSpace into-dispatch macro (×ばつ), f32→u8 clamp/round
- css/values/gradient.rs: get_fallback items-loop body (×ばつ)
....rs (−1238 LOC, 12 sites)
- uws_sys/socket.rs: ONE canonical InternalSocket five-arm match (deletes bun_uws parallel reimpl)
- uws_sys/App.rs + h3.rs: per-HTTP-method route-register macro
- http_types/h2.rs: h2 wire-protocol types canonical (deletes runtime reimpl)
- drop unused enum_forward! macro
- libuv_sys/libuv.rs: uv-errcode→E table (×ばつ → 1), drop dead WindowsStat dup
- errno/lib.rs: per-OS UV_E row set (×ばつ → 1)
- errno/windows_errno.rs: Windows E + SystemErrno UV tail, ERROR_MAP 137-row table
- zlib_sys/shared.rs: gzFile + typedefs canonical
- ast/new_store.rs: Expr/Stmt::Data Store module body twin
- ast/lexer_tables.rs: is_latin1_identifier_u16 (×ばつ → 1)
- ast/lexer_log.rs: lexer error-reporting cluster (×ばつ → 1)
- js_printer/lib.rs: writer reserve/copy/advance triplet
- callers: forward to bun_core::strings lexer_step / contains_non_bmp
- jsc/JSValue.rs: create_array_from_iter/create_array_from_slice (replaces empty-array+put_index loops)
- jsc/JSGlobalObject.rs: throw-X-is-not-constructable stub
- jsc/lib.rs: IndentScope over hand-rolled inc/body/dec
- jsc/ConsoleObject.rs: noop extern-C stub body (×ばつ)
- threading/work_pool.rs: intrusive_work_task! → bun_core::intrusive_field!
- io/lib.rs: io-request parent recovery via IntrusiveField
- event_loop/AnyEventLoop.rs: js-mini method set twin
...8 sites)
- test_runner/expect.rs: matcher prelude/postmatch guard, string-affix matchers, toContain keys/values bodies
- server/ServerWebSocket.rs: SendStatus→jsNumber (×ばつ), publish prologue (×ばつ), subscribe/unsubscribe/isSubscribed body
- server/mod.rs: any_server_dispatch! macro (4-arm tag match)
- socket/uws_dispatch.rs: us-dispatch C-ABI vtable shim macro
- socket/uws_handlers.rs: ns-socket-events forward boilerplate per SQL driver
- sql_jsc/postgres: SocketHandler vm-shutdown guard helper (×ばつ → 1)
- runtime/cli/mod.rs: which/isBunX/isNode doubled mod-vs-body
- runtime/shell/interpreter.rs: shell-task-offset boilerplate via IntrusiveField
- runtime/dispatch.rs: timer_arm! macro, run_from_js+destroy arm body (×ばつ), fs_async cast ladder (42 arms), CompressionStream generic (×ばつ)
...sites)
- webcore/encoding.rs: node-encoding runtime→const-generic 9-arm ladder
- ffi/abi_type.rs: ABIType per-variant string match (×ばつ → 1)
- bake/DevServer.rs: hex-slice→ne-int decoder
- callers: forward to bun_core canonical hex/time/string/ptr helpers
...sites)
- bundler, install, js_parser, resolver, sourcemap, url, sys, md, perf, watcher, glob, etc.
- forward to: bun_core hex/string/time/fmt, paths, ptr::AsCtxPtr, vec_ext
...non_ascii is SmallVec post-merge)
Jarred Sumner and others added 30 commits May 13, 2026 19:36
...uard
8234852 added a same-origin check before attaching the registry
Authorization header to tarball downloads, comparing raw URL.origin byte
slices. URL.origin is an unnormalized prefix of the input string, so a
tarball URL of https://host:443/... does not byte-match a .npmrc registry
of https://host/... even though they are the same origin. Registries that
emit dist.tarball URLs with the default port spelled out (e.g. Artifactory)
therefore lost the Authorization header on every download and failed with
401.
Compare (protocol, hostname, get_port_auto()) instead — get_port_auto()
returns the explicit port or the scheme default, so :443 and bare https
both resolve to 443.
Adds an integration test for the guard itself: auth sent on same-origin
tarball, withheld on cross-origin tarball. The default-port spelling case
specifically requires binding port 80/443 and is not integration-tested.
CLAUDE.md: Core Source Organization rewritten around the Cargo workspace
(bun_core / bun_sys / bun_runtime / bun_bin / per-subsystem crates) with
the actual .rs paths; .zig siblings noted once as a non-compiled porting
reference. rust:check-all replaces zig:check-all; memory-management note
covers RAII + the arena-Drop edge case.
src/CLAUDE.md: full rewrite as a Rust API guide. Covers the bun_core/bun_sys
helpers to prefer over std, bun_core::String (Latin-1/UTF-16, JSC bridging),
bun_paths, bun_jsc::URL, MimeType, allocators + the arena/Drop gotcha,
env_var, scoped logging, spawn, and a new JSC Interop & FFI Safety section
(pointer provenance / borrow=ptr, Strong/Weak handles, refcount-transfer
protocol on to_js(), per-thread AtomString hazards). All API names verified
against the source.
On Windows, recursive rm/rmdir passed the raw path to zig_delete_tree,
whose dt_* helpers go through Syscall::*at -> to_nt_path /
normalize_path_windows. Those normalizers do not resolve a leading-
separator, drive-less path ("/tmp/foo") against the cwd's drive, so the
delete walked a nonexistent NT object and silently no-op'd (or ENOENT'd)
while existsSync/statSync/unlinkSync, which already pre-resolve via
slice_z, agreed the directory existed.
Pre-resolve the path with slice_z in the recursive arms (Windows only)
so it carries the cwd drive before reaching the dt_* helpers, matching
both the non-recursive arms and the original std.fs.Dir.* behavior
(which resolved rooted paths via wToPrefixedFileW / RtlGetFullPathName_U).
Adds two Windows-gated regression tests in test/js/node/fs/fs.test.ts
that derive a rooted-but-driveless path from tmpdir() and assert
existsSync and recursive rmSync/rmdirSync agree.
The eager seed read /etc/localtime, /etc/timezone and /etc/sysconfig/clock
to pin a default timezone before VM init when $TZ is unset. That diverges
from the lazy ICU host-zone auto-detection upstream uses and risks subtle
Date/Intl inconsistencies on machines where those sources disagree or carry
a POSIX-TZ string ICU normalizes differently than the IANA zone the lazy
path would pick. Revert to the original behavior: $TZ honored when set and
non-empty, JSC/ICU auto-detects otherwise. Drops seed_host_time_zone +
tzif_v2_footer + normalize_posix_tz_zone (run_command.rs), the
wtfSetTimeZoneOverride binding (wtf-bindings.cpp + WTF.zig), and the
parallel seedHostTimeZone in bun.js.zig.
Windows env var names are case-insensitive, so the OS env block can carry
HTTP_PROXY/HTTPS_PROXY/NO_PROXY in any casing (Http_Proxy, HTTP_proxy, ...).
isProxyVar() in createEnvironmentVariablesMap was a case-sensitive String==
comparison against the 6 canonical names, so a non-canonical key fell through
to the generic accessor path and the bottom loop then overwrote the canonical
accessor with DontEnum (because hasProxyVar[*] stayed false). The result:
{...process.env} (which most spawn env merges do) silently dropped the var,
even though process.env.HTTP_PROXY read it fine.
Fall back to equalIgnoringASCIICase on Windows so any casing of a proxy var
in the OS env block keeps the canonical accessor enumerable. POSIX behavior
is unchanged (Http_Proxy is genuinely a different var than HTTP_PROXY there).
...en we ship
The bench profile was being built with a two-stage PGO link (instrument →
train → llvm-profdata merge → relink with -fprofile-use), but the actual
release/CI builds are not PGO-d, so the bench numbers measured a binary
nobody ships. Make build:btg a plain --profile=btg link (same codegen as
ci-release: lto=true, no PGO, no symbol ordering, no special-case linker
layout). Removes scripts/build-pgo.ts; the -fprofile-generate/-use and
keep-text-section-prefix flags stay gated on the (now-unset) pgoGenerate/
pgoUse config fields and are inert by default.
...case-insensitively
The test asserted a fixed-case key ({...process.env}.HTTP_PROXY) which is
wrong: on Windows the spread preserves the original key case from the OS
env block (JS objects are case-sensitive even when env-var semantics
arent), so the spread has Http_Proxy, not HTTP_PROXY. The bug was that the
canonical-uppercase accessor was DontEnum, so the var didnt appear in the
enumeration at all. Assert the var appears under *some* case-insensitive
match, and drop pre-existing forms from bunEnv so the test exercises the
non-canonical casing in isolation.
...ts and source-driven adjustments
The proxy-related env vars (HTTP_PROXY, HTTPS_PROXY, NO_PROXY and lowercase
variants) get a CustomAccessor with DontEnum when not present in the OS env
block at startup. The setter wrote through to the native env loader but did
not clear DontEnum — so process.env.HTTP_PROXY = ... followed by
Bun.spawn({env: {...process.env}}) silently dropped the var (the spread
skips non-enumerable properties). The regular env-var setter handles this
by replacing the accessor with an enumerable data property; the proxy setter
keeps the accessor (the native env map is the source of truth) and now
re-defines it without DontEnum after a write.
This is what was breaking proxy-env propagation to spawned MCP servers when
the parent assigns the proxy vars rather than receiving them in its own OS
env.
The windowsEnv() Proxy set() trap gated envMapList.push on
!(k in internalEnv). That guard is correct for ordinary env vars (the
accessor only exists if the var was in the OS env at startup, in which case
the key is already in envMapList) but wrong for the proxy-related vars
(HTTP_PROXY/HTTPS_PROXY/NO_PROXY and lowercase variants): those always have
a CustomAccessor on internalEnv, so the in check is true even when the var
was never in the OS env block. A first-time runtime assignment then never
added the key to envMapList, so Object.keys(process.env) /
{...process.env} silently omitted it on Windows.
Gate on envMapList membership (case-insensitively) instead — push the key
when its not there regardless of whether internalEnv already has an
accessor. Pairs with the JSEnvironmentVariableMap.cpp DontEnum fix; the
two together make runtime-assigned proxy vars survive the spread on every
platform.
The blanket 'revert to match main' commit reverted several test changes
that were actually tracking real differences in this branch's source, or
went past main into a stale state. Restoring the pre-revert versions
of the affected files (already verified passing on builds 54128-54144):
- direct-readable-stream.test.tsx: http3:/http1: are the option names
 read by ServerConfig.rs and by current main (renamed in 0d9b296).
 Reverting to h3:/h1: meant the QUIC server never enabled HTTP/3 and
 every H3 fetch timed out.
- bun-audit.test.ts.snap: vulnerable_packages is StringArrayHashMap on
 this branch (insertion-ordered, deterministic) vs Zig std.StringHashMap
 (bucket-ordered). Same 21 advisories, different order.
- bundler_npm.test.ts: minifier allocates nt/ar++ at the mapped source
 positions on this branch, not Y1/GJ++.
- spawn-unread-stdout-gc.test.ts: 400x50ms ASAN poll window and the
 collected > 0 assertion; under release-ASAN each grandchild's LSan
 exit can outlast the original 1.5s window.
- hot.test.ts: writeHotFileAtomicSync, the partial-bundle-read 'retry'
 path, and the watcher death-rattle check; without them the test
 re-races --hot against a non-atomic 2MB writeFileSync and reports
 hot-runner-root.js / 'Unexpected NUL' instead of bundle_in.ts.
concurrent.test.ts gets a slightly different fix: derive the
max-concurrency cap from the observed ceiling (Math.max) and assert it
is exactly 5 or 20, instead of gating on harness isASAN. isASAN only
matches CI's bun-asan binary name, but a default 'bun bd' debug build
is also ASAN-instrumented (profiles.ts: debug defaults asan on) yet
named bun-debug, so the isASAN-gated version always failed locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /