Test-binary RPC actions for cross-process integration tests.
Six 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), and
_testing_migration_tracker (dump the schema_version tracker rows for
cross-impl migration-identity parity — the provenance half the snapshot gate
excludes by design).
A further daemon-token action, _testing_action_manifest (dump the live
RPC registry for cross-impl method-set + auth-shape parity), lives here too
but is not bundled by create_testing_actions — it must enumerate
*every* mounted method, so it's appended at the full-mount layer
(build_full_spine_rpc_actions) where the complete list exists.
_testing_reset — full DB wipe + keeper re-seed + optional
secondary-account seeding. The
handler 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), seeds any
caller-requested extra_accounts (also direct-inserted at this
setup step), refreshes the daemon-token cache to point at the new
keeper, and fires the consumer-supplied domain-state callback. The
new keeper + secondary credentials return as the action output so
the per-test fixture closes over them.
The redesign converges in-process and cross-process keeper
lifetimes: both modes now run against a freshly bootstrapped keeper
per test. 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. Earlier drafts considered a separate
_testing_seed_role_grant action for arbitrary direct grants; that
was rejected because 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.