Plan: Medicaid and CHIP classes of assistance are pack data (#655)

Status: Done
Closes: #655
Epic: &128
Issues: #655 (parent) · #3419 U1 (w3) · #3420 U2 (w8) · #3421 U3 (w3) · #3422 U4 (w5) · #3423 U5 (w3) · #3424 U6 (w2); follow-up #3425 (the CHIP premium table's name); relates to #3415 (Slate A), #1961, #3373, #3264
Branches: refactor/medicaid-class-catalogue, refactor/medicaid-classes-from-pack, refactor/reporting-class-tmsis, refactor/medicaid-labels-from-pack, refactor/ele-chip-tier, docs/medicaid-classes

This is a Design + Scope plan: GitLab owns tracking, the child issues carry the implementer brief, and the plan freezes when U1 starts.

Erratum (2026-11-15): U1 adds no class rows to the fixture packs. Rows for today’s codes would add Georgia-named keys to both packs and raise two neutrality-allowlist counts, which only fall; the rows arrive in U2, in the change that removes the flat Georgia-named keys. U1’s tests build their packs in a temporary directory.

Erratum (2026-11-16): a limit may state the household it is sized on, { pct_fpl = 200, household = "magi" } (magi or full), on any shape resolved by household; absent, the track decides (magi and chip the MAGI household, non_magi the full household). whm is a non_magi class whose limit determine.rs computes on the MAGI household's guideline. The loader refuses an unknown value, naming the row and the limit, and refuses a household on a flat { amount } limit as a shape error, since a flat amount is sized on no household.

Erratum (2026-11-16): [[medicaid.classes]] is cited per row, not as one value: an array of tables registered as per-row-cited is keyed by each row's code, as medicaid.classes.<code>.limits.<name>, .values.<name>, .tmsis_group or .outside_tmsis_reason, each citation's value equal to the row's TOML value (a limit's is its inline table). code, label, track and benefit_type need none, and a citation of the whole array is an orphan. Every other array of tables keeps its single citation.

Erratum (2026-11-17): U4's neutrality outcome is larger than planned. The pack-identity counts of fixtures/config/default/citations.toml and fixtures/config/test-max/citations.toml fall from 28 to 2, and the decision-file entries U2 raised or added for class codes shared with Georgia (medicaid-magi.json, medicaid-non-magi.json, medicaid-denial-reasons.json, medicaid-eligibility-hierarchy.json and chip-eligibility.json in both fixture packs) are removed, as are the medicaid_labels.rs entries. The approval's class label rides the event as assigned_coa_label, which a pack's approved medicaid.determined routes must forward in program_data_keys: canopy-notices refuses an approval that names a class with no label.

Erratum (2026-11-17): the delivered branches are refactor/medicaid-class-catalogue, refactor/medicaid-classes-from-pack, refactor/reporting-reads-class-tmsis-group, refactor/medicaid-labels-from-pack, refactor/express-lane-chip-tier and docs/medicaid-classes-close.

Erratum (2026-11-17): U5, by maintainer ruling. [medicaid.express_lane] is optional: a pack without it grants and renews nothing, the age-out still runs, and canopy-medicaid refuses to start without the table while an active flag exists. The federal half is canopy-config-federal 631769c4.

Erratum (2026-11-17): U4 adds a key the plan did not foresee, by maintainer ruling. Nothing in a pack said which class is the section 1115 demonstration's, and the dev seed had Georgia's code built in. [medicaid.adult_demonstration] takes an optional class; an undeclared code refuses boot and is a pack-check finding.

Erratum (2026-11-17): Verification step 4 as delivered. The three enum entries and the test-max cascade-priority entry were cleared by rewording, not re-attributed; no #655 entry remains. Verification step 3's grep still finds, outside tests, comments citing Georgia as an example (canopy-notices config.rs, canopy-applications params.rs) and enum Manual in canopy-contracts-applications, which #2211 deletes.

Context

