Identity plane split, plan I3d: canopy-identity senders (epic &133)
Status: Done (2026-10-09) — !1585
Epic: &133 (stage I3 of &130)
Issues: #2806 (U1, w2); #2807 (U2, w3); #2808 (U3, w5); #2809 (U4, w3); #2810 (U5, w2). Each relates to #2648, which closes at the switch (E8). U1 files #2811.
MR: feat/identity-senders, "canopy-identity senders (#2806 … #2810)".
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. E1–E8 are this plan’s decisions (ADR-049 Amendment 16); R1–R3 are the maintainer’s rulings.
Context
I3a’s stage list gives I3d "every sender’s purposes (A2), client-key loading and settings, the shared clients' token plumbing, the verification adapter routes (#2648); unwired" (plan I3a).
What canopy-auth already holds, unwired:
-
ClientAssertionMinter(A1),SystemTokenSource(system tokens cached per (resource, scope), single-flight,invalidate) andDelegationTokenSource::delegate(onward delegation with a per-requestDelegationCache, G9). All incrates/canopy-auth/src/identity_client.rsandidentity_client/delegation.rs. -
I3c’s receiver:
PrincipalandUserPrincipal::delegation()(identity_receiver/principal.rs), andReceiverSettings(identity_receiver/settings.rs). -
canopy_signing::load_provisioned_key(D10: throughSecretProvider, with no file fallback).
What is missing:
-
Purposes. Only the portal’s 9 exist (
identity_policy.rs,PORTAL_PURPOSES). The other 46 System/Both edges inidentity_policy/call_graph.rshave none, so the issuer answersinvalid_targetto every other system-token request. -
Settings and keys. No setting names a client key, and no type derives the token endpoint.
-
B4’s choice. Nothing picks a call’s token: delegation onward from the request’s user, or a system token.
-
The adapter routes. Verification’s
/internal/v1adapter routes check one sharedX-Service-Api-Key(services/canopy-verification/src/api/service_key.rs):-
IEVS: called by snap’s detached task (
services/canopy-snap/src/verification_client.rs); -
SOLQ: called by eligibility’s determine (
services/canopy-eligibility/src/orchestrator.rs,fetch_ssa_solq); -
SAVE: no production caller.
-
Maintainer rulings (2026-10-09):
-
R1. Each service purpose holds one scope. Receivers keep checking the edge and the route’s client list (L2, L3).
-
R2. #2648’s decisions are made now, and SOLQ’s admission is compiled. The switch moves the routes and deletes the key.
-
R3. I3d is the sender library only. The shared clients and their call sites (about 45 token fetches and 184 bearer attachments) move at the switch, which keeps K1.
Decisions (ADR-049 Amendment 16, E1–E8; land with U1)
-
E1. Service purposes. Every non-portal System or Both edge (46) gets exactly one purpose,
<client>/<target>(A2). Its one scope is its own name, so a purpose cannot drift from its scope.-
The scope is informational: a receiver checks a system token’s edge (L3) and the route’s client list (L2), never this scope (R1).
-
This amends B7’s last sentence: for a service caller, route-level authority is the route’s client list; only the portal’s purpose scopes carry it.
-
A
service_purpose!(Client, "canopy-x", "canopy-y")macro builds each entry, so the name, the audience and the scope come from one pair throughconcat!.
-
-
E2. One settings type.
ReceiverSettingsbecomesIdentitySettings, because the receiver and the sender read the same two settings (L6).-
It moves to
crates/canopy-auth/src/identity_settings.rs, withISSUER_SETTING,INTERNAL_URL_SETTINGand its tests.IdentityReceiver::over_http(&IdentitySettings, CanopyService, IdentityHttpClient)moves toidentity_receiver/layer.rs, besideIdentityReceiver. -
It adds
token_endpoint()=identity_endpoint(INTERNAL_URL_SETTING, &internal, "token"), which is/identity/tokenunder the internal URL. -
No alias: the type is pre-1.0 and unwired.
-
-
E3. The client key.
client_key_secret(client)namesCANOPY_<SERVICE>IDENTITY_CLIENT_PRIVATE_KEY, where<SERVICE>is the client id withoutcanopy-, upper-cased, with-→_(for exampleCANOPY_SNAP…).-
The key is loaded only through
load_provisioned_key(D10). -
The devstack hands each service its key at the switch (K4). Until then, U5’s proof feeds the generated key file through an in-memory provider.
-
-
E4. The sender. One
IdentitySenderper process, for a confidential client that runs as a service, owning oneSystemTokenSourceand oneDelegationTokenSourceover one key.-
IdentitySender::over_http(&IdentitySettings, ConfidentialClient, Arc<dyn KeySigner>, IdentityHttpClient) → Result<Self, SenderError>. -
IdentitySender::from_secrets(&IdentitySettings, ConfidentialClient, &dyn SecretProvider, IdentityHttpClient) → Result<Self, SenderError>. -
SenderError:-
NotAService(ConfidentialClient): the client’sservice()isNone(canopy-web, canopy-portal; their senders are I3e’s and I3f’s); -
Key(#[from] ProvisionedKeyError).
-
-
-
E5. Origin and kind (B3, B4).
-
Origin<'p>:User(&'p VerifiedDelegation)orSystem.Origin::of(&'p Principal):-
a user principal gives
User(user.delegation()); -
a system principal, the portal’s included, gives
System; -
detached tasks, background work, durable retries and boot use
Origin::System.
-
-
IdentitySender::calls<'p>(&self, Origin<'p>) → Outbound<'_, 'p>holds the origin and the request’sDelegationCache. -
Outbound::bearer(&mut self, CanopyService) → Result<Bearer<'_>, SendError>takes the token’s kind from the compiled edgeedge(Client::Confidential(client), target):-
no edge:
SendError::NoEdge, and nothing is sent; -
System: a system token, whatever the origin (rules, audit writes, process-wide reads);
-
Delegation: onward from the user’s token, never narrowed (
Narrowing::default()). A system origin isSendError::SystemOrigin, and nothing is sent; -
Both: by origin.
-
-
Outbound::system_bearer(&mut self, CanopyService)asks for a system token where B4 makes an in-request call system (bookkeeping, process-wide data). A Delegation-only edge isSendError::NoSystemEdge; no edge isNoEdge. -
System tokens are always asked for with
scope: None(the purpose’s one scope). -
SendError:-
NoEdge,SystemOrigin,NoSystemEdgeandTimeout, each carrying itstarget: CanopyService; -
System(#[from] SystemTokenError); -
Delegation(#[from] DelegationError).
-
-
-
E6. Budget and rejection.
-
The bound: each acquisition is bounded by
SENDER_BUDGET=DELEGATION_BUDGET(5.5 s, G10’s floor for a sender’s call) + 1 s for signing and the round trip, with aconstassertion that it is at leastDELEGATION_BUDGET. The system grant’s 5 s budget fits inside it. Past the bound isSendError::Timeout. -
Cancel safety: a cancelled system acquisition releases the single flight before counting an attempt, so the next waiter acquires. A cancelled delegation request never reaches the cache, which is written only after the answer.
-
After a receiver’s 401:
Outbound::rejected(&mut self, CanopyService)invalidates the target’s system token (invalidate(audience, None)) and removes the request cache’s delegation entry for it. That uses a newDelegationCache::forget(target); each entry now records its target beside the token, since its key is an opaque digest. The call site’s one retry then reacquires (i1b). -
The sender never retries on its own and never fails open (K1).
-
-
E7. Bearers.
-
Bearer<'a>is a borrowed&'a DelegationTokenor anArc<str>system token, read only throughexpose_for_call(). -
Bearer::owned() → OwnedBearer(Zeroizing<String>, with noClone,DebugorDisplay) serves a task the request spawns, such as eligibility’s program fan-out. -
No error carries a token, assertion or body.
-
-
E8. #2648, the adapter routes (R2).
-
SOLQ joins the delegated table (M1: eligibility reaches it inside a worker’s request on its own credentials).
POST /internal/v1/ssa/solqtakesAdmission::system_from(&[Eligibility]).and_user_roles_via(&[ELIGIBILITY], CASEWORKER_WRITER_ROLES):-
CMD orders are system;
-
a worker’s determine (canopy-web’s or the CLI’s
POST /v1/eligibility/determine) reaches SOLQ inside its request; -
determine’s bar is the writer bar (
post_determine).
-
-
IEVS translates to
system_from(&[Snap]): its one caller, a detached task, on a System edge. -
SAVE translates to the key’s holders,
system_from(&[Eligibility, Snap]). It has no production caller (#2811). -
At the switch: the four routes move behind the receiver at their own paths (outside the
/v1nest), the key is deleted, and #2648 closes. -
The delegated-route gate reads
/internal/v1/paths:-
the census keeps a path that starts with
/internal/as is; today it would prefix/v1; -
the table reader admits a backticked
/v1/or/internal/v1/path.
-
-
Units
Erratum (2026-10-09): this plan’s decisions were lettered N1–N8, which Amendment 9 already uses; they are E1–E8 here and in ADR-049 Amendment 16 (#2812).
Erratum (2026-10-09): U3 adds Bearer::is_delegation(), which names a bearer’s kind for its Debug and the tests, and makes DelegationToken's compile-time probes crate-visible, so the sender’s tests hold OwnedBearer and Bearer to them; its J1 review asked for both.
Every commit goes through the J1–J8 review. Each subject is at most 72 characters with its ` (#N)`.
-
U1 (w2)
docs(adr): record canopy-identity’s senders.-
ADR-049 Amendment 16 (R1–R3, E1–E8, amending B7), plus the Status line.
-
This page (
In progress), with the nav group** Identity Plane Split (epic &130)above the archive line. -
The SAVE issue (#2811), related to #2648.
-
-
U2 (w3)
feat(auth): compile every service’s system purposes(E1).-
identity_policy.rs: oneconst PURPOSES: [SystemPurpose; 55], the portal’s 9 first (unchanged, so tests looking up by audience still find them first), then 46service_purpose!entries.purposes()returns it. -
Tests:
-
every_service_system_edge_has_one_purpose: each non-portal System or Both edge has exactly one purpose; -
a_service_purposes_one_scope_is_its_name; -
the existing naming, grammar, uniqueness and edge tests now cover 55;
-
a_pair_without_a_purpose_finds_nonekeeps its Delegation-only pair (Web → Persons).
-
-
Docs:
shared-crates.adoc.
-
-
U3 (w5)
feat(auth): add the canopy-identity sender(E2–E7).-
New module:
identity_settings.rs, withReceiverSettingsmoved and renamed. -
New module:
identity_sender.rs(+identity_sender/tests.rs). -
Updated:
-
identity_receiver.rs(re-exports, docs); -
identity_receiver/layer.rs(over_http); -
identity_client/delegation.rs(forget, an entry’s target); -
lib.rsre-exports; -
crates/canopy-test-lib/tests/identity_receiver_test.rs(the renamed type).
-
-
Test seams:
-
make
identity_client::testsandidentity_client::delegation::testspub(crate), with theirEndpoint,spawnand key helpers; -
IdentitySender::with_budget(self, Duration) → Selfis#[cfg(test)] pub(crate).
-
-
Tests:
-
The edge and origin matrix: an eligibility sender on the delegation mock (whose answers extend the chain by canopy-eligibility, and which the system source also accepts). It reads each request’s
grant_typeoff the mock’s recorded forms:-
Rules (System) by either origin → client credentials;
-
Caps (Delegation): user → token exchange, system →
SystemOriginwith no request; -
Persons (Both): by origin;
-
Notices (no edge) →
NoEdgewith no request; -
system_bearer(Caps)→NoSystemEdge.
-
-
Timeout: the system mock’s stall gate makes
bearerTimeoutat a short budget. Once the gate opens, the next call acquires. -
Rejection:
rejectedmakes the next system and delegation call reacquire (the mock’s hit count rises by one each). -
from_secrets: a missing key isKey(ProvisionedKeyError::Missing)namingCANOPY_ELIGIBILITY__IDENTITY_CLIENT_PRIVATE_KEY, and a provisioned PEM builds. -
client_key_secretgives each service client’s name. -
canopy-web and canopy-portal are
NotAService. -
OwnedBearerexposes the bearer’s string. -
The settings tests are moved, plus
token_endpoint().
-
-
Docs:
shared-crates.adoc;CHANGELOG.adocChangedfor the rename.
-
-
U4 (w3)
feat(auth): admit SOLQ by canopy-identity(E8).-
delegated_routes.rs: the SOLQ row, citingservices/canopy-verification/src/api/ssa.rs(handle_query). The count test goes to 120.the_deliberate_rows_keep_their_decisionspins SOLQ’s arms. -
xtask:
-
census.rspath_ofkeeps a value starting with/internal/, with a fixture test registeringpaths::SSA_SOLQas/internal/v1/ssa/solq; -
doc.rscells_inadmits/internal/v1/beside/v1/, with the reader’s refusal test extended (a backticked/internal/xis still refused).
-
-
Docs:
-
the regenerated table (
cargo xtask delegated-routes doc); -
in
authorization-inventory.adoc, the cross-cutting bullet on the/internal/v1surface (the one namingfetch_ssa_solq'sx-service-api-key) gains a sentence: the switch re-admits the four routes by canopy-identity, per Amendment 16 E8 (#2648). The route rows stay as today’s code; -
shared-crates.adoc's "119 routes" → 120.
-
-
-
U5 (w2)
test(auth): prove the sender on the devstack identity plane.-
The test file:
crates/canopy-test-lib/tests/identity_sender_test.rs, followingidentity_receiver_test.rs:-
a
broker()that returnsNonewheninfrastructure_available()is false, so the battery, which requires the devstack, runs the tests; -
a probe behind
IdentityReceiver::over_httpfor a given receiver and admission.
-
-
The tests:
-
Snap, system: snap’s sender, keyed from the broker’s keys directory through a one-secret provider (
client_key_secret(Snap)), takes a system token for verification byOrigin::System. The probe admits it undersystem_from(&[Snap]), and it carries the purposecanopy-snap/canopy-verificationwith that scope. -
Eligibility, onward: the broker mints jane.doe’s delegation for eligibility, and an
IdentityTokenValidatorfor eligibility verifies it into aPrincipal. Eligibility’s sender delegates onward to verification. The probe admits it under SOLQ’s compiled admission, with the actor chain canopy-eligibility, canopy-web and jane.doe’s realm subject. -
Snap, user origin on a System edge: a delegation addressed to snap, sent through snap’s sender for verification, gets a system token (E5).
-
-
Close:
-
CHANGELOG.adocAdded; -
Amendment 16’s as-built record;
-
the plan Done and archived;
-
plan-lint --donewith--allow-openfor #2806–#2810, #2648 and #2811; -
after merge, close the units, comment on #2648, and update the epic.
-
-
Scope
In: the purposes, the settings rename, the key loader, the sender, SOLQ’s row and the gate’s path rule, the devstack proof, the SAVE issue.
Out:
-
The switch (I3g): wiring the sender into any client or service; moving the shared clients and their call sites; the
ServiceSettingsfields; handing services their keys; moving the adapter routes; deleting the shared key. -
canopy-web’s sender, its session form and its system read (I3e).
-
The portal’s sender and canopy-cli (I3f).
-
A sender circuit breaker or metrics: the ADR names none.
Risks
-
A purpose’s scope reads as a grant it is not. E1 and the B7 amendment say it is informational, and a test holds it equal to the purpose name, so no one adds meaning to it unnoticed.
-
B4’s origin is wrong at a call site. The edge rule refuses the impossible pairs locally (
NoEdge,SystemOrigin,NoSystemEdge). The rest is the switch’s call-site review, run against I3g’s battery as real users. -
The rename touches I3c’s public type. It is unwired and pre-1.0. The
CHANGELOGnotes it.
Verification
-
Per unit: fmt; clippy with validate’s flags; nextest for canopy-auth (U2–U4), xtask (U4) and canopy-test-lib (U5); quality-budgets, plan-lint and check-docs;
cargo xtask delegated-routes check(U4). -
U5: run on a devstack whose canopy-security is built from the branch (
cargo xtask dev reload), since the issuer serves the new purposes only from U2’s code. -
Per MR: the pre-push battery.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic |
Claude Opus 5.5 (fresh subagent) |
no-ship. One blocker, fixed in-plan: B1, U4’s doc targets named a paragraph and a note that don’t exist (now the inventory’s Notes folded in: U5 follows the battery’s |
The maintainer shipped after round 1 (2026-10-09).