Skip to content

Bun parity: remaining open items to reach 100% test-suite pass #66

Description

@chrisbbreuer

Tracking issue for the remaining work to reach 100% parity with Bun's official test suite (~/Code/bun, pinned SHA fd0b6f1a27), runnable here via home test. Each item has the root cause traced during investigation. We tackle them top-to-bottom; check off as landed (small fix:/feat: commits, pushed).

How to run / verify

  • Build: HOME_BUN_OBJ_ROOT=/tmp/bun-pinned/build/release/obj HOME_BUN_WEBKIT_LIB=~/.bun/build-cache/webkit-5488984d20e0dbfe-arm64/lib ./pantry/.bin/zig build
  • Test: cd /tmp/bun-pinned && home test test/js/... (run files sequentially with a pkill -9 -f zig-out/bin/home between them — parallel runs cause resource-exhaustion false hangs).
  • Release build (-Doptimize=ReleaseSafe) clears debug-assert crashes and gives honest leak numbers.

A. node:tls socket layer

  • getCipher() cluster works — was a false diagnosis: the null cipher/session came from the broken (cert-less) handshake caused by the Buffer-cert gap, now fixed (b3492d3). Verified locally: getCipher {TLS_AES_128_GCM_SHA256, version:"TLSv1/SSLv3"} (matches pin test), getProtocol TLSv1.3, getSession 1106-byte Buffer, getEphemeralKeyInfo/getSharedSigalgs/exportKeyingMaterial/isSessionReused all correct. The pin test connects to bun.sh (crashes on this macOS 27 box) so it can't be run here, but the behavior is confirmed.
  • getPeerCertificate at pin parity — abbreviated works (17 keys, CN populated); earlier {} was a test error (called with false→ the non-abbreviated path). The detailed/issuerCertificate-chain path is a literal TODO at tls_socket_functions.zig:149 — identical in the pin, so pin tests needing it fail there too (not a Home gap).
  • ALPN — fixed in 428aa2c (hand-mirror SSLConfig.fromJS never parsed ALPNProtocols).
  • SNI server.addContext() — fixed in 4ed9a49. The hand-mirror read only serverName, not its servername altName (which node:tls passes), so the client sent no SNI → server context selection never matched. Isolated addContext test now passes (context1/context2 authorize via their CA, unknowncontext falls back). Remaining node-tls-context failures are the file's external-connecting tests (machine's TLS-network crash).
  • Cert-chain verification — "unable to verify the first certificate" / "unable to get issuer certificate" on incomplete-chain + intermediate-CA scenarios (basic single-CA verify works).
  • Config validationtls.createServer({passphrase: wrong}) should reject but listens; passphrase IS passed to us_ssl_ctx_from_options, so it's uws-level validation timing/error-surfacing.
  • getPeerCertificate '\0' handling (CVE-2009-2408 test).

B. Bun Shell ($) — (parallel agent landing corpus tests)

  • **$\cmd` segfaults** in the interpreter execution-completion microtask (get_by_idon null); construction + parse work, the completion callback derefs a null/freed object. ~11bun/shell` files.

C. fetch / HTTP client

  • redirect + gzip — fixed in c508e00 (NativePromiseContext wiring; see below). fetch-gzip.test.ts 2/3 → 5/0.
  • streamed gzip with delay — fixed in c508e00 (same root).
  • body-stream.test.ts — the hang is fixed by c508e00; remaining failures now fail fast and are a separate request-body-stream clone bug (reader (clone) + force ReadableStream conversion).

D. HTTP/2 & HTTP/3

  • HTTP/2 client — real protocol-impl bugs producing wrong/empty responses (toBe mismatches, "JSON Parse: Missing"). fetch-http2-client.test.ts (58 fail), fetch-http2-adversarial (9).
  • HTTP/3 — unported (fetch-http3-*).

E. Deep/unported subsystems

  • napi-FFI — crash in cc.test.ts.
  • S3Clients3-stream-cancel-leak segfault; S3 largely parked.
  • Bake/HMR — parked; ClientFile.Packed size invariant relaxed for release ([df83921]).
  • Worker MessageChannel/BroadcastChannel edge cases — core cross-thread now works (dcb6db6); verify remaining worker tests.

F. Memory-leak tests (triaged on ReleaseSafe 2026-07-07 — build target un-rotted in 55f7140)

  • setTimeout-clear-in-callback — ✅ FALSE ALARM: all 3 variants (clear/refresh/repeat) pass on ReleaseSafe; debug-build overhead as suspected.
  • text-decoder utf16le output-buffer leak — ✅ FALSE ALARM: both utf-16le and utf-16be pass on ReleaseSafe.
  • streams-leak — ✅ FALSE ALARM: passes on ReleaseSafe.
  • serve-body-leak — ✅ CLOSED (4ee746c): root cause was the libc mimalloc shim (allocator page retention, not a leak — see forensics comment). Real mimalloc re-attached (Phase 12.2); 7 pass / 0 fail on ReleaseSafe.
  • inspect-error-leak — ✅ CLOSED (4ff003d): ZigException.Holder.deinit was a stub that dropped the pin's deferred resetArena — every inspected error left one full transpile in the module loader arena (74MB/100k iters). Now passes with 'RSS increased by 4 MB', exactly real Bun's number.
  • node:util test-aborted gc-cleanup — ✅ CLOSED (d459e0d): FinalizationRegistry callbacks never fired AT ALL — JSCScheduler.zig was a no-op placeholder and the two event-loop exports were noop stubs, severing JSC's DeferredWorkTimer delivery chain. Pin's scheduler ported; test-aborted now 5/5 (gc-cleanup passes in 2.5ms).
  • (new) HTMLRewriter handler leak — reclassified, NOT a leak: all 58 lol_html_* symbols are noop stubs (lol-html Rust crate unported — link_bun_rust_archive = false); the child panics on the first .on() (else => unreachable on a garbage return at lolhtml_sys/lol_html.zig:253) and the test fails on stderr. Belongs with section E as an unported-library item: link lol_html_c_api (rlibs exist in the Bun build tree), delete the stubs, and restore the pin's HTMLString.toString free (lol_html.zig:623 — latent leak once real lolhtml links).

G. Environmental / infra (mostly resolved)

  • Test runner: home test defaults to native bun:test runner (078c659)
  • bun:internal-for-testing gated in release (13deb08)
  • node v24 + bun v1.3.14 installed via pantry (clears differential-spawn "node not found" failures)
  • Build recovery recipe after /tmp wipe (memory: home-build-portability.md)

Done this session (context)

signals (db0df4d), native-VM file runner (f296bb6), Worker cross-thread + teardown (dcb6db6, 85aba46), native test runner default (078c659), translateUVErrorToE (188268e), Bun.markdown renderer (2768d9a), MD4 (1279c18), Bun.CSRF (96b8f05), node:tls SecureContext ~40 tests (6cf4a6b), release build + build-recovery (dff7bfa, df83921, 13deb08).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions