testing/cross_backend/bench/scenario.ts

Context handed to a BenchScenario.run. Carries a ready, pre-authed transport (the bootstrapped keeper's, by default) plus the resolved RPC path and the backend's declared capabilities. A scenario fires one round trip (or a small fixed *idempotent* sequence) against it — no per-call _testing_reset, which is the correctness-test model and would dominate the timing.

view source

Declarations
#

3 declarations

BenchScenario
#

testing/cross_backend/bench/scenario.ts view source

BenchScenario import type {BenchScenario} from '@fuzdev/fuz_app/testing/cross_backend/bench/scenario.js';

One benchmarkable wire scenario. The run body is the Benchmark task fn: it must throw on a non-success response so the benchmark records a failed iteration rather than timing an error path as if it succeeded.

Scenarios should be idempotent — they run thousands of times against a single bootstrapped backend with no reset between iterations. Prefer reads; a mutating scenario must not accumulate unbounded state.

name

Scenario name (groups the per-backend results in the report).

type string

readonly

requires?

Optional capability gate — return false to skip this scenario on a backend that can't serve it (e.g. a WS scenario needs capabilities.ws).

type (capabilities: BackendCapabilities) => boolean

readonly

run

The timed body. Throws on a non-success response.

type (ctx: BenchScenarioContext) => Promise<void>

readonly

BenchScenarioContext
#

testing/cross_backend/bench/scenario.ts view source

BenchScenarioContext import type {BenchScenarioContext} from '@fuzdev/fuz_app/testing/cross_backend/bench/scenario.js';

transport

Pre-authed transport — the bootstrapped keeper's session cookie jar.

type FetchTransport

readonly

rpc_path

RPC endpoint path, e.g. '/api/rpc'.

type string

readonly

capabilities

Declared capabilities of the backend this context targets.

type BackendCapabilities

readonly

default_bench_scenarios
#

testing/cross_backend/bench/scenario.ts view source

readonly BenchScenario[] import {default_bench_scenarios} from '@fuzdev/fuz_app/testing/cross_backend/bench/scenario.js';

Starter cross-impl scenarios — all on the standard spine surface, so they run on every backend (TS Hono, Rust spine), and all reads, so they're safe to repeat against one bootstrapped keeper without state accumulation.

  • account_verify — the dispatch + auth-resolve floor (no real query work).
  • account_session_list — an authed DB read.
  • audit_log_list — an admin paginated read (the keeper holds ROLE_ADMIN).

login is deliberately omitted: the cross-process test binaries wire a fast TestingArgon2idHasher, so a login scenario would measure dispatch rather than real Argon2 cost — misleading without its own clearly-labeled tier.

Depends on
#

Imported by
#