MedicaidCategory (crates/canopy-contracts-medicaid/src/categories.rs) and its display twin MedicaidCoa (crates/canopy-reference/src/medicaid_labels.rs) each list 38 classes of assistance. Nine are Georgia’s own: Pathways, P4hbFp/P4hbIpc/P4hbRm, Edwp, NowWaiver, CompWaiver, Icwp and the brand PeachCare. Everything downstream is fixed to that list:

  • services/canopy-medicaid/src/rules_client.rs requires the pack's decisions to return one boolean per class (37 on MagiOutput and NonMagiOutput, the 38th on ChipOutput, none defaulted, beside two optional spend-down amounts), and determine.rs maps each to a variant in eligible_fn.

  • services/canopy-medicaid/src/params.rs requires every pack to state pathways_*, p4hb_*, whm_*, tefra_max_age and the rest as flat [medicaid] keys.

  • determine_benefit_type and spend_down_for (determine.rs) branch on class names; track() and program() are Rust matches.

  • services/canopy-reporting/src/params.rs refuses boot unless [reporting.tmsis.eligibility_groups] maps every MedicaidCoa but Refugee.

  • services/canopy-notices/src/generator.rs parses a class code and a denial code into MedicaidCoa and MedicaidDenialReasonCode to print their labels, which name PeachCare and Pathways.

  • The Express Lane tier is peachcare in EleEligibilityTier, two SQL CHECKs and the federal ele-grant-2026.json / ele-renewal-2026.json; Georgia's two thresholds sit in the federal cross-program-2026.json.

