Identity plane split, plan I3f2: the test harness (epic &133)

Status: Done (2026-10-11) — !1594
Epic: &133 (stage I3 of &130)
Issues: #2855 (U1, w2); #2856 (U2, w3); #2857 (U3, w5); #2858 (U4, w3); #2859 (U5, w3); #2860 (U6, w3); #2861 (U7, w3); #2862 (U8, w3); #2863 (U9, w3).
MR: feat/identity-test-harness, "the test harness (#2855 … #2863)".

One MR, one commit per issue, under the maintainer’s one-MR-per-related-group ruling. It merges once the pre-push battery passes. This is a Design + Scope plan: GitLab owns tracking, and the plan freezes when U1 starts. J1–J8 are this plan’s decisions (ADR-049 Amendment 24); R21–R23 are the maintainer’s rulings.

Context

I3f is the cut-over’s last stage before the switch (ADR-049 Amendment 11). R18 split it in two. I3f1, the Rust clients, has merged; I3f2 is "the test harness: the TypeScript broker, Playwright sign-in and k6".

K1 lets only additive library code and devstack infrastructure land before the switch, proven against the devstack’s identity plane. D14 bans test-only grants and password grants: "the battery signs in through the devstack’s upstream with a headless driver and federates as canopy-web does".

What exists:

  • canopy-test-lib’s TokenBroker (crates/canopy-test-lib/src/identity_broker.rs, K7) handles Kanidm sign-in, federation as canopy-web, delegation and system tokens.

    • It holds one 0600 cache entry per person under a flock, with 30 s TOTP spacing.

    • BrokerConfig::from_env reads seven CANOPY_TEST__* keys.

    • Its driver, cache and spaced() are private.

    • The Kanidm driver’s authorise_query(uat, query) answers Code{code,state}, ConsentRequested, AuthenticationRequired or Refused. Consent is off for canopy-web, whose one registered redirect is https://web.canopy.test/auth/callback.

  • The in-network runner (canopy-integration) reads its inputs from the canopy_identity_inputs volume and caches in canopy_identity_broker_cache.

    • The inputs are kanidm.json, kanidm-ca.pem and keys/.

    • xtask/src/devstack_identity/broker_inputs.rs::install fills the volume; only cmd/test.rs calls it.

  • Playwright (tests/e2e, 1.60, a root container with no certutil) signs in through Keycloak.

    • auth/setup.ts fills Keycloak’s form for nine roles.

    • lib/given/auth.ts holds Keycloak password grants and client credentials, used in 36 files.

    • The canopy-e2e service has no identity env or volumes.

  • k6 (tests/k6, grafana/k6:2.3.0, digest-pinned) takes Keycloak tokens in setup().

    • It runs on {project}_default via xtask/src/cmd/perf.rs, with --no-usage-report and K6_AUTO_EXTENSION_RESOLUTION=false.

    • --profile is a clap value list, and perf identity is already the capacity-harness subcommand.

