Plan: SHINES profile delivers CpsRequest via S3 object drop

Archive record

Merge requests: !1751 (re-land of !1576: three cherry-picks + fixes; Closes #1610, #1611, #1612, #1687)

2026-09-29 (GA SHINES ingests by S3 bucket drop — ShinesSink writes, under {prefix}/{client_request_id}/, craig_receipt.json first (server receipt time + the conformed digest), signed-path attachments/{sha256}, then cps_request.json last via craig_store::store_blob_create; dateReported / intakeDate / submitted_at are the server receipt time and a replay answers the original; same id + different substance is the typed 409 IDEMPOTENCY_CONFLICT before any attachment; CRAIG_STOREBACKEND=local refused under shines; the honeypot echoes the client id under shines; pre-1.0 breaking — CRAIG_INTAKESHINES_URL + the SHINES mock removed, the edge needs CRAIG_STORE* + optional CRAIG_INTAKES3_KEY_PREFIX; tracking reference is the reporter’s own client_request_id. ADR-042 § "Amendment 2026-08-31". Open: #691 BOTS schema + key-layout sign-off, #1613 object-store-degradation e2e, #2094 SDK client-id minting, #2109 honeypot submitted_at tell, #2110 form recovery from a SHINES IDEMPOTENCY_CONFLICT.)

Status

Done (2026-09-29) — !1751

Erratum (2026-09-29): this plan was written on the original branch after implementation, and the first draft derived submitted_at and a date key segment from the client-minted id. The re-land (feat/1610-shines-s3-delivery, three cherry-picks plus fixes) corrects the Design to as-built: server receipt time persisted in craig_receipt.json, a date-free key, the typed 409, the Local refusal, the honeypot echo under Shines (#1687).

Epic: &85
Issues: #1610, #1611, #1612, #1687
Branch: feat/1610-shines-s3-delivery

Context

craig-intake is a stateless edge (ADR-017). Under BackendProfile::Shines (ADR-042) a standalone edge conforms each validated submission to Georgia’s legacy SHINES CpsRequest schema (backend/shines/mapper.rs) and — before this plan — POSTed it synchronously to {shines_url}/cps-requests. SHINES has no such API; that target was a mock (the shines module of craig-mock-server).

The real GA SHINES ingestion path is an S3 bucket drop. This plan makes the SHINES profile write the conformed CpsRequest (and, on the signed path, its attachments) to an S3-compatible object store via the existing craig-store crate, and removes the HTTP POST path, the shines_url setting, and the SHINES mock route.

This is a pre-1.0 breaking change to the SHINES profile’s deployment config and is recorded as an ADR-042 amendment (no new ADR). The object store is the durable record — the same "synchronous, durability-confirming, no local buffering" posture ADR-042 already specifies, with a different transport.

Scope

In scope:

  • Rewrite ShinesSink internals: reqwest POST → craig_store::Store object write. parse_views + mapper::map are unchanged.

  • Object layout: craig_receipt.json (first) + one cps_request.json (last) per submission + content-addressed attachment blobs on the signed path; convergent no-overwrite via craig_store::store_blob_create.

  • Config: remove shines_url (field + helper + validate() requirement); add CRAIG_INTAKES3_KEY_PREFIX. Bucket / endpoint / credentials load from the existing CRAIG_STORE* env.

  • Boot: boot_standalone_shines loads the object store, keeps the crosswalk fidelity gate, and adds check_store_fidelity (key-prefix escape guard
    Local-backend refusal).

  • Honeypot: under Shines the public honeypot echoes the client_request_id, as the real accept does.

  • Remove the SHINES mock (the shines module of craig-mock-server) + its mount + the /shines/_control/fault toggle; mark the proposed-API interface page superseded.

  • Devstack: craig-intake-standalone-shines (+ -tls) drop CRAIG_INTAKE__SHINES_URL / the mock-server dep edge and gain the garage_credentials anchor + garage / garage-init deps.

  • Test migration: the ShinesSink delivery tests, the signed-submit integration assertions (mock capture → Garage read-back), and the SHINES e2e upstream-fault scenario.

Out of scope:

  • A configurable HTTP-vs-S3 toggle — S3 is now the only SHINES delivery.

  • Object read-back / a status API — get_report_status stays 503, route unmounted (ADR-042 §D7, unchanged).

  • Bucket lifecycle / retention / TTL / server-side encryption — operator-owned (see Risks, PII at rest).

  • The None (cases) and integrated paths — untouched.

  • Any change to the mapper, ExtraFields, NarrativeView, the RefVal crosswalk, the signed-JWS verification, or the keyring sidecar.

Design

ShinesSink — services/craig-intake/src/backend/shines/sink.rs

pub(crate) struct ShinesSink {
    store: craig_store::Store,   // Clone
    key_prefix: String,          // boot-validated
}

forward() parses the typed views (500 on an internal parse failure), then:

  1. dir = {prefix}/{client_request_id} — built ONLY from the boot-validated prefix and the UUID. No date, no request field.

  2. Read {dir}/craig_receipt.json. Present: conform at its submitted_at. Absent: stamp the server clock, conform at it, and create the receipt ({submitted_at, cps_sha256}); a lost create race adopts the winner’s receipt and re-conforms at its time. A mapping failure is the 422 and writes nothing.

  3. The conformed digest differs from the receipt’s cps_sha256 → 409 IDEMPOTENCY_CONFLICT, before any attachment write.

  4. Write each edge-verified attachment to {dir}/attachments/{sha256}, THEN {dir}/cps_request.json LAST, declared against the receipt’s digest.

  5. Return AcceptedReport { id: TrackingReference(client_request_id), submitted_at: receipt.submitted_at }.

put_object wraps craig_store::store_blob_create: Created / Converged → Ok; OccupiedKeyForeignBlob → the typed 409; Store(e) → opaque 500 via From<StoreError>; the remaining variants → opaque 500. Garage (no If-None-Match) leaves a residual last-writer-wins window for two simultaneous different submissions under one id (ADR-042 amendment, "Concurrency").

Object layout

{prefix}/{client_request_id}/craig_receipt.json      (written first)
{prefix}/{client_request_id}/attachments/{sha256}    (signed path only)
{prefix}/{client_request_id}/cps_request.json        (written last)

The CpsRequest.supportingDocuments manifest already carries {fileName, fileType, sha256} per file, so a consumer resolves each attachments/{sha256} from the manifest. {prefix} = CRAIG_INTAKE__S3_KEY_PREFIX, default cps-requests.

Config — services/craig-intake/src/config.rs

  • Remove shines_url (field, shines_url() helper, the (Standalone, Shines) validate() requirement, the hand-written Debug field, the test fixtures). keyring_url is still required.

  • Add #[serde(default = "default_s3_key_prefix")] pub s3_key_prefix: String (default cps-requests).

Boot — services/craig-intake/src/main.rs + backend/shines/fidelity.rs

boot_standalone_shines loads craig_store::ObjectStoreConfig::load() (which already refuses a missing backend), runs check_boot_fidelity()
check_store_fidelity(&backend, &s3_key_prefix), then Store::from_config(&store_config) and ShinesSink::new(store, settings.s3_key_prefix.clone()). build_router is unchanged (the Signed wiring, mount_status: false, the keygen-under-Shines gate are all as-is).

check_store_fidelity fails the boot (via anyhow) on a prefix that is empty, whitespace-padded, absolute, or has a . / .. / empty path segment / backslash / NUL; it refuses StoreBackend::Local.

Steps

Step 1: ShinesSink HTTP → S3 + config + boot + mock removal + devstack

Files: services/craig-intake/src/backend/shines/{sink,fidelity,mod}.rs, services/craig-intake/src/{config,main,router_tests}.rs, services/craig-intake/Cargo.toml, tools/craig-mock-server/src/{lib,shines}.rs, docker-compose.yml, CHANGELOG.adoc.

Rewrite the sink struct + delivery half + helpers; migrate the ShinesSink unit tests to a tempdir Local Store (writes CpsRequest object, idempotent retry, attachments as siblings, zero-byte attachment, typed 409 before attachments, receipt replay, lost-claim, partial-failure retry, store-fault → redacted 500, key not request-derived, never-logs-attachment-bytes; the mapper-422 + debug-capture + get_report_status 503 tests are kept). Delete the SHINES mock; rewire the two devstack SHINES services to Garage.

Step 2: integration + e2e test migration

Files: services/craig-intake/tests/api/signed_submit.rs, tests/e2e/specs/intake-embedded-ui-shines.spec.ts, docker-compose.yml (craig-e2e env), xtask/src/docker.rs.

The signed-submit integration tests already asserted only "a tracking reference is returned" (they never read the mock’s captured body), so the migration strengthens rather than rewrites them: a craig_test_lib::garage_test_store() read-back of {prefix}/{client_request_id}/cps_request.json asserts the mapped CpsRequest shape, plus a new signed_submit_is_idempotent_on_the_object_key. The three SHINES e2e specs assert the tracking reference equals the submitted client_request_id; the /shines/_control/fault upstream-fault scenario is removed (no upstream) with an object-store-degradation e2e tracked as a follow-up (#1613). CRAIG_SHINES_MOCK_URL is removed from compose + xtask.

Step 3: docs

Files: docs/modules/ROOT/pages/adrs/adr-042-standalone-intake-backend-plugin.adoc, docs/modules/ROOT/pages/interfaces/shines-cps-intake-proposed-api.adoc, docs/modules/ROOT/pages/intake-standalone-architecture.adoc, docs/modules/ROOT/pages/configuration-reference.adoc, docs/modules/ROOT/pages/local-dev.adoc, CHANGELOG.adoc, this plan.

ADR-042 amendment (S3 delivery + strip-surface update); "Superseded" banner on the proposed-API interface page; architecture flow diagram + ShinesSink bullet; configuration-reference S3_KEY_PREFIX row; local-dev service row; CHANGELOG Changed + Removed.

Verification

  1. cargo nextest run -p craig-intake --bin craig-intake — the backend::shines + config unit suites (tempdir-store, no devstack).

  2. cargo nextest run -p craig-mock-server — passes with shines.rs gone.

  3. cargo clippy --workspace --all-targets — -D warnings, cargo fmt --check, cargo xtask quality-budgets.

  4. cargo xtask dev reload — craig-intake-standalone-shines boots healthy with garage / garage-init / craig-intake-keyring deps and no mock-server edge.

  5. cargo nextest run -p craig-intake --test api — signed_submit reads the cps_request.json back from Garage with the asserted CpsRequest fields; route_profile_visibility unchanged.

  6. Boot-failure: unset CRAIG_STOREBACKEND for the shines container → refuses; CRAIG_STOREBACKEND=local → check_store_fidelity refuses; s3_key_prefix=".." → check_store_fidelity refuses; Shines
    MODE=integrated → validate() refuses (unchanged); no KEYRING_URL → refuses.

  7. The battery’s e2e projects intake-ui-shines and intake-ui-shines-tls — the form and the signed paths submit against the S3-backed edge and the confirmation shows the submitted client_request_id.

Documentation Updates

Risks / open items

  1. PII at rest. The CpsRequest object carries third-party / minor SSNs, addresses, DOBs — plaintext JSON in the bucket. Inherent to the feature; the ADR amendment + architecture page state that bucket encryption / ACLs / retention are operator responsibilities. No app-layer envelope encryption in scope. Operator requirements: 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; a bucket dedicated to the drop; bucket default encryption (SSE-S3, or SSE-KMS with kms:GenerateDataKey + kms:Decrypt on the key), never a policy denying a PutObject that lacks an SSE header (craig-store sends none).

  2. Removing the mock breaks the SHINES upstream-fault e2e. Replaced with a happy-path tracking-reference assertion; an object-store-degradation e2e is #1613.

  3. BOTS has not confirmed the object schema or key layout (#691). The mock was equally unconfirmed; S3 is strictly closer to the real path. The drop also carries CRAIG’s craig_receipt.json beside cps_request.json; BOTS ingestion is to key on cps_request.json only.

  4. Garage concurrency residual. Garage ignores If-None-Match, so two simultaneous DIFFERENT submissions under one id can end last-writer-wins, and two simultaneous identical first attempts converge on the bytes but may answer different submitted_at values; sequential identical retries converge. Documented in the ADR amendment.

  5. Sticky claim. A store fault between the receipt and cps_request.json leaves the id claimed for that content: an identical retry converges, an edited resubmission is a 409, and today the form cannot recover from it without a reload (#2110).

  6. Honeypot submitted_at. Under Shines the honeypot echoes the client id, but its submitted_at is the edge’s current time on every attempt where a real replay answers the original — a pre-existing tell (#2109).

Review log

Round Vendor Resolved model Verdict

1

Anthropic — fresh post-implementation review of !1576 (posted on the MR)

Claude Opus 5.5

no-ship — folded on re-land: server receipt time + date-free key, the false client-id-version claim (#1687), typed 409 before attachments, Local refused, least-privilege / dedicated-bucket / SSE guidance, the e2e id oracles, the tautological idempotency read, the partial-failure test, the plan’s status table

Edit this page · latest