Identity plane split, plan I3c2: canopy-identity delegated routes (epic &133)

Status: Done (2026-10-09) — !1584
Epic: &133 (stage I3 of &130)
Issues: #2799 (the stage issue, closed by U3); #2800 (U1, w2); #2801 (U2, w5); #2802 (U3, w3). U1 files #2803, #2804 and #2805.
MR: feat/identity-delegated-routes, "canopy-identity delegated routes (#2799, #2800 … #2802)".

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. M1–M6 are this plan’s decisions (ADR-049 Amendment 15); R1–R6 are the maintainer’s rulings.

Context

Plan I3c built Principal and Admission, which has a user-via arm. Its round 2 found the gap I3c2 closes.

The gap. Today canopy-web, canopy-cli (under canopy login service) and services inside a worker’s request call many routes on their own service token. After the switch each such call carries the user’s delegation token: * canopy-web’s edges and canopy-cli’s are delegation only; * B4 makes every in-request service call delegation.

So each such route’s judgment moves from its service arm to its user arm. The route breaks when it has no user arm, or when its user arm admits fewer roles than the caller lets through.

The inventory. It was built in round 2 and re-verified for this plan by three read-only code walks (2026-10-09; #2799).

Maintainer rulings (2026-10-09): * R1. Visibility is preserved (L7). A route canopy-web calls admits every role canopy-web shows that page to. * R2. In-request service routes admit users via (L7). Only through the arm listing those callers. * R3. A compiled table plus a gated doc. The admissions are code, checked against the call graph; the inventory page is generated from them. * R4. Audit reads. admin, studio_admin and auditor read freely; case roles only through case- or resource-scoped queries. * R5. Enrollment’s household gate stays. A delegated read follows the worker’s own assignment. * R6. canopy-cli’s operators are admitted by each route’s effect. The CLI’s notice mark-read verb goes.

canopy-web’s gates as token roles. WorkerRole::from_roles resolves one role per session by precedence, and every resolved role is one the token holds (services/canopy-web/src/session.rs, dashboard/role_map.rs):

canopy-web gate Roles it lets through

any session (AuthenticatedWorker: the process, intake, /cases, fact-history pages, …)

caseworker, eligibility_specialist, supervisor, analyst, admin, studio_admin, auditor

WritePermission

CASEWORKER_WRITER_ROLES

case sections, all-roles panels

caseworker, eligibility_specialist, supervisor, analyst, admin, studio_admin

supervisor panels

supervisor, studio_admin

supervisor/admin operations

supervisor, admin

audit log

admin, studio_admin, auditor

Decisions (ADR-049 Amendment 15, M1–M6; land with U1)

  • M1. Scope. A route is listed when two things hold:

    1. a delegation caller reaches it today on its own service token: canopy-web, canopy-cli under its service login, or a service inside a worker’s request;

    2. the admission I3c’s table translates from today’s guard does not already admit every user that caller lets through.

    Every other route translates by I3c’s table alone.

    • One exception: applications' day-30 shadow findings. canopy-web’s call is meant to carry its identity but sends none today, a pre-existing defect U1 files.

  • M2. Formation. A listed route’s admission is the translation plus one via arm, and_user_roles_via(callers, roles):

    • callers are exactly the delegation callers that reach it on a service token;

    • roles cover the union of what each caller’s own gate lets through: canopy-web’s by the table above; a service hop’s by the admission of the route it serves inside, transitively; canopy-cli’s by the route’s effect (M3).

    Today’s portal arms remain. Today’s system arm remains too, unless no client holds a system edge to the service: appeals, wic and reporting. There the arm is dropped, since L3 already refuses every system token there, so nothing narrows for system work.

  • M3. Role sets. OR is CASEWORKER_OR_ABOVE_ROLES; W is CASEWORKER_WRITER_ROLES. New constants in crates/canopy-auth/src/claims.rs:

    • CASE_READER_ROLES (R+) = OR + analyst + studio_admin;

    • WORKER_READER_ROLES (R+a) = R+ + auditor;

    • AUDIT_READER_ROLES (Aud) = admin, studio_admin, auditor;

    • SUPERVISOR_VIEW_ROLES (SupV) = supervisor, studio_admin.

    The rule:

    • A row’s roles are the smallest set containing M2’s union, in the order admin ⊂ SA (supervisor, admin) ⊂ W ⊂ OR ⊂ R+ ⊂ R+a, with SupV ⊂ R+ and Aud ⊂ R+a.

    • One exception: the all-alerts feed keeps supervisor, admin, studio_admin. canopy-web gives the feed only to those three, and rounding up would add case roles.

    • canopy-cli by effect: a read takes OR (today’s bar for direct worker reads), a write W, a destructive call SA, an operations call admin, an audit read Aud.

    • Ties: where two sets tie (SupV and Aud for {studio_admin}), the row’s pinned set stands. The table is authoritative; the rule derived it.

    • Literals: the constants are literal slices, so xtask’s role scan resolves them.

  • M4. Deliberate service-only bars.

    • snap’s hearing view admits users. Its projection holds no sealed data, and Web→Snap is delegation-only.

    • snap’s snapshot admits users via eligibility for its dry-run only. Direct reads, the CLI’s included, keep admin/QC.

    • applications' record-determination admits writers via canopy-web; its signed-provenance check is unchanged.

    • snap’s operation envelope stays eligibility’s system read (bookkeeping).

    • notices' mark-read stays the portal’s. The CLI verb goes in I3f (an issue U1 files).

    • canopy-web’s worker-name refill (GET /v1/security/workers) stays system, on canopy-web’s own system token (I3d/I3e). The workers-observed post and the exchange-audit ingest stay system too.

  • M5. Rules the switch implements, beyond admission:

    • Security events and fact history: a case role is admitted only for a case- or resource-scoped query (R4). canopy-web’s dashboard audit-events panel, unscoped today, scopes its query (I3e).

    • applications' assignments/household-ids: the subject is the caller’s own unless supervisor or admin.

    • persons:batchGet's SSN projection stays system-only.

    • A fact’s author comes from the bearer, never a body or query field (the CLI’s --author-sub).

    • The rep-disqualification cancel admits writers via appeals only for hearing_overturned.

    • The eligibility scoped feed drops canopy-web’s service arm.

    • Enrollment’s household gate applies to delegated reads (R5).

  • M6. The compiled table. canopy_auth::identity_receiver::delegated_routes() lists one DelegatedRoute { service, method, path, admission } per route below.

    • Tests hold it to the call graph: every via actor holds a delegation edge to the service; a route keeping a system arm has a system caller; routes are unique.

    • xtask generates the inventory page’s table, gates drift, and checks each path is registered in its service.

    • The switch admits each listed route by its constant.

The delegated routes

Callers: Web, Cli, A (applications), Ap (appeals), E (eligibility), En (enrollment), Rp (reporting), Sn (snap), V (verification).

Today: RSC = require_service_caller (translates to system()); SP = service or portal with the route’s scope; OR, W, SA = today’s user arm.

Route Today Via Roles Note

persons

POST /v1/persons

RSC

Web, Cli

W

GET /v1/persons

RSC

Web, Cli

R+a

case search

GET /v1/persons/{id}

SP

Web, Cli

R+

PUT /v1/persons/{id}

RSC

Web, Cli

W

DELETE /v1/persons/{id}

RSC

Cli

SA

POST /v1/households

RSC

Cli

W

GET /v1/households/{id}

RSC

Web, Cli, E, V

R+a

process, intake, fact history

GET /v1/households/{id}/full

RSC

Web, Cli, E, Sn

R+

POST /v1/persons:batchGet

RSC

Web, A

R+a

SSN system-only

POST /v1/households:batchGet

RSC

Web, A, V

R+a

POST, DELETE /v1/households/{id}/members/claims[/{fact_id}]

RSC

Web, Cli

W

author from bearer

GET /v1/persons/{id}/income

RSC

Web, Cli

R+a

POST, DELETE /v1/persons/{id}/income/claims[/{fact_id}]

RSC

Web, Cli

W

GET /v1/persons/{id}/assets, /v1/persons/{id}/expenses

RSC

Cli

OR

POST /v1/persons/{id}/assets/claims, …/expenses/claims

RSC

Web, Cli

W

GET /v1/persons/{id}/addresses

RSC

Web

R+

POST, DELETE /v1/persons/{id}/addresses/claims[/{fact_id}]

RSC

Web, Cli

W

applications

GET /v1/applications

RSC

Web, Cli

R+a

GET /v1/applications/{id}

SP

Web, Cli, E, V

R+a

POST /v1/applications

RSC

Web, Cli

W

DELETE /v1/applications/{id}

RSC

Cli

W

POST /v1/applications/{id}/programs/{program}/determination

RSC

Web

W

provenance unchanged

GET /v1/applications/{id}/documents

SP

Web

R+

GET /v1/applications/{id}/documents/{document_id}/content

RSC

Web

R+a

POST /v1/applications/{id}/documents/{document_id}/rescan

RSC

Cli

SA

POST /v1/applications/{id}/interview/waive

RSC

Cli

W

GET /v1/applications/caseload-trend

RSC

Cli

OR

GET /v1/applications/day30-shadow-findings

RSC

Web

SA

M1 exception

GET /v1/applications/{id}/determination-context

RSC

E

W

GET /v1/households/{id}/assignments

RSC

Web, En

OR

R5; enrollment’s household reads admit OR

GET /v1/assignments/household-ids

RSC

E

OR

subject rule

GET /v1/applications/{id}/sections

OR

Web

R+a

intake page

GET /v1/applications/{id}/interviews

OR

Web

R+a

process page

GET /v1/households/{household_id}/authorized-representatives

OR

Web

R+a

rep history

GET /v1/persons/{person_id}/rep-disqualifications

OR

Web

R+a

rep history

GET /v1/administrative-denials/{id}

OR

Web, Ap

R+a

process page

GET /v1/applications/{id}/agency-pends

OR

Web

R+a

process page

GET …/programs/snap/reopen/eligibility, …/reopen/episodes, …/postponement

OR

Web

R+a

process page

POST /v1/rep-disqualifications/{id}/cancel

SA (exchanged)

Ap

W

hearing_overturned only

enrollment

GET /v1/enrollments

RSC

Web

R+

POST /v1/enrollments, POST /v1/enrollments/{id}/issue

RSC

Web

W

GET /v1/enrollments/{id}/issuances

RSC

Web

R+

GET /v1/adverse-actions

RSC

Web

R+

GET /v1/adverse-actions/{id}

RSC

Web, Ap

W

PUT /v1/adverse-actions/{id}/stays/{appeal_id}

RSC

Ap

W

POST /v1/households/enrollments:batchGet

RSC

Web

R+a

case search

GET /v1/enrollments/live

RSC

E, Sn

W

renewals

GET /v1/renewals/snap/certifications

SP

Web, E

R+a

GET /v1/renewals/snap/certifications/{id}

RSC

A

W

GET /v1/renewals/snap/due, /v1/renewals/{program}/due

RSC

Web

R+a

GET /v1/renewals/overdue, /v1/renewals/snap/interim-contacts/due

RSC

Web

R+

GET /v1/renewals/caseload-trend

RSC

Web, Cli

R+

GET /v1/renewals/snap/nudges

RSC

Web, Cli

R+

POST /v1/renewals/caseload-rollup/refresh

RSC

Cli

admin

notices

GET /v1/notices, /v1/notices/{id}, /v1/notices/{id}/pdf

SP

Web

R+a

appeals

GET /v1/appeals, /v1/appeals/queue

RSC

Web

R+a

system arm dropped (M2)

GET /v1/appeals/hearings/upcoming

RSC

Web

SupV

system arm dropped

GET /v1/appeals/{id}

RSC

Web

W

system arm dropped

eligibility

GET /v1/eligibility/determinations

OR + portal

Web

R+a

GET /v1/eligibility/case-status

OR

Web

R+a

GET /v1/eligibility/cross-program-alerts/all

SA or canopy-web

Web

supervisor, admin, studio_admin

canopy-web’s arm retires

reporting

GET /v1/reporting/overpayments/summary

OR

Web

SupV

system arm dropped

GET /v1/overpayments (snap, tanf, medicaid)

OR

Rp

R+

onward from the summary and export

snap

GET /v1/determinations/{id}/hearing-view

RSC

Web, Cli

R+

M4

POST /v1/determine/dry-run

RSC

E

OR

GET /v1/determinations/{id}/snapshot

RSC or admin/QC

E

OR

M4

GET /v1/determinations, /v1/abawd/tracking, /v1/tsnap

OR

Web

R+

GET /v1/verification/discrepancies

OR

Web, Cli

R+

GET /v1/params

OR + portal

Web

R+a

process page

tanf

GET /v1/determinations, /v1/work-requirements/{person_id}[/activities], /v1/time-limits/{person_id}

OR

Web

R+

GET /v1/tanf/sanctions/rollup

OR

Web

SupV

medicaid

GET /v1/determinations, /v1/applications/{id}/categories, /v1/ele/household/{household_id}, /v1/households/{household_id}/determinations/newest, /v1/cmd/events, /v1/cmd/escalations

OR

Web

R+

caps

GET /v1/providers/{id}

RSC

Web

R+

GET /v1/determinations, /v1/determinations/{id}/authorizations

OR

Web

R+

wic

GET /v1/wic/appointments/upcoming

RSC

Web

R+

system arm dropped

GET /v1/determinations, /v1/nutritional-risk-assessments

OR

Web

R+

system arm dropped

verification

POST /v1/verifications/batch-context

RSC, applications only

A

R+a

process-page reads

POST /v1/verifications/cancel-open

RSC, applications only

A

W

GET /v1/verifications

OR + portal

Web

R+a

GET /v1/verifications/{id}/responses, /v1/verifications/ievs/discrepancies

OR

Web

R+

security

GET /v1/security/events

service or admin

Web, Cli

R+a

case roles scoped (M5)

GET /v1/security/events/{id}, /v1/security/chain/attest

service or admin

Web, Cli

Aud

GET /v1/security/chain/status

service or admin

Web, Cli

R+a

case Audit section

GET /v1/security/persons/{person_id}/fact-history/{resource}

service or admin

Web, Cli

R+a

resource-scoped

GET /v1/security/summary, /v1/security/alerts, /v1/security/nist-controls

service or admin

Cli

Aud

audit reads; the CLI’s chain verify and its job poll are operations and keep today’s admin arm, unlisted

rules

GET /v1/rule-sets, /v1/rule-sets/{name}, POST /v1/evaluate

RSC

Cli

OR

A row naming several routes is one DelegatedRoute per route. U2 writes each route’s exact registered path and cites its handler.

Units

Erratum (2026-10-09): M2’s dropped system arm applies wherever no client but the portal holds a system edge, since a system arm never admits the portal. So the three notices rows drop theirs too, keeping their portal arm. U2’s review found it, and U2’s test excludes the portal.

Erratum (2026-10-09): U3’s header row ends at Via roles, without the trailing | written below, which AsciiDoc would read as a ninth, empty cell.

Every commit goes through the J1–J8 review. Each subject is at most 72 characters with its ` (#N)`.

  1. U1 (w2) docs(adr): record canopy-identity’s delegated routes.

    • ADR-049 Amendment 15 (M1–M6, R1–R6), plus the Status line.

    • This page (In progress), with the ** Identity Plane Split (epic &130) nav group above the archive line.

    • Issues filed (fix: for a pre-existing defect):

      • canopy-web’s day-30 shadow-findings call sends no identity;

      • canopy-web’s case tab fragments and ?program=all skip the composition role filter, so an auditor session reaches case reads by URL;

      • an I3f issue to drop canopy-cli’s notice mark-read verb.

  2. U2 (w5) feat(auth): compile canopy-identity’s delegated routes (M3, M6).

    • claims.rs: the four role sets, as literal slices, added to the vocabulary test’s list of bar constants.

    • Admission: read accessors, in an impl block of their own (the type’s main impl stays at or under 16 methods):

      • system_arm() → SystemArm, where SystemArm { None, Any, From(&'static [ConfidentialClient]) } becomes public;

      • portal_scope() → Option<&'static str>;

      • user_arm() → Option<&'static [&'static str]>;

      • via_arm() → Option<(&'static [Client], &'static [&'static str])>.

    • identity_receiver/delegated_routes.rs: DelegatedRoute (service: CanopyService, method: axum::http::Method, path: &'static str, admission: Admission), and delegated_routes() → &'static [DelegatedRoute], each row citing its handler in a comment. Re-exported.

    • Tests:

      • every_via_actor_holds_a_delegation_edge (may_delegate).

      • a_system_arm_has_a_system_caller: for Any, some client holds a system edge to the service; for From, each listed client does.

      • routes_are_unique by (service, method, path).

      • each_route_admits_its_callers_users_and_refuses_others:

        • a user holding one of the via roles is admitted via each listed caller;

        • a user holding no role of either user arm is refused required_role_missing;

        • for each delegating actor (delegators_of(service)) not listed, a user holding only a via role that the translated user arm lacks is refused actor_not_allowed when the row has no plain user arm, else required_role_missing. The case is skipped when there is no such actor or no such role.

    • Docs: shared-crates.adoc.

  3. U3 (w3) chore(xtask): gate the delegated-route inventory (M6).

    • cargo xtask delegated-routes doc | check, modeled on cargo xtask call-graph (xtask/src/cmd/call_graph/doc.rs, its rows_in and edge_of):

      • doc prints authorization-inventory.adoc's == Delegated routes (canopy-identity) table from delegated_routes(), sorted by service, path, method.

      • The header: | Service | Method | Path | System | Portal | Users | Via | Via roles |.

      • The cells:

        • System is —, any, or comma-joined client ids;

        • Portal is the scope or —;

        • Users and Via roles are a role set: the constant’s name when it equals one of the six (CASEWORKER_OR_ABOVE_ROLES, CASEWORKER_WRITER_ROLES, CASE_READER_ROLES, WORKER_READER_ROLES, AUDIT_READER_ROLES, SUPERVISOR_VIEW_ROLES, compared as sets), otherwise comma-joined sorted roles, or —;

        • Via is comma-joined client ids.

      • check parses the rows back and fails on drift either way.

      • It also fails on a (service, method, path) its service does not register. The registration census (xtask/src/cmd/delegated_routes/census.rs) parses with syn every non-test source of services/<service>/src, plus crates/canopy-overpayments/src for snap, tanf and medicaid. For each .route(path, router) call:

        • the path is v1_route!(<expr>) or a string literal;

        • <expr> is a literal, or paths::NAME, resolved through the file’s use canopy_contracts_<x>::paths (or {…, paths}) to NAME's &str constant in crates/canopy-contracts-<x>/src (paths.rs or its mod paths);

        • a relative literal is prefixed /v1 (the router nests service routes there);

        • the methods are every get/post/put/patch/delete in the router expression, as a call (post(h), axum::routing::delete(h)) or a chained method (.get(h)).

      • A registration it cannot resolve is listed, and a per-service floor on resolved registrations fails a stale scanner, as the QC sweep’s floors do.

    • A delegated-routes validate stage beside call-graph.

    • Tests, on fixture sources:

      • drift each way;

      • a missing or doubled section;

      • a wrong method (a path registered get(h) refuses a POST row);

      • a removed registration (the path constant and its utoipa annotation remain, no .route);

      • a paths::NAME resolved through its use;

      • a relative literal;

      • a chained router (post(a).get(b) registers both);

      • an unresolvable path, listed;

      • the proptests no_page_panics_the_table_reader and rendered_rows_parse_back (render, then parse, gives the same rows), as call_graph/doc/tests.rs has.

    • Close:

      • the generated section;

      • CHANGELOG.adoc Added;

      • Amendment 15’s as-built record;

      • the plan Done and archived;

      • plan-lint --done with --allow-open for #2799, the U1–U3 issues and the three issues U1 files;

      • after merge, close #2799 and update the epic.

Scope

In: the inventory, the role sets, the compiled table and its tests, the gated doc, the three filed issues.

Out: * wiring, the M5 rules, and the routes I3c’s table translates alone (I3g); * senders, purposes and canopy-web’s system-token reads (I3d, I3e); * the CLI verb (I3f).

Risks

  • A missed call breaks at the switch as a 403. The table comes from three code walks, re-verified once; U2 cites each handler. I3g’s battery, running as real users through the broker, exposes a miss.

  • Rounding up admits a role a caller doesn’t let through. It never reaches an actor that isn’t listed, and the one supervisor feed it would have widened keeps its literal set.

Verification

  • Per unit: fmt; clippy with validate’s flags; nextest for canopy-auth (U2) and xtask (U2, U3); quality-budgets, plan-lint and check-docs; cargo xtask delegated-routes check (U3).

  • Per MR: the pre-push battery.

Review log

Round Vendor Resolved model Verdict

1

Anthropic

Claude Opus 5.5 (fresh subagent)

no-ship. Three blockers, fixed in-plan:

  • B1 the per-row refusal for an unlisted actor (actor_not_allowed only without a plain user arm);

  • B2 the dead system arms on appeals, wic and reporting (dropped, M2);

  • B3 accessor names that clashed, a public SystemArm, and the generated table’s header and cell forms.

Notes folded in: the R5 row is OR (enrollment’s reads admit QC); U3’s proptests; the --allow-open list; the nav group’s name; literal role constants; the accessor impl block; ties in M3.

2

not stated (the maintainer’s other vendor)

not stated

2 findings (P2), fixed in-plan:

  • the CLI’s security summary, alerts and NIST-controls reads were missing (rows added, Aud; chain verify and its poll stay admin);

  • U3’s registration check matched path literals only; now a syn census of (service, method, path) through contract path constants, tested on a wrong method and a removed registration.

Edit this page · default