canopy-wic API Reference

For a service integrator (orchestrator or worker-BFF author) calling canopy-wic: the routes below are the ones services/canopy-wic/src/api/mod.rs::routes() mounts, spelled from crates/canopy-contracts-wic/src/paths.rs, with the guard each handler applies. Schema detail lives in the canopy-wic data model.

Base URL

container port 8017 (host: CANOPY_PORT_CANOPY_WIC_8017 in .ports.env); canopy_api::ApiServer::router mounts every route under /v1.

Authentication

Bearer token: a canopy-identity token for this receiver (its aud is urn:canopy:service:canopy-wic), authenticated by the service’s identity receiver (ADR-049 Amendment 14): no bearer is 401 token_missing, a token it refuses 401 token_rejected, an X-Canopy-Actor header 400 actor_header_retired, and no trustworthy key set in time 503 keys_unavailable.

Access

no client holds a system edge to canopy-wic, so no system token for it can be minted; canopy-web, canopy-cli and canopy-eligibility (onward, inside a worker’s request) hold delegation edges to it. The writes admit the writer bar, the reads caseworker+ (canopy-web’s case readers on the household determinations, assessments and breastfeeding-status lists, and on the upcoming-appointments feed alone), the redaction data_steward, the snapshot read admin or quality_control, or canopy-eligibility's onward delegation at caseworker+ (GET /v1/determinations/{id}/snapshot), and the lifecycle-sweep trigger admin via canopy-cli. A refusal is 403 with its ReceiverDenial code (ADR-049 Amendment 14); each route’s constant is in the authorization inventory.

Shapes

crates/canopy-contracts-wic/src/ (determine.rs, determinations.rs, participants.rs, lifecycle_sweep.rs, terminations.rs, nutritional_risk.rs, breastfeeding.rs, appointments.rs, events.rs); the redact request/response is the shared canopy_contracts_eligibility::determine pair. Snapshot: docs/modules/ROOT/openapi/wic.json (cargo xtask api-docs); live Swagger UI at /swagger-ui on the same port.

Database

canopy_wic (ADR-001); WIC is not FTI-scoped.

Routes

Method Path Access 2xx Coded 4xx

POST

/v1/determine

writer

200

403, 409 (wic_current_certification_exists, operation_already_determined), 422 (wic_as_of_in_future, wic_anchor_after_certification_date, wic_date_out_of_range, wic_fetus_count_out_of_range, wic_fetus_count_not_pregnant, wic_reassessment_without_certification)

GET

/v1/determinations

caseworker+; case reader via canopy-web

200

400 (a malformed household_id, limit or purpose), 403

GET

/v1/determinations/{id}

caseworker+

200

403, 404

GET

/v1/determinations/{id}/snapshot

admin or quality_control; caseworker+ via canopy-eligibility

200

403, 404

POST

/v1/determinations/{id}/redact

data_steward

200

400, 403, 404

GET

/v1/held-determinations

determination operator via canopy-eligibility

200

403, 422 (invalid_limit, invalid_cursor)

GET

/v1/participants?household_id=

caseworker+

200

400, 403

GET

/v1/participants/{id}

caseworker+

200

403, 404

POST

/v1/participants/lifecycle-sweep/run

admin via canopy-cli

200, 202

403

GET

/v1/participants/{id}/terminations

caseworker+

200

403, 404

POST

/v1/participants/{id}/terminations/{termination_id}/cancel

writer

200

403, 404, 409 (termination_household_mismatch), 422 (missing household_id or unknown body field)

POST

/v1/wic/households/{household_id}/terminations

writer

201, 200

403, 404, 409 (idempotency_key_reused, wic_termination_already_scheduled), 422 (idempotency_key_invalid and the evidence and date codes, Mid-certification termination)

POST

/v1/nutritional-risk-assessments

writer

201

400, 403, 422

GET

/v1/nutritional-risk-assessments?person_id=

caseworker+; case reader via canopy-web

200

403

GET

/v1/nutritional-risk-assessments/{id}

caseworker+

200

403, 404

POST

/v1/breastfeeding-statuses

writer

201

403, 422 (wic_date_out_of_range, wic_effective_date_in_future, or a malformed body or unknown field)

GET

/v1/breastfeeding-statuses?person_id=

caseworker+; case reader via canopy-web

200

400, 403

POST

/v1/wic/households/{household_id}/appointments

writer

201

403

GET

/v1/wic/appointments/upcoming

case reader via canopy-web

200

403

Access legend (bars in crates/canopy-auth/src/roles.rs): writer = CASEWORKER_WRITER_ROLES (caseworker, eligibility_specialist, supervisor, admin; quality_control is read-only); caseworker+ = CASEWORKER_OR_ABOVE_ROLES (the writer roles and quality_control); case reader = CASE_READER_ROLES (caseworker+, analyst and studio_admin); a role in backticks admits that role. A bar alone admits a user’s delegation through any client; via canopy-web or via canopy-cli only through that client, another client’s delegation 403 actor_not_allowed; a delegation without the roles is 403 required_role_missing. The constants: WRITER and READER (api/handlers.rs), OPERATION (api/lifecycle_sweep.rs), the redaction’s inline Admission::user_roles(&["data_steward"]), and the six canopy_auth::delegated rows (WIC_GET_DETERMINATIONS, WIC_GET_DETERMINATIONS_ID_SNAPSHOT, WIC_GET_HELD_DETERMINATIONS, WIC_GET_NUTRITIONAL_RISK_ASSESSMENTS, WIC_GET_BREASTFEEDING_STATUSES, WIC_GET_WIC_APPOINTMENTS_UPCOMING); determination operator = DETERMINATION_OPERATOR_ROLES.

The redaction names data_steward alone, so admin does not satisfy it; whether an admin also holds data_steward is provisioning. On the devstack the role is the Kanidm group canopy_role_data_steward (devstack/kanidm/migrations/00-canopy.hjson), whose one member is data.steward; the admin accounts are not in it.

Determination

POST /v1/determine

Runs one signed determination per participant (ADR-035). Handler: handlers::post_determine.

