ReviewOS

home-lang/home

Bun parity: bound WebSocket permessage-deflate decoding

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

Parent: #66 Predecessor: #396

Corpus position 4210/4708: js/web/websocket/websocket-permessage-deflate-edge-cases.test.ts.

Complete permessage-deflate negotiation and receive semantics across Bun.serve, Bun-listener, and raw node:net topologies. Server-to-client messages queued from open() must publish as tasks so listeners installed after awaiting open cannot miss them. Raw 101 handling must preserve pipelined frame bytes, validate the accept key, accept both node:net server registration styles, assemble continuation frames, enforce RSV/opcode rules, decode text/binary payloads, and cap inflated output at 128 MiB.

Oversized messages must emit a real structured ErrorEvent (ERR_WEBSOCKET_MESSAGE_TOO_BIG, receive/decompress phase, cause, byte counts/limit, source-aware stack) and close with 1009 / Message too big, never degrade to 1006. Add permanent exact-file and diagnostic-contract regressions. Acceptance: unchanged upstream file 5/5, zero failed/todo/unsupported/allowed-empty.

10 days ago

Completed by ff03961 (feat(websocket): bound permessage deflate decoding).\n\nPorted the position-4210 contracts, including negotiated permessage-deflate across Bun.serve, Bun listener, and raw net handshakes; fragmented compressed messages; bounded 128 MiB inflation; structured receive errors and 1009 closure; task-order delivery; pipelined 101 bytes; and both net server registration styles.\n\nVerification:\n- exact upstream websocket-permessage-deflate-edge-cases.test.ts: 5 passed, 0 failed\n- contiguous upstream positions 4202-4210: 9 files, 59 passed, 0 failed/todo/unsupported/allowed\n- permanent focused structured-error regression: passed\n- zig fmt --check and git diff --check: passed\n\nContinues #396 and advances #66.

Sign in to comment on this issue.