ReviewOS

home-lang/home

Enforce strict RFC 6455 WebSocket subprotocol responses

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

Tracks Home’s port of Bun corpus position 4218 (js/web/websocket/websocket-subprotocol-strict.test.ts).

Scope:

  • reject comma-combined, duplicate, empty, and unoffered Sec-WebSocket-Protocol response values
  • accept exactly one offered protocol and expose it on WebSocket.protocol
  • close invalid negotiations with RFC 6455 code 1002 and reason Mismatch client protocol
  • retain actionable WebSocketSubprotocolError context: code, operation, phase, offered/received protocols, close metadata, cause, and source-aware stack
  • validate both raw socket and Bun-listener handshake paths

Acceptance evidence:

  • 18 passing tests
  • 0 todos
  • 0 failures
  • 0 unsupported cases
  • 0 allowed-empty cases

Implementation: f845cdb Parent tracker: #66

10 days ago

Completed in f845cdb.

Verified js/web/websocket/websocket-subprotocol-strict.test.ts: 18 pass, 0 todo, 0 fail, 0 unsupported, 0 allowed-empty. The focused regression also validates structured negotiation error fields, causal/source stack, and RFC close code/reason. Continued in #66.

Sign in to comment on this issue.