testing/cross_backend/ws_inbound_dispatch.ts

Cross-process suite for the two refusals a WebSocket request can meet ahead of dispatch — the same on both spines, pinned over a real upgrade:

  • a request whose id names a request still running on the socket is answered invalid_request with data.reason: 'duplicate_request_id' and not dispatched; the running request keeps the id and answers as usual, and once it has answered the id is free again
  • past the per-socket in-flight ceiling (128 on both spines) a new request is answered queue_overflow with its id and not dispatched; the socket stays open, the running requests still answer, and the duplicate check comes first

A request has to stay in flight for either to be observable, so the suite holds requests with peer/ping: the server's handler pings the client back and waits for the echo, and the client's responder withholds it until the test releases it. Gated on capabilities.peer_request for that reason.

The wire literals are deliberate independent copies of the producers' constants (ERROR_DUPLICATE_REQUEST_ID, MAX_INBOUND_DISPATCHES_PER_CONNECTION, WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE on TS; their Rust twins in fuz_realtime) — parity by test, so a value renamed on one side fails here instead of moving both at once.

Cross-process only: create_ws_transport needs a real bound socket, so wire it from a *.cross.test.ts file.

view source

Declarations
#

3 declarations

create_holding_peer_ping_responder
#

testing/cross_backend/ws_inbound_dispatch.ts view source

(): { responder: WsRequestResponder; release: () => void; pinged: (count: number) => Promise<void>; } import {create_holding_peer_ping_responder} from '@fuzdev/fuz_app/testing/cross_backend/ws_inbound_dispatch.js';

A client responder that withholds every server-initiated peer/ping echo until release — so each client peer/ping stays in flight on the server — and answers at once after it. Shared with the WS envelope suite's cancel cases.

returns

{ responder: WsRequestResponder; release: () => void; pinged: (count: number) => Promise<void>; }

the responder, its release, and pinged(count), resolving once count pings have reached the client

describe_ws_inbound_dispatch_cross_tests
#

WsInboundDispatchCrossTestOptions
#

testing/cross_backend/ws_inbound_dispatch.ts view source

WsInboundDispatchCrossTestOptions import type {WsInboundDispatchCrossTestOptions} from '@fuzdev/fuz_app/testing/cross_backend/ws_inbound_dispatch.js';

inheritance

setup_test

Per-test fixture producer (default_cross_process_setup(handle)).

type (): Promise<TestFixture>

readonly
returns Promise<TestFixture>

capabilities

Backend capability flags; every case gates on capabilities.peer_request.

type BackendCapabilities

readonly

Depends on
#

Imported by
#