ADR-091: The Partner Return — a Partner Calls CRAIG Through a Mutual-TLS Listener in craig-exchange, and the Owning Service Keeps What It Said
Status
Accepted (2026-12-03) with plan the Medicaid referral, #3193. It decides the question the inbound audit raised (#3172): how a partner that calls CRAIG is let in, and what happens to what it says. The maintainer ruled the shape on #3172 (2026-11-29) and three further points while the plan was written (2026-12-03); each is stated in the Decision below.
It extends ADR-090: the module contract takes its second addition, version 1.2, by the rule that record’s amendment set for the first. It leaves ADR-075 (the triggered send) and ADR-089 (a partner crate implements contracts the product owns) as they are, and adds one leg to the four the lifecycle-journeys programme names (#3187, rule R4).
The plan’s steps deliver the decision. The registry, the referral and the listener are built (How the host runs a return). A deployment takes a partner’s call once its jurisdiction’s partner set holds a return leg and the deployment consents to that interface; until then no listener is bound.
Context
Every conversation CRAIG has had with a partner was started by CRAIG: it sends a record (ADR-075), fetches what a partner published (a collection), or asks a question (an inquiry, a person index). Georgia’s medical-assistance system does not fit. The audit of its interface (#3172, rows M3 and X2) found two contracts where the partner crate modelled one: a referral whose synchronous answer is only the partner’s number for the application, and a status the partner delivers later by calling a service the child-welfare system hosts. The second cannot be had by asking.
A call from outside is the largest change to craig-exchange’s exposure since it was written, so the questions are the ones a door raises. Who is calling, and how is that known? What may that caller do? What is done with a body a partner controls? And where does what it says come to rest, given that craig-exchange has held no partner’s facts so far, only ids and counts?
Decision
-
A return is a leg of the partner specification. A partner crate implements
ReturnLeg(craig_exchange_contracts::returns): the largest body it reads, the product records a call’s body holds, and the answer the partner expects. Both rules are pure. A return leg reaches no partner, and the module host gives it no transport, as it gives a triggered-send leg’s rules none. The wire is the jurisdiction’s (Georgia’s is SOAP); nothing in the product names it. -
The listener lives in craig-exchange, on a port of its own, and serves one route. No new service (maintainer, 2026-11-29). It is bound only where the deployment consents to a return for some interface, and it serves
POST /returns/{interface}/{leg}and nothing else; the service’s API port serves no return. -
The caller is its client certificate, and the certificate must pass twice. It must chain to an issuer in a bundle the deployment configures, which the TLS handshake decides, and its fingerprint must be registered against a partner in craig-security and approved there, which is looked up on every call (maintainer, 2026-11-29 and 2026-12-03). The first keeps an unknown party from reaching any code past the handshake. The second makes one certificate one caller, revocable at once and without a restart. The caller carries no token.
-
A caller may use its own operations only. craig-exchange holds, on the partner row of an interface, which registered partner may call it. A call to an interface that is another caller’s, or that does not exist, is answered alike.
-
A return is gated as a send is. An active partner row, an agreement that admits it and the deployment’s consent for that interface, each checked on every call. Consent defaults to off.
-
The owning service keeps what the partner said; craig-exchange keeps ids and counts. The listener hands each record to the service that owns the fact and stores one row of the call: who, which leg, when, and how many records met which outcome. A referred application’s outcome is craig-cases': it finds the application by the identifier the partner keys the person on and the reference the partner gave when it took the referral, and stores nothing for a report it cannot place. The id a partner’s program assigns rests only there, sealed, on the application’s report (maintainer, 2026-12-03); whether it is also one of the person’s identifiers is a question of its own.
-
Certificates have their own authorization type. An administrator registers, approves and revokes; the auditor role reads; craig-exchange’s service identity reads the one lookup; every other caller is refused (maintainer, 2026-12-03).
-
The module contract becomes 1.2. It adds three interfaces and changes none:
referral-legs,returnsand, for simulators,callers. A module built for 1.0 or 1.1 loads unchanged and provides none of them.
The referral is a triggered send with a receipt
The other half of the conversation needs no new door. A submitted application is one more event on the trigger
substrate, and the record is sent as every triggered record is. What is new is small: the partner’s answer carries
the partner’s own reference for the application, the receipt, which craig-exchange hands to the service that
owns the application and of which it keeps nothing. A partner crate states this as a ReferralLeg
(craig_exchange_contracts::referral): two tokens and two pure rules. Everything a triggered-send leg otherwise
declares about itself is the host’s to fix for a referral, so a partner cannot declare it wrongly.
Reading a certificate
craig-security stores a registered certificate’s fingerprint, subject and validity, and so must read them from the
certificate. Three X.509 readers were already in the lockfile when this was decided. x509-parser 0.18.1 was the
newest release of its line and is the one used. RustCrypto’s x509-cert was locked at 0.2.5 with 0.3.1 its
newest, so a direct use would have added a second generation of it to the build. rustls-webpki, which the
handshake itself uses, validates a chain but offers a certificate’s subject only as DER and its validity not at
all. The choice is easy to reverse: one function reads a certificate.
Consequences
-
A partner’s bytes arrive unasked. A leg states the largest body it reads and refuses a longer one; a module’s leg runs inside the module’s fuel and memory limits; and what a leg decodes is held to the contract’s bounds before any service is handed it (
returns::admitted: at most 500 reports a call, each text 1 to 64 printable ASCII bytes with no space). A fuzz target (return_decode) puts arbitrary bodies through the reference partner’s leg. -
Two things must be registered before a partner can report anything: its certificate in craig-security, and the binding of that registered partner to the interface’s partner row in craig-exchange. Either missing is a refusal, so a half-configured deployment takes no call.
-
Revocation is immediate, at the cost of a lookup on every call. A return is a daily call, not a hot path.
-
An outcome can arrive before its receipt was applied. craig-cases then cannot place it and answers that it is unknown; nothing is stored, and the partner’s leg tells the partner so. A partner that sends again later is answered as if for the first time. The reference partner’s simulator holds such an outcome due (
an_outcome_answered_unknown_is_due_again). -
A second kind of partner record names no person of CRAIG’s. A referral’s outcome names its person by the partner’s identifier, so
PartnerReportsays how each kind names its subject, and a collection run, which admits by the people it listed, counts such a report as one it cannot attribute. -
Jurisdictions take 1.2 when they next rebuild. Until then their committed modules load as they did.
Alternatives considered
-
A token the partner presents (an API key or a signed assertion) in place of a certificate. Georgia’s partner authenticates this call by certificate today, and a bearer secret is one more thing to leak from a partner’s batch host. Rejected for the transport; registration in craig-security keeps the property a token would have given, that a caller is one the agency enrolled.
-
Trusting the certificate chain alone. An issuer that signs for a whole agency would let any of its systems call as the partner. Rejected: registration is what makes one certificate one caller.
-
Registration alone, with no issuer bundle. Every unauthenticated party would then reach the lookup, and the lookup’s availability would decide who can open a connection. Rejected: the handshake refuses first.
-
A service of its own for inbound calls. It would hold the same partner rows, agreements and consents as craig-exchange, or ask for them on every call. Rejected by the maintainer’s ruling: the listener is a second port on the service that already owns them.
-
craig-exchange stores the outcome and craig-cases reads it. It would make craig-exchange a store of facts about children, which it has not been, and put the question "which application is this?" in the service that cannot answer it. Rejected: the owner of the fact decides whether a report is about anything it holds.
-
Polling the partner for the status. The partner offers a separate inquiry (#3172, row X1), but it answers about one person on request and is not how the partner delivers a decision. Left for its own issue.
Canonical pages: Writing a partner crate, § A return and § A referral leg.