ADR-042: Modular Per-Backend Plugin for Standalone Intake (SHINES Alignment)

Status

Accepted (2026-06-23). Resolves the design question raised while scoping the standalone mandatory-reporting portal + SHINES integration. This ADR fixes the architecture; the code lands as separately-weighted follow-ups (see Implementation scope).

Related: ADR-017 (stateless intake — the edge this layers onto), ADR-018 (partner signer keys + detached JWS — the verification this extends into standalone mode), ADR-036 (state-bundle build-time-TOML / no-toml-leak pattern — borrowed, not consumed), ADR-037 (field ownership — contrasted: worker-role read/write authz, not reporter-driven capture relevance).

Context

craig-intake is a stateless edge (ADR-017): validate + forward, no service-side DB / MQ / AuthzEngine. It serves two channels that share ONE intake DTO and ONE validation path:

  • a human web form (services/craig-intake/static/report.html, served only in standalone mode), and

  • a 3rd-party API (POST /partner/v1/reports), JWS-signed (ADR-018), for external systems submitting the same report.

Both deserialize craig_intake_contracts::SubmitReportRequest and run the same validation::prepare_submission (services/craig-intake/src/api/validation.rs). It runs in two modes: integrated (forwards to CRAIG’s own craig-cases) and standalone (forwards to an external backend). Today the forwarder is a single concrete CasesForwarderSink hardcoded to craig-cases (services/craig-intake/src/sink/cases_forwarder.rs) — there is no backend abstraction, and standalone mode still points at craig-cases.

The new requirement, and its precise boundary

