WIC mid-certification termination: reassessment, scheduling and notice (epic &106, Plan B3)

Status: Done (2026-09-29) — !1534, !1535, !1536, !1538, !1540
Issues: #2391 (epic &106), #2445, #2446, #2447, #2448, #2449
Branches:

  • MR-P: fix/notices-dispatch-integrity, a prerequisite of MR-2.

  • MR-0: feat/2391-wic-income-reassessment. It carries this page.

  • MR-1: feat/2391-wic-termination-notice-routes.

  • MR-2: feat/2391-wic-termination-scheduling.

Erratum (2026-09-29): MR-1 renamed services/canopy-notices/src/noe_superseded.rs to retractions.rs; the Context cite is corrected to as-built.

Erratum (2026-09-29): D4 as built adds two 422s: wic_reassessment_superseded (a covered member has an income_reassessment made after the cited run; partial index wic_determinations_reassessment_person) and idempotency_key_invalid (a blank, over-255-byte or NUL-bearing body key), and it re-reads the body key before the no-current-record 404.

Erratum (2026-09-29): D7 as built repairs to max(effective_on, new floor), never earlier than the termination’s date, and judges expires_first against that date; a same-date replacement letter still quotes the closed letter’s date.

This is a Design + Scope plan. GitLab owns tracking. It freezes when the first unit starts. It builds on B1 (#2389) and B2 (#2390). Plan B3-H follows it and closes #2391.

Context

  • The law.

    • 7 CFR 246.7(h)(1)(ii): disqualify "a participant and any other household members currently receiving WIC benefits who are determined ineligible based on the mid-certification income reassessment". An adjunctively eligible participant may be disqualified "only after their income eligibility has been reassessed based on the income screening procedures used for applicants who are not adjunctively eligible".

    • (j)(6): written notice "not less than 15 days before" the disqualification, with the reasons and the right to a fair hearing.

    • 246.9(e): at least 60 days to request a hearing, "from the date the agency mails or gives" the notice.

    • 246.9(g): continued benefits for an appeal within the 15-day period (B3-H).

    • DPH’s Notice of Termination form (pinned, "Revised February 2023") and CT-860.04 VI.A.

  • Evidence exists. WIC determinations record typed income_eligible and adjunctive_eligible results (services/canopy-wic/src/determine.rs, migration 20260413000000_create_wic_tables.sql).

    • But every POST /v1/determine run re-certifies each member it finds eligible (determine.rs, store/participants.rs persist_certification).

    • So an income reassessment needs a run that certifies nothing (D1).

  • Precedents:

    • enrollment’s adverse action (services/canopy-enrollment/src/adverse_actions.rs: the printed date is fixed at scheduling, the route is verbatim, dispatch evidence gates, a late letter is repaired);

    • B2’s lifecycle sweep, WIC dispatch consumer, supersession hook, retraction consumer and pinned notice types;

    • canopy-wic’s household route (/v1/wic/households/{household_id}/appointments) and store/participants.rs in_person_order.

  • Verified defects this program fixes:

    • #2446: a retraction can flip a delivery the dispatcher has already claimed. The letter is mailed, but its stamp misses (services/canopy-notices/src/retractions.rs, worker.rs, store.rs).

    • #2447: the notice date is fixed at render, not at dispatch, so a legal day crossed in the queue leaves 59 days (generator.rs).

    • #2448: canopy-wic stamps from Utc::now() and SQL now() (determine.rs, store/lifecycle.rs, store/participants.rs).

    • #2449: B2’s WIC letter alters the USDA statement (rulesets/georgia/notices/components/civil-rights.typ against CR-1110.02).

  • Constraints:

    • Quality budget B1 is at its lock of 17 (services/canopy-wic/src/api/persist.rs at 492 lines), and B8 is at its lock of 8.

    • The global POST idempotency middleware replays 2xx responses byte for byte by header (crates/canopy-api/src/idempotency.rs).

    • [wic.lifecycle] denies unknown fields, and LifecycleParams is Copy.

Rulings in force: pre-1.0, no shims; every jurisdiction without code changes; ADR-004; ADR-011; ADR-043 A1; neutrality; the in-workstream ruling on related defects.

Scope

In scope: MR-P and D1–D10.

Out of scope:

  • Plan B3-H: the appeal hold, the canopy-appeals arm, enactment, wic.certification_terminated, and retracting an unsent expiration notice at enactment;

  • continued benefits beyond the hold (#827);

  • sanctions (#827, #837) and missed pickups (#826);

  • a rescission letter after a dispatched cancellation, an explicit communication gap (#2451);

  • the canopy-web form (#2450);

  • Spanish rendering (#774/#836);

  • the DPH voucher line (#826);

  • a program_data snapshot for on-demand re-render (#2454).

Design

# Decision

D1

Income reassessment determinations (MR-0, #2445).

  • POST /v1/determine takes a required purpose (evaluation or income_reassessment), persisted as wic_determinations.purpose (CHECK) and signed as program_extension.purpose.

  • income_reassessment requires every subject to hold a current record (422 wic_reassessment_without_certification).

    • It writes the determination rows and wic.determination_completed.

    • It mints no record, supersedes nothing and stages no wic.certification_created.

  • The branch lives in determine.rs or a new module, not in persist.rs.

D2

Pack data (MR-2).

  • rulesets/federal/wic-lifecycle.json gains "termination": {"min_advance_notice_days": 15, "authority": "7 CFR 246.7(j)(6)", "permitted_bases": ["7 CFR 246.7(h)(1)(ii)"]}.

  • [wic.lifecycle.termination] holds advance_notice_days and [[…reasons]] {code, basis}, parsed into a non-Copy TerminationParams behind an Arc.

  • Boot refuses: a missing table; a lead below the floor or above MAX_POLICY_DAY_COUNT; empty or duplicate reasons; a basis outside permitted_bases.

  • In code, each basis maps to an evidence kind; (h)(1)(ii) maps to an income reassessment.

  • Packs: georgia and default have 15 days and income_ineligible_at_reassessment; test-max has fixtures.

  • Georgia cites CT-840.01 II and (j)(6). Pin CT-860.06 (the CT-860.04 wayback precedent), or record it in [meta].lost. A conflict with the ruled reasons or lead stops MR-2 for a ruling.

D3

Schema (MR-2; services/canopy-wic/migrations/20270116000000_wic_terminations.sql, forward-only, one constraint per ALTER).

  • wic_termination_cohorts: id, household_id, idempotency_key (UNIQUE), reason_code, requested_effective_on, the reassessment run tuple, scheduled_by TEXT NOT NULL CHECK <> '' (the route is user-only), created_at.

  • wic_participant_terminations:

    • columns: id (WicTerminationId), cohort_id, participant_id, reassessment_determination_id (composite FK to wic_determinations_subject_key), reason_code <> '', basis, policy_version, effective_on, required_advance_days (CHECK 15..366), status (`scheduled

cancelled`; B3-H widens it), cancel_reason (`worker

superseded

expired

expires_first`), cancelled_at, cancelled_by/cancelled_by_service, created_at, updated_at; CHECKs: * num_nonnulls(cancelled_by, cancelled_by_service) ⇐ 1; * (status = 'cancelled') = (cancelled_at IS NOT NULL) = (cancel_reason IS NOT NULL), with a cancel actor exactly when cancelled; * (cancel_reason = 'worker') = (cancelled_by IS NOT NULL); indexes: * UNIQUE (id, participant_id); * partial unique (participant_id) WHERE status = 'scheduled'; * partial (effective_on, id) for the settle leg; * list (participant_id, created_at DESC, id DESC). * wic_termination_notices: source_event_id PK, termination_id FK (indexed), effective_on (the date printed), replaces_effective_date, staged_on; set-once notice_id, notice_date, noticed_effective_date, the dispatched_at/dispatched_date pair, and superseded_at; one live letter per termination. * wic_participants: termination_id and terminated_on columns, with FK (termination_id, id) → (id, participant_id). The named CHECK (status = 'terminated') = (termination_id IS NOT NULL), which B4 widens. (terminated_on IS NULL) = (termination_id IS NULL). * effective_on and terminated_on are the first day not certified. * *Cutover. DELETE the fixture terminated rows; there is no retained WIC data, as in the A1 precedent. The seed writes prior periods as expired with expired_at. Test helpers stop using Terminated as a generic non-current status.

D4

Schedule (MR-2; api/terminations.rs, store/terminations.rs).

  • POST /v1/wic/households/{household_id}/terminations with require_user_only(CASEWORKER_WRITER_ROLES).

  • Body ScheduleTerminationsRequest { reason_code, reassessment_determination_ids, effective_on: Option, idempotency_key } (deny_unknown_fields).

  • Idempotency, two layers:

    • The header middleware replays its cached response verbatim.

    • The body key is read from the pool before any other check, and again after the locks. The same identity (household, reason, ids, requested date) answers 200 with the current state; anything else is 409 idempotency_key_reused.

    • Unique violations are mapped by constraint name.

  • One transaction:

    • lock the household’s current records in person order (in_person_order);

    • validate that the ids form one income_reassessment run over this household, each after that member’s granting determination and inside its period, and that the run covers every current record;

    • terminate each member with income_eligible = false and adjunctive_eligible = false. The others are reported as not terminated, and a run with none is 422;

    • the floor is today + lead + DISPATCH_SLACK_DAYS (2), and a requested date may only be later;

    • refuse a date past any member’s certification_end − expiration lead(homeless) (M3);

    • insert the cohort, terminations and letters (pre-minted envelope ids), stage one wic.termination_scheduled each, and build the response in the transaction.

  • Answers:

    • 201 WicTerminationCohort; 200 on a replay;

    • 404 for an unknown household or no current record; 409 idempotency_key_reused, wic_termination_already_scheduled;

    • 422: wic_termination_reason_unknown, wic_reassessment_unknown, wic_reassessment_subject_mismatch, wic_reassessment_outside_certification, wic_reassessment_incomplete, wic_reassessment_found_none_ineligible, wic_termination_effective_too_soon, wic_termination_within_expiration_notice_lead.

D5

Cancel and list (MR-2).

  • Cancel: POST /v1/participants/{id}/terminations/{termination_id}/cancel, user-only.

    • A compare-and-set scoped by id, participant and scheduled.

    • On a miss, re-read: a missing or other-participant termination is one uniform 404; already cancelled is 200.

    • Then close_live_letter.

  • List: GET /v1/participants/{id}/terminations, require_service_or_caseworker_or_above.

    • A keyset page {items, next_cursor} with clamp_limit, from one CTE-plus-join statement folded in Rust.

    • 404 for an unknown participant; an empty page for one with none.

  • Wire shape: WicTermination carries its letters (source_event_id, effective_on, notice_date, dispatched_date, superseded). WicParticipant gains terminated_on and termination_id. Actors are stored, not exposed.

D6

Locks, clock, helpers (MR-2).

  • One order everywhere: record → termination → letter, each a separate FOR UPDATE.

  • One Tick per request or pass stamps every write (#2448 retires Utc::now() and SQL now(); B8 stays at 8).

  • Helpers:

    • cancel_scheduled_termination_locked(reason, actor);

    • close_live_letter: set superseded_at, and stage wic.termination_notice_superseded only when the letter has no dispatch evidence under its lock. MR-P (#2446) makes that retraction lease-safe.

  • An exhaustive match on record status. A non-scheduled termination is a no-op.

D7

Dispatch evidence and the settle leg (MR-2; no enactment).

  • The dispatch consumer also matches WIC_NOTICE_OF_TERMINATION. It stamps the set-once letter fields, and WARNs when noticed_effective_date differs from effective_on.

  • A letter is on time when it was dispatched with dispatched_date = notice_date and notice_date + lead < effective_on (strict), or when it is undispatched while today + lead < effective_on.

  • The settle leg runs first in each pass. For each scheduled termination whose live letter can no longer be on time:

    • repair: close the live letter, move to the new floor, and write a new letter with replaces_effective_date (the replacement line);

    • or cancel as expires_first when the new floor passes the M3 bound.

  • A due termination with an on-time letter waits for B3-H.

  • Leg order is settle → notice → expire. The expire leg cancels (expired) any scheduled termination through the helper, per row.

  • The report gains terminations_repaired and terminations_cancelled (the wire pin, the arb, wic.json).

D8

Supersession (MR-2). The supersede UPDATE returns record columns only. Then lock the termination and the letter, and cancel as superseded (actor canopy-wic) through the helper, in the same transaction.

D9

The bus and the notice (MR-1; MR-2 publishes).

  • Payloads:

    • WicTerminationScheduledV1 { termination_id, cohort_id, participant_id, determination_id, reassessment_determination_id, application_id, household_id, person_id, reason_code, effective_date, certification_end, replaces_effective_date }. determination_id is the granting determination.

    • WicTerminationNoticeSupersededV1 { source_event_id, participant_id, termination_id }.

  • Both manifests route wic.termination_scheduled:

    • notice_type = "wic_notice_of_termination", program = "wic", template_key = "notice-of-termination";

    • subject_template = "Notice of Termination — WIC Certification", effective_date_policy = "verbatim";

    • program_data_keys = ["effective_date", "reason_code", "replaces_effective_date"];

    • addressing = "caretaker_for_minor", notice_required = true;

    • regulatory basis: (j)(6), (h)(1)(ii) and 246.9, plus the DPH form in georgia.

  • [templates.wic.notice-of-termination]: version = "2026.1", hearing_rights = true, no form_number.

  • The Georgia template adapts the form.

    • It carries the reason sentence, the termination date, a real hearing-rights(…) call with no continued-benefits offer, the decision-prevail date (the stored deadline), the records, representative and confidentiality text, a verbatim WIC USDA component (#2449, also used by B2’s letter), the language-access tagline and the replacement line.

    • It omits the voucher line, the signature, date-of-birth and phone fields, and Spanish.

    • An unknown reason code refuses the render. The default ruleset is neutral.

  • reason_code and replaces_effective_date get placeholders in default_program_data.

  • WIC_NOTICE_OF_TERMINATION joins CORRELATED_NOTICES.

  • wic.termination_notice_superseded joins the retraction table. The module becomes retractions.rs, with logs neutral to notice type; the queue name stays.

  • In MR-2 both keys join canopy-wic’s write ACL.

D10

Compliance (MR-2).

  • wic.certification.mid-certification-disqualification-notice binds as an endpoint (/wic/households/{household_id}/terminations, post, schedule_terminations), with test_ref a route infra test that proves the evidence, the reason and the floor. Its allowlist entry is removed.

  • The scenario drops its #2391 fence, adds no blocked_by, and stays Partial, with a note naming B3-H and the web issue (#2450).

  • The federal-requirements.adoc row and the catalogue gap comment state the as-built half.

Invariants

  • No termination is scheduled without an income reassessment that found that member income- and adjunctive-ineligible, covering the whole household.

  • A record has at most one scheduled termination.

  • Each termination’s live letter is either on time, or replaced or cancelled on the next pass. No path leaves an unsent letter for a cancelled termination.

  • No termination date is within the lead of today plus slack, or within the expiration-notice window.

Units

MR-P first, or in parallel, before MR-2. Then MR-0 → MR-1 → MR-2. MR-1 merges and deploys before MR-2 publishes (binding-first).

  1. MR-P (w4, Closes #2446 and #2447).

    • #2446 makes retraction respect the dispatch claim: arm 2 skips live claims; every arm writes notice_retractions; claim, park and defer exclude retracted notices; a fence miss after provider acceptance logs ERROR; resend refuses superseded.

    • #2447 fences a legal-day crossing before deliver (a terminal stale status, then re-render and resend), retiring the stale notice’s appeal-rights row.

    • The tests are in the issues, including an interleaving test with a recording adapter and a test-clock day-boundary test.

  2. MR-0 (w3, Relates to #2391, Closes #2445). The plan page, its nav line, and D1.

    • Tests: a reassessment run writes rows and changes no record; the envelope pin carries purpose; a subject without a current record is 422.

    • Docs: api/canopy-wic.adoc, data-models/canopy-wic.adoc, CHANGELOG.adoc.

  3. MR-1 (w3, Relates to #2391, Closes #2449). D9 contracts and constants, both manifests and templates, the retraction and correlation rows, the retractions.rs rename, and the #2449 component.

    • Files: services/canopy-notices/src/{retractions.rs,event_routing.rs,generator.rs,manifest_checks.rs,main.rs}, api/canopy-notices.adoc, CHANGELOG.adoc.

    • Tests:

      • the route count moves from 56 to 57; letters minus 4; the renamed caretaker pin; a sixth route case;

      • both-ruleset renders: the reason, the dates, the phone and mail text, the prevail date equal to the stored deadline, no continued-benefits text, the tagline, the replacement line, an unknown reason refused;

      • the retraction arms and same-source isolation for the new key;

      • the correlation pins and wire pins;

      • a live test publishing both envelopes through the devstack broker and observing the letter and its retraction (binding evidence).

  4. MR-2 (w8, Relates to #2391, Closes #2448). D2–D8, D10.

    • Files: canopy-wic’s migration, lifecycle.rs, params.rs, api/terminations.rs with nested api/terminations/infra_tests.rs, services/canopy-wic/src/api/mod.rs, services/canopy-wic/src/api/persist.rs, api/persist/supersession.rs, determine.rs, store/{mod,terminations,participants,models,lifecycle}.rs, store/lifecycle/fixtures.rs, lifecycle_sweep.rs, lifecycle_sweep/infra_tests.rs, notice_dispatch_subscriber.rs, events.rs, main.rs, tests/wic_test.rs; the canopy-contracts-wic terminations, paths, lifecycle_sweep, participants and roundtrip files; the test-lib client; the seed files and seed tests/integration.rs; the rulesets and citations; the ACL and topology allowlist; the D10 rows; a canopy-notices test that every pack’s reason codes render; wic.json.

    • Tests:

      • pack refusals;

      • schedule: every answer; the two-layer replay (header against body key; replay after repair, cancel, a pack change and a date advance); concurrent same-key pairs, same and different household; a valid service token gets 403;

      • cross-participant and multi-pointer FK refusals in raw SQL;

      • cancel: uniform 404, idempotent, closes the letter;

      • list paging;

      • settle: an exact-boundary on-time letter; a late dispatch repairs with a replacement line; an undispatched letter repairs once it can no longer be on time; expires_first; beyond one page with an exhausted budget; outbox rollback on schedule, repair and each cancel path;

      • supersession after a repair retracts the new letter (await_blocked); schedule against cancel, and cancel against repair, interleaved;

      • the dispatch stamp; the status CHECKs and the cutover; seed rows expired;

      • live: schedule from a reassessment run, then list and cancel, in wic_test.rs.

Verification

  1. Per unit:

    • fmt, clippy in both profiles, cargo doc with broken links denied;

    • the non-live lanes and the named ephemeral-schema tests;

    • quality-budgets, neutrality-lint, migrations-lint, determination-status-lint, the policy audit and action-coverage, scenarios audit, test-lanes-lint.

  2. Per MR: mq-topology; CANOPY_CARGO_FEATURES=canopy-api/test-clock cargo xtask dev reload; cargo xtask api-docs --update and input-coverage; git push.

  3. MR-2 is rebased after MR-1 has merged and MR-1’s live binding test has passed on the reloaded devstack.

  4. Closing: cargo xtask plan-lint --done, with --allow-open for #2391 (until B3-H) and for each out-of-scope owner still open, before the nav moves to Archive.

Documentation Updates

  • The pages in each MR, plus state-machines.adoc (the termination machine) and the canopy-wic row of services.adoc in MR-2.

  • GitLab: the issues are filed and the B4 question is on #2392.

Review log

round vendor resolved model verdict

1 (2026-09-28)

Anthropic

claude-opus-5-5

no-ship. Five blockers fixed: the commit subject, the MR-1 CHANGELOG, a full-path cite, the lock order, and the idempotency identity.

2 (2026-09-29)

OpenAI

gpt-6-astra

no-ship; 38 findings, verified by an eight-cluster read-only workflow (most confirmed, some partial). The maintainer decided M1–M3 and M1.ii. The program was restructured: * notices integrity prerequisites #2446 and #2447; * a non-certifying reassessment with household cohorts and adjunctive evidence; * the hold and enactment moved to B3-H; * truthful provenance and cutover; * user-only guards, scoped cancel, keyset list; * two-layer idempotency; * per-row settle fencing and strict on-time rules; * adapted-form tests; * binding evidence; * the process fixes.

Edit this page · default