ReviewOS

home-lang/home

Bun parity: preserve fragmented WebSocket close payloads

#395
Closed chris opened this 11 days ago ·
11 days ago

Parent: #66 Predecessor: #394

Corpus position 4208/4708: js/web/websocket/websocket-close-fragmented.test.ts.

The raw Bun TCP fixture must run through the shared in-memory listener topology, retain an incomplete close frame until its full declared payload arrives, decode the received close code and UTF-8 reason, send the masked close reply, and publish the correct clean CloseEvent. The current parser discards the received payload by routing opcode 8 through parameterless close(), producing an empty reason.

Implement general RFC 6455 close-payload handling rather than special-casing this fixture: bodyless frames report 1005, reserved/invalid wire codes report 1002, malformed UTF-8 reports 1007, and valid codes/reasons pass through. Add permanent exact-file and payload-matrix regressions. Acceptance: unchanged upstream file 1/1, zero failed/todo/unsupported/allowed-empty.

11 days ago

Completed and pushed in b606d35 (fix(websocket): preserve fragmented close payloads).

The unchanged position-4208 file is 1/1, and the exact 4202-4208 range is 7 files / 44 passed / 0 failed / 0 todo / 0 unsupported / 0 allowed-empty.

Home now retains incomplete close frames until the entire declared payload is present; decodes and validates close status/reason; preserves valid UTF-8 reasons across TCP splits; maps bodyless, reserved-code, and malformed-UTF-8 frames to 1005/1002/1007; sends a masked reply; tears down the transport; and emits the clean CloseEvent. Permanent exact-file and four-case payload regressions pass. Parent: #66; predecessor: #394.

Sign in to comment on this issue.