Plan: State reference data loads from config bundles (config-git-source U5)
Status
Done (2026-11-15) — state reference data loads from each jurisdiction’s bundle/ config files; the compiled state crates are gone, craig-partners-ga keeps the Georgia adapters, and the first train car booted the stack on the new wiring green.
Closes: #2956 (epic &121). Parent: config-git-source, § State reference data (U5) and scope row U5.
Branch: feat/config-bundle. Tree: written against origin/main (2026-11-14).
Notes on: #2297, #2328, #1797, #2306, #1930 (see § Delivery).
A Design + Scope plan. It freezes when work starts; a deviation is a one-line erratum.
Context
Today a jurisdiction is a compiled crate. crates/craig-state-bundle/src/bundle.rs defines the StateBundle trait (16
methods); crates/craig-state-ga/src/lib.rs and crates/craig-state-tx-stub/src/lib.rs implement it with Rust
literals (the 16 include contribute()). Ten consumers (craig-cases, -financial, -placement, -exchange, -reporting,
-intake, -web, -security, craig-seed, craig-mock-server) link the crates behind state-ga / state-tx-stub features,
and crates/craig-state-bundle/src/activation.rs picks one from CRAIGACTIVE_STATE_BUNDLES. Each service also reads
CRAIG_<SVC>JURISDICTION. Changing a Georgia rate or holiday is a source change and a release.
U1 to U4 of the parent plan moved rulesets and policy to signed config repositories, read through
crates/craig-config/src/snapshot.rs (ConfigSnapshot: layered resolve, highest layer wins, absent is Ok(None)).
U5 does the same for the bundle data. Only code stays in source: the eleven Georgia partner adapter factories.
Three statements in the parent plan are stale and are corrected here, not there: no audit codecs exist any more; mock
routes already live in crates/craig-state-ga-mock; and the outbound trigger matrix is data (ruling F4). Georgia tables
in craig-reference and the SHINES backend in craig-intake are in no U5 text and stay.
Rulings this plan implements (maintainer, 2026-11-11 to 2026-11-14, on #2956)
| Id | Ruling |
|---|---|
F1 |
No |
F2 |
|
F3 |
Enum spellings are snake_case: |
F4 |
The outbound trigger matrix moves to |
V1 |
No rate-class file means the code default |
X2 |
A jurisdiction without an AFCARS crosswalk boots; AFCARS export refuses for it. |
R1 |
|
R2 |
The business clock reads a set-once process registry installed at boot from the loaded bundle. |
R3 |
One CRAIG MR. The config repositories merge their bundle data first; the MR carries the pin bump. |
R4 |
A retired variable still set in a deployment is ignored silently. |
R5 |
The Texas palette moves to the Texas config repository as explicit values. |
R6 |
The mock server serves every compiled partner mock and reads no config. |
R7 |
The feature matrix shrinks to craig-exchange and craig-mock-server, with and without the Georgia partner crate. |
R8 |
A new verb, |
R9 |
craig-seed skips the AFCARS policy rows when the jurisdiction has no crosswalk, and says so. |
Design
D1. ConfigBundle (new crate crates/craig-config-bundle)
Depends on craig-config, craig-state-bundle, craig-reference, serde, toml, thiserror; craig-state-bundle
keeps no runtime toml.
-
ConfigBundle::check(&ConfigSnapshot) → Vec<BundleError>parses and validates everybundle/file and returns every error it finds, not the first.ConfigBundle::load(&ConfigSnapshot) → Result<&'static ConfigBundle, BundleErrors>runscheck, refuses on any error, and leaks the result once (R1). It implementsStateBundle;name()andjurisdiction_code()both return the manifest’s jurisdiction. (Today Texas’sname()is"tx-stub"; the name was only the activation key, which goes.) -
Schemas. Each file’s keys are the fields of the spec type it fills, in snake_case, as the Georgia and Texas drafts (Draft MR !3 in each config repository) already spell them, with the corrections of § Scope step 2. A file holding a list is an array of tables named for the file (
,); a map is one table ([federal_mapping]);settings.tomlis top-level keys. The implementer writes the structs first and the testonia fixture from them; the fixture is then the worked example of every file. -
Each file is its own
#[serde(deny_unknown_fields)]struct.BundleErroris athiserrorenum whose variants name the layer, file and key. -
snapshot.list("bundle")is compared with the known file set: an unknown file name is an error, so a misspeltfmap_rate.tomlis refused instead of reading as "no FMAP". -
Validation is structural: parse, enum membership, duplicates, and cross-file references (the Medicaid identifier kind must be a declared identifier kind; a terminology manifest entry must name an existing
.ftl). Semantic checks stay with their consumers (FMAP ordering in craig-cases, UAS windows in craig-financial). -
The high-contrast palette merge now done in
crates/craig-state-bundle/build.rsbecomes one function bothbuild.rsand the loader call.
D2. The bundle/ file map
An absent file means exactly today’s trait default.
| File | Trait item | Absent means |
|---|---|---|
|
|
|
|
names resolved against the compiled catalog (D3) |
no adapters |
|
extras over the product taxonomy |
the 14 product types (F1); a product token in the file is a duplicate error |
|
|
empty |
|
|
empty |
|
|
the product default palette |
|
|
no overlay |
|
|
none |
|
|
none |
|
|
|
|
|
|
|
the same-named methods |
empty |
|
|
empty |
|
|
empty |
D3. What stays code
-
crates/craig-state-gais renamedcrates/craig-partners-gaand exports onlypub fn adapters() → Vec<(&'static str, ErasedAdapterFactory)>.crates/craig-state-ga-mockis renamedcrates/craig-partners-ga-mock, content unchanged.crates/craig-state-tx-stubis deleted withcrates/craig-state-bundle/theme/tx-stub.tomlandtx_stub_palette()(R5). -
craig-exchange keeps one feature,
partners-ga(default on), and builds its adapter catalog from the compiled crates inservices/craig-exchange/src/bundle_orchestrator.rs. A name inadapters.tomlthe catalog lacks refuses boot; ashinesentry still refuses. -
The other consumers lose the
state-*features, the optional dependencies and theircandidate_bundles()wrappers.activation.rsand thecandidate_bundles!macro are deleted. -
xtask/src/cmd/feature_matrix.rs(R7):FEATURE_MATRIX_CRATESbecomes craig-exchange and craig-mock-server, andJURISDICTION_FEATURESbecomes the one featurepartners-ga, checked on and off. craig-mock-server gets the samepartners-gafeature (default on) gating itscraig-partners-ga-mockdependency, and serves every route of the mocks it compiled (R6). InPLUGIN_AXIS_CHECKSthe two craig-web rows collapse to one,("craig-web", "plugin-example,plugin-ssa-screening"); the craig-composition row is unchanged.
D4. Jurisdiction, settings and the clock
-
ConfigSnapshot::load(env)loses its jurisdiction argument andConfigError::JurisdictionMismatchgoes: the manifest is the only source. Every place that readssettings.jurisdictionreadssnapshot.jurisdiction().ServiceSettings.jurisdiction(crates/craig-common/src/settings.rs) is removed as an env key. No code readsCRAIGACTIVE_STATE_BUNDLESorCRAIG_<SVC>JURISDICTION; one still set is ignored (R4). -
Readers outside
ServiceSettings, all moved to the snapshot:IntakeSettings.jurisdiction(services/craig-intake/src/config.rs); the cases gate (services/craig-cases/src/gate_hooks.rs) and the scheme-rewrite tool (services/craig-cases/src/scheme_rewrite/mode.rs), which load the snapshot fromCRAIG_CONFIG_SOURCEinstead of the two variables;xtask/src/cmd/rewrite_scheme.rs, which selects Texas by passing the Texas source list; and the env lists inxtask/src/registry.rs. -
Every bundle consumer loads a snapshot at boot, so each needs
CRAIG_CONFIG_SOURCE, the config volume and thecraig-config-fetchdependency indocker-compose.ymlanddocker-compose.cluster.yml(today only placement, composition, rules and seed have them). The threecraig-intake-standalone*services get the same Georgia source list and volume ascraig-intake;craig-intake-txgets the Texas source list. The compose anchors*active_state_bundlesand*jurisdictionare deleted with their uses. -
The link-time timezone slice in
crates/craig-common/src/clock.rs(declare_business_timezones!) is replaced by a set-once registry (OnceLock), installed at boot from the bundle before the router is built (R2). Installing a different zone for an installed jurisdiction is an error.BusinessClock::for_jurisdictionandtry_for_jurisdictionkeep their signatures, so their 196 call sites do not change. Undercfg(test)and for integration tests,craig-test-libinstalls the Georgia and Texas zones.
D5. Tests' source of bundles
-
fixtures/config/testonia/bundle/: a complete fixture bundle, one file of every kind, with an explicit palette. Tests that must run with no fetched config use it. -
craig_test_lib::configgains a helper returning theConfigBundleof a named layer, cached one per layer per process (bounds the R1 leak). The roughly 59 call sites that passSome("georgia")orSome("tx-stub")to a*_forboot function use it. -
Georgia-specific tests in the old crate (FMAP citation tether, legal statuses against the DOE wire, trigger legs) move to
craig-partners-gaorcraig-config-bundleand read the locked Georgia layer. Fake bundles in craig-financial and craig-exchange tests are unchanged: the trait stays. -
The contrast test (
crates/craig-state-bundle/tests/data/contrast-pairs.toml) runs over the product palettes, the locked Texas layer’s explicit palette and the testonia fixture.
D6. cargo xtask config check-bundle <dir> (R8)
Builds a working-copy snapshot over the directory (ConfigEnv::working_copy), runs ConfigBundle::check, and prints
every error with file and key; exit 1 on any. The config repositories' agents run it from this branch before they merge.
D7. Seed (R9)
tools/craig-seed/src/afcars_policy.rs stops hardcoding Georgia: it resolves <jurisdiction>-afcars-crosswalk.json
(the existing naming rule, with the snapshot’s jurisdiction) from the snapshot; when the file is absent it writes no
AFCARS policy rows and logs one line naming the jurisdiction.
Scope and order (one MR, R3)
-
On
feat/config-bundle: D1, D2, D5’s fixture and D6. Push the branch, unarmed. -
The Georgia and Texas config agents re-transcribe their Draft MR !3 against D2 from current CRAIG main (the drafts predate it): file names as D2, no
name/jurisdictionkeys, no product partner types (F1), Georgia addsoutbound_triggers.toml(F4), Texas adds explicit palette values (R5). Texas adds no FMAP: its bundle equals what the stub compiles in, and #2328’s data is a later Texas-repository change with its own pin bump. Each runscheck-bundlefrom the branch and merges. -
On the branch: bump
config-sources.lock; add a golden test comparingConfigBundlewithGeorgiaBundleandTxStubBundleitem by item; run it and record its output in the MR. The one declared difference is Texas’sname()("texas"loaded,"tx-stub"compiled), asserted as exactly that pair. -
On the branch: D3, D4, D7; delete the compiled bundles and the golden; add the locked-layer tests of § Tests; compose, xtask plumbing, docs.
-
Arm the MR. Main is untouched until it merges.
Out of scope: craig-reference Georgia tables; the SHINES backend; #2297’s third criterion; #1797 and #2306 (they
follow this unit); a Texas devstack profile (U6); rewriting Georgia mentions in prose.
Risks
| Risk | Class | Mitigation, and the test that pins it |
|---|---|---|
A misnamed or missing file reads as "empty" where the compiled bundle had data. |
silent |
An unknown file under |
The golden passes because both sides are empty, or skips an item. |
silent |
The golden enumerates the trait’s items by name from one list a second test holds equal to the trait’s method set, and asserts Georgia’s non-empty counts before comparing. |
The config repositories' pipelines pin an older CRAIG; a new |
fail-closed |
Their merge is blocked, not CRAIG’s main. The agent reports the failing job before changing anything; the fix is a |
A retired variable is still read somewhere and silently changes behaviour. |
silent |
|
The golden exists only inside the branch (R3), so main never runs it. |
silent |
Its output is recorded in the MR; the locked-layer tests above stay and run in every car. |
A config value drifts from a product enum or the partner wire. |
fail-closed |
Enum parse refuses an unknown token ( |
A jurisdiction boots with no holiday calendar or FMAP. |
fail-closed |
Consumers' existing typed refusals stay. |
|
fail-closed |
craig-exchange refuses at boot ( |
A trigger row names an unregistered adapter (F4). |
fail-closed |
The existing exchange boot check, now fed from config ( |
The clock registry is not installed, so dates run on UTC. |
silent |
Boot installs before the router. |
Two installs race or disagree. |
fail-closed |
|
A retired variable left in a deployment is ignored and the operator believes it applies (R4, accepted). |
silent |
Accepted by ruling. The release note names both variables as no longer read. |
Tests need fetched config a fresh checkout lacks. |
fail-closed |
|
The pin moves before a config repository carries a valid bundle. |
fail-closed |
The order in § Scope; |
A service that never loaded config before now fails to boot without |
fail-closed |
The compose changes of D4; the car boots the full devstack. The release note states the new requirement. |
Leaked bundles grow in a test process. |
silent |
The helper caches one per layer ( |
Tests
| Category | Tests | Devstack |
|---|---|---|
Contract (schema) |
Per file: unknown key, unknown enum token, wrong type, duplicate; unknown file; missing |
no |
Contract (defaults) |
|
no |
Golden (branch only) |
Loaded Georgia and Texas equal the compiled bundles on every item. |
no (needs the fetch) |
Regression |
Seed SQL byte-identity ( |
no (needs the fetch) |
Boot refusal |
Schema error; unknown adapter; |
no |
X2 |
|
service-level; the first may need the devstack |
Concurrency |
The clock registry install test above. |
no |
Property |
Round-trip and no-panic for the identifier-format and palette parsers ( |
no |
|
Exit 0 on the testonia fixture; exit 1 naming file and key on a planted error. |
no |
Every new test gets a red proof. Devstack-gated tests are compiled locally and run by the car.
Delivery
-
Canonical page:
docs/modules/ROOT/pages/shared-crates.adoc(the state crates' new shape, the file map). -
Also updated for the retired settings and features:
configuration-reference.adoc,deployment-guide.adoc,local-dev.adoc,devstack.adoc,quality-gates.adoc(feature matrix),testing-reference.adoc,multi-jurisdiction-extensibility.adoc,cli.adoc(config check-bundle). -
ADR-072 amendment (a dated section): Tier 2’s home becomes config bundle data under
bundle/in the jurisdiction layer, boot-resolved, fail-closed, stamped by the layer SHA; partner adapters stay source, selected byadapters.toml; the set-once clock registry is recorded as accepted global state (R2). -
Parent plan: one erratum line (the stale "codecs, mock routes, triggers").
-
CHANGELOG entry: the release-note fragment
changelog.d/2956.changed.adoc(folded intoCHANGELOG.adocat the release), pre-1.0 BREAKING. Ops:CRAIG_CONFIG_SOURCEis required by every service;CRAIGACTIVE_STATE_BUNDLESandCRAIG_<SVC>JURISDICTIONare no longer read; thestate-gaandstate-tx-stubfeatures are gone. -
Close:
Closes #2956; after merge, one line with the merge SHA and the car’s evidence. Notes on #2297 (criteria 1 and 2 mooted, 3 not done), #2328 (not done here: the data is now a Texas-repository change, the cases test a source change), #1797 and #2306 (unblocked), #1930.
Notes
-
crates/craig-policy/src/bundle_ref.rsis a pure parser ofbundle:<method>[<entry>]refs and needs no change; its tether is the FMAP citation test that D5 moves. -
Departure from the triage note on #2956, which folded #2328’s Texas FMAP into this unit: it is left out so the Texas bundle equals the stub and the golden has one declared difference. For the maintainer to confirm.
Errata
-
Erratum (2026-11-14):
craig-config-bundlealso depends onserde_path_to_error(already a workspace dependency), so a parse error names its key. -
Erratum (2026-11-14): the loader refuses four more structural faults than D1 lists: a theme with neither a palette name nor values; a catalog outside
terminology/<lang>/for its own language; a field surface the product has no roster for; a high-contrast override of a token its base mode lacks. -
Erratum (2026-11-14): the § Notes line calling the #2328 omission a departure from the triage note is wrong. The note says to do #2328 after this unit, as a Texas-repository change plus a cases test, which is what this plan does.
-
Erratum (2026-11-15): D4 is wrong that craig-rules already has
CRAIG_CONFIG_SOURCE; for craig-rules the variable’s presence was the config-managed switch. craig-rules now always loads a snapshot, and a new setting,CRAIG_RULES__RULE_SET_AUTHORITY(config, the default, orapi), says who owns the rule sets. The devstack setsapi. ADR-087 is amended with the docs of this unit. -
Erratum (2026-11-15): the clock registry (R2) gives tests their zones through a test-only
test-zonesfeature of craig-common that craig-test-lib enables, not through an install call in craig-test-lib. -
Erratum (2026-11-15): the cluster rig (
docker-compose.cluster.yml) gets no fetch service and no named volume, which that rig forbids: its two services bind-mount the fetchedtarget/configread-only, andcargo xtask cluster-testsfetches the locked layers before it brings the rig up.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic |
vertex-anthropic/claude-fable-5-2 (cold read) |
FLAGS (2): a risk stated in prose; the golden contradicted |
2 |
vertex-gemini/gemini-4-carbon |
FLAGS (2): #2328’s FMAP bundled in; undeferred scope questions, missing readers and matrix rows, multi-error |
Approved by the maintainer on 2026-11-14, after both rounds were folded.