Plan: Constituent & Provider Portals — The Portal Substrate and the Foster-Parent Portal First (&13 / &50)

Archive record

Merge requests: !1630 (U0 plan page + ADR-076, Closes #1841) + !1631 (U1, Closes #1842) + !1632 (U2, Closes #1843) + !1633 (U3, Closes #1844) + !1635 (U4, Closes #1845) + !1639 (U5, Closes #1846) + !1640 (U6a, Closes #1847) + !1641 (U6, Closes #1848) + !1642 (U7, Closes #1849) + !1643 (U8a + U8, Closes #1850 / #1851) + !1644 (U9, Closes #1852) + !1646 (U10, Closes #1853) + !1649 (U11, Closes #634) + !1650 (U12, Closes #1854 / #87)

2026-09-15 — CRAIG’s first public-user surface, on a substrate the provider and family portals inherit. Identity stays in the SAME realm: three portal realm roles (craig_auth::PORTAL_REALM_ROLES, disjoint from the worker set), the public craig-portal-ui client (code + PKCE, client-level lifespans) and the portal BFF’s confidential craig-portal client, both with audiences for craig-placement and craig-financial ONLY; craig-web’s worker-audience gate shipped FIRST (pre-1.0 Changed). A portal BFF reaches a backend over the subject-token channel — its own service token as the CHANNEL, the user’s OWN IdP token in X-Craig-Subject as the IDENTITY, verified against the same JWKS under aud + an azp allowlist; the BFF mints nothing — and the fleet guard in craig-api contains the channel before any ruleset (a portal-role bearer 401 everywhere, a channel without a subject 401, a subject confined to the configured /v1/<svc>/portal/ prefixes). Authority is the effective-dated caregiver binding ledger on craig-placement (a foster home XOR a home-less kinship placement bound to a cases person; invitation codes as ADR-062 one-time secrets; enrolment answers ONE uniform 404), read AUTHORITATIVELY by financial on every request — revocation is one row. Hosts: crates/craig-bff extracted from craig-web behaviour-neutral, and the new services/craig-portal. Reads are dedicated data-minimised projections — units / unit / training / certificates on placement (child names first name + last initial through the batched cases arm, worker display names through the security arm), the nine-key payments projection on financial — ONE portal_read per admitted request under the caregiver’s sub; the knob-gated caregiver hard check (CRAIG_FINANCIALSUBSIDY_CAREGIVER_CHECKENABLED, default off, behind cargo xtask caregiver-coverage) closes #634’s named criterion. The pages ship en + es at Grade 6 under The Foundation palette, the four-state contract as applied (data \| empty \| error; loading N/A per the U10 erratum), axe en + es as a blocking gate; U11 made the foster home the first ADR-037 §4–§7 field-ownership tenant (surface foster_home_portal: the field_ownership.toml owner map, the caregiver’s propose → the Studio "Pending changes" accept / reject, every live staff write of a governed field consulted and audited). U12 proves it live — the bind → enrol → propose → accept → audit → end journey and the edge refusals with real IdP tokens. Follow-ups #1857–#1861, #1865, #1886; the provider (P-A #1855 → #88) and family (P-B #1856 → #86) programs are their own plans; epic &13 stays OPEN as their tracker.

Status

Done (2026-09-15) — !1650

Erratum (2026-09-13, U2 #1843): the client names follow the craig-ui / craig-web precedent and the identity model’s service-client convention — the PUBLIC (code + PKCE) client is craig-portal-ui, the portal BFF’s confidential client is craig-portal (role service:craig-portal); decisions 1, 3 and 4 and the SUBJECT_CLIENTS allowlist read craig-portal-ui for the public client, and the channel token stays craig-portal. The portal’s port is pinned here — container 8080, devstack host 8081 — but the CRAIG_SERVICES / PORT_MAPPINGS rows and the CLAUDE.md port row land with the compose service in U5: a registry row with no running container is a discovery WARN on every dev start.

Anchors

epic &13 (the tracker: U0 #1841, U1 #1842, U2 #1843, U3 #1844, U4 #1845, U5 #1846, U6a #1847, U6 #1848, U7 #1849, U8a #1850, U8 #1851, U9 #1852, U10 #1853, U12 #1854; #87 the foster-parent anchor closed by U12; #90 progressed per portal; P-A #1855 → #88; P-B #1856 → #86; #89 closed), epic &50 (#634 = U11, closed by U11), ADR-076 (Proposed at U0), ADR-037 (§2/§3 shipped by Plan Y; §4–§7 applied here; field_ownership.toml amendment), ADR-043, ADR-062, ADR-048, ADR-067, ADR-068; follow-ups #1857 (caseworker phone), #1858 (dual-role principals), #1859 (invitation module lift), #1860 (shared rate limiter), #1722 (per-caregiver training identity — this ledger is what it needs), #1729 (PATCH Option<Option<T>> explicit null — the placement-side wire gap the U11 field_written arm avoids); queue #1654 item 9; design reference Constituent & Provider Portals (design).

Erratum (2026-09-14, U6 #1848): three as-built readings the contextless critique settled. (1) ONE resource type, foster_home_caregiver, governs the caregiver ledger for BOTH unit kinds — a kinship unit’s check carries the placement’s assignment pair on the ref (so Texas’s assigned rows apply) instead of routing through the placement ruleset’s update rows, which would have let readonly list kinship caregivers while refusing home-bound ones. (2) The create body names the unit as explicit foster_home_id XOR placement_id fields (the table CHECK’s shape), not a unit object. (3) The Texas foster_home_caregiver twin mirrors the Texas foster_home twin (admin; supervisor when supervising; regional supervisor; caseworker CRUD) rather than a realm-flat copy of Georgia. Ending stays plan-literal: effective_from < ended_on ⇐ today — a future-dated end would leave a current binding outside the open-binding partial uniques.

Erratum (2026-09-15, U8 #1851): four as-built readings. (a) The ADR-062 §U attempt machine has no refused state: a binding revoked between the upload attempt and the finalize is caught by the finalizer’s locked re-check and answers AttemptError::TargetGone — 404 upload target on the handler path, failed(target_gone) by the reconciler after the grace — recorded as follow-up #1886. (b) The scope rule: a subject with ZERO current bindings (or a revoked identity) is 403 on EVERY portal route (the BFF ends the session); a subject with bindings asking for a unit outside them is 404; ListScope::Denied is 403; a refused request stages no portal_read. (c) A home-less kinship placement unit answers empty training and documents lists, a 404 download and a typed 422 upload (home_documents attach to a foster home). (d) The realm seeds ONE portal user (pat.foster), so the two-subject leakage matrix is pinned sequentially on one subject plus a store-level two-subject predicate test; the second seeded foster parent lands with U12’s e2e journeys.

Erratum (2026-09-15, U9 #1852): two readings of the subsidy-eligibility caregiver intervals. (1) They answer an EVIDENCE question under a CLOSED upper bound — a binding covers as_of when effective_from ⇐ as_of AND (ended_on IS NULL OR ended_on >= as_of), and a cancelled entry (ended_on = effective_from) never covers — because SG/NRSG activation evaluates the transfer day and staff closing the outgoing caregiver’s binding that same day can only enter ended_on ⇐ today; under the ledger’s half-open CURRENT predicate (ended_on > as_of, which the portal-scope read keeps) the legitimate signer read as "not a caregiver on the transfer day". (2) An absent ?as_of= evaluates on the placement’s OWN evidence date — the jurisdiction business date while it is planned/active, its ended_on (the jurisdiction date of ended_at, clamped to the business date: evidence never runs ahead of the clock) once ended — not on the business date unconditionally: activation derives the transfer date FROM this very response’s ended_on, so a second ?as_of=<transfer> read would add a budget leg the placement can answer itself, in ONE read. An explicit as_of still wins; the past-accepted / more-than-a-day-ahead invalid-date bound (relative to the business date) is unchanged.

Erratum (2026-09-15, U10 #1853): the BFF’s access reading, superseding the U8 erratum’s "the BFF ends the session" and the ADR-076 U8 note’s same words: a backend 403 (zero current bindings, or a revoked identity) on GET /units renders the honest NOT-CONNECTED state (h1 "Your homes", the fact, the why, the enrol form) and on every other page or action redirects to /units with ONE neutral "not connected to that home right now" flash — the session is KEPT in both cases. Placement and financial re-derive scope on every request (containment is theirs), the IdP SSO session outlives the BFF cookie anyway, and the same 403 answers a never-enrolled caregiver opening a stale link, for whom "access ended" copy would be false; flagged for the maintainer on the MR — a one-line switch to clear_session if overruled. The per-page upstream-call budget this shape implies (each read audited on placement per request, ruling R4): every unit page first resolves the unit from the caregiver’s units list, the ONLY carrier of name / kind / role — unit dashboard 2, training 2, documents 2, download 3 (the units list resolves the unit, the documents list proves the doc and supplies its Content-Type, then the bytes), payments 3 (list + unit detail for child names + the payments page).

Erratum (2026-09-15, U10 #1853): the enrol act’s 409 — which placement answers only AFTER the code passed every check, for two populations (this account already holds a live identity; the invitation’s person is enrolled under ANOTHER account) — is disambiguated by THIS account’s own state, never by the code: a units probe answering 200 flashes "already connected" and lands on /units; a probe answering 403 flashes the ONE uniform refusal and lands on /welcome (the portal says nothing about the other account); any other probe outcome is the unavailable flash naming craig-placement.

Erratum (2026-09-15, U10 #1853): the loading state is NOT APPLICABLE to the portal — every page is a synchronous server render, and the four-state contract’s as-built ownership (the composition shell owns loading) has no shell here; no skeleton is faked. Every page’s main <section> carries data-state ∈ data | empty | error (the signed-out welcome, the 404 page and the flat _*.html partials exempt), pinned by a template test.

Erratum (2026-09-15, U10 #1853): the error state is Retry ONLY — the block names the failing service, says the information is safe, and offers a Retry link to the same path; no Status link and no last-sync time, because the portal has no status surface and holds no synced copy of anything (a recorded deviation from the four-state contract § 4. Error).

Erratum (2026-09-15, U10 #1853): the failure-copy split — bff.ftl (craig-bff, en + es) is the CLOSED vocabulary of the sign-in failures and the crate’s failure page; the portal’s page, enrol and upload failures live in the portal’s own .ftl files (portal.ftl owns the cross-cutting keys; portal-enrol.ftl / portal-documents.ftl the act-specific ones), so the U4 line "categorical failures render via a shared bff.ftl`" covers sign-in only. craig-bff’s `UploadError prose is mapped portal-side per variant; the admit-refusal and CSRF bodies stay #1865.

Erratum (2026-09-15, U10 #1853): the four-state lint is NOT parameterised for the portal — cargo xtask lints four-state-contract scans plugins/ templates for the state-dispatch idiom only, so the Host section’s "lints parameterised by roots: … the four-state lint" did not happen for it; the portal self-pins the contract by its own template test (data-state on every non-exempt page) and the e2e’s per-page state assertions.

Erratum (2026-09-15, U10 #1853): ruling R3 was unmet by U5 — the U5 portal rendered the product default (Simple Statehouse) while its CSS comment and docs named The Foundation; U10 ships The Foundation in craig-state-bundle (theme/foundation.toml, foundation_palette(), with the select-arrow and [color.high_contrast] groups derived per the token schema) and the portal declares it, its dark-mode header and primary-button inks moved to tokens that clear 4.5:1 under axe.

Erratum (2026-09-15, U11 #634): R-a — the caregiver’s propose is DERIVED from the owner map, not answered by a ruleset row. The field-evaluation path (resolve_field_permission over <j>-authz-{placement,education_record,health_record, foster_home}) sees neither claims.channel nor foster_parent — the four staff families carry neither input — so the portal act is admitted by the ALREADY-SHIPPED foster_portal row create × i_projection == 'proposal' (the token is SINGULAR) and then by owner(field) == shared; STATE fields are never proposable. The prepended field_permission rows govern STAFF only: every update row mirrored scope for scope into 'state' / 'shared' → write, 'provider' → read, readonly → read, a trailing catch-all → none (decision 12’s invariant — no staff role loses a write it holds today).

Erratum (2026-09-15, U11 #634): R-b — the table shape goes beyond the U11 row’s ruled columns, because a home unit hosts several children and a proposal must name its row: unit became unit_id + unit_kind (the caregiver-binding unit shape), plus target_table + target_id (the education / health record or the home), plus reason (the reject reason DecideProposalRequest carries); the portal DTO rows gained record_id so the client can name the target. The ruled columns (proposed_value TEXT, previous_value TEXT, proposed_by_sub, proposed_at, decision, decided_by, decided_at), the FOR NO KEY UPDATE re-read, the 409 on a moved value, the ADR-062 claims and the retained rejected rows are as ruled.

Erratum (2026-09-15, U11 #634): R-c — previous_value is SERVER-DERIVED at propose: the current stored text is read inside the claimed propose transaction (NULL = the field was unset), never taken from the client; the 409 compare against it happens at accept, as ruled.

Erratum (2026-09-15, U11 #634): R-d — the lock-state transport is a RIDE-ALONG on GET /v1/placement/portal/units/{unit} (field_permissions, home_contact, proposals): no extra call, no extra portal_read, the unit-dashboard budget stays 2. home_contact WIDENS the ruling-R5 projection with the home’s OWN phone + primary_contact — the caregiver’s own household, shown to the bound caregiver only (the PII denylist scan extended; PortalUnit.name is no longer "the ONLY home column the portal sees").

Erratum (2026-09-15, U11 #634): R-e — the propose act stages ONE portal_read (surface proposal) AFTER the claimed transaction, on the Claimed and the Replay path alike, exactly as the upload act does — ruling R4 is one portal_read per portal REQUEST; the FIELD audit of the act is placement.field_proposed. A refused request stages nothing (the U8 posture).

Erratum (2026-09-15, U11 #634): R-f — staff CREATES are governed as well as PUTs: decision 12 says every LIVE staff write of a governed field, so create_education, create_health, create_foster_home and create_placement consult resolve_field_permission for each governed field set non-null in the body (all tokens before any write, before the row transaction) and stage placement.field_written with old_value = None.

Erratum (2026-09-15, U11 #634): R-g — the Studio "Pending changes" gate is the FIELD-APPROVER set, not the admin-only Studio gate: middleware::require_field_approver over FIELD_APPROVER_ROLES = {admin, supervisor} — the Texas regional token spelled in texas-authz-education_record.json (regional_supervisor) is NOT a realm role in devstack/keycloak/craig-realm.json, so it is not in the set; a SEPARATE nav-pending-changes item under the same predicate (the admin-only Studio composition link is untouched). Rationale: the plan’s live probe has jane.doe (caseworker + supervisor) accepting.

Erratum (2026-09-15, U11 #634): R-h — accept authority is Action::Approve on the TARGET row’s own resource type, evaluated by the SHIPPED rulesets with the existing ref builders (supervisor_sub: None for education / health / foster_home): Georgia admin + supervisor (the realm-flat wildcard) and Texas admin + regional admit; the Texas plain-supervisor row is i_supervises-gated and stays INERT on these refs — a Texas plain supervisor is denied accept (403) and, lacking a foster-home list row, sees an empty pending list — today’s Texas update posture on these types, unchanged. Caseworkers are denied everywhere. No new approve rows.

Erratum (2026-09-15, U11 #634): R-i — ONE open proposal per (target_id, field) (the partial unique pending_edits_fhp_one_open): a second propose while one is pending answers 409 field-proposal-pending. Accepted and rejected rows are retained (the audit). A stale accept (409 concurrent-modification) is drained by REJECT; the caregiver may then propose again.

Erratum (2026-09-15, U11 #634): R-j — values are validated and canonicalised at PROPOSE per token kind: Text { max } (max = the staff DTO’s own garde cap for that column, single-sourced from craig_validation) trimmed and non-empty; Date parsed %Y-%m-%d and re-rendered; a bad value is 422 validation-failed on proposed_value. A proposal cannot CLEAR a field; a NULL previous_value reads "was unset".

Erratum (2026-09-15, U11 #634): R-k — accept writes foster_homes under the held FOR NO KEY UPDATE lock and bumps version WITHOUT If-Match: the CAS protects optimistic clients; the lock plus the previous_value compare are the accept’s guard. A no-op accept (proposed == current) still marks the row accepted and stages the audit with old == new.

Erratum (2026-09-15, U11 #634): R-l — the field-audit payload keys follow the cases precedent, {field, old_value, new_value} (placement.field_proposed under the caregiver’s sub, placement.field_proposal_decided under approved_by with the caregiver as proposed_by_sub, placement.field_written under user_id); the TABLE keeps the ruled previous_value / proposed_value column names.

Erratum (2026-09-15, U11 #634): R-m — a target that is gone or soft-deleted at accept answers 409 field-proposal-target-gone: the row stays pending and reject drains it; the education / health locks and reads carry active = true.

Erratum (2026-09-15, U11 #634): R-n — the caregiver SEES the outcome: the unit detail’s proposals list carries the pending rows AND the rows decided in the last 30 days with decision + reason, and the portal renders "Waiting for your caseworker." / "Accepted." / "Not accepted." (+ the reason) in place of the ask form on that row.

Erratum (2026-09-15, U12 #1854): two readings of the U12 row. (1) "binding ended → 403 + logout" is superseded by the U10 erratum — the journey asserts the NOT-CONNECTED state with the session KEPT. (2) The U8 erratum’s "second seeded foster parent lands with U12" did not happen: the journey and the portal specs run serially on the ONE seeded pat.foster (enrolled fresh per spec, the identity revoked after), so the two-subject leakage predicate stays the store-level test.

Context

Two trackers, one program: epic &50 (Plan Y’s durable tracker; #634 = the ADR-037 §4–§7 field-ownership APPLICATION) and epic &13 (three portals + #90); combined weight 37. This plan defines the shared SUBSTRATE, specifies it plus the FIRST portal (and the §4–§7 application on it) as executable units, and sequences the other two portals as follow-on plans with their prerequisites filed (ruling R0). What three read-only research passes established:

  • No public-user identity exists. craig-intake (ADR-043) authenticates nobody (/public/v1 = CAPTCHA + limiter
    ip_hash; ADR-043 names "IdP-rooted identity" as the pickup). The realm has 9 worker roles + service:*, NO portal role or client; lifespans are realm-wide only (access 1800 s, idle 3600 s, max 36000 s). Precedents: security.worker_identities (sub, username, display_name, email — no phone; no by-sub read arm — only the ?search= autocomplete + the upsert middleware); partner_api_keys (hash + prefix).

  • craig-web is strictly staff with a latent audience gap: require_auth = "a valid session exists", role gates opt-in per route; verifiers pinned to craig-ui; refresh failures PRESERVE the session; backend calls = service token
    X-Craig-Actor whose sub is SUPPLIED BY THE SIGNER (crates/craig-auth/src/actor_token.rs), honoured when the bearer is_service(). Claims::service_id() falls back to azp — a public-client USER token also answers its client id.

  • Every reusable BFF convention is pub(crate) in the craig-web binary (session / CSRF, flash, rejection_detail, BffApiError with hard-coded English, the upload relay, PageContext, the client_request_id macro, cookie names, /auth/callback); shared across binaries ONLY materialize_theme_css + craig-i18n; the web lints are craig-web-only.

  • Authz. ListScope::Custom fails CLOSED in every handler (crates/craig-authz/src/types.rs); build_check_input scopes on the ACTING principal and emits the outer service_id; service rows exist fleet-wide; resolve_field_permission
    FieldPermission shipped DORMANT with zero callers; security’s audit attribution parser reads created_by / approved_by / user_id / archived_by / sub, else "system".

  • Domain facts. FOSTER: foster_homes has primary_contact TEXT and NO caregiver persons; it is NOT case-assigned (admin, supervisor and caseworker all update it); placements (nullable foster_home_id for KINSHIP; history retained); education_records.placement_id; health_records carry diagnosis / medications / treatment / notes and the staff handler returns all; foster_home_training + the expiry ledger; home_documents (inspection photos, licences, "other") + the §U runner whose authz runs BEFORE multipart parsing; placement has its own service principal and a RELAY-ONLY cases client. FINANCIAL: payments.foster_home_id; subsidy_agreement_parties {agreement_id, person_id, role}; guardianship ACTIVATION skips the party helper; its queue binds no caregiver events. FAMILY and PROVIDER: the readiness matrix below (no messaging, no phone, no family_document kind; no provider entity, contract, referral, service record or crate).

  • #634’s named criterion (#1114 U3 ruling C): the provider registry binds caregiver PERSONS to homes / placements so subsidy enrollment can verify a signer IS the placement’s caregiver; the linkage stays REJECTED until then.

  • ADR-037 rubric: craig-cases IF ≤ ~30 fields + single migration; a new service IF > 30 fields OR own session boundary
    own live data OR > 2 new tables. Contract 5’s CWCA example spans TWO backends plus rows that do not exist.

Decisions (recorded in ADR-076)

  1. Identity = the same realm, a new PUBLIC client craig-portal (code + PKCE) with client-level lifespans (access.token.lifespan 300 s, client.session.idle.timeout 1800 s, client.session.max.lifespan 28800 s) and realm roles foster_parent / family / provider; AUTHORITY comes only from a staff-issued invitation redeemed into a binding row on the owning backend. (Alternatives: ADR-076.)

  2. Portal roles live in craig_auth::PORTAL_REALM_ROLES, not REALM_ROLES; Claims::is_portal_principal().

  3. The subject-token channel replaces the actor seam for portals. The portal BFF calls backends with ITS service token as the bearer (channel proof) and the USER’S OWN Keycloak access token in X-Craig-Subject (identity proof). The auth middleware verifies the subject against the same JWKS with aud == this service and azp ∈ the configured public clients, and composes claims: acting = the subject’s Keycloak claims (roles signed by the IdP — a compromised BFF can forge neither a subject nor a role), channel = the OUTER bearer’s service:<id> ROLE (never azp). The BFF mints nothing; there is no cached identity to replay past the IdP’s deadlines.

  4. Fleet-wide portal containment in craig-api, before any ruleset runs (portal_channel_guard): (i) a BEARER whose roles intersect PORTAL_REALM_ROLES → 401 (a portal principal never calls a backend directly); (ii) an outer bearer carrying the service:craig-portal role without an honoured subject → 401; (iii) under that channel the subject’s roles must be ⊆ PORTAL_REALM_ROLES (else 401) and the path must be under this service’s allowlisted /v1/<svc>/portal/ prefix (else 403). Services with no portal surface configure an EMPTY allowlist. The craig-portal-bff client carries audience mappers ONLY for craig-placement and craig-financial.

  5. Portal reads exist ONLY as dedicated projection routes under /v1/placement/portal/ and /v1/financial/portal/, each answering a named data-minimised DTO; no existing staff handler is ever authorised for the channel. Authz: ONE new ResourceType::FosterPortal variant (ruleset {j}-authz-foster_portal, loaded by BOTH services) whose rows gate on claims.channel == 'craig-portal' + 'foster_parent' in claims.roles + resource.attrs.projection. List scope = ListScope::Custom({"binding": "caregiver"}) decoded by a NEW craig_authz::PortalScope (Custom is fail-closed elsewhere).

  6. The binding ledger lives on craig-placement (the live-data owner) and is read AUTHORITATIVELY by financial per request over S2S (GET /v1/placement/internal/caregiver-bindings?sub= under a scoped service row; placement unavailable → typed 503; no projection, no cache — revocation is immediate on both services).

  7. A binding is a CAREGIVING UNIT bound to a person, effective-dated on the jurisdiction clock: caregiver_bindings {unit = foster_home_id XOR placement_id (kinship without a home)}; current iff effective_from ⇐ today AND (ended_on IS NULL OR ended_on > today); interval-validated at create; deactivation = ended_on := today. Portal scope = ACTIVE placements in bound homes ∪ bound kinship placements; a child’s records are reachable only through such a placement.

  8. Host = a NEW services/craig-portal Axum + Askama BFF over an extracted crates/craig-bff parameterised by BffConfig { client_id, verifiers, callback_path, post_login_redirect, cookie_prefix, refresh_failure: Drop | Preserve, locale_policy }; the portal uses Drop (any refresh failure ends the session). Categorical BFF failures render via a shared bff.ftl (en + es).

  9. craig-web’s audience gate ships FIRST (U1): callback refuses a session without ≥ 1 REALM_ROLES role; require_auth re-checks. No portal identity is provisioned before it.

  10. The foster-parent portal never calls craig-cases. Child display names come from a NEW batched, data-minimised cases arm (POST /v1/cases/persons/display-names {ids ≤ 50} → {id → {first_name, last_initial}}, scoped service row service_id == 'craig-placement' && attrs.projection == 'display_name') read by a NEW CasesProjectionClient on placement’s OWN principal under one 4 s deadline; on failure the DTO says names_unavailable: true, never a guess. Worker names: a NEW security arm (POST /v1/security/worker-identities/display-names {subs}), fallback "your caseworker" (#1857).

  11. The caregiver hard check in financial is knob-gated and evidence-dated. subsidy-eligibility?as_of= returns the caregivers CURRENT on that date with their intervals; ERR uses the enrollment date, SG / NRSG ACTIVATION re-verifies the persisted parties at the transfer date. CRAIG_FINANCIALSUBSIDY_CAREGIVER_CHECKENABLED default OFF; a coverage report (cargo xtask caregiver-coverage: active placements with no current caregiver) precedes the flip.

  12. #634 §4–§7 lands IN THIS PLAN (U11) on placement, surface foster_home_portal (ruling R1). STATE: placements.status, permanency_goal; SHARED: education_records.school_name / grade_level, health_records.next_due_date, foster_homes.phone / primary_contact (the caregiver PROPOSES, staff ACCEPTS); no provider-owned field (it would strip staff of writes they hold today). Every LIVE staff write on a governed field consults resolve_field_permission and emits the field audit. rulesets/<j>/<surface>_ownership.toml → rulesets/<j>/field_ownership.toml, [surface.<name>].

  13. Read audit = one *.portal_read event per portal request carrying sub (the attribution key security parses), role, jurisdiction, surface, unit_id (ruling R4).

Identity + scope design

Keycloak — devstack/keycloak/craig-realm.json is edited DIRECTLY (the reference renderer in xtask/src/cmd/identity/{model,render}.rs only approximates it and never writes it; its existing drift is #1861), with the same roles / clients / user mirrored into the model and pinned by a render test: the three roles; public client craig-portal (mirror of craig-ui + the lifespan attributes + mappers aud-craig-placement, aud-craig-financial ONLY); confidential craig-portal-bff + role service:craig-portal (mirror of craig-web, same two audiences); NO aud-craig-portal anywhere (no inbound service calls). Seed pat.foster ([foster_parent], sub …0000-000000000009).

craig-auth / craig-api: X-Craig-Subject verification (JWKS, aud, azp allowlist CRAIG_<SVC>SUBJECT_CLIENTS, default empty = refuse); Claims.channel: Option<String> set ONLY from the outer bearer’s service: role when a subject was honoured; X-Craig-Actor and X-Craig-Subject on one request → 401; the authz input gains "channel"; portal_channel_guard (decision 4) with CRAIG_<SVC>PORTAL_PATHS (empty default).

Placement tables (one additive migration; no floor bump):

caregiver_bindings (id uuidv7 PK, foster_home_id → foster_homes NULL, placement_id → placements NULL,
  CHECK ((foster_home_id IS NULL) <> (placement_id IS NULL)), person_id UUID NOT NULL /* cases.persons, existence-checked */,
  role TEXT CHECK IN ('primary','co'), effective_from DATE NOT NULL, ended_on DATE CHECK (ended_on > effective_from),
  created_by UUID NOT NULL, created_at, updated_at;
  UNIQUE (foster_home_id, person_id) WHERE ended_on IS NULL; UNIQUE (placement_id, person_id) WHERE ended_on IS NULL)
caregiver_identities (id uuidv7 PK, subject_sub UUID NOT NULL, person_id UUID NOT NULL, invitation_id → portal_invitations,
  enrolled_at, revoked_at, revoked_by UUID; UNIQUE (subject_sub) WHERE revoked_at IS NULL; UNIQUE (person_id) WHERE revoked_at IS NULL)
portal_invitations (id uuidv7 PK, binding_id → caregiver_bindings, code_hash TEXT UNIQUE /* SHA-256 of 128 bits */,
  code_prefix TEXT, expires_at NOT NULL, issued_by UUID NOT NULL, redeemed_at, redeemed_by_sub UUID, revoked_at)

Scope predicate (ONE store function, live join, jurisdiction today): bound units = caregiver_bindings b JOIN caregiver_identities i ON i.person_id = b.person_id AND i.revoked_at IS NULL WHERE i.subject_sub = $sub AND b.effective_from ⇐ $today AND (b.ended_on IS NULL OR b.ended_on > $today); visible placements = placements p WHERE p.status = 'active' AND (p.foster_home_id IN bound homes OR p.id IN bound kinship placements); education / health only via a visible child_id.

Endpoints. Placement STAFF (authority = the home’s own UPDATE rows: admin, supervisor, caseworker — FosterHomeCaregiver mirrors foster_home.json; kinship units use the placement’s update rows): POST/GET /v1/placement/caregivers (unit, person_id, role, effective_from; ADR-062 claim; person existence via the display-name arm), POST …/caregivers/{id}/end (ended_on; revokes the binding’s open invitations in the same tx), POST …/caregivers/{id}/invitations (returns {code} ONCE), DELETE …/invitations/{id}, DELETE …/caregivers/{id}/identity (revoke; re-enrol = a new invitation). Placement PORTAL: POST /v1/placement/portal/enrollment {code, client_request_id} (row: channel + foster_parent + attrs.projection == 'enrollment' + create — the ONE portal permission that works before any binding; ONE tx: ADR-062 claim FIRST, SELECT … FOR UPDATE the invitation, require unexpired / unredeemed / unrevoked and the binding current, insert the identity (a live identity for this sub or person → 409), stamp redeemed; the same-request replay returns the original 200, every other failure the uniform 404; constant-time compare; per-IP + per-sub limiter), GET /v1/placement/portal/units, GET …/units/{unit} (children: child_id, child_display, started_at, caseworker_name; education {school_name, grade_level, enrollment_date}; health {record_type, provider_name, next_due_date} — ruling R5), GET …/units/{unit}/training ({training_type, completed_at, expires_at, hours} — no verified_by), GET …/units/{unit}/documents + GET …/documents/{id}/download (ONLY document_type = 'training_certificate'; filename / type / date), POST …/units/{unit}/documents (type fixed server-side; binding + channel checked BEFORE multipart; the §U finalizer re-checks the binding), POST …/units/{unit}/proposals (U11). Placement INTERNAL: GET /v1/placement/internal/caregiver-bindings?sub= (financial, scoped row); subsidy-eligibility?as_of= gains caregivers: [{person_id, role, effective_from, ended_on}]. Cases and security: the batched display-name arms. Financial PORTAL: GET /v1/financial/portal/units/{unit}/payments (per-diem by home; subsidy via parties of the bound persons; rows {payment_id, child_id, payment_type, period_start, period_end, day_count, net_amount, status, issued_at} — no ive_eligible / ffp_* / uas_code / case_id / agreement_id / any *_by, *_by_name, *_sub / void_reason).

Ruleset rows (hitPolicy first, prepended; georgia + texas; inputs i_channel: claims.channel, i_foster_parent, i_projection): foster_portal ×2 (one per jurisdiction, loaded by placement AND financial): r0 i_channel == 'craig-portal' && i_foster_parent && action == 'create' && i_projection == 'enrollment' → allow; r1 … 'list' → allow, scope custom binding:caregiver; r2 … 'read' | 'create', i_projection ∈ {unit, training, documents, document_upload, proposal, payments} → allow (the handler resolves the unit against the binding, else 404); r3 default deny. foster_home_caregiver ×2: admin / supervisor / caseworker create | read | list | update | delete; default deny. Existing rulesets UNCHANGED (the guard keeps the channel off them).

Events (ADR-003): placement.caregiver_bound | caregiver_ended {unit, binding_id, person_id, role, effective_from, ended_on, created_by}, placement.caregiver_identity_enrolled | caregiver_identity_revoked {sub, person_id, invitation_id, revoked_by}, placement.portal_invitation_issued | portal_invitation_revoked {invitation_id, binding_id, issued_by}, placement.portal_read | financial.portal_read {sub, role, jurisdiction, surface, unit_id}; certificate uploads reuse placement.home_document_uploaded (document_type = training_certificate, created_by = sub).

Host

crates/craig-bff (moved out of craig-web, pub, behaviour-neutral for craig-web): session cookie + SessionUser + flash (every cookie name under cookie_prefix); OIDC login / callback / logout parameterised (callback_path, post_login_redirect, verifiers per client); verify_csrf; session_context with the refresh_failure policy; Transport with BOTH identity modes (Actor for staff, SubjectToken for portals); BffApiError + rejection_detail rendering CATEGORICAL failures through bff.ftl (en + es); the upload relay; PageContext core; the client_request_id form macro; the strict-CSP builder; shared base partials; the test-support twins (templates_csrf, architecture_invariants, i18n_coverage, csp). Lints parameterised by roots: validate_web_query_strings, TEMPLATE_ROOTS, the four-state lint, the CSRF template gate.

services/craig-portal: stateless; CRAIG_PORTAL__*; theme via materialize_theme_css (the Foundation palette — ruling R3); portal.ftl en + es + a session locale tier (locale_policy: SessionThenNegotiate; craig-web keeps Negotiate — the craig_i18n::negotiate_locale header path); craig_api::rate_limit::build_rate_limiter on login / enrollment / upload; routes /login /callback /logout /welcome (enrol) /units /units/{unit} /units/{unit}/{payments|training|documents} /language; no staff route; port = the next free PORT_MAPPINGS row (U2 pins it and the CLAUDE.md table).

Units — each its own MR; sequence U1 → U2 ∥ U3 → U4 → U5 → U6a → U6 → U7 ∥ U8a → U8 → U9 → U10 → U11 → U12

MR Scope W

U0 #1841

This page (Active nav), ADR-076 (Proposed), the Plan::PORTALS label, epic &13 restructured, the follow-up issues, round 1 logged

2

U1 #1842

craig-web worker-audience gate (decision 9) + test — ships BEFORE any realm change

2

U2 #1843

Identity: roles, craig-portal (+ lifespans, two audiences) and craig-portal-bff; model.rs / render.rs; PORTAL_REALM_ROLES; CRAIG_SERVICES / PORT_MAPPINGS; pat.foster; census

3

U3 #1844

craig-auth X-Craig-Subject verification + Claims.channel; craig-api portal_channel_guard (empty allowlists fleet-wide); authz input channel; proofs of decision 4 (i)–(iii) on EVERY service

5

U4 #1845

crates/craig-bff extraction (both identity modes, refresh_failure, cookie prefix, bff.ftl en + es); craig-web re-pointed; lints / tests parameterised

8

U5 #1846

services/craig-portal skeleton: Dockerfile stage, compose, config, login / session / CSRF / CSP / limiter, theme, portal.ftl, e2e project + setup login + a11y block (en + es) + knob-projects.toml + URL passthrough + VPAT scope

5

U6a #1847

The cases batched display-name arm (decision 10); no cases-side release event (first name + last initial is below the SSN / DOB release class) — placement’s portal_read is the audit

2

U6 #1848

Placement: the three tables; FosterHomeCaregiver + FosterPortal types + the four rulesets; staff caregiver / invitation / identity endpoints; enrollment (the state machine); events; CasesProjectionClient

5

U7 #1849

craig-web "Caregivers" panel on home detail AND kinship placement detail: add, end, invite (code once), revoke identity

3

U8a #1850

The security batched worker display-name arm (decision 10)

2

U8 #1851

Placement portal projections (PortalScope decoder; units / unit / training / documents / upload with the finalizer re-check; portal_read); subsidy-eligibility?as_of= + internal/caregiver-bindings

5

U9 #1852

Financial: portal payments projection over the authoritative binding read; portal_read; the knob-gated caregiver check at ERR create AND SG / NRSG activation (as of the transfer date); cargo xtask caregiver-coverage — the #634 named criterion

5

U10 #1853

craig-portal pages (Grade-6 copy, en + es, four-state): welcome / enrol, units, unit dashboard, payments, training, documents (+ upload), language

8

U11 #634

§4–§7 on placement, surface foster_home_portal: FieldOwnershipContribution axis + rulesets/<j>/field_ownership.toml [surface.<name>] + boot gate + pending_edits_foster_home_portal + portal propose / staff accept-reject (Action::Approve, one tx + outbox audit) + prepended field_permission rows + resolve_field_permission on every live staff write of a governed field + read / write field audit + portal lock reflection + craig-web Studio pending view; pending_edits_foster_home_portal {id, unit, field, proposed_value TEXT, previous_value TEXT, proposed_by_sub, proposed_at, decision, decided_by, decided_at} — typed text values, the target row re-read FOR NO KEY UPDATE at accept (409 when it no longer equals previous_value), an ADR-062 claim on propose AND accept / reject, rejected rows retained; Closes #634

8

U12 #1854

e2e journeys (bind + invite as jane.doe; pat.foster enrols; own units only; other unit 404; placement ends → child gone; binding ended → 403 + logout; propose school → staff accepts → audit rows; direct bearer / forged role / off-allowlist path refused); axe en + es; CSRF; i18n en + es; authz-coverage; close-out; Closes #87

5

P-A #1855

Provider program plan (#88): services/craig-provider per rubric (c) (ruling R7) — registry, contracts, referrals + capacity, service records, the CWCA ownership surfaces on cases + placement + provider

3

P-B #1856

Family program plan (#86): parent_identities on cases, person → open-cases read, family_document, hearings, the messaging + notification DECISION

3

Readiness matrix

Need Foster (#87) Provider (#88) Family (#86)

Identity / binding

U6 (placement; homes AND kinship placements)

provider registry — NEW service

parent_identities on cases + case_household.role = 'parent'

Scoped rows

placements / education / health / documents / training EXIST

contracted cases, referrals, service records — NONE

tasks responsible = 'parent'; next_hearing_date only

Uploads

home_document kind + a portal route

service_record_attachment — new

family_document — new

Contact

caseworker NAME via the security arm; no phone anywhere (#1857)

provider contact log — new

phone absent; messaging — DECISION (P-B)

Field ownership

U11 (placement owner)

pending_edits on cases AND placement + provider rows

none

Closes

#87; #634 (U11) incl. the named criterion; #90 incrementally

#88

#86; #90 (family catalogue)

Test matrix (by risk)

  • Channel + containment (evil): a direct foster_parent bearer → 401 at EVERY service; a craig-portal bearer with no subject → 401; a staff-role subject under the channel → 401; an on-channel request off the /portal/ allowlist → 403; craig-web’s actor with foster_parent → default deny; a subject with azp == craig-ui → 401; a forged subject (wrong signer / wrong aud) → 401; the BFF cannot mint — architecture_invariants pins no ActorTokenIssuer in craig-portal.

  • Session (sad): access-token expiry → refresh; refresh failure of ANY kind → session dropped; idle > 30 min → login.

  • Enumeration (evil): enrollment answers ONE 404 for unknown / expired / redeemed / revoked / ended-binding; constant-time compare; 5 / min per IP; same-request replay → the original 200; two concurrent redeemers → one identity (row lock); revoke-vs-redeem race → one of them wins, never both.

  • Revocation + dates (sad, conc): binding ended → the next portal GET 403 on placement AND financial; identity revoked → same; placement ended → the child disappears; placement unavailable → financial typed 503; future effective_from → no access until the date; ended_on ⇐ effective_from → 400.

  • Scope leakage (evil, conc): two units / two caregivers — own units only; other unit → 404; a Custom scope reaching a non-decoding handler → redacted 500; documents list = certificates only; a licence document download → 404.

  • PII minimisation (evil): DTO snapshots carry no DOB / SSN / diagnosis / medications / treatment / notes / narrative; child = first name + last initial; names_unavailable on cases failure; the binding tables carry ids only; payments carry no ive_eligible / ffp_* / uas_code / *_by / void_reason; training carries no verified_by.

  • Uploads (sad): wrong type refused before parsing; foreign unit → 404; binding revoked between attempt and finalize → attempt refused.

  • Subsidy check (sad): knob off → report-only; on → ERR create refuses a non-caregiver signer; SG activation refuses a signer whose binding ended before the transfer date; a kinship caregiver (no home) passes.

  • Audit (happy): every portal GET lands a portal_read row under the caregiver’s sub; every field proposal / acceptance lands with role + jurisdiction + field + before / after. Worker gate (evil): pat.foster at craig-web → 403, no cookie.

  • a11y / i18n: axe en + es under four media emulations; four-state per page; i18n_coverage en + es for portal.ftl AND bff.ftl; Spanish error / upload-failure / login-failure paths rendered.

  • Property: invitation code round trip; PortalScope decode total; effective-interval arithmetic; the field audit’s before / after never carries a DOB.

Verification

Per MR: fmt, clippy, the budgets, the lints (incl. the parameterised web lints, validate-authz-coverage, mq-topology, tracing-pii-fields), contested-census, check-docs, plan-lint, the pre-push battery. Live probe after U12: jane.doe binds a caregiver to a seeded home and a kinship placement and issues invitations; pat.foster enrols, sees both units in en and es, uploads a certificate visible in craig-web, proposes a school correction jane.doe accepts in Studio; the binding is ended and the next portal request 403s; GET /security/audit/user/{sub} lists the portal_read and field-audit rows.

Rollout

Order per environment: craig-web gate (U1) → cases + security arms → promote the foster_portal + foster_home_caregiver rulesets for BOTH jurisdictions BEFORE any image built after U6 (boot coverage iterates every ResourceType on every service; the ADR-074 rules-bootstrap precedent) → placement + financial images (empty-allowlist guards are inert) → the realm change → craig-portal behind the ingress → caregivers entered, caregiver-coverage run → invitations → the knob. Pre-1.0 Changed: craig-web requires a worker role, not merely a valid realm session.

Risks

A new public binary (own limiter, strict CSP, no staff route, enumeration-proof enrolment, the fleet guard); new middleware on every service (its proofs are U3’s acceptance); dual-role principals are two Keycloak accounts by policy (#1858); PII — every portal DTO is a named projection and DOB never leaves cases; the per-process limiter multiplies by replica (#1860).

Rulings (approved 2026-09-13, plan mode)

R0 order: substrate + foster-parent first; provider (P-A) second; family (P-B) third. R1 the foster home is the §4–§7 first tenant (U11); cwca_ownership.toml → field_ownership.toml with per-surface sections. R2 the subject-token channel (decision 3) is the portal identity transport. R3 the Foundation palette is the portal theme. R4 read audit per REQUEST (portal_read), not per row. R5 caregiver-visible health fields: record_type / provider_name / next_due_date only. R6 production account provisioning (staff-created IdP user vs realm self-registration) was posed as neutral to authority — the binding, not the account’s origin, grants access — and approved as written: the deployment guide documents both, the code depends on neither. R7 the provider program’s host is services/craig-provider per rubric (c). The maintainer’s 28-finding gate on rev 1 (2026-09-13) was folded into rev 2 before approval; the fold table is on ADR-076.

Review log

Round Vendor Resolved model Verdict

1

Anthropic — one fresh contextless subagent, the four plan-lifecycle questions, over this page + ADR-076; each blocker independently re-verified against the repository

Claude Fable 5.1

no-ship (2026-09-13) — Q1 conforms, Q3 clean, Q4 readable (dense Context / Endpoints, noted once); two Q2 blockers folded in-plan the same day: the realm JSON is edited directly with the identity model mirrored (not regenerated — the model’s drift filed as #1861), and the payments / training DTO field lists with their exclusions; seven Q2 notes folded (guard rule (ii) keys on the outer service:craig-portal role, the security ?search= arm cite, ONE FosterPortal variant shared by both services, ruleset promotion before any post-U6 image, no cases-side release event for display names, the pending_edits representation + accept guard, the locale_policy variants)

2

open — run by the maintainer through another vendor’s model

open

open

Edit this page · latest