Request WicApplicationContext (determine.rs): application_id, household_id, purpose ([purpose]), household_size, gross_monthly_income — the one shared income input, tested against 185% FPL — homeless (homeless status), participants[], each a WicParticipantContext (person_id, the optional anchor dates date_of_birth, expected_delivery_date and pregnancy_end_date (anchor dates), the optional fetus_count and the required family_size_increase_waived (fetus count), and the optional adjunctive_certifications, each {program, basis} with basis full or presumptive (adjunctive routes)), jurisdiction, the optional as_of: the evaluation date, and the optional operation_id (operation binding). In an evaluation, as_of is also the certification date, the start of any certification the request grants. When as_of is omitted, the service uses its legal today: the legal day of the request’s one decision instant (Tick, services/canopy-wic/src/tick.rs, #2448), which also stamps every determination and certification record the request writes and every supersession it makes.

Operation binding (#3158, ADR-002 Operation binding). operation_id is the determination operation canopy-eligibility claimed for the dispatch; a direct caller sends none.

  • Gate: a body naming an operation_id is 403 from any caller but canopy-eligibility, on its system token or its onward delegation (enforce_operation_gate, src/api/handlers.rs), before any read or write. The refusal is logged with the caller’s client alone.

  • Signing: every participant’s envelope signs the operation (envelope.operation_id, determine::sign), so canopy-eligibility binds each envelope to the operation that asked for it. Each wic_determinations row stores the operation and signed_payload, the exact bytes its jws_token covers; a direct caller’s rows store the bytes and no operation.

  • Replay: when the body’s operation_id already has determinations, the handler answers 200 DeterminationList with them, in person_id order, each parsed from its row’s signed_payload with its stored jws_token (determine::replayed_determinations). It makes no rules call, and writes no row and stages no event. A dispatch retried after its first execution committed therefore binds the same determinations. canopy-wic serves no operation read, so a replay is answered here rather than refused.

  • Race: when a concurrent execution of the same operation commits its determinations after this one’s replay check found none, this one’s insert trips wic_determinations_operation_subject_uq, one row per operation and participant. It answers 409 operation_already_determined, the code canopy-eligibility reads, whose detail names no database object, and its transaction rolls back every participant. The orchestrator’s next retry is answered from the store.

A participant carries no category, breastfeeding status or nutritional-risk flag (#3152). canopy-wic derives the category ([category]) and reads the breastfeeding status (Breastfeeding statuses) and the nutritional-risk assessment it records, so a caller states only the facts it holds.

Purpose: purpose is a required WicDeterminationPurpose with no default (#2445); a body that omits it, or states another token, is refused 422 by the JSON extractor.

  • evaluation: an application or a recertification. Everything below applies: each approval is certified.

  • income_reassessment: the mid-certification income reassessment of 7 CFR 246.7(h)(1)(ii). It records each member’s typed income_eligible and adjunctive_eligible results as the evidence a later termination reads, and it certifies no one. The termination routes (#2391, Mid-certification termination) schedule terminations from it.

An income_reassessment differs from an evaluation in these ways:

  • Current record required: every participant must hold a current (active or temporary) certification record, or the request is refused with 422 wic_reassessment_without_certification, naming the participant, and nothing is written. The check runs twice. Before any rules call, determine reads the household’s current records once, without a lock (store::participants::list_current_by_household), and takes each participant’s category from the matching record ([category]); a participant with none is refused there, so no ruleset is evaluated (#3152). The check runs again first in the persist transaction (api/persist/reassessment.rs), which refuses a record that ended between the read and the commit. It locks each participant’s current record FOR SHARE (store::participants::lock_current_record) in ascending person_id order, the order a supersession locks records in. The record therefore stays current until the reassessment commits: a supersession or a lifecycle-sweep expiry of it waits for the commit. A record superseded by a request that commits while the reassessment waits reads as not current, and the reassessment is refused; a retry sees the successor.

  • Preflight: the anchor-date checks (wic_anchor_after_certification_date, and wic_date_out_of_range on an anchor) exist only to derive the category and compute the certification period, so a reassessment skips them. The empty-list and duplicate checks, the fetus-count checks (fetus count), and the as_of domain and future checks, still apply.

  • Gates: the run computes no certification period, so the category-date gate is not scored: program_extension.category_dates_valid is absent, and the sealed program input records certification_date, certification_period and category_dates_valid as null. The other gates are scored as in an evaluation, and a member is approved when they all pass.

  • No certification: the run assigns no food package and mints no certification record. It supersedes nothing and stages no wic.certification_created. The envelope carries no effective_date, expiration_date, participant_category, food_package or participant_id. The determination’s participant_category and end_date are null, and its effective_date, a required column, holds as_of, the date the reassessment evaluated.

  • Written as usual: each member’s determination, input snapshot, snapshot DEK and wic.determination_completed are written in one transaction. The determination row, the event, the envelope’s program_extension and the sealed program input each state purpose.

Homeless status: homeless is a required boolean with no default (#2390): whether the household’s members are homeless individuals as 7 CFR 246.2 defines one. A body that omits it is refused 422 by the JSON extractor, never read as false. It decides no verdict and is not in the sealed input snapshot. Each certification record the request grants carries it, and it selects the lead of that record’s advance notice of expiration (Certification lifecycle).

Fetus count: under 7 CFR 246.7(d)(2)(vii), a pregnant woman meets the income guideline if it would be met with her family increased by the number of embryos or fetuses in utero, the same increased size may be used for her categorically eligible family members, and the applicant may waive the increase (#3146).

  • The income family size: household_size plus the fetus_count of each pregnant participant, one with an expected_delivery_date, whose family_size_increase_waived is false (income_family_size, services/canopy-wic/src/determine.rs). An absent count adds nothing.

  • One size for the household: canopy’s WIC economic unit is the household, so every participant’s income test takes its limit at that size: [wic].income_limit_pct_fpl of the poverty guideline for the income family size (economic_unit). The ruleset and its thresholds are unchanged; the ruleset still sees input.household_size as reported.

  • Recorded: the sealed program input records household_size beside income_family_size, and the participant’s fetus_count and family_size_increase_waived as supplied. An income denial reason names the income family size its threshold is for.

  • Preflight, in both purposes, since both run the income test: a count outside 1 to 8 (MIN_FETUS_COUNT / MAX_FETUS_COUNT, canopy-persons' pregnancy bounds) is 422 wic_fetus_count_out_of_range. A count on a participant with no expected_delivery_date, who is not pregnant, is 422 wic_fetus_count_not_pregnant (#3152): the count is refused rather than ignored, because dropping it unseen could deny a household the rule admits. The waiver alone is never refused. Each names the participant and the field, never the count.

Anchor dates: a certification period is computed from the participant’s anchor dates (7 CFR 246.7(g)(1); the vocabulary, the federal bounds and each pack’s rules are in Rulesets › WIC certification periods). The per-category anchors list in the federal layer’s wic-certification-periods.json decides which anchor a category derives from ([category]) and its period reads:

Category Anchor

pregnant

expected_delivery_date

postpartum, breastfeeding

pregnancy_end_date: the day the pregnancy ended, by a birth or a loss

infant, child

date_of_birth

An infant’s food package (I or II) follows its age in whole months on as_of, computed from date_of_birth; the request carries no age.

Preflight: in an evaluation, every participant is checked before any rules call, DEK mint or write. The first failure answers 422, naming the participant and the field but never the value. A missing anchor is no refusal (the former 422 wic_anchor_missing is gone, #3152): the participant derives no category that needs it.

  • wic_anchor_after_certification_date: a date_of_birth or pregnancy_end_date is after as_of;

  • wic_date_out_of_range: any date, as_of or an anchor, falls outside the years 1900–9999, the supported date domain.

Participant category: canopy-wic derives each participant’s 7 CFR 246.2 category; the request states none (#3152, services/canopy-wic/src/category.rs). In an evaluation, after the preflight and before any rules call, it reads the participant’s breastfeeding status on as_of (Breastfeeding statuses) and takes the first category that applies, in this order:

  1. pregnant, whenever an expected_delivery_date is present: a caller sends one only for a pregnancy open on the date;

  2. breastfeeding, when the status is fully or partially and the pregnancy_end_date lies inside the breastfeeding window;

  3. postpartum, when the pregnancy_end_date lies inside the postpartum window, whatever the status;

  4. infant, then child, when the date_of_birth lies inside the window.

Each window is the pack’s, read from the certification-period table (the federal window narrowed by the pack’s, as the period uses), never a literal: postpartum through six months after the pregnancy ends, breastfeeding through twelve, infant until the first birthday, and child from the first birthday through the end of the fifth-birthday month or the pack’s narrower close. A woman between six and twelve months after the pregnancy with no status recorded, or with not_breastfeeding, derives no category.

A member with no category is no refusal. Every household member is a WIC subject, so such a member is sent to the ruleset with a null category, which fails its five category equalities, and is denied as not categorically eligible with the reason 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 member gets no period, category_dates_valid is false, and the determination’s participant_category is null. An income_reassessment derives nothing: each participant’s category is the current certification record’s ([purpose]), and it reads no breastfeeding status.

Adjunctive routes (7 CFR 246.7(d)(2)(vi), #3312, services/canopy-wic/src/adjunctive.rs). canopy-wic resolves each participant’s route from the participants' adjunctive_certifications, the request’s participants being the family, before the ruleset runs, and passes the ruleset input.adjunctive_route (null for none). The (A) routes are mandatory and federal, the federal layer’s wic-adjunctive-routes.json: participant, the participant’s own certification (SNAP when full; TANF or Medicaid full or presumptive); family_tanf, any participant’s full TANF certification; family_medicaid, the full Medicaid certification of a participant whose category is pregnant or infant. The pack’s [wic].adjunctive_programs is the State’s (B) election only; a participant’s own certification in one of its programs is the state_option route. The participant’s own route is taken first, then state_option, then the first family route in the file’s order. A program no route names confers nothing, matched exactly: SNAP and chip (unless elected) are not routes. The determination records the route and its program, adjunctive_route and adjunctive_program, in the signed program_extension, the snapshot and the row; under a family route the program is the family member’s. The snapshot’s participant records the adjunctive_certifications as sent, and its policy_params the (B) list and adjunctive_routes_digest, the federal file’s digest. canopy-wic refuses to boot on a malformed routes file and on a pack listing snap, tanf or medicaid. Each certification may name the determination_id it rests on (#2365). The orchestrator sends each participant the certifications their recorded determinations in force give them, every one full and naming its determination; a direct caller states its own and names none. A certification decided in the same run as the WIC determination is not seen: that run is income-tested (#3383).

Per participant (services/canopy-wic/src/determine.rs): the pack’s wic-eligibility.json ruleset decides every eligibility gate and their combination (ADR-003, #3079). It runs categorical eligibility, the income test and adjunctive eligibility: an income-ineligible participant for whom canopy-wic resolved an adjunctive route (adjunctive routes) is income-eligible. canopy-wic sends the category it holds ([category]) and scores the two gates a ruleset cannot and passes them in: the category’s dates, checked in Rust (date-window denial), and a recorded assessment in wic_nutritional_risk_assessments. The ruleset’s eligible approves a participant only when it is categorically eligible, its category dates are valid, it is income- or adjunctively eligible, and its nutritional risk is documented; an income reassessment scores no dates, and the unscored gate does not decide. determine records the ruleset’s verdict and never recombines the gates. The typed request and verdict are in services/canopy-wic/src/eligibility_ruleset.rs, and a verdict missing a gate answers 500, never a denial. The food-package family follows 7 CFR 246.10(e), Package VII for a woman whose recorded status is fully, and the certification period is computed from the anchors. The input snapshot (ADR-028) is persisted in determination_snapshots and its hash is signed into the envelope. Denied participants included, the snapshot records the request’s purpose, the anchors as supplied, the certification date, the breastfeeding_status canopy-wic read and the participant_category it holds (both null when none), category_dates_valid and the certification_period, which is null for a member with no category. The derivation graph records the category as a derived node read from every anchor, the certification date, the breastfeeding status and the certification-period table, and the period and package edges read that node (#3152). The period records the effective window, federal_end, rule_end, end and controlling: {bound, authority, anchor}, where bound is window_from, window_through, federal_maximum or pack_rule, and anchor is the field a denial reason names (the excluding window edge’s anchor, or the anchor of the term that set the end). Its policy_params record certification_periods: the federal file’s digest (federal_digest) and, per category, the option’s registry key (option), the pack’s election, the federal arm in force (federal_arm) and the pack’s rules and windows.

Inclusive end: an approved participant is certified from as_of through the computed end, inclusive, so the end is the last day of the certification. The envelope’s effective_date / expiration_date, the determination’s effective_date / end_date and the record’s certification_start / certification_end carry the same two dates.

Date-window denial: a participant whose dates do not fit its category gets a signed denial with a written reason (7 CFR 246.7(j)(5)), never a 422. The effective window is the federal window narrowed by the pack’s windows. The participant is denied when as_of falls outside that window, or when its computed period ends before as_of. Since the category is derived only inside its window (#3152), a derived category is never outside it; the gate denies when the period has already ended. The reason names the anchor field and the controlling authority, never a date:

  • outside the window: outside the category on the certification date: {field} ({authority});

  • the period already ended: the certification period set by {authority} has already ended: {field}.

The authority is the one that decided. A federal bound cites 7 CFR, and a pack’s cutoff cites the pack’s own authority. For example, a Georgia breastfeeding woman whose pregnancy ended 2025-01-01 is still in the category on 2026-01-01, but CT-840.01 VI ended her period on 2025-12-31, so a certification that day is denied citing DPH WIC CT-840.01 VI. An infant whose date_of_birth puts it past the infant window derives child ([category]); the former 422 for an infant age above 11 months (#770) is gone. program_extension.category_dates_valid carries the gate’s result beside the other gate booleans. A member with no category gets no period: category_dates_valid is false with no date reason, and the categorical denial explains it.

Certification record: each approved participant of an evaluation gets one wic_participants row, the participant’s certification record (Participants). The row names the determination that granted it and carries that determination’s application, household and person. Its id is minted before signing and returned at program_extension.participant_id, so the signature covers it. A denied participant gets no row and no participant_id.

Supersession (store::participants::persist_certification): a person holds at most one current (active or temporary) certification.

  • An approval whose as_of is on or after the start of the person’s current certification supersedes it in the same transaction: the current row becomes superseded, its superseded_by names the new row, and it keeps its signed certification_end.

  • When the superseded record’s advance notice of expiration was staged and has no dispatch evidence, the same transaction stages wic.expiration_notice_superseded (api/persist/supersession.rs), so canopy-notices retracts a letter about an end that no longer applies. A dispatched notice is left alone; the successor’s own notice follows (Certification lifecycle).

  • A same-day re-determination also supersedes: the prior record never took effect, so it is replaced outright.

  • An approving re-determination whose as_of is strictly before the current record’s certification_start is refused with 409 wic_current_certification_exists, because that record would end before it began. The same 409 answers a race between two requests certifying one person. The transaction rolls back, so the request leaves no determination, snapshot, snapshot DEK or participant row.

  • A superseded record’s scheduled mid-certification termination is cancelled superseded in the same transaction, its live letter closed and, when undispatched, retracted (Mid-certification termination, #2391).

  • A denied re-determination leaves the current certification alone: ending one needs the 15-day notice of 7 CFR 246.7(j)(6), which the termination route schedules (Mid-certification termination).

No future-dated certification: a certification begins on the date the applicant is determined eligible, which is never later than the service’s legal today. An as_of after that day is 422 wic_as_of_in_future (past the year 9999, wic_date_out_of_range), refused before anything is written, so a future-dated successor can never supersede today’s certification. The test clock steers the legal today.

Atomicity: all N determinations, snapshots, snapshot DEKs, participant rows, supersessions and outbox events commit in one transaction (persist_outputs, services/canopy-wic/src/api/persist.rs); a participant row is minted only when every gate of an evaluation passes. Each snapshot’s DEK is generated and KEK-wrapped while the determination is computed (PgRedactionKeyStore::mint_unpersisted), and its redaction_keys row is inserted in that transaction beside the snapshot it seals (persist_minted_with), so a request that does not commit leaves no key (#2367). The participant rows persist, and an income_reassessment locks its current records, in ascending person_id order, so every request takes row and index locks in the same order, and two requests naming the same people in opposite orders cannot deadlock.

422, each before any write: participants[] is empty or a person_id repeats; a fetus count is out of range or on a participant who is not pregnant (wic_fetus_count_out_of_range, wic_fetus_count_not_pregnant; fetus count); household_size is below 1 (#2685, refused before any rules call or key mint); a date fails the preflight (wic_anchor_after_certification_date, wic_date_out_of_range; anchor dates); wic_as_of_in_future, when as_of is after the service’s legal today; or wic_reassessment_without_certification, when an income_reassessment names a participant who holds no current certification record, refused before any rules call ([purpose]).

409 wic_current_certification_exists when the new certification would give the person a second current certification: an approving re-determination dated before the current one’s start, or a concurrent certification of the same person. 409 operation_already_determined when a concurrent execution of the dispatch’s operation_id committed its determinations first (operation binding); nothing is written.

Response 200 DeterminationList — one SignableDetermination per participant (canopy_signing), each carrying person_id, snapshot_hash and the dispatch’s operation_id, absent for a direct caller; program_extension carries the request’s purpose and the gate booleans, category_dates_valid among them in an evaluation, and an evaluation’s approved participant’s program_extension.participant_id is the id of its certification record.

Orchestrated dispatch: the orchestrator’s map_context (services/canopy-eligibility/src/mappers/mod.rs) answers input_unsatisfiable for WIC, naming the worker facts it cannot source: participant category, breastfeeding status and nutritional risk (#769). This route no longer takes any of the three (#3152); the orchestrator’s WIC mapper is #3153. The expected delivery and pregnancy end dates, the fetus count and its waiver come from canopy-persons' pregnancy fact (#3143), and homeless status from its homelessness fact (#3144). So the orchestrator’s onward delegation never reaches this route today; a writer’s delegation sent directly does. The route already signs and dedupes the dispatch operation (operation binding, #3158), the precondition canopy-eligibility sets for dispatching a program.

GET /v1/determinations

Handler: handlers::list_determinations; params DeterminationListParams.

  • household_id (optional) — that household’s determinations, newest first, at most 100 rows (store::determinations::list_determinations_by_household).

  • limit (optional) — page size of the unscoped, jurisdiction-wide newest-first list; canopy_api::pagination::clamp_limit applies default 50, range 1..=200. Ignored when household_id is given.

  • purpose (optional, #2445) — evaluation or income_reassessment ([purpose]): only that purpose’s determinations. The store filters in SQL before either list’s bound (the household’s 100 rows, or limit), so newer reassessments never crowd evaluations out of the window. Any other token is 400, as for a malformed household_id or limit.

Response 200 — array of WicDeterminationRead (determinations.rs): the WicDetermination fields flattened, snapshot_hash always present. Every row states its purpose ([purpose]). An income_reassessment row decides no certification, so a reader that picks a participant’s current or latest decision asks for purpose=evaluation. canopy-web’s WIC roster, household rollup and cross-program matrix (determination_view::wic_decisions_path) and its recent-determinations panel do, and each also skips any reassessment row it is served (#2445).

GET /v1/determinations/{id}

Handler: handlers::get_determination. 200 WicDeterminationRead; 404 when no determination has that id.

GET /v1/determinations/{id}/snapshot

A determination's frozen ADR-028 input snapshot, exactly as stored (#3427): the read canopy-snap serves for its own determinations. Handler: snapshot::get_determination_snapshot (src/api/snapshot.rs).

Access

admin or quality_control; caseworker+ via canopy-eligibility (delegated::WIC_GET_DETERMINATIONS_ID_SNAPSHOT): canopy-snap's snapshot admission less its system arm, since no client holds a system edge to canopy-wic. A system token is 403 service_class_on_user_only. The snapshot carries the proven facts, their provenance, income and household composition, so a worker's direct delegation needs admin or quality_control; any other is 403 required_role_missing, a caseworker's included. The caseworker+ arm admits canopy-eligibility's onward delegation alone.

Response 200 — the typed DeterminationSnapshot the determination stored in determination_snapshots. Its sealed parts (program_input, the sealed fact leaves) are returned sealed: the route opens nothing and reads no key. 404 when no determination has the id. 500 when the determination exists and its snapshot row does not (corruption, logged as an error: every determination signs a snapshot_hash and writes its snapshot in the same transaction), or when the stored snapshot's schema_version is one this build does not read (DeterminationSnapshot::verify_schema_version).

GET /v1/held-determinations

The determinations whose completion events canopy-wic still holds past its held-row warning age, oldest first (#3065): the read an operator lists before adopting or dropping one through canopy-eligibility. A determination’s events stay held until canopy-eligibility records or disowns it (ADR-002 Amendment 7), so a listed determination is one the held-row watch warns about. The read releases and drops nothing.

Access

a determination operator through canopy-eligibility alone (delegated::WIC_GET_HELD_DETERMINATIONS, src/api/held.rs; determination operator = DETERMINATION_OPERATOR_ROLES): a system caller is 403 service_class_on_user_only, a user’s direct delegation 403 actor_not_allowed, and a delegation without the roles 403 required_role_missing.

Query (HeldDeterminationsQuery): after, the previous page’s next; limit, 1 to 200, default 50; determination_id, to look up one determination.

Response (200): HeldDeterminationPage (crates/canopy-contracts-eligibility/src/held.rs): items, in (held_since, determination_id) order, and next, an opaque cursor absent on the last page. Each item is { determination_id, program, operation_id, held_since, held_rows }:

  • held_since is when the oldest still-held event was staged, and held_rows how many are held. A determination is listed once its held_since is older than the decision clock’s instant less CANOPY_MQ_HELD_AGE_WARN_SECS (MqTuning::held_age_warn; Configuration Reference).

  • program is wic.

  • operation_id is the canopy-eligibility operation the determination was dispatched under, read from its wic_determinations row (#3158), and absent for a direct caller’s determination or one written before #3158.

  • A hold whose determination row is missing is still listed, with no operation, and logged at WARN.

Returns 422 invalid_limit for a limit outside 1 to 200 and invalid_cursor for an after no page issued.

POST /v1/determinations/{id}/redact

Crypto-shreds the determination’s input snapshot (ADR-036). Handler: handlers::post_redact_determination; path constant canopy_contracts_eligibility::paths::REDACT_DETERMINATION.

Request RedactDeterminationRequest { "reason": "…" }; a blank reason is 400.

Behaviour: the determination must exist (404 otherwise); PgRedactionKeyStore::shred_with("determination_snapshot", id) tombstones the per-determination DEK in redaction_keys and the determination.redacted audit event (actor sub the steward’s canopy subject, principal.attribution_sub(); the reason; no plaintext) is staged in the same transaction. The snapshot ciphertext and the signed snapshot_hash are untouched, so the JWS still verifies. Re-redacting tombstones nothing and still returns 200.

Response 200 RedactDeterminationResponse { "determination_id", "redacted_at" }; redacted_at, also the determination.redacted event’s, is the request’s decision instant (#2473). The DEK’s shredded_at is that instant too, and its created_at the determining request’s (#2475).

Participants

A participant row is one person’s WIC certification record, written by the approving determination (POST /v1/determine). A person holds at most one current certification, and the database refuses a second (data model).

GET /v1/participants?household_id={uuid}

Handler: handlers::list_participants; household_id is required (ParticipantListParams), and a missing or malformed one is 400. Lists the household’s current certification records (store::participants::list_current_by_household): the active or temporary rows, at most one per person, in person_id order (#2380). A superseded, expired or terminated record is not listed.

Response 200 — an array of WicParticipant, empty when the household holds no current certification. The worker portal no longer reads it: its WIC interim-contact and change-report forms are household-level since #2409.

GET /v1/participants/{id}

Handler: handlers::get_participant; path param id (WicParticipantId).

Response 200 WicParticipant (participants.rs):

  • id — the record’s id, the one POST /v1/determine returned at program_extension.participant_id;

  • person_id;

  • determination_id — the determination that granted the certification;

  • application_id, household_id — that determination’s;

  • participant_category, certification_start / certification_end (the certification’s first and last days; inclusive end), food_package;

  • status — a WicCertificationStatus (Certification status);

  • homeless — the homeless status the granting request stated ([homeless]);

  • superseded_by — the successor record’s id, set exactly when status is superseded;

  • termination_id, terminated_on — the termination that ended the record and its first day not certified, set exactly when status is terminated (the enact leg writes them, Certification lifecycle, #3387);

  • created_at, updated_at — stamped at the writing request’s or pass’s decision instant (#2448).

403 on a guard failure; 404 when no participant has that id.

Certification status

WicCertificationStatus (crates/canopy-contracts-wic/src/participants.rs) is the closed vocabulary of WicParticipant.status, and the wic_participants status CHECK admits exactly its tokens. active and temporary are current (WicCertificationStatus::CURRENT).

Value Current Written by

active

yes

The approving determination (POST /v1/determine).

temporary

yes

Reserved for the thirty-day temporary certification, #2393.

expired

no

The lifecycle sweep (Certification lifecycle), for a current record whose inclusive certification_end precedes the jurisdiction’s legal today, a lapsed temporary certification included.

terminated

no

The lifecycle sweep's enact leg, when a scheduled mid-certification termination takes effect (Certification lifecycle, #3387). The database admits it only with the termination that ended the record (termination_id, the named CHECK wic_participants_terminated_check). #2393’s proof-of-ineligibility path is not built; breastfeeding cessation after six months postpartum is #2392. The demo seed writes prior-period records expired.

superseded

no

A re-determination of the same person, in the transaction that writes the successor.

Certification lifecycle

services/canopy-wic/src/lifecycle_sweep.rs (#2390) gives the 7 CFR 246.7(j)(8) advance notice of expiration and expires every certification past its end, and settles scheduled mid-certification terminations (#2391). Every hourly probe runs one full pass under the canopy-wic.lifecycle-sweep advisory lock, with no daily window fence, so a row that failed or that a budget-stopped pass never reached is retried by the next probe the same day. Every leg is idempotent by predicate, and the legs run settle → notice → expire. One decision instant is read per pass (the logical clock, which the test clock steers), and its legal day in the jurisdiction’s timezone drives every comparison and stamp.

  • Settle leg (lifecycle_sweep/settle.rs, #2391): each scheduled termination whose live letter can no longer be on time ([termination-letters]) is judged again in its own transaction under the record, termination and letter locks. Its letter is closed (retracted when undispatched), and the termination keeps its date or moves to the new earliest date (the pass’s day plus the termination’s required_advance_days plus the two days of dispatch slack), whichever is later, so a repair never moves a termination earlier; a replacement letter at that date quotes the closed letter’s date (replaces_effective_date, the same date when it was kept: the letter replaces the earlier notice, and its own date starts the hearing window). When that date falls after the record’s expiration-notice bound (its end minus its expiration lead), the termination is cancelled expires_first instead: the certification ends first. A scheduled termination of a record no longer current is cancelled with the record’s reason (expired, superseded). A termination whose letter is on time is left for the enact leg.

  • Notice leg: a current record without a staged notice is due when its end is on or after the legal today and its lead date is on or before it. The lead date is the end minus the pack’s lead: [wic.lifecycle].expiration_notice_lead_days, or expiration_notice_lead_days_homeless for a record whose homeless is true (Rulesets › WIC certification lifecycle). Per row, one transaction stamps expiration_notice_staged_on with the legal day and expiration_notice_event_id with a pre-minted envelope id, re-checking that the record is still current and unstaged, and stages wic.expiration_notice_due under that id. A notice staged after the record’s lead date is staged late, whether the record was first seen late or an earlier attempt failed; each is logged at WARN.

  • Expire leg: a current record whose inclusive end precedes the legal today flips to expired with expired_at set to the pass instant, re-checking that it is still current (a record superseded meanwhile is left alone), and wic.certification_expired is staged in the same transaction. Its scheduled termination, if any, is cancelled expired there too, its letter closed and, when undispatched, retracted. Expiry never waits for delivery: (j)(8) is a notice duty, not a precondition. A record that expires without dispatch evidence for its notice is WARNed and counted.

  • Enact leg (lifecycle_sweep/enact.rs, #3387), after the settle leg and before the notice leg: each scheduled termination whose effective_on is on or before the legal today is judged in its own transaction under the record, termination and letter locks, and enacted when the record is active or temporary and its period has not ended, the live letter has dispatch evidence and was on time ([termination-letters]), and no hearing hold stands (The hearing hold on a termination). Enacting writes the termination enacted (with enacted_at and the record's earlier status), the record terminated with termination_id and terminated_on (the later of effective_on and the pass's day, so a termination a hold kept past its date ends the record on the day it is enacted), stages wic.certification_terminated, and retracts the record's notice of expiration (wic.expiration_notice_superseded) when it is staged and unsent. A termination whose letter is unsent or late is never enacted: the settle leg repairs or cancels it. A record whose period has already ended is the expire leg's.

  • Failures and overdue notices: every leg pages by keyset under one time budget; a failed row is WARNed and counted. After the legs the pass counts the current records past their lead date whose notice has no dispatch evidence and WARNs when there are any. canopy-notices publishes no failure event: a letter that failed terminally is parked there for operator recovery, and a recovered letter still correlates.

  • Dispatch evidence (notice_dispatch_subscriber.rs, queue canopy-wic.notice-dispatched): a notice counts as sent only when canopy-notices' notice.dispatched for notice_type = wic_notice_of_expiration (the pinned canopy_contracts_notices::correlation::WIC_NOTICE_OF_EXPIRATION, which canopy-notices checks every manifest against at boot, #2435) carries the record’s expiration_notice_event_id back as source_event_id. The consumer stamps expiration_notice_dispatched_at and expiration_notice_dispatched_date set-once, with no status filter, so a superseded or expired record’s late dispatch still stamps. It ignores other notice types, WARNs on an unknown correlation, and WARNs when the dispatch date is after the record’s lead date. A notice.dispatched for wic_notice_of_termination (WIC_NOTICE_OF_TERMINATION) stamps its letter row ([termination-letters]) the same way, set-once and whether or not the letter was closed: notice_id, notice_date, noticed_effective_date and the dispatched_at/dispatched_date pair. A printed termination date other than the letter row’s WARNs. The letter stamp first locks the letter’s termination (terminations::stamp_dispatched_letter), and when that termination is already cancelled, the stamp stages wic.termination_rescinded for the letter (Events published, #3018). Every stamp’s updated_at is the delivery’s decision instant (#2448).

POST /v1/participants/lifecycle-sweep/run

Handler: lifecycle_sweep::trigger_lifecycle_sweep; path constant LIFECYCLE_SWEEP_RUN. Runs the same locked pass as the hourly probe now, for journeys and operators; there is no request body and no caller-supplied date. The pass is fleet-wide: it acts on every record in the service.

Response 200 LifecycleSweepRunOutcome (lifecycle_sweep.rs) { "skipped": false, "report": { … } } when this call ran the pass; the LifecycleSweepReport counts staged (the late ones included), staged_late (staged after the record’s lead date, certification_end minus the lead, whether first seen late or after an earlier attempt failed), expired, expired_without_dispatched_notice, notices_overdue, warned (failed rows, retried by the next pass), terminations_repaired (moved with a replacement letter), terminations_cancelled (in the settle leg, or with the record the expire leg expired; #2391), terminations_enacted and terminations_held (due and ready, but a hearing hold stands; #3387). 202 { "skipped": true, "report": null } when another invocation holds the advisory lock. 403 for any caller but a canopy-cli admin: actor_not_allowed through another client, required_role_missing without admin.

Mid-certification termination

services/canopy-wic/src/api/terminations.rs (#2391) schedules and cancels the 7 CFR 246.7(h)(1)(ii) disqualification of household members a mid-certification income reassessment found ineligible, with the 7 CFR 246.7(j)(6) written notice not less than the pack’s lead before it takes effect. Scheduling and cancelling are human decisions: both writes admit a writer’s delegation, and the stored actor is the delegation’s canopy subject (stored, not exposed). These routes end no certification themselves: the lifecycle sweep's enact leg does, on the termination date (Certification lifecycle). A worker form in canopy-web is #2450. The 246.9(g) hearing hold is The hearing hold on a termination.

One lock order holds everywhere: the certification record, then its termination, then the termination’s live letter (store::terminations). The dispatch stamp takes the last two only: the termination, then the letter it stamps. A superseded record’s termination is cancelled in the supersede transaction (Participants), and the lifecycle sweep settles the rest (Certification lifecycle).

POST /v1/wic/households/{household_id}/terminations

Handler: terminations::schedule_terminations. Request ScheduleTerminationsRequest (terminations.rs, unknown fields refused): reason_code (a [wic.lifecycle.termination] reason; Rulesets › WIC certification lifecycle), reassessment_determination_ids (one income_reassessment run, one per currently certified member), optional effective_on (the termination date, the first day not certified; only a date on or after the earliest is admitted), and idempotency_key (non-blank, at most 255 bytes, the header layer’s bound, and no NUL, else 422 idempotency_key_invalid).

Idempotency, two layers: the global middleware replays a repeated Idempotency-Key header’s response byte for byte. The body idempotency_key is validated, then read before any other check, and read again once the household’s records are locked, before what the locks found is judged: a retry of a committed schedule whose records were superseded meanwhile is still its 200 replay, not a 404. A request naming the same household, reason, reassessments (in any order) and requested date answers 200 with the cohort’s current state: after a cancel, a repair, a pack change or a date advance alike. Anything else under a used key is 409 idempotency_key_reused, including a concurrent request for another household whose cohort insert waited on the key.

Checks, in one transaction: the household’s current records are locked in ascending person_id order (404 when it holds none); the reason must be the pack’s (422 wic_termination_reason_unknown); each id must be an income_reassessment determination (422 wic_reassessment_unknown); the ids must be one run (one application, household, evaluation date and run instant) over this household, one per current member (422 wic_reassessment_subject_mismatch); each reassessment must follow the determination that granted the member’s record and fall inside its period (422 wic_reassessment_outside_certification); and the run must cover every current record (422 wic_reassessment_incomplete). The run must be the latest evidence: a covered member with an income_reassessment made after it refuses the request (422 wic_reassessment_superseded), so a run later reassessment contradicts, such as corrected pay stubs finding the member eligible, terminates no one. The members found income_eligible = false and adjunctive_eligible = false are terminated; a run finding none is 422 wic_reassessment_found_none_ineligible. The termination date is the legal today plus the pack’s advance_notice_days plus two days of dispatch slack, or a later requested date (an earlier one is 422 wic_termination_effective_too_soon), and no later than any terminated member’s certification end minus its expiration-notice lead (422 wic_termination_within_expiration_notice_lead). A member with a scheduled termination is 409 wic_termination_already_scheduled. A refusal writes nothing.

Writes: the cohort, one scheduled termination per ineligible member (its reason’s basis, the pack’s [meta].version as policy_version, and the lead as required_advance_days), and each termination’s first letter, staging one wic.termination_scheduled under the letter’s pre-minted id. Response 201 WicTerminationCohort: id, household_id, reason_code, requested_effective_on, reassessment_determination_ids (sorted), terminations[] (in participant_id order), not_terminated[] (the reassessments of the members not terminated) and created_at.

The termination and its letters: a WicTermination carries id, cohort_id, participant_id, reassessment_determination_id, reason_code, basis, effective_on, required_advance_days, status (scheduled, cancelled, enacted or reversed), enacted_at (present when enacted or reversed), reversed_at (present exactly when reversed), cancel_reason (worker, superseded, expired, expires_first or appeal_reversed) and cancelled_at (both present exactly when cancelled), held (whether a hearing hold stands on it, The hearing hold on a termination), created_at, updated_at, and letters[] in staging order, each {source_event_id, effective_on, notice_date, dispatched_date, superseded}; at most one is live. A letter counts as sent only on dispatch evidence (Certification lifecycle). It is on time when it was dispatched on the date it is dated and that date plus the lead is strictly before the termination, or while undispatched and the legal today plus the lead is.

POST /v1/participants/{id}/terminations/{termination_id}/cancel

Handler: terminations::cancel_termination; Request CancelTerminationRequest { household_id } (terminations.rs, deny_unknown_fields, #3107). Locks the record (FOR UPDATE), refuses a record whose stored household_id is not the body’s with 409 termination_household_mismatch (naming the termination id, the record id and the requested household, never the stored owner, with nothing written), then compare-and-sets the termination from scheduled to cancelled (worker, the caller’s subject) scoped by the termination, the record and the status, and closes its live letter: an undispatched one is retracted (wic.termination_notice_superseded); a dispatched one has gone out and stays so, and the cancel stages wic.termination_rescinded for it (Events published). The household check holds the stored owner to the household the request names; a caller that names the record’s own household passes. canopy-web binds the record and termination to the worker’s household before sending that household (canopy-web API). Response 200 WicTermination, also for a termination already cancelled. 409 termination_enacted for one that has taken effect, reversed since or not: only a hearing decision undoes an enacted termination (The hearing hold on a termination). 404, one uniform answer, for a missing record, a missing termination and another record’s termination. 422 for a body missing household_id or carrying an unknown field.

GET /v1/participants/{id}/terminations

Handler: terminations::list_terminations; query limit (clamped to 1..=200, default 50), after_created_at and after_id (both, from the previous page’s next_cursor). Response 200 WicTerminationPage {items, next_cursor}: the record’s terminations newest first (created_at DESC, id DESC), each with its letters, from one statement; next_cursor when the page is full. An empty page for a record with none; 404 for an unknown record.

The hearing hold on a termination

services/canopy-wic/src/api/termination_holds.rs (#3387). 7 CFR 246.9(g): a participant who appeals a termination within the notice period keeps benefits until the hearing official decides or the certification period expires. canopy-appeals owns the appeal and says so here with a hold, one row per (termination, appeal). All four routes admit canopy-appeals' system token alone (APPEALS): every other service’s system token and every user is 403. The enact leg leaves a termination alone while a hold stands on it.

PUT /v1/terminations/{termination_id}/holds/{appeal_id}

Handler: termination_holds::command_termination_hold; path constant TERMINATION_HOLD. Request WicTerminationHoldRequest { household_id, command } (termination_holds.rs, unknown fields refused), command one of hold, release, cancel. The command runs in one transaction under the certification record’s lock and then the termination’s, the order every termination write takes. 404 for an unknown termination; 409 termination_household_mismatch when the termination is not household_id's, for every command, with nothing written.

  • hold: an appeal that already has a hold row is answered with it, standing or released (a released hold is never placed again). Otherwise the termination must be scheduled (409 termination_not_scheduled) and the legal today before its effective_on (409 hold_not_timely: the notice period ends the day the termination takes effect). The hold is written held with the request’s instant and legal day.

  • release: the appeal’s standing hold becomes released at the request’s instant. A hold already released keeps its first instant, and an appeal that never held is answered with no hold and writes none.

  • cancel: the hearing was decided for the household. A scheduled termination is cancelled with reason appeal_reversed and actor canopy-appeals, through the same path as every cancel: every hold on it is released and its live letter closed, retracted when unsent and rescinded (wic.termination_rescinded, cancel_reason = appeal_reversed) when sent. It needs no hold of its own, so an appeal filed after the notice period cancels too. An enacted termination is reversed (7 CFR 246.9(k)(3): "If the decision is in favor of the appellant and benefits were denied or discontinued, benefits shall begin immediately"): the termination becomes reversed; its certification record returns to the status it had, with termination_id and terminated_on cleared, and wic.certification_restored is staged. When the record's period has ended, or the person already holds a newer current certification, the record is left terminated: there is no period left to restore. A record's notice of expiration that enactment retracted has its stamp cleared, so the next sweep stages a new one. A termination already cancelled or reversed is answered as it stands.

Response 200 WicTerminationHoldReceipt { termination_id, appeal_id, termination_status, hold, reversal }: the termination’s status after the command, reversal (restored or nothing_to_restore, present exactly when the termination is reversed) and the appeal’s hold (WicTerminationHold { termination_id, appeal_id, status, placed_at, placed_on, ended_at }), absent when the appeal never held. Every command is safe to repeat: the repeat answers the same receipt and stages nothing more.

GET /v1/terminations/{termination_id}/holds/{appeal_id}

Handler: termination_holds::get_termination_hold. Response 200, the same receipt shape. 404 for an unknown termination or an appeal that never held it.

GET /v1/terminations/holds

Handler: termination_holds::list_termination_holds; path constant LIST_TERMINATION_HOLDS; query status (held or released; omitted, every hold), limit (clamped to 1..=200, default 50) and the keyset cursor after_placed_at, after_termination_id, after_appeal_id (all three, from the previous page’s next_cursor). Response 200 WicTerminationHoldPage { items, next_cursor }, oldest first (placed_at, termination_id, appeal_id); next_cursor when the page is full.

GET /v1/terminations/{termination_id}

Handler: termination_holds::get_termination; path constant GET_TERMINATION. Response 200 WicTerminationSummary { id, participant_id, household_id, status, effective_on, held }. 404 for an unknown id.

Nutritional-risk assessments

canopy-wic stores the clinician’s assessment and gates certification on its presence; it does not compute risk.

POST /v1/nutritional-risk-assessments

Handler: handlers::create_assessment. An assessment is a human clinical act (#1008): the route admits a writer’s delegation, and the assessor recorded is the delegation’s canopy subject (assessor_subject) — never a body field.

Body CreateNutritionalRiskAssessment (nutritional_risk.rs, deny_unknown_fields): person_id, assessment_date, the four category booleans anthropometric_risk / biochemical_risk / dietary_risk / medical_risk, risk_codes[], notes. It carries no id, created_at or assessor: the server assigns the id and the creation stamp (the request’s decision instant, #2473), and a body naming any of them — a stale assessor_worker_id above all — is a 422.

Validation (both 400): at least one of the four category booleans must be true ("At least one nutritional risk type must be documented."), and risk_codes must be non-empty ("At least one risk code must be provided."). There is no "no-risk" encoding on this route.

Response 201 Created — the persisted WicNutritionalRiskAssessment, whose assessor_worker_id is the delegation’s canopy subject.

GET /v1/nutritional-risk-assessments?person_id={uuid}

Handler: handlers::list_assessments_by_person; person_id is required (PersonScopedQuery). 200 — array of assessments.

GET /v1/nutritional-risk-assessments/{id}

Handler: handlers::get_assessment. 200 one assessment; 404 when unknown.

Breastfeeding statuses

canopy-wic records each woman’s breastfeeding status (7 CFR 246.2), the one WIC fact no other service records (#3151). The record is append-only: a change of status is a new row with a later effective_date. The determination reads a woman’s status on the evaluation date (store::breastfeeding::status_on, #3152): the row with the latest effective_date on or before as_of, two rows effective the same day read by the later created_at, then the higher id. With no such row she is not breastfeeding. The status chooses between the breastfeeding and postpartum categories ([category]) and, fully, Package VII.

POST /v1/breastfeeding-statuses

Handler: handlers::breastfeeding::create_breastfeeding_status. Like the nutritional-risk assessment, the route admits a writer’s delegation only (a service bearer is 403 service_class_on_user_only), and recorded_by is the delegation’s canopy subject (assessor_subject), never a body field.

Body CreateBreastfeedingStatus (breastfeeding.rs, deny_unknown_fields): person_id, status (BreastfeedingStatus: fully, partially or not_breastfeeding) and effective_date, the first day the status holds. It carries no id, created_at or recorded_by; a body naming any of them is a 422.

Validation (api/handlers/writes.rs check_effective_date), in the order the determine preflight checks as_of:

  • an effective_date outside the years 1900-9999 (determine::SUPPORTED_YEARS) is 422 wic_date_out_of_range;

  • an effective_date after the service’s legal today (the legal day of the request’s decision instant, Tick) is 422 wic_effective_date_in_future.

Either refusal writes nothing and names the field, never the date sent.

Response 201 Created — the stored WicBreastfeedingStatus: id, person_id, status, effective_date, recorded_by and created_at, the request’s decision instant.

GET /v1/breastfeeding-statuses?person_id={uuid}

Handler: handlers::breastfeeding::list_breastfeeding_statuses; person_id is required (PersonScopedQuery; missing or malformed is 400). Admitted as the nutritional-risk list is (delegated::WIC_GET_BREASTFEEDING_STATUSES). 200 — the person’s WicBreastfeedingStatus rows, newest effective_date first, then the later created_at first on the same day, then the higher id (store::breastfeeding::list_by_person); at most 100 rows, and an empty array when none is recorded.

Appointments

POST /v1/wic/households/{household_id}/appointments

Handler: appointment_handlers::schedule_appointment. The path parameter is the household id; the row is inserted into wic_appointments with no participant lookup (#627 re-scoped the route from the former certifications/{id} path). The worker-portal BFF (services/canopy-web/src/api/actions_wic.rs) supplies household_id from the case it is on and calls on the worker’s delegation.

Request ScheduleAppointmentRequest (appointments.rs, deny_unknown_fields): appointment_at (UTC instant), appointment_type (caller-supplied string), notes (optional), scheduled_by (caller-supplied string, stored as sent; the route records no other actor).

Response 201 Created WicAppointment — the inserted row (status defaults to scheduled; created_at is the request’s decision instant, #2473).

GET /v1/wic/appointments/upcoming?days={n}

Handler: appointment_handlers::list_upcoming_appointments. Feed for the worker-dashboard "Upcoming appointments" panel (services/canopy-web/src/dashboard/panels/upcoming_appointments.rs), which reads it on the worker’s delegation; the feed admits case readers through canopy-web alone (another client’s delegation is 403 actor_not_allowed).

  • The window opens at the request’s decision instant (#2473), which the test clock steers.

  • days (optional) — default is the jurisdiction’s [shared.timing].appointments_api_default_lookahead_days (WicParameterTable, #1162; the georgia pack’s jurisdiction.toml sets 30), clamped server-side to 1..=365.

Response 200 — up to 50 WicAppointment rows with status = 'scheduled' and appointment_at inside the window, soonest first.

Error codes

Code Meaning

400

actor_header_retired (an X-Canopy-Actor header); blank redaction reason; an assessment with no risk category or an empty risk_codes; malformed JSON; a malformed GET /v1/determinations query parameter, an unknown purpose token included

401

No bearer (token_missing) or a token the receiver refuses (token_rejected)

403

required_role_missing; actor_not_allowed (a delegation through a client the route does not list: the upcoming-appointments feed’s, the sweep trigger’s)

404

Determination, participant, assessment or termination not found; a household with no current certification record (schedule)

409

POST /v1/determine: wic_current_certification_exists — the new certification would give the person a second current certification; operation_already_determined — a concurrent execution of the dispatch’s operation_id committed first (operation binding). Schedule: idempotency_key_reused, wic_termination_already_scheduled. Cancel: termination_household_mismatch (a cancel whose household_id is not the record’s, #3107; Mid-certification termination)

422

POST /v1/determine: empty participants[], duplicate person_id, wic_anchor_after_certification_date (a date_of_birth or pregnancy_end_date after as_of), wic_date_out_of_range (any date, as_of or an anchor, outside the years 1900–9999; anchors in an evaluation only), wic_as_of_in_future (an as_of after the service’s legal today), wic_fetus_count_out_of_range (a fetus_count outside 1–8), wic_fetus_count_not_pregnant (a fetus_count on a participant with no expected_delivery_date), or wic_reassessment_without_certification (an income_reassessment names a participant holding no current certification record; refused before any rules call). Schedule: idempotency_key_invalid, wic_termination_reason_unknown, wic_reassessment_unknown, wic_reassessment_subject_mismatch, wic_reassessment_outside_certification, wic_reassessment_incomplete, wic_reassessment_superseded, wic_reassessment_found_none_ineligible, wic_termination_effective_too_soon, wic_termination_within_expiration_notice_lead. Cancel: a body without household_id or with an unknown field (#3107; Mid-certification termination)

503

keys_unavailable (no trustworthy key set in time)

Events published

The WIC events are staged from services/canopy-wic/src/events.rs, and their payloads carry identifiers, codes, statuses and dates only (ADR-004); determination.redacted is the exception, carrying the steward’s sub and the free-text reason. They are typed V1 contracts in canopy_contracts_wic::events (#2389, #2390, #2391), each staged in the transaction that writes its record and stamped programs=["wic"]. Every id is a UUID string at the payload’s top level. Every payload except the two retractions carries the household and the person, so a consumer places the event on the household and addresses the person from the payload alone; wic.expiration_notice_superseded names only the stale letter (source_event_id) and the record (participant_id), and wic.termination_notice_superseded those and the termination. No payload has a schema_version field (the envelope’s version covers it); a determination’s denial_reasons and a participant’s housing status are never on the bus.

What POST /v1/determine stages is held until the determination is recorded (#2322): wic.determination_completed, wic.certification_created, and a supersession’s wic.expiration_notice_superseded, wic.termination_notice_superseded and wic.termination_rescinded, each under the staging determination’s canopy_mq::hold_for(determination_id) (api/persist.rs, api/persist/supersession.rs). The verdict consumer under Events consumed releases them on determination.recorded.wic or drops them on determination.disowned.wic (ADR-002 Amendment 7). A determination canopy-eligibility never records, a direct caller’s included, publishes none of them. A termination’s events staged by the cancel route, the expire leg, the settle leg or a dispatch stamp are not held.

  • wic.determination_completed (canopy_reference::cross_program::WIC_DETERMINATION_COMPLETED, WicDeterminationCompletedV1) — determination_id, application_id, household_id, person_id, determination_status, purpose ([purpose]; an income_reassessment decided no application and certified no one, whatever its verdict), completed_at (the determination’s created_at); one per participant.

  • wic.certification_created (canopy_reference::cross_program::WIC_CERTIFICATION_CREATED, WicCertificationCreatedV1) — participant_id (the certification record’s id), determination_id, application_id, household_id, person_id, participant_category, status, certification_start, certification_end; only when a certification record was written, which an income_reassessment never does.

  • wic.expiration_notice_due (WIC_EXPIRATION_NOTICE_DUE, WicExpirationNoticeDueV1) — participant_id, determination_id, application_id (the application the letter’s addressing reads), household_id, person_id, certification_end; staged by the lifecycle sweep’s notice leg under the envelope id stamped on the record as expiration_notice_event_id (Certification lifecycle). Both notices manifests route it to the WIC notice of expiration (wic_notice_of_expiration, template notice-of-expiration, addressing = "caretaker_for_minor", notice_required; canopy-notices). The letter prints no hearing box, and canopy-notices persists no appeal-rights row for it. A minor participant’s letter goes to the application’s filer when the filer is a member of the household, at any age, else to a WIC-scoped authorized representative, and names the child on its Regarding: line; a minor who applied for herself receives her own letter.

  • wic.expiration_notice_superseded (WIC_EXPIRATION_NOTICE_SUPERSEDED, WicExpirationNoticeSupersededV1) — source_event_id (the stale letter’s wic.expiration_notice_due envelope id), participant_id; staged in the supersede transaction when the superseded record’s notice was staged and undispatched. canopy-notices retracts the letter by (source_event_id, wic_notice_of_expiration): a queued work item or an undispatched notice becomes superseded, and a retraction that overtakes its due event is held, so the letter is never staged (#2432).

  • wic.termination_scheduled (WIC_TERMINATION_SCHEDULED, WicTerminationScheduledV1) — termination_id, cohort_id, participant_id, determination_id (the granting determination), reassessment_determination_id, application_id (the granting determination’s), household_id, person_id, reason_code, effective_date (the date the letter prints), certification_end, replaces_effective_date (on a replacement letter, the date the closed one printed; else null); staged under the letter row’s id, which canopy-notices carries back as the letter’s source_event_id, when a termination is scheduled and when the settle leg repairs it (Mid-certification termination). Both notices manifests route it to the WIC notice of termination (wic_notice_of_termination, effective_date_policy = "verbatim", a hearing box; canopy-notices).

  • wic.termination_notice_superseded (WIC_TERMINATION_NOTICE_SUPERSEDED, WicTerminationNoticeSupersededV1) — source_event_id (the closed letter’s), participant_id, termination_id; staged whenever a letter with no dispatch evidence under its lock is closed: a cancel, a supersession, an expiry, an expires_first cancel or a repair. canopy-notices retracts the letter by (source_event_id, wic_notice_of_termination).

  • wic.certification_terminated (WIC_CERTIFICATION_TERMINATED, WicCertificationTerminatedV1) — participant_id, determination_id, household_id, person_id, termination_id, reason_code, terminated_on; staged by the enact leg in the transaction that ends the record (#3387). Audit-only: no notices route, since the notice of termination went out before the date.

  • wic.certification_restored (WIC_CERTIFICATION_RESTORED, WicCertificationRestoredV1) — participant_id, determination_id, household_id, person_id, termination_id, restored_on, certification_end; staged when a hearing decision reverses an enacted termination and its record is restored (#3387). Audit-only.

  • wic.termination_rescinded (WIC_TERMINATION_RESCINDED, WicTerminationRescindedV1) — termination_id, participant_id, determination_id (the granting determination), application_id (the granting determination’s), household_id, person_id, cancel_reason (worker, superseded, expired or expires_first), rescinded_effective_date (the date the last letter with dispatch evidence printed), rescinded_notice_event_id (that letter’s source_event_id), certification_end; staged by cancel_scheduled_termination_locked (services/canopy-wic/src/terminations.rs) in the transaction that cancels a termination one of whose letters has dispatch evidence, whatever cancelled it: the cancel route, a supersession, the expire leg or the settle leg (#2451). A letter canopy-notices claimed before the cancel may take its evidence only after the cancel committed. The notice.dispatched consumer then stages the event in the transaction that stamps that letter, naming it under the termination’s stored cancel reason (stamp_dispatched_letter, #3018). The stamp locks the termination, which every cancel writes, before it stamps the letter, so the cancel and the stamp serialize. One rescission names each such letter, whichever commits last. A replayed dispatch stamps nothing and stages nothing. A letter that went out cannot be retracted, so this event is how the participant learns its date no longer applies; a cancel whose letters all lacked evidence stages none, and a repair never does. Both notices manifests route it to the WIC termination rescission (wic_termination_rescinded, template termination-rescinded, addressing = "caretaker_for_minor", notice_required, no hearing box; canopy-notices).

  • wic.certification_expired (WIC_CERTIFICATION_EXPIRED, WicCertificationExpiredV1) — participant_id, determination_id, household_id, person_id, certification_end, expired_at (the pass instant); staged in the transaction that expires the record. Audit-only: no notices route.

  • determination.redacted — the shared routing key across the five program services, stamped programs=["wic"]; actor sub, reason, redacted_at.

Events consumed

  • canopy-wic.notice-dispatched ← notice.dispatched (wic_notice_of_expiration and wic_notice_of_termination only): stamps the record’s dispatch evidence set-once by expiration_notice_event_id, or a termination letter’s by its source_event_id (Certification lifecycle), staging wic.termination_rescinded when that letter’s termination is already cancelled (#3018). The handler runs on the inbox transaction and parks an unrecognized routing key.

  • canopy-wic.determination-verdicts ← determination.recorded.wic, determination.disowned.wic (src/verdict_subscriber.rs, #2322) — canopy-eligibility’s verdict on a determination this service signed (ADR-002 Amendment 7; payloads in canopy-eligibility’s verdicts). In the inbox transaction, recorded releases the outbox rows held under canopy_mq::hold_for(determination_id) and disowned deletes them; the verdict is recorded in determination_verdicts, where a recorded verdict is final. A key that is no verdict parks; a malformed payload, or one naming a program this service does not determine, dead-letters. A replay releases or drops nothing.

Edit this page · default