testing/cross_backend/conformance_table.ts

Table runner for the declarative cross-backend conformance suite.

describe_conformance_table_tests takes a list of ConformanceCase rows plus the standard {setup_test, surface_source, capabilities} fixture protocol every Tier 1 suite uses — so one runner drives both transports: in-process via default_in_process_setup (fast, every gro test) and cross-process via default_cross_process_setup (the conformance gate, exercising each impl's real auth resolution over real HTTP). Same case definition, transport-parameterized.

Each row references a method; the runner resolves its input / output schema from the live spec registry (RPC) or RouteSpec (the 6 REST auth routes) — the row never carries a schema. The principal the row runs as resolves to a TestFixture accessor via resolve_conformance_principal — no inline credential minting.

Every response also passes an always-on no-fingerprint invariant (assert_no_fingerprint_headers over FINGERPRINT_HEADERS — Server / X-Powered-By / WWW-Authenticate must stay absent on both spines), and a row may pin further header expectations via expect.headers. Headers are deliberately kept out of the equivalence-group {status, body} comparison.

Given ws, the runner sends each case as a frame on a WebSocket instead: the principal opens an admitted socket and the frame meets the per-message gates. The frame carries the same JSON-RPC envelope the HTTP body does, so the same rows hold, read through the status the HTTP binding maps the frame's error code to; the cases a socket can't carry are left out (is_ws_conformance_case).

A case binding request.acting gets params.acting filled with a real actor id at run time (ConformanceActingBinding), so rows can act as a named actor of a multi-actor keeper without knowing its id.

A case's RPC method resolves from the declared rpc_endpoints first, then from live_rpc_endpoints when given — the methods a backend live-mounts off the declared surface (cell verbs, opt-in resolvers, _testing_* backdoors), so rows can reach them too.

view source

Declarations
#

15 declarations

assert_expected_headers
#

testing/cross_backend/conformance_table.ts view source

(headers: Record<string, string>, expected: Record<string, string | null>, label: string): void import {assert_expected_headers} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Assert each declared header expectation: a string value must be present and equal (header name matched case-insensitively), null must be absent. The negative-space twin for headers — expect.headers pins a header beyond the always-on no-fingerprint floor.

headers

type Record<string, string>

expected

type Record<string, string | null>

label

type string

returns

void

assert_no_fingerprint_headers
#

testing/cross_backend/conformance_table.ts view source

(headers: Record<string, string>, label: string): void import {assert_no_fingerprint_headers} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Assert a response carries none of the FINGERPRINT_HEADERS. Run on every case unconditionally — the always-on no-fingerprint floor.

headers

type Record<string, string>

label

type string

returns

void

ConformanceCaseResponse
#

testing/cross_backend/conformance_table.ts view source

ConformanceCaseResponse import type {ConformanceCaseResponse} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

One case's request as sent and its response unparsed: the HTTP status, the response-headers snapshot (lowercased keys), and the JSON body exactly as the server sent it — the whole JSON-RPC envelope for an RPC method, undefined for a REST body that is not JSON.

Over a WebSocket the body is the response frame, the headers are empty (a frame carries none), and the status is the one the HTTP binding answers for the frame's outcome: 200 for a result, else jsonrpc_error_code_to_http_status of its error code — so a row's expect.status reads as the error code on both transports.

target

type ConformanceCaseTarget

readonly

status

type number

readonly

headers

type Record<string, string>

readonly

body

type unknown

readonly

ConformanceCaseTarget
#

testing/cross_backend/conformance_table.ts view source

ConformanceCaseTarget

type { readonly kind: "rpc"; readonly path: string; readonly action: RpcAction; } | { readonly kind: "rest"; readonly route: RouteSpec; }

import type {ConformanceCaseTarget} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

The spec a sent case resolved to — the RPC action, or the REST route.

ConformancePrincipalConfig
#

testing/cross_backend/conformance_table.ts view source

ConformancePrincipalConfig import type {ConformancePrincipalConfig} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Names a seeded extra_accounts username for the role_holder / wrong_role principals — the only two that aren't backed by an always-available fixture accessor. Suites exercising those principals declare the matching extra_accounts at setup and name them here.

role_holder?

extra_accounts username for the role_holder principal.

type string

readonly

wrong_role?

extra_accounts username for the wrong_role principal.

type string

readonly

ConformanceRpcEndpointsOptions
#

testing/cross_backend/conformance_table.ts view source

ConformanceRpcEndpointsOptions import type {ConformanceRpcEndpointsOptions} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

rpc_endpoints

The declared RPC endpoints.

type RpcEndpointsSuiteOption

readonly

live_rpc_endpoints?

The live-mounted RPC endpoints, for methods off the declared surface.

type RpcEndpointsSuiteOption

readonly

session_options

Session options — needed to resolve the factory forms.

type SessionOptions<string>

readonly

ConformanceTableOptions
#

testing/cross_backend/conformance_table.ts view source

ConformanceTableOptions import type {ConformanceTableOptions} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

cases

The conformance cases to run, in order.

type readonly ConformanceCase[]

readonly

setup_test

Per-test fixture producer (in-process or cross-process).

type (): Promise<TestFixture>

readonly
returns Promise<TestFixture>

surface_source

Surface spec — supplies the RouteSpecs for the REST branch.

type AppSurfaceSpec

readonly

capabilities

Declared backend capabilities (reserved for capability-gated rows).

type BackendCapabilities

readonly

rpc_endpoints

RPC endpoints — resolved to find each method's action spec.

type RpcEndpointsSuiteOption

readonly

live_rpc_endpoints?

The RPC endpoints the backend live-mounts, for methods kept off the declared rpc_endpoints (cell verbs, opt-in resolvers, _testing_* backdoors). A method resolves from rpc_endpoints first and from here only when the declared surface lacks it, so passing a backend's whole live mount is fine. Omitted, only declared methods resolve.

type RpcEndpointsSuiteOption

readonly

session_options

Session options — needed to resolve the rpc_endpoints factory form.

type SessionOptions<string>

readonly

principals?

Maps the role_holder / wrong_role principals to seeded usernames.

type ConformancePrincipalConfig

readonly

ws?

Run the cases over a WebSocket at this endpoint instead of HTTP: each RPC case's principal opens an admitted socket and sends its request as a frame. Only the cases is_ws_conformance_case admits run; the rest are left out, and so is an equivalence group left with fewer than two members.

type WsEndpointTarget

readonly

suite_name?

describe block label. Defaults to 'conformance table'.

type string

readonly

describe_conformance_table_tests
#

FINGERPRINT_HEADERS
#

testing/cross_backend/conformance_table.ts view source

readonly string[] import {FINGERPRINT_HEADERS} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Response headers that fingerprint the backend implementation or framework. Neither spine emits these; the runner asserts they stay absent on EVERY conformance response so a framework upgrade or consumer middleware that adds (say) Server: to one spine can't silently become a backend-identifying oracle. Lowercased — matched against the lowercased-key snapshot headers_to_record produces.

is_ws_conformance_case
#

testing/cross_backend/conformance_table.ts view source

(c: ConformanceCase): boolean import {is_ws_conformance_case} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Whether a case can run over a WebSocket: an RPC method (not a REST auth route), sent as POST (a GET row pins the HTTP query path), pinning no header value (a frame has no headers; an absence pin holds vacuously), as a principal that can hold a socket.

c

the case

returns

boolean

whether the WS leg runs it

resolve_conformance_principal
#

testing/cross_backend/conformance_table.ts view source

(fixture: TestFixture, as: ConformancePrincipal, principals?: ConformancePrincipalConfig | undefined, resolved_rpc_endpoints?: RpcEndpointSpec[]): Promise<...> import {resolve_conformance_principal} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Map a ConformancePrincipal onto the transport + headers it authenticates with, reading exclusively from the per-test TestFixture.

The five always-available principals resolve from fixture accessors; role_holder / wrong_role read a seeded extra_accounts entry named via options.principals (throws a clear setup error when unconfigured); scoped_token mints its narrowed credential over the production path. Also used outside the table by suites that send a principal's requests themselves (describe_rpc_adversarial_cross_tests).

fixture

the per-test fixture

as

the principal

principals?

usernames for role_holder / wrong_role

optional

resolved_rpc_endpoints?

the endpoints scoped_token mints through

optional default []

returns

Promise<ResolvedConformancePrincipal>

the transport and headers the principal sends with

resolve_conformance_rpc_endpoints
#

testing/cross_backend/conformance_table.ts view source

(options: ConformanceRpcEndpointsOptions): RpcEndpointSpec[] import {resolve_conformance_rpc_endpoints} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Resolve the endpoints a conformance case's RPC method is looked up in: the declared rpc_endpoints, then live_rpc_endpoints. find_rpc_action takes the first match, so a declared method resolves from the declared surface even when the live mount repeats it.

options

the declared and live endpoints, and the session options

returns

RpcEndpointSpec[]

the endpoints in lookup order

ResolvedConformancePrincipal
#

testing/cross_backend/conformance_table.ts view source

ResolvedConformancePrincipal import type {ResolvedConformancePrincipal} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

A resolved principal: the transport + headers a case fires through.

transport

type (url: string, init: RequestInit): Promise<Response>

readonly

url

type string

init

type RequestInit
returns Promise<Response>

headers

type Record<string, string>

readonly

suppress_default_origin?

Suppress the default Origin header on the request. Required for non-browser credential probes (bearer / daemon) — bearer_auth discards the token when Origin / Referer is present.

type boolean

readonly

actor_id?

The actor of the account the credential names — what the principal acting binding writes. Absent for principals that present no account.

type string

readonly

send_conformance_case
#

testing/cross_backend/conformance_table.ts view source

(c: ConformanceCase, options: SendConformanceCaseOptions): Promise<ConformanceCaseResponse> import {send_conformance_case} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

Resolve a case's principal on fixture and send its request, asserting nothing about the response.

The send half of the table runner, shared with the cross-backend differential (describe_differential_conformance_tests), which sends one case to two backends and compares what came back.

c

the case

options

the fixture, surface and endpoints to send through

returns

Promise<ConformanceCaseResponse>

the resolved target and the raw response

throws

  • Error - when the method is on neither the RPC surface nor the REST auth routes

SendConformanceCaseOptions
#

testing/cross_backend/conformance_table.ts view source

SendConformanceCaseOptions import type {SendConformanceCaseOptions} from '@fuzdev/fuz_app/testing/cross_backend/conformance_table.js';

What send_conformance_case needs besides the case.

fixture

The per-test fixture the principal resolves from.

type TestFixture

readonly

surface_source

Surface spec — supplies the RouteSpecs for the REST branch.

type AppSurfaceSpec

readonly

principals?

Usernames for the role_holder / wrong_role principals.

type ConformancePrincipalConfig

readonly

resolved_rpc_endpoints

The endpoints RPC methods (and the scoped_token mint) resolve against — resolve_conformance_rpc_endpoints of the declared and live endpoints.

type RpcEndpointSpec[]

readonly

ws?

Send the request as a frame on a socket at this endpoint instead of over HTTP.

type WsEndpointTarget

readonly

request_headers?

Headers added to the HTTP request beneath the principal's, which win on a name clash. Not sent on the WS leg (a frame carries no headers).

type Readonly<Record<string, string>>

readonly

Depends on
#

Imported by
#