canopy-notices API Reference
For a service integrator wiring a letter, and a BFF author reading one: canopy-notices generates, stores and dispatches household notices as PDFs from Typst templates (ADR-010) and, per ADR-029, renders any allow-listed non-NOA document with an optional ES256 detached-JWS signature. Most letters are not requested over HTTP: they are routed from bus events through the ruleset’s notices/manifest.toml (below). Tables and retention: the data-models page.
- Base URL
-
container port 8008 (host:
CANOPY_PORT_CANOPY_NOTICES_8008in.ports.env) - Authentication
-
Bearer token: a canopy-identity token for this receiver (its
audisurn:canopy:service:canopy-notices), 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
-
No client but the portal holds a system edge to canopy-notices, and no route has a system arm: the applicant reads admit the portal (bound by its ownership claim) and canopy-web’s readers; the read stamp is the portal’s alone; the render route admits the citation-render bar through any client (canopy-web or canopy-cli); generate and resend admit
admin, and the delivery queue caseworker+, only through canopy-cli; the event replay is user-onlyadmin. A refusal is 403 with itsReceiverDenialcode (ADR-049 Amendment 14); each route’s constant is in the authorization inventory. - Database
-
canopy_notices
Admission specifics
-
Ownership. The portal’s
X-Canopy-Applicantclaim must bind the household (require_owned_household): onGET /v1/noticesagainst thehousehold_idfilter (an absent filter never binds), answered 403ownership_claim_missing/ownership_mismatch; onGET /v1/notices/{id}, its PDF and mark-read against the stored notice’s household after the load, answered with a uniform 404 so a refusal never confirms a foreign notice exists. The check is inert for a user. -
The admissions are
OPERATOR(adminvia canopy-cli),QUEUE_READER(caseworker+ via canopy-cli) and the inline render and mark-read admissions inservices/canopy-notices/src/api/beside the threedelegated::NOTICES_*rows; no route records an actor. The event replay is merged bymain.rsfromcanopy_api::AdminRoutes(crates/canopy-api/src/admin.rs) and admitsADMIN_HUMAN(admin, any client).
Routes
Mounted by routes() in services/canopy-notices/src/api/mod.rs; spelling from crates/canopy-contracts-notices/src/paths.rs. The last row is the shared operator route main.rs merges from canopy_api::AdminRoutes (crates/canopy-api/src/admin.rs; body ReplayRequest { event_ids }).
| Route | Access | Success | Coded refusals |
|---|---|---|---|
|
|
201 |
400 unknown |
|
portal ( |
200 |
422 unknown |
|
caseworker+ via canopy-cli |
200 |
— |
|
portal ( |
200 |
404 |
|
portal ( |
200 |
404 (unknown notice, or the on-demand re-render failed); 409 |
|
portal ( |
200 |
404 |
|
|
200 |
400 no PDF to deliver; 404; 409 superseded (retracted) notice, or a stale notice that cannot regenerate |
|
citation render |
200 |
400 unknown |
|
|
200 |
403 |
Access legend: portal (<scope>) = the portal’s system token holding that scope; + ownership = the claim check above; worker reader = a user’s delegation holding a WORKER_READER_ROLES role; caseworker+ = CASEWORKER_OR_ABOVE_ROLES; citation render = CITATION_RENDER_ROLES (admin, studio_admin, auditor; all crates/canopy-auth/src/roles.rs); a bar with no client admits a delegation through any client, via X only a delegation that client presents.
POST /v1/notices
Request GenerateNoticeRequest:
{
"household_id": "uuid", "recipient_person_id": "uuid",
"notice_type": "notice_of_action", "subject": "SNAP Benefits Approved",
"template_key": "noa-approval", "regulatory_basis": "7 CFR 273.10",
"program": "snap", "application_id": "uuid", "determination_id": "uuid",
"effective_date": "2026-04-01", "continued_benefits_available": false,
"program_data": { "monthly_allotment": "535.00", "effective_date": "2026-04-01", "expiration_date": "2026-09-30" }
}
-
Required:
household_id,recipient_person_id,notice_type,subject,template_key,regulatory_basis. Optional:program,application_id,determination_id,effective_date,continued_benefits_available,program_data, and the adverse-action bindingadverse_action_id,adverse_action_generation,action_reason_code,exemption_authority,effective_date_policy. -
notice_typeis an opaque string on the wire (notice_type: Stringincrates/canopy-contracts-notices/src/notices.rs), persisted as-is; the routed vocabulary is the manifest’snotice_typevalues (table below).template_keyis a bare manifest key resolved astemplates[program][template_key](canopy_typst::Manifest,crates/canopy-typst/src/manifest.rs); a pair with no entry is 400. -
effective_date_policyisclamp(default — an effective date earlier thannotice_date + advance_notice_daysis pushed to the floor and the row markedadvance_notice_adjusted;[notices].advance_notice_daysis refused at boot outside 1..=366, #2425) orverbatim(the adverse-action pipeline computed the legal date; the notice persists it untouched). -
program_datais an opaqueserde_json::Valuehanded to the template; the required keys are per template. -
A render or upload failure fails the request — a notice never persists without its PDF. The HTTP path renders the placeholder recipient block; event-routed letters resolve the real recipient (below).
-
Response
Noticecarriespdf_storage_path,delivery_status(pendinguntil the dispatcher stampsdispatched_at), the action binding,cb_election_deadline(notice_date + [appeals].continued_benefits_election_days),acp_applied(the address-confidentiality substitute block rendered — the DM page’s ACP section), andagency_name/agency_phone: the letterhead the notice printed (#2389),nullwhen the generator recorded none (an older or seed-loaded row, which printed[notices]). The applicant portal names them as a withheld letter’s contact (#2400).notice_dateanddispatched_atderive from the gated clock in[jurisdiction].timezone.
GET /v1/notices
Keyset-paginated newest-first (created_at DESC, id DESC). Query: household_id, program, repeated programs, limit (default 50, max 200), after_created_at + after_id (the previous page’s next_cursor). The two program filters compose by AND; an unknown slug is 422 naming the value. Response NoticePage — items + next_cursor (null at the end).
Reads, mark-read, resend, queue
-
GET /v1/notices/{id}→NoticeWithAppealRights(the appeal filing deadline).appeal_rightsis present exactly when the letter prints the hearing-rights box, its template’shearing_rights(Template resolution, #2431); a letter without the box (the interview appointment, the NOMI, the verification checklist, …) and a program-less notice, which renders no letter, readnull.GET /v1/notices/{id}/pdfstreams the object fromcanopy-store; a notice with no stored PDF (or whose object cannot be read) triggers an on-demand re-render whose bytes are returned without being persisted. The re-render prints the letterhead, appeal rights and program data the notice recorded. Only a notice with no recorded letterhead or no appeal-rights row takes the current[notices]for those fields, a re-render without a snapshot prints the placeholders for its program data, and no re-render reads a[notices.program.<program>]table (Notice identity). -
A
stalenotice (#2447) and asupersededone (#2456) are retired (active = false):GET /v1/notices/{id}, its PDF and mark-read answer 404, andGET /v1/noticesomits it, so the applicant portal and the worker lists show no letter that was never mailed — after a regeneration, only the regenerated letter and its appeal rights. A resend still resolves a retired notice (see below). -
POST /v1/notices/{id}/mark-readsetsread_aton first open (COALESCE(read_at, now()), idempotent). No audit event — the applicant’s own read. -
POST /v1/notices/{id}/resendflipsdelivery_statusback topendingfor the dispatcher loop: it retries afailednotice and mails adispatchedone again. A resent copy keeps the notice’s firstdispatched_at, the mailing its legal windows count from; its hand-off is stamped aslast_resent_atand republished onnotice.dispatchedasresent_at(#2458). A resent copy that exhausts its attempts — refused to the bound, or parked by the crash-loop guard — returns the notice todispatched, notfailed: the original letter went out, and only the copy’s failure is logged, at ERROR (#2462). A retracted letter is refused with 409 (#2446): asupersedednotice, or one whose retraction arrived while it was leased or after it went out. The resend takes the retraction consumer’s source-event lock, so a racing retraction is either refused here or finds the resend committed; a retracted notice is never revived. Astalenotice (#2447) is never mailed: its resend answers 202 with the stale notice, unchanged, and leaves its work item, already re-queued when the notice went stale, queued to regenerate the letter. It is refused with 409 once the regeneration produced a live letter (resend that one), when the regeneration failed terminally (that failure was announced as final withnotice.staleregenerating = false, and a consumer may already have repaired, so resuming it could mail a second letter; the resend re-queues nothing), when the letter was retracted, or when the notice came from outside the work-item path. -
GET /v1/notices/queueis the dispatcher’s view:delivery_status = 'pending'with a stored PDF.
POST /v1/documents/render
Request RenderDocumentRequest — { "template_key": "audit-citation", "inputs": { … }, "sign": true }. template_key is allow-listed service-side (never a filesystem path; unknown → 400); inputs is opaque JSON. With sign, the service canonicalizes inputs (JCS) and signs it ES256 (key id canopy-notices-current) under the document typ canopy-document+jws (#2956); the detached JWS is embedded in the PDF and returned as X-Canopy-Signature. Verify it with VerifyingKey::verify_detached_as(…, DOCUMENT_JWS_TYP): a document signature never verifies as a determination. Allow-listed today: audit-citation (the "Cite for hearing" citation, with a GET /v1/security/chain/attest attestation). Response is application/pdf with Cache-Control: no-store.
Error codes
| Code | Meaning |
|---|---|
400 |
Missing required field; unknown |
401 |
No bearer ( |
403 |
|
404 |
Notice not found (uniform on a foreign household from the portal arm) |
409 |
Resend of a superseded (retracted) notice, or of a stale notice that cannot regenerate (already regenerated, regeneration failed terminally, retracted, or no work item) |
422 |
Unknown |
500 |
Typst compile or storage failure; the notice is not stored |
503 |
No trustworthy key set in time ( |
Template resolution
Templates load from the configuration layers' notices/, each file resolved from the highest layer that holds it (the neutral templates are the fixtures/config/notices-neutral base layer; a manifest only a base layer supplies renders only in development or under CANOPY_NOTICES__ALLOW_DEFAULT_TEMPLATE_FALLBACK, services/canopy-notices/src/notice_tree.rs), through canopy_typst::Manifest (manifest.toml): a (program, template_key) lookup, nothing derived from notice_type. The manifest’s form_number is stamped on the row after the compile; in the neutral templates it is the placeholder FORM-<PROGRAM>-<TEMPLATE-KEY> (reference-ruleset rules). Every [templates.<program>.<key>] entry also declares hearing_rights (required, no default; #2431): true exactly when its file calls the hearing-rights( component, pinned for both shipped rulesets by every_template_entry_declares_the_hearing_rights_its_file_renders (crates/canopy-typst/src/manifest.rs). persist writes the notice’s appeal-rights row only when the resolved template sets it, so a notice has a stored hearing deadline exactly when its letter printed one. The continued-benefits offer prints only inside the hearing-rights box, so the boot refuses a route with continued_benefits_available = true whose template declares hearing_rights = false, naming the event and the template (services/canopy-notices/src/manifest_checks.rs). Date and money helper conventions for template authors live with the rulesets (the pack’s notices/components/money.typ; worker::HOUSEHOLD_DATE_FMT for the Rust side): a present-but-malformed money figure refuses the render rather than printing a guess.
Notice identity
Every letter prints the three letterhead fields: agency_name, agency_address and agency_phone. A letter with a fair-hearing block also prints hearing_phone, appeal_deadline_days ("within N days from the date of this notice") and, when set, hearing_address; a letter without one reads none of the three (pinned by a_template_without_a_hearing_box_reads_no_hearing_field), since only a boxed letter’s appeal-rights row records them for a re-render. All six come from the notice’s resolved identity, configured in the jurisdiction pack, the pack’s jurisdiction.toml:
-
[notices]is the jurisdiction’s identity. Every program without a table of its own uses it. An unknown key anywhere in the block,[notices.acp]and the program tables included, refuses the boot (#2399), so a misspelled[notices.programs.wic]cannot silently leave WIC on[notices].[notices.acp]states one form (#3439): afixedtable (the default) needsline_1,city,stateandzip; aper_participanttable states none of them; anything else refuses the boot. -
[notices.program.<program>](for example[notices.program.wic]) is one program’s complete identity, used in place of[notices]on that program’s letters. It has the same six fields and the same requiredness:hearing_addressis optional and every other field is required. A table withouthearing_addressprints no hearing address; it never borrows the jurisdiction’s. A table missing a required field, carrying an unknown key or naming a slug that is not a program refuses the boot. Nothing is inherited, so one letter never mixes two agencies.
NoticeConfig::identity(Option<Program>) (services/canopy-notices/src/config.rs) is the one resolver for a new notice. Generation renders from it, and persist stores from the same resolution: for a letter with a hearing box, the appeal-rights row’s hearing_phone, hearing_address and hearing_request_deadline (notice_date + appeal_deadline_days), and the notice row’s letterhead columns (agency_name, agency_address, agency_phone). The printed and the stored deadline therefore agree. The #1639 side-channel text prints its program’s agency_phone the same way.
A template’s program_data cannot override any of the six fields or notice_date: canopy_typst::context::flatten_context keeps the configured value and logs the collision at WARN. Every other key, effective_date included, is still overridden by program_data.
Federal floor. The federal layer’s hearing-request-windows.json lists a minimum window per program, with its authority (WIC: 60 days, 7 CFR 246.9(e)). At boot canopy-notices resolves each listed program’s identity, from its table or from [notices], and refuses to start when the window is below the floor, naming the program, the window, the floor and the authority. Every window, [notices]' and each program table’s, is also refused at boot outside 1..=366 days, naming its table and key (#2924). A program the file does not list has only that bound; giving another program a floor is a data edit.
Re-rendering reproduces what was stored. The on-demand re-render behind GET /v1/notices/{id}/pdf never reads a [notices.program.<program>] table. A notice with a stored letterhead and appeal-rights row re-renders with them; the current [notices] fills only what the rows do not record:
-
the letterhead comes from the notice row’s columns. NULL means
persistrecorded none: a row persisted before the columns existed, which printed[notices], or one loaded outside the generator (the seed tool). Both re-render with the current[notices]letterhead; -
the hearing phone and address come from the notice’s appeal-rights row, and the window is its
hearing_request_deadlineminusnotice_date; a notice with no appeal-rights row (a seed-loaded notice, or a letter without a hearing box, which prints none of these fields) gets the[notices]hearing fields; -
the continued-benefits offer (#2398) is the appeal-rights row’s
continued_benefits_availablewith the notice row’scb_election_deadline, the date the letter printed. Without a rights row the offer stands exactly when the notice row carries a deadline, and the rights row’scontinued_benefits_request_deadline(NULL on every rowpersistwrites) is read only when the notice row has none; -
the program data (#2454) is the notice’s
notice_program_datasnapshot: theprogram_dataits letter rendered, whichpersistwrites with the notice. The snapshot omits the keys that name a person (NAMES_A_PERSONinservices/canopy-notices/src/program_data_snapshot.rs), so a re-render prints noRegarding:line, names no representative (#3057) and no sanctioned member, and prints the placeholder where a SNAP claim letter names its liable adults. Each snapshot key is written over the placeholder set, so a template key added after the notice was issued prints its placeholder. A re-render without a snapshot (a seed-loaded notice, or one persisted before the table existed) prints the em-dash placeholders and logsre-render without a program_data snapshot: placeholdersat INFO.
A notice persist wrote therefore re-renders with the identity and program data it was issued under after the configuration changes.
The re-render compiles the template version the notice records (template_version), never the current one under the old notice's name (#3058). The pack keeps only each template's current version, so a notice issued at an earlier version is refused with 409 notice_template_version_unavailable, naming both versions, rather than reprinted from a template that differs from the letter mailed. Seeded notices record the version of the manifest canopy-notices renders their jurisdiction with: the pack's own, or default's when the pack ships none.
Event routing ([[event_routing]])
The subscriber on queue canopy-notices.events binds every event_type in the manifest and routes by payload discriminators. Precedence when several entries share an event_type: (created_source, reason_code) → created_source → action_type → applied_via → interview_mode → recipient_kind → (status, effective_date_basis_kind) → (status, served_program) → status → the discriminator-less entry; a discriminated entry never catches a non-matching payload, and the status and bare tiers exclude family-discriminated entries. An entry with suppress = true + reason silences the whole event in its tier (the letter is another service’s). Adding a value is a manifest entry; adding a discriminator is a Rust change. served_program (#2943) is matched against the payload’s program, since the manifest’s program is the letter’s own program; an entry naming it must name a status, refused at load otherwise. A letter’s program must be a canonical lowercase canopy_reference::Program slug (snap, wic, …); loading refuses any other value, naming the route (#2438). The Georgia table (the georgia pack’s notices/manifest.toml; the default ruleset mirrors it):
| Event | Discriminator → template_key (notice_type) |
Program |
|---|---|---|
|
|
snap |
|
|
tanf |
|
|
medicaid, chip |
|
→ |
per key |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
→ |
per key |
|
|
snap |
|
|
snap |
|
→ |
snap |
|
→ |
wic |
|
→ |
wic |
|
→ |
wic |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
|
snap |
|
→ |
snap |
|
→ |
snap |
|
→ |
snap |
|
|
snap |
|
|
snap |
Each entry’s program_data_keys names the payload keys forwarded to the template (ADR-004: ids, tokens, dates and decimal strings — never names or addresses); the manifest is the authority for the per-letter key list. Producer contract for every route: top-level household_id + person_id (the recipient — the head of household, or the representative on authorized_representative routes); an event missing either is acked and skipped (a WARN when the route is kind-bearing or notice_required).
Addressing (addressing, a letter field, never a discriminator). subject, the default, addresses the event’s person. For a subject below [notices] age_of_majority on the legal day, responsible_adult_for_minor (the Medicaid and CHIP NOAs, #1941, #2943) addresses the adult who applied, else an active individual authorized representative scoped to the notice’s program (CHIP under medicaid), and caretaker_for_minor (the WIC notices of expiration and of termination, #2390, #2391) addresses the application’s filer when they are a member of the subject’s household at any age, 7 CFR 246.7(j)(8)'s participant, parent or caretaker, else that representative. A redirected letter names the subject on its Regarding: line and records it in subject_person_id; a minor who applied for herself receives her own letter with no such line. No addressee is a retryable work-item error, never a letter to the child.
Nondiscrimination statement (#2449, #2463, #2464, #2465, #3010). Each letter prints its program’s statement, which components/nondiscrimination.typ selects for the engine’s template_program input, the program whose manifest entry the letter resolved under; the choice is the pack’s. Every shared template (shared/noa-{approval,approval-coverage,denial,termination}.typ, shared/sanction.typ, shared/overpayment.typ) prints the selected statement. Each statement is a component that prints its pinned text word for word at body size. USDA’s WIC statement prints as one unbreakable block; SNAP’s breaks only between its paragraphs, its complaint paragraph kept with its closing line (#3010). The longer HHS statements flow across a page break, so they leave no near-empty page before them; each keeps its opening paragraph, any heading with its first paragraph, and the Section 1557 notice’s closing notice of availability on one page. A .txt sidecar beside each component holds that text, and a render test compares the program’s letters against it.
-
SNAP letters print
components/civil-rights.typ, USDA’s current SNAP and FDPIR statement (the FNA "Nondiscrimination Statements" page,compliance/policy-sources/dph-wic-manifest.tomldocs."usda-fna-nds-snap"). -
WIC letters print
components/wic-nondiscrimination.typ, USDA’s statement for programs other than SNAP (docs."usda-fna-nds", same manifest). -
TANF and CAPS letters print
components/hhs-nondiscrimination.typ, an HHS-program statement with no USDA text (45 CFR 260.35; 45 CFR 98.13(b)(5)). georgia’s quotes the HHS parts of DFCS’s joint statement: the HHS sentence, the HHS OCR complaint block, and the DFCS Civil Rights, ADA/Section 504 Coordinator and DHS LEP contacts. CAPS uses it as a best-effort choice, since no CAPS parent-facing statement exists. -
Medicaid and CHIP letters print
components/section-1557-nondiscrimination.typ: a notice of nondiscrimination with the eight elements of 45 CFR 92.10(a)(1), followed by the English notice of availability of 45 CFR 92.11(a). Its wording follows HHS OCR’s 2024 sample notices. georgia’s carries DCH’s Civil Rights Coordinator, language line and website. The 92.11(b) translations into the State’s 15 most common LEP languages are not printed yet (#2464).
The default pack’s TANF, CAPS, Medicaid and CHIP statements are federal text with bracketed placeholders for the agency’s contacts. The sources, retrieval dates, and what each pinned text quotes and authors are in compliance/policy-sources/civil-rights-manifest.toml.
From event to letter
The subscriber does not render in the inbox transaction. It persists a notice_work_items row (atomic with the inbox row, idempotent on (source_event_id, notice_type)) and acks. A worker loop claims items under FOR UPDATE SKIP LOCKED, resolves the recipient from canopy-persons (legal name, membership check, mailing-first address; the household’s confidentiality election is read from canopy-applications fail-closed so an address_confidential household routes through the [notices.acp] substitute), renders outside any transaction, and commits the notice + appeal rights + notice.generated in one claim-fenced transaction. Failures retry with exponential backoff to a terminal failed + last_error after 8 attempts. A dispatcher loop drains pending notices through the delivery adapter, stamps dispatched_at and publishes notice.dispatched. delivery_status: pending → dispatched (terminal today — sent / delivered_at await a receipt-capable carrier), failed, superseded, stale; a resend returns the row to pending.
The legal day (#2447). A notice is dated with the legal day it is rendered on, and its deadlines count from that date, while the law counts them from mailing, which is the provider hand-off (#1091). So before each hand-off the dispatcher compares a never-dispatched notice’s notice_date with today’s legal date in [jurisdiction].timezone, read from the service’s one injected decision clock (the same handle dates the notice and stamps dispatched_at). A notice whose day has passed is never delivered: it goes stale, leaves every read (active = false, its appeal-rights row with it), stages notice.stale, and its work item is re-queued in the same transaction, so the worker renders a fresh letter dated today with recomputed deadlines under the same source event, whose notice.dispatched is the only dispatch evidence producers see. A stale notice whose letter was retracted meanwhile goes superseded and is not regenerated; one outside the work-item path cannot be regenerated: it is logged at ERROR and counted by the gauge canopy_notices_stale_unregenerated{notice_type} (#2460; configuration reference). A resent copy of a letter already dispatched keeps its date. A day can still cross after that check, above all during the provider call itself: the stamp then records the true, later dispatched_at, so a consumer gating on dispatched_date = notice_date sees the difference, and the dispatcher logs WARN.
Two dedicated subscribers sit beside the manifest table: queue canopy-notices.recovery handles application.applicant.recovery_initiated (an email/SMS kill-switch notice to the application-time contact, read back from GET /v1/applicants/recover/{recovery_id}; ADR-026; a logging stub adapter for UAT), and queue canopy-notices.noe-superseded retracts a stale letter (src/retractions.rs; the module was noe_superseded.rs until #2391, and the queue keeps its first name because renaming a live durable queue is a broker migration). It binds three keys, each mapped to the notice_type its due route stages the letter under: renewal.snap_expiration_notice_superseded → notice_of_expiration, wic.expiration_notice_superseded → wic_notice_of_expiration (#2390) and wic.termination_notice_superseded → wic_notice_of_termination (#2391); a delivery under any other key parks (#1131). Its log lines name the notice_type. Every retraction is recorded as a notice_retractions row (#2446). It flips a still-queued work item of that type to superseded, or its undispatched notice when no dispatcher holds the notice under a live lease; every path that supersedes a notice also retires it from reads (#2456). A pending notice already mailed once (dispatched_at set) is a resent copy: a retraction cancels only the copy, and the notice stays dispatched, readable, with its first dispatched_at. A leased notice may already be with the provider, and no lock is held across that call, so it is left to its dispatcher. The dispatch claim never takes a retracted notice. Immediately before each hand-off the dispatcher takes a last look: it renews the notice’s lease only while that lease is still live, supersedes the notice instead if its retraction committed since the claim, and never hands over a notice whose lease expired. A letter retracted after that look is mailed and stamped, and its notice.dispatched tells the producer it went out. A refused delivery of a retracted notice supersedes it, and each dispatch pass supersedes one whose lease expired unstamped. A retraction whose letter is not staged yet (it overtook its due event on the other queue) makes the subscriber refuse to stage that event (#2432). The consumer and the staging both take a transaction-scoped advisory lock on the source event id first, so a retraction racing an uncommitted staging waits for it and retracts the staged item.
Events published
-
notice.generated— staged in the worker’s persist transaction; since #2459 it carries the work-item keysource_event_id+notice_type, asnotice.dispatcheddoes (nullsource_event_idoutside the work-item path), so a consumer can recognise a regenerated letter as the stale one’s replacement. -
notice.stale(#2459; payloadcanopy_contracts_notices::events::NoticeStaleV1) — staged in the transaction that retires a notice whose legal day passed before dispatch (#2447): the notice, household, notice type, the work item’ssource_event_id(nulloutside the work-item path), theadverse_action_id, the printednotice_dateand noticed effective date,regenerating(whether a letter regenerated under the samesource_event_idfollows) andretired_at. When the work item regenerating it goes terminallyfailed, the worker announces the same notice again withregenerating = false, in the failure’s transaction. canopy-enrollment keeps the letter’s adverse-action version as a staged successor while it is regenerating, and supersedes it when the regenerated letter is recorded or when no regeneration will come. A retracted stale notice goessupersededand stages none. -
notice.dispatched— staged with the dispatch stamp;dispatched_at/dispatched_dateare always the FIRST dispatch, so a resent copy republishes them unchanged and names its own hand-off asresent_at(nullon a first dispatch, #2458); carriessource_event_id+notice_type(the correlation dispatch-gated consumers key on: canopy-verification’s due-date re-anchor, canopy-applications' NOMI and postponement stamps, canopy-renewals' NOE stamp) andapplication_id,determination_id,program(nullwhen the row has none).Pinned notice types (#2435). A letter some code recognises by its
notice_typeis pinned incanopy_contracts_notices::correlationwith the route that stages it (event type and discriminators), in two sets.CORRELATED_NOTICESare the letters another service keys on:nomi(application.interview_missed),rep-disqualification-rep(application.rep_disqualification_noticed,recipient_kind=authorized_representative) andexpedited-postponed-approval(determination.completed.snap,status=approved∧effective_date_basis_kind=expedited_postponed), whose dispatch canopy-applications stamps;verification-checklist(verification.requested), whose dispatch re-anchors canopy-verification’s due dates;notice_of_expiration(renewal.snap_expiration_notice_due), stamped by canopy-renewals;wic_notice_of_expiration(wic.expiration_notice_due), whose dispatch canopy-wic’s dispatch consumer stamps (#2390); andwic_notice_of_termination(wic.termination_scheduled), pinned for canopy-wic’s dispatch consumer, which stamps it once canopy-wic schedules terminations (#2391). The retraction consumer here retracts both notices of expiration and the WIC notice of termination.ENRICHED_NOTICESare the letters this service’s own worker enriches before render:expungement_notice(enrollment.expungement_pending), built from the event’s issuance facts, and the appointment letters rendered from the interview row:interview-appointment(application.interview_scheduled, one route each forinterview_mode=telephone,face_to_faceandhome_visit),interview-on-demandand its textinterview-on-demand-text(bothinterview_mode=on_demand) andnomi; andoverpayment_notice(snap.overpayment_claimed), the SNAP claim letter ([snap-claim-letter]). Every consumer in this tree reads the constants. canopy-notices refuses to boot when the loaded manifest’s route for a pinned letter stages letters none of which carries its type, naming the event, the discriminators and both types; a manifest that does not route the letter, or only suppresses it, loads.
The SNAP claim letter (#2228). snap.overpayment_claimed stages the claim's initial demand letter, which 7 CFR 273.18(e)(3)(iv) requires to state sixteen things, (A) to (P). The route forwards claim_id, overpayment_amount, claim_basis, period_first_month, period_last_month and months. Before the render the worker and the generator add:
-
claim_period_firstandclaim_period_last, the period's months as the letter prints them (March 2026), and a printablemonthon eachmonthsrow. A letter whose event states no whole-month period is not rendered: the item goes onto its retry ladder naming the missing key. -
liable_adults, the display names of the adults the claim is collected from (273.18(a)(4)(i)). The worker reads the household's roster from canopy-persons (GET /v1/households/{id}/fullwith an empty projection, so no SSN is opened) on the period's first day and on its last. A member is named when at or past[notices].age_of_majorityon the day of a roster they appear in. A member present only between those two days is not seen; recording liability on the claim itself is left to the claims ledger (#930). No adult on either day, or an unreadable roster, is an error and no letter is sent. -
claim_due_date, the letter's date plus the pack's[notices.claims].repayment_due_days.
liable_adults is one of NAMES_A_PERSON, so the names are printed in the stored PDF and never written to notice_program_data; the due date and the period are. The template words the claim's type and reason from claim_basis, prints the calculation table or, for a claim with no itemized months, a sentence saying so, and prints the allotment-reduction block O), (P only when an allotment_reduction input is present, which nothing sets until #930. The neutral letter appends a repayment agreement for agency-error and household-error claims and omits it for an intentional program violation.
Design history: the archived notice-generation plan, the adverse-action pipeline plan (the periodic-report and termination letters), and snap-intake-completion (the interview, NOMI, checklist, agency-pending, void, continuation and representative letters).