Plan: Dispatch WIC determinations from the orchestrator (#2364)

Status: Done (2026-11-01) — U1, U2, U2b, U3 and U4 (#3151, #3152, #3158, #3153, #3154) merged
Epic: &63
Issues: #2364 (parent) · #3151 U1 (w3) · #3152 U2 (w5) · #3158 U2b (w5) · #3153 U3 (w5) · #3154 U4 (w3) · follow-up #3155 (income exclusions)
Branches: feat/wic-breastfeeding-status, feat/wic-derived-category, feat/wic-signed-operation, feat/wic-orchestrated-dispatch, feat/wic-breastfeeding-action

Erratum (2026-10-31): xtask/src/cmd/route_authz.rs classifies canopy-web’s handlers only, so U1 adds no route-authz entry. The list’s readers are the canopy_auth::delegated row WIC_GET_BREASTFEEDING_STATUSES plus the authorization inventory, and U4’s action takes the route-authz entry.

Erratum (2026-10-31): store::breastfeeding::status_on and its tests move from U1 to U2, which first calls it, because canopy-wic is a binary and an uncalled function fails clippy’s dead_code.

Erratum (2026-10-31): U1 also refuses an effective_date outside canopy-wic’s supported years with 422 wic_date_out_of_range, determine’s check, because a date outside PostgreSQL’s DATE range would otherwise answer 500.

Erratum (2026-10-31): the plan missed the maintainer’s 2026-10-29 ruling (#3116, ADR-002 Operation binding) that the orchestrator dispatches only to a service that signs and dedupes the dispatch operation, which quarantine.rs only_an_operation_signing_program_is_dispatched enforces. By maintainer decision, unit U2b (#3158, D2b, Decision 6) is added before U3, and D3 and U3 are corrected to carry and bind the operation.

Erratum (2026-10-31): category::derive returns Result<Option<ParticipantCategory>, PeriodError>, because a window edge outside chrono’s range is an error rather than a silent "no category"; the preflight’s year domain keeps the error unreachable from determine.

Erratum (2026-10-31): D2b adds no signature column. wic_determinations.jws_token already holds each envelope’s signature, so the CHECK reads operation_id IS NULL OR (signed_payload IS NOT NULL AND jws_token IS NOT NULL) and operation_envelopes serves signed_payload with jws_token.

Erratum (2026-10-31): MappedContext::Generic holds a Box<ApplicationContext>, because clippy’s large_enum_variant refuses the unboxed enum; a box serialises as its contents, so every dispatched body is unchanged.

Erratum (2026-11-01): U4’s spec is tests/e2e/specs/flow-wic-file-to-determination.spec.ts, not journey-…: the journey- prefix enrols a spec in the gated walkthrough project (#1409), and this one walks filing to determination, a flow, so the citations below are corrected.

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

Context

Nothing in production calls canopy-wic’s POST /v1/determine. The orchestrator’s map_context (services/canopy-eligibility/src/mappers/mod.rs, Program::Wic arm) refuses WIC with ContextError::InputUnsatisfiable, naming three "worker facts" from wic_worker_fact_gaps(): participant_category, nutritional_risk_documented and is_breastfeeding_fully. The substrate on both sides is already in place: canopy-wic answers the per-subject DeterminationList of signed envelopes that parse_determinations reads (ADR-035 Decision 2), ProgramServiceRegistry knows Program::Wic and its verifier key, and income reaches the mapper already normalised to monthly (#861, normalize_income in services/canopy-eligibility/src/orchestrator.rs). The pregnancy-and-homelessness plan (Plan: Pregnancy and homelessness facts for SNAP and WIC (#3070, #3072, #3073)) put the two pregnancy anchors and the household’s homeless status on the generic context, so MemberContext.pregnancy, MemberContext.pregnancy_end_date and ApplicationContext.homeless are readable.

The three named gaps are not three facts. participant_category is a derivation: 7 CFR 246.2 defines the five categories from the date of birth, the expected delivery date, the pregnancy end date and whether the woman is breastfeeding, and rulesets/federal/wic-certification-periods.json already carries each category’s anchor and window. nutritional_risk_documented is a wire value canopy-wic deliberately ignores: determine reads store::assessments::has_assessment ("don’t trust the caller", services/canopy-wic/src/determine.rs step 2) and the wic-eligibility.json rulesets say so in their comment. Only is_breastfeeding_fully is a fact nobody records, and WIC is its only reader: it chooses between Food Packages V and VII (params::assign_food_package) and, with the pregnancy end date, between the breastfeeding and postpartum categories.

canopy-wic already owns the sibling clinical record. wic_nutritional_risk_assessments (services/canopy-wic/migrations/20260413000000_create_wic_tables.sql), store/assessments.rs, the user-only POST /v1/nutritional-risk-assessments route (services/canopy-wic/src/api/handlers.rs create_assessment, writer role, the assessor is the calling worker’s OIDC subject) and canopy-web’s form on the Nutrition tab (services/canopy-web/templates/cases/tab_nutrition.html, services/canopy-web/src/api/actions_wic.rs POST /actions/wic/nutritional-risk) are the pattern a breastfeeding record copies.

Decisions (best effort, cited; AGENTS.md: no SME gate before 1.0)

  1. canopy-wic owns breastfeeding status and derives the category (maintainer, 2026-10-31). Breastfeeding is WIC-only clinical data, so ADR-001’s one-database-per-service puts it in canopy-wic beside the nutritional-risk assessment, and the category is a rule applied to anchors the service already receives. The three fields leave WicParticipantContext; pre-1.0, nothing keeps them as optional overrides. Rejected: a canopy-persons breastfeeding fact (the sealed-fact machinery for a fact no other program reads) and an orchestrator-side derivation (a program rule outside the program service).

  2. Every household member is a WIC subject. The mapper sends every member; canopy-wic derives no category for a member outside 246.2 and denies that member as not categorically eligible. Rejected: omitting members the mapper thinks cannot qualify, which would make a woman with no facts recorded disappear instead of being denied, and would make an empty list a program failure.

  3. The category derivation order is pregnant, then breastfeeding, then postpartum, then infant, then child, each taken when its anchor falls inside the pack’s window for that category (wic-certification-periods.json: postpartum through 6 months after the pregnancy end date, breastfeeding through 12 months, infant until the first birthday, child from 12 through 60 months). A woman is pregnant whenever an expected delivery date is present, because the orchestrator sends one only from a pregnancy fact open on the determination date. A member with no breastfeeding record on or before the determination date is not breastfeeding.

  4. Gross monthly income is the plain sum of the household’s income records, each already monthly (#861). An income record whose frequency the normaliser could not convert (left unconverted and warned, normalize_income) makes the sum unsound, so the mapper refuses with InputUnsatisfiable naming income[].frequency, source class persons, no gap issue. WIC’s income exclusions (7 CFR 246.7(d)(2)(iv)©) are follow-up #3155, not this plan. adjunctive_program stays None (#2365).

  5. nutritional_risk_documented leaves the wire and the wic_determinations.nutritional_risk_documented column keeps recording the value canopy-wic verified.

  6. canopy-wic signs and dedupes the dispatch operation before the orchestrator dispatches it (the maintainer’s 2026-10-29 ruling, #3116), in canopy-tanf’s shape (b27b412ab): a replay of a known operation answers 200 with the stored envelopes, which strands no retry, since canopy-wic serves no operation read and stays outside reads_operations. It is keyed per subject, as canopy-medicaid’s is (#2673).

Scope

In scope: a breastfeeding-status record in canopy-wic with its route and canopy-web form; category derivation inside canopy-wic; the three fields removed from the determine contract; the orchestrator’s WIC mapper and dispatch; the action-catalogue binding, the input-requirements manifest and the scenario fences that cite #2364; an e2e that files for WIC and reads the determination.

Out of scope: WIC income exclusions (#3155); adjunctive enrollment (#2365); the processing-deadline clock (#831); breastfeeding cessation and category transition (#2392); CAPS dispatch (#857); determination supersession for WIC (#895); the portal asking about breastfeeding; a CLI verb for the record (the nutritional-risk record has none).

Design

D1 — The breastfeeding-status record (canopy-wic)

Migration services/canopy-wic/migrations/<timestamp>_create_wic_breastfeeding_statuses.sql:

CREATE TABLE wic_breastfeeding_statuses (
    id             UUID PRIMARY KEY,
    person_id      UUID NOT NULL,
    status         TEXT NOT NULL CHECK (status IN ('fully', 'partially', 'not_breastfeeding')),
    effective_date DATE NOT NULL,
    recorded_by    TEXT NOT NULL,
    created_at     TIMESTAMPTZ NOT NULL
);
CREATE INDEX idx_wic_breastfeeding_statuses_person
    ON wic_breastfeeding_statuses (person_id, effective_date DESC, created_at DESC);

recorded_by is the worker’s OIDC subject as TEXT, the shape wic_nutritional_risk_assessments.assessor_worker_id took in 20270113000000_actor_subjects.sql, and created_at has no default because migrations-lint forbids DEFAULT now() (20270209000000_decision_stamps_no_default.sql): both are written the way api/handlers/writes.rs record_assessment writes them, from the OidcSubject and the request’s Tick. The record is append-only: a change of status is a new row with a later effective_date, and the status on a date is the latest row with effective_date ⇐ date, ties broken by created_at.

Contract crates/canopy-contracts-wic/src/breastfeeding.rs:

#[derive(Serialize, Deserialize, ToSchema, Clone, Copy, PartialEq, Eq, Debug)]
#[serde(rename_all = "snake_case")]
pub enum BreastfeedingStatus { Fully, Partially, NotBreastfeeding }

#[derive(Serialize, Deserialize, ToSchema, Debug)]
#[serde(deny_unknown_fields)]
pub struct CreateBreastfeedingStatus {
    pub person_id: Uuid,
    pub status: BreastfeedingStatus,
    pub effective_date: NaiveDate,
}

#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct WicBreastfeedingStatus { id, person_id, status, effective_date, recorded_by, created_at }

Paths in crates/canopy-contracts-wic/src/paths.rs: CREATE_BREASTFEEDING_STATUS and LIST_BREASTFEEDING_STATUSES, both /v1/breastfeeding-statuses (the list takes ?person_id=), mirroring the nutritional-risk pair. The POST is user-only and writer-admitted like create_assessment (a service bearer is 403 service_class_on_user_only), answers 201 Created with the stored row, and refuses an effective_date after the service’s legal today with 422 wic_effective_date_in_future (the same shape as wic_as_of_in_future). The list is readable by the same callers as LIST_NUTRITIONAL_RISK_ASSESSMENTS. Both routes join the route-authz classification (xtask/src/cmd/route_authz.rs) under the scope of the nutritional-risk routes (record_nutritional_risk_wic and its read).

Store services/canopy-wic/src/store/breastfeeding.rs: record(db, &CreateBreastfeedingStatus, recorded_by, tick) → WicBreastfeedingStatus, status_on(db, person_id, on: NaiveDate) → Result<Option<BreastfeedingStatus>, sqlx::Error>, list_by_person.

D2 — The derived category and the thinner wire (canopy-wic)

WicParticipantContext (crates/canopy-contracts-wic/src/determine.rs) loses participant_category, is_breastfeeding_fully and nutritional_risk_documented. Its remaining fields are person_id, date_of_birth, expected_delivery_date, pregnancy_end_date, fetus_count, family_size_increase_waived and adjunctive_program. WicApplicationContext is unchanged.

New services/canopy-wic/src/category.rs:

#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum ParticipantCategory { Pregnant, Breastfeeding, Postpartum, Infant, Child }

impl ParticipantCategory {
    /// The wire and ruleset spelling: the `CATEGORY_VOCABULARY` entry.
    pub fn as_str(self) -> &'static str;
}

/// 7 CFR 246.2, in the order of Decision 3, each category taken only when
/// its anchor lies inside the pack's window for it on `as_of`.
pub fn derive(
    p: &WicParticipantContext,
    breastfeeding: Option<BreastfeedingStatus>,
    periods: &CertificationPeriods,
    as_of: NaiveDate,
) -> Option<ParticipantCategory>;

CertificationPeriods (services/canopy-wic/src/certification_period.rs) is the parsed wic-certification-periods.json canopy-wic already holds as wic_params.certification_periods; the windows come from it, never from literals (a parity test asserts as_str() over all five variants equals canopy_policy::wic_food_packages::CATEGORY_VOCABULARY). preflight runs first, in its current order (the empty list, duplicate ids, fetus counts, the as_of domain and future checks, then the per-participant anchor checks), so an out-of-range anchor is still 422 before anything is derived. One check changes: preflight_fetus_count refuses a fetus_count on a participant with no expected_delivery_date (still 422 wic_fetus_count_not_pregnant), where it compared the removed category with pregnant; under Decision 3 a participant is pregnant exactly when she has an expected delivery date, so the rule is the same. After the preflight, determine builds per participant a Participant { ctx, category: Option<ParticipantCategory>, breastfeeding: Option<BreastfeedingStatus> }:

  • In a run that certifies (purpose.certifies()), category is derive(…​), with breastfeeding from store::breastfeeding::status_on(db, person_id, as_of).

  • In an income_reassessment, which certifies no one and checks no anchor, determine first reads the household’s current certification records with the existing non-locking store::participants::list_current_by_household(db, household_id), and category is the matching record’s participant_category (parsed into ParticipantCategory). A participant with no current record is refused there with 422 wic_reassessment_without_certification, before any rules call; persist_outputs → lock_reassessed_records keeps its own check under the row lock, which refuses a record that ended between the read and the commit. breastfeeding is None: a reassessment assigns no food package.

Everything downstream that read p.participant_category reads participant.category.map(as_str), and assign_food_package takes breastfeeding == Some(Fully) where it took is_breastfeeding_fully.

The ruleset input (eligibility_ruleset::WicEligibilityInput.participant_category) becomes Option<&str>. The wic-eligibility.json rulesets need no edit: their categorical expression is five equalities, and null satisfies none, so a member with no category is denied with categorical_eligible = false. The denial reason text becomes "No WIC participant category applies on {as_of}: not pregnant, not within six months after a pregnancy, not breastfeeding within one year after a pregnancy, and not under five (7 CFR 246.2)." The preflight_participant anchor-missing 422 (wic_anchor_missing) goes: derive picks a category only when its anchor is present, which the derive unit tests of U2 pin for each category. The range and after-certification-date checks on every supplied anchor stay.

The persisted wic_determinations.participant_category column (already nullable, read as WicDeterminationRead.participant_category: Option<String>) is written from the derived category, or NULL for a member denied without one; canopy-web’s determination_view.rs renders "none" for it. wic_participants.participant_category stays NOT NULL: only an approved member, who always has a category, gets a certification record.

compliance/input-requirements/wic.toml drops the three rows that cite the closed #769 (participant_category, is_breastfeeding_fully, nutritional_risk_documented), and cargo xtask policy input-coverage compares the manifest with the regenerated docs/modules/ROOT/openapi/wic.json. crates/canopy-contracts-wic/tests/roundtrip.rs asserts the serialised participant carries exactly the seven remaining fields.

D2b — canopy-wic signs and dedupes the dispatch operation (canopy-wic)

Mirror canopy-tanf’s b27b412ab (#3116), keyed per subject like canopy-medicaid’s 20270207000000_medicaid_determinations_operation.sql (#2673):

  • WicApplicationContext gains operation_id: Option<DeterminationOperationId> (#[serde(default, skip_serializing_if = "Option::is_none")]), the operation canopy-eligibility claimed. In post_determine (services/canopy-wic/src/api/handlers.rs), before any read or write, enforce_operation_gate refuses a body naming one from any caller but canopy-eligibility (principal.client() == Client::Confidential(ConfidentialClient::Eligibility), on its system token or its onward delegation) with 403. A direct caller naming none still determines.

  • determine assigns operation_id on every participant’s envelope before signing (the field canopy_signing::SignableDetermination already carries), so each envelope binds the operation.

  • Migration <timestamp>_wic_determinations_operation.sql. wic_determinations gains operation_id UUID, signed_payload BYTEA (the exact RFC 8785 bytes the signature covers, computed once at signing) and signature TEXT, with no defaults.

    • A CHECK holds that operation_id IS NULL OR (signed_payload IS NOT NULL AND signature IS NOT NULL).

    • CREATE UNIQUE INDEX wic_determinations_operation_subject_uq ON wic_determinations (operation_id, person_id) WHERE operation_id IS NOT NULL.

    • Rows written before the migration carry none of the three and stay readable.

  • A replay. Before computing, post_determine reads store::determinations::operation_envelopes(db, operation_id): every row of that operation, signed_payload and signature read verbatim, in person_id order. If there are any, it answers 200 DeterminationList with them and writes no row or event.

  • A race. A concurrent second execution that passed the lookup trips the index (23505) in persist_outputs; the transaction rolls back, and the request answers 409 coded operation_already_determined (the code canopy-eligibility’s OPERATION_ALREADY_DETERMINED reads). The orchestrator’s next retry is answered from the store.

  • services/canopy-wic/src/api/held.rs names the row’s operation in each held item where it said operation_id: None, as canopy-tanf’s held list does since #3116.

D3 — The orchestrator’s WIC mapper (canopy-eligibility)

map_context returns a body, not a generic context: a new

#[derive(Serialize)]
#[serde(untagged)]
pub(crate) enum MappedContext {
    Generic(ApplicationContext),
    Wic(WicApplicationContext),
}

The dispatch loop stamps the claimed operation_id on both arms (D2b). It stamps benefit_effective_date and effective_date_basis on the Generic arm only, since WIC’s context has neither. .json(&ctx) serialises either arm. quarantine::signs_its_operation gains CanopyService::Wic, so a WIC envelope that signs another operation, or none, is quarantined provenance_rejected like any bound program’s. In the tests of quarantine.rs, Program::Wic moves from the unsigned list to the bound one, and only_an_operation_signing_program_is_dispatched now admits it. canopy-wic stays outside reads_operations (it serves no operation read: a replay answers from its store), so held_ops::adoptable_program(Program::Wic) stays false and WIC holds stay drop-only, as TANF’s do.

map_context(program, ctx) gains the run’s legal day, as_of: NaiveDate, the date the household read already used. New services/canopy-eligibility/src/mappers/wic.rs, pub(crate) fn context(ctx: &ApplicationContext, as_of: NaiveDate) → Result<WicApplicationContext, ContextError>:

  • application_id, household_id, household_size, homeless and jurisdiction from the generic context; purpose: WicDeterminationPurpose::Evaluation; as_of: Some(as_of), the stamp canopy-wic’s preflight expects from the orchestrator (#1561).

  • gross_monthly_income: each ctx.income value deserialised to canopy_contracts_persons::income::Income (typed at the boundary); the sum of amount over records whose frequency == "monthly"; any record with another frequency returns InputUnsatisfiable(vec![MissingInput { field: "income[].frequency", source_class: "persons", gap_issue: None }]). A record with amount: None adds nothing (redacted records were already dropped upstream).

  • participants: every ctx.members entry, with person_id parsed, date_of_birth parsed, expected_delivery_date and fetus_count and family_size_increase_waived from member.pregnancy (waived defaults to false when there is no pregnancy, which is never read), pregnancy_end_date from the member, adjunctive_program: None. A person_id or date_of_birth that does not parse is a persons data error and refuses with InputUnsatisfiable naming members[].person_id or members[].date_of_birth, source class persons.

wic_worker_fact_gaps() (#769’s gap list) and the Program::Wic refusal go; the module docs and ADR-034’s "CAPS and WIC refuse" sentence are updated to say CAPS alone.

Bindings and fences: compliance/action-catalogue/wic.toml binds wic.certification.orchestrated-determination-dispatch to service = "eligibility", path = "/eligibility/determine", verb = "post", operation_id = "post_determine", test_ref = services/canopy-eligibility/tests/orchestrator_dispatch_test.rs (the GAP comment above it goes); the #2364 entry leaves compliance/action-coverage-allowlist.toml. In compliance/scenario-inventory/wic.toml, #2364 leaves the six blocked_by lists; the breastfeeding and postpartum rows, left with no fence, bind additionally to the canopy-wic derivation tests of D2 (services/canopy-wic/tests/wic_test.rs::wic_derives_breastfeeding_from_the_record and ::wic_derives_postpartum_without_a_record), and the file-to-notification journey binds additionally to the e2e of D4 while keeping #831. cargo xtask scenarios audit and policy action-coverage are clean.

D4 — The worker form and the journey (canopy-web, e2e)

services/canopy-web/templates/cases/tab_nutrition.html gains a "Breastfeeding status" form beside the assessment form: the household’s members in a person_id select, a status radio over the three values, an effective_date date input, posting to POST /actions/wic/breastfeeding-status in services/canopy-web/src/api/actions_wic.rs with the same WritePermission, participation-scope and bound-delegation checks as /actions/wic/nutritional-risk, forwarding to canopy-wic’s CREATE_BREASTFEEDING_STATUS under the worker’s delegation. The tab lists each member’s current status from LIST_BREASTFEEDING_STATUSES. mock_upstream grows the two routes; primitives_test.rs template counts and route_authz.rs mutating-route totals move by one each.

e2e tests/e2e/specs/flow-wic-file-to-determination.spec.ts: a household of a woman whose pregnancy ended two months ago (recorded through /actions/pregnancy/add then /actions/pregnancy/end), her infant, and a father; the WIC worker records a nutritional-risk assessment for the woman and the infant and a fully breastfeeding status for the woman; the application is filed for wic; the case’s Determination tab shows three WIC determinations: the woman approved as breastfeeding on Food Package VII, the infant approved as infant, and the father denied as not categorically eligible.

Risks

  • No breastfeeding record reads as not breastfeeding (silent). A woman between six and twelve months postpartum with no status recorded derives no category and is denied. Mitigation: the Nutrition tab shows "no status recorded" beside each member (D4), the denial reason names breastfeeding, and wic_derives_postpartum_without_a_record pins the behaviour.

  • family_size_increase_waived defaults to false for a member with no pregnancy (silent, never read). canopy-wic reads the waiver only beside a fetus_count, which only a pregnancy supplies; the mapper unit test asserts the pair travels together.

  • An unconverted income frequency refuses dispatch (fail-closed). The household gets input_unsatisfiable naming income[].frequency rather than a WIC determination on an understated sum; the mapper unit test covers it.

  • Fixture churn (silent). Twenty-six files build WicParticipantContext with the three fields (services/canopy-wic/tests/wic_test.rs anchored_participant, the lifecycle and termination fixtures, the parity tests). U2 changes them mechanically: a fixture that chose a category now supplies the category’s anchor and, for breastfeeding, a status row. A fixture that silently lands in another category would change its asserted outcome; the per-category derive tests and the re-read insta snapshots are the check. The pinned as_of helpers (pinned_as_of, months_before) already date the anchors.

  • Ruleset sync (fail-closed). The three wic-eligibility.json copies are compared with the Rust input shape by the #330/#331 sync tests; Option<&str> serialises as null, which the existing expression already fails. The sync tests are the proof; a ruleset edit is not expected.

  • Seed. tools/canopy-seed inserts wic_determinations rows directly; every column it writes stays, so the seed is unaffected.

Units (weights by complexity) — U1 → U2 → U2b → U3 → U4

Weights: 1 trivial · 2 small · 3 medium · 5 large · 8 very large. One unit = one independently shippable MR = one child issue.

U1 (w3) — The breastfeeding-status record

Files: services/canopy-wic/migrations/<timestamp>_create_wic_breastfeeding_statuses.sql, crates/canopy-contracts-wic/src/breastfeeding.rs, crates/canopy-contracts-wic/src/paths.rs, services/canopy-wic/src/store/breastfeeding.rs, services/canopy-wic/src/api/handlers.rs, services/canopy-wic/src/api/mod.rs, xtask/src/cmd/route_authz.rs, docs/modules/ROOT/openapi/wic.json, docs/modules/ROOT/pages/api/canopy-wic.adoc, docs/modules/ROOT/pages/data-models/canopy-wic.adoc.

D1. Tests: a route test that a service bearer is 403 service_class_on_user_only and a writer’s POST answers 201 with recorded_by the caller’s subject; an infra test that status_on returns the latest effective row on or before the date and None before the first; a 422 for a future effective_date; a contract roundtrip in crates/canopy-contracts-wic/tests/roundtrip.rs.

U2 (w5) — Derive the category; the three fields leave the wire

Files: crates/canopy-contracts-wic/src/determine.rs, services/canopy-wic/src/category.rs (new), services/canopy-wic/src/determine.rs, services/canopy-wic/src/eligibility_ruleset.rs, services/canopy-wic/src/params.rs, services/canopy-wic/src/store/determinations.rs, services/canopy-wic/tests/wic_test.rs and the fixtures under services/canopy-wic/src/**/fixtures.rs, compliance/input-requirements/wic.toml, docs/modules/ROOT/openapi/wic.json, services/canopy-web/src/determination_view.rs.

D2. Tests: category::derive unit tests for each category, the pregnant-over-postpartum precedence, the day each window closes (postpartum at six months, breastfeeding at twelve, infant on the first birthday, child at the end of the sixtieth month), and a member with no anchor; the vocabulary parity test; integration tests wic_derives_breastfeeding_from_the_record (a fully row gives breastfeeding and Package VII, a partially row Package V) and wic_derives_postpartum_without_a_record; a member with no category is denied with the new reason and a NULL category; the existing per-category tests pass by anchor alone. The insta snapshots under services/canopy-wic/tests/snapshots/ are re-accepted after reading each diff.

U2b (w5) — canopy-wic signs and dedupes the dispatch operation

Files: crates/canopy-contracts-wic/src/determine.rs, services/canopy-wic/migrations/<timestamp>_wic_determinations_operation.sql, services/canopy-wic/src/api/handlers.rs, services/canopy-wic/src/determine.rs, services/canopy-wic/src/api/persist.rs, services/canopy-wic/src/store/determinations.rs, services/canopy-wic/src/api/held.rs, the fixtures that build WicApplicationContext, docs/modules/ROOT/openapi/wic.json, docs/modules/ROOT/pages/api/canopy-wic.adoc, docs/modules/ROOT/pages/data-models/canopy-wic.adoc.

D2b. Tests, mirroring b27b412ab’s: * The gate: a worker’s delegation and another system caller are refused; the orchestrator’s system token and onward delegation are admitted; a direct caller naming no operation passes. * A replay answers the same envelopes byte for byte and adds no row or outbox event. * A raw insert of an operation row without its signed bytes trips the CHECK (23514). * Two executions of one operation racing past the lookup leave one set of rows, and the loser answers 409 operation_already_determined (a concurrency test, the category a race fix carries). * Every envelope of a dispatch signs its operation.

U3 (w5) — The orchestrator dispatches WIC

Files: services/canopy-eligibility/src/mappers/mod.rs, services/canopy-eligibility/src/mappers/wic.rs (new), services/canopy-eligibility/src/orchestrator.rs (the dispatch stamp and MappedContext), services/canopy-eligibility/src/quarantine.rs (signs_its_operation and its tests), services/canopy-eligibility/tests/orchestrator_dispatch_test.rs, compliance/action-catalogue/wic.toml, compliance/action-coverage-allowlist.toml, compliance/scenario-inventory/wic.toml, docs/modules/ROOT/pages/adrs/adr-034-per-program-determination-context-mapping.adoc.

D3. Tests: mapper unit tests for the income sum, the unconverted-frequency refusal, a member’s pregnancy fields and the all-members rule; wic_input_unsatisfiable_when_mapper_errs becomes wic_dispatches_every_member_as_a_subject, with a canopy-wic mock asserting the posted body (every member, the summed income, no category field) and the posted operation_id, and the orchestrator recording one signed envelope per member; a WIC envelope signing another operation is quarantined provenance_rejected; settle_matrix tests cover a WIC list with one approved and one denied subject. Closes #2364.

U4 (w3) — The breastfeeding form and the journey

Files: services/canopy-web/templates/cases/tab_nutrition.html, services/canopy-web/src/api/actions_wic.rs, services/canopy-web/src/api/case_detail/wic_tab.rs, services/canopy-web/src/api/mock_upstream.rs, services/canopy-web/src/api/wic_action_route_tests.rs, services/canopy-web/tests/primitives_test.rs, xtask/src/cmd/route_authz.rs, tests/e2e/specs/flow-wic-file-to-determination.spec.ts, docs/modules/ROOT/pages/api/canopy-web.adoc, docs/modules/ROOT/pages/guide/caseworker.adoc.

D4. Tests: route tests for the refusals (no write permission, out of scope, a member not on the roster) and the forwarded body; the e2e above.

Verification

  1. cargo xtask test — the unit and integration lanes pass (see Testing).

  2. cargo xtask dev restart after U1’s migration, then cargo xtask e2e — specs/flow-wic-file-to-determination.spec.ts and specs/wic.spec.ts.

  3. cargo xtask policy input-coverage, policy action-coverage, scenarios audit, route-authz audit and api-docs are clean.

  4. cargo xtask validate — the pre-push battery is green.

Documentation Updates

  • api/canopy-wic.adoc (the breastfeeding routes, the determine body), data-models/canopy-wic.adoc (the table), api/canopy-web.adoc (the action), services.adoc (WIC is orchestrator-reachable)

  • CHANGELOG.adoc — one entry per unit under == Unreleased

  • adr-034-per-program-determination-context-mapping.adoc — the WIC sentence; guide/caseworker.adoc — the Nutrition tab

Review log

round vendor resolved model verdict

1

Anthropic

claude-fable-5-1

FLAGS — Risks named no fail-open/fail-closed/silent class and missed the two silent defaults; D3 omitted jurisdiction and as_of; evidence beyond the supplied files was unlisted. Fixed: Risks classified and extended, D3 completed, an evidence comment added.

2

Google

gemini-4-argon

FLAGS — recorded_by must be TEXT and created_at take no default (migrations-lint); deriving before the preflight would skip its 422s and break income_reassessment; no contract test for the removed fields; #769 unnamed. Fixed: D1’s DDL, D2’s order and the reassessment path, a roundtrip assertion, #769 named.

Edit this page · default