Worker identity as an opaque OIDC subject, with typed actors (#1008)
- Context
- Scope
- Design
- Units — U-A → U-H, one MR
- U-A (w5) —
refactor(common,auth): one OidcSubject type and a typed Actor (#1008) - U-B (w3) —
refactor(web): take the session subject as OidcSubject (#2327) - U-C (w8) —
refactor(applications): typed actors and body-borne assignees (#2328) - U-D (w3) —
refactor(eligibility,enrollment): scope reads by OidcSubject (#2329) - U-E (w5) —
refactor(verification,wic,appeals): typed actors and referents (#2330) - U-F (w5) —
refactor(medicaid,snap,tanf): typed actors and the ELE chain (#2331) - U-G (w3) —
refactor(renewals,reporting): action actors from the bearer (#2332) - U-H (w3) —
test(seed): seed opaque subjects and document typed actors (#2333)
- U-A (w5) —
- Verification
- Documentation Updates
- Review log
Status: Done (2026-09-26) — !1517
Issues: #1008, #2327–#2333 (epic &129)
Branches: refactor/1008-oidc-subject-actors (carries this page)
This is a Design + Scope plan. GitLab owns tracking, and each child issue (and #1008 for U-A) carries its unit’s exact inventory. The plan freezes when U-A starts. It ships as one MR with one battery, because the wire and contract changes must land in lockstep. For example, enrollment’s assignment gate deserializes applications' response, and medicaid’s consent subscriber parses applications' event.
Erratum (2026-09-26): D4’s guard also refuses every row whose pre-#1008 writer recorded a service’s own sub as a UUID subject, since that cannot be told from a human’s: every application_sections row, every cancelled rep_disqualifications row, every overpayment_claims row, every overpayment_recomputes row and every resolved ievs_discrepancies row. A converted service account would be an invented human.
Erratum (2026-09-26): D7’s framed form also opens every nullable input with a presence byte (0x00 absent, 0x01 then the value) in place of the NONE / GENESIS sentinels, and hashes source_application_id, which was not a chain input. The verifier reads the stored actor as raw text, so a malformed, doubled or missing actor is a break at that row, not an error.
Erratum (2026-09-26): the snap IEVS resolution event carries its actor as resolved_by (D3’s wire name), not under the facts author key. canopy-security’s actor-field scan reads every #1008 actor field and composition’s actor_user_id, and only a typed Actor may record the reserved human / service classes (D8).
Erratum (2026-09-26): EffectiveUser::actor() also refuses (403) a bearer naming two distinct services, or a citizen-class azp that disagrees with its service: role. The portal finalize records its ELE consent as the finalizing service and admits only a citizen-class principal equal to the bearer’s azp.
Context
A worker is (issuer, sub), and sub is opaque and case-sensitive (OIDC Core 1.0 §2). Canopy projects it into a Uuid almost everywhere:
-
Projections and duplicates.
parse_worker_uuid(services/canopy-web/src/api/composition.rs:197),parse_user_id(api/dashboard.rs:708),canopy_composition::UserId(crates/canopy-composition/src/types.rs:140), about 20 service-sidesubparses,KeycloakSubbeside the contracts-securityWorkerSubject, and three{worker_id}path templates (the typed-id allowlist’s only entries). -
Nil sentinels. A service act records
Uuid::nil()(api/reopen_support.rs:54,postponement_saga.rs:364, snapapi/recompute_handler.rs:239-245), encoded in three CHECKs (20261222000000_reopen_void_audit.sql:42-48,20261223000000_postponement_episodes.sql:55-59). -
Lost or wrong actors. Many service writes record NULL, which loses which service acted. Section edits record canopy-web’s service account, and ELE consent records an applicant
PersonIdwhen no human bearer is present. -
Actors in bodies. The renewals nudge / redetermination
action_by, WICassessor_worker_idand IPVreferred_bycome from request bodies, the service-transported human that ADR-043 C1 retired. Some worker fields are typedPersonId.
Rulings in force: the #1008 ruling (2026-09-11, amended); the maintainer’s 2026-09-25 rulings (the type name; the correct service-actor model); ADR-046 (opaque, query-borne subject; issuer deferred, item 5); ADR-043 (EffectiveUser); ADR-001 §B4. Pre-1.0: no compatibility shims, and data that cannot be expressed is refused, never invented.
Scope
In scope: D1–D9 below.
Out of scope (GitLab follow-ups, linked from the closing comment):
-
free-string actor columns typed as
Actor: eligibilityrequested_by(the worker’s display name, from a body), the appeals*_actorcolumns, WICscheduled_by, medicaidclaim_adjustments.actor, renewalsconverted_by, and enrollment’ssub=…; actor=…composites; -
a per-row issuer at the federation trigger (ADR-046 item 5);
-
more TEXT actor columns outside this inventory:
quarantine_resolutions.actor, thecohort_runsactors, snap/tanfclaim_provenance_adjustments.actor, tanfrecorded_by/resolved_by; -
the pending-verifications panel filters on the never-written
verifications.worker_id; -
canopy-web’s WIC assessment form captures no
risk_codes, so its write is refused; -
#607’s assignment revamp builds on
OidcSubject(coordinate, don’t block).
Design
Decisions
| # | Decision |
|---|---|
D1 |
Types (new
|
D2 |
The bearer is the only actor source.
|
D3 |
Storage: one of three shapes per column (
|
D4 |
Migrations and the reset cutover (pre-1.0, so the only populated databases are devstacks).
|
D5 |
Routes (auth classes unchanged unless D6 says otherwise).
|
D6 |
Actors move from bodies to the bearer.
|
D7 |
The ELE hash chain is framed (
|
D8 |
Audit rendering uses actor metadata, not spelling.
|
D9 |
Column shapes (D3)
The shapes are classified by writer class, as of main at 5664cb71d. The child issues carry each column’s file and line.
| Shape | Columns |
|---|---|
Pair, mandatory ( |
|
Pair, optional ( |
|
Human-only |
|
Referent |
|
Invariants
Over the columns above and their wire fields and events:
-
None holds a UUID-projected or nil subject, or a value that fails D1.
-
Every recorded actor is exactly one of a human’s OIDC subject or a named service, and it comes from the bearer or the writing job.
-
No provenance is invented: a row that cannot state its actor is refused, never guessed.
Units — U-A → U-H, one MR
Commit 1 is docs(plans): plan the OIDC subject and typed actors (#1008). The last is docs(plans): close the OIDC subject plan (#1008).
Each unit retypes its service’s columns, contracts, events and clients, and updates every consumer of what it changes, so each commit compiles. Each unit also updates its services' pages under docs/modules/ROOT/pages/api/ and docs/modules/ROOT/pages/data-models/.
U-A (w5) — refactor(common,auth): one OidcSubject type and a typed Actor (#1008)
Files:
-
crates/canopy-common/src/{identity,lib}.rs;crates/canopy-auth/src/{claims,effective_user}.rs, plus everyClaims { sub: … }literal and.subread in the workspace. -
contracts-facts, contracts-persons and contracts-security, with their persons / snap / security / web
worker_directory.rsconsumers. -
ADR-043 amendment (the typed actor, D2/D3) and ADR-046 addendum (opaque subjects in every row; issuer deferred).
Tests:
-
A proptest that D1’s invariant round-trips and refuses empty / over-255-byte / control input.
-
Actorserde andfrom_columns(both set → error). -
A malformed stored subject or principal fails
Decode. -
A token with an invalid
sub→ 401; aSystemwithout a validservice:role → 403 fromactor(). -
Security’s observation and lookup, and persons'
close_author, keep" alice "distinct from"alice".
U-B (w3) — refactor(web): take the session subject as OidcSubject (#2327)
Files: the composition crate (UserId removed); the canopy-web migration (composition_documents.created_by and the archive’s created_by / archived_by in ONE migration); session.rs worker_id: OidcSubject; participation.rs; D8: canopy-web audit/mod.rs resolve_actor and canopy-security event_parsing.rs extract_actor.
Tests:
-
A non-UUID session subject writes and merges the user layer. The stored-session JSON fixture passes unchanged.
-
A human subject spelled
Systemrenders as a worker, not "system". -
An
Actorservice row renders its principal.
U-C (w8) — refactor(applications): typed actors and body-borne assignees (#2328)
Files:
-
All 14 applications columns (D3/D4): the migration order (including
postponement_reverted_pair), the guard, the pair CHECKs. -
The D5 assignment routes, contracts and events (
SectionUpdatedEvent,DocumentScanOverriddenEventplus canopy-security’s parser,EleConsentRecordedEventplus medicaid’s subscriber andele_consents). -
Consumers: eligibility’s assignments client, enrollment’s
AssignmentRow, web participation and the section proxy (D6), test-lib clients,tests/e2e/lib/given/assignments.ts.
Tests:
-
A non-UUID worker end to end: assign, list, the enrollment gate’s
AssignmentRow, section edit. -
Each mandatory pair refuses both and neither.
-
Each optional pair admits neither before the act, and refuses neither once the act predicate holds, and both at any time.
-
A service-reverted postponement converts. The guard raises on a historic
systemdenial and on a nil with no service. -
A saga revert records
Service. -
A service consent records its service. An old-shape consent event reaches medicaid’s DLQ, not an ack.
U-D (w3) — refactor(eligibility,enrollment): scope reads by OidcSubject (#2329)
Files: eligibility handlers.rs (the scoped route and query, AlertsAccessedV1.effective_worker); enrollment api/{mod,continuations,successors}.rs, events.rs, services/canopy-enrollment/src/clients/mod.rs (the AC-6 gate); the web cross-program-alerts panel and Plugin.toml; test-lib eligibility client; allowlist + typed_ids.rs.
Tests:
-
The resolve matrix, with
non_uuid_subject_fails_closedrewritten to pass, and the alerts gate with a non-UUID assigned worker. -
A reserved-character subject reaches applications encoded.
-
The old paths → 404.
-
Every enrollment human read is audited, including an assigned non-UUID caseworker.
U-E (w5) — refactor(verification,wic,appeals): typed actors and referents (#2330)
Files: verification (the completed_by / cancelled_by pairs, worker_id referent, reviewed_by; store.rs ::UUID casts); WIC (D6 route and request, actions_wic.rs); appeals (referred_by pair + D6 gate, both recorded_by, hearing_officer_id referent; PersonId → OidcSubject); the test-lib conformance entries for changed gates.
Tests:
-
A postponement-saga cancel records
Service("canopy-applications"). -
A WIC assessment by an exchanged worker records its subject, a service bearer → 403, and a body assessor is refused.
-
An exchanged IPV referral records the human.
U-F (w5) — refactor(medicaid,snap,tanf): typed actors and the ELE chain (#2331)
Files:
-
Medicaid
ele_grant_eventspair + D7 andrevoked_by. -
The canonical overpayments
discovered_bypair: a newcrates/canopy-overpaymentstemplate + const + parity test, stamped identically into snap / tanf / medicaid. -
Snap
overpayment_recomputes.requested_bypair (caller_uuidremoved),granted_by,screened_by, theievs_discrepanciespair, in a separate snap-only migration.
Tests: D7’s vectors and collision cases; the guard on existing chain rows; parity; a scheduler lapse records Service("canopy-medicaid"); a non-UUID recompute records the human.
U-G (w3) — refactor(renewals,reporting): action actors from the bearer (#2332)
Files: renewals recert_nudges / pr_redeterminations pairs + D6, processed_by; reporting generated_by; web actions.rs nudge body; conformance entries.
Tests: a body action_by is refused (unknown field). An exchanged redetermination action records the human; a service one records its service.
U-H (w3) — test(seed): seed opaque subjects and document typed actors (#2333)
Files:
-
Seed: model/datagen/sql/manifest. Seed-cast workers that never log in use non-UUID subjects; realm-fixture users keep their realm subjects.
-
tests/e2e/lib/seed.ts. -
Docs: CHANGELOG,
authorization-inventory.adoc,shared-crates.adoc, ADR-027 line 64,guide/supervisor.adocandrunbooks/alerts-scoping-cutover.adoc(the retired routes),tools/canopy-clidocs. -
OpenAPI (
api-docs --update).
Tests: the seed integration suite asserts a non-UUID subject in every retyped table it writes.
Verification
-
Per unit: fmt, clippy, nextest and quality-budgets in isolated worktrees.
-
cargo xtask dev restart(the D4 reset), thencargo xtask test --integration --host --no-refresh --skip-static --run-ignoredfor the touched services. -
cargo xtask e2e(it reseeds). -
typed-ids audit-path-uuid,route-authz,api-docs --update, thengit push. The battery is the gate.
Documentation Updates
-
ADR-043 amendment; ADR-046 addendum.
-
The
docs/modules/ROOT/pages/api/anddocs/modules/ROOT/pages/data-models/pages of every touched service;authorization-inventory.adoc;rbac-matrix.adoc(WIC, IPV and redetermination gates);shared-crates.adoc. -
CHANGELOG.adoc:-
Changed: the columns, the routes,
Claims.sub, the actor wire shape, the gates. -
Removed: the two newtypes,
UserId, the worker path segments, the body actors. -
Fixed: section-edit attribution; service writes that recorded no service.
-
The D4 upgrade note: a quiesced drain, then the reset.
-
-
GitLab: file the out-of-scope follow-ups.
Review log
| round | vendor | resolved model | verdict |
|---|---|---|---|
1 (2026-09-25) |
Anthropic |
claude-opus-5-5 |
no-ship — four blockers fixed: commit subjects over 72 characters; the WIC web write claim (its form lacks |
2 (2026-09-26) |
OpenAI |
gpt-6-astra |
no-ship — 11 findings fixed. A framed ELE hash replaces the ambiguous concatenation (D7). The migration drops lifecycle CHECKs such as |