Plan: Outbound Interface Trigger Parity — The OUTBOUND Ledger, Late-Bound Single-Record Sends, the CPRS Legs (&87)

Archive record

Merge requests: !1621 (U0 plan page + ADR-075, Closes #1826) + !1623 (U1, Closes #1827) + !1624 (U2a, Closes #1828) + !1625 (U2b, Closes #1835) + !1626 (U3, Closes #1829 / #243) + the close-out MR (U4, Closes #1830)

2026-09-13 — outbound partner sends became EVENT-DRIVEN for the CPRS INV/ONG interface: a jurisdiction declares its trigger matrix through StateBundle::outbound_triggers(), exchange validates every row against the live adapter registry at boot AND binds every declared event on its consumer queue (the two halves of ADR-032 §1.3), admits each occurrence inside the inbox attempt transaction under a partner-free identity, runs the per-interface consent chain (knob → exactly one active partner → an agreement owned, active and inside both dates → a Generic adapter; a refusal is a recorded held(<reason>) row, never a dropped event), resolves membership ONCE into the catalogue’s OUTBOUND ledger, assembles ONE record per job at dispatch under a whole-read budget (PII never at rest in exchange), pins bytes to a source_version with supersession on drift, decides a record’s closure framing at resolve, settles on the partner’s ACKNOWLEDGEMENT with categorical failures, and keeps per-stage FIFO. Three operator acts (catch-up, release, dismiss), server-owned provenance, stage-qualified leg tokens, three deliberate schema-floor bumps. Six interfaces (WIC, DOE-SLDS, IES, STARS, SMILE, TCM) stay blocked on facts CRAIG does not model yet (#1804–#1810); production delivery to CPRS waits on the protocol bridge (#1812) and outbound auth (#1813). The epic stays OPEN as the tracker of those bind issues.

Status

Done (2026-09-13) — !1626

Erratum (2026-09-13, U1 #1827): the release audit rides the EXISTING case.person_pii_exported key discriminated by purpose = outbound_principals (the third wrapper, per ADR-003’s multi-wrapper rule and the SSN-release precedent) — not a new case.outbound_principals_released key; the security parser needs no new arm. Decision 12’s route list gained the single-record arms for BOTH stage kinds and the report → open-investigations arm at round 1 (already on the page); the projection returns every member’s role verbatim and never pre-filters — the consumer’s admission rule (child roles under 18) is exchange’s (decision 6).

Erratum (2026-09-13, U2 #1828 / #1835): U2 shipped as the two MRs the unit table permits. U2a (#1828) carried the substrate and the CPRS ONG stage_opened leg; U2b (#1835) carries stage_closed, the catch-up and release / dismiss acts and the mock _capture surface. Three deviations, all in U2b. The catch-up act takes {interface, kind} and NOT decision 15’s since: the cases open-stages arm is an id cursor with no time filter, the walk is idempotent by the admission identity, and a parameter the projection cannot honour would be a lie. A closure resolve that finds a recipient absent from the stage’s current membership records removed_at and stages nothing — decision 6 does not cover the case, and CRAIG has no ONG household-removal event, so absence at closure is the only evidence there is. A record’s closure indicator is decided at RESOLVE and recorded on the job (exchange_send_jobs.record_closure), not derived from its leg and never re-read from the stage at assembly: an opening record and the closure that follows it are two sends the partner receives in that order, so reading the stage at dispatch would make both say closed. The same column is what makes decision 9’s "a stage_opened resolve of an already-closed case emits closed records directly" true without a second code path.

Erratum (2026-09-13, U3 #1829): the leg TOKEN is stage-qualified (ong_* / inv_*) rather than bare, because the pair (interface, leg) is what the ledger stores and what dispatch resolves a leg from — a bare stage_opened stopped identifying one leg the moment the INV stage existed. Decision 14’s INV principal_added / principal_removed key on the REPORT as written; what the page did not say is that a report is not a stage, so the resolve maps it to the referral’s open investigations and acts on each in its OWN transaction, and that the removal leg reads no principals projection (only the shared report → open-investigations id arm) — the subject rides the admission (subject_person_id), which is the only place a released held admission could still find it. The per-stage FIFO key of decision 9 is taken from the STAGE a record belongs to, not from the job that staged it, because a report-keyed occurrence spans stages. Decision 1’s dual-site boot check gained its missing half: the consumer binds every event the matrix declares, since a declared row nobody bound passes validation and then never fires.

Anchors

epic &87 (children #1826 U0, #1827 U1, #1828 U2, #1829 U3, #1830 U4; the six prerequisite-bound bind issues #1820 WIC, #1821 DOE-SLDS, #1822 IES, #1823 STARS, #1824 SMILE, #1825 TCM; #243 the CPRS anchor closed by U3; #244 closed as superseded), ADR-075 (Proposed at U0), ADR-032 (the adapter registry this extends; amended), ADR-062 (the inbox attempt machine every consumer uses), ADR-065 §D2 (the service-only allowlist-of-one precedent), ADR-063 §D3 (the schema floor the rollout leans on), ADR-067 (the two-path census), ADR-058 (retention classes); prerequisites #1804 (legal status / custody), #1805 (EMPI id), #1806 (GTID), #1807 (Initial Medicaid Application), #1808 (child-support referral decision
NCP), #1809 (SMILE acts), #1810 (TCM claims), #1811 (structured worker names), #1812 (CPRS protocol bridge), #1813 (outbound partner auth); fixes #1814, #1815; follow-ups #1816, #1817, #1818, #1819, #1836 (the db-error lint’s closure form), #1837 (the trigger act bounds + the catch-up lease conflict unasserted), #1838 (trigger DISPATCH legs in the contested census), #1839 (admit / removal TOCTOU + the INV resolve lane split); ⁂ readings on #1073 (CPRS stage identity).

Context

Outbound partner sends are staged MANUALLY today — POST /v1/exchange/send (services/craig-exchange/src/api/transactions.rs:159-254; callers: craig-cli exchange send, the test-lib; craig-web only LISTS transactions) — while the catalogued SHINES specs define trigger points SHINES fires automatically. The maintainer’s 2026-09-02 re-scope of #243 / #244: "event-driven legs assembled from cases/placement data via S2S, enabled per partner via exchange_partners + DSA, dispatched through the existing send-job outbox; the design questions are answered by the program plan". What the research established:

  • Every target adapter exists as typed wire code (crates/craig-partner-cprs/src/adapter.rs:62-91 — ONE CprsInvOngStageData per send; the ack CprsInvOngAck { transaction_id, person_id, return_code ∈ {0, 300, 301, 305} }). GA registers all eleven; the seven targets are DispatchClass::Generic. Absent: the TRIGGER, the PAYLOAD ASSEMBLY, and the per-recipient state the catalogue calls the OUTBOUND table.

  • The legacy CPRS protocol is a PULL over SOAP/XML against SHINES’s CPRS_CPS_INSERT_OUTBOUND staging table (CPRS INV/ONG lines 112, 553); the crate inverted it to a JSON push. The catalogue’s semantics are TABLE semantics: insert on admission, update on change, entry removed so no further updates are sent (156), closure indicator on stage close (170), continuation six months past 18 and after conversion to collateral (118–121), initial pre-population of open stages at release (567), and DT_LAST_UPDATE is NOT provided to CPRS (110).

  • The manual path is the reusable staging trio — claim_first → create_transaction + stage_send_job
    publish_exchange_send_requested in ONE tx (transactions.rs:208-236); the worker claim_pending (FOR UPDATE SKIP LOCKED, lease 90 s), MAX_ATTEMPTS = 6, backoff [5,5,30,120,300,900], send_value via the boot registry; settlement persists err.to_string() into last_error / error_message / exchange.failed{error} and logs it; any decoded 2xx is success; the worker’s own doc assumes identical retries (send_worker.rs:36-38). Retention never age-deletes live work.

  • The consumer shape is fixed: subscribe_idempotent (ADR-062, INBOX_MAX_RETRIES = 5) on craig-exchange.events; case.created / placement.created are debug stubs; case.assignment_changed (ICPC ownership) and case.screening_cohort_changed (the SSA watermark + run invalidation) have REAL handlers that must keep running. The mq-consumer census is BLOCKING.

  • Per-partner enablement precedent: the SSA worker’s chain (knob → exactly ONE active partner by adapter_kind → dsa_is_active → egress). dsa_is_active checks status + expiration ONLY — not dsa.partner_id == partner.id, not effective_date; the partner-update guard checks only that the agreement EXISTS; adapter_kind is mutable.

  • Facts available vs required (matrix below): CPRS needs case + principals (names, gender plaintext; DOB BlindIndex-encrypted; case_household; admin_unit → FIPS) — present; the Primary Case Manager’s NAMES are structured nowhere. WIC requires empi_id (none), DOE-SLDS gtid (none); IES, STARS, SMILE, TCM trigger on acts CRAIG does not model; four of them on "in DFCS custody", a fact that exists nowhere.

  • Events: case.created, case.closed, case.screening_cohort_changed (no person id, by design), case.intake_created, case.investigation_closed, case.report_person_linked / _unlinked, case.report_persons_auto_linked (the ASYNC link pass after conversion — investigation creation does not wait for it), case.person_updated (id-only). Household removal has no route.

  • PII posture: exchange_send_jobs.payload / exchange_transactions.request_payload are plaintext JSONB read by two API paths (the web UI lists transactions without them); error columns and exchange.failed echo upstream bodies. The cases-side service-only precedent is the SSN release — allowlist of ONE, the release AUDIT EVENT staged BEFORE responding (ADR-065 §D2 / H21). CasesClient acquires the bearer OUTSIDE its 5 s budget. The mock-server HOST buffers every request; the partner routers are stateless.

  • ADR-063 §D3: a migration that bumps schema_compat_floor makes an OLDER binary refuse to BOOT; it does not stop a running replica. __ is the settings nesting separator.

Decisions (recorded in ADR-075; ADR-032 amended)

  1. A trigger is registry data; the matrix is bundle-declared. craig-state-bundle gains OutboundTriggerSpec { event, interface, leg } and a defaulted StateBundle::outbound_triggers() (the uas_codes() shape; default empty). GA declares the CPRS rows; TX none — no jurisdiction == "georgia" literal in exchange. craig-exchange owns the LEGS (membership resolver + single-record assembler + ack classifier); triggers::Registry keyed by (event, interface, leg); boot validates dual-site (ADR-032 §1.3): every declared spec has a registered leg whose adapter kind is registered AND Generic; an unknown spec fails boot naming the row.

  2. ADDITIVE dispatch inside the same inbox transaction. Every existing arm stays; after it, triggers::admit(envelope, tx, ctx) runs for any event type with matrix rows; no rows → today’s no-op; the debug stubs go. Both effects commit or roll back together (each idempotent under retry); a regression test pins the cohort event bumping the SSA watermark AND writing the CPRS admission in one tx. Contested: anchor unchanged; the admission dispatcher gets its own two-path
    ordering triple (oracle = the two ledgers).

  3. Two ledgers, two identities. exchange_trigger_admissions — ONE row per trigger OCCURRENCE, partner-free: UNIQUE (interface, leg, entity_kind, entity_id, entity_revision TEXT), event_id (the envelope id), status ∈ {staged, held, resolved, dismissed}, held_reason, dismiss_reason, partner_id NULL, created_at, resolved_at; ON CONFLICT DO NOTHING inside the inbox attempt tx (redelivery absorbed by the inbox triple, re-emission by this index; the partner is RESOLUTION, not identity). Transitions: held --release-→ staged; staged --resolve tx-→ resolved (terminal); held --dismiss-→ dismissed (terminal); staged means a resolve job is pending. exchange_outbound_recipients — the catalogue’s OUTBOUND table per (interface, partner, stage, person): UNIQUE (interface, partner_id, stage_kind, stage_id, person_id), admitted_at, role, dob_year_month (the 18 y 6 m cut-off — no full DOB), removed_at, closed_sent_at, last_correlation_id, last_source_version, last_record_digest — ids, dates, digests only. Both are RECOVERABLE WORK: never age-pruned; held rows persist until released or dismissed; recipient rows are provenance (archive-then-prune later, #1819).

  4. Server-owned provenance. exchange_transactions.origin ∈ {manual, trigger} (DEFAULT manual) + admission_id FK; exchange_send_jobs.kind ∈ {payload, resolve, record} (DEFAULT payload) + admission_id, recipient_id, source_version, ordering_key; transaction_id relaxed to NULL with CHECK kind = 'resolve') = (transaction_id IS NULL (a resolve job has no transaction; its payload is the reference {admission_id}; record and payload jobs keep the FK + cascade). Only the worker’s admission path writes origin = trigger / kind ≠ payload; the late-bound branches key on kind, NEVER on exchange_type. send_exchange REFUSES an exchange_type matching a registered TriggerKind token (typed 400 EXCHANGE_TYPE_RESERVED); origin is not wire-settable.

  5. Consent = per-interface knob + the corrected chain, at admission AND re-bound at every dispatch. TriggerSettings { cprs: InterfaceTriggerSettings { enabled } } ⇒ CRAIG_EXCHANGETRIGGERSCPRS__ENABLED=true (default off; the settings test loads that exact string). Chain: knob → exactly one active partner by adapter_kind → dsa_admits(partner, today) — NEW in store/agreements: dsa.partner_id == partner.id AND effective_date ⇐ today AND (expiration_date IS NULL OR >= today) on the jurisdiction clock AND status = Active → dispatch class Generic. Every failure = held(<reason>) ∈ {knob-off, no-partner, partner-ambiguous, dsa-missing, dsa-inactive, dsa-not-yet-effective, dsa-expired, dsa-not-owned, not-generic}. At dispatch the job’s partner_id must still resolve to an active partner whose adapter_kind EQUALS the staged interface and whose DSA still admits — else terminal partner-changed. The SSA worker’s predicate is a pre-existing defect (#1814) and adopts dsa_admits on its own branch under that issue — not in U2.

  6. Two job kinds; membership resolves ONCE, in a worker transaction, never in the inbox tx. An admission stages ONE resolve job. Its dispatch (ONE bounded S2S read) resolves the CURRENT membership, then in ONE tx: per person admitted by the leg’s rule and absent from the recipient ledger → recipient row + ONE transaction (origin = trigger, exchange_type = "cprs.<leg>", initiated_by = "system", initiated_by_name = "trigger:cprs/<leg>", record_count = 1) + ONE record job (reference payload, source_version, ordering_key = "cprs:<stage_id>") + exchange.send_requested; admission → resolved. A crash-repeated resolve converges on the recipient UNIQUE; a child added between the open event and its delayed resolution is admitted ONCE. stage_closed resolves to EVERY non-removed recipient (no age filter) and stamps closed_sent_at; the admission rule (under 18 on the jurisdiction clock) applies only to NEW recipients; continuation (18 y 6 m, collaterals) rides the recipient row for the deferred principal_updated leg. An empty resolution completes resolved with zero transactions — recorded, nothing sent. The admission rule is age AND role: household members in the child roles (child, sibling) and report persons / allegation victims in the child roles (victim, never reporter or an adult role — the unit pins the exact tokens against craig_reference).

  7. One record per job; late-bound assembly; PII never rests in exchange. A record job: ONE bounded S2S read of the single person record (outer tokio::time::timeout(ASSEMBLY_BUDGET = 5 s) around bearer + GET + decode) → the typed CprsInvOngStageData with transaction_id = job.correlation_id (the CPRS wire idempotency field; the generic craig_correlation_id injection is dropped by every typed adapter — #1815) → send_value. Lease arithmetic: 5 s + one adapter send (≤ 30 s) + settlement ≪ 90 s. After settlement request_payload stores the reference
    source_version + SHA-256 of the transmitted bytes; the recipient row the digest + correlation. Early assembly is REJECTED: two API read paths render those columns.

  8. Immutable identity per attempt. The projection returns source_version (opaque, over persons.updated_at, cases.updated_at, case_household.added_at); the record job pins it; every dispatch re-reads and compares: equal → the SAME bytes under the SAME correlation; changed after an attempt with an unknown outcome → the job is finalized superseded and a NEW record job with a NEW correlation is staged in the same tx — the partner never sees payload B under identity A; changed before any attempt → the job adopts the new version.

  9. Per-stage FIFO, enforced locally. claim_pending skips a job whose ordering_key has an earlier (by id — UUID v7 order) non-terminal job; resolve and record jobs of one stage share the key. Truth-at-resolve covers producer reordering: a stage_opened resolve on an already-closed case emits closed records; the later stage_closed admission finds closed_sent_at set. The catalogue’s silence on partner ordering is recorded; a terminal-failed predecessor does not block successors.

  10. Acknowledgements are classified. Each leg carries classify_ack(sent, inbound) → Accepted | Rejected(code) | Mismatch; CPRS: return_code = 0 AND ack.transaction_id == sent.transaction_id AND ack.person_id == sent.person_id → Accepted; 300 | 301 | 305 → terminal partner-rejected(<code>); an id mismatch → terminal ack-mismatch. The decoded-2xx-is-success path stays for payload jobs.

  11. Categorical settlement, every path. SendFailure { class ∈ {transport, timeout, bad-status, malformed-response, partner-rejected, ack-mismatch, assembly-refused, assembly-unavailable, partner-changed, superseded, retries-exhausted}, status, body_digest } renders class[:status] digest=…; that string — never the body — lands in last_error, error_message, exchange.failed{error} and tracing. PII-echo tests drive a mock echoing a child’s name
    DOB in a 4xx body AND a 200 rejection ack and assert every persistence path clean. payload jobs adopt the same rendering (pre-1.0 Changed).

  12. The cases projection: service-only, allowlist of one, data-minimised, audited per release. GET /v1/cases/cases/{case_id}/outbound-principals (ONG), GET /v1/cases/investigations/{id}/outbound-principals (INV: the referral’s report persons + allegation victims), GET /v1/cases/cases/{case_id}/outbound-principals/{person_id} and GET /v1/cases/investigations/{id}/outbound-principals/{person_id} (one record, ONG / INV), GET /v1/cases/reports/{report_id}/outbound-stages?interface= (ids of the open investigations reached through the report’s referral — the link legs' resolve step), GET /v1/cases/outbound-principals/open-stages?interface=&cursor= (ids, paged — the catch-up arm). source_version: ONG over persons.updated_at, cases.updated_at, case_household.added_at; INV over persons.updated_at, investigations.updated_at, report_persons.linked_at. Each call takes ?correlation=&interface= (a resolve read passes correlation = admission_id, a record read the job’s correlation_id) and STAGES case.outbound_principals_released {entity_kind, entity_id, person_id?, interface, correlation_id, requester, record_count} in its own tx BEFORE responding (ADR-003 row + security parser arm in the same MR). Behind require_service_caller() + service_id() == "craig-exchange" (handler const, H21). DOB decrypts under the ADR-048 storage context on the boot-verified path; fields = names, gender, DOB, role, primary_caregiver, active, added_at, source_version; no SSN / race / ethnicity.

  13. CPRS identity and mapping, ruled now. stage_id = the case id (ONG, FPR) or investigation id (INV). CPRS case_id = cases.referral_id ?? cases.id (ONG) and the referral id (INV) — ONE immutable identity per SHINES-case analogue (⁂ #1073). county_fips = admin_unit_to_fips(admin_unit, Georgia); gender male|female → M|F, else U; DOB from the decrypt. The Primary Case Manager record is OMITTED and primary_case_manager_person_id = None until #1811 lands (catalogue rows 72–84, 523 are the recorded coverage gap).

  14. The CPRS legs. ONG: stage_opened on case.created (entity case, rev 0); principal_added on case.screening_cohort_changed with change = "household" (entity case, rev = cohort_revision; the diff happens at resolve); stage_closed on case.closed (rev 0); household removal has no route — nothing to bind. INV: stage_opened on case.intake_created (entity investigation, rev 0); principal_added on case.report_person_linked and principal_removed on case.report_person_unlinked — the payload carries report_id + person_id only, so both admit as (entity_kind = report, entity_id = report_id, entity_revision = link id) and their resolve job maps the report to its open investigation(s) through the outbound-stages arm (a report with no investigation resolves empty; async auto-links are admitted when they land, no readiness barrier needed); removal stamps removed_at on the recipient row, NO partner call (catalogue 156); stage_closed on case.investigation_closed (entity investigation, rev 0). OUT: principal_updated (#1816), merges / splits (#1817).

  15. Catch-up covers initial population AND the rollout window. POST /v1/exchange/triggers/catch-up {interface} (admin; CLI exchange trigger-catch-up): walks the open-stages arm (paged) and writes stage_opened admissions for every open stage without a recipient row — idempotent by both ledgers; one run per interface under an advisory lease; a run record with counts (catalogue 567).

  16. Held rows are released by an act, in scope. POST /v1/exchange/triggers/admissions/release {interface, held_reason?, ids?} (admin) re-runs the chain → staged (a resolve job) or re-held; …/dismiss (admin) marks dismissed with a bounded dismiss_reason. Counters exchange_trigger_admissions_total{interface,leg,status}, exchange_trigger_held_total{interface,reason}, exchange_trigger_dispatch_total{interface,kind,class}.

  17. Deployment sequence. (1) cases image (additive); (2) the exchange migration BUMPS schema_compat_floor so no older exchange binary can (re)start; (3) roll every replica and verify by the orchestrator’s rollout status that every replica runs the new image digest (CRAIG exposes no build endpoint); (4) run catch-up; (5) flip the knob. Until (5) admissions write held(knob-off); events an old stub consumed between (2) and (3) are repaired by (4). Rollback = the newest release whose embedded max ≥ the floor (ADR-063 §D3).

  18. Production interoperability is a named prerequisite. CPRS pulls SOAP/XML; the crate pushes JSON — #1812; outbound partner auth — #1813. The devstack mock proves the CRAIG side only.

  19. Test oracle. The mock-server host gains a devstack-only GET /_capture?path=&since= (bounded ring buffer)
    DELETE /_capture over its existing capture buffer, so end-to-end legs assert transmitted bytes.

Readiness matrix

Interface Trigger fact in CRAIG Payload identifiers in CRAIG Verdict

CPRS INV/ONG

case / investigation open + close; household cohort; report-person link / unlink

names, gender, DOB (decrypt), role, county FIPS; case-manager names ABSENT (record omitted)

BUILD (U2 ONG, U3 INV)

WIC

"in DFCS custody" — no legal-status fact

empi_id REQUIRED — none; race / ethnicity / citizenship / placement address

blocked: #1804 + #1805

DOE-SLDS

GTID validated + custody

gtid REQUIRED — none

blocked: #1806 + #1804

IES Medicaid

Initial Medicaid Application act — no model

client identifiers

blocked: #1807

STARS

child-support referral "Yes" at the IV-E determination — no decision

NCP records, per-diem, medicaid class

blocked: #1808

SMILE

service-authorization / payment-of-care / vendor-contract approval

client / vendor records

blocked: #1809

TCM

contact-claim scan — no model

claim fields

blocked: #1810

Units — each its own MR; the epic is &87

MR Scope W

U0 #1826

This page (Active nav), ADR-075 (Proposed), the Plan::TRIGGER-PARITY label, epic &87 restructured (U0–U4 + the six bind issues), the prerequisite / fix / follow-up issues, #244 closed as superseded, the ADR-032 amendment pointer, round 1 logged

1

U1 #1827

The cases projection (deploys FIRST): DTOs in craig-cases-contracts; the four principal arms (ONG / INV; set / single record), the report → open-investigations arm, the open-stages arm; source_version; case.outbound_principals_released (catalogue row, security parser arm); allowlist-of-one refusals; DOB decrypt on the verified path; contract + refusal + delayed-link fixtures; services.adoc

3

U2 #1828

The substrate + CPRS ONG stage_opened / stage_closed (may ship as two MRs): OutboundTriggerSpec + outbound_triggers(); exchange triggers/ (registry, boot validation, additive admission, TriggerKind, both ledgers + the origin / kind / ordering_key / source_version columns with the FLOOR BUMP, dsa_admits, TriggerSettings, resolve + record kinds, per-stage FIFO, late-bound assembly under the outer budget, supersession, ack classification, categorical settlement for ALL jobs, the reserved-token refusal, catch-up, release / dismiss, metrics); the mock _capture surface; contested entries + legs; docs (implementation-guide Consumes table, deployment-guide § "Outbound trigger rollout", services.adoc, CLI page); CHANGELOG Added + Changed

8

U3 #1829

ONG principal_added + the CPRS INV legs: the cohort-driven membership diff; the four INV keys; the investigation resolver; delayed-link and removal tests; ADR-075 as-built note; the #1073 identity note; Closes #243

5

U4 #1830

Close-out: Status Done, archive, .claude/CLAUDE.md, plan-lint --done; epic &87 stays OPEN as the tracker of the six bind children

1

Test matrix (by risk)

  • Boot: undeclared leg / unregistered or non-Generic kind → refusal naming the row; TX boots unchanged; the settings test loads CRAIG_EXCHANGETRIGGERSCPRS__ENABLED=true into triggers.cprs.enabled.

  • Admission (services/craig-exchange/tests/api/outbound_triggers.rs, // @axis: per test): case.created → one admission
    one resolve job (happy); the same envelope redelivered / a re-emitted event → still one (replay); knob off → held(knob-off) (sad); zero / two partners → held(no-partner | partner-ambiguous); a DSA owned by ANOTHER partner, not yet effective, expired yesterday, inactive → the four held(dsa-*) reasons; cohort household → the SSA watermark bump AND the admission in ONE tx (regression); manual send_exchange with exchange_type = cprs.ong_stage_opened → 400 EXCHANGE_TYPE_RESERVED, no origin = trigger row anywhere (evil).

  • Resolve + record (real devstack cases + the worker + the devstack mock): two children + one adult → two recipient rows, two transactions, two captured records (transaction_id == correlation_id, county_fips from admin_unit, case_id = referral_id ?? case_id); no name / DOB in request_payload, payload, last_error; a child added between the open event and the resolve → sent ONCE (U3; conc); case.closed → closure records for every non-removed recipient incl. one now 18 y 2 m; the mock rejecting 305 → partner-rejected:305 with no body persisted; a foreign person_id in the ack → ack-mismatch; a 4xx body echoing name + DOB → every persistence path clean (evil); cases unreachable via the s2s-client.craig-exchange.cases toxiproxy lane → assembly-unavailable … retries-exhausted, the retry endpoint restages and succeeds once healed (fault); a person edited after an unknown-outcome attempt → superseded + a fresh correlation (replay); a stage_closed job never claims while the stage’s record jobs are pending (conc); adapter_kind flipped between stage and send → partner-changed; the case deleted → assembly-refused.

  • Catch-up / release: open stages without recipients → admissions once, idempotent on re-run; held rows → staged after the knob flips; dismiss audited.

  • Cases projection: worker bearer → 403; foreign service → 403; craig-exchange → 200 with decrypted DOB
    source_version; the release event’s outbox row exists when the body arrives; DTO key set pinned (contract); the INV arm returns report persons + allegation victims.

  • Contested: the admission dispatcher’s graceful-close + tcp-reset + ordering-burst legs by name; the widened S2S client.

  • Property: TriggerKind token round-trip; recipient identity equality ⇔ tuple equality; SendFailure render never contains a byte of the input body.

Verification

Per MR: fmt, clippy, budgets (B1 on send_worker.rs / main.rs; B3 — typed references, ONE serde_json::Value boundary at send_value), the 22 lints (mq-topology, route-to-client regen, tracing-pii-fields), axis-coverage, contested-census, check-docs, plan-lint; the pre-push battery. Live probe after U2: seed a case with a household as dana.county → GET /_capture?path=/partner/cprs shows one record per child with transaction_id = the job’s correlation; GET /v1/exchange/transactions lists the system rows; knob off → held(knob-off); expire the DSA → held(dsa-expired); run catch-up twice → idempotent counts.

Rollout

Decision 17’s sequence, per environment; the knob stays off until every replica is new and catch-up has run. Pre-1.0 Changed: the two debug stubs become real consumers; exchange_transactions gains origin / admission_id and system-initiated rows; last_error / error_message / exchange.failed{error} become categorical for ALL jobs. Production delivery to CPRS stays blocked on #1812 and #1813.

Risks

PII on a new S2S route — allowlist of one, data-minimised, audited per release, never at rest in exchange (columns, errors, events, logs all pinned). Event floods — one admission per occurrence, one recipient per person. The worker gains a network read — one 5 s outer budget per job inside the 90 s lease. Ordering — enforced locally per stage; partner ordering unknown and recorded. Mixed fleets — excluded by the floor bump; the rollout window repaired by catch-up. Case-manager records — omitted, a recorded gap with a filed prerequisite. Scope — six interfaces wait on domain facts this program names and files rather than fakes.

Rulings (approved 2026-09-12, plan mode)

R1 scope = substrate + CPRS (ONG then INV); #244 split into six prerequisite-bound bind issues and closed. R2 late-bound single-record assembly with the two ledgers; no PII at rest in exchange. R3 the service-only principals projection with decrypted DOB, allowlist of one, a per-release audit event. R4 consent = per-interface knob + one active partner
dsa_admits (ownership + both boundaries); HELD rows preserved and releasable. R5 the matrix is bundle-declared, legs live in exchange. R6 CPRS identity: stage_id = case / investigation id; case_id = referral_id ?? case_id (ONG) / referral id (INV), immutable, ⁂ #1073. R7 the case-manager record is omitted until a structured worker-name source exists. R8 categorical settlement applies to ALL send jobs (pre-1.0 Changed). R9 the legal-status / custody model and the CPRS protocol bridge are filed prerequisites, not built here. The maintainer’s 25-finding gate on rev 1 (2026-09-12) was folded into rev 2 before approval; the fold table is on ADR-075.

Review log

Round Vendor Resolved model Verdict

1

Anthropic — one fresh contextless subagent, the four plan-lifecycle questions, over this page + ADR-075

Claude Fable 5.1

no-ship (2026-09-12) — Q1 conforms, Q3 clean, Q4 readable; six Q2 gaps folded in-plan the same day: the admission state machine (released dropped, resolved terminal), the INV link legs admitting on the report with a resolve-time mapping, the resolve job’s nullable transaction, the INV single-record arm + source_version, replica verification by rollout status (no build endpoint exists), the act roles + per-kind correlation; notes folded (SSA fix on its own branch, since? cut, event_id, FIFO by id, the age-AND-role admission rule, two API read paths, citation drift) or dropped

2

open — run by the maintainer through another vendor’s model

open

open

Edit this page · latest