testing/cross_backend/token_lifetime.ts

Cross-backend parity suite for the API token lifetime axis of account_token_create — the round-trip that keeps a one-sided landing impossible.

Why this suite exists

The action-manifest parity gate captures {method, side_effects, auth} and no param schemas, while the TS spine validates params against a Zod strictObject and the Rust spine hand-parses with params.get(...). So a spine that silently ignored the lifetime field would answer the same mint request with a 200 and an eternal token — same method, same status, nothing red anywhere. The forcing function has to observe the *stored* state: mint with a TTL, then read expires_at back off the wire.

What it pins

  • A TTL mint stores a bounded expiryaccount_token_create with {kind:'ttl', days} returns a non-null expires_at (create output *and* account_token_list), landing within a generous window around now + days. A spine that dropped the field returns null and fails.
  • An eternal mint stores NULL — the control: {kind:'eternal'} yields expires_at: null on both reads.
  • An omitted lifetime is refusedlifetime is required; a mint without it must 400 invalid_params on both spines. This is the direct pin on the silently-ignoring-unknown-shapes hazard.
  • Out-of-range days are refuseddays: 0 400s identically, so the two hand-rolled bounds checks can't drift.

$lib-free by contract (relative specifiers only), like the sibling cross-backend suites. Runs both legs — in-process (gro test) and cross-process — through the shared {setup_test} protocol.

view source

Declarations
#

2 declarations

describe_token_lifetime_cross_tests
#

TokenLifetimeCrossTestOptions
#

testing/cross_backend/token_lifetime.ts view source

TokenLifetimeCrossTestOptions import type {TokenLifetimeCrossTestOptions} from '@fuzdev/fuz_app/testing/cross_backend/token_lifetime.js';

Options for the token-lifetime parity suite. Ungated — the mint + list pair is on every spine's standard surface, so there is no capability flag (the sibling of identity_parity.ts rather than the cell suites).

setup_test

Per-test fixture-producing function (fresh keeper + db per call).

type SetupTest

readonly

rpc_path?

RPC endpoint path the methods are mounted on. Default /api/rpc.

type string

readonly

Depends on
#