Plan: intake vocabulary as pack data (#2211)
Status: Done (2026-11-21)
Epic: &128
Issues: #2211 (parent) · #3496 U1 (w3) · #3497 U2 (w5) · #3498 U3 (w3) · #3499 U4 (w2); follow-ups #3500 (interview modes and revert reasons), #3501 (SUA election, work-registration exemptions, the TANF personal-responsibility section), #3502 (the Medicaid determine contract’s doc comments), #3503 (the neutrality gate and <@ ARRAY[…]); relates to #3415 (Slate A), #2210
Closes: #2211 (by U4)
Branches: refactor/intake-section-citations, refactor/intake-document-types, refactor/intake-reported-income-sources, refactor/intake-neutral-refusal-text
This is a Design + Scope plan: GitLab owns tracking, the child issues carry the implementer brief, and the plan freezes when U1 starts.
Context
compliance/neutrality-gate.toml holds 26 allowlist entries and 64 findings under #2211. They are Georgia’s intake vocabulary compiled into shared code:
-
crates/canopy-contracts-applications/src/sections.rshasenum Manual(five Georgia manuals),ManualCitation,SectionName::pamms_citationand five page tables. canopy-web renders the result on every intake accordion row for any pack (services/canopy-web/src/api/applications.rs,services/canopy-web/templates/applications/intake.html). A test reads Georgia’scitations.tomlfrom the shared crate. -
DocumentType(crates/canopy-contracts-applications/src/documents.rs) is a closed enum of five values, repeated in a SQL CHECK (services/canopy-applications/migrations/20260605000000_create_application_documents.sql), in the portal’s picker and labels (services/canopy-portal/src/pages/documents.rs) and in canopy-web’s labels (services/canopy-web/src/case_detail/sections/documents.rs). A stored value outside the enum is read asOther(services/canopy-applications/src/domain.rs). -
ReportedIncomeSource(crates/canopy-contracts-applications/src/applications.rs) is a closed enum of five values, repeated in a SQL CHECK (services/canopy-applications/migrations/20270203000000_application_reported_income.sql) and in the portal’sINCOME_SOURCES(services/canopy-portal/src/pages/apply.rs). The neutrality gate does not see this CHECK: it is written<@ ARRAY[…], notIN (…). -
21 refusal and log strings in canopy-applications, canopy-snap and canopy-verification name PAMMS beside the federal citation, and four enum doc comments cite PAMMS (
EffectiveDateBasis,FilingReceiptRule,RepDisqualificationCancelReason,InterviewState).
Rulings this plan implements
-
Slate A, 2026-11-16 (#3415): document types and reported income sources become pack lists; manual citations become pack data and
enum Manualis deleted; administrative-denial reasons stay in code. -
2026-11-16 (#2211): interview modes and postponement revert reasons are not settled; they wait on a jurisdiction-extension plan.
-
2026-11-21 (question tool): scope is the three ruled items plus the state-manual references in error text. SUA election, work-registration exemptions and the TANF personal-responsibility flag are out, to the TANF plan (#2210) or their own issue.
-
2026-11-21: section citations are a dedicated pack table, not workflow-step bindings.
-
2026-11-21: a state-manual reference in refusal text is removed and the federal citation kept; no lookup mechanism.
Design
The pattern is Slate A’s X1, as SNAP certification categories and [[snap.verification.requestable_types]] already work: the pack declares rows; the service validates them at boot and refuses to start otherwise; the stored column is plain text checked against the loaded pack at write time; no SQL CHECK lists values.
U1 — section citations
Pack table, optional, in jurisdiction.toml:
[[intake.section_citations]]
program = "snap"
section = "identity"
label = "PAMMS dfcs-snap §3035"
source_ref = "dfcs-snap/modules/snap/pages/3035.adoc"
-
programis acanopy_reference::Programslug;sectionis aSectionNameslug. At most one row per pair. -
canopy-web loads the table at boot into a map and refuses to boot on an unknown program or section, a duplicate pair, or an empty
label. The intake row showslabel; a pair with no row shows no anchor and no tooltip. -
Deleted from
sections.rs:Manual,ManualCitation,pamms_citation, the five page functions, their tests, and the Georgia-readingpack_infra_testsmodule. The doc comment ofSectionNameloses its PAMMS reference. -
IntakeSectionRow.pamms_citationand the template variable are renamedmanual_citation. -
canopy config check(crates/canopy-pack-check) gains a finding: a row whosesource_refis not asource_refof that pack’s owncitations.toml(exact, or followed by a space and a qualifier, the rule the deleted test applied). -
Fixtures:
defaultcites federal text for a few sections;test-minhas no table;test-maxhas rows that differ fromdefault.
U2 — document types
Pack table, required:
[[intake.document_types]]
code = "identity"
label = "Identity"
applicant_label = "Proof of who you are"
applicant_hint = "A driver's license, state ID, or passport"
-
canopy-applications, canopy-web and canopy-portal each load it at boot and refuse to boot when it is missing or empty, a
coderepeats, or a text field is empty. -
DocumentTypethe enum is deleted. The contract fielddocument_typebecomes aString. The upload route refuses a code the pack does not declare with 422, naming the code. -
The row reader passes the stored code through.
impl TryFrom<ApplicationDocumentRow> for ApplicationDocument(services/canopy-applications/src/domain.rs) has no pack in scope and gains none: it stops coercing an unknown code toOtherand copies the column. Its error type staysScanStatusDrift, unchanged. The code was checked against the pack when it was written. -
A code a later pack no longer declares is therefore still read. It is no longer offered or accepted, and canopy-web and the portal show the bare code where they have no label for it.
-
A forward-only migration drops the
document_typeCHECK.document_kindand its CHECK are untouched (not a pack vocabulary by the ruling, and not flagged). -
canopy-web labels a document by the pack’s
label. The portal’s picker and labels come from the pack: the list rides the portal’s existing transport (services/canopy-portal/src/jurisdiction.rs: process-global on the server, adata-canopy-*attribute on the served shell for the WASM client) as one JSON-encoded attribute.
U3 — reported income sources
Pack table, required:
[[intake.reported_income_sources]]
code = "unemployment"
label = "Unemployment"
-
Same loaders and refusals as U2, in canopy-applications, canopy-web and canopy-portal.
-
ReportedIncomeSourcethe enum is deleted;ReportedIncome.other_sourcesbecomesVec<String>. Finalize refuses an undeclared or repeated code with 422, naming it. The row reader (reported_incomeindomain.rs) passes stored codes through, as in U2:ApplicationRowDrift::ReportedIncomeSourceand its test are deleted;ReportedIncomePairstays. -
A forward-only migration drops
applications_reported_income_sources_check; the pair check beside it stays. -
The portal’s
INCOME_SOURCESconstant is deleted; the wizard offers the pack’s rows in the pack’s order. The testincome_sources_are_the_reported_income_vocabulary(services/canopy-portal/src/pages/apply.rs) and the dev-dependency note that exists for it inservices/canopy-portal/Cargo.tomlgo with it.
U4 — neutral refusal text, and the allowlist’s close
-
The state-manual reference is removed from each of the 21 strings; the federal citation and the sentence stay. Files:
services/canopy-applications/src/api/postponement_gates.rs,api/postponement_revert.rs,api/rep_disqualifications.rs,interview_policy.rs,params.rs,rep_authority.rs,scheduler.rs;services/canopy-snap/src/postponement_policy.rs;services/canopy-verification/src/params.rs,request_policy.rs. -
The PAMMS references leave the doc comments of the four enums named in Context. No variant changes.
-
compliance/neutrality-gate.toml: every #2211 entry is removed as its findings go (U1 33, U2 1, U4 25). The five that remain move owner:-
administrative_denials.reasonbecomeskind = "by-design", citing an amendment to ADR-006 that records the Slate A ruling (canopy’s own state machine). -
the two
application_interviews.interview_modeCHECKs,application_postponement_episodes.reverted_reason,enum PostponementRevertReasonand the two[[pack_vocabulary_columns]]rows move to #3500, the issue for the extension plan.
-
-
Result: 0 entries under #2211; total findings 325 → 266.
Config repositories
canopy’s session commits nothing there. Sequence per unit, as for #1163: announce the table on canopy/rules; each agent adds it (an unread table is harmless); verify Georgia’s commit from a git archive; pin it in the unit’s MR. U2 and U3 make a pack without the table unbootable for three services, so Georgia’s pin is in the same MR. Texas is not pinned; its agent is told the same.
Scope
In: the four units above, their docs, OpenAPI snapshots, the fixture packs, Georgia’s pin.
Out, each to its own issue:
-
interview modes and postponement revert reasons (#3500, extension plan);
-
SUA election, work-registration exemptions, the TANF personal-responsibility flag (#3501, linked from #2210; a note on #2211 says so);
-
the Georgia vocabulary in
crates/canopy-contracts-medicaid/src/determine.rsdoc comments (#3502; raised by the Texas agent); -
teaching the neutrality gate to see
<@ ARRAY[…]CHECKs (#3503).
No compatibility: no alias for the deleted enums, no default list in code, no fallback when a table is missing.
Units
| Unit | Change | Branch | Status |
|---|---|---|---|
U1 |
Section citations as a pack table; |
|
Done (2026-11-21) |
U2 |
Document types as a pack list; CHECK dropped; portal and web read the pack |
|
Done (2026-11-21) |
U3 |
Reported income sources as a pack list; CHECK dropped |
|
Done (2026-11-21) |
U4 |
State-manual references out of refusal text and enum docs; allowlist closed |
|
Done (2026-11-21) |
One MR per unit, in order, each stacked on the last. U1 to U3 say "Relates to #2211"; U4 closes it. The issue’s "one MR" is superseded: three of the units change a wire type or a migration and are reviewed more safely apart.
Risks
| Risk | Mode | Mitigation |
|---|---|---|
A pack without |
fail-closed |
Three services refuse to boot, naming the key. Georgia’s pin rides the same MR; Texas is told before U2. |
A stored document type or income source the pack no longer declares |
fail-open |
By design: the row is read and shown with its bare code; nothing new can use the code. |
With the CHECK gone, a bad code written past the API |
silent |
Only canopy-applications writes these columns, and it validates against the pack. Nothing checks on read; a code written by hand in SQL would be shown as a bare code. Pinned by the write-refusal tests. |
The portal’s WASM client and server render different lists |
silent |
One loader feeds both: the server’s process-global and the stamped attribute come from the same value. A test renders the shell and parses the attribute back to the same list. |
A section citation that points at nothing |
silent |
|
Refusal text loses the state-manual pointer a Georgia worker used |
silent |
Accepted by ruling. The citation stays in the pack’s |
Config-repo ordering: canopy merges before Georgia carries a table |
fail-closed |
The pin is in the unit’s MR; |
Tests
-
Contract (wire):
crates/canopy-contracts-applications/tests/roundtrip.rsround-tripsdocument_typeandother_sourcesas strings; OpenAPI snapshots regenerated in U2 and U3. -
Refusal (unit, fixture packs): each loader refuses, by the key’s name, a missing table, an empty table, a repeated code, and each empty field in turn:
code,label, and for document typesapplicant_labelandapplicant_hint(U2, U3, in canopy-applications, canopy-web, canopy-portal); canopy-web refuses an unknown program, an unknown section, a duplicate pair and an emptylabel(U1). -
Stored code (unit): a document row and an application row holding a code the loaded pack does not declare convert without error and carry the code (replaces the deleted drift test); canopy-web renders that document with the bare code.
-
Write path (integration): an upload with an undeclared
document_typeanswers 422 naming it (services/canopy-applications/tests/document_test.rs); finalize with an undeclared or repeated income source answers 422 (tests/finalize_saga_test.rs). -
Migration: after each migration a code outside the old list inserts; the pair check on reported income still refuses.
-
Regression, the case that would have caught it: a pack with no
intake.section_citationsrenders an intake page with no manual anchor (U1);test-maxdeclares a document type and an income sourcedefaultdoes not, and both are offered, accepted and labelled (U2, U3). -
Pack check: a fixture pack whose row names a
source_refabsent from itscitations.tomlyields the finding; the shipped fixtures yield none. -
Gate:
cargo xtask neutrality-lintpasses with the entries removed in each unit; an entry left with fewer findings than its count fails it, so no unit can under-remove. -
Every "refuses to boot" and "422" above is pinned by the refusal and write-path tests named in those bullets.
Delivery
-
Docs, with each unit:
rulesets.adoc(the three pack tables),jurisdiction-onboarding.adoc(what a new pack must declare; what removing a code does to stored rows),api/canopy-applications.adoc(the two string fields and their 422s),data-models/canopy-applications.adoc(the dropped CHECKs),services.adoc,shared-crates.adoc(the deleted types), and the ADR-006 amendment in U4. -
CHANGELOG.adoc== Unreleased: oneChangedentry per unit; U2 and U3 state that a pack without the table no longer boots. -
At approval: U1 to U4 and the four follow-up issues are filed; this plan is committed under
plans/; a note on #2211 records the narrowed scope. -
Close: U4’s MR closes #2211; Status becomes
Done (date); the plan moves toplans/archive/.
Review log
| round | vendor | resolved model | verdict |
|---|---|---|---|
1 |
anthropic |
claude-fable-5-2 |
FLAGS (P2): U2 named the wrong error type for the document row reader ( |
2 |
gemini-4-carbon |
FLAGS (P2): the same seam; "retiring a code" was promised in the docs with no such field; the header, Scope and Delivery disagreed on two or four follow-ups and on where the SUA items go; the Tests section omitted the empty-field refusals it claimed. P1, P3, P4 pass. |
The plan presented for approval carried these resolutions: the row readers pass a stored code through instead of checking it against the pack (they have no pack in scope, and a code is validated when written), with the stored-code test named and the risk restated as fail-open by design; "retiring" replaced by a statement of what removing a code does; four follow-ups throughout; the empty-field refusals listed per field; the portal test and note added to U3. The maintainer approved it on 2026-11-21.
Errata
-
Erratum (2026-11-21): the page stays under
plans/.cargo xtask docs plan-archivemoves every Done plan at once and is run by a developer, so U4 does not move this one alone. -
Erratum (2026-11-21): U2 and U3 also refuse a pack code with outer whitespace or longer than 64 bytes. Such a code passed the planned rules and could never match a submitted value or fit the column.
-
Erratum (2026-11-21): U2 changes the applicant portal’s upload proxy, which filed a request naming no document type as
other. With no built-in list there is no code to assume, so it sends the applicant back to choose. -
Erratum (2026-11-21): U1’s pack check runs one way: a row passes when a cited
source_refequals it or extends it with a space and a qualifier, not when the row extends a cited one.