ReviewOS

home-lang/home

Bun parity: isolate split CONNECT proxy envelopes

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

Corpus position 4140 (fetch-proxy-connect-tunnel-split-envelope.test.ts) guards Bun #30381.

Scope:

  • parse a CONNECT 200 envelope incrementally across TCP reads
  • discard proxy-only headers before parsing the tunneled upstream response
  • decode the upstream chunked body and recognize its terminator without waiting for FIN
  • prevent Proxy-Agent/Connection leakage into the user response
  • model the subprocess fixture through the same parser
  • surface structured tunnel parse errors with operation, phase, byte counts, cause, and composed stack
  • add permanent focused coverage and advance the zero-failure frontier.

First failure: the child fixture produces no JSON response, leading to JSON Parse error: Unexpected EOF.

10 days ago

Completed and pushed in a019131 (fix(fetch): isolate CONNECT tunnel envelopes).

Implemented:

  • incremental CONNECT response parsing across arbitrary TCP chunk boundaries
  • strict successful CONNECT status validation
  • proxy envelope buffer isolation before upstream parsing
  • upstream HTTP/chunked response parsing that completes on the terminal chunk without waiting for FIN
  • proxy-only header exclusion from the user-facing response
  • deterministic subprocess fixture execution through the same parser
  • structured FetchProxyTunnelError with stable code, operation, phase, endpoint, received/proxy byte counts, cause, and composed stack
  • permanent focused regression

Verification:

  • upstream split-envelope regression: 1 passed, 0 failed/unsupported
  • focused split CONNECT regression: pass
  • full zig build: pass

Corpus frontier through position 4140: 481 files, 6,875 passed, 281 todo, 172 allowed-empty, 0 failed, 0 unsupported.

Sign in to comment on this issue.