The standalone portal must be deployable in front of SHINES (Georgia’s legacy monolithic CCWIS) as the durable store. Four constraints define the shape of the solution:

  1. Conform to SHINES, today. While connected, SHINES is the system of record, so every SHINES-required field must be faithfully sourced — not best-effort with nulls.

  2. Never bind the core. The conformance applies only to standalone intake when connected to a legacy backend. craig-intake’s generic DTO + validation + the integrated/native path stay jurisdiction-neutral — this is just CRAIG’s existing state-neutral platform invariant (the whole point of the Multi-Jurisdiction Foundation, Plans T-Y) applied to intake. No future jurisdiction inherits SHINES’s shape.

  3. Disposable by construction. When CRAIG replaces SHINES, the SHINES-specific fields, crosswalk, mapper, and rules must strip cleanly — a bounded, enumerable edit, not an open-ended untangling (the true strip surface is enumerated in the 2026-08-07 amendment; the original "zero residue" phrasing overstated it).

  4. Modular fields with declared relationships. Fields must be easy to add/remove, and the design must declare relationships between them — conditional visibility / enablement and required-if rules (e.g. a "badge number" field is relevant only when the reporter is law-enforcement; greyed-out/absent otherwise). This relationship logic must stay consistent across the human form (UI behavior), the 3rd-party API, and server-side validation — a field hidden-as-irrelevant must not be required server-side, and an irrelevant field arriving via the API is handled identically. (CRAIG has already been bitten by form/server divergence: #639, #650.)

Transport + data realities (settled while scoping)

  • SHINES has no intake API today and is monolithic; the API is net-new on the SHINES side. CRAIG defines a reasonable target contract and builds against a mock (extending the existing craig-mock-server, which already emulates SHINES systems), documenting the contract as a proposed SHINES intake API spec.

  • Synchronous, durability-confirming. The sink POSTs and blocks on SHINES’s committed-write confirmation; the returned SHINES record ID becomes the reporter’s tracking code. Because the edge is stateless, that round-trip is the only durability receipt — no optimistic acks, no local buffering (a SHINES outage surfaces to the submitter; absorbing outages is the deferred #215 local-outbox, out of scope here).

  • RefVals crosswalk is net-new. SHINES keys race/marital-status/language off numeric IDs and sex off M/F; CRAIG uses string enums. The authoritative SHINES RefVals code tables are not yet available, so the crosswalk ships as a swappable placeholder with "load authoritative RefVals before go-live" tracked as a blocking data dependency.

  • Signing is a 3rd-party→CRAIG concern only. SHINES has no signature capability; CRAIG→SHINES is a plain authenticated JSON POST. Browser-side keypair generation + detached-JWS verification already exist (ADR-018; services/craig-web/static/js/craig-sign.js) — but JWS is verified today only in integrated mode (forwarded to craig-cases for verification + replay dedup via cases' seen_jti table). A SHINES-connected standalone edge has no downstream verifier and no DB.

  • No partner tenancy in standalone-SHINES. There are no 3rd-party "partners": anyone may submit via the API provided the detached JWS verifies against a kid present (and active) in a known-key registry. The public form path is unchanged (anonymous, CAPTCHA, IP-rate-limited).

  • The only state lives in a sidecar. Since the edge is stateless (ADR-017) yet the registered public keys and the JWS replay-dedup records ARE state, a minimal companion service craig-intake-keyring owns them — exposing the same HTTP contracts craig-security and craig-cases already expose, so intake’s existing SignerAuthClient / JwsReplayClient point at the sidecar (no new client; JWS verified in standalone as in integrated). Its store is an unencrypted flat JSON file: it holds only public keys (keygen is client-side; private keys never leave the browser) + replay records — all publishable, so encryption would be obscurity, not security (Kerckhoffs).

Decision

Adopt a per-backend "backend profile" layered onto standalone mode — the seam, not a framework. This is "Approach A" from the design panel, refined with a typed sidecar.

  1. A narrow IntakeSink trait. Extract a trait over the submission path (forward + get_report_status); CasesForwarderSink becomes one impl and a new ShinesSink the other. The cases-specific partner-edge BOLA methods (get_report_owner_partner / verify_partner_owns_report) stay on the concrete cases type — they encode craig-cases ownership semantics and are not part of the backend abstraction. The trait references NO SHINES type: forward takes a ForwardRequest carrying the typed body + the raw submitted Value, and ShinesSink parses its SHINES views from the raw Value internally — so deleting backend/shines/ leaves the generic seam compiling. It returns a backend-agnostic TrackingReference (a String newtype — SHINES record IDs are legacy NUMBER`s, not UUIDs); the cases backend wraps its UUID. This propagates to the public `ReportConfirmation/ReportStatus and the three SDKs in lockstep (pre-1.0 CHANGELOG Changed).

  2. Typed carriers, never the Value bag. Genuinely-new top-level SHINES inputs (the caretaker block, foster-care/military/prior-report flags, the nine question* narrative fields) live in typed views — a ExtraFields sidecar (which travels as sibling top-level JSON keys; SubmitReportRequest serde-ignores them and gains ZERO new top-level scalars) and an extended NarrativeView. Per-person SHINES fields (SSN, child grade/isVictim, adult dob/address/contact, the mother/father designation) extend the EXISTING typed ChildEntry/AdultEntry views — not a parallel struct. This honours "no serde_json::Value in business logic" and makes the strip-boundary explicit. The report contract is four encodings that move in lockstep: the server views, the Rust SDK (craig-intake-sdk), the Python SDK, and the TypeScript SDK (the #639/#650 drift surface).

  3. A single declared field-relevance rule table + ONE pure evaluator. Relationships are data: { field, relevant_when: Predicate(over already-captured scalars), required_when_relevant: bool }. The same table drives all three surfaces — the human form (served at a standalone-only schema endpoint, an Alpine driver computing show/hide/required, replacing today’s hand-coded x-if strings), server-side prepare_submission, and the 3rd-party API path (an irrelevant field is dropped, a required-when-relevant field that is blank is rejected). A shared typed Predicate grammar (serialized to JSON for the client, matched in Rust on the server) makes UI/server drift structurally impossible — generalizing the existing hand-written is_active_duty → military_branch conditional.

  4. A typed RefVals crosswalk built on the existing craig-reference::afcars enum→numeric-code precedent (gender_to_afcars(Gender) → u8 and siblings), behind a trait so the placeholder GA map swaps for the authoritative table without touching the mapper.

  5. A typed mapper CRAIG → SHINES CPS_Request, reusing the crosswalk for numeric RefVal IDs.

  6. A boot-time fidelity gate. Because the SHINES dictionary carries no required/optional annotations, the required-field set is encoded in a typed Rust manifest the compiler checks; boot_standalone fails fast if any SHINES-required field lacks a declared source or any crosswalk enum lacks a mapping — mirroring CRAIG’s pervasive boot tripwires (ADR-034/036/037). Fidelity fails closed.

  7. A key-registry sidecar + signature-only auth for the SHINES-connected build. The craig-intake-keyring sidecar (above) owns the known-key registry + the replay-dedup store and re-exposes the craig-security signer-key + craig-cases replay-check contracts, so intake’s existing clients verify JWS in standalone exactly as integrated — keeping the edge stateless. Because there is no partner tenancy, the standalone signed-API path is a distinct handler (signature-verified against the registry, no partner-id binding) with the full reporter-type set; it cannot reuse the partner handler (which binds partner_id and accepts only the public reporter subset). The cases-bound status/attachment routes are not mounted under Shines (SHINES has no status-read contract; the tracking reference is a durable receipt).

Everything backend-specific lives under services/craig-intake/src/backend/shines/, selected by a BackendProfile enum resolved only in boot_standalone. The core DTO’s semantics, the shared validation pipeline’s behavior, and the integrated/native path are unchanged for non-SHINES deployments. Stripping SHINES = flip BackendProfile::Shines → None, delete backend/shines/, and remove the bounded set of profile-gated extension points threaded through the core — the per-person Option sidecar fields DO live on the shared ChildEntry/AdultEntry views (Decision item 2 above is the accurate statement; the original summary’s "never merged into it" contradicted it). The 2026-08-07 amendment enumerates the full strip surface.

Promotion to a generic trait IntakeBackend + manifest + registry is deferred until a second backend (e.g. SACWIS) is real; the shape above is deliberately trait-ready so that promotion is a mechanical refactor, not a rewrite.

Alternatives considered

A design + judge panel (four independent approaches, three independent judges scoring fidelity / modularity / craig-fit / cost / risk) evaluated the space. All three judges and all four approaches' own self-critiques converged that a plugin framework is not justified at one backend.

A. Minimal per-backend profile + typed sidecar (CHOSEN)

Builds only the non-speculative parts (sink trait, typed views, one rule table + evaluator, typed crosswalk, typed mapper, boot gate, the keyring sidecar + signature auth). Full fidelity by compile-time typing; cleanest possible strip; jurisdiction-neutral core preserved; trait-ready for backend #2.

B. Purpose-built IntakeBackendPlugin framework (rejected)

A first-class plugin contract (trait + TOML manifest + build-time codegen) any backend implements. Rejected as premature: it pays framework cost (extra crates, codegen) for exactly one backend, replacing speculative reuse with speculative generality. Its own author conceded the honest minimum is "the seam, not the framework." Adopt B’s shape mechanically when a second backend earns it.

C. Express SHINES as an instance of the Plan T-Y substrate (rejected as primary)

Reuse the composition engine (Plan W/X), field-authz (Plan Y), and the state bundle (Plan U). Rejected: a read-side/write-side category error — Plan W/X compose UI panels/case-sections by role and have no per-field inter-field conditional-visibility representation; Plan Y is worker-role read/write authz on stored rows via a zen-engine AuthzEngine that the stateless edge does not (and per ADR-017 should not) boot; and the craig-state-bundle crate drags craig-exchange-contracts/-transport/-partner-audit into a deliberately lean edge. The craig-exchange SHINES StandardAdapter is pub(crate) + transport-bound inside a stateful service and is not reachable from the edge. What genuinely transfers is patterns (build-time-TOML/no-toml-leak, additive-contribution + fail-fast-on-conflict, env-driven activation) and the afcars crosswalk precedent — which the chosen approach borrows. Borrowing a pattern is not instancing a framework.

D. Runtime-loaded data-only backend descriptor (rejected — unanimous last)

The backend "plugin" as a runtime-loaded descriptor (field schema + rules + crosswalk + mapping) interpreted by a generic engine; add/strip a backend = add/remove a file, no recompile. Rejected: it forfeits the compile-time fidelity guarantee the system-of-record constraint demands (ADR-036 deliberately chose build-time codegen for exactly this reason), then must re-erect it with separately-maintained, lapse-prone lint + fixture gates; it reintroduces serde_json::Value business logic the conventions push against (a mini language + interpreter to validate); and it would import a runtime rule engine (zen) into an edge that today has zero such dependency. Maximum ops-time flexibility bought at the cost of the one guarantee that cannot lapse.

Consequences

Positive

  • Fidelity by construction. A missing SHINES-required field or an unmapped crosswalk enum fails the build or boot, not silently a partial CPS_Request.

  • Clean, bounded strip. SHINES-only logic concentrates under src/backend/shines/ and the typed sidecar, with a small enumerable set of profile-gated extension points in core modules (2026-08-07 amendment); removing SHINES is a directory delete + an enum flip + those bounded edits. The disposability requirement is structural, not aspirational — but it is a multi-file edit, not a one-directory delete.

  • Jurisdiction-neutral core preserved in behavior. SHINES fields ride the shared ChildEntry/AdultEntry views as Option sidecar extensions and profile-gated arms — absent/inert for every non-SHINES deployment; no SHINES RULE changes shared validation semantics for other backends.

  • Fixes a known bug class. The single declared rule table consumed by both UI and server removes the form/server-divergence failure mode (#639, #650) by construction.

  • No premature framework. N=1 stays small; the trait-ready shape makes backend #2 a mechanical promotion.

Negative / residual risk

  • Per-backend work is a code change behind a build, not a config edit. Adding/stripping a backend or a field recompiles. For a stateless public edge with include_str! assets, a strict CSP, and no config-reload story, paying a recompile to buy guaranteed fidelity is the deliberate trade (vs. Approach D).

  • The shared Predicate grammar must stay small (equality / presence / boolean over already-captured scalars). Rich cross-field arithmetic would push toward a real rule engine — explicitly out of scope; a future need is a separate, tracked decision.

  • A new sidecar service to operate (craig-intake-keyring) for the SHINES-connected build. This is the deliberate cost of keeping the edge stateless: the only state (public-key registry + replay dedup) is isolated in one tiny flat-file service rather than smeared into the edge. Replay dedup is keyed by jti (the unchanged replay client carries no kid; jti is a per-submission UUID, so cross-holder collision is negligible).

  • The SHINES API and RefVals are mocked/placeholder until the real contract and code tables arrive — both tracked as blocking go-live dependencies, not silent gaps.

Neutral

  • Pre-1.0, no production data: the work is additive and mock-first; no migration/backfill.

  • No change to ADR-017’s stateless posture for integrated mode, to ADR-018’s signer-key contract, or to ADR-020’s encryption semantics.

Implementation scope (follow-up issues, not this ADR)

This ADR is the decision; the code lands as separately-weighted follow-ups, sequenced in the plan (Standalone Intake Backend Plugin) and tracked under its epic. The sink-trait extraction lands first (pure refactor, de-risks); the typed views + crosswalk + mapper + boot gate + rule engine + the craig-intake-keyring sidecar + signature auth + the SHINES mock + e2e follow. Implemented under epic &58 (MR1–MR10, #681–#690); the SHINES API contract, RefVals, and required-field set remain external go-live dependencies (#691–#693).

  • ADR-017 — the stateless edge this layers onto; the BackendProfile selector lives only in boot_standalone.

  • ADR-018 — partner signer keys + detached JWS; this ADR re-exposes that signer-key + replay-check contract from the craig-intake-keyring sidecar so the stateless edge verifies JWS in standalone-SHINES (no partner tenancy).

  • ADR-036 — the build-time-TOML/no-toml-leak typing discipline this borrows (pattern, not crate).

  • ADR-037 — field ownership; contrasted (worker-role authz, not reporter-driven capture relevance).

Amendments

Amendment 2026-10-13 — one adultInfo[] list, no mother / father slots (#2351)

The CpsRequest no longer sorts adults into singular motherInfo / fatherInfo slots plus otherHouseholdInfo[]. Every adult is one entry of adultInfo[], in submission order, with the same keys (the household answer is isHouseholdMember; isOtherMember is gone). The per-adult shines_household_role answer, the ShinesHouseholdRole enum, the one-per-slot rule and the required-parent manifest are removed with the slots.

Why: DFCS’s call scripts — the P28 call-intake form and the Information & Referral script — keep one repeating adult list described by Primary Caregiver, Household Member, Principal / Collateral and Relationship to Primary Caregiver; none asks for a mother or a father. The call-intake form therefore never sent the role, so its adults all landed in otherHouseholdInfo[] while the portal form filled the parent slots: two shapes for the same people. An adult’s role is its relToPrimaryCaretaker code. The object shape remains CRAIG’s proposal, unconfirmed by BOTS (#691).

Known cost: the SHINES mandated-reporter portal itself has a "Parent’s Information" tab with one Mother and one Father section and a separate "Member Information" tab, which is where the retired slots came from. Whatever enters a stored request into that portal must now choose the mother and the father from adultInfo[] itself; CRAIG no longer captures that choice.

Earlier amendments below that name shines_household_role, ShinesHouseholdRole, PersonInfo or OtherHouseholdInfo describe the tree as it was on their date.

Amendment 2026-09-29 — SHINES code tables and mandated-portal parity (#2097, epic &100)

DFCS listed 27 gaps between the GA DHS mandated-reporter portal and the standalone-SHINES form, with the portal’s pick-lists as a CSV (plan shines-portal-parity). Standalone SHINES is phase 1 of the rollout in which CRAIG replaces SHINES, so the SHINES profile adopts the portal’s value sets rather than crosswalking CRAIG’s. Decided:

  1. Placement. The pick-lists are craig_reference::shines_codes — beside the shines crosswalks, not in craig-state-ga: the SHINES backend compiles in every craig-intake build while state-ga is an optional feature, and the Rust SDK depends on craig-reference only. They are committed const tables, not a build-time parse; a parity test pins each to its column of the verbatim CSV (crates/craig-reference/data/shines/field-dropdowns.csv).

  2. Wire rule (SHINES profile). A coded list (the three relationship lists) sends its 2-letter code; a label-only list sends the exact label. An existing ingress key that is an untyped string or bool with no CRAIG vocabulary is reused and table-validated under the SHINES profile; a key bound to a CRAIG / AFCARS vocabulary (sex, race, ethnicity, language, marital_status) gets a flat shines_-prefixed sibling (the shines_household_role convention), and under the SHINES profile the CRAIG-typed key is refused, never silently dropped. The default (cases) profile is unchanged.

  3. Value sets vs relevance. Relevance rules govern whether a field is present / required; which values a present field may take (e.g. the Principal vs Collateral relationship list, switched by the household-member flag) is validation, enforced server-side.

  4. i18n. Code-table labels are SHINES reference text, untranslated in every locale (rendered with lang="en"); field labels and help text are Fluent keys as usual.

  5. Crosswalk retirement. When the per-person SHINES fields land (plan U5), race_to_shines_id, RACE_ID_OTHER_OR_UNKNOWN, marital_status_to_shines_id, language_to_shines_id and sex_to_shines_code retire with the race lossy-fidelity entry (single-select race is lossless). Numeric ids stay placeholders — code_table_placeholder_id (1-based list position) and gender_to_shines_code’s `U — under #692.

Amendment 2026-10-19 — typed sanitized text (#2524)

Amends §D3 (the typed carriers). Intake free text was a String cleaned in place by a hand-kept list of fields (api/validation.rs sanitize_text and its callers), so a field the list did not name went through unsanitized, and the cleaned value was ammonia’s HTML serialization (& stored as &), not text. As built:

  • Sanitized by type, at deserialization. Every free-text field of SubmitReportRequest, ExtraFields and NarrativeView is craig_intake_contracts::SanitizedText. Its only producers, SanitizedText::parse and the Deserialize impl that calls it, run the one sanitizer: markup stripped (ammonia, no tags allowed), control characters (tab and line feed kept) and the bidi format controls U+202A..U+202E / U+2066..U+2069 stripped, NFC, at most TEXT_MAX_CHARS chars. The garde caps measure the sanitized value. The string leaves of the per-person entries and the narrative, which no typed view carries, are walked by validation::sanitize_forwarded_freetext_in_place, whose leaf is SanitizedText::parse. Since #1755 the walk reaches every depth (the race answers, a nested or non-object narrative) and skips only an entry’s own ssn (and, since #2545, its closed-vocabulary and format keys), and the signed manifest’s fileName / fileType (SupportingDocument) are SanitizedText too.

  • Constrained leaves are checked raw (#2545). reporter_type, report_source, concern_type, mandated_reporter_category, reporter_relationship_to_child, reporter_relationship_to_caregiver and reporter_maltreater_relationship are plain String kept as sent, and the walk skips each entry type’s vocabulary and format keys (validation::CHILD_RAW_KEYS, validation::ADULT_RAW_KEYS), so validate_reporter_type, validate_report_source, validate_concern_type, validate_optional_enum, the typed shines_household_role and, for a child’s date_of_birth, validate_optional_iso_date (only ASCII digits and hyphens, then a calendar date) check the value exactly: one wrapped in markup, carrying a control character or padded is a value-free 400 (as built, #2524 sanitized <b>mandated</b> into an accepted mandated). A blank value, empty or only ASCII whitespace (validation::is_blank), is still not provided. When the jurisdiction resolves to a state, validation::resolve_admin_unit matches the raw submitted admin_unit (validation::WireTopLevel), NFC-normalized as before (a decomposed Doña Ana still matches), against the state’s table, case-insensitively, and forwards the table’s canonical name: this reverses SAD-11’s (#750) post-sanitize order for state mode only. A tribal or territory admin_unit has no table and stays sanitized free text. reporter_state and reporter_county take the same dual shape (#2098): under the SHINES profile entry_rules::validate_shines_extra matches each raw submitted value (validation::WireTopLevel) exactly against its SHINES State / County list, so markup, a control character or padding is a value-free 400; under every other profile they stay sanitized free text. The per-person SHINES pick-list keys take it too (#2101): under the SHINES profile the walk also skips entry_rules::SHINES_CHILD_LIST_KEYS / entry_rules::SHINES_ADULT_LIST_KEYS, which entry_rules::validate_shines_child / entry_rules::validate_shines_adult match exactly against their lists (the 400 names the entry path, children[0].state); under every other profile they are walked free text. The signed manifest’s fileType takes it too (#2105): under the SHINES profile entry_rules::validate_shines_extra matches each raw submitted supporting_documents[].fileType (validation::WireTopLevel) against the accepted attachment types (attachments::check_declared_file_types), so markup or a control character around .pdf is the generic 400 attachment-content-unaccepted, never sanitized into an accepted type. The #2333 call-intake values take it too: a person’s designation joins both list-key sets; under the SHINES profile the walk keeps a narrative object’s five answers (entry_rules::SHINES_NARRATIVE_TOKEN_KEYS) raw for entry_rules::validate_shines_narrative; the nested blocks' list labels, tokens and date of birth are plain String, matched exactly by entry_rules::validate_shines_extra and blank only when ASCII whitespace (entry_rules::is_blank); and the reporter’s ssn is an SsnIdentifier, as on a person entry.

  • Plain text, escaped at output. The stored and forwarded value is plain text, never entity-encoded: Smith & Jones stays Smith & Jones in cases raw_submission and in the SHINES CpsRequest. Consumers escape at their own output: Askama in craig-web and craig-portal; SHINES receives raw text (recorded on #691).

  • Bounded. A raw value over RAW_MAX_BYTES (32 KiB: four bytes per capped char) is refused before any pass (UnsanitizableText::TooLong). The sanitizer runs at most eight passes, so markup that surfaces one layer per pass eight deep — nested RAWTEXT / RCDATA wrappers (<xmp>, <textarea>, <plaintext>, …) or a tag split around stray < — is refused (UnsanitizableText::TooDeep); text holding no < never is (a leading U+FEFF run is dropped in one pass). Either refusal is a 400 whose detail carries the variant’s message, never the input.

  • The per-person ssn is an identifier on every profile. api::ssn::SsnIdentifier admits blank, or digits with optional spaces / hyphens, and keeps the submitted string as is (J4). Any other shape, a JSON number included, is a 400 naming the entry and ssn, never the value; on the None profile it was forwarded unchecked. Since #2546 only ASCII whitespace may surround it (is_admissible_ssn trims char::is_ascii_whitespace): a value padded with U+00A0, U+3000 or other Unicode whitespace is that 400, where str::trim had admitted it.

  • The SHINES narrative must be an object. Under the Shines profile validation::require_shines_narrative_shape decodes narrative at the edge with backend::shines::narrative::decode: a non-object, or a wrong-typed question, is a 400 naming narrative (it was a 500 from the sink, and an array narrative was mapped positionally, unsanitized). ShinesSink re-decodes the walked raw value with the same decoder, so the IntakeSink seam still names no SHINES type; that re-decode’s error arm is unreachable from the wire.

  • Stored file names are typed. Every service’s uploaded file name is craig_store::StoredFileName, whose only producer StoredFileName::parse strips path separators, every control character (C0, DEL, C1) and the bidi format controls, trims whitespace and dots, and caps the name at 255 bytes. It replaces craig_store::sanitize_filename, named by the 2026-06-28 (B4) and 2026-07-01 amendments; the signed manifest’s fileName is validated by it too.

Rows stored before #2524 are not rewritten (pre-1.0; devstacks reseed). This does not change the ADR-042 decision (the profile seam, the backend-agnostic IntakeSink trait, the everything-under-backend/shines/ rule).

Amendment 2026-09-10 — reporterInfo.reportSource placeholder RefVal (#648 MR-A)

The NCANDS #10 report source became a REQUIRED intake fact on every channel (ADR-040 § Amendment — #648 part 2). The standalone SHINES path keeps nothing, so the mapped CpsRequest.reporterInfo gains reportSource, crosswalked by craig_reference::shines::report_source_to_shines_source(ReportSource) — a PLACEHOLDER RefVal in the exact shape of reporter_type_to_shines_rep_type (total, unique, pinned; each value is the codebook label, e.g. "Education Personnel"). Like every other crosswalk here it is a #692 go-live dependency: the authoritative SHINES RefVals replace the placeholders before go-live, without touching the mapper. repType stays; the source is additional; TOP_LEVEL_KEYS is unchanged (reporterInfo was already pinned) and fidelity::verify_crosswalk_totality covers the new crosswalk.

Amendment 2026-06-28 — SHINES adult-field forwarding decisions (#743)

Epic &61 Step 5 (#743) closed a family of SHINES adult-field defects surfaced by the 2026-06-28 craig-intake coverage audit. Two of the fixes are forwarding-contract decisions — what the SHINES profile collects versus what it forwards — recorded here as the as-built.

A1. maltreater_relationship_to_victim — collected under SHINES, NOT forwarded to the CpsRequest wire

When an adult is flagged is_alleged_maltreater, validate_adult_entry requires maltreater_relationship_to_victim (profile-agnostically). The SHINES public form now renders that selector (revealed by the checkbox) and SHINES_ADULT_KEYS carries it, so the alleged-maltreater path is satisfiable under SHINES — previously it was an unsatisfiable 400 (no field existed to provide the required value).

The value is not mapped onto the SHINES CpsRequest: PersonInfo/OtherHouseholdInfo (mapper.rs) carry only is_alleged_maltreator with no relationship target, and adding one to the SHINES wire is gated on the authoritative SHINES contract (#691, a go-live dependency; RefVals are the separate #692). So the field reaches cases/audit (the captured submission) but not the SHINES forward, until #691 adds a wire field. The asymmetry is deliberate: form completeness + server validation are satisfied without inventing an unauthoritative wire field.

A2. relationship_to_child — no longer collected under SHINES

The per-adult relationship_to_child has no SHINES target — SHINES models the household via rel_to_primary_caretaker, and AdultEntry carries no relationship_to_child field — so a SHINES payload that included it was silently dropped by serde before mapping (entered data lost). It is now gated out of the SHINES form and removed from SHINES_ADULT_KEYS; it remains collected + forwarded under None/cases (persisted in raw_submission). 750’s forthcoming [serde(deny_unknown_fields)] will make any future such drop loud rather than silent.

superseded in part by the 2026-06-28 (#750) amendment below — AdultEntry now carries a relationship_to_child field (modeled so the None/cases body it sends is not 400’d once unknown keys are denied). The SHINES behavior is unchanged: it is still not sent under the SHINES profile (not in SHINES_ADULT_KEYS), so there is no SHINES silent drop.

Amendment 2026-06-28 — input-integrity hardening (#750)

Epic &61 Step 4 (#750) closed the input-integrity gaps from the same coverage audit. Three decisions are forwarding/validation-contract as-built.

B1. Unknown-field rejection is per-entry serde deny PLUS a top-level key-set diff — never a blanket deny

The submission body is multi-owner: the core SubmitReportRequest fields plus, under the SHINES profile, the 14 SHINES-only ExtraFields keys (§D3), which travel as additional top-level keys in the same body. A blanket [serde(deny_unknown_fields)] on the core contract would therefore 400 every valid SHINES submission (and every SDK body using the [serde(flatten)] extra shape). Two mechanisms instead:

  • Per-entry: #[serde(deny_unknown_fields)] on the typed AdultEntry/ChildEntry views, so a misspelled per-person key (lost data on an abuse report) is a loud 400 via the existing per-entry from_value.

  • Top-level: an explicit key-set diff in prepare_submission (all three channels). The allowlist is the core key set — derived from serde_json::to_value(body) (the contract has no skip_serializing_if, so the derived set is complete and cannot drift) — unioned, only under the SHINES profile, with SHINES_EXTRA_KEYS. The core crate stays SHINES-agnostic: SHINES_EXTRA_KEYS lives in backend/shines/extra.rs (the "strip cleanly" guarantee) and a drift test pins it to the struct + the cross-language fixture. A #[serde(flatten)] catch-all was rejected: utoipa renders it as additionalProperties: true, advertising the opposite of the intent in the published OpenAPI.

This supersedes the pre-1.0 behavior where a None/cases submission silently tolerated SHINES-shaped top-level keys (the SHINES union is gated to the Shines profile). Under None a SHINES key is now an unknown field → 400: a None deployment has no SHINES backend and never parses those keys, so accepting-and-dropping them was the same silent data-loss this hardening removes (no fig leaf; pre-1.0, so no compat carve-out). SHINES keys are accepted only under the Shines profile, where they are actually parsed.

B2. AdultEntry/ChildEntry widened to the full None-form + SDK key set

To make the per-entry deny safe, every key the public form and the SDK send is now modeled: AdultEntry gains relationship_to_child (supersedes A2’s "no such field" note — captured under None/cases, still not sent under SHINES), phone, email, county, is_primary_caregiver, dob_approximate; ChildEntry gains dob_approximate and age. age is capture-only: the SHINES chindInfo[] mapper has no age slot (DOB is canonical), so it is forwarded raw, never mapped; it is range-validated (0..=21). The form’s x-model.number age input clears to JSON null (→ None), so a blank age is "not provided", not a 400.

B3. admin_unit allowlist is jurisdiction-parameterized, enforced on every channel

When the deployment’s configured jurisdiction (settings.jurisdiction) resolves to a US state/territory with an AdminUnit table, the routing admin_unit is allowlist-validated against that jurisdiction on all three submit channels (public, partner, signed — no partner exemption). For a tribal/territory key that resolves to no table the allowlist is skipped and only the NAME_MAX cap bounds the value (Plan-S neutrality — the allowlist never defaults to a single state). reporter_county is deliberately not allowlisted: a reporter may live out-of-jurisdiction. The resolved jurisdiction is layered as a ConfiguredJurisdiction extension on each submit nest.

B4. The keyring validates the registered JWK at registration (MR-2)

craig-intake-keyring’s `POST /keys/register (§D8) now structurally validates public_key_jwk as a P-256 public key (p256::PublicKey::from_jwk_str) before persisting. ES256 is the only signer algorithm, so a P-256 parse is the exact check — it mirrors craig-intake api/jws.rs. A structurally-invalid key previously reached the flat-file store and surfaced only as a verifier failure at lookup; it is now a fixed 400 at registration (the rejected key material is never echoed). A proptest proves arbitrary JWK JSON never panics. The sibling craig-security register is tracked for the same parity hardening as a follow-up. The other MR-2 fixes — char-based concern_description min-length, loud (map_err) forward serialization on the public + partner paths, craig_store::sanitize_filename on attachment uploads, and the kiosk "Submit Another" no-residue invariant — are intake-internal hardening recorded in the CHANGELOG, not contract changes.

Amendment 2026-07-01 — SHINES signed-path attachments via a signed hash manifest (epic &65)

The standalone-SHINES signed path (§D9) previously dropped attachments — the CpsRequest had no documents field and no attachment route was mounted under the SHINES profile, so a mandated reporter could not send the supporting documents the legacy SHINES portal accepts. Epic &65 (#940–#946) added attachment support to the signed/mandated path. The decision + as-built:

  • Signed hash manifest, not signed transport. The reporter’s browser SHA-256-hashes each file, adds a supporting_documents manifest ([{fileName, fileType, sha256}]) to the report JSON, and the existing detached JWS covers that manifest. Documents are therefore tamper-evident without signing the upload transport. Sha256Hex is a construction-validated newtype in the backend-agnostic craig-validation crate, so the IntakeSink seam and the SHINES SupportingDocument share one type without the trait referencing a backend type.

  • Edge-authoritative verification (§D9). craig-intake content-negotiates the signed submit: JSON-only (SDK clients) or one multipart/form-data request (a report part = the exact signed JSON + one file part per attachment). It verifies the JWS over the RAW report bytes (the canonical-JSON signing contract is UNCHANGED — the raw bytes are never reparsed/reserialized before verifying), recomputes each delivered file’s SHA-256, and matches the delivered set against the signed manifest by multiset (extra / missing / swapped file → 400, ATTACHMENT_MANIFEST_MISMATCH). Like every ExtraFields free-text leaf, fileName / fileType are SanitizedText, sanitized when the manifest deserializes, so the mapper copies plain text into CpsRequest.supportingDocuments (#1755; until then the raw signed values were forwarded), and a signed fileName that is no valid craig_store::StoredFileName (a pure-markup name sanitizes to empty) is refused (400). Verification is atomic: any failure rejects with ZERO forwards to SHINES. Errors name no filename or hash (no content oracle); filenames/hashes/bytes are never logged.

  • Sink → SHINES is no longer JSON-only (§D7). When ≥1 attachment is verified, ShinesSink::forward POSTs one multipart/form-data body — a request part (the CpsRequest JSON, now carrying supportingDocuments) + one file part each — sharing the same redaction + accepted-status handling as the JSON arm; the JSON-only POST is unchanged for the no-attachment case. Exactly one POST either way (no retry loop). See the proposed SHINES API.

  • Caps. MAX_ATTACHMENTS (compile-time, 5) bounds the manifest; CRAIG_INTAKESIGNED_MAX_FILE_BYTES (10 MiB default) is the per-file cap enforced while buffering each part; CRAIG_INTAKESIGNED_BODY_LIMIT (30 MiB default) is the whole-request cap layered as an inner DefaultBodyLimit on the /signed nest, overriding the global body_limit for those routes.

  • Debug output. Under the existing EXPOSE_SSN_PII ack flag the signed response is a Serialize-only superset (never in the OpenAPI/SDK contract) carrying the conformed CpsRequest + the edge-recomputed hashes + the signed manifest, served Cache-Control: no-store, never logged, absent when the flag is off.

  • No new BOLA surface. Attachments ride the atomic signed submit; there is deliberately no follow-up GET/POST /{id}/attachments capability under SHINES (legacy record ids are guessable).

  • Clients. The browser report form (secure context) and all three SDKs (Python/TS/Rust) hash → manifest → sign → one multipart submit; a cross-language attachment-hash.json parity vector pins that every hasher agrees with the edge’s recompute.

Out of scope (unchanged): unsigned concerned-citizen SHINES attachments (no signature to anchor a manifest); the cases-backed attachment proxy (its own route); SHINES-side re-verification (permitted, not required).

Amendment 2026-08-07 — honest strip-surface enumeration (#999)

The original Decision summary and Consequences overstated disposability ("delete one directory", "zero residue", "no SHINES field …​ touches the shared validation") and contradicted Decision item 2, which correctly says the per-person SHINES fields extend the EXISTING typed ChildEntry/AdultEntry views. The layering is sound — Option sidecar fields and profile-gated arms, exactly the typed-sidecar approach chosen — but the strip is a bounded multi-file edit, and this amendment is its enumeration so the true surface stays discoverable (verified against the tree, 2026-08-07):

  • backend/shines/ — the directory delete, plus the Shines variant in backend/mod.rs.

  • api/validation.rs — the shines_household_role: Option<ShinesHouseholdRole> field on the shared AdultEntry view (with the SSN/dob/relationship sidecar fields) and the profile-gated ExtraFields/SHINES_EXTRA_KEYS allowlist extension.

  • config.rs — shines_url / keyring_url / debug_emit_cps_request fields, their validate() arms, and the unwrap helpers.

  • main.rs — SHINES boot dispatch, check_boot_fidelity(), ShinesSink::new, the signed-submit wiring.

  • relevance/mod.rs — shines_field_rules() + the profile-gated extend.

  • api/public.rs — the profile-gated ExtraFields parse
    merge_shines_extra().

  • api/partner.rs — the ExtraFields::default() construction.

  • api/mod.rs — the mounted backend::shines::signed_submit OpenAPI paths/components.

  • crates/craig-reference — the ShinesHouseholdRole enum (shared crate, outside craig-intake entirely).

A bare directory delete does not compile: use crate::backend::shines::… appears in six core modules. None of this changes the decision — the sidecar shape was chosen precisely so these touch-points are Option-inert for every non-SHINES deployment — only the prose claiming otherwise.

Amendment 2026-08-29 — keyring signing receipts (#732)

Maintainer-ruled: log-based signer evidence alone does not meet the intended non-repudiation bar for mandated-reporter signing. Every ACCEPTED signed submission appends a durable signing receipt to the new append-only signing_receipts table, co-located with the keys: signer_kid, payload_sha256 (SHA-256 hex of the canonical signed payload), jws (the detached compact exactly as presented), iat, received_at. Design points:

  • A SEPARATE table, deliberately not columns on replay_records: the dedup table is transport (retention-pruned, stale-recycled), receipts are EVIDENCE — they survive the prune, and a jti recycled past the retention window appends a SECOND receipt rather than overwriting the first (#980’s no-mutation-on-replay invariant, extended: a captured-jti resubmission with forged artifacts appends nothing). No purge tooling ships until DFCS names a records-retention schedule (the ADR-058 posture).

  • The receipt rides the existing replay-check call as a versioned optional wire extension — all three fields or none (partial = warn + plain dedup); the cases-backed integrated twin ignores the fields.

  • Re-verifiable evidence chain: given the original canonical payload (held by the submission’s owner, e.g. SHINES), the stored compact verifies against the REGISTERED public key, and the stored hash binds the receipt to that exact payload (pinned end-to-end by signed_submit_persists_a_reverifiable_signing_receipt). To keep the payload OUT of the keyring, intake now REFUSES attached JWS compacts (non-empty payload segment) — the contract is strictly detached.

  • The SHINES-side mapping of signer evidence into the submission stays gated on the #691 contract.

Amendment 2026-08-26 — Postgres-backed keyring for horizontal scale-out (epic &84)

§D8’s "the only state lives in a sidecar…​ its store is an unencrypted flat JSON file" assumed exactly one running craig-intake-keyring instance — concurrency safety came entirely from one in-process RwLock serializing every mutation before an atomic local-disk write (#980). A deployment need to run craig-intake-keyring as multiple horizontally-scaled instances breaks that assumption: state on one container’s local disk cannot be shared across replicas.

Two S3-based designs (reusing crates/craig-store, this project’s existing object-storage abstraction) were evaluated first and rejected:

  • Per-operation objects, no locks — fails the replay_check security property outright. Two instances can each observe "not yet seen" and both admit the same JWS jti during the reconciliation window; replay_check is the sole defense against a captured signed JWS being replayed into a mandated report a second time, so eventual consistency there is a live regression, not a cosmetic race.

  • Per-key S3 objects + conditional writes (If-None-Match/If-Match) for compare-and-swap, including a lock-file-in-bucket variant — crates/craig-store/tests/garage_put_create.rs already pins, against the real devstack Garage backend (v2.2.0), that Garage permanently ignores If-None-Match: * (a CRDT-architecture limitation confirmed upstream as design-level, not a transient bug). Any design that needs S3 conditional writes for mutual exclusion — a lock file’s "create only if absent" requirement is the identical primitive — is unverifiable in this project’s own devstack and would silently lose its safety property there while appearing to work against real AWS S3 in production. That is the opposite of this repo’s contested-environment testing posture (ADR-067): a security control whose correctness can only be asserted against one deployment target and never exercised in CI.

Decision: craig-intake-keyring gains a small Postgres database (craig_intake_keyring) and adopts the fleet’s standard ADR-063 migration-gate posture (same-image migrate subcommand, verify-only serve boot) instead of remaining the one service outside that discipline. Register/approve/revoke/lookup/replay-check become ordinary row transactions and constraints — the identical pattern craig-security’s own `partner_signer_keys table already uses for a near-identical signer-key registry shape; store.rs’s docstrings already said approve/revoke "mirrors craig-security’s status = 'pending'-gated update" structurally, this makes it literal. replay_check’s cross-instance atomicity comes from a single `INSERT …​ ON CONFLICT (jti) DO UPDATE …​ WHERE statement (Postgres row-level locking makes the first-seen-or-replay decision one atomic statement no matter how many instances race it) — see plans/archive/keyring-postgres-backend.adoc for the exact SQL and the full implementation plan.

This reverses §D8’s "no DB" minimalism in exchange for correctness that does not depend on a specific S3 backend’s undocumented behavior. The public-keys-only Kerckhoffs rationale (no encryption — the data is publishable) is unaffected and carries over unchanged to the Postgres store. Plan: plans/archive/keyring-postgres-backend.adoc.

Amendment 2026-08-31 — SHINES delivers via an S3 object drop (epic &85 / #1610)

§D7’s transport realities said the SHINES CpsRequest was POSTed to {shines_url}/cps-requests and that "SHINES has no intake API today — the target is a mock". Georgia’s real SHINES ingestion path is an S3 bucket drop, not an HTTP endpoint, so the mock had no real contract to stand in for. Corrected on re-land 2026-09-29 (#1687): the receipt-time, key-layout, conflict and concurrency bullets replace a first draft that derived the intake date and a date key segment from the client-minted id.

Decision: the Shines profile writes the conformed CpsRequest (and, on the signed path, its supporting-document blobs) to an S3-compatible object store through craig_store::store_blob_create — the digest-verified, read-back-prechecked, no-overwrite create. The synchronous, durability-confirming, no-local-buffering posture is unchanged; only the transport is. The object schema and key layout are CRAIG’s proposal and are not yet confirmed by BOTS (#691 tracks the sign-off). The drop also carries CRAIG’s craig_receipt.json beside cps_request.json, so BOTS ingestion is to key on cps_request.json only — part of the same sign-off.

  • Object layout. Per submission, under {prefix}/{client_request_id}/:

    • craig_receipt.json — written FIRST: CRAIG’s claim for the id, {"submitted_at": <RFC 3339>, "cps_sha256": <hex>}.

    • attachments/{sha256} — the signed path’s edge-verified files, content-addressed (the CpsRequest.supportingDocuments manifest carries {fileName, fileType, sha256}, so a consumer resolves them).

    • cps_request.json — written LAST: the completeness marker a consumer ingests.

    The key is built only from the boot-validated prefix and the UUID — no date and no request-body field — so a path-shaped source_system_id / admin_unit cannot escape it and every retry lands in the same directory. A partial-failure retry leaves at worst orphan attachment blobs, never a CpsRequest without its files.

  • Receipt time. dateReported / intakeDate (the UTC date) and the returned submitted_at are the server’s receipt time of the first accepted attempt — never derived from the client-minted client_request_id. ADR-062 fixes only that field’s type (Uuid), not a UUID version, and an intake date is a legally significant clock-start a client must not be able to set. The first attempt stamps the server clock, conforms the CpsRequest at it, and records both in craig_receipt.json; every later attempt under the same id reads the receipt and re-conforms at the ORIGINAL time, so a retry — even across UTC midnight — converges on byte-identical cps_request.json and answers the original submitted_at.

  • Conflicts. A later attempt whose conformed CpsRequest digest differs from the receipt’s cps_sha256 (same id, different substance) is refused with the ADR-062 typed 409 IDEMPOTENCY_CONFLICT, before any attachment is written into the original submission’s directory. The cps_request.json write declares the RECEIPT’s digest — store_blob_create’s claim-digest invariant. The claim is sticky: after a store fault between the receipt and the `cps_request.json write, an identical retry converges, while an edited resubmission under the same id is a 409. As-built (#2110): the public form recovers from that 409 — it keeps every field, mints a fresh client_request_id and tells the reporter the next submit sends the report as a new submission. As-built (#2278): the cases profile answers the same typed 409. craig-cases refuses a held received_request_id whose intent differs with ADR-062’s IDEMPOTENCY_CONFLICT, and intake relays that one problem type as its own fixed typed 409 (never the upstream text); every other upstream 409 stays the generic conflict. So the form’s recovery reaches both profiles.

  • Concurrency. Sequential identical retries converge on every backend. On a backend that honors If-None-Match: * (AWS S3, MinIO, R2, the Local test store) two simultaneous first attempts race on the receipt create; the loser adopts the winner’s receipt and converges, or 409s if its substance differs. Garage ignores If-None-Match, so a racer inside the read-back-to-put window can overwrite the receipt or cps_request.json: two simultaneous identical first attempts converge on the bytes but may answer different submitted_at values, and two simultaneous DIFFERENT submissions under one id can end last-writer-wins with two 200s. That needs a same-instant id reuse (the form guards double submit); it is an accepted residual, not a guarantee.

  • Tracking reference. There is no backend-assigned record id; the durable receipt returned to the reporter IS their own client_request_id. AcceptedReport / TrackingReference are unchanged (backend-agnostic strings). The public honeypot echoes the client id under the Shines profile too, so the returned id is not a tell. Its submitted_at is still the edge’s current time on every attempt, where a real replay answers the original — a pre-existing tell tracked as #2109. Correction (2026-11-08, #2109): the edge now memoises each trapped client_request_id’s first answer in a bounded per-process map (24 h, 10 000 entries), so a retry answers the same `submitted_at under either profile with no database. A time derived from the id was rejected: a forged v7 timestamp would come back on the first answer. Residual: a retry that reaches another replica, follows a restart or outlives its evicted entry answers a fresh time.

  • Config (pre-1.0 breaking). CRAIG_INTAKESHINES_URL is removed (field, shines_url() helper, validate() requirement). The SHINES edge needs CRAIG_STORE* (bucket / endpoint / region / credentials — craig_store::ObjectStoreConfig::load() refuses a missing backend) plus the optional CRAIG_INTAKE__S3_KEY_PREFIX (default cps-requests). keyring_url is still required.

  • Boot. boot_standalone_shines keeps check_boot_fidelity() (the crosswalk totality gate) and adds check_store_fidelity(&backend, &s3_key_prefix): it fails closed on a prefix that is empty / whitespace-padded / absolute / has a . / .. / empty path segment / backslash / NUL, and it refuses CRAIG_STORE__BACKEND=local — a local-disk drop would acknowledge reports SHINES never ingests. There is no opt-in: devstack runs Garage, and the sink unit tests build a tempdir store directly.

  • Operator requirements.

    • Least privilege: the edge credential needs s3:GetObject
      s3:PutObject on {bucket}/{prefix}/*, plus s3:ListBucket on the bucket conditioned on s3:prefix = {prefix}/*. Without List, S3 answers a missing key 403 instead of 404, and the receipt read and the read-back precheck depend on the 404. No s3:DeleteObject.

    • Dedicated bucket: the SHINES drop gets its own bucket, never the CRAIG core document bucket. Devstack shares craig-dev under the full-access dev key; that is dev-only.

    • Encryption at rest: configure bucket default encryption (SSE-S3, or SSE-KMS; with SSE-KMS also grant kms:GenerateDataKey + kms:Decrypt on the key, because the read-back GET decrypts). Do not use a policy that denies a PutObject lacking an SSE header: craig-store sends none.

    • PII at rest: the objects are plaintext JSON carrying reporter and third-party PII including SSNs; ACLs and retention are operator responsibilities (no app-layer envelope encryption; craig-retention is not wired into this path).

  • Removed with this change. tools/craig-mock-server/src/shines.rs (the /shines/cps-requests + /shines/_control/fault routes), the ShinesSink::new(http, url, token) HTTP call site, the multipart-forward helper, and the SHINES-mock e2e wiring (CRAIG_SHINES_MOCK_URL). The proposed-API interface page (SHINES CPS Intake — Proposed API) is superseded — its CpsRequest schema section is retained as the object shape.

Strip-surface update (supersedes the relevant rows of the 2026-08-07 enumeration): config.rs loses shines_url + shines_url() and gains s3_key_prefix + default_s3_key_prefix; main.rs’s SHINES boot dispatch loads the object store and calls `ShinesSink::new(store, prefix); backend/shines/sink.rs is an object-store writer, not an HTTP client; backend/shines/fidelity.rs gains check_store_fidelity; api/public.rs’s honeypot names the `Shines profile variant (removed with it). backend/shines/ still strips cleanly — the IntakeSink seam names no object-store type.

This does not change the ADR-042 decision (the profile seam, the backend-agnostic IntakeSink trait, the everything-under-backend/shines/ rule) — only the SHINES profile’s delivery transport. No new ADR. Plan: Plan: SHINES profile delivers CpsRequest via S3 object drop.

Edit this page · latest