Plan: One SHINES CpsRequest for the Portal Form and the P28 Call-Intake Form

Archive record

Merge requests: Aravinth Manivannan’s !1901 (#2333 with the JSON Schema, and #2351), approved as-is on 2026-10-21 and re-landed with integration fixes as the close-out !1974 (Closes #2333, #2351)

2026-10-22 — after a contextless round 1 (no-ship, folded 2026-10-13). What landed: four craig-reference enums with placeholder SHINES codes, under the boot fidelity gate (D1, D7); the reporter_demographics / triage / notification / screening blocks and safety_concern_description, each block refused on every channel with a 403 field-permission-denied until staff authorization (#2617) (D2); per-person designation / employer / is_dfcs_staff / military_stationed_at and a child’s apt / is_in_foster_care / foster_care_provider_name, the foster-care 422 required-field-missing (D3, D4); the narrative "Additional information" answers (D5); every new value matched as sent (#2545); the reporterInfo / triageInfo / notificationInfo / additionalInfo / screeningInfo wire and one adultInfo[] list (D6, #2351), with a JSON Schema the mapper tests hold to its keys. Follow-ups stay open: #692, #693, #1714, #1770 (the P28 form rebase); #2617 (staff authorization for the staff-only blocks).

Status

Done (2026-10-22) — !1974

Erratum (2026-10-13): the adults ride one adultInfo[] list (#2351) — where this plan names motherInfo, fatherInfo or otherHouseholdInfo[], read adultInfo[]; shines_household_role is removed.

Erratum (2026-10-13): ChildEntry.is_in_foster_care ships as Option<bool> (wire Y / N / empty), not D3’s plain bool — a fourth plain bool on the child entry would need a struct_excessive_bools lint override, and "not asked" (the portal form) is distinct from "no". D5’s caps on the new narrative fields are declared on NarrativeView but, like every existing narrative cap, not enforced at the edge (nothing validates the view); the five answers are bounded by their token check. The four D2 blocks are accepted only on the signed channel (a 422 naming the block elsewhere): they are staff-recorded, and screening.entering_into_shines steers a downstream bot, so an unauthenticated caller must not be able to set them.

Erratum (2026-10-22): re-landed as !1974 with integration fixes — on every channel a block is a 403 field-permission-denied until staff authorization (#2617), not a 422; the foster-care refusal is a 422 required-field-missing; reporter_demographics.ssn is an SsnIdentifier; every new list value and token is matched as sent (#2545).

Anchors

Issue #2333 (epic &89); builds on SHINES Mandated-Reporter Portal Parity (epic &100, units U1–U9); ADR-042; #692 / #693 (authoritative SHINES RefVals and wire keys — everything new here is a placeholder until they land); #1714 (Principal / Collateral lists — already `ShinesCodeTable`s); #1770 (P28 over the S3 delivery).

Context

Two branches grew the SHINES CpsRequest (services/craig-intake/src/backend/shines/mapper.rs) apart:

  • The portal-parity stack (the base of this branch) matches the DHS public "CPS - Mandated Reporter Form": SHINES pick-list values for demographics and relationships, a timed intakeDate, a child address, attachment rules.

  • feature/p28-partner-intake (epic &89, unmerged, predates the stack) adds the fields of the DHS call-intake form that agents fill while on the phone: reporter demographics, triage, county notification, screening gates, "Additional information", and per-person employer / designation / foster care. It reads keys the stack has since removed (reporter_relation, is_other_member, foster_care_address) and CRAIG-enum crosswalks the stack deleted.

DFCS’s Craig_P28_Form_Differences.docx lists 26 call-intake items missing from CRAIG; the stack covers the 7 that overlap with the public portal. This plan closes the other 19 in the contract — the request body, its validation, the mapper and the SDKs. After it merges, the P28 branch is rebased onto it and keeps only its form, route and specs.

Scope

In

ExtraFields, the per-entry child / adult views, the SHINES narrative view, SHINES-profile validation, relevance, the CpsRequest mapper, the boot fidelity gate, craig-reference enums and crosswalks, the three SDKs, the cross-language fixture, CHANGELOG.adoc and interfaces/shines-cps-intake-proposed-api.adoc.

Out

Any form UI. The mandated-reporter form (report.html) mirrors the public portal, which has none of these fields; the call-taker UI is p28.html on the P28 branch. The default (cases) profile is unchanged: it tolerates the new per-entry keys and maps nothing. Server-side enforcement of the screening gates (they end the call in the form; D2).

Design

All new keys follow the stack’s rules (portal-parity D3): accepted only under BackendProfile::Shines, pick-list fields hold SHINES list values checked in backend/shines/entry_rules.rs, blank counts as absent, errors never echo input.

D1 — reference enums (craig-reference)

Four new enums in enums.rs, each with a validate_* function in validation.rs; two existing enums are reused. All six get a placeholder SHINES crosswalk in shines.rs (fn x_to_shines_code(X) → &'static str, #692):

Enum Wire tokens Placeholder SHINES code

PersonDesignation (new)

principal, collateral

Principal, Collateral

TriageResponseTime (new)

imm_24, five_day, sor_so

IMM/24, 5 DAY, SOR/SO

NotificationMethod (new)

phone, email

Phone, Email

MandatedReporterDisclosure (new)

accepted, declined

Accepted, Declined

YesNoUnknown (existing)

yes, no, unknown

Y, N, U

YesNo (existing)

yes, no

Y, N

The first three are ported from the P28 branch. P28’s TriStateAnswer duplicates YesNoUnknown and its SafetyConcernAnswer has no consumer (safety_concerns is a free core string that already maps to emergencyInfo); neither is ported. YesNoUnknown / YesNo need no new validator: callers use the generic validate_enum.

D2 — ExtraFields (backend/shines/extra.rs)

Five new top-level keys (21 → 26), added to SHINES_EXTRA_KEYS and sdks/test-vectors/extra-fields.json. The four blocks are structs with #[serde(default, deny_unknown_fields)], so a misspelled nested key is a 400, not lost data.

Key Shape (every leaf optional; a string unless marked)

reporter_demographics

date_of_birth (ISO date, CODE_MAX), dob_approximate (bool), ssn (CODE_MAX), shines_race, shines_ethnicity, shines_marital_status, shines_language (SHINES list labels, CODE_MAX, as on an adult), employer (NAME_MAX), additional_contact_name (NAME_MAX), additional_contact_phone (PHONE_MAX), is_dfcs_county_staff (bool), county_met_response_time (bool). No gender: the existing reporter_gender key carries it.

triage

triage_needed (bool), triage_response_time (TriageResponseTime token, ENUM_STRING_MAX).

notification

county_contact_name (NAME_MAX), county_notified (SHINES "County" label, NAME_MAX), notification_datetime (DateTime<Utc>, RFC 3339), notification_notes (DESCRIPTION_MAX), notification_method (NotificationMethod token, ENUM_STRING_MAX), county_contact_assigned (a name, NAME_MAX), cis_justification, supervisor_justification (DESCRIPTION_MAX).

screening

entering_into_shines, is_abuse_neglect_report, victim_is_minor, previously_reported_this, caller_is_law_enforcement, immediate_assistance_needed (all bool), mandated_reporter_disclosure (MandatedReporterDisclosure token, ENUM_STRING_MAX).

safety_concern_description

Free text, DESCRIPTION_MAX.

Block bools are Option<bool> (unanswered is distinct from "no"). No new cap constant. The Rust SDK mirror carries the same caps. sanitize_extra_fields sanitizes every string leaf of the blocks except ssn (the mapper digit-extracts it; a raw SSN is never normalized).

The screening answers are captured, not enforced: the form ends the call on a disqualifying answer, and an API caller that sends victim_is_minor: false is recorded as having said so.

D3 — per-entry keys (api/validation.rs)

Entry New keys

AdultEntry

designation (PersonDesignation token, ENUM_STRING_MAX), employer (NAME_MAX), is_dfcs_staff, military_stationed_at (SHORT_TEXT_MAX)

ChildEntry

designation, apt (CODE_MAX), is_in_foster_care, foster_care_provider_name (NAME_MAX)

is_dfcs_staff is a plain #[serde(default)] bool, as shines_household_member: absent is false, and the wire value is always Y or N. is_in_foster_care is Option<bool> (see the erratum).

Household membership stays shines_household_member (portal-parity U6); P28’s is_household_member entry key is not added. Report-level is_in_foster_care / foster_care_name (portal-parity U8) stay as they are: the portal asks once per report, the call form once per child, and SHINES receives whichever was answered.

D4 — SHINES-profile rules (entry_rules.rs)

  • validate_shines_extra additionally checks: the four shines_* demographics and county_notified against their ShinesCodeTable; triage_response_time, notification_method, mandated_reporter_disclosure against their enums; reporter_demographics.date_of_birth as an ISO date. Field paths are dotted (triage.triage_response_time).

  • validate_shines_adult / validate_shines_child check designation against PersonDesignation.

  • Relationship list. rel_to_primary_caretaker is drawn from the Principal list when the entry’s designation is principal, the Collateral list when it is collateral, and — when no designation is given — by shines_household_member as today. The call form has both a Household Member checkbox and a Principal / Collateral radio, and the radio picks the list.

  • Foster care. A child with is_in_foster_care and a blank foster_care_provider_name is a 422 at children[i].foster_care_provider_name (the twin of the child-address rule).

  • Narrative. A new validate_shines_narrative, called from prepare_submission under Shines, parses the body’s narrative object as NarrativeView and checks the D5 answers: previous_truancy, digital_payment_platforms, has_recent_photos are YesNoUnknown; can_email_photos, child_fatality_or_serious_injury are YesNo. A narrative that does not parse is a 400 here (today it is a 500 in the sink).

  • Relevance. One new SHINES row: triage_response_time is relevant when triage_needed is true, and required then. FieldId::TriageNeeded / TriageResponseTime resolve from the nested block; their schema names stay flat (triage_needed, triage_response_time), and the FieldId doc comment says so.

D5 — narrative (backend/shines/narrative.rs)

NarrativeView gains previous_truancy, previous_truancy_description, digital_payment_platforms, digital_payment_details, has_recent_photos, can_email_photos, child_fatality_or_serious_injury — all optional strings: the five answers ENUM_STRING_MAX, the two free-text ones NARRATIVE_MAX. The narrative object is already forwarded and sanitized as a whole; only the typed view grows.

D6 — CpsRequest mapping (mapper.rs)

Convention (as the stack): a string key is always present and empty when unanswered; a numeric *Id key is omitted when unanswered; a bool maps to Y / N / empty; an enum maps to its D1 code.

Where Keys added

reporterInfo

dob, dobApproximate, ssn, raceId, ethnicityId, maritalStatusId, langId, employer, additionalContactName, additionalContactNumber, isDfcsCountyStaff, countyMetResponseTime. One reporter object — P28’s separate reporterDemographics block is not carried over.

top level

safetyConcernDescription (beside emergencyInfo); the blocks triageInfo (triageNeeded, triageResponseTime), notificationInfo (countyContactName, countyNotified, notificationDateTime, notificationNotes, notificationMethod, countyContactAssigned, cisJustification, supervisorJustification), additionalInfo (previousTruancy, previousTruancyDescription, digitalPaymentPlatforms, digitalPaymentDetails, hasRecentPhotos, canEmailPhotos, childFatalityOrSeriousInjury) and screeningInfo (enteringIntoShines, isAbuseNeglectReport, victimIsMinor, previouslyReportedThis, callerIsLawEnforcement, immediateAssistanceNeeded, mandatedReporterDisclosure). All four blocks are always emitted.

motherInfo, fatherInfo, otherHouseholdInfo[]

designation, employer, isDfcsStaff, stationedAt

chindInfo[]

designation, isInFosterCare, fosterCareProviderName; address now includes apt after street (compose_address takes a slice of parts instead of a 4-array)

notificationDateTime is RFC 3339 UTC to the second, as intakeDate. TOP_LEVEL_KEYS gains the five top-level keys; the pinned mapped_request_hash is re-blessed. screeningInfo exists because the "entering this into SHINES" answer decides whether a downstream bot enters the intake — P28 captured it and never forwarded it.

D7 — fidelity gate (fidelity.rs)

verify_crosswalk_totality adds one ensure_nonsentinel call per D1 enum, so an empty placeholder code refuses boot.

D8 — SDK parity

  • Rust (crates/craig-intake-sdk/src/types/): the four block structs and the new key in extra.rs; the D3 keys on Child / Adult and the D5 keys on Narrative in dto.rs (previous_truancy is already there — only its doc changes); re-exports in mod.rs; the pinned key count.

  • Python (sdks/python/src/craig_intake/builder.py) and TypeScript (sdks/typescript/src/builder.ts): the five keys in each SHINES key list; their tests' key counts; both SDK changelogs.

  • sdks/test-vectors/extra-fields.json: 26 keys, with a populated value for each new one.

Verification

  • Unit: each D4 rule (accept, refuse, blank-is-absent), nested unknown key refused, sanitization incl. the ssn carve-out, the relevance row, the D6 keys and blocks (populated and empty), the re-blessed hash, TOP_LEVEL_KEYS, the fidelity gate, enum round-trips, the fixture parity tests. The mapper proptest’s arb_adult / arb_child generators gain the D3 keys.

  • Devstack API: in tests/api/signed_submit.rs, a signed submission carrying every new block stores a CpsRequest with the D6 keys, and each D4 rule refuses a signed submission; in tests/api/intake_schema.rs, the public channel refuses a call-intake block.

  • cargo xtask validate --skip-devstack --skip-docker, cargo xtask sdk-test, cargo xtask plan-lint.

Follow-through — the P28 rebase

After the MR for #2333 is open, feature/p28-partner-intake is rebased onto this branch. Its contract commits (reference enums, ExtraFields, mapper, relevance, SDK keys, sanitization) are dropped in favour of this one; its form (p28.html, p28-form.js), route, CSS and Playwright specs are kept and adapted to send the D2 / D3 keys and to expect the D6 wire.

Review log

Round Vendor Resolved model Verdict

1

Anthropic

claude-opus-5-5

no-ship — Q1: nav entry under Planned while In progress; Q2: D1 added two enums that already exist (YesNoUnknown, YesNo), D2 / D5 gave no per-field length caps. All folded (2026-10-13), with the plain-bool, compose_address, count-pin and proptest notes.

Edit this page · latest