ADR-090: Partner Modules — a Jurisdiction’s Partner Code and Simulators Load from Its Configuration Layer as WebAssembly Components
Status
Accepted (2026-11-30) with plan partner modules, #3200. It answers the question ADR-089 left open: where a jurisdiction’s partner crates live, and who builds the binary that links them. The maintainer ruled the shape and its three open choices that day; the rulings are recorded in notes on #3200 and stated in the Decision below.
It amends one clause each of ADR-032 (run-time loading, its rejected alternative 9), ADR-066 (where the send-authority witness lives, and what holds the boundary in this repository), ADR-072 ("Partner adapters stay source") and ADR-089 (what a partner crate depends on, and how a jurisdiction’s set reaches craig-exchange). Each of those pages carries a note naming its clause.
The plan’s steps deliver the decision. Until its switch lands, the tree is as ADR-089 describes it.
Context
ADR-089 made a partner crate an implementation of contracts the product owns, and left craig-exchange naming no
partner. It did not move the code. Georgia’s eleven partner crates and two aggregators are still under crates/,
and craig-exchange and the mock server link them through a partners-ga feature that is on by default
(services/craig-exchange/Cargo.toml, tools/craig-mock-server/Cargo.toml). So every published image carries
Georgia’s partners, and a change to a partner’s wire is a CRAIG build and a CRAIG release.
The maintainer’s requirement (2026-11-30): "I’m not a giant fan of an external entity being able to force a rebuild", and a jurisdiction must be able to "consume upstream craig and keep track with main while keeping all of their jurisdiction specific stuff totall separate".
Three compiled shapes were put forward first: CRAIG’s build pulls the jurisdiction’s crates; the jurisdiction builds its own craig-exchange on CRAIG’s libraries; or both at once. Each fails the requirement, because partner code ends inside a service binary and a wire change is a build and a release of that binary.
Loading partner code at run time had been set aside twice in CRAIG, neither time on its merits:
-
ADR-032, alternative 9: "the binding surface (5 registries + async transport + reqwest) doesn’t map cleanly".
-
ADR-089: "Rejected for now: it forces the run-time plugin decision before the seam is proven, and a simulator’s router would stay native either way."
Both reasons are gone. ADR-089 left four narrow contracts (the manual send, the triggered-send leg, the collection
and the inquiry), and a partner crate reaches a partner only through the OutboundTransport the host hands it.
Two decisions already point this way. ADR-033's amendment of #2296 commits CRAIG’s worker-UI plugins to a sandboxed WebAssembly backend (#3074). Canopy’s ADR-052 (jurisdiction extension modules) loads a jurisdiction’s WebAssembly component from its configuration layer, with wasmtime as the runtime and a WIT contract. This decision uses the same runtime, the same kind of contract and the same way of building a guest.
What a spike showed
Run on 2026-11-30 and recorded in #3200’s notes of that day. Its code is not in the tree: the plan’s step 3 starts from it.
-
The education partner (
craig-partner-doe-slds) ran as a component behind the existing contracts with its production source unchanged. The conformance kit’s manual-send, leg and collection checks passed through the module, and each leg’s record assembled inside the module equalled its committed golden. -
Its simulator ran as a second component behind the mock server, with its router inside the module and the host’s clock as its only import. So ADR-089’s second reason did not hold either.
-
The same tests passed when built for static musl with mimalloc, and on wasmtime 48, 50 and 51.
-
All eleven of Georgia’s partner crates built for
wasm32-unknown-unknown. -
Loading a module took about 0.3 s, once. A call with a fresh instance cost 22 to 38 µs more than the native call; a partner call takes milliseconds.
-
The module’s bytes were the same when built from another directory and another
CARGO_HOME, once both paths were remapped.
Not shown: the inquiry contract through a module, the other ten partners through the kit, craig-exchange booting on a loaded set, and a build on another machine. The plan tests each.
Decision
-
A jurisdiction’s partner code and its partner simulators are WebAssembly components in its configuration layer. A layer may hold
partners/: a manifest, the partner-set module, the simulators module, and the Cargo workspace both are built from. craig-exchange loads the partner set at boot, and the mock server loads the simulators. No jurisdiction’s code is compiled into a CRAIG binary. A published image is the same for every jurisdiction, and a partner’s wire change is a change to the layer and a restart. -
The contract is one WIT package,
craig:partner: ADR-089’s contracts as data. The manual send, the triggered-send leg, the collection and the SSA benefit inquiry cross as typed values. A record and a partner’s answer cross as JSON text, as they do at the erased seam today, and a failure crosses as data and is rebuilt on the host. Behind the contract the host implementsErasedAdapter,TriggerLeg,ErasedCollectionand the inquiry, and hands craig-exchange an ordinaryPartnerSet, so the dispatch code does not change. The package version is the contract version: a host loads modules of its own major version and refuses any other at boot. -
A module may touch its imports and nothing else. No WASI interface is linked, so a module has no files, sockets, environment, clock or randomness of its own. A partner set’s only import is the host’s transport. The host admits an endpoint only when it is the endpoint of the partner row the call is for, or under it. The host adds that row’s credential itself, so no credential enters a module, and it applies its own deadline. Every call gets a fresh instance under a fuel limit and a memory limit, and a module that fails, fails that call only.
-
A shipped host grants a module no SSA send authority. The witness of ADR-066 moves with Georgia’s crate. In this repository the boundary becomes this: the entry point craig-exchange boots through gives a module’s inquiry no authority, whatever the module reports, and refuses the question unsent. A pass-through exists only under a test-only feature that
cargo xtask release-artifact-gateholds out of every release graph, which is the placecontract-stubhas today. Every screening job still pausescontract-pending. How a module is granted a real contract is #1433’s to design, as a reviewed change to this repository: activation remains a change to product code, never to configuration. -
The built module is committed in the layer and is rebuilt to the same bytes (ruling). The layer’s signed, pinned commit (ADR-087) covers the module and its source. The jurisdiction’s pipeline and CRAIG’s car each rebuild the module from that source and refuse one whose bytes differ. What is committed is the core module the compiler emits; the host wraps it as a component when it loads it, so the recipe is a compiler, a lockfile and a profile, all three in the layer. No Rust toolchain is needed where CRAIG is deployed.
-
A partner crate stays Rust written against the specification. The specification’s crates build for WebAssembly, and an SDK crate lends a partner crate a transport whose calls are the host’s imports and exports its set. A partner crate’s production source does not change to become a module.
-
Simulators are modules too, and only the mock server can load them (ruling: components for partner code and simulators both). One instance lives as long as the mock server, because a simulator’s state lives in the module. The host’s clock is its only import.
-
The reference partner is a module, so the mechanism is tested without any jurisdiction. CRAIG’s tests of the host, the boot and the mock server run on the fixture jurisdiction’s partner (
testonia_registry), beside two modules written to misbehave. -
Georgia’s partner crates move to Georgia’s repository and are deleted here. The gates that list partner crates read the pinned layers' manifests and the reference partner.
-
A contract change after the move. An addition lands here alone, and a jurisdiction takes it when it next rebuilds. A breaking change lands as a paired configuration change does today: the jurisdiction’s commit is built against the commit of CRAIG’s branch, and CRAIG’s merge request carries the change and the new pin together.
-
The runtime is wasmtime, and it follows wasmtime’s monthly releases (ruling: "I think we keep pace with the monthlies now. We can see how much of a pain it is and potentially change it before we go 1.0"). #3203 carries the monthly bump and the review of this policy before 1.0.
-
wasmtime’s Tier 3 status for static musl is an accepted risk (ruling). wasmtime lists
x86_64-unknown-linux-musl, which CRAIG ships, as a Tier 3 target: its own project does not test that target in CI and has no maintainer for it. Its security policy counts a bug as a vulnerability only when it affects a Tier 1 platform or feature (wasmtime’sdocs/stability-tiers.mdanddocs/security-what-is-considered-a-security-vulnerability.md, read 2026-11-30). CRAIG’s car builds its tests for that target, so the host’s tests run there on every merge request.
The plan names the test that holds each of these.
Consequences
-
One image of each service serves every jurisdiction. A deployment’s layer must hold its partner modules: a layer whose
bundle/adapters.tomllists a kind no loaded set provides refuses boot, as a kind no compiled crate provided does today. -
A partner’s wire change is a commit in the jurisdiction’s repository and a new pin. CRAIG builds and releases nothing for it.
-
A second jurisdiction writes its partner crates against the specification and the SDK, builds two modules, and changes nothing in CRAIG.
-
The contract is a compatibility surface with a version from the day a module is built outside this repository. CRAIG keeps a major version working or pairs the break with the jurisdictions that build against it.
-
CRAIG gains a runtime dependency that ships monthly, supports an ordinary release for two months, and raises its minimum Rust version as it goes. A wasmtime bump can therefore force a bump of
rust-toolchain.toml. -
craig-exchange and the mock server carry wasmtime’s compiler. The host compiles a module when it loads it; loading a precompiled one would mean running native code the host cannot check.
-
A call through a module costs tens of microseconds, and loading one costs a fraction of a second at boot.
-
The tests of Georgia’s wire and rules leave this repository with the crates. CRAIG’s battery runs the mechanism on the reference partner, and the devstack suites and the journeys on the pinned Georgia layer’s modules.
-
The sandbox contains a mistake; it is not a boundary against the deployer. Each jurisdiction runs its own deployment and loads its own modules.
-
The same host can later serve supported extension points for waivers (#3202) and the plugin backend (#3074). Neither is designed here.
Open questions
-
How a module is granted a real SSA contract: #1433.
-
Whether CRAIG stays on wasmtime’s monthly releases or moves to its 24-month line, and whether Canopy and CRAIG follow one policy: #3203, before 1.0.
-
Delivery as a signed artifact that a layer pins by digest (#2959), and reloading a module without a restart (#2958).
Alternatives considered
-
CRAIG’s build pulls a jurisdiction’s crates, pinned by commit as the layers are. Rejected: CRAIG’s release would still carry the jurisdiction’s partners, so a wire change stays a CRAIG release.
-
A jurisdiction builds its own craig-exchange on CRAIG’s libraries. Rejected: a wire change is still a build and a release of a service binary; the jurisdiction needs a Rust build, images and a devstack of its own; and CRAIG’s battery could no longer run the deployment it tests.
-
Both at once: the jurisdiction releases, and CRAIG links its code for tests only. Rejected: two builds and two lockfiles to keep aligned, for the same compiled coupling.
-
A separate adapter service per jurisdiction. Rejected: a network hop and a second deployment inside every send.
-
Native dynamic libraries. Rejected: a statically linked musl executable cannot load one, and a native library runs with the host’s rights.
-
wasmi as the runtime. Rejected: it has no component model, so no WIT contract.
-
Build the module from the layer’s source at every fetch. Rejected: a Rust toolchain and a crate registry in every deployment, and a slower start.
-
An artifact the layer pins by digest. Not now: the registry and the signing it needs do not exist (#2959).
-
Commit the wrapped component. Rejected: the wrapping tool would join the build recipe and move with wasmtime.
-
Simulators stay native Rust that the jurisdiction builds. Not chosen, by ruling: a jurisdiction’s code would still be compiled into a CRAIG test binary.
-
wasmtime’s 24-month line. Set aside by ruling, for now; #3203 reviews it.
-
Ship craig-exchange and the mock server on glibc, or run modules on wasmtime’s interpreter, to leave the Tier 3 platform or its generated native code. Not chosen, by ruling.
Amendment — #3192 (2026-12-01): how the contract takes an addition
The decision above says an addition to the contract lands in CRAIG alone and a jurisdiction takes it when it next rebuilds. The person index (plan the person index) is the first addition, contract 1.1, and it fixes how every later one is made:
-
A minor version adds interfaces and changes none. A host and a module built at different minor versions are matched by their interfaces' names alone, so an interface, once published, is never edited within a major version. The contract as 1.0 published it is kept beside the host’s tests, and a test has wit-component’s own check compare it with the live contract (
no_published_interface_changed). -
The host requires what 1.0 exported and binds a later export only where a module has it. It asks the module first, so a module committed before the host learned of 1.1 loads unchanged and provides no person index (
a_module_built_for_1_0_provides_no_person_index; Georgia’s pinned 1.0 module, on every car, throughevery_pinned_layers_modules_load). -
A manifest that states a later minor than the host’s is refused, as another major is: such a module may count on an interface the host has never heard of (
a_newer_minor_refuses_boot). -
The SDK defaults what a later minor adds, so a jurisdiction’s source written for an earlier one builds against a later SDK as it stands.
That wasmtime resolves a module’s imports and finds its exports across the minor versions of one major was read in wasmtime 51’s source before the plan was approved and is exercised by the tests named here. A change to a published interface remains a breaking change and lands as the decision above says one does.
Canonical page: Partner modules, § Versions.