WIC certification expiration and the advance expiration notice (epic &106, Plan B2)

Status: Done (2026-09-28) — !1530, !1531
Issues: #2390 (epic &106; split from #2360), #2431, #2432
Branches:

  • MR-1, the consumer half: feat/2390-wic-expiration-notice-routes. It carries this page.

  • MR-2, the producer half: feat/2390-wic-certification-expiration.

This is a Design + Scope plan. GitLab owns tracking. It freezes when the first unit starts. It builds on B1 (#2389): typed routable WIC events, and the WIC notice identity in canopy-notices.

Erratum (2026-09-28): D5’s addressing is caretaker_for_minor, not responsible_adult_for_minor: 7 CFR 246.7(j)(8) owes the notice to the participant, parent or caretaker at any age, and the adult-only rule left a minor parent and her infant unnoticed.

Context

  • A granted WIC certification never ends. Nothing writes expired (crates/canopy-contracts-wic/src/participants.rs names #2390 as its writer). canopy-wic runs no background task and binds no queue (services/canopy-wic/src/main.rs), though its inbox tables exist. No participant is warned before a certification lapses.

  • The law:

    • 7 CFR 246.7(j)(8) (restated in docs/modules/ROOT/pages/federal-requirements.adoc by B1): "notified not less than 15 days before the expiration of each certification period". There is no fair-hearing clause, since an expiration is not an adverse action.

    • DPH CT-840.01 (pinned corpus): 15 days, 30 for a homeless participant.

    • 7 CFR 246.2 defines a homeless individual. That text sits only in the DPH corpus (NS-210.11), not in any federal source.

  • No homeless fact exists for WIC. The only one is SNAP/TANF’s SpecialCircumstancesPayload.homeless (crates/canopy-contracts-applications/src/sections.rs). The only builders of WicApplicationContext are canopy-wic, its tests and crates/canopy-test-lib/src/clients/wic.rs.

  • No retained WIC record exists. WIC is outside the SNAP-only September 2026 UAT, and canopy has no production deployment. The only rows are canopy-seed demo fixtures and test rows.

  • Precedents:

    • the enrollment expiry sweep (services/canopy-enrollment/src/expiry_sweep.rs): keyset paging, a time budget, one transaction per row with WARN-and-continue, and the manual trigger services/canopy-enrollment/src/api/expiry_sweep.rs (200 or 202);

    • the unfenced advisory-locked retry loop (services/canopy-appeals/src/cb_stay.rs);

    • the renewals notice of expiration:

      • staging (services/canopy-renewals/src/scheduler.rs stage_drain_noe: a pre-minted envelope id, stamped and staged in one transaction);

      • dispatch evidence (services/canopy-renewals/src/noe_dispatch_subscriber.rs);

      • retraction (services/canopy-notices/src/noe_superseded.rs, four arms keyed on source_event_id);

    • the #1941 regarding_name overlay for a redirected addressee (services/canopy-notices/src/generator.rs assembled_program_data) and its render pin the_noas_print_a_regarding_line_only_for_a_redirected_addressee.

  • Defects this plan must fix:

    • Appeal rights (#2431). persist (services/canopy-notices/src/generator.rs) creates an appeal-rights row for every notice. Yet NoticeWithAppealRights.appeal_rights is "None for non-adverse notices" (crates/canopy-contracts-notices/src/notices.rs), and 12 templates per ruleset print no hearing box, SNAP’s interview appointment and NOMI among them. No other service reads the row.

    • Early retractions (#2432). noe_superseded.rs arm 4 acks a retraction whose letter is not yet staged, so a retraction that overtakes its due event is lost.

  • Constraints:

    • Quality budget B1 is at its lock of 17, with services/canopy-wic/src/api/handlers.rs at 460 lines and services/canopy-wic/src/api/persist.rs at 484. New code gets its own files.

    • B8 is at its lock of 8, so the tick reads unwrap_or_else(canopy_common::clock::now).

    • [wic.certification] refuses non-category keys.

    • run_window_fenced consumes its window on any Ok (crates/canopy-db/src/window_fence.rs).

    • Binding-first deployment (docs/modules/ROOT/pages/event-delivery-protocol.adoc): a queue’s new keys deploy before their producer.

Rulings in force: pre-1.0, no shims; every jurisdiction without code changes; ADR-004 (ids, codes and dates only on the bus); ADR-011 (every pack key cited); neutrality; the maintainer’s in-workstream ruling on related defects.

Scope

In scope: D1–D7.

Out of scope:

  • capturing homeless at intake: the orchestrator does not dispatch WIC (#2364), and the capture gap is #858;

  • #2372 (seed ends from the period engine);

  • termination (B3 #2391), cessation (B4 #2392) and temporary certification (B5 #2393). B3 reuses D7;

  • recording a verbal expiration notice (CT-840.01 allows one).

Design

# Decision

D1

The homeless input (MR-2).

  • WicApplicationContext.homeless: bool is a new required field, with no serde default. Its doc cites 7 CFR 246.2.

  • wic_participants.homeless boolean NOT NULL. The migration adds it with DEFAULT false and drops the default in the next statement. The fill touches only fixtures (Context), and afterwards every writer must state the value.

  • The seed states it: homeless: false on its fixture (tools/canopy-seed/src/{model.rs,datagen.rs,sql.rs}). WicParticipant.homeless, the row mirror and the insert_certification column list carry it.

  • It stays out of the sealed program_input: it sets a notice lead, not a verdict.

  • compliance/input-requirements/wic.toml moves to v4 with a homeless row: required, policy_material = false, worker-fact, gap_issue = "#858".

  • wic_worker_fact_gaps (services/canopy-eligibility/src/mappers/mod.rs) adds homeless, and its two count pins move from 5 to 6.

D2

Lead days as pack data, held to a federal floor (MR-2).

  • rulesets/federal/wic-lifecycle.json (new, with no nodes) holds {"expiration_notice": {"min_lead_days": 15, "authority": "7 CFR 246.7(j)(8)"}}. It gets a file-level federal_register citation in rulesets/federal/citations.toml, and joins [families.static] in indexing.toml and the README’s static list.

  • A strict [wic.lifecycle] table holds expiration_notice_lead_days and expiration_notice_lead_days_homeless. It is parsed in a new services/canopy-wic/src/lifecycle.rs with deny_unknown_fields and a thiserror enum, and loaded by WicParameterTable::load after the certification periods.

  • Boot refuses a missing table, a lead below the floor or above canopy_common::date::MAX_POLICY_DAY_COUNT, and a homeless lead below the ordinary one.

  • Pack values:

    • georgia: 15 and 30 (authority = "manual", source_ref "Georgia DPH WIC Procedures Manual CT-840.01 (Certification Period)");

    • default: 15 and 15, citing 7 CFR 246.7(j)(8);

    • test-max: fixture values of 15 and 30;

    • test-min has no [wic].

D3

The lifecycle sweep (MR-2; services/canopy-wic/src/lifecycle_sweep.rs).

  • Cadence.

    • Every hourly probe runs one pass under run_with_advisory_lock(pool, "canopy-wic.lifecycle-sweep", …), with no daily window fence. A fence would strand a failed or budget-stopped row until the next day, and a notice failing on its certification’s last day would never be staged.

    • Both legs are idempotent by predicate, so a re-run retries only what remains.

    • The trigger and the probe call the same run_lifecycle_sweep_locked.

    • One tick per pass: deps.as_of.unwrap_or_else(canopy_common::clock::now), with today = clock::date_in(now, legal_tz).

  • Migration (forward-only, one constraint per ALTER), besides D1’s column:

    • expired_at timestamptz, with CHECK (status = 'expired') = (expired_at IS NOT NULL);

    • expiration_notice_staged_on date and expiration_notice_event_id uuid, with a pair CHECK and a partial UNIQUE index on the event id;

    • expiration_notice_dispatched_at timestamptz and expiration_notice_dispatched_date date, with a pair CHECK and CHECK dispatched ⇒ staged;

    • partial indexes on (certification_end, id) WHERE status IN ('active','temporary'), one also AND expiration_notice_staged_on IS NULL.

  • Notice leg.

    • Selects current, unstaged rows where certification_end - lead(homeless) ⇐ today ⇐ certification_end.

    • Per row: pre-mint the envelope id, then in one transaction stamp staged_on and the event id (re-checking the row is current and unstaged) and stage wic.expiration_notice_due.

    • A row first seen after its lead date is staged late with a WARN.

  • Expire leg. UPDATE … SET status = 'expired', expired_at = $tick, updated_at = $tick WHERE id = $1 AND status IN ('active','temporary') AND certification_end < $today.

    • It stages wic.certification_expired in the same transaction.

    • The status re-check leaves a record superseded meanwhile alone.

    • Expiry never waits for delivery: (j)(8) is a notice duty, not a precondition.

  • Failures. Both legs page by keyset under one time budget. A failed row is logged at WARN and counted, and the next hourly probe retries it.

  • Overdue. Notices publishes no failure event. A terminally failed letter parks in canopy-notices for operator recovery, and a recovered letter still correlates.

    • Each pass counts notices_overdue (current rows past their lead date with no dispatch evidence) and WARNs when it is non-zero.

    • The expire leg WARNs and counts every record that expires without dispatch evidence.

  • Trigger. POST /v1/participants/lifecycle-sweep/run, in a new services/canopy-wic/src/api/lifecycle_sweep.rs:

    • guarded by require_service_caller();

    • 200 with the report, 202 while the lock is held; no caller-supplied date;

    • path constant LIFECYCLE_SWEEP_RUN in crates/canopy-contracts-wic/src/paths.rs;

    • a new canopy_contracts_wic::lifecycle_sweep module with LifecycleSweepReport { staged, staged_late, expired, expired_without_dispatched_notice, notices_overdue, warned } and LifecycleSweepRunOutcome { skipped, report: Option<LifecycleSweepReport> };

    • WicClient::trigger_lifecycle_sweep in crates/canopy-test-lib/src/clients/wic.rs;

    • authorization-inventory rows, and a refreshed docs/modules/ROOT/openapi/wic.json.

D4

Dispatch evidence and supersession (MR-2).

  • Dispatch. services/canopy-wic/src/notice_dispatch_subscriber.rs binds queue canopy-wic.notice-dispatched to notice.dispatched, following the renewals shape.

    • It ignores other notice types, and stamps the dispatch pair set-once where expiration_notice_event_id = source_event_id, with no status filter.

    • An unknown correlation WARNs.

    • A dispatched_date after certification_end - lead(homeless) WARNs as late.

    • main.rs registers it on the boot subscriber before the sweep spawns.

  • Supersession. persist_certification's supersede UPDATE also returns the old record’s expiration_notice_event_id and dispatch stamp.

    • When a notice is staged and undispatched, services/canopy-wic/src/api/persist.rs stages wic.expiration_notice_superseded in the same transaction.

    • A dispatched notice is left alone; the new certification’s own notice follows.

  • The bus (MR-1 lands the contracts; MR-2 publishes):

    • WicExpirationNoticeDueV1 { participant_id, determination_id, application_id, household_id, person_id, certification_end }. application_id is the canopy-applications id the addressing needs.

    • WicExpirationNoticeSupersededV1 { source_event_id, participant_id }.

    • WicCertificationExpiredV1 { participant_id, determination_id, household_id, person_id, certification_end, expired_at }.

    • No housing status goes on the bus (ADR-004).

    • The keys are constants in canopy_reference::cross_program. In MR-2 all three join canopy-wic’s write ACL (devstack/rabbitmq/definitions.json), and wic.certification_expired is allowlisted in xtask/mq-topology-allow.toml as audit-only.

D5

The notice (MR-1).

  • Both manifests route wic.expiration_notice_due:

    • notice_type = "wic_notice_of_expiration" (SNAP’s notice_of_expiration is keyed on elsewhere), program = "wic", template_key = "notice-of-expiration";

    • subject_template = "Notice of Expiration — WIC Certification";

    • addressing = "responsible_adult_for_minor", notice_required = true, program_data_keys = ["certification_end"];

    • regulatory_basis: georgia "7 CFR 246.7(j)(8); DPH WIC CT-840.01", default "7 CFR 246.7(j)(8)". The default stays federal-only for the neutrality count.

  • [templates.wic.notice-of-expiration] has hearing_rights = false (D6) and no form_number. Its files are rulesets/georgia/notices/wic/notice-of-expiration.typ and rulesets/default/notices/wic/notice-of-expiration.typ.

  • The template has: letterhead; the #1941 Regarding: line, printed only when inputs.regarding_name is non-empty, so a responsible adult’s letter names the child; a dates box with inputs.certification_end; how to be recertified; signature, civil rights, and language and disability access. It has no hearing-rights box. Georgia may carry CT-840.01 wording; the default is neutral.

  • certification_end joins default_program_data (services/canopy-notices/src/generator.rs).

D6

Appeal rights follow the letter (MR-1, #2431).

  • TemplateEntry.hearing_rights: bool is required, with no default (crates/canopy-typst/src/manifest.rs), and is carried on TemplateRef (crates/canopy-typst/src/context.rs).

  • persist creates the appeal-rights row only when the resolved template’s flag is true.

  • Every template entry in both manifests and in the canopy-typst test fixtures declares the flag, true exactly when its file calls the hearing-rights( component.

  • On-demand rendering of a row-less notice keeps its identity fallback.

D7

Retraction (MR-1).

  • services/canopy-notices/src/noe_superseded.rs binds its queue to both retraction keys.

    • A key-to-notice-type table: renewal.snap_expiration_notice_superseded → notice_of_expiration, and wic.expiration_notice_superseded → wic_notice_of_expiration.

    • Other keys park (the #1131 recognized-set guard, now that the queue binds two keys).

    • Arms 1–3 are unchanged.

  • Arm 4 (#2432). An unknown source id records a notice_retractions (source_event_id, notice_type) row instead of acking without effect.

    • work_items::insert skips an event that has a retraction row.

    • Both first take a transaction-scoped advisory lock on the source event id, so concurrent staging and retraction serialize. insert takes the inbox transaction instead of a generic executor.

Invariants

  • A certification is expired only by the sweep, only past its end, and only while still current.

  • A current certification’s notice is staged at most once; its stamp and staged event commit together. It counts as sent only on dispatch evidence.

  • An undispatched notice of a superseded certification is retracted, whether it is queued, rendered, or not yet staged.

  • A notice has an appeal-rights row exactly when its letter prints a hearing box.

  • No lead is below the federal floor or above a year, and the homeless lead is never shorter than the ordinary one.

Units

MR-1 merges and deploys (cargo xtask dev reload) before MR-2’s WIC activates, so both notices bindings exist before any WIC publish (binding-first). Each commit carries its CHANGELOG bullet.

MR-1: consumer half (Relates to #2390; Closes #2431, #2432)

  1. docs(plans): plan WIC certification expiration (#2390): the page and its nav line.

  2. U-N1 (w2) fix(notices): persist appeal rights only for letters with a hearing box (#2431).

    • Files: crates/canopy-typst/src/{manifest.rs,context.rs}, services/canopy-notices/src/generator.rs, rulesets/{georgia,default}/notices/manifest.toml, docs/modules/ROOT/pages/api/canopy-notices.adoc.

    • Tests: every_template_entry_declares_the_hearing_rights_its_file_renders (both rulesets); a_letter_without_a_hearing_box_persists_no_appeal_rights (ephemeral schema, read back as None). Existing notice_write_success_persists_notice_and_appeal_rights stays green.

  3. U-N2 (w2) fix(notices): hold a retraction that arrives before its notice (#2432).

    • Files: a notice_retractions migration, services/canopy-notices/src/{noe_superseded.rs,work_items.rs} and work_items::insert's callers.

    • Tests: a_retraction_before_staging_suppresses_the_letter; a_retraction_racing_its_staging_waits_then_retracts (two connections; the staging holds the lock uncommitted).

  4. U-B (w3) feat(notices): route and retract the WIC advance expiration notice (#2390).

    • Files: crates/canopy-contracts-wic/src/{events.rs,lib.rs}, crates/canopy-reference/src/cross_program.rs, both manifests and templates, services/canopy-notices/src/{generator.rs,event_routing.rs,noe_superseded.rs}, docs/modules/ROOT/pages/api/canopy-notices.adoc.

    • Tests:

      • the route count moves from 55 to 56;

      • the responsible-adult pin is renamed and gains the route; the letters-without-addressing assertion becomes 48 − 3;

      • the route joins both_ruleset_route_cases(), with certification_end forwarded;

      • the_wic_expiration_notice_names_the_child_only_when_redirected, both rulesets, asserting no hearing box;

      • a persisted WIC expiration notice has appeal_rights = None;

      • WIC retraction arms: stage → supersede → dispatch for a queued item, and for a rendered-but-undispatched notice the dispatcher’s claim no longer returns;

      • an unrecognized key parks;

      • default_program_data_is_a_map_of_every_placeholder_family;

      • wire pins for the three V1 events.

MR-2: producer half (Closes #2390)

  1. U-A (w6) feat(wic): expire certifications and stage the advance notice (#2390).

    • Files:

      • services/canopy-wic/{migrations/<next>_wic_lifecycle.sql,src/lifecycle.rs,src/lifecycle_sweep.rs,src/notice_dispatch_subscriber.rs,src/api/lifecycle_sweep.rs,src/api/mod.rs,src/api/persist.rs,src/main.rs,src/params.rs,src/events.rs,src/determine.rs,src/store/participants.rs,src/store/models.rs,tests/wic_test.rs};

      • crates/canopy-contracts-wic/{src/determine.rs,src/participants.rs,src/lifecycle_sweep.rs,src/paths.rs,src/lib.rs,tests/roundtrip.rs};

      • crates/canopy-test-lib/src/clients/wic.rs;

      • tools/canopy-seed/src/{model.rs,datagen.rs,sql.rs};

      • rulesets/federal/{wic-lifecycle.json,citations.toml,indexing.toml,README.adoc};

      • rulesets/{georgia,default,test-max}/{jurisdiction.toml,citations.toml};

      • compliance/input-requirements/wic.toml;

      • services/canopy-eligibility/{src/mappers/mod.rs,tests/orchestrator_dispatch_test.rs};

      • devstack/rabbitmq/definitions.json, xtask/mq-topology-allow.toml;

      • the compliance rows (below);

      • docs/modules/ROOT/openapi/wic.json.

    • Compliance:

      • wic.certification.certification-expiration-notification binds as kind = "system-job", component services/canopy-wic/src/lifecycle_sweep.rs, test_ref two_passes_are_idempotent; its allowlist entry is removed.

      • The scenario wic.certification.certification-expiration-advance-notice binds that test too and keeps blocked_by = ["#826"] (its journey carries benefits on). The #2390 fence is dropped, and it stays Partial.

      • The compliance/action-catalogue/wic.toml GAP comment "WicApplicationContext has no homeless/migrant/disaster flag" is restated: homeless exists now; migrant and disaster remain gaps.

    • Tests:

      • lifecycle.rs: lifecycle_keys_parse_and_refuse_below_the_floor_or_misordered. It covers four packs, a missing table, an unknown key, 14, 367, and a homeless lead below the ordinary one.

      • Sweep infra_tests (ephemeral schema, injected as_of):

        • the_notice_leg_stamps_and_stages_once_per_row (envelope id = stamp);

        • a_homeless_participant_is_noticed_at_the_longer_lead;

        • a_row_first_seen_after_its_lead_is_staged_late_with_a_warn;

        • the_expire_leg_expires_only_current_rows_past_their_end;

        • a_superseded_record_is_not_expired;

        • two_passes_are_idempotent;

        • keyset_crosses_page_boundaries;

        • a_budget_stopped_pass_is_finished_by_the_next_probe_the_same_day and a_failed_row_is_retried_by_the_next_probe_the_same_day, both through run_lifecycle_sweep_locked at one as_of;

        • manual_trigger_skips_while_the_lock_is_held;

        • overdue_and_undispatched_expiries_are_counted;

        • legal_day_rollover_pins.

      • Dispatch subscriber: a_dispatch_stamps_its_certification_once, a_late_dispatch_warns, a_foreign_notice_type_is_ignored, an_unknown_correlation_warns.

      • store/participants.rs (ephemeral schema): homeless_round_trips_through_the_record; superseding_an_undispatched_notice_returns_its_event_id; a_dispatched_notice_is_not_returned_for_retraction.

      • services/canopy-wic/src/api/persist.rs: the retraction event is staged in the supersede transaction.

      • Live (wic_test.rs): wic_lifecycle_sweep_expires_a_lapsed_certification. It determines with a past as_of whose computed end precedes the legal today, retries trigger_lifecycle_sweep through 202, and GETs the record as expired. It never moves the clock, which 38 live tests share (#2140), and it notes the pass is fleet-wide.

  2. U-C (w1) docs: document WIC certification expiration (#2390):

    • api/canopy-wic.adoc and data-models/canopy-wic.adoc;

    • rulesets.adoc ([wic.lifecycle] and the floor file);

    • authorization-inventory.adoc;

    • federal-requirements.adoc: the 246.7(j)(8) row’s "not implemented" cell;

    • CHANGELOG.adoc (Changed: homeless is a required determine field, a pre-1.0 wire change).

  3. docs(plans): close the WIC certification expiration plan (#2390).

Verification

  1. Per unit, in isolated worktrees:

    • fmt, workspace clippy with the portal features, and cargo doc with broken intra-doc links denied;

    • the non-live lanes, and the ephemeral-schema tests filtered by name;

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

  2. Per MR, on its branch:

    • mq-topology;

    • CANOPY_CARGO_FEATURES=canopy-api/test-clock cargo xtask dev reload;

    • cargo xtask api-docs --update, then input-coverage (MR-2: manifest v4 against the regenerated wic.json);

    • git push.

  3. MR-2 is rebased on main after MR-1 merges and deploys.

Deploy note: MR-2’s first pass expires every seeded current certification past its end, and stages late notices for those in their lead window (#2372: the seed’s dates are fixed).

Documentation Updates

  • The pages in U-N1, U-B and U-C.

  • GitLab:

    • file #2431 and #2432 at approval;

    • add "WIC homeless status" to #858’s checklist;

    • after MR-2 merges, close #2390 and repoint its plan link.

Review log

round vendor resolved model verdict

1 (2026-09-28)

Anthropic

claude-opus-5-5

no-ship. Three blockers fixed: * full paths for every cited file; * the live test determines in the past instead of moving the shared clock; * U-C updates the (j)(8) row, and the homeless GAP comment is restated. Observations folded in.

2 (2026-09-28)

OpenAI

gpt-6-astra

no-ship. Seven findings fixed: * hourly locked passes replace the daily fence, so incomplete passes retry; * two MRs, binding-first; * supersession retraction (D7, plus arm 4 #2432); * staged vs dispatched evidence, with overdue handling; * the Regarding: line; * appeal rights follow the letter (#2431); * homeless has no lasting default, and the fixture-only state is established.

Edit this page · default