Test-binary RPC actions for cross-process integration tests.
The daemon-token-authed actions bundled by create_testing_actions:
_testing_reset (DB wipe + keeper re-seed), _testing_drain_effects
(audit barrier), _testing_mint_session (forge an
expired-by-construction server-side session for the expiry conformance
cases), _testing_put_fact (seed an embedded fact for the fact-serving
suite), _testing_schema_snapshot (introspect the live schema for
cross-impl parity diffing against a Rust backend's fuz_db snapshot),
_testing_migration_tracker (dump the schema_version tracker rows for
cross-impl migration-identity parity — the provenance half the snapshot gate
excludes by design), and _testing_flood_notifications (queue a burst
of notifications onto the caller's own WebSocket connection, to push its
outbound queue past its byte budget).
Two further daemon-token actions live here but are not bundled by
create_testing_actions, and are appended at the full-mount layer
(build_full_spine_rpc_actions) instead: _testing_action_manifest
(dump the live RPC registry for cross-impl method-set + auth-shape parity —
it must enumerate *every* mounted method, so it goes where the complete list
exists) and _testing_shorten_credential_expiry (pull an account's
credential expiries in to seconds from now, shorten-only, for the
credential-deadline cases) — the latter kept out of the bundle so a consumer
whose Rust binary doesn't mount its mirror keeps a green manifest gate.
_testing_origin_check, mounted the same way, lives in the hono-free
testing_origin_check.ts.
_testing_reset — full DB wipe + keeper re-seed + optional
secondary-account seeding. The
handler first fires the consumer-supplied domain-state callback (domain
rows depend on auth rows, so a domain table with a restricting FK to
actor empties before the rows it references go), then wipes every
auth-namespace row (no keeper-preserve filter),
flips bootstrap_lock back to its post-bootstrap shape, seeds a
fresh keeper account inline (reusing create_test_account_with_credentials
so cross-process matches in-process write semantics), queues the
daemon-token cache refresh to point at the new keeper once the reset
commits, and seeds any caller-requested extra_accounts (also
direct-inserted at this setup step). The
new keeper + secondary credentials return as the action output so
the per-test fixture closes over them.
In-process and cross-process keeper lifetimes match: both modes run
against a freshly bootstrapped keeper per test, so mutation-cascade
tests (password change, revoke-all, hardcoded-username signup
uniqueness) and direct keeper-vs-admin probes work uniformly
cross-process.
Keeper ≠ admin. The keeper and admin roles are independent.
Keeper authorizes daemon-token / bootstrap paths; admin authorizes
the user-facing admin RPC surface. _testing_reset seeds the keeper
account with [ROLE_KEEPER, ROLE_ADMIN] by default — matching the
production bootstrap_account flow — plus any roles passed via
extra_keeper_roles. Tests probing the keeper-vs-admin separation
(a keeper-only account must 403 on admin RPCs) declare a secondary
via extra_accounts: [{username, roles: [ROLE_KEEPER]}] so the
account is seeded at this same bootstrap-equivalent step.
No free-form runtime bypass. There is no action for arbitrary
direct role grants: a runtime bypass would let tests skip the
production consent flow's side-effects (audit emit, WS fan-out) and
silently mask bugs in those paths. The bypass that does exist —
extra_accounts — is framed as bootstrap-time seeding, the same
shape bootstrap_account itself uses to grant the initial
KEEPER + ADMIN pair. Tests that want a role on a *post-bootstrap*
account must route through role_grant_offer_create +
role_grant_offer_accept (the production path); they observe the
full event chain.
Production safety: this module lives under cross_backend/ and starts
with import '../assert_dev_env.ts'; — production bundles either
tree-shake the module out or throw at startup. The Rust mirror
(fuz_testing crate) ships a parallel action; `cargo xtask
check-release blocks fuz_testing` from entering production dep
graphs.