testing/cross_backend/request_target_conformance_wire.ts

The request target conformance table over raw sockets: each wire row of request_target_conformance.json sent to the live backend with its target written byte for byte, and the answer's status, error code and — on a JSON-RPC answer — envelope id, error code and data.reason asserted, with the Allow methods, a plain-text body, a HEAD answer's media type and the session cookie's clear where the row pins them.

Where the unit legs run each spine's strict readers over a query string or a path segment, this sends the target: the runtime's request-line parser, its URL, the router and the route's own phases sit between the bytes and the answer, so it is what proves every surface that reads the query or the path params reads them through the strict readers, in the phase order the row pins, and that both routers answer a method a path doesn't serve, and a path nothing serves, alike. A fetch client can't send these targets — it would re-encode them — so the leg is raw-socket, and cross-process only. It needs no backdoor.

A row is sent by its principal (keeper_session: the fixture's keeper cookie; none: no credential; invalid_session: the session cookie's name with a value that doesn't verify), with its origin as the one Origin line or none, its host in place of the backend's Host, and its headers as written. The rows run as one test per set of capabilities they require, each skipped — visibly — on a backend not declaring every one: a backend serving a fallback of its own outside /api (spine_fallback: false) skips the rows that land there and runs the rest. A row holding expect_where_dot_segments_resolved expects that answer on a backend whose runtime resolves dot segments (capabilities.runtime_resolves_dot_segments) and its expect on one whose router reads the raw path. A HEAD row's answer must carry no body. An upgrade row is a WebSocket upgrade (capabilities.ws): a 101 is the handshake accepted, and a refusal's code is read where the runtime sends its body (capabilities.ws_refusal_body).

What it needs of a backend: the spine's RPC endpoint with account_verify on rpc_path, the account status and login routes, the WebSocket endpoint on ws_path, the audit stream on sse_path, GET alone on health_path, nothing else at the paths its routing rows name as unmatched, and the fact routes at /api/facts/:hash and /api/cells/:cell_id/facts/:hash, each as its capability declares, and a single-actor keeper (no extra_actors) that holds the WebSocket upgrade's roles.

view source

Declarations
#

2 declarations

describe_request_target_conformance_wire_cross_tests
#

RequestTargetConformanceWireCrossTestOptions
#

testing/cross_backend/request_target_conformance_wire.ts view source

RequestTargetConformanceWireCrossTestOptions import type {RequestTargetConformanceWireCrossTestOptions} from '@fuzdev/fuz_app/testing/cross_backend/request_target_conformance_wire.js';

setup_test

Per-test fixture producer (cross-process), seeding no extra_actors.

type (): Promise<TestFixture>

readonly
returns Promise<TestFixture>

capabilities

ws, sse, account_status, fact_serving, fact_serving_admin_hash and spine_fallback gate the rows that require them; ws_refusal_body whether a refused upgrade's code is read, and runtime_resolves_dot_segments which answer a dot-segment row expects.

type BackendCapabilities

readonly

base_url

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

type string

readonly

rpc_path?

JSON-RPC endpoint path. Default SPINE_RPC_PATH.

type string

readonly

ws_path?

WebSocket endpoint path. Default SPINE_WS_PATH.

type string

readonly

account_status_path?

Account status route path. Default SPINE_ACCOUNT_STATUS_PATH.

type string

readonly

account_login_path?

Login route path, the POST-only route. Default SPINE_ACCOUNT_LOGIN_PATH.

type string

readonly

sse_path?

Audit stream path, the SSE route. Default SPINE_SSE_PATH.

type string

readonly

health_path?

Health probe path, the route outside the auth scope. Default /health.

type string

readonly

Depends on
#

Imported by
#