WIC certification periods from anchor dates (epic &106, Plan A2)
Status: Done (2026-09-27) — !1523
Issues: #2358 (epic &106); closes the re-cut #825 and #829
Branches: feat/2358-wic-anchor-periods (carries this page)
This is a Design + Scope plan. GitLab owns tracking. It freezes when U-A starts. One MR, one battery. It follows Plan A1 (#2359), whose program_extension.participant_id and GET /v1/participants/{id} its tests read.
Erratum (2026-09-27): as built, D5’s controlling also records the anchor of the excluding window edge or of the term that set the end, which supplies the D6 {field}; D7’s per-category provenance also records the option’s registry key (option); D2’s boot also refuses a federal category whose anchors list is empty or names certification_date; D1’s preflight checks the date domain on as_of before A1’s future-date refusal; and services/canopy-wic/src/api/handlers.rs documents the three preflight codes in the 422 description.
Erratum (2026-09-27): D8 as built: Georgia’s woman-expiration scenario states the pregnant end as six weeks after the expected delivery (the actual-delivery revisit is #2360); file-to-notification-journey is fenced to both #831 and #2364, because it waits on the clock and the dispatch; and the per-category certification flow rows go to #2364, with the three on the 10-day or 20-day processing standard (pregnant, infant, child) also fenced to #831.
Context
-
The period is a flat month count.
-
params::certification_end_datereturnsas_of + N months(services/canopy-wic/src/params.rs~180-195), with N taken fromcertification_periods_monthsinrulesets/federal/wic-food-packages-2026.json(~12-18). -
That is an exclusive anniversary, while the contract calls
certification_endinclusive (crates/canopy-contracts-wic/src/participants.rs~29-30). -
WicParticipantContext(crates/canopy-contracts-wic/src/determine.rs~26-46) carries no anchor date.
-
-
The law is anchor-based and leaves room.
-
7 CFR 246.7(g)(1) sets the maxima. Its (g)(1)(v) was last revised by 76 FR 59885, effective 2011-10-28. Three State options are registered in
compliance/federal-options/wic.toml(~14-30). -
7 CFR 246.2 defines each category.
-
States read "approximately every six months" and the category edges differently:
-
Georgia’s CT-840.01 is day-anchored and shorter, under the maintainer’s rulings recorded on &106;
-
Oregon rounds an older infant’s six months to month-end;
-
Washington admits a child through the fifth-birthday month.
-
-
-
Precedents:
-
TANF and CAPS use inclusive ends on chrono’s month clamp (#1488:
services/canopy-tanf/src/determine.rs~1017-1031). -
SNAP puts its vocabulary in the pack and does the arithmetic in Rust (
services/canopy-snap/src/certification_period.rs). -
canopy_common::expedited_postponement::certification_end(start, n)computes month-end dates. -
#770 added snapshot keys without a version bump (
services/canopy-wic/src/determine.rs~156-160).
-
-
Tracking debt: after A1, 20 allowlist entries and about 40 scenario-fence lines still cite #825 or #829.
Rulings in force: pre-1.0, no shims; every jurisdiction without code changes; neutrality N1–N5; ADR-002 (the determination consumes its context); ADR-011 (every pack key cited); ADR-028 (the snapshot records what decided).
Scope
In scope: D1–D8.
Out of scope: #2360 (temporary certification; transitions such as actual delivery and breastfeeding cessation; notices; the sweep); #2361, #2362, #2363, #2365; #2364 (dispatch, and re-pointing the closed #769 gap rows); #858 (capturing the anchors); 246.7(g)(2) and (g)(3); seed end dates from anchors (a follow-up issue).
Pre-existing defects, each filed as a fix: issue: canopy-web’s WIC interim-contact and change-report actions omit household_id; the WicApplicationContext.as_of doc names clock::today; the stale catalogue GAP comments at compliance/action-catalogue/wic.toml ~46-50 and ~61-68.
Design
| # | Decision |
|---|---|
D1 |
Anchors arrive on the wire (ADR-002), inside a supported domain.
|
D2 |
A closed vocabulary, evaluated in Rust.
|
D3 |
The federal file holds the loosest lawful bounds:
|
D4 |
Packs elect, shorten and narrow; nothing widens.
|
D5 |
The engine:
Conventions:
|
D6 |
The category-date gate is Rust, from the effective window (row
|
D7 |
Replay (ADR-028).
|
D8 |
Compliance.
|
Invariants
-
No WIC certification’s end passes the 7 CFR 246.7(g)(1) bound that its pack’s elections select. For a pregnant woman that bound is projected from the expected delivery date, and is revisited at delivery (#2360).
-
Packs only shorten and narrow. Every period is recomputable from its snapshot, and no Georgia value lives outside
rulesets/georgia. -
No write happens before the batch preflight passes. No allowlist entry or fence under
compliance/orrulesets/cites #825 or #829.
Units — U-A → U-C, one MR
Commit 1: docs(plans): plan WIC certification periods from anchor dates (#2358). Last: docs(plans): close the WIC certification periods plan (#2358).
U-A (w8) — feat(wic): compute certification periods from anchor dates (#2358)
Files:
-
rulesets/federal/{wic-certification-periods.json,wic-food-packages-2026.json,citations.toml,indexing.toml,README.adoc}; -
crates/canopy-policy/src/wic_food_packages.rs; -
crates/canopy-contracts-wic/{src/determine.rs,src/lib.rs,tests/roundtrip.rs}; -
services/canopy-wic/{Cargo.toml,src/main.rs,src/certification_period.rs,src/certification_period_tests.rs,src/params.rs,src/determine.rs,src/derivation.rs,tests/wic_test.rs,tests/snapshots/wic_test__wic_test_approved_pregnant.snap}; -
rulesets/{georgia,default,test-max}/{jurisdiction.toml,citations.toml}; -
compliance/{input-requirements/wic.toml,federal-options/wic.toml}; -
services/canopy-eligibility/{src/mappers/mod.rs,tests/orchestrator_dispatch_test.rs}; -
the D8 U-A rows in
compliance/{action-catalogue,action-coverage-allowlist,scenario-inventory}andrulesets/georgia/scenarios/wic.toml; -
docs/modules/ROOT/openapi/wic.json.
Tests (certification_period_tests.rs unless noted):
-
ct_840_01_worked_examplesassertsend,rule_end == Some(end)and the controlling authority. The postpartum row’s CT-840.01 V action date prints "12/01/19", a typo for 2018-12-01.category inputs end pregnant
EDD 2018-11-22, certified 2018-09-01
2019-01-03
postpartum
pregnancy end 2018-11-22, certified 2018-12-01
2019-05-22
breastfeeding
pregnancy end 2018-11-22, certified 2019-01-05
2019-11-21
child
DOB 2014-03-19, certified 2019-01-25
2019-03-31
child
DOB 2014-03-19, certified 2019-03-18
2019-03-31
infant
DOB 2018-11-22, certified 2019-04-10
2019-11-21
infant
DOB 2018-11-22, certified 2019-07-11
2019-12-31
child (ruled)
DOB 2016-06-01, certified 2018-12-14
2019-11-30
-
Ruled edges: an infant born 2018-11-22, certified 2019-05-22 (exactly six months) → 2019-10-31, and certified 2019-05-21 → 2019-11-21; postpartum after a loss, pregnancy end 2026-03-10 → 2026-09-10; the postpartum clamp, pregnancy end 2025-08-31 → 2026-02-28; a 29 February birth.
-
a_state_cutoff_denies_with_its_own_authority: Georgia breastfeeding with pregnancy end 2025-01-01, certified 2026-01-01. The claim is in the window, but the end is 2025-12-31, so the denial cites CT-840.01 VI. -
a_child_on_the_fifth_birthday_follows_the_pack_window: Georgia and default deny it; test-max admits it through the birthday month. -
federal_arms_follow_the_election: hand-pinned values per category and arm, including a test-max infant certified 2025-09-10 at seven months → 2026-03-31. -
federal_pregnant_projection_reproduces_the_cfr_example_arithmetic: the regulation’s example uses the actual birth; fed as the projected date 2026-06-04, the arithmetic gives 2026-07-31. -
a_pack_rule_past_the_federal_maximum_is_held_to_it. -
period_never_exceeds_the_federal_maximum(proptest over the three packs, every category and in-domain anchors). It recomputes the bound from the parsed federal arm and assertsendnever passes it.end >= startis asserted only whenis_valid(). -
Windows, ages and loading:
category_windows_follow_7_cfr_246_2;age_months_agrees_with_anniversaries(proptest);leap_day_birth_diverges_from_age_years_only_on_february_28;required_anchors_come_from_the_federal_file;federal_categories_match_the_food_package_vocabulary;federal_options_match_the_registry;malformed_rules_refuse_to_load(one case per refusal). -
In
determine.rs:missing_anchor_is_refused_before_any_write(one case per category),anchor_after_the_certification_date_is_refusedandout_of_range_dates_are_refused_in_preflight. -
The derivation edge test covers the anchor inputs and the new node.
-
In
wic_test.rs:wic_certification_end_is_anchor_computed_and_inclusive(the envelope agrees withGET /participants/{participant_id});wic_category_outside_its_date_window_is_denied;wic_missing_anchor_is_refused_and_writes_nothing(replaces the infant 422 test); the food-package family test is driven by DOB. -
Removed with the behaviour:
certification_periods_from_federal_file;infant_age_is_required_and_range_checked; the period assertion inunmapped_category_is_refused_not_defaulted; canopy-policy’s period assertion (~355) andminimal_validfixture key (~387).
U-B (w1) — chore(compliance): retarget WIC fences from the re-cut #825 and #829 (&106)
Files: compliance/action-coverage-allowlist.toml, compliance/action-catalogue/wic.toml (the GAP comments of the bound rows), compliance/scenario-inventory/wic.toml, rulesets/georgia/scenarios/wic.toml.
Check: action-coverage, cargo xtask scenarios audit --online, and git grep -nE '#82[59]\b' — compliance rulesets, which returns nothing.
U-C (w2) — docs: document WIC certification periods from anchor dates (#2358)
Files (under docs/modules/ROOT/pages/):
-
rulesets.adoc: a new[#wic-certification-periods]section covering the vocabulary, loosest-bound and shorten-or-narrow semantics,authority, the elections, the date domain, the clamp and leap-day convention, and the file tree; -
api/canopy-wic.adoc: the anchors, the 422 codes, the denial reasons and the inclusive end; -
federal-requirements.adoc: the 246.7(g)(1) row (~633-637) restated from eCFR; -
CHANGELOG.adoc: Added (the anchor fields, the 422 codes,category_dates_valid, the pack keys, the federal file); Changed (the periods, inclusive ends, anchors required per category (breaking), the infant-age 422 becoming a denial); Removed (infant_age_months,certification_periods_months).
Verification
-
Per unit, in isolated worktrees: fmt, workspace clippy with the portal features,
cargo docwith broken intra-doc links denied, the non-live nextest lanes, quality-budgets, neutrality-lint, the policy gates (audit, action-coverage, input-coverage), scenarios audit, test-lanes-lint and machete. -
CANOPY_CARGO_FEATURES=canopy-api/test-clock cargo xtask dev reload, thencargo xtask api-docs --update(only the D1 changes), thengit push. The battery runswic_test.rsand the WIC e2e specs.
Documentation Updates
-
The pages in U-C.
-
GitLab: file the three pre-existing
fix:issues and the seed-end-dates follow-up; add this plan’s link to epic &106; after merge, close #825 and #829 and correct their re-cut notes (the retargeting landed with this plan).
Review log
| round | vendor | resolved model | verdict |
|---|---|---|---|
1 (2026-09-27) |
Anthropic |
claude-opus-5-5 |
no-ship — three blockers fixed: U-A carries its bound-row compliance edits; the #825/#829 invariant is scoped to |
2 (2026-09-27) |
OpenAI |
gpt-6-astra |
no-ship — all findings fixed: loosest lawful federal bounds that packs shorten and narrow (Oregon month-end rounding; Washington’s birthday-month child window); the lower-bound property only on valid periods, with a cutoff-denial test; scenarios bind only proven arithmetic (federal month-end wording; cessation fenced to #2360); denials cite the controlling authority; a date domain, bounded offsets, batch preflight and error mapping; the pregnant bound qualified as a projection; the citation dated 2011-10-28 (76 FR 59885); two allowlist removals and 18 retargets. |