Plan: a scheduled WIC termination is enacted, and a timely appeal holds it (#3387)

Status: Done (2026-11-23) — four units; a scheduled termination is enacted, a timely appeal holds it, and a won late appeal restores it
Epic: &162
Closes: #3387 (by U4)
Issues: #3387 (parent) · U1 #3526 · U2 #3527 · U3 #3528 · U4 #3531 · follow-ups #3529, #3530
Branches: feat/wic-termination-hold, feat/appeals-wic-termination-arm, feat/wic-termination-enactment, feat/wic-termination-restore

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

Context

  • The defect. canopy-wic schedules a mid-certification termination and mails its 7 CFR 246.7(j)(6) notice, and nothing ends the certification. services/canopy-wic/src/lifecycle_sweep/settle.rs says "The leg enacts nothing"; no code outside fixtures writes the terminated record status. The household has a letter naming the day benefits end, and stays certified until the period expires.

  • Why it was left. The archived plan plans/archive/wic-mid-certification-termination.adoc deferred enactment, the appeal hold, the canopy-appeals arm, wic.certification_terminated and the expiration-notice retraction to a follow-on that was never written. This plan is that follow-on.

  • The law (eCFR, current to 2026-11-19, read 2026-11-23):

    • 246.7(j)(6): written notice "not less than 15 days before the suspension or disqualification".

    • 246.9(g): "Participants who appeal the termination of benefits within the 15 days advance adverse action notice period provided by § 246.7(j)(6) must continue to receive Program benefits until the hearing official reaches a decision or the certification period expires, whichever occurs first."

    • 246.9(e): at least 60 days to request a hearing; an appeal after the notice period is heard, without continued benefits.

    • 246.9(k)(3): "If the decision is in favor of the appellant and benefits were denied or discontinued, benefits shall begin immediately."

  • What exists.

    • wic_participant_terminations.status is scheduled or cancelled; wic_participants admits terminated only with termination_id and terminated_on (services/canopy-wic/migrations/20270116000000_wic_terminations.sql).

    • The sweep runs settle, notice, expire (services/canopy-wic/src/lifecycle_sweep.rs); letter_on_time (services/canopy-wic/src/terminations.rs) judges a letter.

    • canopy-appeals holds an enrollment adverse action through a synchronous command whose receipt precedes its commit (services/canopy-appeals/src/clients.rs, AdverseActionsClient), and contests one of three record kinds (crates/canopy-contracts-appeals/src/appeals.rs, ContestedRecord). It has no edge to canopy-wic (crates/canopy-auth/src/identity_policy.rs).

Ruling (maintainer, 2026-11-23): the hold is synchronous at filing: canopy-appeals takes a hold receipt from canopy-wic before the appeal commits.

Scope

In: the hold in canopy-wic; a wic_termination contested arm in canopy-appeals that places, releases and cancels through it; enactment in the lifecycle sweep; wic.certification_terminated; retracting an unsent expiration notice at enactment; restoring an enacted termination when a late appeal is decided for the household; the termination statuses.

Out, each on its own issue:

  • other termination bases (#3313); sanctions, claims and the rest of #827; temporary certification (#2393);

  • the letter stating the continued-benefits right (#3529): the hold works whether or not the letter says so;

  • a worker-portal form for filing against a WIC termination (#3530): the API and canopy-cli file it;

  • benefits for the days between an enactment and its reversal (#827, which holds WIC claims and continued benefits): U4 restores the certification from the day of the decision.

Design

The hold (U1, canopy-wic)

wic_termination_holds (termination_id, appeal_id, status, placed_at, placed_on, ended_at), primary key (termination_id, appeal_id), status held or released, foreign key to the termination.

PUT /v1/terminations/{termination_id}/holds/{appeal_id}, admitted to canopy-appeals' system token alone, body { household_id, command }:

  • hold: under the record then termination locks, 200 with a receipt when the termination is scheduled, belongs to household_id, and the legal today is before its effective_on (the notice period of 246.9(g)). Refusals are 409 and coded: termination_not_scheduled, hold_not_timely, termination_household_mismatch. A repeat by the same appeal answers the stored receipt.

  • release: the hold becomes released; idempotent.

  • cancel: the hold is released and the termination cancelled with a new reason appeal_reversed (actor canopy-appeals), through cancel_scheduled_termination_locked, which closes or rescinds its letter as every cancel does.

Reads, each admitted to canopy-appeals' system token alone: GET of the same path reads one hold; GET /v1/terminations/holds?status=held pages the standing holds (each with placed_at); GET /v1/terminations/{termination_id} reads one termination with its household_id, status, effective_on and held, and answers 404 for an unknown id. The existing worker read (GET /v1/participants/{id}/terminations) gains held: bool.

A cancelled or expired termination’s holds are released in the same transaction. The settle leg is unchanged: a held termination whose letter is late is still repaired, and its hold stands.

The appeals arm (U2, canopy-appeals)

ContestedRecord::WicTermination { termination_id }. At filing, for program wic only:

  1. read the termination from canopy-wic by id; an unknown id and another household’s termination both answer 404, as the other arms do (services/canopy-appeals/src/api/mod.rs);

  2. send hold; a receipt commits the appeal with the hold recorded; hold_not_timely commits the appeal with no hold (the hearing is still owed, 246.9(e)); termination_not_scheduled (the termination was enacted, or is over) also commits the appeal with no hold, since the hearing is owed either way; a household mismatch is 404;

  3. canopy-wic unreachable is 503 with nothing committed.

The arm refuses an adverse_action_id (continued benefits here are the hold, not an enrollment stay).

At a recorded decision or a finalized withdrawal, after the appeal’s own commit (the order canopy-appeals uses for enrollment):

  • reversed_household, and a final appeal recorded reversed after an upheld_agency decision (FinalAppealOutcome::Reversed), send cancel, whether or not the appeal holds: it cancels a scheduled termination and restores an enacted one (U4);

  • upheld_agency, dismissed and a withdrawal send release, and only when the appeal placed a hold. An appeal that filed with no hold owes nothing on those outcomes.

The command owed is written on the appeal row in that commit (wic_hold_command: release or cancel, cleared by the receipt), so a command that fails afterwards is not lost. It leaves a standing hold, which only delays.

A retry worker, wic_hold_retry (the services/canopy-appeals/src/rep_overturn_retry.rs precedent), settles what is left:

  • it re-sends every owed command until its receipt clears it;

  • it pages canopy-wic’s standing holds and releases one whose appeal_id names no appeal row, but only when the hold was placed more than one hour ago (a mechanism constant). A filing mints its appeal id, takes the hold and commits within seconds, so the floor keeps the worker from releasing the hold of a filing still in flight.

The reconcile scanner (services/canopy-appeals/src/reconcile.rs) stays report-only, as its header requires: it gains findings for an owed command older than its alert age and for a standing hold on a terminal appeal.

New: wic_url in canopy-appeals' config, a WicTerminationsClient, the Appeals → canopy-wic service purpose, and the arm in the hearing view.

Enactment (U3, canopy-wic)

Statuses: wic_participant_terminations.status gains enacted (with enacted_at); the CHECKs are widened by a new migration.

An enact leg runs after settle and before notice. It scans scheduled terminations with effective_on ⇐ today, and for each, in its own transaction under the record, termination, letter and hold locks, enacts when all hold:

  • the record is active or temporary;

  • the live letter has dispatch evidence and was on time (letter_on_time);

  • no hold is held.

Enacting writes the termination enacted with record_status_before (the record’s status as enacted, for U4), the record terminated with termination_id and terminated_on (the later of effective_on and the pass’s day, so a termination released after its date ends that day and not on a past one; test a_released_termination_ends_on_the_pass_day), stages wic.certification_terminated (WicCertificationTerminatedV1: participant, determination, household, person, termination, reason code, terminated_on), and, when the record’s expiration notice is staged and undispatched, stages wic.expiration_notice_superseded for it. A termination with an undispatched or late letter is not enacted: the settle leg repairs or cancels it first.

A hold and an enactment take the same record lock, so one commits first: a hold after enactment is refused termination_not_scheduled, and an enactment after a hold finds it.

The sweep report gains terminations_enacted and terminations_held.

Restoration (U4, canopy-wic)

An appeal filed after the notice period carries no hold, so its termination is enacted; 246.9(k)(3) then requires benefits to begin at once when the appeal is decided for the household.

wic_participant_terminations.status gains reversed (with reversed_at); only an enacted termination becomes reversed. cancel on an enacted termination, under the record and termination locks:

  • when the record is still terminated by this termination and its certification_end is on or after the legal today, the record returns to the status it had (U3 keeps it on the termination as record_status_before, since enactment overwrites the record’s), termination_id and terminated_on are cleared, the termination becomes reversed, and wic.certification_restored (WicCertificationRestoredV1) is staged;

  • when the period has since ended, or a later determination superseded the record, the termination becomes reversed and the record is left: no period is left to restore. The receipt says which happened.

The outcome is kept on the termination (reversal_outcome: restored or nothing_to_restore), and a repeat answers it. Until U4 lands, cancel on an enacted termination answers 409 termination_enacted and the owed command stays on the appeal row for the retry worker, so no reversal is lost between U3 and U4.

Units

Unit Change Status

U1

The hold table, its three commands and two reads, held on the termination read, the appeal_reversed cancel reason, hold release on cancel and expiry. No enactment.

Done (2026-11-23)

U2

The wic_termination arm: filing, decision, withdrawal, the owed-command column, the retry worker, the scanner findings; the client, config and service purpose.

Done (2026-11-23)

U3

The enacted status, the enact leg, wic.certification_terminated, the expiration-notice retraction, the report counters.

Done (2026-11-23)

U4

The reversed status, restoration through cancel, wic.certification_restored; closes #3387.

Done (2026-11-23)

The order is the safety property: enactment lands only after the hold and the arm that places it, and restoration follows it directly.

Risks

Risk Mode Mitigation

A timely appellant is terminated because enactment ran before the hold landed

fail-open

The hold is synchronous and shares the record lock with enactment; concurrency test a_hold_and_an_enactment_never_both_win. Enactment (U3) lands only after U1 and U2.

canopy-wic is unreachable at filing, and a retry the next day is past the notice period

fail-closed

503 with nothing committed, so the worker sees the failure and retries the same day; the route is one indexed write. Stated in api/canopy-appeals.adoc.

A hold is placed and the appeal’s commit then fails, leaving a hold with no appeal

silent

The retry worker releases a standing hold whose appeal does not exist once it is an hour old; tests an_orphan_hold_is_released_after_the_floor and a_hold_younger_than_the_floor_is_left (the second guards a filing in flight, which would otherwise fail open).

A release or cancel fails after the decision commits

silent

The owed command is on the appeal row from the decision’s commit; the hold stands, which only delays; the retry worker re-sends it; test an_owed_hold_command_is_resent_until_its_receipt.

A termination is enacted on a letter that never went out or went out late

fail-open

The enact predicate requires dispatch evidence and letter_on_time; tests a_termination_with_an_undispatched_letter_is_not_enacted and a_termination_with_a_late_letter_is_not_enacted.

A released termination is enacted with a past terminated_on

silent

terminated_on is the later of the date and the pass’s day; tests a_released_termination_ends_on_the_pass_day and a_termination_enacted_on_its_date_ends_that_day.

An unsent expiration notice is mailed to a terminated participant

silent

Retracted at enactment in the same transaction; test asserts the staged event and its absence when already dispatched.

A late appeal is won and the participant stays terminated

silent

U4 restores through cancel; between U3 and U4 the owed command is kept and re-sent; tests a_won_late_appeal_restores_the_certification and a_cancel_refused_as_enacted_stays_owed.

A restore revives a record whose period has ended or that a later determination replaced

fail-open

The restore re-checks the record under its lock; tests a_restore_after_the_period_changes_no_record and a_restore_of_a_superseded_record_changes_no_record.

A consumer of the record status meets terminated for the first time

fail-open

U3’s first commit lists every reader of WicCertificationStatus and wic_participants.status with a test on a terminated record.

Tests

  • Concurrency: a_hold_and_an_enactment_never_both_win (two tasks on one termination: exactly one of held-and-scheduled or enacted-and-refused); two hold commands for one appeal leave one row.

  • Boundary (integration, canopy-wic): enacted on effective_on, not the day before; a hold accepted the day before effective_on and refused on it; not enacted while held, enacted the pass after release with terminated_on that day; cancelled, not enacted, on cancel; not enacted with an undispatched or late letter; an expiring record ends expired and its hold is released.

  • Contract (wire): round-trips for the hold request, receipt and list, WicCertificationTerminatedV1 with a wire pin, the wic_termination arm, the sweep report; OpenAPI snapshots.

  • Through canopy-appeals (integration): filing takes a receipt before commit; hold_not_timely and termination_not_scheduled each file without a hold; canopy-wic down is 503 with no appeal row; an unknown or foreign termination is 404; each decision outcome, a reversing final appeal and a withdrawal send their command, and an appeal with no hold owes none on an agency outcome; the three retry-worker tests; the scanner mutates nothing.

  • Restoration (integration): the four U4 tests named under Risks; a repeat cancel answers the same receipt.

  • Regression: the case that would have caught #3387: a scheduled termination with an on-time dispatched letter is terminated after the pass on its date.

  • Admission: the hold route refuses every system token but canopy-appeals', and every user.

  • Each new pin is proved by a mutant.

Documentation Updates

  • state-machines.adoc: the termination statuses with enacted, and the hold.

  • api/canopy-wic.adoc, data-models/canopy-wic.adoc, api/canopy-appeals.adoc, data-models/canopy-appeals.adoc, services.adoc, authorization-inventory.adoc.

  • federal-requirements.adoc: the 246.9(g) row; compliance/action-catalogue/wic.toml and compliance/scenario-inventory/wic.toml rows for enactment and the hold.

  • devstack/rabbitmq/definitions.json: wic.certification_terminated (U3) and wic.certification_restored (U4) in canopy-wic’s write ACL.

  • CHANGELOG.adoc: one entry per unit.

  • Close: U4’s MR closes #3387; Status becomes Done (date).

Review log

round vendor resolved model verdict

1

anthropic

claude-fable-5-2

FLAGS (P2): the plan had the reconcile pass release and cancel holds, but reconcile.rs is report-only by its own header; releasing a hold "whose appeal does not exist" had no age floor, so it could release the hold of a filing still in flight. P1, P3, P4 pass.

2

google

gemini-4-carbon

FLAGS (P2): canopy-appeals had no read of a termination by id, and the read’s admission was unstated; a household mismatch answered 422 where the other arms answer 404; the reconcile mutation and the missing age floor, as round 1; two never-claims named no test. P1, P3, P4 pass.

The plan presented for approval carried these resolutions: a retry worker on the rep_overturn_retry.rs precedent settles holds, with the command owed written on the appeal row, and the scanner stays report-only; an orphan hold is released only after an hour, with a test of each side of that floor; canopy-wic gains a system read of one termination, and an unknown or foreign termination answers 404; each never-claim names its test. The maintainer approved it on 2026-11-23 after ruling that the hold is synchronous at filing.

The draft named epic &106, the archived plan’s; the issue sits under &162, which this page states.

The review of this page’s commit then found two gaps in the approved draft. An appeal filed after enactment would have been refused 422, though the hearing is still owed; it now files without a hold. And a late appeal decided for the household had no effect on an enacted termination, against 246.9(k)(3); the maintainer ruled on 2026-11-23 that restoration joins this plan as U4, which now closes the issue.

Errata

  • Erratum (2026-11-23): a restore also leaves the record when the person already holds a newer current certification (the plan said "a later determination superseded the record"; a terminated record is never superseded, the person is certified anew), and it clears the stamp of a notice of expiration that enactment retracted.

  • Erratum (2026-11-23): the appeal's hold field is wic_hold_state, not a _status name, which the verdict-typing lint reads as an untyped verdict.

  • Erratum (2026-11-23): the enact leg also leaves a record whose certification period has already ended to the expire leg, and terminated_on never falls after a period's end.

Edit this page · default