One WIC certification record per participant (epic &106, Plan A1)
Status: Done (2026-09-27) — !1522
Issues: #2359 (epic &106)
Branches: feat/2359-wic-certification-record (carries this page)
This is a Design + Scope plan. GitLab owns tracking. It freezes when U-A starts. One MR, one battery. Plan A2 (#2358, anchor-date periods) follows it.
Erratum (2026-09-27): D3 as built persists each participant’s whole output (determination, snapshot, record, events) in ascending person_id order through api/persist.rs persist_order, which a persist-level infra test pins; the 409 leaves no determination, snapshot or record, but the snapshot DEK minted before the transaction remains (pre-existing, #2367).
Erratum (2026-09-27): D5’s seeded prior determination is dated on the prior certification’s start (a certification starts on its determination date), with its assessment a week before; and two further catalogue GAP comments the new status and supersession falsified (above mid-certification-disqualification-notice and thirty-day-temporary-certification) are corrected.
Context
-
The record is not a record.
-
wic_participantshas no link to a determination, application or household, and no uniqueness (services/canopy-wic/migrations/20260413000000_create_wic_tables.sql~4-20). -
Its status CHECK is
active\|expired\|terminated\|transferred, but onlyactiveis ever written. -
determineinserts a row on every approval (services/canopy-wic/src/determine.rs~590-604), and nothing updates one. So a person can hold overlapping active certifications. -
store::participants::list_active_by_personis dead code.
-
-
Nothing reaches it.
-
GET /v1/participants/{id}documents only a 403. -
WicParticipant.statusis a freeStringwhose doc names a value the CHECK refuses (crates/canopy-contracts-wic/src/participants.rs~16-39). -
No response carries a participant id.
-
-
Dates.
as_ofis the caller’s value orlegal_today(determine.rs~237-239). Anyas_ofis accepted, including a future one (services/canopy-wic/src/api/handlers.rs~39-63). -
Precedents:
-
DeterminationStatus, the typed-vocabulary shape (crates/canopy-reference/src/enums.rs~54-113); -
a named-constraint violation mapped to a coded 409 (
services/canopy-medicaid/src/determine.rs~762-775); -
a delete-cutover migration (
services/canopy-wic/migrations/20270111000001_determination_status_check.sql). The latest WIC migration is20270113000000.
-
-
Row:
wic.certification.dual-participation-prevention(7 CFR 246.7(l)(1)) is unbound. Detection belongs to #837. -
Reachability: the orchestrator refuses WIC (#2364), so this is exercised through direct service calls.
Rulings in force: pre-1.0, no shims; ADR-016 (forward-only migrations); neutrality N3 (no status token is in any pack); ADR-043 A1 (no actor column here; provenance is #2361).
Scope
In scope: D1–D5.
Out of scope:
-
#2358 (Plan A2): periods.
-
#2360: the writers of
temporary,expiredandterminated; ending a certification with notice. -
#2361: provenance.
-
#837: detection.
-
#895: determination-level supersession.
-
#826: VOC transfer-in, which enrols without a new determination and will need its own record basis.
Pre-existing defects, each filed as a fix: issue:
-
WIC create routes answer 200, not 201.
-
Snapshot DEKs are minted outside the persist transaction, so a rollback, including the new 409, orphans one.
-
The seed’s terminated prior-period row can pick an infant and start its certification before the infant’s birth (
tools/canopy-seed/src/datagen.rs~3497-3533).
Design
| # | Decision |
|---|---|
D1 |
Links and cutover. The migration is
|
D2 |
Typed status.
|
D3 |
Supersession, inside the determine transaction.
|
D4 |
Reachable and documented.
|
D5 |
Seed and compliance.
|
Invariants
-
A person holds at most one current (active or temporary) certification, and the database refuses a second.
-
Every record names the determination that granted it, and its person, application and household match that determination.
-
A re-determination supersedes the prior record in the transaction that writes it, and no certification starts after the service’s legal today.
Units — U-A → U-B, one MR
Commit 1: docs(plans): plan the one WIC certification record (#2359). Last: docs(plans): close the WIC certification record plan (#2359).
U-A (w5) — feat(wic): make wic_participants the one certification record (#2359)
Files:
-
the migration;
-
crates/canopy-contracts-wic/{Cargo.toml,src/participants.rs,tests/roundtrip.rs}; -
services/canopy-wic/src/{store/models.rs,store/participants.rs,determine.rs,api/handlers.rs,api/mod.rs}; -
services/canopy-wic/tests/wic_test.rsand the approved-pregnant insta snapshot (which redactsparticipant_id); -
crates/canopy-test-lib/src/clients/wic.rs; -
crates/canopy-common/src/id.rs; -
tools/canopy-seed/{Cargo.toml,src/model.rs,src/datagen.rs,src/sql.rs,src/manifest.rs,tests/integration.rs}; -
xtask/src/cmd/seed_verify.rs; -
compliance/{action-catalogue/wic.toml,action-coverage-allowlist.toml,scenario-inventory/wic.toml}, for the D5 rows only; -
docs/modules/ROOT/openapi/wic.json.
Tests:
-
certification_status_tokens_round_trip(proptest). -
Ephemeral-schema tests in a
#[cfg(test)] mod infra_testsinstore/participants.rs(theservices/canopy-wic/src/store/determinations.rs~141-226 pattern):-
status_check_admits_exactly_the_certification_vocabulary; -
a_second_current_certification_is_refused, for active and temporary holders; -
persist_certification_supersedes_and_names_the_successor; -
superseded_requires_a_successor; -
participant_must_match_its_granting_determination; -
concurrent_first_certifications_leave_one_current: two sessions viaconnect_raw; -
reversed_order_batches_never_deadlock: two sessions persisting [A, B] and [B, A] through the ordered persist path. One succeeds and the other gets the 409; neither gets 40P01.
-
-
wic_test.rs(devstack):-
wic_approved_determination_links_its_certification_record; -
wic_redetermination_supersedes_the_current_certification; -
wic_redetermination_dated_before_the_current_certification_is_409, which leaves no new determination, snapshot or participant row; -
wic_future_dated_determination_is_refused, which writes nothing; -
wic_denied_redetermination_leaves_the_current_certification; -
wic_get_participant_unknown_is_404.
-
-
Seed invariants: every participant’s determination is an approved determination of the same person, and each person has at most one current row.
U-B (w1) — docs: document the WIC certification record (#2359)
Files:
-
docs/modules/ROOT/pages/api/canopy-wic.adoc: the GET, the 409, the future-date 422 andparticipant_id; -
docs/modules/ROOT/pages/data-models/canopy-wic.adoc: the columns, constraints, index and relationships; -
CHANGELOG.adoc:-
Added: the documented GET, supersession and the 409;
-
Changed: the typed status,
participant_id, and futureas_ofrefused; -
Removed:
transferred, and pre-link rows at cutover.
-
Verification
-
Per unit, in an isolated worktree: fmt, workspace clippy with the portal features,
cargo docwith broken intra-doc links denied, the non-live nextest lanes, the infra tests filtered by name, quality-budgets, neutrality-lint, the policy gates, scenarios audit, test-lanes-lint and machete. -
cargo xtask dev restart,CANOPY_CARGO_FEATURES=canopy-api/test-clock cargo xtask dev reload, a reseed,cargo xtask api-docs --update(only the D2–D4 changes), thengit push.
Documentation Updates
-
The pages in U-B.
-
GitLab: file the three pre-existing
fix:issues, and add this plan’s link to epic &106.
Review log
| round | vendor | resolved model | verdict |
|---|---|---|---|
1 (2026-09-27) |
Anthropic |
claude-opus-5-5 |
ship — no blockers; 14 observations folded in (seed ordering and typing, same-day supersession, return value, 409 scope, seed-verify edges, stale comments, detection-row fields, schema attributes, B3a, the |
2 (2026-09-27) |
OpenAI |
gpt-6-astra |
no-ship — both findings fixed: participants persist in |