The class columns are already plain text with no CHECK, the cascade order and the final pick are already pack decisions (medicaid-cmd-cascade-priority.json, medicaid-eligibility-hierarchy.json), and four vocabularies are already pack rows validated at boot ([[snap.certification.categories]], [[tanf.work_activities]], [[snap.adverse_action.reasons]], WIC adjunctive routes). This plan applies that pattern (ADR-006, ADR-003). It holds 37 of the 84 entries in compliance/neutrality-gate.toml and blocks the Texas pack (#3264).

Maintainer decisions taken for this plan (2026-11-15): the pack declares every class it runs and each row cites a federal T-MSIS eligibility group; a class's limits are typed shapes Rust resolves to dollars; labels, denial text and the Express Lane tier are in this plan.

Scope

In scope:

  • A class catalogue, [[medicaid.classes]], in each pack that enables Medicaid or CHIP, and its loader.

  • The decisions contract: decisions return the eligible class codes; class limits and values reach them through the context.

  • Deleting MedicaidCategory, MedicaidCoa and MedicaidDenialReasonCode; the flat per-class [medicaid] keys; [reporting.tmsis.eligibility_groups].

  • Class labels and denial-reason text from the pack, carried on the determination event.

  • The Express Lane tier chip, and its two thresholds from the pack.

  • A pack check for the catalogue in canopy-pack-check, so canopy config check reports it before a pin.

  • Fixture packs default and test-max; test-max ends with a class set that differs from Georgia's.

Out of scope:

  • TANF and intake vocabulary (#2210, #2211): their own plans.

  • [medicaid.peachcare_premiums] and the peachcare_premium_schedule table: a rename with its own migration (#3425). Erratum (2026-11-18): removed instead, since nothing read either (maintainer ruling on #3425).

  • services/canopy-medicaid/migrations/20260417000000_create_express_lane_evaluations.sql, whose CHECK names peachcare_eligible: the table was dropped by 20260606000000_drop_express_lane_evaluations.sql, and a shipped migration is not edited.

  • Writing Texas's Medicaid and CHIP: the canopy-config-texas agent's work, after this lands.

  • The content of the Georgia and federal repositories: their agents commit there; this plan states what canopy needs from each.

  • MedicaidBenefitType: its four values (full_medicaid, chip_standalone, qmb_supplement, family_planning_only) name no state and stay an enum.

Design

The catalogue

One row per class, in jurisdiction.toml:

[[medicaid.classes]]
code = "pregnant_women"            # [a-z0-9_]{1,64}; unique in the pack
label = "Pregnant Women"           # printed on letters
track = "magi"                     # magi | non_magi | chip
benefit_type = "full_medicaid"     # a MedicaidBenefitType code
tmsis_group = "05"                 # a code of the federal tmsis-eligibility-groups.json
# outside_tmsis_reason = "…"       # instead of tmsis_group, for a class outside Title XIX/XXI

[medicaid.classes.limits]          # optional; name -> one typed shape
income = { pct_fpl = 220 }

[medicaid.classes.values]          # optional; name -> integer, passed through

A limit is exactly one of: { pct_fpl = N }; { by_household_size = [..], each_additional = N }; { amount = N }; { individual = N, couple = N }. Rust resolves each to monthly dollars for the member: pct_fpl against the poverty guideline, and both size-based shapes by household size, using the MAGI household for magi and chip tracks and the household for non_magi, as determine.rs does today. A class may carry several named limits (Texas's one-parent and two-parent tables are two names on one row).

crates/canopy-reference/src/medicaid_classes.rs (new) holds ClassCode (a validated newtype over String), ClassRow, ClassLimit and ClassCatalogue::load(&ConfigSnapshot) → Result<Self, ClassCatalogueError>, a thiserror enum. The load refuses, naming the row: a duplicate or malformed code; an unknown track or benefit_type; a row with both or neither of tmsis_group and outside_tmsis_reason; a tmsis_group the federal file does not list; a chip track whose group is not among the file's separate_chip_codes; a limit that is not exactly one shape; an empty catalogue when [jurisdiction].enabled_programs names medicaid or chip. canopy-medicaid and canopy-reporting call it at boot and refuse to start on an error. program is derived: chip track is CHIP, anything else Medicaid.

Every row's keys are cited in citations.toml, as every pack key is.

The decisions contract

medicaid-magi, medicaid-non-magi and chip-eligibility each return:

  • eligible_classes: an array of class codes;

  • spend_down: an object of class code to monthly amount, for the classes that have one (may be empty).

Nothing else is read from them: the denial_reasons member they emit today is not in MagiOutput, NonMagiOutput or ChipOutput. Per-class denial reasons come from the fourth decision, medicaid-denial-reasons, whose input and output keep their shape; its context changes with the others, from the flat DenialReasonsThresholds to classes.

Their context gains classes: for each catalogue row, classes.<code>.limits.<name> (resolved dollars) and classes.<code>.values.<name>. The thresholds object keeps only values that belong to no class (TmaPhaseThresholds.phase_1_months). Inputs gain what Rust decided by class name until now: is_pregnant on the non-MAGI input; tma_phase_has_start and tma_phase_income_test_required on the MAGI input; and net_countable_income_before_disregard beside net_countable_income, so a pack can test a group that takes no 5% disregard (42 CFR 435.603(j)) without Rust knowing which. p4hb_subtype (crates/canopy-contracts-medicaid/src/determine.rs) is renamed family_planning_subtype on the determine body and the MAGI input: it is a fact about the applicant's request that only a pack's decision interprets.

canopy-medicaid unions the three eligible_classes lists. A code no catalogue row declares fails the determination with an internal error naming the code and the decision, as an unknown cascade code does today (resolve_priority_order). The cascade-priority and hierarchy decisions keep their shape; their codes are held to the catalogue the same way. MagiOutput, NonMagiOutput, ChipOutput, the per-class threshold structs (DenialReasonsThresholds among them), eligible_fn, spend_down_for and determine_benefit_type are deleted; benefit type, track and spend-down come from the row and the spend_down object.

MedicaidCategory is replaced by ClassCode in every file that names it; rg -l MedicaidCategory crates services tools --glob '*.rs' is the list (22 files, tests included; the two canopy-web hits are an unrelated template struct of the same name and do not change). [medicaid.cooperation]'s two exempt lists are validated against the catalogue. [medicaid.adult_demonstration] becomes optional: its loader in services/canopy-medicaid/src/demonstration_activity.rs returns None for an absent table instead of an error, an absent table means no demonstration, and demonstration_activity_met is sent false. The flat keys the per-class limits replace are removed from MedicaidParameterTable; keys that are not per-class (cmd_clock_days, cmd_escalation_warning_days, chip_program_name) stay.

Reporting

canopy-reporting reads each row's tmsis_group from ClassCatalogue. [reporting.tmsis.eligibility_groups], OUTSIDE_TMSIS and the every-MedicaidCoa check are deleted; a row with outside_tmsis_reason is filtered from the extract as refugee is today.

Labels and denial text

The pack gains [[medicaid.denial_reasons]] rows { code, display_text }. CoaDenialReason (services/canopy-medicaid/src/events.rs) becomes { coa_code: String, coa_label: String, reason_code: String, reason_text: String }, and the determination event carries the assigned class's label; canopy-medicaid fills them from the catalogue and the reason table when it decides, so a letter prints what was true then. A reason code with no row fails the determination, as an unrecognised code does today (unknown_denial_code_refusal, reached from typed_coa_denial_reason and signed_denial_codes in determine.rs). The codes canopy itself emits (medicaid_eligible, the cooperation, residency and demonstration codes) are one const list in canopy-medicaid, and boot refuses a pack that gives any of them no text. canopy-notices prints the carried strings and stops parsing; MedicaidCoa and MedicaidDenialReasonCode are deleted.

Express Lane

EleEligibilityTier::Peachcare becomes Chip, wire token chip, with no alias. A migration replaces both live CHECKs (20260605000001_create_ele_status.sql, 20260605000002_create_ele_grant_events.sql) with IN ('medicaid','chip') and updates ele_status. ele_grant_events is hash-chained over the tier (ele_audit.rs), so its rows cannot be rewritten: the migration raises, naming the re-seed, when that table holds a peachcare row. express_lane.medicaid_fpl_pct and peachcare_fpl_pct leave the federal cross-program-2026.json for the pack's [medicaid.express_lane] medicaid_income_limit_pct_fpl and chip_income_limit_pct_fpl; max_age and grant_months stay federal. ExpressLaneParams and the two rules-client fields are renamed to match.

The pack check

canopy-pack-check gains Check::MedicaidClasses, run by check_pack and by cargo xtask rules check per pack: the catalogue loads; every code in the pack's cascade-priority and hierarchy decisions and in the cooperation lists is a declared class; every "o-reason" literal of medicaid-denial-reasons.json has a [[medicaid.denial_reasons]] row (from U4). It reads files only.

What the other repositories must publish

  • canopy-config-georgia, one commit before U2: [[medicaid.classes]] for its 38 classes with labels, tracks, benefit types, T-MSIS groups, limits and values; the three decisions rewritten to the new contract; the flat per-class keys removed; [[medicaid.denial_reasons]]; [medicaid.express_lane]. Keys canopy has not started reading are inert until the unit that reads them.

  • canopy-config-federal, one commit before U5: the two ELE decisions emit chip; the two thresholds removed from cross-program-2026.json.

  • canopy-config-georgia, after U5: [reporting.tmsis.eligibility_groups] removed.

Each canopy unit that needs one carries the pin bump in its own merge request, so its car tests code and pack together; canopy main keeps the old pin until then.

Units (weights by complexity) — U1 → U2 → U3 ‖ U4 → U5 → U6

Weights: 1 trivial · 2 small · 3 medium · 5 large · 8 very large. One unit = one independently shippable MR = one child issue.

compliance/neutrality-gate.toml counts matches per file exactly, so every unit also edits it for the files it touches: an entry falls or goes with the code, and none is raised.

U1 (w3) — the catalogue type, loader and fixture rows

Files: crates/canopy-reference/src/medicaid_classes.rs, crates/canopy-reference/src/lib.rs, fixtures/config/{default,test-max}/{jurisdiction,citations}.toml.

ClassCode, ClassRow, ClassLimit, ClassCatalogue::load and limit resolution. The fixture packs gain rows for the 38 current codes (the same codes as Georgia, so nothing else changes yet). No service calls the loader. Tests: unit, one per refusal above with the row named; property, ClassCode round-trips and rejects anything outside its alphabet without panicking; unit, each limit shape resolves to the dollars determine.rs computes today for the same inputs.

U2 (w8) — canopy-medicaid decides from the catalogue

Files: every file rg -l MedicaidCategory lists (above), with crates/canopy-contracts-medicaid/src/categories.rs deleted; services/canopy-medicaid/src/{rules_client,params,events,demonstration_activity}.rs; crates/canopy-contracts-medicaid/src/determine.rs; crates/canopy-pack-check/src/ (the new check); the four decisions (medicaid-magi, medicaid-non-magi, chip-eligibility, medicaid-denial-reasons) in both fixture packs, crates/canopy-test-lib/fixtures/rulesets/medicaid-*.json and chip-eligibility.json, config-sources.lock, compliance/neutrality-gate.toml.

The decisions contract, the context, ClassCode in place of the enum, the removed flat keys, the pack check, and the Georgia pin bump. Fixture class codes stay a subset of Georgia's until U4, because the event still types the code as MedicaidCoa. Tests: contract, the exact context and output JSON of each decision; regression, every existing canopy-medicaid determination test passes with unchanged verdicts, classes, tracks, benefit types and spend-downs; unit, an undeclared code from a decision fails the determination naming it; unit, a pack with no [medicaid.adult_demonstration] boots; regression, the pack check finds a cascade code with no class row.

U3 (w3) — reporting reads the class's T-MSIS group

Files: services/canopy-reporting/src/params.rs, services/canopy-reporting/src/worker/medicaid.rs, fixture packs.

Tests: regression, the T-MSIS and CMS-64 extracts for the existing fixtures are unchanged; unit, a class with outside_tmsis_reason is filtered and counted.

U4 (w5) — labels and denial text from the pack

Files: services/canopy-medicaid/src/{events,determine}.rs, services/canopy-notices/src/generator.rs, crates/canopy-reference/src/medicaid_labels.rs, crates/canopy-pack-check/src/, fixture packs, notice templates that read the class or reason label.

test-max drops the Georgia demonstration and waiver classes and renames its CHIP class, so the corpus runs a class set that is not Georgia's. Tests: contract, the event's wire shape; regression, a default and a test-max CHIP denial letter contain neither "PeachCare" nor "Pathways"; regression, a Georgia letter renders the same class and reason text as before; unit, boot refuses a pack with no text for a canopy-emitted code; regression, the pack check finds a decision reason with no row.

U5 (w3) — the Express Lane tier and thresholds

Files: crates/canopy-contracts-medicaid/src/ele.rs, crates/canopy-reference/src/cross_program.rs, services/canopy-medicaid/src/{main,scheduler,rules_client}.rs, services/canopy-medicaid/src/store/ele.rs, a new migration under services/canopy-medicaid/migrations/, fixtures/config/test-federal/{cross-program-2026,ele-grant-2026,ele-renewal-2026}.json, crates/canopy-test-lib/fixtures/rulesets/ele-*.json, config-sources.lock, OpenAPI snapshots.

Tests: contract, the tier's wire token; regression, a child between the pack's two thresholds is granted the CHIP tier under test-max's own limits (today it is skipped); integration, the migration on a schema with a peachcare row in ele_grant_events raises and on one without succeeds.

U6 (w2) — documentation and the close

Files: docs/modules/ROOT/pages/{rulesets,jurisdiction-onboarding,shared-crates,services}.adoc, docs/modules/ROOT/pages/api/{canopy-medicaid,canopy-reporting,canopy-notices}.adoc, docs/modules/ROOT/pages/data-models/canopy-medicaid.adoc, docs/modules/ROOT/pages/adrs/adr-006-jurisdiction-agnostic-ruleset-organization.adoc (an amendment recording the class catalogue), compliance/neutrality-gate.toml, and the doc comments Verification step 4 names (crates/canopy-reference/src/enums.rs, crates/canopy-reference/src/medicaid_labels.rs, services/canopy-applications/src/domain.rs).

Each earlier unit updates the pages its change touches; this unit writes the catalogue's reference section and the amendment, removes the onboarding page's Medicaid caveat, and sets the Status.

Erratum (2026-11-16): the neutrality gate rises in U2 for the fixture packs, by maintainer ruling, where the contract puts a class code on a line that had none: pack-identity in fixtures/config/{default,test-max}/citations.toml 19 to 36 (per-row class citations), medicaid-magi.json 15 to 16 and medicaid-non-magi.json 6 to 7 in both packs, and a new entry of 1 for fixtures/config/default/chip-eligibility.json; the two jurisdiction.toml entries fall 19 to 18. Each falls when #3422 gives the fixture packs neutral codes.

Risks

  • A class the pack forgot is never evaluated — silent. A decision can return only declared codes, and a cascade or hierarchy code with no row is a pack-check finding and a refused determination, so an omission surfaces on the pin's car and in canopy config check.

  • A decision returns a code the catalogue lacks — fail-closed. The determination fails naming the code; nothing is assigned.

  • A limit resolves to different dollars than today — silent. U1's equivalence test pins each shape to today's arithmetic, and U2's regression tests hold every existing verdict.

  • Georgia's rewritten decisions differ from the old ones — silent. U2's car runs the Georgia scenario and determination suites against the new pin; verdicts must not move.

  • A letter prints no reason — fail-closed. A reason code with no text refuses the determination and, for canopy's own codes, the boot.

  • A re-rendered old letter loses its label — silent. Labels are carried on the stored event, not looked up at render; U4's Georgia regression test covers a render from a stored event.

  • The tier migration meets chained peachcare rows — fail-closed. It raises and names the re-seed; the chain is never rewritten.

  • canopy and a config repository land out of step — fail-closed. The pin moves in the unit's own merge request; a pack of the wrong shape fails that car, and main keeps the old pin.

  • T-MSIS reports a class under the wrong group — silent. The group is validated against the federal list at boot, and U3's extract regression holds the existing output.

Verification

  1. cargo xtask test --unit passes before each push; the merge train's pipeline is the gate for the rest (CI is the gate).

  2. After U2: canopy config check on the Georgia working copy exits 0, and with one class row deleted exits 1 naming the cascade code.

  3. After U5: rg -i "peachcare|pathways|p4hb" crates services tools --glob '*.rs' finds only tests that use Georgia's pack as data, comments citing Georgia as an example, and the premium-schedule code this plan leaves (Out of scope).

  4. After U6: cargo xtask neutrality-lint passes with no issue = "#655" entry left in compliance/neutrality-gate.toml. U2, U4 and U5 remove the entries for what they delete. U6 settles the five on surfaces this plan keeps: MedicarePartABasis, CmdEventType and MedicaidStandard are federal mechanisms flagged for a doc comment, which U6 rewords; MedicaidBenefitType's comment likewise; and the family_planning_subtype rename clears the fifth. An entry the lint still needs after that is re-attributed to the issue that owns it, with its reason, never left on #655.

Documentation Updates

  • rulesets.adoc — [[medicaid.classes]], [[medicaid.denial_reasons]], [medicaid.express_lane] (canonical page for the pack shape)

  • api/canopy-medicaid.adoc, api/canopy-reporting.adoc, api/canopy-notices.adoc, data-models/canopy-medicaid.adoc, services.adoc

  • shared-crates.adoc — medicaid_classes and the pack check

  • jurisdiction-onboarding.adoc — the Medicaid caveat removed

  • ADR-006 — an amendment

  • CHANGELOG.adoc — an entry under == Unreleased in each unit's MR; U2, U4 and U5 are breaking changes to the pack shape and the wire

  • Close: U6's MR says Closes #655; the Status is set to Done and the merge SHA noted on #655; #1961 and #3373 are closed or re-scoped against what landed

Review log

round vendor resolved model verdict

1

anthropic

claude-fable-5-2

FLAGS — three seams contradicted the tree (the denial-code refusal's name, the demonstration loader's file, a third peachcare CHECK in a dropped table); corrected before approval

2

google

gemini-4-carbon

FLAGS — the three decisions return no denial_reasons and a fourth decision's context was missed; five #655 neutrality entries sit on kept surfaces; a verification grep could not pass when stated; corrected before approval

Edit this page · default