Plan: The partner specification — what a partner crate implements, with Georgia’s partners ported onto it
Status
Done (2026-11-30) — a partner crate implements contracts the product owns (the manual send, the triggered-send leg, the collection, the inquiry), a jurisdiction exports one partner set, the conformance kit holds each kind, and craig-exchange links and names no partner; Georgia’s partners are ported onto it. Where a jurisdiction’s partner crates live is #3200; the identifier release rule is #3201.
Closes: #3196 (re-scoped by the ruling below).
Epic: &124. Relates to: #3188 (done; its collection seam is the model), #3192 and #3193 (they wait on this plan),
#3172, ADR-032, ADR-066, ADR-072, ADR-075. Tree: written against main at 503d8eb59.
Maintainer (2026-11-29): "we need to have generic specifications for how partner crates need to work"; no
jurisdiction cares what Georgia uses for its interfaces. The plan is that specification, made executable, with
Georgia’s code ported onto it inside craig. Where Georgia’s crates then live is decided afterwards, with the ported
code as evidence. A leg’s view of a person names the identifier generically now; which identifier craig-cases
releases for a send gets its own issue, designed with #3192.
Context
-
Two seams already have the right shape. A manual send is
ExchangeAdapterwith its erased form (crates/craig-exchange-contracts/src/erased.rs). A collection isCollectionAdapterwithErasedCollection(collection.rsbeside it), registered bycraig_partners_ga::collections()(crates/craig-partners-ga/src/lib.rs) and run by a generic runner (services/craig-exchange/src/collections/mod.rs). -
A triggered send has none. The thirteen legs are an enum inside craig-exchange (
services/craig-exchange/src/triggers/legs.rs:Family,Leg), with the education agency’s rules inlegs/doe_slds.rsandtriggers/doe_passes.rsand matches on the variants intriggers/admission.rsandtriggers/dispatch.rs.legs.rsalso downcasts the erased error toCprsErrororDoeSldsError(partner_error), and itscollection_failurenames the education crate. -
The SSA screening pipeline names its source.
services/craig-exchange/src/ssa_worker.rsbuilds Georgia Gateway’s income inquiry, callsSsaSolqAdapterand finds its partner as"ssa_solq"; so does the staging route (SSA_SOLQ_KINDinapi/screening.rs), and the partner crate’s authority type is held inapi/mod.rs(SolqAuthority),api/screening_resume.rs,ssa_readiness.rsandlib.rs. -
So three partner crates are unconditional dependencies of craig-exchange (
services/craig-exchange/Cargo.toml:craig-partner-ssa-solq,craig-partner-cprs,craig-partner-doe-slds), and consent is one struct field per partner (TriggerSettings,CollectionSettingsincrates/craig-common/src/settings.rs). -
The conformance kit covers one kind of leg:
crates/craig-partner-test-harness/src/lib.rsruns nine checks of a manual send against a crate’sPartnerUnderTestdescriptor. A partner that is nobody’s exists only as data: the fixture layer lists the adaptertestonia_registryand the rowcase.createdtotestonia_registry.stage_opened(fixtures/config/testonia/bundle/), which no build provides.
Scope
In: a partner’s failure without its type (D1); the triggered-send contract and the product’s event catalogue (D2); person-scoped listings as leg data (D3); the inquiry contract, with the SSA source behind it (D4); the partner set, its manifest and the boot checks (D5); the reference partner (D6); the kit for every kind of leg (D7); the pins that hold craig-exchange free of partner names (D8); ADR-089 and the page "Writing a partner crate".
Out:
-
Where a jurisdiction’s partner crates live, and who builds the binary. #3200; the ported code is its evidence, and an out-of-workspace build of the kit is its first step.
default = ["partners-ga"]stays. -
The return leg (the partner calls CRAIG). The lifecycle-journeys plan’s rule R4 gives it to the plan that first needs the listener (#3172); a contract with no door to test it against is not written here.
-
Which identifier craig-cases releases for a send. Its custody arm serves the fixed kind
GTID_KIND(crates/craig-cases-contracts/src/outbound_principals.rs); craig-exchange maps it onto the generic view. #3201. -
Persisted tokens. No interface, leg, entity, class or transaction-type token is renamed (D8). The product’s own
shinesadapter kind and thessa_solq_screeningtransaction type are product tokens and stay. -
The eight Georgia adapters that only send manually (they already sit behind the erased seam), the devstack tests under
services/craig-exchange/tests/api/and the Playwright journeys, which keep driving Georgia’s partners; and the partners' real wires (#3172).
Design
D1. A partner’s failure, without its type
PartnerFailure and PartnerFailureView move from crates/craig-exchange-transport/src/json_adapter.rs into
craig-exchange-contracts (new failure.rs), with no re-export: partner_error! and every caller name the
contracts crate, as the macro already does for JsonFault. ExchangeAdapter::Error and
CollectionAdapter::Error gain the bound PartnerFailureView, and ErasedAdapterError::Inner carries the error as
an object that keeps the view, so a new ErasedAdapterError::failure() answers it with no downcast. Display and
source() are unchanged, so the text a manual send persists as its last error is unchanged. The three errors the
macro does not stamp (SsaSolqError, and the standard and no-op adapters' in craig-exchange) implement the view by
hand. With the bound an inner error of unknown type can no longer be built, so the assertions about one go with it:
an_unrecognised_inner_error_is_transport_with_a_digest, and the "another partner’s error" and "no mapping" arms of
a_collection_failure_reads_as_a_sends_failure_does (both in legs.rs). The MR names them.
The view gains digests_body() → bool: whether a refused body may contribute its eight-hex digest. partner_error!
takes it as a required argument (body_digest = keep or omit), so each partner crate decides; the education
agency’s is omit, as now, because a body may echo a GTID. craig-exchange classifies with one function,
settlement::partner_failure(&ErasedAdapterError) → SendFailure (triggers/settlement.rs), which replaces
partner_error, the family match in Leg::classify_error and collection_failure. Classes and rules are today’s:
a 401 or 403 is auth-refused with no digest, a 5xx is partner-unavailable.
D2. The triggered-send contract
New module crates/craig-exchange-contracts/src/trigger.rs. A leg is a LegSpec (data) and three behaviours:
pub trait TriggerLeg: Send + Sync + 'static {
fn spec(&self) -> &'static LegSpec;
fn admits(&self, stage: &StageView, principal: &PrincipalView, today: NaiveDate) -> bool;
fn assemble(&self, ctx: &RecordContext<'_>) -> Result<serde_json::Value, AssemblyRefusal>;
fn classify_ack(&self, sent: &SentRecord<'_>, response: &serde_json::Value) -> AckVerdict;
}
LegSpec field |
Meaning, and where legs.rs decides it today |
|---|---|
|
The persisted tokens ( |
|
What an admission keys on: case, investigation, report, custody episode or person identifier ( |
|
Which entity plays the stage: case, investigation or custody episode ( |
|
|
|
The leg a catch-up walk raises for an open stage ( |
|
The one value of a multi-purpose event the leg admits ( |
|
|
|
The two listing gates (D3). |
The view. A leg sees the specification’s own types, not craig-cases' wire. StageView, PrincipalView,
CustodyView, CustodyRowView and IdentifierView carry, field for field, the facts of OutboundStage,
OutboundPrincipal, OutboundCustody, OutboundCustodyRow and OutboundGtid, except that the principal’s gtid
is named identifier and carries its kind. IdentifierView’s `Debug prints no value
(an_identifier_view_debug_prints_no_value, the twin of a_gtid_debug_never_prints_the_value).
craig-exchange maps each read once (new triggers/views.rs). RecordContext is today’s, over the views.
SentRecord holds the person, the correlation and a borrow of the record that was sent, in place of its gtid
field, and stays without Debug.
The verdicts. AssemblyRefusal is Refused or Invalid. AckVerdict is Accepted (with the body to store),
Rejected (with the partner’s numeric code, if it gave one), Mismatch or Malformed. The class vocabulary stays
craig-exchange’s: settlement.rs maps each verdict to one Class (each_verdict_maps_to_its_class).
The product’s event catalogue. How an event identifies its occurrence is the product’s knowledge, not a leg’s.
New triggers/events.rs holds one row per admissible event and replaces the match on leg variants in
admission.rs (admission_key, doe_admission_key):
| Event | Entity (payload key) | Subject | Revision | Discriminator |
|---|---|---|---|---|
|
case ( |
none |
once |
none |
|
case ( |
none |
|
|
|
investigation ( |
none |
once |
none |
|
report ( |
|
|
none |
|
custody episode ( |
|
once |
none |
|
custody episode ( |
|
|
none |
|
person identifier ( |
|
once |
|
craig-exchange’s TriggerRegistry (triggers/mod.rs) holds legs as Arc<dyn TriggerLeg> and resolves one by its
persisted (interface, leg) pair wherever Leg::resolve is called today. A pair no set provides resolves to
nothing, as a retired leg does now.
D3. Person-scoped listings as leg data
doe_passes.rs, resolve_pin and queued_ahead in dispatch.rs, and record_ordering_key in admission.rs ask
whether a leg is the education agency’s and read its request type. They become triggers/listing_passes.rs and read
only the spec:
-
scope == Person: a resolve locks the person after the stage; record jobs order per person; a resolve other thanAdmitNewreads the stage under the identifier its recipient was pinned to (for an identifier-keyed leg, the identifier its admission names). -
scope == Personandrule == AdmitNew(an opening): it waits while an earlier listing’s settling leg is unsettled (predecessor-unsettled), and its record re-stages behind an older stage’s pending record. -
reentry_gated: a newer recipient of the person supersedes the occurrence (superseded-by-reentry). -
settles_listing: the legs an opening waits for (today’sCLOSING_LEGS).
Georgia’s six education legs declare Person and: custody_opened, gtid_recorded and custody_corrected,
re-entry gated; custody_closed and gtid_ended, settling; custody_retracted, both. The seven CPRS legs are
stage-scoped with neither gate. DoeSldsRequestType is read only by the education crate’s own assembly.
D4. The inquiry contract, with the SSA source behind it
New module crates/craig-exchange-contracts/src/inquiry.rs:
pub trait Inquiry<Q, A>: Send + Sync + 'static {
fn interface(&self) -> &'static str;
/// `None`: no contract with the source exists, and nothing may be sent.
fn authority(&self) -> Option<SourceAuthority>; // Authoritative | NonAuthoritative
fn ask<'a>(&'a self, endpoint: &'a str, auth: &'a OutboundAuth, question: Q)
-> BoxFuture<'a, Result<A, InquiryFailure>>;
}
The first pair is SSA benefit screening, which is a product function. SsaBenefitQuestion is the released screening
identifier (a SecretString) and the request date; SsaBenefitAnswer is Found (the month and the benefit kinds) or
NoRecord. InquiryFailure is a closed enum whose tokens are today’s job classes (partner-timeout,
partner-connect, partner-transport, partner-status, partner-malformed, auth-unsupported, partner-fault,
partner-refused, partner-error) and identifier-unusable, which the partner crate decides before sending.
ssa_worker.rs keeps the pipeline (runs, members, jobs, fences, retention, the call to craig-cases) and the
product half of the answer’s mapping, and asks the registered inquiry. IncomeInquiryRequest, ClientNumber::parse,
the Gateway half of the mapping and partner_error_class move to crates/craig-partner-ssa-solq/src/inquiry.rs.
The registered inquiry is one value in craig-exchange’s state, in place of api::SolqAuthority, and every site
that names the source today asks it. The worker’s preconditions and the staging route’s resolve_ssa_partner
(api/screening.rs) find the partner row by interface(); the worker, ssa_readiness.rs and
api/screening_resume.rs read authority(). With no inquiry in the set, the worker holds contract-pending and the
staging route answers its "no active partner" 503 (a_set_without_an_inquiry_stages_nothing).
The send-authority witness stays where it is and as strong as it is. SolqSendAuthority and its unconstructible
GatewayProof remain in crates/craig-partner-ssa-solq/src/authority.rs. The crate’s inquiry holds an
Option<SolqSendAuthority> and answers authority() from it. The set Georgia registers builds it with None, so
the worker’s first precondition still pauses every job contract-pending; a harness builds the stub under
contract-stub, which answers NonAuthoritative, and craig-cases still refuses facts for it. solq_send_authority()
in services/craig-exchange/src/lib.rs is deleted: activation remains a code change, made in the partner crate.
D5. The partner set, its manifest and the boot checks
crates/craig-state-bundle/src/types.rs gains PartnerSet { adapters, collections, legs, ssa_benefits }: the first
two are today’s factory lists, a leg is an Arc<dyn TriggerLeg>, and an inquiry is built from the BootContext as an
adapter is. A jurisdiction’s aggregator exports one function, partner_set(); craig_partners_ga::adapters() and
collections() fold into it, and compiled_adapters and compiled_collections in
services/craig-exchange/src/bundle_orchestrator.rs become one compiled_set. The manifest is derived, not written:
PartnerSet::manifest() lists each interface with its dispatch class and its legs of each kind, and boot logs it.
PartnerSet::validate() runs at boot and in the kit. It refuses two legs with one (interface, leg); a leg,
collection or inquiry whose interface has no adapter in the set; two opening legs for one interface and stage kind;
and a listing gate on a stage-scoped leg. Boot then checks the set against the configuration. Today’s refusals stay
(a listed adapter the set lacks; a matrix row whose leg or adapter kind is unknown, or whose kind is not generically
dispatchable). Four are new: a row whose event is outside the catalogue; a row whose event keys another entity than
its leg; a leg that wants a discriminator its event has none of; and a consent variable for an interface with no leg
of that kind.
Consent becomes a map. TriggerSettings and CollectionSettings deserialize interface to enabled from the same
variables (CRAIG_EXCHANGETRIGGERS<INTERFACE>__ENABLED and the COLLECTIONS twin), with no field per partner.
enabled(interface) answers a bool: an interface with no variable is off, which is how its two answers today
(Some(false) and None) are already treated, as knob-off for a send and a refusal for a collection.
D6. The reference partner
New crate crates/craig-partner-testonia-registry, kind testonia_registry: the fixture jurisdiction’s resident
registry. It depends only on the specification’s crates and holds one of everything: a manual-send adapter; one leg
for each of the thirteen spec shapes Georgia’s legs use, as rows over one record type and one acknowledgement type
(stage_opened is the fixture layer’s row); a collection that reports PartnerReport::Education; an SSA benefit
inquiry that is non-authoritative by construction; and, behind mock, a closed-world simulator with its _sim
routes. It exports partner_set().
It is a dev-dependency only. craig-exchange’s unit tests of the generic machinery (dispatch.rs, admission.rs,
triggers/contested_legs.rs, triggers/test_support.rs, the listing passes, the SSA worker’s) drive its legs in
place of the Leg::Cprs… and Leg::DoeSlds… variants. A test of one Georgia leg’s own rules moves with the leg
into its partner crate. Each test function of a touched file survives under its name in one of the two places.
D7. The conformance kit
crates/craig-partner-test-harness keeps the manual-send checks and gains one module per kind. A crate supplies a
descriptor with its fixtures, as PartnerUnderTest does now.
-
leg: the spec is coherent; a leg whose rule admits nobody new admits nobody; assembly is a pure function of its context; a refused subject refuses assembly; the assembled record, sent to the crate’s own mock, is acknowledgedAccepted, and against another correlation isMismatch; an undecodable acknowledgement isMalformed;classify_ackneither panics on nor accepts arbitrary JSON (property). -
collection: nothing published is an empty answer; what the simulator published is collected and attributed.inquiry: a known person is answered; an unknown one gets the no-record answer; a refusal ispartner-refused; an unusable identifier sends nothing. Both: the three injected faults map to their failure. -
simulator: two loads of the same people answer the same; a person it was not given is not known; a person out of its reach changes nothing;clearforgets everything. -
set:validate()passes, and every registered leg, collection and inquiry has a descriptor in the list the crate hands over.
FaultClass and PartnerUnderTest::classify are deleted: the kit reads D1’s view. So that a crate can host only
its own partner, tools/craig-mock-server/src/lib.rs gains spawn_for_routes, its registry over a given list.
D8. What "names no partner" means, and what holds it
-
Linking. craig-exchange links a partner crate only through a jurisdiction’s aggregator feature: the fingerprint
partner_crate_consumers_default_to_every_partner_feature(xtask/src/cmd/feature_matrix.rs) countscraig-partner-*crates as hard links too. -
Source. No code of craig-exchange outside its tests holds a string literal equal to a partner kind token (the
crates/craig-partner-*directory names).cargo xtask lints jurisdiction-literals(xtask/src/cmd/lints/jurisdiction.rs) gains that token class overservices/craig-exchange/src/, with the walker that already skips test code (a_partner_kind_literal_in_exchange_is_refused). -
Partner crates. Their normal
craig-*dependencies are the specification’s crates (craig-exchange-contracts,craig-exchange-transport,craig-state-bundle,craig-validation):partner_crates_depend_only_on_the_specification, beside the fingerprint. -
The reference partner is in no release graph:
the_reference_partner_reaches_no_release_image(xtask/src/cmd/release_artifact_gate.rs). -
Tokens.
georgias_persisted_tokens_are_unchanged(incraig-partners-ga) holds the thirteen leg pairs,doe_slds.weekly_recordsand the SSA interface token as literals.
Alternatives rejected (ADR-089 records them)
A leg taking craig-cases' projection types (it ties partner crates to an internal service wire; the collection seam already keeps the product’s record types in the contracts crate). An owned failure value in place of the boxed error (it changes the text manual sends persist). A hand-written manifest (a second copy, free to drift). Payload keys in each leg’s spec (partner crates would restate the product’s event shapes). Moving the screening pipeline out with its source. Ruled out earlier on #3196: prose only, traits alone, a language-neutral component interface.
Steps
One MR per step, in order; each relates to #3196 and the last closes it.
-
The decision. ADR-089 (the next free number) and this page; a status note on ADR-032, ADR-066, ADR-072 and ADR-075, each naming the clause ADR-089 amends.
-
The failure view (D1).
-
The contract, the set and the reference partner (D2’s module, D5’s type and
validate, D6’s adapter, legs and simulator, D7’sleg,simulatorandsetmodules,spawn_for_routes). Additive: craig-exchange is untouched. -
The legs' decisions become data, in place (D2’s catalogue and view mapping, D3).
Legstays an enum for this one step and answers aLegSpec;Familyand every match on a variant outsidelegs.rsgo. Behaviour is unchanged. A golden record per leg is captured from the code as it stands. -
The switch (D5’s boot checks and consent map). Legs come from the set. The CPRS and education legs move to
crates/craig-partner-cprs/src/legs.rsandcrates/craig-partner-doe-slds/src/legs.rs;Legand two partner dependencies are deleted; craig-exchange’s unit tests move to the reference legs (D6). -
The inquiry (D4; D7’s
inquirymodule; the reference inquiry; D8’s linking and source pins). The last partner dependency is deleted. -
The close. The reference collection and D7’s
collectionmodule; every Georgia partner crate under the kit; D8’s remaining pins; the page; the plan archived.
Erratum (2026-11-30): step 5 lands as two changes, the switch under the unit tests as they stand and then those
tests' move to the reference legs, so that a failing car names one cause; craig-partner-cprs and
craig-partner-doe-slds are development dependencies of craig-exchange between the two.
Risks
-
A ported leg assembles different bytes — silent (the partner receives a changed record). Mitigation: step 4’s golden records, asserted in the partner crate after the move (
the_assembled_record_matches_its_golden); the devstack suites underservices/craig-exchange/tests/api/and the journey run unchanged on each car. -
A token changes in the move — silent (stored rows stop resolving). Mitigation:
georgias_persisted_tokens_are_unchanged,each_verdict_maps_to_its_class,inquiry_failures_carry_the_job_class_tokens. -
The view drops a fact the projection carries — fail-closed where a leg needs the fact (assembly refuses), silent where it only changes the bytes. Mitigation:
the_view_carries_every_projected_factmaps a fully populatedOutboundPrincipalsand compares field by field;the_view_tokens_equal_the_projections; the golden records. -
A failure is classified without its partner’s body rule — fail-open (a digest of a body that echoes an identifier is stored). Mitigation: the macro has no default;
doe_adapter_errors_classify_as_cprs_do(legs/doe_slds.rs) and the education arms ofa_collection_failure_reads_as_a_sends_failure_doeskeep their assertions, that a refused education body leaves its status and no digest, againstpartner_failure. -
The inquiry seam weakens the SSA custody boundary — fail-open (a send before a contract, or facts from a stub). Mitigation: the witness and its fixture are untouched (
a_production_shaped_build_cannot_construct_the_witness);the_production_set_holds_no_send_authority(incraig-partners-ga);round_trip_sends_once_and_terminals_non_authoritative_at_casesruns unchanged;release-artifact-gatekeepscontract-stubout of release graphs. -
The configuration and the build disagree — fail-closed at boot, by D5’s refusals (Tests). A consent variable for an interface the build lacks used to be ignored and now refuses boot; that step’s changelog fragment says so.
-
The reference partner ships — fail-open (a synthetic partner a production layer could list). Mitigation: dev-dependency only, and
the_reference_partner_reaches_no_release_image. -
A test is lost in a move — silent. Mitigation: D6’s rule, checked in each MR by comparing the test names
cargo nextest listreports before and after, with the moves listed in the MR. -
A registered leg escapes the kit — silent. Mitigation:
an_undescribed_leg_fails_the_set_check. -
Step 5 is one large change — fail-closed (it does not compile, or its car fails). Mitigation: step 4 turns the decisions into data first, so step 5 moves code and swaps the enum for the registry.
Tests
-
Contract (wire and tokens): the three token pins and the two view pins named under Risks; the Display fixture of
partner_error!(display_strings_match_the_hand_written_wording) passes unchanged; the settings teststrigger_consent_env_string_lands_on_the_nested_interface_knob,doe_slds_settings_load_the_knobandcollection_consent_is_its_own_knob_apart_from_the_send_consentassert that the same variables load the same consents, one per interface and kind, through the map; the reference partner’s wire types round-trip. -
Property:
classify_ackon arbitrary JSON (kit); the reference crate joins theparse-prop-coveragecensus;crates/craig-partner-ssa-solq/tests/parse_never_panics.rscovers the moved parse. -
Concurrency: the plan adds no race. The seeded contention suite (
triggers/contested_legs.rs) and the listing tests (triggers/doe_legs_tests.rs) run on the reference legs, assertions unchanged. -
Boot (unit):
a_duplicate_leg_refuses_boot,a_leg_without_an_adapter_refuses_boot,two_opening_legs_refuse_boot,a_gate_on_a_stage_scoped_leg_refuses_boot,a_row_for_an_event_outside_the_catalogue_refuses_boot,a_row_whose_event_keys_another_entity_refuses_boot,a_discriminator_the_event_lacks_refuses_boot,a_consent_for_an_unknown_interface_refuses_boot, andthe_fixture_layer_boots_on_the_reference_set(the fixture bundle with the reference set builds the registries). -
Regression: the tests of every touched file, moved or re-pointed with their assertions unchanged; the devstack suites (
outbound_triggers,ssa_worker, the collection tests) and the Playwright journey on each car. -
Kit: the reference partner and each Georgia partner crate run every module that applies to them.
Delivery
-
Canonical page: new
docs/modules/ROOT/pages/partner-crates.adoc, "Writing a partner crate" (the contracts, the set, the kit, the reference partner, how to run the kit), linked fromdocs/modules/ROOT/nav.adoc; begun at step 3 and completed at step 7. -
Other docs, with the step that changes the surface:
adrs/adr-089-partner-specification.adoc;shared-crates.adoc;multi-jurisdiction-extensibility.adoc(its partner-adapters step);deployment-guide.adoc(the consent variables and the boot refusals);testing-reference.adoc(the kit). -
CHANGELOG entry: one
changelog.d/3196.<slug>.<type>.adocfragment per MR (the project’s override). -
Plan page: committed as
docs/modules/ROOT/pages/plans/partner-specification.adocwith step 1,In progressat step 2,Doneand archived at step 7. -
Close: step 7’s MR closes #3196, with the merge SHA noted on it and on &124. Filed at approval: #3200 (where a jurisdiction’s partner crates live) and #3201 (the identifier release rule). #3192’s plan builds on step 6’s contract.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic (Vertex) |
|
FLAGS on the second question: the SSA source is
also named by the staging route ( |
2 |
Google (Vertex) |
|
CLEAN on all four questions. |