Plan: SSA screening on Gateway’s income inquiry
Status
Done (2026-11-28) — SSA screening asks Gateway’s income and resource inquiry, keyed by the member’s DHR client number
(Georgia: the empi identifier, named by screening_identifier_kind), and no SSN leaves craig-cases for it. The
SOAP answer’s SI/ST and SSR/SSD rows on the client’s own clientID become ssi and title_ii facts; an
active fact the answer leaves out is terminated; a member Gateway holds no record for is no_gateway_record and
raises the review alert; the SSN release, digest binding and verification CAS are gone. Production activation stays
Phase P (#1433): the send-authority witness is unconstructible, so a release build still pauses every job. #3176
(renames) and #3177 (non-SSA income) stay open.
Closes: #3175. Relates to: #162 (anchor), #1433 (Phase P), #1432, #3172. Supersedes: units
C0–C3 of Plan: SSA Benefit Verification (SOLQ / SDX / BENDEX) for IV-E Eligibility (the SDX/BENDEX import).
Maintainer (2026-11-27), the first four on #162 (note 4341730085): re-key in place; a member Gateway does not
serve is screened with no record, plus an alert; SSA codes only; the WSDL’s SOAP wire; terminate by absence.
Context
The pipeline of ssa-data-exchange.adoc (units A1–E4, built) screens a case’s household before an IV-E
determination. It releases each member’s SSN from craig-cases just in time, sends it to an ssa_solq partner as
placeholder JSON, and has no response contract: every answer maps to Unmappable
(services/craig-exchange/src/ssa_worker.rs, map_response_outcome).
SSA’s exchanges end at Gateway. The child welfare system reads the results through Gateway’s
incomeResourceInquire, transcribed in Gateway Income and Resource Inquiry (IncomeResourceService). It is SOAP, keyed by
DHR client number, and carries no SSN. Its unearnedIncome rows hold what Gateway’s BENDEX and SDX batches loaded:
SSR and SSD (RSDI), SI and ST (SSI). One answer lists the whole Gateway household’s rows, each tagged with the
clientID it belongs to. Gateway does not enforce the WSDL’s maxOccurs.
CRAIG stores the DHR client number as a person identifier of kind empi (Georgia: 9 digits), encrypted, one live row
per person and kind, its value immutable (services/craig-cases/migrations/20261014130000_person_identifiers.sql).
Scope
In: the identifier-keyed cohort and release (D1, D2); the SOAP codec (D3); the worker’s send and mapping (D4); outcome semantics in craig-cases (D5); the vocabulary and schema (D6); the docs and ADR amendments (§ Delivery).
Out:
-
Production activation. The send-authority witness (
crates/craig-partner-ssa-solq/src/authority.rs) stays unconstructible, so a release build still pauses every jobcontract-pending. Flipping it, outbound authentication, the DSA, the egress allowlist and cutover evidence remain Phase P (#1433, operations). -
Renaming the partner kind
ssa_solq, its crate and thessa_*tables (#3176). -
Non-SSA income (VA, railroad, child support, earnings) for the IV-E income test (#3177).
-
A devstack Gateway mock (Canopy’s subject) and Gateway’s other SHINES services (#3172).
-
Survivors' benefits: Gateway has no code for them, so
ssa_deathstays dormant.
Design
D1. The cohort binds each member’s client-number identifier
Setting. A bundle names the identifier kind screening uses, as it does for the Medicaid application:
-
StateBundle::screening_identifier_kind(&self) → Option<&'static str>, defaultNone(crates/craig-state-bundle/src/bundle.rs, besidemedicaid_application_identifier_kind). -
screening_identifier_kind: Option<String>inSettings(crates/craig-config-bundle/src/schema.rs), carried bybundle.rs.read.rs’s `medicaid_kind_is_declaredbecomes one check over both keys, with the sameUndeclaredIdentifierKinderror. -
craig-cases boots
ScreeningIdentifierGate(Option<IdentifierKind>)insrc/identifier_kind.rs, mirroringMedicaidApplicationGate: a kind the vocabulary does not declare refuses boot. -
Georgia sets
screening_identifier_kind = "empi"incraig-config-georgia/bundle/settings.toml; step 5 bumpsconfig-sources.lock.
Cohort. StageScreeningMember (crates/craig-cases-contracts/src/screening_wire.rs) carries
identifier_id: Uuid in place of ssn_digest. assemble_cohort
(services/craig-cases/src/api/case_screening_cohort.rs) reads each active household person’s live identifier id of
the gate kind through one new store read in store/person_identifiers.rs. It refuses with 409:
-
SCREENING_UNCONFIGUREDwhen the gate isNone; -
SCREENING_IDENTIFIER_MISSING, naming the person ids and the kind’s label, when a member holds no live identifier of the kind. This replacesMISSING_SSNhere.
Members sort by person id, then identifier id. cohort_hash (screening_cohort.rs) takes &[(Uuid, Uuid)] and
its domain tag becomes craig.ssa.cohort.v2.
Revision seam (services/craig-cases/src/screening_revision.rs). CohortChangeKind loses PersonDigest,
SsnCleared and LinkPromoted with their four call sites (api/persons_ssn.rs, api/persons.rs,
api/report_persons.rs, ssn_promotion.rs): an SSN change no longer alters a cohort. It gains
ScreeningIdentifier (wire token screening_identifier), noted by record_person_identifier,
end_person_identifier and retract_person_identifier (api/ledgers/person_identifiers.rs) inside their own
transaction when the row’s kind is the gate kind.
D2. The identifier release replaces the SSN release
POST /v1/cases/persons/{id}/screening-identifier-release, in a new api/persons_screening_release.rs. It keeps the
SSN release’s guards: the consumer allowlist of one (craig-exchange) and stage-time attribution.
-
Request
ScreeningIdentifierReleaseRequest { identifier_id, screening_run_id, screening_member_id, requested_by }; response{ value: String }, the plaintext client number. -
The row must belong to the person, be of the gate kind and be live. It is decrypted with the helper
reveal_person_identifieruses. Otherwise 409SCREENING_IDENTIFIER_STALE; an unknown person is 404. -
Audit (
events.rs). A release keeps the wrapperpublish_person_pii_released_for_screeningand its keycase.person_pii_exported, withpurposeincome_inquiry_screening,include_full_ssnfalse and theidentifier_idadded. A refusal’s keycase.person_ssn_release_refusedis renamedcase.person_screening_release_refused, reasonidentifier_stale, with its craig-security parser arm, census test and ADR-003 entry.SsnReleaseAuditbecomesScreeningReleaseAudit.
Deleted: api/persons_ssn_release.rs, its route and OpenAPI entry, SsnReleasePurpose, SsnReleaseRequest,
SsnReleaseResponse, CasesClient::release_ssn, and their tests. current_ssn_digest and current_digest_version
move to api/persons_ssn.rs, which still uses them for the human SSN attestation. SsnDigest and
persons.ssn_verified stay for that path.
D3. The SOAP codec
A new module crates/craig-partner-ssa-solq/src/income_inquiry.rs:
/// A DHR client number: 1 to 9 ASCII digits. `Debug` redacts it.
pub struct ClientNumber(String); // ClientNumber::parse(&str) -> Option<Self>
pub struct IncomeInquiryRequest { pub client: ClientNumber, pub request_date: NaiveDate }
pub enum SsaIncomeKind { Ssi, TitleIi }
pub enum IncomeInquiry {
/// `R000` with the request month's data: the SSA kinds on the client's own rows, possibly none.
Answered { month: NaiveDate, kinds: BTreeSet<SsaIncomeKind> },
/// `R005`, `R006`, or `R000` without the request month: Gateway holds nothing for the client then.
NoRecord,
}
pub fn envelope(request: &IncomeInquiryRequest) -> Vec<u8>;
pub fn parse(body: &[u8], request: &IncomeInquiryRequest) -> Result<IncomeInquiry, SsaSolqError>;
envelope writes the document/literal request the interface page describes: a SOAP 1.1 Envelope and Body, the
element incomeResourceInquire in the namespace IncomeResourceServiceNamespace, and unqualified children
incomeResourceService → incomeResourceRequest → DHRClientNumber, requestIdentifier (INQ) and requestDate
(MM/dd/yyyy). The three values are digits, a constant and a formatted date, so none needs escaping. The contract
has no correlation field; the correlation id stays on the exchange transaction row.
parse, in order. Each refusal is a variant of SsaSolqError carrying no response bytes, and nothing of the
response but the result leaves it:
-
The body is UTF-8 and parses with a DTD refused and a node limit of 50,000: else
MalformedResponse. The transport already caps the body at 1 MiB (MAX_RESPONSE_BYTES). Elements match by local name; namespaces are not compared. An element withxsi:nil="true"or no text is absent. -
A SOAP
Faultin the body isPartnerFault(new). -
returnCodeunderincomeResourceResponse:R000continues;R005andR006areNoRecord;R001–R004areRequestRefused(new);R007, an unknown code, or noreturnCodeisPartnerError(new). -
The
inquiryDatawhosebenefitMonthis the request date’sMMyyyy: none isNoRecord. EveryinquiryDataand everyunearnedIncomeis read, however many there are. -
Each
unearnedIncomeof that month needs aclientIDand anunearnedType: a row missing either isMalformedResponse, so a renamed field fails loudly instead of reading as "no benefit". A row counts when itsclientID, as a number, equals the request’s client number.SIandSTgiveSsi;SSRandSSDgiveTitleIi; any other type is ignored.
The crate. The parser uses roxmltree, a read-only tree. Compared:
-
quick-xmlwith serde:deny.tomlalready ignores RUSTSEC-2026-0194 and -0195 for two transitive copies, on the ground that they parse only S3 API responses. Using it here would add a third copy, on partner ingress. Its serde lists also match repeated elements by qualified name and need a feature for non-adjacent repeats. -
serde-xml-rs: the least maintained of the three, and it bringsxml-rs. -
roxmltree: refuses a DTD unless asked, has a node limit, and exposes local names, so the lenient rules above are ours to state. We keep four fields, so serde derives save nothing. Step 3 starts by reading the pinned version’sParsingOptionsdocumentation and runningcargo deny check.
D4. The worker’s send and mapping
In services/craig-exchange/src/ssa_worker.rs:
-
custody_phasecallsCasesClient::release_screening_identifier. A released value thatClientNumber::parserefuses ends the memberfailed(identifier-unusable); a 409 stale ends itidentifier_stale. -
The request date is the jurisdiction’s business date, as
claim_state_gatesalready reads it. -
SsaSolqAdapter’s `ExchangeAdapterimpl takesIncomeInquiryRequestand returnsIncomeInquiry. It sendsContent-Type: text/xml; charset=utf-8and the quotedSOAPActionof the interface page. -
partner_error_class:PartnerFault→partner-faultandPartnerError→partner-error, both retried like today’s classes.RequestRefused→partner-refusedis the one classdispatchdoes not retry: it ends the memberfailedthroughterminal_pair. -
map_response_outcomebecomesmap_inquiry:Answered { month, kinds }→Screened { screened_month: month, entries }, one entry per kind with rolerecipient, statusactive,as_ofthe month’s first day;NoRecord→NoGatewayRecord.SolqScreeningRequest,SolqScreeningResponse,SCHEMA_VERSIONand the error variantRequestEncodingare deleted.
D5. Outcome semantics in craig-cases
RecordSsaOutcomeRequest (crates/craig-cases-contracts/src/screening_outcome.rs) loses echo_matched and
expected_digest and gains identifier_id. SsaMemberOutcome becomes Screened { screened_month, entries } |
NoGatewayRecord; NoMatch and Unmappable are deleted.
record_outcome_tx (services/craig-cases/src/api/ssa_outcomes.rs), in order:
-
The replay guard and the person lock, as today.
-
The member’s identifier row is still live, read
FOR SHAREby id: else 409SCREENING_IDENTIFIER_STALE. This replacesverify_digest. -
The authority refusal, as today.
-
Each entry is inserted through
insert_fact_chained, as today. -
Termination by absence. For
Screened, each of the person’s chain heads that isactiveand has no entry of its kind and role gets aterminatedsuccessor,as_ofthe screened month. The heads come fromstore::ssa_benefits::current_facts_for_person, which now takes the transaction and loses itsdead_codeexpectation.NoGatewayRecordwrites no fact. -
The
facts_recordedfan-out runs when any fact row was written.NoGatewayRecordfans outno_gateway_recordthroughfan_out_review_items_for_person(store/ive_determinations.rs). -
The projection row, as today.
apply_verification_casand thesolq_matchattestation are deleted.
The alert at determination. The fan-out reaches determined cases only. So persist_determination
(api/ive_determination.rs), after insert_determination, calls upsert_review_item(tx, case_id,
"no_gateway_record") when the witnessed run holds a no_gateway_record outcome (a new read in
store/ssa_benefits.rs). derive_evidence is unchanged.
D6. Vocabulary and schema
-
Step 4, cases
ssa_screening_outcomes.member_outcomeand exchangessa_screening_members.status:no_match→no_gateway_record, rows updated and CHECKs swapped. -
Step 4, cases
screening_review_worklist.latest_reason: the CHECK gainsno_gateway_record. -
Step 5, exchange
ssa_screening_members:ssn_digestdropped,identifier_id UUID NOT NULLadded,ssn_stale→identifier_stale,unmappableremoved. -
Step 5, cases
ssa_screening_outcomes.member_outcome:unmappableremoved and its fact-less rows deleted.
Step 5’s exchange migration first deletes the rows of ssa_screening_jobs, ssa_transport_handoffs,
ssa_screening_members and ssa_screening_runs, in that order: a run bound to SSN digests has no identifier to
re-key to, and no run was sent under authority. The Rust enums, the retention and archive specs that name
ssn_digest (ssa_retention.rs, retention_archive.rs), the worker’s job classes, craig-web’s and
plugins/ssa-screening’s status labels, and `tests/e2e follow the same renames.
Steps
Each step is one MR on its own branch from main, with its tests, docs and a changelog.d/ fragment.
-
Plan. This page under
plans/, its nav entry, and inssa-data-exchange.adocan erratum line plusN/Afor C0–C3. The issue this plan closes (#3175) and the two out-of-scope issues (#3176, #3177) are filed; the rescope is noted on #1433. -
Setting. D1’s setting in craig-state-bundle and craig-config-bundle, inert. Then Georgia’s
settings.toml, as an MR incraig-config-georgia. -
Codec. D3’s module, its dependency and its tests. The adapter impl is untouched.
-
Outcome semantics. D5 without the identifier binding:
echo_matchedand the CAS go;screened_month, termination by absence,NoGatewayRecordand both alert writers arrive; D6’s step-4 rows.expected_digest,verify_digestandUnmappablestay until step 5: the worker still sends the placeholder and mapsUnmappable. -
Re-key. D1’s cohort and seam, D2, D4, D5’s
identifier_id, D6’s step-5 rows, and the lock bump. -
Close. The plan to
plans/archive/, StatusDone, a note on #162 with what Phase P still owes.
Risks
-
Another person’s row is credited to the member (fail-open: a sibling’s SSI would derive a parent’s incapacity). Mitigation: a row counts only on a numeric
clientIDmatch; testa_household_members_row_is_not_credited_to_the_client. -
A stale
activefact survives when Gateway has no record (fail-open). Mitigation: theno_gateway_recordalert from both writers; testsno_gateway_record_alerts_the_determined_caseanda_determination_over_a_no_record_member_opens_the_item. -
Termination by absence on a Gateway data gap (fail-closed: a benefit is dropped and a deprivation basis lost). Mitigation: the chain is append-only, so the next screening re-activates it, and the termination itself raises
facts_recorded; the operations page says so. -
Contract drift read as "no benefit" (silent, then fail-closed through termination). Mitigation: a row without
clientIDorunearnedType, and a missingreturnCode, are errors, not empty answers; testsa_row_without_its_type_is_malformedandan_answer_without_a_return_code_is_a_partner_error. -
Hostile or oversized XML (fail-closed). Mitigation: DTD refused, node limit, 1 MiB cap; tests
a_doctype_is_refusedandparse_never_panics. -
The client number or another person’s data leaks into a log, row or event (silent). Mitigation:
ClientNumberredacts, errors carry no bytes, and the canary sweep covers the new path; testthe_inquiry_leaves_no_canary_in_any_sink. -
A deployment sends before Phase P (fail-closed): the witness is unchanged, pinned by
witness_unconstructible. -
The setting is absent (fail-closed: screening refuses
SCREENING_UNCONFIGURED); testscreening_refuses_without_a_configured_kind. -
Step 5’s migration deletes development runs (silent). Mitigation: the changelog’s operations note; no run was sent under authority.
Tests
Contract (wire).
-
the_envelope_matches_the_pinned_bytes: the request, byte for byte. -
Fixtures written from the WSDL under
crates/craig-partner-ssa-solq/tests/fixtures/income_inquiry/, one test each:r000_ssi_and_rsdi,r000_month_absent,r005,r006,r007,empty_service,nil_fields,fault, and theR001–R004refusals. -
the_worker_posts_the_envelope_and_no_ssn: the body wiremock received equals `envelope’s output. -
Worker classes, against wiremock:
a_refused_request_fails_the_member_without_a_retry,a_partner_error_is_retriedandan_unparseable_client_number_fails_the_member. -
The OpenAPI goldens of craig-cases and craig-exchange, and
cohort_hash_matches_the_pinned_vector(v2).
Property. parse_never_panics, on arbitrary bytes. parse_agrees_with_the_model: generated answers with shuffled
rows, unknown elements, several clients and more rows than the WSDL allows; the kinds equal the model’s.
Regression.
-
a_household_members_row_is_not_credited_to_the_client, androws_past_the_wsdl_caps_are_all_read(fiveunearnedIncome, threeinquiryData). -
a_screened_answer_without_the_row_terminates_the_active_fact,no_gateway_record_terminates_nothing, anda_replayed_outcome_writes_no_second_termination. -
a_member_without_the_identifier_refuses_the_cohort,an_ssn_change_no_longer_bumps_the_cohortandending_the_identifier_bumps_the_cohort.
Concurrency. an_identifier_ended_before_the_send_makes_the_member_stale, and
an_end_racing_the_outcome_leaves_facts_or_a_stale_member: an END and the outcome transaction joined; one of the
two legal results holds.
Security. only_exchange_may_release_the_identifier, the_inquiry_leaves_no_canary_in_any_sink, and the
release’s audit events through craig-security’s parser.
End to end. tests/e2e/specs/cases-ssa.spec.ts records identifiers, not SSNs, and gains the missing-identifier leg.
Delivery
-
ADRs: ADR-066 gains an amendment (Gateway as counterparty and source, the wire, the mapping, termination by absence, the unchanged witness); ADR-065 gains one (the identifier release replaces the SSN release).
-
Docs, each in the step that changes its surface:
data-model-cases.adoc,data-model-exchange.adoc, the regeneratedapi/craig-cases.adocandapi/craig-exchange.adoc,operations/ssa-screening-ops.adoc,operations/ssa-digest-rotation.adoc(its screening part goes),configuration-reference.adoc(the setting) and the event catalogue inadrs/adr-003-rabbitmq-topology.adoc. The interface page stays the contract. -
CHANGELOG entry: one
changelog.d/<issue>.<slug>.<type>.adocfragment per step, folded intoCHANGELOG.adocat release. Steps 4 and 5 are breaking wire and schema changes and carry operations notes. -
Close: step 6 closes the plan’s issue and archives the page.
Erratum (2026-11-27): settings.toml’s keys are documented in `multi-jurisdiction-extensibility.adoc § settings.toml, not configuration-reference.adoc; the setting’s doc goes there.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic (Vertex) |
|
FLAGS on the second question. D2 named an audit key
the tree lacks: the release wrapper emits |
2 |
Google (Vertex) |
|
CLEAN on all four questions; the maintainer then approved the plan for implementation. |