testing/cross_backend/action_manifest.ts

Cross-impl RPC action-manifest introspection — a normalized, JSON-serializable dump of a backend's live RPC method set, one entry per method carrying its input shape, auth shape, side-effect flag, and rate-limit class.

The sibling of schema_introspect.ts's SchemaSnapshot: where that captures the live *database* shape for the schema-parity gate, this captures the live *RPC registry* shape for the action-manifest parity gate. Both are dumped over a daemon-token _testing_* introspection action (_testing_action_manifest here, _testing_schema_snapshot there) and diffed across the TS spine and the Rust testing_spine_stub so a method-set or per-method auth-shape divergence fails loud. This complements the in-repo spine_method_coverage gate: that proves *mounted ⟹ covered*; this proves *TS-mount-set ≡ Rust-mount-set* (method set + auth shape).

Scope — domain + testing surface, not wire protocol. Protocol actions (heartbeat / cancel / peer/ping) are excluded: on the TS spine create_testing_action_manifest_action filters them via the protocol_action_specs method set; the Rust stub drops PROTOCOL_ACTION_SPECS. The two impls organize protocol actions differently (peer/ping is on the TS spine's WS and HTTP-RPC endpoints — it must answer peer_no_transport over HTTP — while heartbeat/cancel stay WS-only; the Rust stub compiles one shared registry serving both transports), so including them would be a spurious cross-impl diff. This matches the scope of the in-repo spine_method_coverage gate (also over build_full_spine_rpc_actions).

Paired with action_manifest_parity.ts for the diff + assertion helpers.

view source

Declarations
#

4 declarations

action_manifest_entry
#

testing/cross_backend/action_manifest.ts view source

(spec: { readonly method: string; readonly input: AnySchema; readonly auth: RouteAuth; readonly side_effects: boolean; readonly rate_limit?: "both" | "account" | "ip" | undefined; }): { ...; } import {action_manifest_entry} from '@fuzdev/fuz_app/testing/cross_backend/action_manifest.js';

Normalize one spec's input shape + auth + side-effects into a manifest entry. Reads the input shape off is_void_schema(spec.input), pulls the four auth axes off RouteAuth (the same shape the Rust AuthSpec mirrors), and flattens optional roles / credential_types to sorted arrays.

spec

type { readonly method: string; readonly input: AnySchema; readonly auth: RouteAuth; readonly side_effects: boolean; readonly rate_limit?: "both" | "account" | "ip" | undefined; }

returns

ActionManifestEntry

ActionManifest
#

testing/cross_backend/action_manifest.ts view source

value + type

{ methods: { method: string; input: "object" | "void"; side_effects: boolean; account: "optional" | "none" | "required"; actor: "optional" | "none" | "required"; roles: string[]; credential_types: string[]; rate_limit: "both" | ... 2 more ... | null; }[]; } import {ActionManifest} from '@fuzdev/fuz_app/testing/cross_backend/action_manifest.js';

The full action manifest — every entry, sorted by method.

methods

type ActionManifestEntry[]

ActionManifestEntry
#

testing/cross_backend/action_manifest.ts view source

value + type

{ method: string; input: "object" | "void"; side_effects: boolean; account: "optional" | "none" | "required"; actor: "optional" | "none" | "required"; roles: string[]; credential_types: string[]; rate_limit: "both" | ... 2 more ... | null; } import {ActionManifestEntry} from '@fuzdev/fuz_app/testing/cross_backend/action_manifest.js';

One method's normalized RPC metadata — the cross-impl-comparable unit. roles / credential_types are always present + sorted (an absent gate and an empty list both serialize to []) so the diff never trips on a undefined-vs-[] or declaration-order difference between impls; the auth axes reuse the canonical AuthAxisState enum. rate_limit is nullable rather than optional for the same reason — an unthrottled action serializes an explicit null, so a missing key is drift, not a default.

method

RPC method name (spec.method).

type string

input

'void' when the input is a void schema (is_void_schema: s.void, a parameterless method), else 'object' — the Rust spine's declared InputShape, which its dispatcher enforces. An object({}) input is 'object'.

type "object" | "void"

side_effects

true when the action declares side_effects (mutation; POST-only on the RPC transport).

type boolean

account

The account auth axis.

type "optional" | "none" | "required"

actor

The actor auth axis.

type "optional" | "none" | "required"

roles

Required roles (any-of), sorted; [] when the action declares no role gate.

type string[]

credential_types

Permitted credential channels, sorted; [] when ungated (any credential).

type string[]

rate_limit

Per-action rate-limit class, or null when the action declares none.

type "both" | "account" | "ip" | null

build_action_manifest
#

testing/cross_backend/action_manifest.ts view source

(specs: readonly Pick<RequestResponseActionSpec, "method" | "input" | "side_effects" | "rate_limit" | "auth">[]): { methods: { method: string; input: "object" | "void"; ... 5 more ...; rate_limit: "both" | ... 2 more ... | null; }[]; } import {build_action_manifest} from '@fuzdev/fuz_app/testing/cross_backend/action_manifest.js';

Build the normalized ActionManifest from a list of request-response specs. Entries are sorted by method so two impls producing the same set serialize identically regardless of mount order. The caller owns the scope it passes (the TS spine passes its full mount; the Rust stub filters PROTOCOL_ACTION_SPECS first) — see the module doc.

specs

type readonly Pick<RequestResponseActionSpec, "method" | "input" | "auth" | "side_effects" | "rate_limit">[]

returns

ActionManifest

Depends on
#

Imported by
#