ReviewOS

home-lang/home

Bun parity: preserve Connection headers after typed arrow erasure

#353
Closed chris opened this 10 days ago ·
10 days ago

Corpus location

  • Position: 4129
  • File: js/web/fetch/fetch-connection-header.test.ts
  • First observed failure: SyntaxError: Unexpected token ':'. Expected ')' to end an argument list.

Required parity

  • Correctly erase the typed async arrow signature (fetchOptions: RequestInit): Promise<Record<string, string>> => without damaging the surrounding JavaScript.
  • Erase the local Record<string, string> annotation used by the captured-header object.
  • Preserve explicit Connection values and their value casing while matching the header name case-insensitively.
  • Provide Bun's default Connection: keep-alive when the caller does not supply the header.
  • Preserve other request headers alongside Connection.
  • Keep any header validation failures structured with stable operation/header context, causes, and useful stacks.

Completion gate

  • Make the complete copied Bun corpus file pass.
  • Add focused rewrite/runtime regressions and pin the file in the permanent HTTP/web mini-suite.
  • Keep copied-corpus accounting and the project build green.

Parent tracker: #66

10 days ago

Implemented and pushed to main in 9a5d459c7dfd109ea1c83389a2e9e1abde15ec77.

  • Bootstrap TypeScript erasure now removes the typed async arrow return signature and Record<string, string> local annotation without leaving invalid JavaScript.
  • HTTP/1.1 fetch dispatch supplies Bun's default Connection: keep-alive only when the caller did not provide a value.
  • Explicit Connection values retain their casing, header names remain case-insensitive, and accompanying headers are preserved.
  • Added a focused rewrite/runtime regression and pinned the file in the permanent HTTP/web mini-suite.

Verification:

  • js/web/fetch/fetch-connection-header.test.ts: 10 passed, 0 failed, 0 todo, 0 unsupported
  • js/web/fetch/fetch-cyclic-reference.test.ts: 2 passed, 0 failed, 0 todo, 0 unsupported
  • focused Connection-header regression: passed
  • permanent HTTP/web tail queue: passed
  • zig build --cache-dir /private/tmp/home-zig-abi-cache: passed

Sign in to comment on this issue.