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
#

2 declarations

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';

setup_test

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

type (): Promise<TestFixtureBase>

readonly
returns Promise<TestFixtureBase>

capabilities

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

type BackendCapabilities

readonly

base_url

Base URL the backend is reachable at (e.g. http://localhost:1177).

type string

readonly

ws_path

WebSocket endpoint path on the backend (e.g. /api/ws).

type string

readonly

Depends on
#