canopy-verification Data Model
For a contributor reading canopy_verification: the tables in effect, their policy-bearing columns and CHECKs, the one intra-database FK, and the complete migration inventory. Routes live on canopy-verification API Reference; source: migrations/.
Tables
| Table | Purpose |
|---|---|
|
Verification work items — one row per task, written by the batch |
|
IEVS adapter callback results, one row per match: the cross-service |
|
Applicant/worker responses to a work item, written by |
|
Generated ADR-018 / ADR-039 outbox and inbox — documented once on the data-models index. canopy-verification binds two consumers over the inbox: |
|
The fleet idempotency cache, created before the migrator runs by |
_sqlx_migrations (sqlx’s history table) is present as in every service.
Relationships
Three domain tables. verification_responses hangs off verifications by FK; ievs_hits shares the cross-service household / person keys with verifications but no Postgres relationship. The outbox, inbox and idempotency tables are infrastructure with no relationship to the domain tables.
Cross-service FKs (ADR-001 boundary)
canopy-verification holds no Postgres-level foreign key to another service. Every cross-service UUID column (application_id → canopy-applications; document_id → canopy-applications application_documents; household_id / person_id → canopy-persons) is an application-level reference only — the orchestrator and the worker BFF supply real ids, and existence is not enforced here. The worker columns are TEXT OIDC subjects (#1008), never UUIDs: reviewed_by names a human, and the completed_by / cancelled_by pairs name a human subject or a service principal, taken from the acting bearer.
Retention
canopy-verification’s domain tables (verifications, ievs_hits) record verification work items and IEVS match data — ievs_hits.payload holds the serialised adapter record itself (persist_hit, services/canopy-verification/src/api/ievs.rs), not metadata about it — but not FTI — the FTI-bearing IEVS audit trail lives in the legally-scoped program services (canopy-tanf / canopy-medicaid fti_audit_log per ADR-004 / ADR-014), and SSA SOLQ/BINDEX records are their own class, authorised to canopy-tanf, canopy-snap, canopy-medicaid and canopy-verification ([class.ssa_solq_bindex].authorised_services, compliance/data-tenancy-authorisation.toml) — not to those two services alone. canopy-verification holds no FTI or PHI at rest, so no Pub 1075 §9 / HIPAA at-rest retention floor applies to this database. SNAP record retention (7 CFR 272.1(f)) implies a 3-year case-record floor for the underlying SNAP record an IEVS match (42 USC §1320b-7; 7 CFR 272.8) verifies; the longest applicable program floor governs in multi-program deployments. Retention is operator-driven (archive moves, not migration-driven destructive changes — ADR-016 forward-only).
Indexes
-
idx_verifications_household_pending(partial,(household_id, requested_at DESC, id DESC) WHERE status = 'pending', #2336) — the per-household LATERAL of the caseload-scoped feedGET /v1/verifications/scoped(the worker dashboard’s "Pending verifications" panel), EXPLAIN-pinned -
idx_verifications_household— household-scoped lookup of verification items -
verifications_open_natural_key_v2_uq(partial UNIQUE, #1643) — open-item dedup, served by ON CONFLICT + read-back convergence -
idx_verifications_checklist_pending_dispatch(partial,(checklist_event_id) WHERE due_date_anchor = 'requested') — thenotice.dispatchedre-anchor consumer’s lookup -
idx_verifications_application_program((application_id, program)) — the batch-context read, the cancel-open scope and the day-30 drain’s per-application join -
idx_ievs_hits_recent— recent-hits feed, orderedhit_at DESC -
idx_ievs_hits_unreviewed(partial,WHERE status = 'unreviewed') — the IEVS-alerts panel hot path -
idx_ievs_hits_household— household-scoped lookup of IEVS hits -
verification_responses_verification_idx((verification_id, responded_at DESC)) — the per-verification response read-back -
verification_responses_application_idx— application-scoped lookup of responses -
event_outbox_*/event_inbox_*— the generated partial indexes, documented once on the data-models index -
idx_idempotency_keys_created_at— runtime DDL beside its table
Migration files
The eight generated outbox/inbox files (20260508000000, 20260516000000, 20260518004851, 20260713000000, 20260720000000, 20260803000000, 20260815000000, 20260904000000) are ADR-039 copies of crates/canopy-mq/outbox-migrations/ (cargo xtask outbox-migrations --write, parity-gated by --check) and are documented once on the data-models index.
-
20260526001500_create_verification_tables.sql— #519 + #522:verificationsandievs_hitswith their partial indexes -
20260601000000_create_verification_responses.sql—verification_responseswith itsverification_id- andapplication_id-scoped indexes -
20260804000000_v7_pk_defaults.sql— #1173: drops theverification_responses.idgen_random_uuid()default so a missed app-supplied UUIDv7 bind fails loudly -
20261122000000_verifications_open_natural_key.sql— #1480: the original open-item natural-key partial unique on(application_id, household_id, verification_type) -
20261123000000_verification_request_context.sql— #1643: the request-context columns and CHECKs, the natural-key split (the legacy key narrowed toprogram IS NULL, the program- and person-awareverifications_open_natural_key_v2_uqadded), and the dispatch-consumer / application-program indexes -
20261223000000_cancel_reason_superseded_by_postponement.sql— #1662: re-creates the closedcancel_reasonCHECK with the fifth tokensuperseded_by_postponement(re-created, never edited in place; no row changes) -
20261224000000_drop_legacy_open_natural_key.sql— #1676: drops the legacy program-NULL keyverifications_open_natural_key_uqonce #1644 removed both of its producers (index-only, no DML; the v2 key stays) -
20261225000000_drop_wall_clock_defaults.sql— #1685: drops theDEFAULT now()onverifications.requested_atandverification_responses.responded_at(NOT NULL stays) so a writer that omits the decision-clock stamp fails instead of misdating the row -
20261226000000_provisional_window_check.sql— #1674: addsck_verifications_provisional_window(due_date_anchor <> 'requested' OR response_days IS NOT NULL) so thenotice.dispatchedre-anchor can never compute a NULL deadline (7 CFR 273.2(f)) -
20270113000000_actor_subjects.sql— #1008: retypesworker_id,completed_by,cancelled_byandievs_hits.reviewed_bytoTEXT, addscompleted_by_service/cancelled_by_serviceand the four optional-pair CHECKs. Its guard refuses a database holding an act with no recorded actor (a pre-#1008 service resolve or cancel stored NULL), an actor without its act, or a nil-UUID subject — the remedy is the reset it names,cargo xtask dev restart, never a backfill -
20270210000000_pending_by_household.sql— #2336: addsidx_verifications_household_pending, and dropsverifications.worker_idwith its two indexes (idx_verifications_worker_pending,idx_verifications_pending_unassigned, partial onworker_id IS NULL): no service writer ever set the column (only the devstack seed did), and a worker’s pending items are their assigned households' (#607). The index is a guardedCREATE INDEX IF NOT EXISTS, so a live deployment can pre-build itCONCURRENTLY
All migrations are forward-only per ADR-016.