canopy-eligibility API Reference
For a service integrator (the BFF, canopy-renewals, canopy-medicaid’s CMD) and an operator running a bulk cohort: canopy-eligibility dispatches a determination request to the program services in parallel, verifies the JWS on each returned determination (ADR-002), assembles the combined result, and owns the bulk-run and order ledgers. Tables: the data-models page; design history: eligibility-orchestrator, the COLA bulk program, the async-bulk audit.
- Base URL
-
container port 8004 (host:
CANOPY_PORT_CANOPY_ELIGIBILITY_8004in.ports.env) - Authentication
-
Bearer token: a canopy-identity token for this receiver (its
audisurn:canopy:service:canopy-eligibility), authenticated by the service’s identity receiver (ADR-049 Amendment 14): no bearer is 401token_missing, a token it refuses 401token_rejected, anX-Canopy-Actorheader 400actor_header_retired, and no trustworthy key set in time 503keys_unavailable. - Access
-
canopy-applications, canopy-renewals, the portal and canopy-eligibility itself hold a system edge to canopy-eligibility; canopy-web, canopy-cli, canopy-applications and canopy-renewals hold delegation edges. The determine write admits a system caller or the writer bar (its bulk and order markers canopy-eligibility’s own system token alone), the reads a system caller or caseworker+ (also canopy-web’s worker readers on case status and the household determinations, and the portal holding
portal:determinations:readon the latter), and the bulk-run reads a system caller orsupervisororadmin; the two alerts feeds, the bulk-run mutations, the quarantine routes and the held-determination routes are user-only. A refusal is 403 with itsReceiverDenialcode (ADR-049 Amendment 14); each route’s constant is in the authorization inventory. - Database
-
canopy_eligibility
Admission specifics
-
The determine markers.
POST /v1/eligibility/determineadmitsWRITER; a request carrying thebulkorordermarker must also passSELF_CALL(Admission::system_from(&[ConfidentialClient::Eligibility]),api/handlers.rs), the consumers' self-calls: another system caller is 403service_not_allowlisted, a user 403system_caller_required. Both markers at once are 400order_and_bulk_markers; a bulk dispatch without a numericx-canopy-bulk-generationheader is 400bulk_generation_header_missing. -
Portal ownership.
GET /v1/eligibility/determinationschecks the portal’s applicant claim against the queried household (principal.require_owned_household): 403ownership_claim_missingwithout one,ownership_mismatchfor another household. -
Outbound. A request’s calls ride its outbound (
RequestOutbound): a worker’s determine carries the worker’s delegation onward to every program it dispatches, and to persons, applications, enrollment, renewals and verification; a system caller’s carries canopy-eligibility’s system tokens. The run config holds both the outbound and canopy-eligibility’s sender (DetermineConfig { source, system },orchestrator.rs); the sender makes the replayed operation’s envelope read (Signature verification), which stays system inside a request. The bulk-run admin routes' corpus, parameter-provenance and universe reads are system too, through the sender inUpstreamDeps(api/bulk_runs_upstream.rs). The bulk and order consumers self-call, and make their own reads, through the sender. -
Attribution. The bulk-run ledger (
created_by,canceled_by, each action row’sactor), the quarantine and held resolutions'actorand the alerts access event’sactorrecordprincipal.attribution_sub(): the caller’s canopy subject on the user-only routes.DetermineRequest.requested_bystays caller-supplied.
Routes
Mounted by routes() in services/canopy-eligibility/src/api/mod.rs; spelling from crates/canopy-contracts-eligibility/src/paths.rs (the three request/result reads are registered as literals with no constant).
| Route | Access | Success | Refusals (RFC 9457 code) |
|---|---|---|---|
|
system; writer (a |
200 |
400 no members / household absent as-of; 404 application context absent; 409 |
|
system; caseworker+ |
200 |
400 no members / household absent; 404 unknown baseline; 422 cross-household, snapshot-less or incomplete baseline, unknown corpus or |
|
system; caseworker+ |
200 |
404 |
|
system; caseworker+ |
200 |
— |
|
system; caseworker+ |
200 |
404 |
|
caseworker+ (caseworker tier: own subject, |
200 |
400 |
|
|
200 |
400 unknown query key (a |
|
system; caseworker+; worker reader via canopy-web |
200 |
404 no determination yet |
|
system; portal (portal:determinations:read); caseworker+; worker reader via canopy-web |
200 |
403 |
|
system; portal (portal:determinations:read); caseworker+; worker reader via canopy-web |
200 |
403 |
|
|
202 + |
400 |
|
system; |
200 |
404 |
|
|
202 |
409 gate ladder (below); 422 |
|
|
200 |
409 state |
|
|
200 / 202 |
409 state |
|
determination operator |
200 |
403; 422 |
|
case reader via canopy-web ( |
200 |
403 |
|
determination operator |
200 |
403; 404 |
|
determination operator |
201 |
403; 404; 409 (Quarantined envelopes); 422 |
|
determination operator |
200 |
400 unknown |
|
determination operator |
201 |
403; 409 |
|
determination operator |
201 |
403; 404; 409 (Adoption); 422 |
Access legend (arms joined by "; ", bars in crates/canopy-auth/src/roles.rs): system = any system caller but the portal; system: canopy-eligibility = only canopy-eligibility’s system token; portal (scope) = the portal holding that scope; writer = CASEWORKER_WRITER_ROLES (quality_control is read-only); caseworker+ = CASEWORKER_OR_ABOVE_ROLES; worker reader = WORKER_READER_ROLES; determination operator = DETERMINATION_OPERATOR_ROLES (eligibility_specialist, supervisor, admin); a role set in backticks admits those roles; a bar alone is a user’s delegation through any client, and via canopy-web only through canopy-web. A route with no system arm refuses a system caller 403 service_class_on_user_only. paths::REDACT_DETERMINATION is a program-service path this router does not mount.
POST /v1/eligibility/determine
An admitted interactive or order determine runs on its own task (canopy_api::run_to_completion, #3202): a caller that disconnects, as canopy-web does when its determine_timeout_ms expires, does not cancel it. The run finishes, records, and canopy-applications projects the outcome from its verdict. Run inline, a cancelled determine left its in_progress request row holding the pending slot, so a re-run was refused 409 until the stale TTL.
Request DetermineRequest — { "application_id", "household_id", "programs": ["snap"], "requested_by", "change_reported_on"? }; the bulk and order self-calls add bulk / order and are exact-canopy-eligibility-identity only. change_reported_on (DetermineRequest.change_reported_on, crates/canopy-contracts-eligibility/src/determine.rs) is the household’s report date for an interactive re-determination of an enrolled household (7 CFR 273.12(c)): required when the derivation selects interim_change (422 change_reported_on_required otherwise), ignored otherwise, never set on the bulk or order self-calls; off the wire when absent. Response DetermineResponse:
{
"request_id": "uuid", "application_id": "uuid",
"programs_approved": [ { "program": "snap", "status": "approved", "benefit_amount": "535.00",
"basis": null, "determination_id": "uuid" } ],
"programs_denied": [], "programs_pending": [],
"total_monthly_benefit": "535.00", "assembled_at": "2026-05-28T12:00:00Z"
}
Each entry is a ProgramResult (program, status, optional benefit_amount, basis, determination_id, snapshot_hash, denial_reason_codes, advisories). snapshot_hash is the SHA-256 of the input snapshot the program service signed, present for a determination of record (ADR-028). advisories relays the signed envelope's operator advisories from the determination of record (ADR-002 Amendment 9, #3324), and is absent when there are none and on every synthesized result. status is a ProgramOutcome (#628): a program’s signed verdict — approved, denied, sanctioned or withheld (canopy_reference::DeterminationStatus; a withheld result lands in programs_denied, the bucket of verdicts that authorize nothing) — or one of the two outcomes that have no determination behind them, pending_verification and input_unsatisfiable. determination_id is present on a determination of record and absent on a synthesized pending, which instead carries a typed failure (unconfigured | breaker_open | transient_upstream | upstream_conflict | terminal_rejection | contract_violation | signature_quarantined | persist_failed | envelope_conflict, the upstream status, a bounded excerpt, and upstream_code — the refused program body’s RFC 9457 code). A program response whose status is outside the verdict vocabulary fails typed parsing and pends as contract_violation; so does a program’s 409 idempotency_body_mismatch (its idempotency layer holds the dispatch key under another body, #2652; upstream_code keeps the token), never upstream_conflict. On an order run, canopy-snap’s and canopy-medicaid’s mismatch is first read back through the epoch’s operation (#2676; canopy-snap’s GET /v1/determination-operations/{operation_id}/envelope, canopy-medicaid’s …/envelopes, every subject’s, #2673). Determinations found there are adopted, as on a replay. The coded 404 operation_not_determined pends contract_violation with upstream_code operation_not_determined. Any other answer to the read pends transient_upstream, keeping the mismatch token. sanctioned files into programs_denied. The signature and binding outcomes are in Signature verification. The combined result, the request’s completed flip and the determination.completed outbox row commit in one transaction; a terminal order failure commits atomically with determination.order_failed.
State of residence (Medicaid and CHIP, #3094). The household read (fetch_household_context) also projects each member’s addresses group, and MemberContext.state_of_residence carries the state of the member’s residential address in force on the evaluation date (residential_state). A member with no residential address of their own takes the applicant’s, the member head_of_household_person_id names (inherit_applicant_residence; maintainer ruling 2026-10-29), and a member’s own address always wins. Only an address_type of residential counts: a mailing address never stands in for one, although primary_address falls back to it. canopy-medicaid determines every member (42 CFR 435.403; 42 CFR 457.320(a)(1)), so before a Medicaid or CHIP dispatch the mapper requires each member’s state to be a USPS code that canopy_reference::fips::State::from_abbreviation resolves (mappers::require_member_states). A member left without one (neither their own nor the applicant’s), a code that names no state, or an empty roster pends the program input_unsatisfiable with missing_inputs [{"field": "members[].state_of_residence", "source_class": "persons"}]. Nothing is dispatched or persisted; the worker records the residential address and re-runs. Whether that state is the jurisdiction’s own is canopy-medicaid’s finding, not the mapper’s. SNAP and TANF receive the field and never pend on it.
Pregnancy and homelessness (#3145). The household read also projects each member’s pregnancies and the household’s homelessness groups (canopy-persons), and three fields carry them as of the evaluation date:
-
MemberContext.pregnancyis theMemberPregnancy(expected_delivery_date,fetus_count,family_size_increase_waived;crates/canopy-types/src/household.rs) of the accepted pregnancy window that covers the day,valid_from ⇐ as_of < valid_to(pregnancy_on), elsenull. -
MemberContext.pregnancy_end_dateis the latest end on or before the day among the member’s pregnancy facts, elsenull. A fact’s end is thevalid_toof its last window, grouped byfact_id: a correction splits a fact into windows, and an earlier window’s end is not an end (latest_pregnancy_end). -
ApplicationContext.homeless(required) istruewhen an accepted homelessness period covers the day andfalseotherwise (homeless_on): a household never recorded homeless is not.
A crypto-shredded pregnancy fact feeds neither member field (ADR-036), as a shredded income fact feeds no budget. The fields ride every body that carries the generic context. canopy-snap reads pregnancy for the ABAWD exception (canopy-snap); TANF and Medicaid ignore them. WIC's own body carries them per participant (below); the two pregnancy dates and the homeless status are persons-sourced rows of compliance/input-requirements/wic.toml.
Standard categorical eligibility facts (SNAP, #3322). For a request naming snap, each member carries two facts, set before the context is cloned per program (member_facts.rs); canopy-snap reads them for 7 CFR 273.2(j)(2)(i) standard categorical eligibility. Both are omitted from the wire when unknown, and a failed read never refuses the run. The bulk COLA arm and the dry-run read neither (#3325). They name their baseline as member_facts_from, and canopy-snap carries the facts frozen in its snapshot (canopy-snap), so a mass change or a what-if makes no TANF read and no SSA lookup.
-
MemberContext.receives_tanf_cash:truefor a member included in the grant of the household's TANF determination in force onas_of, elsefalse. In force means the household's newesttanfrow inprogram_determinationsisapproved, witheffective_date ⇐ as_ofand noexpiration_dateor one afteras_of(tanf_determination_in_force). The grant is canopy-tanf'sPOST /v1/determinations/family-composition:batchGetfor that determination andas_of's month, its members withreceives_assistance, on canopy-eligibility's system token within the 3 s lookup deadline (read_tanf_grant). Members are joined byperson_idto this request's roster; a unit member outside it sets nothing. With no determination in force every member isfalse. A failed database read, no registered canopy-tanf, a transport error, a non-2xx, the deadline, or an absent composition (a determination recorded before #3048) leaves it unknown for every member. -
MemberContext.receives_ssi: the SOLQ record'sssi_activefor a member the SOLQ selection picks (below). A selected member whose lookup gave no record is unknown. An unselected member isfalse, since SSI requires age 65 or over, blindness or disability (20 CFR 416.202). A self-reportedssiincome record only selects the member; SOLQ alone decides the fact.
WIC (#3153). The WIC dispatch posts canopy-wic's own WicApplicationContext (canopy-wic), which mappers::wic::context builds from the household context. CAPS takes its own body too (below), and SNAP, TANF, Medicaid and CHIP take the generic context. Every member is a participant: canopy-wic derives each one's category and denies a member in none, so the orchestrator omits no one. A participant carries the member's person_id and date_of_birth, the expected_delivery_date, fetus_count and family_size_increase_waived of the member's open pregnancy (with none, the first two are null and the waiver false), the member's pregnancy_end_date, and empty adjunctive_certifications (#2365, #3312). The body is an evaluation on as_of, the run's legal day, with the context's household_size, homeless and jurisdiction, and gross_monthly_income the sum of the household's income amounts, each already monthly (#861; WIC's exclusions are #3155). The dispatch stamps the run's claimed operation_id and none of the generic context's provenance fields. WIC pends input_unsatisfiable with one persons missing input, and is not dispatched, when an income record's frequency was left unconverted (income[].frequency), so it never sees an understated sum. Self-employment counts net of business costs (7 CFR 246.7(d)(2)(ii)(B), #3164): a person's self_employment_net record is counted and their gross self_employment records are left out, the person being the only link between the two. Gross receipts whose person has no net record pend WIC the same way, naming income[].self_employment_net; the worker records the net figure and re-runs. It pends the same way on an income value that is not a canopy-persons income record (income[]), a sum past the decimal range (income[].amount), or a member whose person_id or date_of_birth does not parse (members[].person_id, members[].date_of_birth).
CAPS (#3186). The CAPS dispatch posts canopy-caps's own CapsApplicationContext (canopy-caps), which mappers::caps::context builds from the household's parent–child relations. The children are the members who are the child in a relation, and the parents the members who are the parent in one. Each is listed once, in roster order, and canopy-caps names a parent in a denial by that position. A child carries their person_id, their age_years and no provider_id; a parent carries their person_id alone. canopy-caps reads each parent's activity standing and each child's care need from its own records (#3183), so the body carries no worker fact. gross_monthly_income is the same monthly sum WIC's body carries (mappers::income), and eligibility_type is continued on an order run (the context's trigger is the order's) and initial otherwise. The dispatch stamps the run's claimed operation_id, which canopy-caps signs into every child's envelope and dedupes on (#3185). CAPS pends input_unsatisfiable with one persons missing input, and is not dispatched, when the relations name no child or no parent among the members (parent_child), a child has no age (members[].age), or an income record is not a monthly canopy-persons record (income[], income[].frequency, income[].amount).
Referential integrity (ADR-025). Before the eligibility_requests row is written — before the per-household admission lock, the stale sweep and the duplicate-admission 409 — the orchestrator proves both cross-service ids on the run’s bearers (the request’s outbound, as every context read below): application_id at canopy-applications (GET /v1/applications/{id}), then household_id at canopy-persons (GET /v1/households/{id}, which must return at least one member). An unknown id is 422, uncoded, detail {kind} {id} does not exist in the owning service; an owner that is unreachable or answers neither 200 nor 404 is 502, uncoded (fail loud, never a silent admission). Either refusal writes nothing. The interactive arm and the #1504 order self-call share the check (the order consumer classifies the 422 terminal and the 502 retryable); the #1213 bulk arm runs its own frozen-context path and is not covered. A member-less household is therefore refused here as 422 rather than after admission as 400; the 400 remains for a household admitted now but absent, or member-less, as of the evaluation date.
WIC certifications (#2365, adjunctive_certifications.rs). A run naming wic reads, before any claim, which members hold a certification in another program on the run's legal day, from the newest recorded determination of each program and subject, approved and in force. A household-level SNAP approval certifies the members canopy-snap lists (GET /v1/determinations/{id}/certified-members); a TANF approval, the members canopy-tanf's family composition has receiving assistance; Medicaid, CHIP and CAPS, the member the row names. Each is sent to canopy-wic as a full certification naming its determination, and canopy-wic decides what it confers. Any failed read refuses the run: 503 adjunctive_certifications_unavailable, naming the read. A run that does not name wic makes none of these reads.
Effective-date provenance. Every application-scoped run first reads GET /v1/applications/{id}/determination-context fail-closed (502 determination_context_unavailable; a 404 is a 404). A run naming snap without the bulk marker (the order self-call included) then makes the two household reads fail-closed (services/canopy-eligibility/src/enrollment_state.rs, read_enrollment_state): the live enrollment (GET {enrollment_url}/v1/enrollments/live?household_id=&as_of=<legal today> → LiveEnrollmentView: the covering row, else the not-yet-started upcoming row, #2339) and the in-force certification (GET {renewals_url}/v1/renewals/snap/certifications?household_id=; 404 = none, a lapsed row = none). Any transport error, deadline, non-2xx (other than that 404) or parse failure refuses the whole run 503 enrollment_state_unavailable, the detail naming the read; so does an upcoming row beside a covering one or one whose period has already started (enrollment_state::live_periods) — nothing is claimed or signed; the order ledger retries it. The benefit anchor is then derived per program from crate::derivation (services/canopy-eligibility/src/derivation.rs: DispatchArm, arm_for_program, LiveInputs, derive) with the precedence postponement-rows-pending → postponement → conversion → expedited certification (refused) → order (order_continuation for a live household or one whose approved period has not started, else order_effective) → reopen arm R → in-period recertification (recert_approval) → live or not-yet-started enrollment (interim_change) → reopen A/B → pend → interactive:
-
order_effective{order_ref}— an order against a household with NO live enrollment, covering or upcoming, pins the benefit date (back-dating included — a new enrollment);expedited_postponed{episode_id, generation, postponed_deadline, certification_months}— the snap block’s open, undetermined postponement whose rows are on record,benefit_effective_date = legal_filed_date;in_cert_conversion{episode_id, generation}— the released, claimed, unsettled conversion, benefit date legal-today;application_reopen{episode_id, cured_on, benefit_effective_date}(orrecert_reinstatementon arecertificationrow) — the episode’s resolved anchor adopted verbatim;agency_fault_pending— a live (h)(3) pend; otherwisedetermination_day.evaluated_as_ofis legal-today in every arm. -
interim_change{certification_start_date, certification_end_date, reported_on, reopen_episode_id?}(continuation class) — the household holds a live, in-force enrollment: the live period is carried verbatim and re-priced in place, and the anchor is the first day of the effective month fromderivation::interim_effective_month(reported_on, key, legal_today, period)— the report month whenday(reported_on) ⇐ [snap.certification].interim_change_next_month_after_day(georgia 20, PAMMS 3715:97; 7 CFR 273.12(c)(1)), else the following month; never before the processing month (a late-processed report is restoration, #1113) and never after the last certified month. Liveness displacesdetermination_day(an initial row or a post-end recertification),agency_fault_pendingand the A/Bapplication_reopen(whose episode ridesreopen_episode_idso the record-back still settles it); it never displacesrecert_reinstatement,recert_approval(below),expedited_postponedorin_cert_conversion, and the order arm re-prices the live row under its own kind (order_continuation, next bullet). Not started yet (#3056). A household whose approved enrollment starts after legal today (the live read’supcomingrow) takes the same kind on that period, in every cell liveness displaces: the period is carried verbatim, and the anchor is the report-month rule’s month raised to the period’s first month, which is its start (interim_effective_month). canopy-enrollment’s continuation arm re-prices the row in place and re-mints the period’s pending issuances, as for an order (next bullet), so no second enrollment meets the one-live fence. A live household re-run withoutchange_reported_onis 422change_reported_on_required, covering or not yet started; an in-force certification still typedexpeditedis 422certification_conversion_pendingfor every arm below the postponement and conversion rows, interactive and order alike. -
work_sanction{order_ref, certification_start_date, certification_end_date, person_id, sanction_ref}(continuation class, #3219) — an order with triggerwork-sanction(canopy-snap's finding or lift, canopy-snap API) against a household with a live or not-yet-started enrollment takes theorder_continuationarm's anchor and its two refusals, and the basis names the member and the finding (the order'ssubject_person_idandsubject_sanction_ref, carried on the order row since20270321000000_determination_orders_subject.sql; the finding rides apart fromorigin.ref_id, so a re-staged order keeps its own dedup identity). Awork-sanctionorder missing either is 422work_sanction_order_without_subject, and one against a household with neither enrollment is 422work_sanction_not_enrolled, both before any claim and terminal on the ledger: such an order would otherwise mint a first enrollment no application asked for. -
order_continuation{order_ref, certification_start_date, certification_end_date}(continuation class) — an order (determination.requested::Orderor the order self-call) against a household with a live, in-force enrollment (derivation::order_arm): the live period is carried verbatim and re-priced in place, and the anchor is the order’sas_of— the producer’s date (a change-report pipeline applies its own report-date rule before it publishes;change_reported_onis never read on this arm). Two refusals, typed and before any claim, checked in this order: 422order_anchor_behind_processing_monthwhenfirst_of_month(as_of) < first_of_month(legal today)(no basis mints a month behind its anchor — the back span is restoration, 7 CFR 273.17 / #1113) and 422order_outside_certificationwhenas_ofis before the livecertification_start_dateor after thecertification_end_date; the order ledger holds either terminal like every other 4xx (orders/mod.rs::classify_self_call,self_call_422). A re-execution of an epoch whose SNAP determination canopy-snap already holds adopts it before deriving, so neither refusal is computed from that determination’s own enrollment ([re-execution-probe]). Theexpeditedrefusal above still precedes the order arm, and an order under an open postponement or a claimed conversion staysconflicting_episodes. Not started yet (#2339). A household whose approved enrollment starts after legal today (the live read’supcomingrow) takes the same kind on that period: the period is carried verbatim, and the anchor ismax(as_of, certification_start_date)(derivation::order_target). canopy-enrollment’s continuation arm then re-prices the row in place and re-mints the period’s pending issuances at the new allotment (continuation/remint.rs). A change reported before the period begins adjusts it rather than restarting it (7 CFR 273.12(c), 273.10(c)(3)), and the one-live fence never sees a second row. The two refusals read the order’s own date, so the upcoming period refuses exactly the dates its first day would. The interim-change row readsupcomingtoo (previous bullet, #3056). The rows liveness never displaces (recert_reinstatement,recert_approval,expedited_postponed,in_cert_conversion) ignore it, every program but SNAP never receives it, and the bulk consumer’sread_live_periodtreats such a household as not enrolled. A household with neither row keepsorder_effectiveand a new enrollment, as before (tests/order_backdated_enrollment_test.rs; the live chain:tests/order_continuation_test.rs). -
recert_approval{renewal_certification_end_date}(NOT continuation class) — arecertificationapplication decided while its renewed period still runs (legal_today ⇐ renewal_certification_end_date, the end riding the determination context) anchors the NEW period at that end + 1 (7 CFR 273.14(e)(1), (b)(4); PAMMS 3710) — a full first month — whether the row is plain or under an (h)(3) pend, and whatever the live read said (the household is enrolled to that end by definition; nochange_reported_onis needed). Arm R and the A/B episode keep their own anchors; after the end the row takes the existing arms (a post-end recertification isinterim_changefor a live household, legal-todaydetermination_dayotherwise). canopy-snap opens the period from the anchor behind 422recert_anchor_mismatch; canopy-enrollment schedules the successor enrollment and canopy-renewals records the decision (canopy-enrollment, canopy-renewals). -
The postponement and conversion rows are refused, never silently ranked, beside any other anchor source: 422
conflicting_episodes. A snap block still carryingpostponement_pending_step(the postponement saga has not reacheddispatch_determination) is refused pre-claim with 409postponement_rows_pending. Block semantics and the record-back truth table: canopy-applications; the program-side re-verification of the signed basis: canopy-snap.
POST /v1/eligibility/determine/dry-run
Non-persisting: re-scores a household’s current facts as-of as_of against the baseline determination’s frozen policy bundle and pinned corpus (the renewals materiality and 130%-FPL screens), or, with target_policy { corpus_hash, params_digest }, against the named policy (the COLA preview the bulk surface composes with). SNAP only; its canopy-snap and canopy-persons reads ride the request’s outbound (a worker’s onward delegation, or a system caller’s system token). Request DryRunRequest — { baseline_determination_id, household_id, as_of, target_policy? }. Response DryRunResult — baseline / dry_run (VerdictRef { status, benefit_amount }, unsigned), corpus_hash, as_of, household_size, gross_monthly_income, gross_income_limit, and in target mode target_policy with the matched set’s effective_period. Write-free end to end; errors degrade to manual review, never a 500.
Reads
-
GET /v1/eligibility/requests/{id}→EligibilityRequest;GET …/requests/{id}/determinations→ the request’s determinations of record, each a complete signed envelope (snapshot_hash,denial_reason_codes,previous_determination_id,trigger,policy_target,evaluated_as_of,program_extension) whose status and basis are exactly as signed.benefit_effective_datesits outside the signed payload: it is the dispatch’s anchor (the cohort case’s on the bulk arm), recorded only when the envelope signed aneffective_date_basis. A quarantined envelope is never returned by this or any other read below (Quarantined envelopes). -
GET /v1/eligibility/results/{application_id}→CombinedResult. -
GET /v1/eligibility/case-status?household_id={hid}&program={slug}→CaseStatus, the newestprogram_determinationsrow for the household; the optionalprogramscopes it to one program so a program-scoped label never shows another program’s outcome (CaseStatusQuery,api/handlers/reads.rs). 404 when the household (and program, if given) has no determination. -
GET /v1/eligibility/determinations?household_id={hid}&limit={n}&offset={m}→ the household’s program determinations as[ProgramDetermination](the wire type incrates/canopy-contracts-eligibility/src/determinations.rs; the service’sstore::models::ProgramDeterminationrow converts into it,advisoriesfrom the row's recorded column and absent when none, #3324;config_stamp, always present, is the configuration the program ran on as its envelope signed it,[{ name, sha }]per layer, #3261), newest first (determined_at DESC, id DESC), one offset page at a time (HouseholdDeterminationsQuery,api/handlers/reads.rs):limitabsent → 50, any value clamped to 1..=200 (canopy_api::pagination::clamp_limit);offsetabsent or negative → 0 (clamp_offset);[]for a household with no determination (never 404). The remaining page consumers read it atlimit=200(canopy_api::pagination::MAX_LIMIT) and reduce client-side because each wants more than one row per program: the applications process page picks the newest row per (application_id, program) (fetch_determination_result,api/applications/process_reads.rs), the SNAP action resolvers apply their own selectors over the SNAP history (select_certifiable_determination/select_latest_snap_determination/select_appealable_determination,api/snap_determination.rs), and the applicant portal home walks every page (limit=200,offsetadvanced by the rows held —fetch_household_determinations,home.rs; at mostDETERMINATIONS_MAX_PAGES= 10 pages, then a WARN) before taking the newest approved row per program after a per-member pre-pass (current_per_program/authoritative_rows) — #2194. The portal arm requires the signed ownership claim for the queried household. -
GET /v1/eligibility/determinations?household_id={hid}&latest_per_program=true→ the NEWEST determination per program, as the same[ProgramDetermination]shape: at most one row per program (DISTINCT ON (program) … ORDER BY program, determined_at DESC, id DESCinstore::list_latest_determinations_by_household), the reduced set still ordereddetermined_at DESC, id DESC,[]for a household with no determination. Unpaged —limitandoffsetare ignored, because the row count is bounded by the program set rather than by a page, which is the point: a program whose newest row sits past the 200-row cap used to render "No determination" (#2178). Same route, so the same admission and portal ownership check (require_owned_household) apply. The reduction is per program, not per subject: Medicaid, CAPS and WIC write one determination row per person, and this read keeps only the newest of them per program — it is not a substitute for a per-member read (the portal home’s per-member pre-pass is why that caller does not use it). Dialled by canopy-web’s case-detail identity hero (build_identity_hero,api/case_detail/hero.rs) and the Determination tab’s SNAP strip (build_snap_group,determination_view.rs); build the query withcanopy_contracts_eligibility::paths::latest_determinations_by_household, or callEligibilityClient::list_latest_determinations_by_householdfrom tests.
Cross-program alerts
Rows derive from program_determinations with status ∈ denied, sanctioned (the table holds determinations of record only, so a quarantined envelope never surfaces). Both feeds take limit (clamped 1..=50, default 10) and repeated programs= keys (empty = unscoped; unknown → 422 naming the value).
-
The scoped feed filters to households the effective worker holds an active
household_assignmentsrow for (looked up live from canopy-applications, scope-then-limit). The effective worker is an opaque subject (#1008), resolved from the query’s URL-encodedsubjectbyresolve_effective_workerand compared byte for byte, whatever its shape:caseworker/eligibility_specialist/quality_controlread their own canopy subject —subjectmay be omitted, and naming anyone else is 403;supervisor/adminmust name a worker (any, self included). The feed is user-only: a system caller is 403service_class_on_user_only, and the assignment lookup carries the worker’s onward delegation. A requiredsubjectthat is missing is 400subject_required; an invalid one (empty, over 255 bytes, non-ASCII, a control character, or a repeatedsubjectkey) or an unknown query key is refused by the extractor (ScopedAlertsQuery,deny_unknown_fields) before any lookup. Fail-closed: applications unreachable, the 3 s deadline, or an assignment set over 5,000 is a coded 502 — never the unscoped list; a 5-failure breaker opens for 30 s. Each read publisheseligibility.cross_program_alerts.accessed, whoseeffective_workeris the resolved subject as a JSON string (nullon the/allfeed). -
The
/allfeed never consults assignments (delegated::ELIGIBILITY_GET_ELIGIBILITY_CROSS_PROGRAM_ALERTS_ALL: asupervisororadmindelegation through any client, and astudio_adminone through canopy-web). Its query (AllAlertsQuery) isdeny_unknown_fields, so asubjectsent to it is refused rather than ignored. -
Both retired spellings of the scoped feed return 404, with no alias: the pre-#596
/v1/eligibility/cross-program-alertsand the pre-#1008/v1/eligibility/workers/{worker_id}/cross-program-alerts. Older replicas 404 the new path in turn, so a mixed deployment fails closed in both directions.
Quarantined envelopes
An envelope that does not verify, or verifies but does not bind to its dispatch, is written to quarantined_determinations and never to program_determinations (ADR-002 Amendment 5; #2061). No read above returns it. Three routes let a determination operator resolve one (api/quarantine.rs, src/quarantine_ops.rs; wire types in crates/canopy-contracts-eligibility/src/quarantine.rs). Each admits OPERATOR (Admission::user_roles(DETERMINATION_OPERATOR_ROLES): eligibility_specialist, supervisor or admin, through any client). A system caller is 403 service_class_on_user_only, and any other role 403 required_role_missing. canopy-web’s quarantined-envelope worklist is the worker surface: it calls these routes on the worker’s delegation.
| Endpoint | Behavior |
|---|---|
|
One keyset page of open interactive envelopes, oldest first by |
|
One envelope in any state and of any owner, with its newest 20 resolutions, newest first ( |
|
|
An item’s routing (program, eligibility_request_id, application_id, household_id) is canopy-eligibility’s own. claimed_determination_id is the id the envelope claims, stored in its own column (for D-2c bytes that do not parse as an envelope, the id they were fetched under); person_id and claimed_status are read from the stored signed bytes. None of the three has been accepted unless state is reverified. state is derived, never stored: reverified (a reverify promoted it), dismissed, superseded (a newer row for the same household, program and subject exists in either table), otherwise open. owner is interactive, order or bulk.
A resolution runs in two phases:
-
Checks, with no transaction open. The envelope’s owner and state decide the first refusals: 409
order_ownedandbulk_owned(the order and bulk ledgers own those envelopes), 409not_open(any state butopen, except the repeated reverify above, which replays or is refusedsuperseded), and 409not_reverifiablefor a reverify of aprovenance_rejectedenvelope (its bytes verified and cannot bind on a second look). A reverify then verifies the storedsigned_payloadagainst the stored signature under the trusted program’s signing key (chip→medicaid) and re-runs the binding. -
One transaction. It compare-and-sets the envelope’s
revision; a stale revision (another resolution committed since the checks read the envelope) writes nothing and re-reads the envelope: a reverify that lost to a promoting reverify answers that promotion like the repeated reverify above (200, or 409superseded, #2653), and every other loser is 409concurrent_resolution. It appends aquarantine_resolutionsrow:actoris the caller’s canopy subject (principal.attribution_sub()),authz_basisthe highest operator role it holds (role:admin,role:supervisororrole:eligibility_specialist),notethe trimmed note. It stagesdetermination.quarantine_resolvedthrough the outbox, naming the caller asresolved_by(principal.actor()). A reverify that does not verify or bind records its new reason asreason_afterand on the envelope, and leaves it open.
A reverify that verifies and binds also promotes the envelope, inside the same transaction. It is refused while an unsettled determination_operations claim holds the application and program (409 determination_in_flight), once the envelope is superseded or its request already holds a determination of record for that program and subject (409 superseded), and when the envelope signed an effective-date basis whose operation claim, which holds its anchor, does not exist (409 anchor_unavailable). Every program signs its operation, so the binding has already quarantined an envelope naming none (#3197). Otherwise it records the envelope through intake’s persist path, so the projection pin and conflict rule apply (409 envelope_conflict, also when the signed operation is already recorded; duplicate_in_response; unrepresentable_envelope). It then moves one programs_pending entry naming the program (matched case-insensitively) to programs_approved or programs_denied in the request’s newest combined result, under that row’s lock. An approval adds its benefit to total_monthly_benefit, and a Medicaid promotion fills an empty medicaid_assigned_group from the signed assigned_coa. No combined result holding the program as pending is 409 not_pending. A promotion re-evaluates no facts: the operation’s outcome, the request’s status and determination.completed are left as they were. Recording the envelope stages determination.recorded.<program>, which releases the events the program service held for it (Determination verdicts (#2322)).
A dismiss also verifies the stored bytes against the stored signature in the checks phase, with no lock held. When they verify, its transaction stages determination.disowned.<program> with reason dismissed, and the program service drops the events it held for the claimed determination. Bytes that do not verify stage nothing.
Held determination events
A program service holds a determination’s completion events until canopy-eligibility records it (Determination verdicts (#2322)), so one never recorded holds them for good (ADR-002 Amendment 8; #3065). Three routes let a determination operator find them, drop them, and adopt the ones an order binds (api/held.rs, src/held_ops.rs and src/held_ops/adopt.rs; wire types in crates/canopy-contracts-eligibility/src/held.rs). Each admits OPERATOR, the quarantine routes' gate. The procedure is the held-determination runbook.
| Endpoint | Behavior |
|---|---|
|
Reads the |
|
|
A dropped id is never recordable. store::record_determination_on takes the same advisory lock and refuses an id the ledger dropped, so intake, an order replay, a promotion and the bulk arm answer the program pending envelope_conflict with detail determination_dropped (a promotion: 409 envelope_conflict).
Adoption
POST /v1/eligibility/determination-operations/{operation_id}/adoptions with { "note": "…" } adopts the held determinations of one of canopy-eligibility’s own operations: the program’s signed envelopes become the determinations of record, and their determination.recorded.<program> verdicts release the held events. The path names eligibility’s DeterminationOperationId (the operation_id a held item reports), so the routing comes from the claim ledger, never from an envelope. The claim’s eligibility_request_id names the run that claimed it, or the newest re-execution of an order epoch. The adopt set is held_ops::adoptable_program: the service signs back its operation and serves the operation read. Today that is SNAP, Medicaid and CHIP; TANF waits for #3116 and a TANF operation read, and WIC, which signs its operation since #3158, for a WIC operation read, so a WIC hold stays drop-only.
The note is checked first (422 invalid_note). The checks phase holds no transaction. It refuses an unknown operation, such as a direct caller’s or the bulk arm’s (404), and then these, each a 409:
-
operation_unsigned: the program is outside the adopt set. -
request_unknown: the claim names no request (claimed before #3065) or a missing one. -
order_retrying: the owning order is not terminal; its re-execution adopts by replay. -
determination_in_flight: the operation’s own claim is unsettled and younger than the staleness TTL.
It then reads the operation’s envelopes from the program service with canopy-eligibility’s system token: canopy-snap’s …/envelope, canopy-medicaid’s …/envelopes. A failed read is 502 program_unavailable, and an operation with no determination is 409 operation_not_determined. Each envelope must be the canonical bytes of what it parses to (envelope_malformed). It must verify under the program’s signing key (signature_unverified, the detail naming the reason) and bind to the trusted routing: the claim’s program and application, the request’s household, and the operation (provenance_rejected, the detail naming the field). An envelope a quarantine row claims, in any state, is refused quarantined.
One transaction then takes each determination’s advisory lock in id order and refuses, in order:
-
operation_in_flight: a live claim holds the application and program. -
superseded: a determination of record or quarantined envelope for the household, program and subject answers a request admitted after the operation’s request. -
already_resolved: the ledger already adopted or dropped one of the determinations. -
already_recorded: every determination is already recorded.
It then records each unrecorded envelope through a promotion’s path. The benefit effective date is the claim’s anchor, and the refusals are a promotion’s: superseded, envelope_conflict, duplicate_in_response, unrepresentable_envelope, anchor_unavailable. One reconcile of the request’s newest combined result follows: every programs_pending entry naming the program is removed, and one entry per adopted determination is filed under a promotion’s benefit and Medicaid-group rules. No combined result holding the program as pending is 409 not_pending. Each adopted determination appends an adopt row to held_determination_resolutions (naming the operation and the request) and stages determination.held_resolved. The answer is 201 HeldResolutions, one resolution per determination; canopy-medicaid signs one per subject. A refusal writes nothing; the operator then drops (Held determination events). As with a promotion, the operation’s outcome, the request’s status and determination.completed are left alone, so a consumer that settles on determination.completed does not see the adopted outcome (#3119).
Bulk cohort runs
The October-COLA mass re-determination surface (ADR-002 Amendments 1 and 3). Schemas: docs/modules/ROOT/openapi/eligibility.json; codes ride ProblemDetails.code. Every bulk POST refuses an Idempotency-Key (400 idempotency_key_not_allowed) and requires a reason of 1..=500 chars (valid_reason, 422 invalid_reason) recorded on the action ledger. The reads and the pause / cancel controls are live even when CANOPY_ELIGIBILITY__BULK_RUNS_ENABLED is off. Operations: the bulk-COLA runbook.
| Endpoint | Behavior |
|---|---|
|
Create a run ( |
|
Keyset pages; full status (counts, |
|
The fail-closed gate ladder: enabled → downstream sign-off ( |
|
Incident controls; cancel drains — claims settle before the run terminalizes. |
|
Resume restores |
The per-case live read (#806). After the consumer’s CAS claim (bulk/store.rs claim_attempt, which mints the operation id only) and before either phase, it reads the household’s live enrollment covering the run’s as_of from canopy-enrollment (GET /v1/enrollments/live, enrollment_state::read_live_period, the CANOPY_ELIGIBILITY__ENROLLMENT_URL upstream) and freezes the case’s provenance write-once (freeze_provenance): effective_date_basis = mass_change_cola { certification_start_date, certification_end_date } — the live period, which canopy-snap signs verbatim and canopy-enrollment applies in place — and benefit_effective_date = as_of. The outcomes settle through the fenced settle_case and surface on …/{id}/failures as last_error_code: no live row → terminal no_live_enrollment_on_effective_date (nothing to re-price; a household enrolled later belongs to a new run); a failed read → retryable live_enrollment_read_failed (the existing backoff); at enact, a live period that differs from the one frozen at preview → terminal certification_changed_since_preview — retry-failures keeps the frozen basis, so a retry cannot fix it; recovery is a NEW run (bulk/consumer.rs provenance_step). At enact either terminal refusal answers only once canopy-snap holds no determination under the case’s operation (#2655): such a refusal can be computed from the downstream effect of the case’s own determination — an earlier execution whose determination snap committed but the arm never ledgered (a lost response body, a quarantined signature, a failed persist) and canopy-enrollment applied. So for a case whose snap context was ever frozen (the arm freezes it before it dispatches), the consumer first reads the operation’s envelope (GET {snap_url}/v1/determination-operations/{operation_id}/envelope, operation_determined; the program registry’s snap URL): found, it dispatches instead, and the frozen key replays the determination or meets operation_already_determined / supersession_conflict, which the arm adopts and ledgers — snap’s one-determination-per-operation index means that dispatch can never sign another; answered the coded 404 operation_not_determined, the refusal settles; any other answer (a bare 404 included) settles retryable operation_probe_failed.
The single-case order substrate
determination.requested is a two-arm payload: Cohort (the bulk shape) and Order — a RequestOrigin {source, ref_id}, subject, programs, pinned as_of, signed trigger, requested_by. Program services publish orders (canopy-medicaid’s CMD first, origin medicaid-cmd); the consumers attach on every boot (CANOPY_MQ_PREFETCH_COUNT=1 is a fleet-wide boot requirement) and execute each order once on the determination_orders ledger — idempotent on UNIQUE (origin_source, origin_ref), claim-token-fenced settles, backoff retry via the 1-minute sweep (attempt cap 12), definitive-result adoption on crash recovery. A program is determined for the order once any completed run carrying its origin answered it approved or denied, whichever epoch dispatched it (orders::store::order_coverage, #2688). The run must also list no pending result for the program, since pending wins (OriginRun::answered, #3012). canopy-medicaid signs one envelope per subject, so a run that approved one member and left another pending lists medicaid both approved and pending, and the program stays undetermined. The next execution dispatches it again on the same epoch, because a pending member’s intake failure (signature_quarantined, persist_failed) retries the epoch rather than bumping it. The same operation’s replay, or its read-back after operation_already_determined (#2673), returns the approved member’s envelope rather than a new determination. Re-landed on the new run, that envelope answers from its row of record (store::record_determination_on). Every execution, on the same epoch or a re-keyed one, dispatches only the programs still undetermined, so a program is never sent again under a new key (ADR-002 §4: one determination per order and program). An order with every program determined settles succeeded without a dispatch, on the newest run that answered one of them, and so does a run that answers the last undetermined programs. Each run’s determination.completed lists only the programs that run dispatched, so a requester of a multi-program order reads the order’s outcome across its runs' completions; no program is answered approved or denied by more than one of them. One order epoch is one operation per program (#2652): the epoch’s first execution mints each program’s operation id (UUID v7) and stores it on the order ledger (determination_order_operations, keyed by the order’s origin, the epoch and the program; orders::store::epoch_operations); every re-execution of the epoch reads it back and claims it, re-opening the settled claim an earlier execution of the epoch left whatever its outcome — a run that died (reaped abandoned), whose completion failed, or that completed without a definitive result while its self-call answer was lost (self_call_transport / malformed_self_response retry the epoch without a bump). A re-execution therefore sends the same operation_id under the same Idempotency-Key, and with an unchanged context the same body (the SOLQ records ride in person_id order), which the program’s idempotency layer replays. A program that answers the epoch’s key idempotency_body_mismatch reached that program with another body in an earlier execution. Its idempotency layer answers from whatever it holds under the key. That can be a committed determination, but also a cached 4xx refusal, a 5xx in cooldown or a claim an earlier execution abandoned. canopy-snap’s and canopy-medicaid’s mismatch is resolved by the epoch operation’s read (#2676, #2673):
-
the determinations found there are adopted, as on a replay;
-
operation_not_determinedre-keys the epoch (dispatch_body_mismatch_undetermined), since nothing was signed under the key; -
any other answer retries the epoch.
Every other program serves no operation read, so its mismatch settles the order failed_terminal with code dispatch_body_mismatch and no epoch bump, because the earlier execution may have committed a determination, which a new key would let it sign twice. A completed self-call settles through the D-5 matrix the bulk consumer shares (#2672), so the epoch bumps (re-keying the next execution) only for an answer that proves nothing was committed under the key: a pending result with no failure (non_definitive_completion), a verdict with no determination id (definitive_without_id), a canopy-snap or canopy-medicaid body mismatch whose operation has no determination (dispatch_body_mismatch_undetermined), or canopy-medicaid’s 409 supersession_conflict to a medicaid or CHIP dispatch (supersession_conflict: medicaid’s persist is one transaction, so the 409 rolled back, and its idempotency layer caches that 409 for 24 hours, so only a fresh key re-resolves the current prior). Every other program failure keeps the epoch: transient_upstream (a timeout or transport failure, after which the program may have committed), breaker_open, signature_quarantined, persist_failed, upstream_conflict (any other 409, canopy-snap’s supersession_conflict included: on a pinned dispatch its successor can be the dispatch’s own committed determination), policy_pin_rejected and superseded_without_successor retry the same epoch, so a determination the program committed before its answer was lost is replayed by its idempotency layer rather than signed again (a cached 409 replays until attempts_exhausted); unconfigured, terminal_rejection, contract_violation, envelope_conflict and upstream_superseded (a superseded-baseline failure, which only the bulk arm reports) settle failed_terminal. Across the order’s programs (and a program’s per-subject results) the most severe settle wins: terminal over a same-epoch retry over a bump; a program with no result retries the same epoch (malformed_self_response). The settle’s excerpt names the failing program. determination.completed echoes the order’s origin; the order self-call pins the order’s date as the benefit anchor — under order_effective (a new enrollment) for a household with no live enrollment, under order_continuation (the live row re-priced in place; 422 order_anchor_behind_processing_month / order_outside_certification when the date is a month behind the processing month or outside the live period, both terminal on the ledger) for a household with a live, in-force enrollment or an approved one whose period has not started (anchored at that period’s start; the effective-date provenance paragraph above). Operations: the CMD change-report rollout runbook.
SSA pre-dispatch (Medicaid, CHIP and SNAP)
When a request includes a program canopy-medicaid serves (medicaid or chip) or snap (#3322), the orchestrator queries canopy-verification’s POST /internal/v1/ssa/solq for each member aged 65+, with disability_status ∈ disabled | disabled_veteran | ssi_recipient, or named by an income record of type ssi (member_facts::needs_solq_for). It forwards the records to canopy-medicaid as ApplicationContext.ssa_solq without persisting them (ADR-004 — raw SOLQ lives only in canopy-medicaid); a SNAP-only run carries no ssa_solq, and SNAP receives only each member's receives_ssi. CANOPY_ELIGIBILITY__VERIFICATION_URL enables it (unset: skipped, and the ABD SSA-linked COA gates fall back to their defaults); development never dispatches it whatever the URL, logged at boot (pre_dispatch_base_url, main.rs; #2495). The queries ride the run’s bearers (the request’s outbound). Fetch failures degrade to None per member. The real SSA transport is no longer an eligibility-side change: the archived plan is superseded by ADR-045 — the connector lands in canopy-exchange (#1544; live connectivity #1559) and this pre-dispatch stays on the Noop adapter until then.
TANF deprivation and relations
The orchestrator sends canopy-tanf no deprivation basis: nothing captures one yet (#669), and since #3509 it infers none. deprivation_type and deprivation_verified stay on the context for a captured basis and are absent until capture exists. The pack's tanf-eligibility decision says whether its own rule gives the unit a provisional basis (the TANF decisions). dependent_children is no longer sent.
The context also carries parent_child (required, #3048): the household’s parent–child relations, read with the parent_child group of the household’s GET /v1/households/{id}/full (fetch_household_context), each {parent_person_id, child_person_id, kind} once although canopy-persons lists it on both members' bundles (household_edges). canopy-tanf composes its assistance unit from them; the other program services ignore the field.
Signature verification
For each returned envelope both dispatch paths (orchestrator.rs intake_envelope, bulk/arm.rs; src/quarantine.rs) compute the canonical signing bytes (SignableDetermination::canonical_signing_payload()) once. That one buffer is verified and stored. Each envelope then goes through three steps:
-
Verify.
VerifyingKeyRegistry::verify_with_history(key_program, bytes, signature)returns aSignatureCheck, and every outcome butVerifiedquarantines the envelope with its reason:Malformed→signature_malformed,UnknownKey→key_unknown,KeyLookupFailed→key_unavailable,Mismatch→signature_invalid. The key program (ProgramServiceRegistry::key_program) is the dispatched program, except that achipdispatch verifies under canopy-medicaid’smedicaidkey. It picks the key and nothing else (ADR-002 Amendment 6, #2319). -
Bind. The claimed program must be the dispatched program (canopy-medicaid signs
program: chipfor a CHIP dispatch), the claimed application and household the request’s, and a SNAP or TANF envelope must name no subject. A SNAP envelope (#2947), a TANF envelope (#3116), a WIC envelope (#3153), a CAPS envelope (#3185), and the envelope of a program canopy-medicaid serves (medicaid,chip), must also sign the operation the dispatch claimed: another operation, or none, does not bind, and a dispatch that claimed none binds no such envelope. Only a program whose service signs and dedupes its operation may be dispatched (ADR-002 Amendment 6); every program’s service now does, CAPS since #3185, so every program is dispatched (CAPS since #3186). The bulk arm also checks the case’s supersession link and the run’s pins. A mismatch quarantines the envelope asprovenance_rejected(detailprovenance_rejected: <field>, e.g.programoroperation_id). The quarantine row keeps the dispatch’s claimed operation (dispatched_operation_id), so a reverify binds the same operation; a row with none (written before #2319) fails reverifyprovenance_rejected. -
Record. A verified, bound envelope is inserted into
program_determinationsunder trusted routing. Its columns, as stored, must re-canonicalize to its bytes (elsecontract_violation,unrepresentable_envelope). An existing row under the same id must hold the same bytes, signature and routing (elseenvelope_conflict); a repeat from the same request isenvelope_conflictwith detailduplicate_in_response.
A quarantined interactive or order program pends with failure signature_quarantined (detail: the reason) or contract_violation (detail provenance_rejected: <field>); a failed quarantine write is persist_failed. An envelope whose bytes cannot be built, or whose signature holds a NUL, is contract_violation with no row. Only determinations of record enter the combined benefit total. Every quarantine row increments canopy_eligibility_determinations_quarantined_total{program,reason}.
Operation replay (#2439, #2673). canopy-snap, and canopy-medicaid for a Medicaid or CHIP dispatch, answer a dispatch whose operation already has a determination 409 operation_already_determined — an order’s same-epoch re-execution (#2652) reaching the service past its idempotency layer. The orchestrator then adopts those determinations as the dispatch’s answer — reachable on the order arm only: an interactive run mints a fresh operation per run and dispatches it once, so it never meets the code: it reads the operation’s envelopes (GET {snap_url}/v1/determination-operations/{operation_id}/envelope, or canopy-medicaid’s …/envelopes, every subject’s, ordered by subject; under canopy-eligibility’s own system token, the run config’s system) and takes each fetched envelope’s bytes through intake. canopy-medicaid signs the dispatch’s one operation on every subject’s envelope, and program_determinations_operation_subject_uq holds one row per operation and subject (a household program’s subject is NULL: one row per operation). They must be the canonical bytes of the envelope they parse to (else quarantined signature_malformed, contract_violation; bytes naming no envelope are contract_violation with no row), and they are verified and bound like a returned envelope, the operation included (another operation’s envelope is provenance_rejected: operation_id), before they are recorded. A failed read pends classified like the bulk arm’s successor reads — a 404 terminal_rejection (operation_envelope_missing: <operation_id>), an availability failure transient_upstream — with upstream_code operation_already_determined, as is any intake refusal of the adopted bytes; the order ledger never bumps the epoch on such a result (a new key would let snap sign again): a read that was unavailable, a signature that did not verify or a failed write retries the same epoch (operation_adoption_pending), anything else settles failed_terminal (operation_adoption_failed). Every other program 409, supersession_conflict included, stays upstream_conflict here; the order ledger then re-keys only canopy-medicaid’s supersession_conflict (#2672) and retries every other on the same epoch.
Re-execution probe (#2675). The order arm’s derivation reads the household’s live enrollment, which a SNAP order’s own first execution can change: canopy-snap stages determination.completed.snap with its determination, canopy-enrollment enrolls the household, and a re-derivation then refuses a back-dated order 422 order_anchor_behind_processing_month (terminal on the ledger) or derives order_continuation and sends another body under the epoch’s key. So before deriving, a run carrying an order and snap looks up the epoch’s SNAP operation (orchestrator::probe_epoch_operation). When an earlier execution of the epoch claimed it (orders::store::claimed_epoch_operation; an execution claims before it dispatches), the run reads canopy-snap’s determination under it (GET {snap_url}/v1/determination-operations/{operation_id}/envelope, under the run config’s system token, counted on SNAP’s breaker):
-
found, SNAP is neither derived nor dispatched: the run claims the operation again under the provenance it was claimed under, and takes the envelope through intake as an adopted replay envelope, verified, bound (the operation included) and quarantined on any failure, as above;
-
the coded 404
operation_not_determined: the derivation runs, and a refusal it makes stands; -
any other answer (a bare 404 included), an open SNAP breaker or no registered SNAP service: the run is refused 503
operation_probe_failedbefore any claim, which the order ledger retries on the same epoch (self_call_503). The probe could not rule out the epoch’s own determination, so the terminal refusal is withheld, as the bulk arm’s enact probe withholds its own (#2655).
Only SNAP is probed: no other program’s provenance reads live state (live_inputs_for).
Error codes
| Code | Meaning |
|---|---|
400 |
|
401 |
No bearer ( |
403 |
The admission refusals: |
404 |
Request, combined result, baseline determination, bulk run, household case-status or quarantined envelope not found |
409 |
|
422 |
|
502 |
|
503 |
|
Events
Published (crates/canopy-contracts-eligibility/src/events.rs; the verdicts in verdicts.rs): determination.completed (DeterminationCompletedV1, staged with the combined result; echoes an order’s origin), determination.requested (the bulk cohort dispatch), determination.order_failed (ids + machine failure_code only), determination.quarantine_resolved (DeterminationQuarantineResolvedV1, staged with each resolution’s ledger row: the resolution, request, application and household ids, the trusted program, the action, reason_before and reason_after, the promoted determination_id, and the operator as resolved_by, an Actor from the bearer that canopy-security records as the audit row’s actor; no domain consumer), determination.held_resolved (DeterminationHeldResolvedV1, staged with each held resolution’s ledger row: the resolution, the action, the program, the determination, an adopt’s operation and request, and the operator as resolved_by, an Actor from the bearer that canopy-security records as the audit row’s actor; no domain consumer), eligibility.cross_program_alerts.accessed (the scoped-feed audit, ids only), and the per-determination verdicts below. Consumed: determination.requested (both arms, on queues canopy-eligibility.bulk-redetermination and the order substrate).
Determination verdicts (#2322)
Two verdicts per program tell the program service what became of a determination it signed (ADR-002 Amendment 7). Each carries .with_programs([program]) and ids only. The broker admits them from canopy-eligibility’s login alone (devstack/rabbitmq/definitions.json).
| Key | Payload | Staged |
|---|---|---|
|
|
By |
|
|
By |
The program services consume them on canopy-<service>.determination-verdicts (each program page’s Events section).
Configuration
CANOPY_ELIGIBILITY{PERSONS_URL, APPLICATIONS_URL, ENROLLMENT_URL, RENEWALS_URL, VERIFICATION_URL, SECURITY_URL, RULES_URL, SELF_BASE_URL, BULK_RUNS_ENABLED, BULK_ENACT_ACCEPT_DOWNSTREAM} and the BULK_* sizing knobs (services/canopy-eligibility/src/config.rs); ENROLLMENT_URL and RENEWALS_URL (config/canopy-eligibility/default.yaml: http://canopy-enrollment:8006, http://canopy-renewals:8007) are REQUIRED and boot-validated like APPLICATIONS_URL — the household reads' targets — and the boot also refuses a pack jurisdiction.toml whose [snap.certification].interim_change_next_month_after_day is missing or outside 0..=31 (orchestrator::load_interim_change_cutoff_day); the unprefixed program registry CANOPY_PROGRAM_URL_{SNAP,TANF,MEDICAID,CHIP,CAPS,WIC} (src/registry.rs); CANOPY_MQ_PREFETCH_COUNT. VERIFICATION_URL enables the SSA SOLQ pre-dispatch outside development only (#2495). Identity settings are the baseline IDENTITY_ISSUER / IDENTITY_INTERNAL_URL (configuration reference), the service’s client key CANOPY_ELIGIBILITYIDENTITY_CLIENT_PRIVATE_KEY (it sends, and does not boot without its sender) and the portal’s applicant-claim verifier CANOPY_ELIGIBILITY__APPLICANT_VERIFYING_KEY (config.rs RESERVED_KEYS).