Plan: the orchestrator sends WIC each member’s certifications in other programs (#2365)
Status: Done (2026-11-13) — both units merged; a certification decided in the same run is #3383
Closes: #2365
Epic: &106
Issues: #2365 (parent) · #3381 U1 (w3) · #3382 U2 (w5) · #3383 follow-up (same-run certifications)
Branches: feat/snap-certified-members-read, feat/wic-adjunctive-certifications
Erratum (2026-11-13): U1's admission is a constant beside its handler (CERTIFICATION_READER, as the operation-envelope read's OPERATION_MINTER), not a row of crates/canopy-auth/src/delegated.rs, which lists only routes a user's delegation reaches; the handler is its own file, certified_members_handler.rs, which also holds excluded_person_ids (the route-module and function-length budgets).
Erratum (2026-11-13): U2's regression test is services/canopy-eligibility/tests/wic_adjunctive_journey_test.rs, beside the stand-in tests rather than in them, since it runs against the real services. The stand-in tests are a module of the member_facts_test crate (tests/member_facts/adjunctive_certifications.rs), sharing its stand-ins, so no new crate-level lint header is added.
This is a Design + Scope plan: GitLab owns tracking, the child issues carry the implementer brief, and the plan freezes when U1 starts.
Context
7 CFR 246.7(d)(2)(vi)(A) makes a WIC applicant income-eligible without an income test when the applicant (1) is certified as fully eligible for SNAP, or fully or presumptively eligible for TANF or Medicaid, or (2) is a member of a family certified for TANF, or of a family in which a pregnant woman or an infant is certified for Medicaid. Paragraph (B) lets a State add its own programs.
canopy-wic already resolves all of these routes (AdjunctiveRoutes::resolve, services/canopy-wic/src/adjunctive.rs) from WicParticipantContext.adjunctive_certifications (crates/canopy-contracts-wic/src/determine.rs), reading the federal routes file (wic-adjunctive-routes.json) and the pack’s [wic].adjunctive_programs. It records the route that applied.
The orchestrator’s WIC mapper sends an empty list for every participant (participant, services/canopy-eligibility/src/mappers/wic.rs). So an orchestrated run always applies the income test, and can deny a participant the regulation makes eligible. The action-catalogue row wic.certification.adjunctive-enrollment-verification is unbound (compliance/action-catalogue/wic.toml, allowlisted in compliance/action-coverage-allowlist.toml).
The pattern to extend is the SNAP member facts of services/canopy-eligibility/src/member_facts.rs: the household’s newest TANF determination in force on as_of, then canopy-tanf’s family-composition read for who is in the grant (tanf_determination_in_force, read_tanf_grant).
Two facts constrain the design:
-
canopy-eligibility’s SNAP and TANF rows are household-level (
ProgramDetermination.person_idisNULL,services/canopy-eligibility/src/store/models.rs); Medicaid, CHIP, CAPS and WIC rows are per person.list_latest_determinations_by_household(services/canopy-eligibility/src/store/mod.rs) keeps one row per program, so it cannot answer a per-person question. -
Who a SNAP determination certified is known only to canopy-snap: the members are in its snapshot, and a member excluded by a work sanction is recorded in the snapshot’s sealed
program_input.work_sanction(ExclusionRecord,services/canopy-snap/src/work_sanction.rs), which canopy-eligibility cannot open.
canopy has no presumptive determination in any program.
Decisions (approved by the maintainer, 2026-11-13)
D1. "Certified" is a recorded determination in force. A member holds a certification in a program when the newest determination for that subject in that program is approved, effective on or before as_of, and not expired by it: the #3310 test, not an enrollment row.
D2. A SNAP certification is held by the members that determination certified. canopy-snap serves them: a new read answers the person ids of a determination’s snapshot members less its recorded work-sanction exclusions. A request member not in that answer (a newborn, a new member, a sanctioned member) holds no SNAP certification.
D3. Every program is reported, by slug. The orchestrator sends a certification for each of snap, tanf, medicaid, chip and caps a member holds. canopy-wic already ignores a program no route names, so the federal file and the pack’s (B) list decide what confers; the orchestrator judges nothing. TANF holders are the members receiving assistance (read_tanf_grant). Per-person programs are read per person.
D4. Every certification is full. canopy records no presumptive determination; AdjunctiveBasis::Presumptive stays for a direct caller.
D5. A failed read refuses the run. If any read fails while wic is requested, the determination is refused 503 adjunctive_certifications_unavailable before anything is claimed, as the SNAP enrollment reads refuse (services/canopy-eligibility/src/enrollment_state.rs). Sending none would run the income test and could deny an eligible participant; guessing would waive it.
D6. Each certification names its determination. AdjunctiveCertification gains determination_id: Option<DeterminationId>: Some from the orchestrator, None from a direct caller that asserts the certification itself. canopy-wic already freezes the list into the snapshot’s program_input, so the source is recorded with no further change.
Scope
In scope:
-
A canopy-snap read of a determination’s certified members.
-
The orchestrator’s certification reads and the WIC mapper filling the list.
-
The
determination_idfield, the catalogue binding, and docs.
Out of scope:
-
Certifications decided in the same run: a request naming
snapandwictogether reads the determinations in force before the run, so WIC is income-tested on that run (#3383). -
Documentary verification by a worker (the issue’s alternative).
-
Any change to canopy-wic’s route resolution.
Design
The canopy-snap read (U1)
GET /v1/determinations/{id}/certified-members (paths::GET_DETERMINATION_CERTIFIED_MEMBERS in crates/canopy-contracts-snap/src/paths.rs), answering
pub struct CertifiedMembers { pub determination_id: DeterminationId, pub person_ids: Vec<PersonId> }
in a new crates/canopy-contracts-snap/src/certified_members.rs. The handler (services/canopy-snap/src/api/determine_handler.rs) loads the determination and its snapshot as get_determination_snapshot does, opens the sealed program_input, and returns the snapshot’s member ids less the excluded ids.
The replay’s types are left alone (FrozenWorkSanction and the Copy type context_assembly::FrozenExclusion keep no ids, and the replay needs none). Instead, in services/canopy-snap/src/api/recompute_handler.rs:
-
the unsealing half of
recover_frozen_inputsbecomespub(crate) async fn open_program_input(db, kek, snapshot, determination_id) → Result<Option<Zeroizing<Vec<u8>>>, ApiError>(Nonewhen the DEK is shredded), whichrecover_frozen_inputsthen calls; -
a new
pub(crate) fn excluded_person_ids(bytes: &[u8]) → Result<Vec<PersonId>, ApiError>parses onlywork_sanction.excluded[].person_id(the shapeExclusionRecordwrites), answering an empty list whenwork_sanctionis absent.
Both are re-exported from services/canopy-snap/src/api/mod.rs beside recover_frozen_inputs. Answers: 404 for an unknown id; 409 determination_not_approved unless the status is approved; 410 snapshot_redacted when the DEK is shredded. Admission: system callers only, a new delegated row in crates/canopy-auth/src/delegated.rs; the call-graph and delegated-routes tables follow.
The orchestrator (U2)
A new module services/canopy-eligibility/src/adjunctive_certifications.rs:
pub(crate) struct Held { pub program: Program, pub determination_id: DeterminationId }
/// person id -> the certifications that person holds on `as_of`.
pub(crate) type WicCertifications = BTreeMap<Uuid, Vec<Held>>;
/// Where the reads go. A base URL is `None` when that service is not registered.
pub(crate) struct CertificationReads<'a> {
pub db: &'a PgPool, pub client: &'a reqwest::Client,
pub snap_base_url: Option<&'a str>, pub tanf_base_url: Option<&'a str>,
pub source: &'a dyn BearerSource,
}
/// Names the read that failed.
pub(crate) struct Unavailable(pub &'static str);
pub(crate) async fn certifications_in_force(reads: &CertificationReads<'_>, household_id: HouseholdId,
members: &[Uuid], as_of: NaiveDate) -> Result<WicCertifications, Unavailable>;
The module is declared in services/canopy-eligibility/src/lib.rs beside member_facts. CertificationReads is new; member_facts::TanfReadTarget is unchanged.
-
A new store read,
list_latest_determinations_by_household_and_subject(services/canopy-eligibility/src/store/mod.rs):DISTINCT ON (program, person_id)over the household, newest first. The in-force test istanf_determination_in_force's, generalised to take the program and moved beside it asdetermination_in_force. -
snapin force: call U1’s read; holders are itsperson_idsamongmembers. -
tanfin force:read_tanf_grant; holders are the grant members amongmembers. -
medicaid,chip,caps: each member whose own newest row is in force. -
A program in force whose service has no base URL is
Unavailable, as is any failed read. The orchestrator turnsUnavailableinto the 503 of D5 at the point the SNAP member facts are read today (after the household context is built, before claims).
ApplicationContext and mappers::map_context are not changed, so its other callers (bulk/arm.rs, the tests in quarantine.rs and mappers/mod.rs) are untouched. A new pub(crate) fn stamp_certifications(body: &mut WicApplicationContext, held: &WicCertifications) in services/canopy-eligibility/src/mappers/wic.rs sets each participant’s adjunctive_certifications from the map, by person id, with basis: Full and determination_id: Some(..). The dispatch loop in orchestrator.rs calls it on the MappedContext::Wic body right after map_context, where stamp_dispatch is called.
The read runs exactly when the request names wic; the test a_request_without_wic_reads_no_certifications pins that.
Units (weights by complexity) — U1 → U2
Weights: 1 trivial · 2 small · 3 medium · 5 large · 8 very large. One unit = one MR = one child issue.
U1 (w3) — canopy-snap serves a determination’s certified members
Files: crates/canopy-contracts-snap/src/{paths,certified_members,lib}.rs, crates/canopy-contracts-snap/tests/roundtrip.rs, services/canopy-snap/src/api/{mod,determine_handler,recompute_handler}.rs, a new services/canopy-snap/src/api/certified_members_infra_tests.rs, crates/canopy-auth/src/delegated.rs, docs/modules/ROOT/pages/api/canopy-snap.adoc, docs/modules/ROOT/pages/authorization-inventory.adoc, docs/modules/ROOT/openapi/snap.json.
Tests: contract roundtrip of CertifiedMembers (wire); unit tests that excluded_person_ids reads the ids ExclusionRecord serialises and answers none without a work_sanction; database tests (*_infra_tests, on the car) that a determination with one sanctioned member answers the others only, that a denied one is 409, and that a redacted one is 410.
U2 (w5) — the orchestrator sends the certifications
Files: services/canopy-eligibility/src/{lib,adjunctive_certifications,member_facts,orchestrator}.rs, services/canopy-eligibility/src/store/mod.rs, services/canopy-eligibility/src/mappers/{wic,wic_tests}.rs, a new services/canopy-eligibility/tests/adjunctive_certifications_test.rs, crates/canopy-contracts-wic/src/determine.rs. The new field is added (as None) to every AdjunctiveCertification literal: crates/canopy-contracts-wic/tests/roundtrip.rs, services/canopy-wic/src/adjunctive.rs, services/canopy-wic/src/determine_gate_parity_tests.rs, services/canopy-wic/src/api/persist/reassessment/infra_tests.rs, services/canopy-wic/tests/wic_test.rs. Also compliance/action-catalogue/wic.toml, compliance/action-coverage-allowlist.toml, docs/modules/ROOT/pages/api/{canopy-eligibility,canopy-wic}.adoc, docs/modules/ROOT/openapi/wic.json.
Tests, by category:
-
Unit (mapper): a member with certifications gets them, each
fullwith its determination id; a member with none gets an empty list; members are joined by person id only. -
Unit (in-force): approved and in force counts; a newer denial supersedes; an expired or future row does not count; per person, a sibling’s row never counts for another member.
-
Wire:
AdjunctiveCertificationroundtrips with and withoutdetermination_id; the WIC OpenAPI snapshot. -
Database and stand-ins (the new
adjunctive_certifications_test.rs, on the pattern ofmember_facts_test.rs, on the car): a household with SNAP in force sendssnapfor the certified members and not for the sanctioned one; a Medicaid row for an infant sendsmedicaidfor the infant only; a failed canopy-snap read refuses the run 503 and dispatches nothing;a_request_without_wic_reads_no_certifications(the canopy-snap stand-in receives no call). -
Regression, the case that would have caught this: an orchestrated WIC determination for an over-income participant holding SNAP is approved with the participant route recorded (
services/canopy-eligibility/tests, on the car, against canopy-wic).
The catalogue row is bound to that regression test and its allowlist entry deleted.
Risks
| Risk | Mode | Mitigation |
|---|---|---|
A certification is sent for a member the program did not certify, waiving the income test |
fail-open |
D2: SNAP holders come from canopy-snap’s own record of who was certified; per-person programs are read per person. Pinned by the sanctioned-member and sibling tests. |
A read fails and the run proceeds with no certifications, denying an eligible participant on income |
silent |
D5: the run is refused 503 instead. Pinned by the failed-read test. |
A lapsed or superseded determination still confers eligibility |
fail-open |
D1: only the newest row per subject, in force on |
A SNAP snapshot is redacted, so its members cannot be read |
fail-closed |
U1 answers 410; the orchestrator treats it as a failed read and refuses the run. An operator sees the 503 code. |
A TANF determination in force has no stored unit ( |
fail-closed |
Accepted: only a determination recorded before units were stored (#3048) lacks one, and a pre-1.0 deployment re-seeds. The 503 names the TANF read. |
WIC requested with SNAP in the same run is income-tested |
silent |
Out of scope, stated here and in the WIC API page; #3383. |
Verification
-
cargo xtask test --unit, clippy and the lint lines locally. -
The merge train’s car runs the database, stand-in and regression tests (CI is the gate). The local devstack is not used.
-
cargo xtask policy action-coveragepasses with the allowlist entry removed.
Documentation Updates
-
api/canopy-snap.adoc(the new read),api/canopy-eligibility.adoc(the reads and the 503),api/canopy-wic.adoc(determination_id, the same-run limit),authorization-inventory.adoc -
CHANGELOG.adoc— an entry per unit under== Unreleased -
On U2’s merge: the SHA noted on #2365, which its MR closes
Review log
| round | vendor | resolved model | verdict |
|---|---|---|---|
1 |
Anthropic |
claude-fable-5-2 |
FLAGS — U1’s seam through |
2 |
gemini-4-argon |
FLAGS — the same U1 seam and missing files; addressed |