testing/cross_backend/role_grant_participation.ts

Cross-backend parity suite for role-gated participation conferral — the success paths. The imperative escape hatch beneath the declarative conformance_participation_cases.ts: the multi-step flows that need a real recipient account (so a static conformance row can't express them) — an admin assigns the participant app-role, and an admin offers it through the consent flow and the recipient accepts.

Proves the two conferral *write* paths agree on both spines (TS spine binary + Rust testing_spine_stub):

  • immediate assign — role_grant_assign of the admin-grantable participant role lands a grant and returns {ok, role_grant_id}; re-assigning the active grant is idempotent (same id).
  • consent flow — role_grant_offer_create of participant (admin-only) → the recipient role_grant_offer_accepts → a role_grant lands.
  • offer replay — re-accepting an accepted offer whose grant still stands answers 200 with the same role_grant_id and writes no audit row; once the grant is revoked, the replay is refused invalid_request with reason role_grant_offer_terminal (never the revoked grant's id).
  • no self-offer, in either case — an admin offering to its own account is refused invalid_params with reason role_grant_offer_self_target, whether the id is sent lowercase or uppercase: both spines canonicalize the id before comparing it with the grantor's account.
  • scoped assign — role_grant_assign of participant with a paired scope_kind + scope_id lands a scoped grant carrying both, read back through admin_account_list, distinct from the global grant.

The single-request gate/denial matrix (grantability refusal, admin-only conferral, dispatcher admin gate, auth) lives in the declarative table (conformance_participation_cases.ts) — keep new single-request assertions there; this suite is only for flows the table cannot carry.

The participant role is registered admin-grantable on both spines (spine_roles / the Rust stub's RoleRegistry), so the suite is ungated; every spine mounts the standard RPC surface it drives. The role is the role option, participant by default: a backend without it passes another admin-grantable role (ROLE_ADMIN for one with only the builtins, which skips the scoped case — builtins are global-only).

view source

Declarations
#

2 declarations

describe_role_grant_participation_cross_tests
#

RoleGrantParticipationCrossTestOptions
#

testing/cross_backend/role_grant_participation.ts view source

RoleGrantParticipationCrossTestOptions import type {RoleGrantParticipationCrossTestOptions} from '@fuzdev/fuz_app/testing/cross_backend/role_grant_participation.js';

Options for the role-gated-participation success-path parity suite.

setup_test

Per-test fixture producer (in-process or cross-process).

type (): Promise<TestFixture>

readonly
returns Promise<TestFixture>

rpc_path?

RPC endpoint path. Default /api/rpc.

type string

readonly

role?

The role conferred — one the backend's registry holds with the admin grant path. Default SPINE_PARTICIPANT_ROLE, the spine's own; a backend with only the builtin roles passes ROLE_ADMIN.

type string

readonly

scope_kind?

A scope kind role applies to, for the scoped-assign case; null skips that case. Default 'space' (the spine participant's), or null for a builtin role, which is global-only (a scoped builtin is refused role_grant_builtin_scoped).

type string | null

readonly

Depends on
#

Imported by
#