Plan: Outbound Partner Authentication and the Initial Medicaid Application (#1813, #1805 slice, #1807)

Archive record

Merge requests: !1931 (U0 plan page + ADR-083, Relates #1813) + !1934 (U4, Closes #2428) + !1935 (U1, Closes #2426) + !1940 (U5, Closes #1807) + !1941 (U2, Closes #2427) + !1938 (U6, Closes #2429); the close-out !1939 (U3, Closes #1813)

2026-10-19 — approved in plan mode on 2026-10-15 after a contextless round 1 (no-ship, 2 blockers fixed) and the maintainer’s round 2 on GPT Astra (no-ship, 10 findings fixed). What landed: the outbound credential channel across the partner crates, inert (U1); the typed auth vocabulary, the endpoint rules, the fail-closed gate, the auth-class record release, the scrub (U2); per-send resolution, host binding, application at three sites, auth-refused, redaction, the probe’s authority (U3); the GA empi identifier kind (U4); the Initial Medicaid Application record, acts and events (U5); the web Medicaid application section on the child’s legal-status panel (U6). Follow-ups stay open: #1073 (the DFCS readings), #1805, #1811, #1812, #1822, #2345, #2430-#2437, #2448, #2457.

Status

Done (2026-10-19) — !1939

Erratum (2026-10-15): D5’s services/craig-web/src/bundle.rs:261 is fixture-based (its own testid kind) and stays as it is; tools/craig-seed/src/bundle.rs:230 is the fifth spec change (U4, #2428).

Erratum (2026-10-15): the a_broker_egress_or_ssa_send_refuses_auth row is two tests, one in craig-exchange-transport (broker, egress) and one in craig-partner-ssa-solq (SSA), since neither crate can see the other; craig-exchange-transport gains a craig-exchange-contracts edge and re-exports OutboundAuth (U1, #2426).

Erratum (2026-10-15): D6’s "the encryption registry and xtask verify-seed cover it" — verify-seed asserts only SEEDED_TABLES, each non-empty, and the seed writes no custody episode, so medicaid_applications is deliberately left off that list (documented there; pinned by the_unseeded_medicaid_application_stays_registry_covered); the registry covers citizenship_status and its at-rest proof is the devstack test citizenship_status_rests_encrypted_and_stays_out (U5, #1807).

Erratum (2026-10-15): D7 "hashes citizenship_status through crate::api::intents::blind_digest`" — that fn requires a `BlindIndex spec and the column is Opaque, so the submit intent digests the token through the sibling keyed_token_digest (keyed: hmac_domain("medicaid_application_citizenship", BLIND_INDEX_SCHEME_V1, token); keyless: the plaintext), the same keyed-HMAC property; the V1 projection’s fields are in sorted order (U5, #1807).

Erratum (2026-10-15): D7’s field refusals (an unknown citizenship_status / prior_medical_assistance token, a legal_admin_unit validate_admin_unit refuses) are 422 validation-failed bound to the field (ApiError::unprocessable), not invalid-enum-value (a 400 sub-type); a token refusal’s detail lists its vocabulary, the county refusal’s names the deployment’s state (not an administrative unit of Georgia), and none echoes the input (U5, #1807).

Erratum (2026-10-15): D7 "No consumer in TP-2" — as built, reporting’s case. queue RECEIVES both case.medicaid_application_ keys (a no-op fallthrough) and craig-security’s # queue audits them (create / update of medicaid_application); "no consumer" holds for craig-exchange, the only service that would ACT on them. No service may read the application routes (deny_pure_service), so TP-3 owes a service read beside its backfill (#1822). ADR-003 and data-model-cases say both (U5, #1807).

Erratum (2026-10-15): the PLAIN_HTTP_HOSTS compose line ships in U2, whose endpoint test needs it (U2, #2427).

Erratum (2026-10-15): U2 adds auth-unsupported and auth-misconfigured (U3 adds auth-unavailable and auth-refused with their ladder); in U2 an off-shape config on a non-none row answers auth-unsupported; its migration is two files so the scrub test re-applies the scrub’s own SQL; a stored row’s type is judged before its endpoint (U2, #2427).

Erratum (2026-10-15): release’s record arm keeps the old job’s partner (the chain must admit it), answers through the one ReleaseResponse with restaged and refused added, and stage_one_record now returns the staged job; release_restages_only_auth_class_records is two tests, its concurrent half two_concurrent_record_releases_stage_one (U2, #2427).

Erratum (2026-10-15): the send-job retention sweep keeps a failed record job of a restageable auth class until it is released, so the plan’s never-lost holds past the retention window (U2, #2427).

Erratum (2026-10-16): D9 "the submit form (legal county prefilled)" — as built the field is labelled "Legal admin unit" (the product’s neutral admin-unit copy, web.ftl:48-82; ADR-072: nothing presupposes an admin-unit design) and is prefilled from the case’s admin_unit, which the Federal facts tab passes in the custody slot’s query (U6, #2429).

Erratum (2026-10-16): D9 "'Recorded; not yet sent to IES'" — as built the product default reads "Recorded; not yet sent to the eligibility system"; the system’s name is the term-medicaid-eligibility-system terminology message (ADR-034 §6), which the Georgia overlay sets to IES, so a Georgia deployment reads exactly "Recorded; not yet sent to IES". The U6 Pages cell gains crates/craig-state-ga/terminology/{en,es}/worker.ftl (U6, #2429).

Erratum (2026-10-16): the boot warning names every active partner whose credential would be refused (any auth class, with the reference name where one is the cause), not only an unresolvable or unbound reference (U3, #1813).

Erratum (2026-10-16): craig-exchange gains a direct secrecy dependency (and tempfile for tests) to build the resolved SecretStrings (U3, #1813).

Erratum (2026-10-16): the resolver reads a reference’s value before its host binding: a reference with neither is auth-unavailable (D1’s seed rows), one with a value but no list, or not listing the endpoint’s host, is auth-misconfigured (U3, #1813).

Erratum (2026-10-16): from U3 an off-shape stored config, including U2’s scrubbed {} on a credential-bearing row, is auth-misconfigured; Rollout item 1’s release follows rewriting the row’s reference config (U3, #1813).

Erratum (2026-10-16): auth-refused is the trigger lane’s class (the leg’s family classifies the status); the manual lane and the probe hold no family, so a manual 401/403 rides the shared ladder to retries-exhausted (manual retry recovers it) and the probe reports the adapter’s own error with its status (U3, #1813).

Erratum (2026-10-16): the close-out’s --allow-open list also names the closing unit’s own issue (open until its MR merges) and #2448, plus any follow-up an erratum cites (U3, #1813).

Erratum (2026-10-16): no accepted acknowledgement of a shipped leg can carry partner text, so the redaction row asserts the stored response and the transaction read on the generic path; the acknowledgement site redacts for later legs (U3, #1813).

Erratum (2026-10-16): U3 also updates data-model-exchange.adoc’s auth-class recovery paragraph (four classes; the U2 interim gone) (U3, #1813).

Erratum (2026-10-16): redaction also covers the \/ JSON spelling, a partner body clipped mid-secret by the #1460 bound, object keys and numbers (U3, #1813).

Erratum (2026-10-16): the U3 half of a_pending_record_survives_the_auth_rollout starts from a terminal auth-misconfigured ref=rollout_ref (the reference provisioned with no host binding), since U3 removes the auth-unsupported interim; release re-stages it, a non-auth class refused, and once bound it sends once, authenticated (U3, #1813).

Glossary. This page is docs/modules/ROOT/pages/plans/archive/partner-auth-medicaid-application.adoc (TP-2). ⁂ marks a reading DFCS may rule otherwise, logged on #1073 (it confirms a reading, it does not gate the build). D = design, F = fork (A- auth, M- application, B- the TP-3 bind), U = merge request, AC = a restated criterion. :line prefixes (on main, a citation anchor): ex/ = services/craig-exchange/src/, tr/ = crates/craig-exchange-transport/src/, ec/ = crates/craig-exchange-contracts/src/, cases/ = services/craig-cases/src/, IES/ = docs/modules/ROOT/pages/interfaces/ies-medicaid-eligibility.adoc, ies/ = crates/craig-partner-ies/src/types.rs, tp1/ = docs/modules/ROOT/pages/plans/archive/custody-episodes-doe-slds.adoc.

Anchor What binds here

#1813, #1807 (P2), #1805 (a slice)

one program, two lanes; ADR-075 names #1813 a prerequisite of every real send (:201-202), IES blocked on #1807 (:208)

ADR-075 (:159-200)

the consent chain and its rebind (decision 5), categorical settlement (decision 10), release (decision 13)

ADR-064 (:50-52, D4 :90-99)

the sops store is dev/CI only; production secrets come from the orchestrator’s store

ADR-081, tp1/ D5 (:200-226)

the custody episode (the application’s parent); person_identifiers (EMPI’s home)

#1822 → TP-3

the IES bind, its facts (D8) and its backfill duty (D7)

Context (census 2026-10-15 on main)

  • auth_config is stored and read by nothing. auth_type TEXT DEFAULT 'none', auth_config JSONB DEFAULT '{}', no CHECK (services/craig-exchange/migrations/20240401000000_create_exchange_tables.sql:8-9); the DTOs accept any string and JSON (ex/api/partners_dtos.rs:46-53, :96-99); the read model omits the column (#757, ex/store/models.rs:10-19). A plaintext secret posted today is stored. The seed’s sister-state rows say oauth2 (tools/craig-seed/src/datagen.rs:2532-2536), the CLI test api_key (services/craig-cli/tests/cli/exchange.rs:30).

  • The seam carries a URL only. ExchangeAdapter::send(endpoint_url, payload) / test_connectivity(endpoint_url) (ec/lib.rs:139-150), the erased seam likewise (ec/erased.rs:62-110, macro arms :247-419); adapters are per-kind boot singletons over one transport (ex/bundle_orchestrator.rs:423-472); JsonAdapterCore builds every request of the ten JSON crates (tr/json_adapter.rs:129-162), StandardAdapter its own (ex/adapters/standard.rs:210-213), and stores any successful JSON (:221) as the transaction response (ex/send_worker.rs:690).

  • Nothing stops a credential in clear, in a URL or in an error. Any http:// DNS name passes the vet (ex/api/dispatch_guard.rs:127-160), and the vet is skipped for an update leaving a row inactive (ex/api/partners.rs:296-306), so https://user:pass@host can be stored and probed, and reqwest derives Basic from it. A reqwest error renders its URL (tr/wire.rs:13-21, ex/api/partners.rs:403-406).

  • Authority. GA supervisors write partners (rulesets/georgia/georgia-authz-exchange_partner.json:98); the probe needs Action::Read (ex/api/partners.rs:391); manual dispatch reads the partner without checking active (ex/send_worker.rs:494).

  • Auth failures drop records. Every non-5xx is terminal bad-status (ex/triggers/legs.rs:666-683); a terminal record job is never walked back (ex/send_worker.rs:604-618); send jobs know pending | in_flight | sent | failed only (20260505185937_exchange_send_jobs.sql:23); the ladder is 5, 5, 30, 120, 300, 900 s over attempts already spent (ex/send_worker.rs:195, :236).

  • No catalogue names a CRAIG-presented scheme (broker-held or SSL plus IP filtering: interfaces/cprs-fcc-case-plans.adoc:461-463, :510; interfaces/stars-integration-architecture.adoc:226). Production secrets arrive as env or _FILE (crates/craig-auth/src/keypair_env.rs:130-132, :167-172).

  • No Medicaid application anywhere. The trigger is "Save and Submit of the Initial Medicaid Application page" (IES/:655, :1676; :1672 retires Sign + Save), by the Case Manager within 48 h of custody (IES/:655, :978), only once the child has an EMPI (IES/:665, :2160). GA declares gtid only (crates/craig-state-ga/src/identifier_kind.rs:12-16). Exchange binds explicit and declared trigger keys only (ex/main.rs:695-715): a later subscription never replays earlier publications.

Scope

In: D1–D9 (F0 A). Out: the IES bind and its facts (TP-3, D8); the EMPI registration exchange (#1805 stays open); mtls #2434, oauth2_client_credentials #2435; recovery of a record job failed under a non-auth class #2436; SSA SOLQ auth (Phase P, ADR-066 :287-289); the broker transport; an IES outcome on the record (M-F8); a CPRS push endpoint (#1812).

Restated acceptance

#1813 (stale: "sourced from the sops store", dev/CI only by ADR-064 :50-52; "mTLS as the catalogue requires", where none does). AC1. A closed auth_type vocabulary (none, bearer, basic, api_key) applied by the shared transport; an unsupported or misconfigured row never sends. AC2. auth_config holds secret references only; anything else is a typed 422 naming the field, never echoing it; U2 empties stored configs; no credential rests in a URL, log, error, event, stored response or read model. AC3. Each reference reaches only the hosts the deployment binds to it; the probe sends the configured auth and reports the type applied; no credential crosses plain http to an unlisted host. AC4. A record job ended by an auth class is recoverable by release.

#1805, the slice. AC5. GA declares empi, nine digits ⁂, worker-attested, on person_identifiers; no DOE leg admits it.

#1807 (stale: feat(financial), financial.medicaid_application_submitted (M-F1); "supervisor+" (M-F6)). AC6. One live application per child per custody episode; submit and retract acts with a keyed intent; case.medicaid_application_submitted / _retracted, ids-only, with ADR-003 rows and security arms in the same MR. AC7. The IES gap list (D8) here, on #1822 and the TP-3 issues. AC8. #1822 names case.medicaid_application_submitted as its trigger and owes an idempotent backfill of every application submitted before it (U0).

Design

D1 — The vocabulary, the reference shape, the endpoint rules (U2; A-F1, A-F3, A-F7, A-F9)

  • PartnerAuth, a typed enum in craig-exchange parsed from (auth_type, auth_config), deny_unknown_fields per variant:

    auth_type auth_config Sent as

    none

    {}

    nothing

    bearer

    {token_ref}

    Authorization: Bearer <secret>

    basic

    {username, password_ref}

    Authorization: Basic base64(username:secret)

    api_key

    {header, key_ref}

    <header>: <secret>

  • SecretRef: ^[a-z][a-z0-9_]{0,62}$, refusing a name ending _file or _hosts (D3’s variables never alias): a name, never a value. username 1–128 printable ASCII, no :. header an HTTP token, never authorization, proxy-authorization, cookie, content-type, content-length, host, connection, transfer-encoding, te, upgrade, keep-alive, trailer or expect. No credential in a query string.

  • Create and update: an unknown type 422 partner-auth-type-unknown; a config off its shape 422 partner-auth-config-invalid naming the JSON path only; an update names both fields or neither.

  • Endpoint rules, regardless of active. An endpoint carrying userinfo is 422 partner-endpoint-userinfo at create and every update (today’s vet runs only for active rows). A non-none row on http:// is 422 partner-auth-requires-https unless its host is in CRAIG_EXCHANGE__PARTNER_AUTH_PLAIN_HTTP_HOSTS (default empty; the comma_list precedent, crates/craig-common/src/settings.rs:1073-1080). A stored row breaking either rule (written before U2) is refused at admission, send and probe as auth-misconfigured, nothing sent.

  • Admission and dispatch run the parse and endpoint rules (D3’s classes). In U2, before D3 applies credentials, every non-none type counts as unsupported: occurrences hold, record jobs fail auth-unsupported (recoverable, D3), manual jobs settle it, so nothing claiming auth is sent unauthenticated again.

  • Read model unchanged (#757). The unit pin (ex/store/models.rs:384-415) stays; the API test (services/craig-exchange/tests/api/partners.rs:262-308) posts a reference config, names both fields on update and still asserts omission (said in the commit). PartnerIntentV1 unchanged.

  • Migration (U2): every auth_config other than {} becomes {}; schema_compat_floor bumped. A plaintext secret leaves the live table only (WAL, backups and replicas keep it: rotation is the revocation, ADR-064 D3 :80-88).

  • Seed: the sister-state rows become bearer with an unprovisioned ref (their sends settle auth-unavailable); the CLI test keeps api_key.

D2 — The credential channel (U1; A-F2, A-F10)

  • craig_exchange_contracts::OutboundAuth { None, Bearer(SecretString), Basic { username, password: SecretString }, ApiKey { header, key: SecretString } }: redacted Debug, no Serialize; contracts and the transport gain secrecy (workspace 0.10, Cargo.toml:118).

  • ExchangeAdapter::send(endpoint_url, auth: &OutboundAuth, payload), test_connectivity(endpoint_url, auth); ErasedAdapter likewise, the three macro arms forwarding it (one lifetime shared by &self and &OutboundAuth on the BoxFuture<'_> returns). The ten JSON crates hand it to JsonAdapterCore; StandardAdapter too; noop:// ignores it.

  • TransportRequest.auth, ProbeRequest.auth, apart from headers. DirectHttpTransport applies bearer_auth / basic_auth, and ApiKey as a HeaderValue with set_sensitive(true); probe_health carries it.

  • Fail closed off the generic path. WebMethodsTransport, EgressControlledTransport (tr/egress.rs:328) and the SSA adapter refuse an auth other than None with a typed error before building anything. StubTransport records the auth’s kind and header name (its value under test-util only).

  • U1 is inert: every call site passes OutboundAuth::None.

D3 — Resolution, binding, application, redaction, recovery (U2, U3; A-F1, A-F5, A-F6, A-F8)

  • Resolver (U3). A ref resolves to env CRAIG_PARTNER_SECRET_<REF> inline, else CRAIG_PARTNER_SECRET_<REF>_FILE read per send (capped at 8 KiB, one trailing LF / CRLF stripped); inline wins, empty is absent (the keypair precedent). A value with a control byte or over the cap is auth-unavailable, its bytes never rendered. Values live in SecretString, nothing cached. The resolver’s only input is an injected SecretSource (an env lookup plus a bounded file reader) that main builds from the process env: the value- and file-varying tests run in-process over a tempdir source (the send worker over StubTransport, the services/craig-exchange/tests/api/ssa_worker.rs:28, :79-86 precedent, or a craig-mock-server spawn_for_test capture), since a devstack test cannot change the container’s environment and std::env::set_var is unsafe under unsafe_code = "deny" (Cargo.toml:404; crates/craig-auth/src/keypair_env.rs:327-333).

  • Destination binding (U3, A-F1). Each ref also needs CRAIG_PARTNER_SECRET_<REF>_HOSTS, a comma list of exact hosts (case-insensitive, no wildcard). The resolver refuses a send or probe whose endpoint host is not listed, or whose ref has no list, as auth-misconfigured (the ref name, never the host list, in the class detail): a partner writer can no longer aim a provisioned secret at another host, and the probe cannot extract one. The deployment owns which hosts a secret reaches.

  • Where (U3). The manual worker (ex/send_worker.rs:520-576), trigger dispatch after its rebind (ex/triggers/dispatch.rs:624-680), the probe (ex/api/partners.rs:360-415). One auth-bearing store read returns the row with auth_config (ExchangePartner carries auth_type, ex/store/models.rs:32) and serves admission, release, both workers and the probe; ExchangePartner stays without auth_config. Free functions throughout (impl TriggerRuntime is at its 16-method cap, tp1/ erratum). Manual dispatch refuses an inactive partner (partner-inactive, terminal, nothing resolved; manual retry recovers).

  • Classes (ex/triggers/settlement.rs:79-94), a bounded label set:

    Class When Record job / manual job Admission

    auth-unsupported

    type outside the vocabulary (and every non-none type in U2)

    fails, nothing sent; record recoverable

    held

    auth-misconfigured

    config off shape, userinfo, http to an unlisted host, host off the ref’s binding

    fails, nothing sent; record recoverable

    held

    auth-unavailable

    a ref resolves to nothing usable

    ladder, then fails; record recoverable

    —

    auth-refused

    the partner answers 401 or 403

    ladder, then fails; record recoverable

    —

  • Auth-class record recovery (U2, A-F6). ReleaseRequest (ex/api/triggers.rs:71) gains record_class, exclusive with held_reason (both 422): {interface, record_class: <auth-*>, ids?} (ids = send job ids). A free fn beside release (ex/triggers/acts.rs:93-157) locks FOR UPDATE each kind = 'record', status = 'failed' job of the interface whose last_error leading token (the SendFailure grammar, ex/triggers/settlement.rs:154-166) is that class and whose new restaged_as is NULL. It re-runs the admission chain, then re-stages through stage_one_record (ex/triggers/dispatch.rs:921, made pub(crate)) with the old job’s ordering key, admission, recipient, source version and closure, as supersede does (:693-760, decision 8): a new correlation and transaction, a fresh attempt budget. It sets the old row’s restaged_as (the U2 migration adds restaged_as UUID NULL REFERENCES exchange_send_jobs(id); the old row keeps its auth class, so the trail says why it failed). Response {restaged, refused}. A non-auth class 422 release-record-class-unsupported (#2436); a chain that no longer admits counts refused and leaves the row. A second or concurrent release is a no-op. So the U2 interim, a long credential outage and a job that met a 401 on its last attempt all end recoverable, never lost.

  • Admission gains a fifth link after the DSA: parse and endpoint rules, no secret read in the inbox transaction; release re-runs it.

  • 401/403: partner_error (ex/triggers/legs.rs:672-683) maps both to auth-refused with the status and no body digest, every family; failure_disposition (ex/send_worker.rs:236-262) retries it on the remaining ladder; the manual worker ends a spent one under that class.

  • Response-persistence boundary (U3). Every byte string exchange stores or serves from a send — the transaction response (ex/send_worker.rs:690), an ack, last_error, exchange.failed{error}, the probe result, the transaction read — passes redact_credential(bytes, &OutboundAuth) first: each exact occurrence of the secret, of its header value (Bearer <secret>, the api key), of Basic’s base64 token and of their JSON-string-escaped forms becomes [credential].

  • Probe (A-F8): carries the auth, needs partner update (today read), reports auth_applied: <type> (applied, not verified: /health may ignore auth), a 401/403 as auth-refused, a resolve failure by class and ref name.

  • No credential leaves. Logs, events and metric labels carry a class and a ref name only. Boot logs one warn! per active partner whose ref does not resolve or has no host binding.

  • Devstack (A-F11): compose sets CRAIG_EXCHANGE__PARTNER_AUTH_PLAIN_HTTP_HOSTS=mock-server, two fixture refs (CRAIG_PARTNER_SECRET_DEVSTACK_TOKEN, CRAIG_PARTNER_SECRET_DEVSTACK_REFUSED, obviously fake low-entropy values, each with _HOSTS=mock-server); a new layer in the mock’s router seam (tools/craig-mock-server/src/lib.rs:166-178) answers 401 to the refused marker and an echo route returns the received Authorization header in a 200 body. No sops entry, no ADR-064 amendment.

D4 — Deployment consequences (U3, deployment-guide.adoc; stated, never mandated)

  • Inline env rotates by restart; a mounted _FILE rotates on the next send. Either comes from the orchestrator’s store; ADR-064’s sops store holds devstack values only.

  • Binding a host to a ref lets every partner row naming that ref reach it; an empty or absent binding refuses the ref. Listing a host in PARTNER_AUTH_PLAIN_HTTP_HOSTS sends credentials to it in clear.

  • A credential problem (missing, wrong, rotated) holds or fails its jobs under an auth-* class: fix the secret, then release the interface’s record jobs of that class; nothing is lost. The ladder rides out blips only as far as each job’s remaining attempts.

  • Deactivating a partner stops its queued manual and trigger jobs (partner-inactive, partner-changed).

  • Activation per partner: provision the secret and its host binding, set auth_type / auth_config, run the probe, then (trigger interfaces) the knob.

  • The rollout (Rollout and risks, item 1) names the U2 → U3 sequence and the release step.

D5 — The EMPI identifier kind (U4; #1805 slice)

  • GA appends { token: "empi", label: "EMPI Client Identifier", format: Digits(9) } ⁂ (IES/:753-757, :1574-1575) to GEORGIA_IDENTIFIER_KINDS; all else is tp1/ D5 unchanged (CGEF plus BlindIndex, the uniques, worker_attested (services/craig-cases/migrations/20261014130000_person_identifiers.sql:66), acts, events with kind = empi, the audited reveal, the person’s authz). The web section lists the bundle’s kinds (services/craig-web/src/routes/cases/person_identifiers.rs:356). DOE admits kind = gtid only (ex/triggers/legs.rs:277-279).

  • Spec changes U4 makes, each said in the commit: the GA proptest’s vocab.len() == 1 (crates/craig-state-ga/src/identifier_kind.rs:40) and its only-gtid-parses assertion (:51); the cases boot test’s one-kind assertion (services/craig-cases/src/identifier_kind.rs:62); the web bundle tests' two one-kind assertions (services/craig-web/src/bundle.rs:261, :274); the cases unknown-kind example (services/craig-cases/tests/api/person_identifiers.rs:535-537) moves to a kind no bundle declares.

D6 — The application record (U5; M-F1, M-F2, M-F3, M-F7, M-F9)

  • craig-cases medicaid_applications: id (v7), case_id, child_id, episode_id (FK custody_episodes, the child’s open episode in the case), citizenship_status (CGEF; token us_citizen | qualified_alien | other | unknown ⁂), prior_medical_assistance (yes | no | unknown), legal_admin_unit (the page’s County, IES/:1607), submitted_on DATE (BusinessClock::date_of), submitted_by, submitted_at, retire columns (retracted, note). A partial UNIQUE on episode_id over live rows; a row guard admitting the retire only; field specs in crates/craig-cases-fields/src/medicaid_applications.rs; the encryption registry and xtask verify-seed cover it.

  • citizenship_status is encrypted although cases encrypts identifiers only (crates/craig-cases-fields/src/person_demographic_facts.rs:6-8): deliberate, an immigration status. An episode later retracted as entered-in-error leaves its application live; TP-3’s assembly checks the episode.

  • Not on it: names, DOB, sex, race, ethnicity, pregnancy, EMPI, removal date (standing cases facts TP-3 reads); no SSN (M-F7); no placement fact.

  • EMPI gate (M-F9): StateBundle::medicaid_application_identifier_kind() → Option<&'static str> (default None, the TX stub; GA Some("empi"); boot refuses an undeclared kind). Submit needs the child’s live identifier of that kind through commit (D7), else 422 medicaid-application-identifier-missing.

D7 — Acts, reads, events (U5; M-F2, M-F6)

  • ADR-062 idempotent: POST /v1/cases/cases/{case_id}/children/{child_id}/medicaid-applications {client_request_id, citizenship_status, prior_medical_assistance, legal_admin_unit} → 201; POST …/medicaid-applications/{id}/retract {client_request_id, note}; GET …/medicaid-applications[?child_id=], GET …/{id}, each row {id, case_id, child_id, episode_id, citizenship_status (decrypted for `case: read), prior_medical_assistance, legal_admin_unit, submitted_on, submitted_by, submitted_at, retired_at, retired_reason, note}`. Submit-only, immutable, a retract frees the episode.

  • Keyed intent. MedicaidApplicationIntentV1 hashes citizenship_status through crate::api::intents::blind_digest (keyed HMAC), never the token, as the person-identifier intent does (cases/api/intents/person_identifiers.rs:10): the persisted claim’s hash (the default is unkeyed SHA-256, crates/craig-api/src/request_claims.rs:133) cannot be matched by trying the four tokens.

  • Refusals: no child-role row 400 child-not-in-case; no open episode of the child in this case 409 custody-not-open; a live application on it 409 medicaid-application-exists; an unknown token 422; a legal_admin_unit that craig_reference::validation::validate_admin_unit (crates/craig-reference/src/validation.rs:66) refuses for the case’s state is 422 on legal_admin_unit, the canonical name stored (calling the predicate directly; canonical_admin_unit, cases/api/admin_unit.rs:28, answers 400 on admin_unit).

  • Lock order (ADR-081 D3, :49-52): claim → case FOR KEY SHARE → the child’s advisory lock → the episode FOR SHARE → the child’s live EMPI row FOR SHARE → insert. Identifier end and retract take that row FOR UPDATE, so liveness holds through commit; neither path takes the other’s earlier locks, so no cycle. The partial UNIQUE answers a racing submit 409.

  • Authz (M-F6): the case resource (cases/api/ledgers/child_facts.rs:95-101): submit and retract case: update, reads case: read; deny_pure_service before every route; no new ruleset.

  • Events, ids-only: case.medicaid_application_submitted / retracted {application_id, child_id, case_id, episode_id, act, act_id, act_at, user_id}, strict. ADR-003 rows; craig-security family case.medicaid_application → application_id, resource medicaid_application (_submitted a create, _retracted an update); the family pin (services/craig-security/src/event_parsing.rs:3324) becomes 35. No consumer in TP-2: exchange binds only declared keys, so TP-3 owes the backfill (AC8). Citizenship never enters an event, log or error.

D8 — The IES field gap list (AC7)

IesMedicaidReferral field (ies/:95-246) Source after TP-2 Gap → TP-3

transaction_id u64 (:100)

none (the correlation is a UUID)

numeric transaction id #2433

dhr_client_number (:104)

the live empi identifier (D5)

registration exchange (#1805)

request_identifier, program_indicator, requesting_aid, dfcs_office_state

constants

—

request_date (:114)

the episode’s custody_from ⁂

—

names, dob, gender

persons

CSEX map #2432; middle_name, suffix none (optional)

ssn (:146)

omitted (M-F7)

—

race, ethnicity (:150-156)

person_demographic_facts

CRACE / CINDETHN crosswalks #2432

citizenship_status (:159)

the application (D6)

IES code crosswalk #2432

pregnancy (:217)

child_parenting_facts

—

legal_county, dfcs_office_name

the application’s legal_admin_unit

county code ⁂ #2432; String(15) ⁂

date_submitted, prior_ma_indicator

the application

—

placement_county, five address fields, foster_parent

free-text foster_homes.address, foster_homes.name

structured placement address #2430

dfcs_office_loc, dfcs_office_city

none

DFCS office source #2431

sscm_name (:193)

cases.assigned_worker_name

#1811 ⁂

email (:222)

worker_identities.email

optional; TP-3 decides

D9 — Web (U6)

A Medicaid application section on the child-in-case view (services/craig-web/src/routes/cases/custody.rs): the submit form (legal county prefilled), the list, retract; each row states its delivery plainly: "Recorded; not yet sent to IES" until TP-3 sends it (no delivery claim in TP-2); Fluent keys; a Playwright journey by test id.

F0 — scope. A (rec): TP-2 = #1813, the EMPI kind, #1807; #1822 to TP-3 with #2430–#2433, #1811 and the backfill duty. Consequence: two usable lanes; IES sends nothing until TP-3, which then backfills every TP-2 application once. B: bind IES now. Consequence: four required fields with no home (D8) are invented or every record refused, and the sync-vs-async reading (⁂14) may amend ADR-075 decision 10. C: #1813 only. Consequence: no way to capture an application meanwhile.

A-F1 — credential home. A (rec): references resolved per send from env or _FILE, each bound to deployment-listed hosts. Consequence: no secret at rest; partner-write authority cannot redirect a secret; a partner needs its secret and binding first. B: env keyed by partner id. Consequence: runtime rows coupled to deploy config. C: encrypted in Postgres. Consequence: the database becomes a credential store. D: references with no host binding. Consequence: a partner writer (a GA supervisor) can aim any secret at a host it controls and extract it through the probe.

A-F2 — channel. A (rec): an explicit &OutboundAuth per call. Consequence: one mechanical signature change across the partner crates. B: per-partner adapter caches. Consequence: invalidation logic. C: a host-keyed decorator. Consequence: two rows on one host cannot differ.

A-F3 — types. A (rec): none, bearer, basic, api_key; mtls #2434. Consequence: headers on the shared client. B: mtls now. Consequence: +W5, per-partner clients, a TLS mock, before any reading names a partner that needs it (⁂1).

A-F4 — OAuth2 client credentials. A (rec): #2435. Consequence: the seed’s oauth2 rows become bearer. B: now. Consequence: a token cache, refresh, a second egress target.

A-F5 — rotation. A (rec): resolve per send, no cache. Consequence: a mounted file rotates on the next send. B: load at boot. Consequence: rotation is a restart.

A-F6 — auth failures. A (rec): auth-* classes, record jobs recoverable by release’s record arm; 401/403 ride the remaining ladder first. Consequence: no record lost to a credential problem; a long outage needs one operator release. B: terminal `bad-status. Consequence: a rotated credential drops every record it meets. C: a general record-job hold for every class. Consequence: new substrate beyond auth (#2436).

A-F7 — plain http. A (rec): refused unless the host is listed. B: left to the deployment. Consequence: a mistyped row sends in clear.

A-F8 — probe. A (rec): the probe carries the auth, needs update, reports it applied. B: an authenticated no-op POST. Consequence: may create records.

A-F9 — read model and stored rows. A (rec): auth_config stays out of the read model; U2 empties stored configs. B: serve the refs. Consequence: every partner reader sees ref names. C: no scrub. Consequence: pre-U2 secrets stay at rest.

A-F10 — SSA and SHINES. Rec: StandardAdapter in (the generic path), SSA out (its adapter refuses an auth; Phase P owns it).

A-F11 — devstack values. A (rec): public markers in compose. B: ADR-064 store entries. Consequence: an amendment, and identity-less contributors lose the tests (:217-218).

M-F1 — owner. A (rec): craig-cases. Consequence: every source fact is local; #1807’s financial label is restated. B: craig-financial. Consequence: an exchange → financial client and a PII fan-out or snapshot; rollout step 1 changes (deployment-guide.adoc:906-908).

M-F2 — shape. A (rec): one live per (child, episode), submit-only, immutable, retract. B: drafts. Consequence: a lifecycle and routes. C: per (child, case). Consequence: a re-entry reuses the old application.

M-F3 — contents. A (rec): only the page facts with no other home. B: every page fact. Consequence: a second DOB at rest. C: none. Consequence: citizenship, prior MA and legal county have no home.

M-F4 — placement gate (IESM.1.3). A (rec): TP-3’s leg (the catalogue gates the sending, IES/:622-623). B: at submit. Consequence: cases gains a placement client now.

M-F6 — who submits. A (rec): case: update, the catalogue’s actor ⁂. Consequence: differs from the issue. B: supervisor and admin. Consequence: a GA and TX ruleset; every submit waits on a supervisor inside 48 h.

M-F7 — SSN. A (rec): omitted. B: a second release purpose. C: a snapshot. Consequence: a second SSN at rest.

M-F8 — return path. A (rec): the outcome stays in exchange’s settlement. B: outcome columns now. Consequence: inbound plumbing not asked for.

M-F9 — EMPI gate. A (rec): a live EMPI through commit. B: no gate. Consequence: TP-3 refuses at send, after the 48 h window.

Minor. M-F5: the removal date is the episode’s custody_from (rec) OR placement’s removal episode (⁂8). Citizenship tokens: a neutral four (rec) OR a bundle vocabulary. The plain-http list: a setting (rec) OR a hard-coded mock-server.

What TP-3 must honour. B-F1: the IES stage is the application (a MedicaidApplication stage kind): a retract and resubmit give a new application id inside one episode, and the recipient ledger dedupes by stage and person (ex/store/trigger_ledgers.rs:186), so the episode is not a usable stage. B-F2/F3: the record carries the page facts; the person projection need not widen for citizenship. B-F4: TP-2 adds nothing to job identity. B-F6: auth applies to any HTTP send; no class assumes an acknowledgement shape. B-F8: no correction leg is owed. B-F10: the backfill (AC8) is an open-applications walk plus catch_up_leg(ies, MedicaidApplication), idempotent through the recipient ledger. B-F11: the gate leaves only an EMPI ended after submit to assembly.

Units — each its own MR, one epic

Order: U0, then U1 → U2 → U3 (auth) and U4 → U5 → U6 (application). Each MR closes its unit issue and Relates to its parent; U3 closes 1813, U4 Relates to #1805, U5 closes #1807. The first code unit sets Status In progress; each MR is green alone with its CHANGELOG entry; each new test carries // @axis:, a devstack one [ignore = "requires devstack"]. Whichever of U3 and U6 merges last closes out (Status Done, the archive row, plan-lint --done --allow-open 1073,1805,1811,1812,1822,2345,2430,2431,2432,2433,2434,2435,2436,2437).

U W Content Pages

U0

1

The TP-2 epic (&108) and unit issues #2426 (U1), #2427 (U2), #1813 (U3), #2428 (U4), #1807 (U5), #2429 (U6); the TP-3 epic (&109) with #2430 structured placement address, #2431 DFCS office source, #2432 GA IES crosswalks, #2433 numeric partner transaction id; #1811 and #1822 re-parented, #1822 restated (trigger, D8, blockers #1805 #1811 #2430–#2433, the IES mock Errors / 5xx sentinel, the backfill duty, the application stage kind); follow-ups #2434 mTLS, #2435 OAuth2, #2436 non-auth record-job recovery, #2437 fix: seeded DSAs expire 2026-12-31 (datagen.rs:2665-2666); labels Plan::TRIGGER-PARITY, a type, P2 for TP-3’s blockers, P3 for follow-ups; restated ACs on #1813, #1805, #1807; the ⁂ readings on #1073. Docs only

this page (Active nav), ADR-083 (Proposed)

U1

5

D2: OutboundAuth, the request fields, the widened seam across the partner crates and StandardAdapter, the broker / egress / SSA refusals. Inert

shared-crates.adoc, CHANGELOG

U2

8

D1 and D3’s U2 parts: vocabulary, typed validation, the endpoint rules (userinfo regardless of active; https unless listed), the admission link, the interim refusal, the auth-class record recovery arm, the scrub migration and floor bump, seed and CLI

api/craig-exchange.adoc, data-model-exchange.adoc, cli.adoc, CHANGELOG (Changed, ops note)

U3

8

D3’s U3 parts and D4: resolver and SecretSource, destination binding, application at three sites, the inactive-partner refusal, 401/403, the response-persistence boundary, the probe, devstack markers and the mock’s 401 and echo routes

deployment-guide.adoc, security.adoc, devstack.adoc, ADR-083 Accepted, ADR-075 amendment (decision 10’s classes; the record arm of release), ADR-032 (:523), CHANGELOG

U4

2

D5 with every spec-changed test it lists

shared-crates.adoc, data-model-cases.adoc, CHANGELOG

U5

5

D6 + D7 with ADR-003 rows and security arms (the same-MR rule); the ledger-lift golden re-blessed

data-model-cases.adoc, api/craig-cases.adoc, ADR-003, shared-crates.adoc, CHANGELOG

U6

3

D9 and Playwright

guide/caseworker.adoc, CHANGELOG

Test matrix (each row red on main; "in-process" runs over the injected SecretSource)

Test Axis U Asserts; why red on main

outbound_auth_never_prints_its_secret

evil

U1

Debug of OutboundAuth, TransportRequest, ProbeRequest holds no secret byte. Red: no type

every_generic_adapter_forwards_auth

happy

U1

each JSON kind and StandardAdapter hand the auth to the stub on send and probe. Red: no parameter

direct_transport_sends_a_sensitive_credential

happy

U1

a local server sees each type’s header, built sensitive. Red: no field

a_broker_egress_or_ssa_send_refuses_auth

evil

U1

typed refusal; nothing built. Red: no field

partner_auth_parse_is_total (proptest)

evil

U2

any (type, JSON) never panics; accepted ⇔ D1 (no _file / _hosts ref); round-trips. Red: no parser

an_unknown_auth_type_is_refused

sad

U2

oauth2, API_KEY, empty: 422, nothing written. Red: 200

a_secret_in_auth_config_is_refused_unechoed

evil

U2

{"token": …}, a bad or _file ref, an extra key, a nested object: 422 naming the path, no value echoed or logged; a one-field update 422. Red: 200, stored

endpoint_rules_hold_regardless_of_activation

evil

U2

userinfo on create and on an update leaving the row inactive: 422; bearer on an unlisted http:// host 422, listed mock-server passes. Red: 200

a_stored_bad_endpoint_is_never_used

evil

U2

SQL-written userinfo and http rows: admission held, send and probe auth-misconfigured, capture empty, no reqwest-derived Basic header. Red: sent

partner_auth_settings_load_the_host_list

happy

U2

…PLAIN_HTTP_HOSTS=mock-server, a → two hosts. Red: no field

the_migration_empties_every_auth_config

happy

U2

rows inserted first, the migration’s SQL applied on a scratch DB: configs become {}. Red: no migration

a_legacy_auth_token_is_never_sent

evil

U2

a SQL-written oauth2 row: admission held (release re-holds), jobs fail auth-unsupported, capture empty. Red: sent unauthenticated

a_pending_record_survives_the_auth_rollout

fault

U2

a CPRS record pending for a bearer row fails auth-unsupported in the interim; release’s record arm re-stages it, a non-auth class refused; with U3 and the secret it sends once, authenticated (the U3 half extends this row). Red: no arm

release_restages_only_auth_class_records

sad

U2

record_class: bad-status 422; both selectors 422; an auth-* job re-staged once under a new correlation, the old row failed with its class and restaged_as set; two concurrent releases stage one. Red: no arm

each_auth_type_reaches_the_partner

happy

U3

in-process: bearer, basic, api_key from inline and from a file: exact headers; none sends none. Red: no header

a_secret_never_leaves_its_bound_hosts

evil

U3

in-process: a ref bound to host A, a partner (and the probe) on host B: auth-misconfigured, nothing at B; a ref with no binding refused. Red: no binding

a_credential_echoed_in_a_success_body_is_redacted

evil

U3

in-process: 200 bodies echoing each type’s header (Basic’s encoded value and JSON-escaped forms too): the stored response, the transaction read and the ack hold [credential], no secret byte. Red: stored verbatim

a_replaced_secret_file_is_used_on_the_next_send

happy

U3

in-process: the file changes between sends; each carries its value. Red: no header

two_partners_of_one_kind_never_cross_credentials

conc

U3

in-process: concurrent sends to two same-kind partners: each capture holds its own. Red: no header

an_unresolvable_secret_sends_nothing_until_provisioned

fault

U3

in-process: unset ref: auth-unavailable on the ladder, nothing sent; provided, the next attempt or a release sends. Red: sent unauthenticated

a_record_with_spent_attempts_is_recoverable

fault

U3

in-process: five prior failures, then a 401: fails auth-refused; release re-stages; it sends once with the fixed secret. Red: terminal bad-status

a_401_or_403_is_auth_refused_not_dropped

fault

U3

devstack: the refused marker’s 401: CPRS and DOE records retried, auth-refused with its code and no digest; a 403 alike (unit). Red: no marker or 401 layer; the unit 403 settles bad-status

a_deactivated_partner_sends_no_queued_manual_job

evil

U3

in-process: a queued manual job, then deactivate: partner-inactive, nothing sent. Red: sent

the_connectivity_test_applies_the_configured_auth

happy

U3

devstack: the probe’s capture carries the header; the result names the type; a read-only caller 403. Red: no header

no_credential_leaks_into_errors_events_or_logs

evil

U3

across 401, 5xx, timeout, unresolvable, unbound host and the probe: no marker byte in last_error, error_message, exchange.failed, the probe result, logs or metric labels. Red: no header

empi_format_is_total (proptest)

evil

U4

accepted ⇔ nine ASCII digits ⁂, never trimmed; two kinds. Red: no kind

an_empi_is_stored_encrypted_and_unique

evil

U4

201; CGEF and hmac; another’s live EMPI 409 naming no one. Red: 422

an_empi_act_is_no_doe_occurrence

evil

U4

record and end on a listed child: no DOE admission. Red: 422

a_submit_records_the_application_and_its_event

happy

U5

201; case.medicaid_application_submitted ids-only (strict decode). Red: 404

a_submit_needs_an_open_episode_and_a_live_empi

sad

U5

no or a closed episode 409; no or an ended EMPI 422; a non-member 400; TX ungated. Red: 404

an_empi_ended_during_submit_never_admits

conc

U5

an EMPI end racing a submit: either the submit commits first and the end waits, or the end commits first and the submit 422; never an application whose EMPI ended before its commit (a pg_locks census). Red: 404

one_live_application_per_episode

conc

U5

racing submits: one 201, one 409; a submit racing the close: no 500; retract then submit 201. Red: 404

a_medicaid_application_retry_replays

replay

U5

the same client_request_id returns the original; another body 409. Red: 404

the_application_intent_hash_is_keyed

evil

U5

the persisted claim’s hash differs from the unkeyed SHA-256 of the intent under each of the four tokens. Red: no route

medicaid_application_acts_are_authorized

evil

U5

the assigned caseworker submits; outside the unit 403; read-only reads; a pure service 403. Red: 404

citizenship_status_rests_encrypted_and_stays_out

evil

U5

the column is CGEF; no event, log or problem body holds the token. Red: no table

application_fields_are_validated

sad

U5

an unknown token 422; a refused admin unit 422 on legal_admin_unit; a client submitted_on 422. Red: 404

an_undeclared_medicaid_identifier_kind_refuses_boot

sad

U5

a bundle naming an undeclared kind is a boot error. Red: no hook

security_files_medicaid_application_events

evil

U5

both keys resolve application_id; the family pin is 35. Red: no arm

cases-medicaid-application.spec.ts

happy

U6

submit, list ("Recorded; not yet sent to IES"), retract by test id. Red: no UI

Rollout and risks

  1. The auth lane’s sequence. U1 is inert. U2 is the fail-closed step: every non-none row holds or fails auth-unsupported (record jobs recoverable). Before or with U3: provision each partner’s secret and _HOSTS binding. After U3: release the interface’s auth-unsupported admissions and record jobs; they send once, authenticated. A deployment that relied on unauthenticated sends sets those rows to none (the ops note). U2’s floor bump stops an older exchange from starting, not one running: write partners only after the roll.

  2. Downgrade. Exchange cannot roll back below U2. U4–U6 are additive in cases with no floor bump; a cases rollback below U5 answers the application routes 404 and leaves the rows.

  3. Risks. A host binding grants every row naming the ref; bind narrowly. A short secret typed as a ref name is stored like a name (it then fails to resolve). Scrubbed values survive in WAL and backups. A partner’s /health may not exercise auth. A content-based 403 is resent on the remaining ladder. Redaction matches the exact applied forms; a partner that transforms the secret (hashes it) defeats it.

⁂ readings for #1073 (U0 posts them):

  1. Which scheme each endpoint requires; who issues and rotates credentials. . Whether GTA webMethods stays in the path. . Whether SSL plus IP filtering stays sufficient (cprs-fcc-case-plans.adoc:510). . Save and Submit with no signature step (IES/:1672-1677 vs :1750, :2130, :2152). . EMPI sent, nine digits; DHR Client Number and EMPI ID are one identifier (IES/:753-757, :777; CR 256 :2615). . EMPI precedes submit (IES/:665, :2160). . The Case Manager submits (IES/:655, :978). . The removal date is the episode’s In-Care date (IES/:769-770). . CRAIG active / planned placements pass IESM.1.3 (IES/:1646-1669). . The code tables: CRACE for a multi-race child, CINDETHN, citizenship String(3), CSEX U, county code. . Office name String(15); whose office. . A display name as SSCM name (#1811). . One application per episode; does IES dedupe a second REF. . A direct POST answers synchronously (ies/:12-16 vs IES/:638, :1750); a 7- or 60-day horizon. . The 548.x rows are superseded (IES/:28-605). . The four citizenship tokens cover DFCS’s categories.

Review log

Round Vendor Resolved model Verdict

1

Anthropic, one fresh contextless reviewer (the page, the rules, the four questions)

Claude Opus 5.5

no-ship: 2 blockers (secret-varying tests unbuildable without an injected source; a _file ref aliasing another ref’s path variable), both fixed; 14 non-blocking notes folded

2

OpenAI (maintainer-run)

GPT Astra

no-ship: 10 findings (5 P1, 5 P2) and 2 contract details, all fixed (deployment-bound secret hosts, a keyed application intent, auth-class record recovery for the U2 rollout, a response-persistence redaction boundary, TP-3’s backfill duty and the "not yet sent" UI, userinfo refused regardless of activation, the application as TP-3’s stage, U4’s full test inventory, the cut-over claim, deactivation stopping manual sends, EMPI liveness through commit, 422 on legal_admin_unit)

Edit this page · latest