testing/cross_backend/rust_spine_consumer_surface.ts

The declared surface of a consumer served by the Rust spine, for its cross suites — create_rust_spine_consumer_surface_spec.

The usual Rust spine consumer server mounts the same spine routes whatever its domain: /health, fuz_auth::account_router under /api/account (ACCOUNT_ROUTER_PATHS), the bootstrap and signup routers beside it, and one RPC endpoint carrying the standard admin / role-grant-offer / account actions plus the consumer's own. This module builds that surface from the hono-free route shapes and the consumer's action specs, so a consumer supplies only what is its own. A server that mounts no signup router (a single-keeper daemon) is not this shape.

The route shapes come from create_account_route_shapes and friends, never the live route factories, which statically pull hono/cookie and hono/streaming. Handlers are never invoked — the suites read method, path, auth and the schemas, and live dispatch happens in the spawned binary — so routes and actions carry no-op handlers.

view source

Declarations
#

5 declarations

ACCOUNT_ROUTER_PATHS
#

testing/cross_backend/rust_spine_consumer_surface.ts view source

readonly ["/status", "/login", "/logout", "/password"] import {ACCOUNT_ROUTER_PATHS} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_consumer_surface.js';

The routes fuz_auth::account_router mounts, relative to /api/account. An allowlist rather than every account route shape: /verify is a TS-only route the Rust router doesn't serve, so declaring it would have the suites probe a 404. A shape fuz_app renames or drops fails the surface build; one it adds stays off the surface until the Rust router mounts it and this list names it.

create_rust_spine_consumer_rpc_endpoints
#

testing/cross_backend/rust_spine_consumer_surface.ts view source

(options: RustSpineConsumerRpcEndpointsOptions): (ctx: AppServerContext) => RpcEndpointSpec[] import {create_rust_spine_consumer_rpc_endpoints} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_consumer_surface.js';

The RPC endpoints a Rust spine consumer mounts: the standard admin / role-grant-offer / account actions, the extra families, then the domain specs — what describe_spine_cross_suites takes as rpc_endpoints.

options

the consumer's action specs, extras and roles

returns

(ctx: AppServerContext) => RpcEndpointSpec[]

the endpoints, as a factory of the stub context

throws

  • Error - when an `exclude_methods` entry names no domain spec

create_rust_spine_consumer_surface_spec
#

testing/cross_backend/rust_spine_consumer_surface.ts view source

(options: RustSpineConsumerSurfaceSpecOptions): AppSurfaceSpec import {create_rust_spine_consumer_surface_spec} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_consumer_surface.js';

Build the declared surface of a Rust spine consumer for its cross suites, on create_test_app_surface_spec: the spine routes (health, the account router's paths, signup, and bootstrap as a surface_only shape), the RPC endpoint from create_rust_spine_consumer_rpc_endpoints, the daemon-token layer every consumer test binary wires, and — with host_gate — the host_validation layer at the head of the middleware list.

options

the consumer's session config, action specs, extras and roles

returns

AppSurfaceSpec

the surface spec, for describe_spine_cross_suites's surface_source

throws

  • Error - when an account route shape the Rust router mounts is missing, or an `exclude_methods` entry names no domain spec

RustSpineConsumerRpcEndpointsOptions
#

testing/cross_backend/rust_spine_consumer_surface.ts view source

RustSpineConsumerRpcEndpointsOptions import type {RustSpineConsumerRpcEndpointsOptions} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_consumer_surface.js';

domain_action_specs

The consumer's own action specs. The request-response specs that aren't protocol actions (heartbeat, peer/ping, …) go on the RPC endpoint, so a full registry like all_action_specs can be passed as it is.

type readonly ActionSpecUnion[]

readonly

extra_rpc_actions?

Actions besides the standard set and the domain specs — opt-in families the consumer mounts (create_actor_lookup_actions, create_self_service_role_actions), built against the stub context.

type (ctx: AppServerContext): RpcAction[]

readonly

ctx

returns RpcAction[]

roles?

The consumer's role schema, for the standard admin and role-grant-offer actions.

type RoleSchemaResult

readonly

exclude_methods?

Domain methods kept off the declared surface — ones the spec-derived suites can't drive (an input whose .refine() the generic body generator can't satisfy). They stay mounted on the backend; this only leaves them out of what the suites enumerate.

type readonly string[]

readonly

rpc_path?

The RPC endpoint's path. Default SPINE_RPC_PATH.

type string

readonly

RustSpineConsumerSurfaceSpecOptions
#

testing/cross_backend/rust_spine_consumer_surface.ts view source

RustSpineConsumerSurfaceSpecOptions import type {RustSpineConsumerSurfaceSpecOptions} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_consumer_surface.js';

inheritance

session_options

The backend's session config — its cookie name above all.

type SessionOptions<string>

readonly

host_gate?

Whether the server turns on the spine's opt-in host gate (fuz_http::StackOptions::host_gate), declared as a host_validation layer at the head of the middleware list.

type boolean

readonly
default false

Depends on
#