Verified on the devstack (2026-10-11):

  • k6 2.3.0 verifies ES256 through crypto.subtle from a JWK, runs an async default, and decodes rawurl base64.

  • Kanidm’s /ui/login/begin for a person answers the TOTP step (form#login[action="/ui/login/totp"], #totp).

  • Playwright 1.60 does not follow a route.fulfill 3xx on a navigation: Chromium goes to the network. A fulfilled 200 text/html whose script calls location.replace(url) is followed.

  • In the canopy-e2e image on canopy_default, Chromium refuses Kanidm with ERR_CERT_AUTHORITY_INVALID, and loads it when launched with --ignore-certificate-errors-spki-list=<leaf SPKI>.

The maintainer’s rulings (2026-10-11):

  • R21. The TypeScript broker is canopy-test-lib’s TokenBroker, served over HTTP as a devstack service on the compose network only. Playwright and k6 get thin clients.

  • R22. At the switch, Playwright signs workers in headlessly. A helper intercepts canopy-web’s redirect to Kanidm, the broker authorises that query with the person’s UAT, and the browser follows to canopy-web’s callback. A Kanidm login page object drives one @identity spec through Kanidm’s real pages.

  • R23. I3f2 lands the service, the clients, the helper and the page object, each proven against the identity plane. The switch flips the callers.

Decisions (ADR-049 Amendment 24, J1–J8; land with U1)

  • J1. Staging (R23).

    • I3f2’s proofs run against the identity plane only: tokens verified against canopy-security’s JWKS, and codes issued for canopy-web’s registered redirect. No service receives these tokens.

    • The switch moves auth/setup.ts onto the headless helper and remaps the 36 given token sites onto compiled client/edge pairs or delegations. It also moves k6’s profiles onto identity.js, rewrites the sign-out assertions, gives canopy-web its https://web.canopy.test origin and registers the xsite redirect.

  • J2. The broker service (R21). The new crate tools/canopy-token-broker is a lib plus a bin, an axum server over TokenBroker, following tools/canopy-seed.

    • A crate rather than a bin in canopy-test-lib: the build cost is the same, canopy-test-lib stays a library, and the bin gets its own dependency set.

    • It listens on 0.0.0.0:8099 on the compose network, with no published port, runs as uid 1000, and mounts the inputs and cache volumes canopy-integration mounts. So its sessions and spacing are the in-network runner’s.

    • It is never built by the root Dockerfile (#2618).

  • J3. The browser steps in the library. TokenBroker gains three methods, reusing its private cache and spaced():

    • authorise_query(uat, query) → Authorization, delegating to the driver;

    • upstream() → Upstream { origin, client_id, redirect_uri, ca_pem }. TokenBroker::new keeps the CA PEM that kanidm_driver reads, and the credentials' origin and client_id; redirect_uri is kanidm::REDIRECT_URI;

    • ui_credentials(person) → UiCredentials { username, password, totp, totp_valid_until }. The password and code are Secrets; Debug is redacted, and totp_valid_until is in Unix seconds.

      ui_credentials holds the person’s entry and runs inside spaced(), after its 30 s wait. It waits until the current TOTP step has at least 15 s left, computes the six-digit zero-padded code, and is stamped by spaced(). So any next sign-in of that person comes at least 30 s later, in a later step, and no code is presented twice.

      The broker’s 90 s retry (while_unavailable) gains two cases, so J4’s 503 holds under concurrency:

    • a system-token call that waited on a failed shared acquisition (SystemTokenError::SharedFailure) acquires again within the budget, rather than failing at once while the leading call retries;

    • federation open and renew (which today call the federation client directly) go through the retry, as the minting grants do.

  • J4. The HTTP API. JSON with deny_unknown_fields, and a 16 KiB body cap. Error bodies are {error, detail, reason?}:

    • detail is a fixed sentence per error, never a Display (reqwest’s URL would carry the query);

    • reason is a public code: the issuer’s RFC 6749 error, the canopy refusal, rate_limited, status_<n>, or Kanidm’s denied or status_<n>.

      Route Body 200

      POST /v1/tokens/delegation

      {person, target, roles?: [..], programs?: [..]}, each joined by spaces for Narrowing::parse

      {token, token_type: "Bearer", expires_at}

      POST /v1/tokens/stepped-up

      {person, target}

      same

      POST /v1/tokens/system

      {client, target, scope?}

      same

      POST /v1/upstream/authorise

      {person, query}

      {code, state}

      POST /v1/upstream/ui-credentials

      {person}

      {username, password, totp, totp_valid_until}

      GET /v1/upstream

      —

      {origin, client_id, redirect_uri, ca_pem}, all public

      GET /healthz

      —

      {status: "ok"}

    • expires_at is the token’s exp in Unix seconds, read from its payload.

    • Status codes. PlaneError::from(BrokerError) is an exhaustive match, nested into FederationError, DelegationError, SystemTokenError and KanidmError, with no wildcard arm, so a new variant does not compile until it is classified:

      Status error Variants

      400

      invalid_request

      The service’s own checks: malformed JSON, an unknown target or client, a narrowing Narrowing::parse refuses

      404

      unknown_person

      UnknownPerson

      413

      payload_too_large

      A body past 16 KiB

      502

      refused

      Federation(Refused | ClientRejected | InvalidRequest | Limited | Status); Delegation(Refused) and System(Refused) other than 503 (the issuer’s invalid_scope included); Kanidm(Denied | Status); NoIdToken; Authorization::Refused

      502

      malformed

      Federation(Malformed), Delegation(Malformed), System(Malformed), Kanidm(UnexpectedState)

      502

      unreachable

      Transport and Body of the three clients, Kanidm(Http), Http, AdminTransport

      502

      consent_requested

      Authorization::ConsentRequested

      502

      authentication_required

      Authorization::AuthenticationRequired, after the one re-sign-in (none for a prompt=login query)

      503

      unavailable

      is_unavailable() once the 90 s retry is spent

      500

      broker_failed

      Everything else: configuration, credentials, keys, cache, Mint, Delegation(ForeignCache), System(SharedFailure) once the retry is spent, and Kanidm’s Client, CaRead, Migration, Enrolment, Clock and TotpCode

    • UAT cache: authorise keeps one UAT per cast person, each behind a tokio::sync::Mutex<Option<Secret>> built once from the cast.

      • On AuthenticationRequired it signs that person in again (spaced, holding the lock) and retries once.

      • A query carrying prompt=login gets no re-sign-in, since even a fresh UAT is refused it (idp_conformance_kanidm.rs's prompt_login_refuses_a_session_that_is_not_fresh).

  • J5. The Playwright client.

    • lib/given/broker.ts is a typed client that throws BrokerCallError {status, error, reason}.

      • It does no retry, because the service is healthy (--wait) before Playwright starts.

      • Its request timeout is BROKER_BUDGET_MS (150 s: the spacing, a fresh TOTP step, and the 90 s retry). Every navigation or wait that can include a broker call uses the same budget.

    • lib/identity/jwks.ts verifyIdentityToken(token, jwks, {issuer, audience, maxLifetime, now}) verifies with node:crypto against a JWKS, /identity/jwks's in the proofs. It checks:

      • ES256 (P1363 signature), an RFC 7638 kid, and typ at+jwt;

      • the issuer, and one aud (the target’s);

      • the receiver’s time rules (check_times, identity_token.rs): exp − iat within 1..=maxLifetime (300 s for delegation, 600 s for system), iat and nbf no later than now + 60 s, and now before exp + 60 s.

  • J6. Headless sign-in (R22). lib/identity/sign-in.ts routeUpstreamSignIn(context, broker, person, upstream) routes GET /ui/oauth2 on Kanidm’s origin.

    • It refuses (route.abort(), nothing sent to the broker, the refusal recorded for the caller) a request whose redirect_uri is not the registered one, or which carries prompt=login.

      • Re-authentication cannot be satisfied headlessly. canopy-web’s re-authentication moves at the switch with the sign-out migration, through the page object (J7).

    • It sends the raw query to the broker’s authorise.

    • It fulfills a 200 text/html that calls location.replace(redirect_uri?code&state); a fulfilled 3xx is not followed.

    • The identity-plane project’s navigationTimeout is BROKER_BUDGET_MS, so a navigation held by a spaced sign-in completes.

  • J7. Kanidm’s pages (R22). lib/pages/kanidm-login.page.ts KanidmLoginPage:

    • it fills #username on form#login;

    • it then answers each step by its form (#totp, #password, a mechanism choice), at most five, until the URL leaves /ui/login;

    • any other page fails, naming its heading.

      The @identity spec launches its own Chromium pinned to Kanidm’s leaf SPKI: standard base64 of SHA-256 over the SPKI DER of getPeerX509Certificate().publicKey.export({type: 'spki', format: 'der'}), read after Node’s tls.connect has verified the leaf against the CA from /v1/upstream.

    • A leaf pin, not a CA pin: Chromium’s ignore list matches any certificate the server presents, chained or not, and the CA certificate is public.

    • ignoreHTTPSErrors is never used.

  • J8. k6. tests/k6/lib/identity.js serves delegation(person, target) and system(client, target) only, with no narrowing or scope, so its per-VU cache key (kind, principal, target) is complete.

    • Cache rule: a token is served for the shorter of maxAgeS (default 300 s, the Rust system cache’s revocation ceiling) and its exp less 60 s, counted from issue. Refreshes are counted in identity_token_refreshes.

    • Broker calls set k6’s timeout to 180 s, since k6’s default of 60 s is shorter than the broker’s budget.

    • verifyToken applies J5’s contract: ES256 through crypto.subtle, the kid, typ, the issuer, the audience, and the same time rules.

    • The proof profile is identity-tokens, so it doesn’t clash with perf identity, and it calls no service.

Units

Every commit goes through the pre-commit review. Each subject is at most 72 characters with its ` (#N). Every new devstack test uses canopy-test-lib’s `infrastructure_available() guard, which CANOPY_TEST_INFRA=required makes fatal, as the existing plane tests do.

Erratum (2026-10-11): U2’s retry is while_retryable(predicate, call) (not a reworked while_unavailable), with system_retryable as the system calls' predicate; kanidm_driver answers the driver and its Upstream together; and TOTP_STEP and UI_TOTP_MIN_REMAINING_SECS are named constants, the first checked at compile time against TOTP_STEP_SECONDS. U3’s PlaneError carries a Class whose status, error and fixed detail are each an exhaustive match; its binary installs no log subscriber and is inventoried in canopy-common’s ADR-041 executable inventory as a tool, and compose sets no RUST_LOG for it. U4’s builder also installs curl, for utoipa-swagger-ui's build script, and the broker joins NON_FLEET_CANOPY_SERVICES as well as E2E_ONLY_SERVICES. U5 matches --project names case-insensitively, removes the broker best-effort when its bring-up fails, adds the ignored the_service_comes_up_healthy_and_goes, and gives xtask a canopy-token-broker dev-dependency for the port pin. U7’s spec asserts that the only request to Kanidm’s origin is the routed /ui/oauth2, which the route answers. U8’s page object answers the three forms Kanidm 1.11 asks (/ui/login/begin, served first at /ui/oauth2 itself, then /ui/login/totp and /ui/login/pw) and has no mechanism-choice branch, since Kanidm asks for none; its spec starts with prompt=login, the re-authentication J6 defers to these pages, and reads the code and state from the callback’s request, because the redirect to canopy-web’s origin is a server redirect Playwright does not route, to an origin that resolves nowhere before the switch. U9’s cache answers {token, expiresAt, issuedAt} and counts a token’s age from its iat, since the broker’s system tokens come from its source’s cache and may arrive up to 300 s old. So a refreshed system token may be the same token: the profile asserts a new jti on refreshed delegations only, with an exp no earlier (not later), since a delegation ends no later than its session. An iteration that throws fails a check, and the profile’s one service call is canopy-security’s public JWKS. token_broker.rs gains SECURITY_URL for k6’s env, and perf.rs's wrapper is with_token_broker(project, needed, run), which removes a failed bring-up too.

  1. U1 (#2855, w2) docs(adr): record the test harness.

    • ADR-049 Amendment 24 (R21–R23, J1–J8), and its Status line.

    • This page (In progress) and its nav group.

  2. U2 (#2856, w3) feat(test-lib): expose the broker’s browser steps (J3).

    • Files: identity_broker.rs, adding:

      • Upstream, UiCredentials and the three methods;

      • private totp_wait(now) → Option<Duration>, which waits out the step when fewer than 15 s are left (checked arithmetic);

      • private six_digits(code);

      • J3’s retry. while_unavailable takes a retryable predicate: is_unavailable(), plus System(SharedFailure) for system calls. A private mint_system(source, audience, scope), which system calls, wraps the source in it. Federation open and renew are wrapped too.

    • Unit tests (identity_broker/tests.rs):

      • totp_wait for now mod 30 = 0, 14 and 15 (no wait), 16 (14 s) and 29 (1 s);

      • six_digits(1234) is 001234;

      • Debug redacts the password and the code;

      • against a scripted token endpoint answering 503 once, then 200: two concurrent mint_system calls over one SystemTokenSource both succeed, and a 400 is returned at once, unretried.

    • Devstack tests (tests/identity_broker_test.rs):

      • jane.auditor's credentials complete Kanidm’s JSON auth (TOTP, then password, then success), and a following upstream_sign_in waits out the spacing;

      • an AuthorizeRequest-built query authorises to a code with its state, and exchange issues an id_token;

      • upstream() matches the credentials file and the CA file.

    • Docs: shared-crates.adoc, testing.adoc (the broker’s calls).

  3. U3 (#2857, w5) feat(tools): serve the token broker over HTTP (J2, J4).

    • Files:

      • tools/canopy-token-broker/{Cargo.toml, src/{lib.rs, main.rs, plane.rs, routes.rs, uat.rs, expiry.rs, tests.rs}, tests/devstack_test.rs}; the root Cargo.toml member.

      • plane.rs: trait Plane: Send + Sync + 'static. Six async methods with Send futures (delegation, stepped_up, system, upstream_sign_in, authorise_query, ui_credentials) and a sync upstream(); impl Plane for TokenBroker; PlaneError (thiserror) carrying J4’s table.

      • main.rs serves on 0.0.0.0:8099 with canopy_common::shutdown, logs no token or credential, and uses anyhow only in main.

    • Router tests (FakePlane, oneshot):

      • each route’s shape, with expires_at equal to exp;

      • every row of J4’s table, one variant per class, including 413 for 17 KiB, 400 not echoing the body, and the reason for each refusal;

      • UAT reuse, one re-sign-in on AuthenticationRequired, 502 on a second, and none for a prompt=login query;

      • no error body holds the fake’s UAT, password or token, and no body at all holds the UAT;

      • a proptest that expires_at never panics on arbitrary input.

    • Devstack test: the real router on 127.0.0.1:0 over TokenBroker::from_env(), as jane.snap-worker:

      • a delegation token and canopy-eligibility’s system token validate through IdentityTokenValidator;

      • an authorise round trip exchanges;

      • an unknown person gives 404.

    • Docs: testing.adoc, "The token broker service" (J4’s tables).

  4. U4 (#2858, w3) feat(devstack): build and compose the token broker (J2).

    • Image tools/canopy-token-broker/Dockerfile, Alpine and multi-stage:

      • builder rust:1.96-alpine with cache mounts id=/canopy-token-broker/usr/local/cargo/registry and id=/canopy-token-broker/app/target (sharing=locked), its own so its feature set never churns the root build’s target;

      • the root Dockerfile’s #2237 content-hash touch;

      • cargo build --locked --profile devstack -p canopy-token-broker;

      • runtime alpine:3.23 with user app (uid 1000), the seeded /app/.identity-inputs and /app/.identity-broker, EXPOSE 8099 and a wget HEALTHCHECK on /healthz.

    • Compose canopy-token-broker, after canopy-e2e:

      • profiles: [e2e];

      • the seven CANOPY_TEST__* keys equal to canopy-integration's;

      • both volumes (inputs read-only);

      • read_only, tmpfs /tmp, ulimits core: 0;

      • depends_on canopy-security and kanidm, healthy;

      • no ports:.

    • docker.rs: TOKEN_BROKER_SERVICE joins E2E_ONLY_SERVICES in compose-file order, so teardowns and dev clean remove it. Its doc no longer says every entry is canopy-e2e's dependency.

    • Tests:

      • the_e2e_only_removal_names_every_e2e_only_dependency_and_nothing_else gains the broker in its expected argv (a new service, not a weakening);

      • the compose block has no ports:, has both volumes, and its keys equal canopy-integration's;

      • every_cache_mount_carries_an_explicit_id_and_locked_sharing, the content-hash pin and the_runner_reads_the_inputs_where_the_install_puts_them extend to the broker’s Dockerfile.

    • Docs:

      • local-dev.adoc, "The token broker service";

      • security.adoc: a devstack-only service holding every client key and Kanidm’s credentials, which answers passwords on ui-credentials, is unpublished, and is never in the root image.

  5. U5 (#2859, w3) feat(xtask): bring the token broker up for e2e (J2).

    • Files:

      • broker_inputs::install takes Installer { Integration, TokenBroker }, choosing its one-off service and profiles (integration + full, or e2e + full); cmd/test.rs passes Integration.

      • The new xtask/src/token_broker.rs: URL (http://canopy-token-broker:8099), bring_up(root, project, env) (install, then compose up_args()), and up_args() (--profile e2e --profile full up -d --no-deps --wait --wait-timeout 180 canopy-token-broker).

      • e2e.rs: needs_token_broker(extra) is conservative. It is false only when the selection provably excludes the identity-plane project’s specs:

        • a --project list naming neither identity-plane nor a wildcard (*, ?), with no positional filter; or

        • positional filters that are each a literal spec path (specs/<name>.spec.ts, no other regex metacharacter) whose name does not start with identity-, with no --project naming identity-plane or a wildcard.

          Anything else (no selection, a directory, a regex, -- specs, -- 'specs/.*') starts the broker. The call comes once after the pre-run remove_e2e_only_services, and the post-run removal takes the broker down. It also runs under --no-refresh, as the canopy-e2e build does, because it is harness, not devstack.

    • Tests:

      • the predicate’s cases: none; -- specs; -- 'specs/.'; -- specs/identity-tokens.spec.ts; --project identity-plane; --project '' (each starts it); and -- specs/fixture-smoke.spec.ts and --project caseworker (neither does);

      • every cargo xtask e2e line in .gitlab-ci.yml leaves the broker down;

      • up_args;

      • both installers' argv.

      • Run the ignored the_install_lands_the_inputs_for_the_runner by hand for both.

    • Docs: tooling/xtask-catalog.adoc (e2e).

  6. U6 (#2860, w3) feat(e2e): mint and verify identity tokens through the broker (J5).

    • Files:

      • lib/given/config.ts: tokenBrokerUrl, securityUrl, identityIssuer;

      • lib/given/broker.ts, lib/identity/jwks.ts;

      • playwright.config.ts: the project identity-plane (testMatch: /specs\/identity-.*\.spec\.ts/, timeout: 300_000, use.navigationTimeout = BROKER_BUDGET_MS, no auth-setup dependency, no storageState);

        • caseworker's lookahead excludes identity-;

        • journey does not depend on it: tokens follow the wall clock (D14), so the fleet clock that journeys move cannot affect them;

      • canopy-e2e gains CANOPY_TESTTOKEN_BROKER_URL, SECURITY_URL and __IDENTITY_ISSUER.

    • Spec specs/identity-tokens.spec.ts:

      • jane.doe to persons verifies, with act naming canopy-web and expires_at equal to exp;

      • a caseworker narrowing shows in roles;

      • jane.admin stepped up has an auth_time within 300 s;

      • canopy-eligibility’s system tokens for applications, enrollment, persons and rules verify;

      • the verifier refuses another audience, a flipped payload byte and an unknown kid. Against a JWKS of a key the spec generates with node:crypto, it also refuses tokens that are expired past the leeway, issued or not valid until past now + 60 s, of zero lifetime, or of a lifetime past the maximum;

      • an unknown person gives 404, and jane.unscoped gives 502 refused with reason missing_primary_programs.

    • xtask pins: the project’s name, the caseworker exclusion, and the canopy-e2e broker URL equal to token_broker::URL.

    • Docs: testing.adoc (E2E).

  7. U7 (#2861, w3) feat(e2e): sign in headlessly through the broker (J6).

    • Files:

      • lib/identity/stand-in-rp.ts routes upstream.redirect_uri's origin.

        • /start serves a 200 text/html that does location.replace to Kanidm’s /ui/oauth2?<query>. The query is AuthorizeRequest::query's (login.rs): response_type=code, client_id, redirect_uri (the registered one), scope=openid profile, a fresh state and nonce, code_challenge (S256) and code_challenge_method=S256, plus an optional prompt=login.

        • /auth/callback is captured with a 200 stub.

      • lib/identity/sign-in.ts (J6).

    • Spec specs/identity-sign-in.spec.ts (jane.admin.snap):

      • the person is first given uiCredentials, which stamps a sign-in. The headless sign-in’s navigation then waits out the spacing (at least 25 s elapsed) and still completes within the budget;

      • the callback carries the RP’s state and a code;

      • the helper ran once, and no request reached Kanidm;

      • a foreign redirect_uri and a prompt=login query each abort without a broker call.

    • Docs: testing.adoc.

  8. U8 (#2862, w3) feat(e2e): sign in through Kanidm’s own pages (J7).

    • Files:

      • lib/identity/pinned-browser.ts: kanidmLeafSpki(upstream) and launchPinnedChromium(upstream) (chromium.launch with the pin; Playwright supplies the --user-data-dir the flag needs);

      • lib/pages/kanidm-login.page.ts.

    • Spec specs/identity-kanidm-ui.spec.ts (@identity, jane.auditor.snap):

      • unpinned Chromium fails ERR_CERT_AUTHORITY_INVALID;

      • pinned, a context naming an empty storageState (the contexts lint) goes from the stand-in /start (the complete query, U7) to Kanidm’s pages;

      • uiCredentials is fetched just before, and the page object signs in;

      • the callback carries the RP’s state and a code.

    • Docs: testing.adoc (why the leaf is pinned).

  9. U9 (#2863, w3) feat(k6): mint identity tokens through the broker (J8).

    • Files:

      • tests/k6/lib/identity.js.

      • tests/k6/identity-tokens.js:

        • setup() (with setupTimeout 300 s) warms the broker: one token of each kind, so spacing and issuer warm-up are spent before measurement;

        • then 2 VUs for 60 s, async default, with maxAgeS 20 s, so each VU refreshes within the window;

        • eligibility’s four targets and jane.doe to persons, each verified (J8) with expires_at === exp;

        • a refreshed token has a new jti and a later exp;

        • against a key the script generates with crypto.subtle: a tampered token, an expired one and a future-dated one are refused;

        • thresholds: checks rate 1, identity_token_refreshes count > 0, http_req_failed rate 0.

      • perf.rs:

        • identity-tokens in the value list;

        • needs_token_broker(profile);

        • a one-line with_token_broker wrapper in run_k6 (token_broker::bring_up, run, best-effort removal);

        • k6_run_args passing the three CANOPY_TEST__* keys before the image.

    • Tests: the profile maps to its script, the env comes before the image, only identity-tokens starts the broker, and the existing pins are unchanged.

    • Close:

      • tooling/xtask-catalog.adoc (perf, set apart from perf identity);

      • CHANGELOG.adoc (Added, and Changed: e2e starts the broker);

      • Amendment 24’s as-built record;

      • the plan Done and archived;

      • plan-lint --done with --allow-open for U1–U9;

      • a perf --profile identity-tokens run recorded in the MR;

      • after merge, I3f2’s tasks ticked on the epic.

Scope

In: the broker’s browser steps, the broker service and its image, the e2e and perf wiring, the Playwright client, verifier, helper and page object with their proofs, and the k6 client and profile.

Out:

  • The switch (J1): plus the broker for CI’s e2e lanes, which needs a prebuilt image or an in-dind build.

  • Issues: the host cache, the volume cache and validate-in-network’s cache sharing no spacing; the @identity subset for alternative upstreams (&134).

Risks

  • Spacing across caches. The host cache and validate-in-network’s cache do not share spacing with the volume, and a cold start’s link_cast signs sec.admin in on the host. So the proofs avoid sec.admin.

  • One service holds every client key. That is the same trust as canopy-integration: compose network only, unpublished, core: 0, read-only, never deployed, and pinned by a test.

  • Kanidm’s pages may change. The page object detects each step rather than assuming the order, and an image bump re-runs @identity.

  • Battery time.

    • The broker image’s first build compiles canopy-test-lib’s dependency tree; later builds reuse its cache mounts.

    • identity-plane adds about two minutes to each cargo xtask e2e run (spacing, the fresh-step wait, the UI flow).

Verification

  • Per unit: fmt; clippy (the workspace with the lane’s features); quality-budgets; check-docs; plan-lint; private rustdoc; npm run typecheck in the image build.

  • nextest: canopy-test-lib, canopy-token-broker and xtask; and cargo xtask test --integration --host -p canopy-test-lib -p canopy-token-broker --no-refresh --skip-static (U2, U3).

  • E2E: cargo xtask e2e — --project identity-plane (U6–U8). The bare battery runs it too.

  • k6: cargo xtask perf --profile identity-tokens (U9).

  • Per MR: the pre-push battery.

Review log

Round Vendor Resolved model Verdict

1

Anthropic

claude-opus-5-5

No-ship. Three blockers, fixed: J4’s error mapping: a variant-to-status table, fixed details and a public reason; the source of /v1/upstream, with the Plane methods named (J3’s upstream()); an MR number in the body. Notes folded in: U4 split into the image and compose (U4) and the xtask bring-up (U5); totp_wait's cases; the fresh-step wait inside spaced(); the infrastructure_available() guard; the removal-test update; the cache-mount ids; no client retry; the SPKI encoding; the verification commands.

2

not stated (the maintainer’s other vendor)

not stated

No-ship. Ten findings and one switch concern, fixed in-plan: a conservative broker start (U5); navigation budgets equal to the broker’s, proven on a recently signed-in person (J5, J6, U7); SharedFailure and federation inside the 90 s retry (J3, U2); a k6 warm-up, timeout and age cap (U9); the receiver’s time rules in both verifiers (J5, J8); k6 serving no narrowing (J8); the complete authorization query (U7); an exhaustive refusal table (J4); prompt=login refused headlessly and deferred to the switch (J4, J6); the secrecy test scoped to error bodies (U3); k6’s 300 s cache ceiling (J8).

Edit this page · default