From ba9b23547304f03f7ed2e332b4e6f8e77e3f287c Mon Sep 17 00:00:00 2001 From: David Trimmer <178813244+DTrim99@users.noreply.github.com> Date: Wed, 2 Dec 2026 10:01:21 -0500 Subject: [PATCH 1/2] Calibrate SNAP participants to FNS average monthly persons (#1843) Map the FNS FY2024 average monthly persons facts the pinned feed carries, by state and nationally, to the SNAP-unit members of SPM units with positive annual snap: people not excluded by is_snap_excluded_member, projected from the unit's snap with the CMS APTC indicator pattern. The persons and household targets now share one unit definition. The two persons families move from reviewed exclusions to compiled in the parity manifest. Co-Authored-By: Claude Opus 5.5 --- .../1843-snap-participant-targets.added.md | 1 + docs/evidence/spec-engine/us-f0-coverage.json | 32 +++++----- .../build/spec_engine/inventory_coverage.py | 16 ++--- .../build/us/fiscal_target_registers.json | 38 +++++++++-- .../src/microcosm/build/us/source_stages.json | 2 +- .../src/microcosm/build/us/spec/sources.yaml | 7 ++- .../build/us/target_parity_manifest.json | 24 ++----- .../build/us_runtime/snap_state_take_up.py | 7 ++- .../shared/test_release_target_parity.py | 8 ++- .../shared/test_spec_engine_loader.py | 2 +- .../us/test_us_bundle_core_contracts.py | 2 +- .../us/test_us_fiscal_target_registers.py | 2 +- .../engine_free/us/test_us_fiscal_targets.py | 63 ++++++++++++++++--- .../us/test_us_multispine_pool_tool.py | 2 +- .../microcosm_build/us_spec_bundle.py | 2 +- tools/build_us_acs_local_release.py | 4 +- tools/build_us_target_parity_manifest.py | 24 ------- tools/generate_us_bundle_from_constants.py | 2 +- 18 files changed, 141 insertions(+), 97 deletions(-) create mode 100644 changelog.d/1843-snap-participant-targets.added.md diff --git a/changelog.d/1843-snap-participant-targets.added.md b/changelog.d/1843-snap-participant-targets.added.md new file mode 100644 index 0000000000..661cad9a6c --- /dev/null +++ b/changelog.d/1843-snap-participant-targets.added.md @@ -0,0 +1 @@ +Calibrate SNAP participants to the FNS FY2024 average monthly persons, by state and nationally: the SNAP-unit members (people not excluded by `is_snap_excluded_member`) of SPM units with positive annual `snap`, the same units the household target counts (#1843). diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index fefdbcc1f2..15658836f6 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -4,7 +4,7 @@ "version": 1 }, "country": "us", - "documentation_sha256": "e843b077f1a609298cb3aeb745beaf89c7d4e19918246190d533b9d5b222c222", + "documentation_sha256": "9f00b7ca5c8120bf64e32396f10b913a6123cd33acc80f1068e2dd690bf9216a", "field_usage": { "authored_normative_field_count": 32811, "claim_count": 49, @@ -1361,12 +1361,12 @@ ], "expected": { "producer_count": 38, - "sha256": "c4218cf5d569caa6ef83b53f2b1563ab2cd52ed159e72da27db5921b18a87cad" + "sha256": "a334aeaab2d7d55ac3cb4f60f950cc1d1947b4ecc84cabde4c529382a7da07cc" }, "failures": [], "observed": { "producer_count": 38, - "sha256": "c4218cf5d569caa6ef83b53f2b1563ab2cd52ed159e72da27db5921b18a87cad" + "sha256": "a334aeaab2d7d55ac3cb4f60f950cc1d1947b4ecc84cabde4c529382a7da07cc" }, "status": "covered" }, @@ -1656,13 +1656,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "ace6d76ea8a91ed8f8acb76cea9763d5057df5b2e157460a95ce104210be0637", - "protocol_sha256": "54a6b01b7b225976f5c8ebf5b8a6c80385b741a7a684861e67c4b0cfe986456b" + "map_sha256": "172638c3a54c9ea16a4d7cbc6ad817a8f7600d076f411445c0aaea39a7042616", + "protocol_sha256": "a487f7529b419fd197472a68bcdfc1693d96175167ae198f431fb695b37963d7" }, "failures": [], "observed": { - "map_sha256": "ace6d76ea8a91ed8f8acb76cea9763d5057df5b2e157460a95ce104210be0637", - "protocol_sha256": "54a6b01b7b225976f5c8ebf5b8a6c80385b741a7a684861e67c4b0cfe986456b" + "map_sha256": "172638c3a54c9ea16a4d7cbc6ad817a8f7600d076f411445c0aaea39a7042616", + "protocol_sha256": "a487f7529b419fd197472a68bcdfc1693d96175167ae198f431fb695b37963d7" }, "status": "covered" }, @@ -1677,7 +1677,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "54a6b01b7b225976f5c8ebf5b8a6c80385b741a7a684861e67c4b0cfe986456b", + "implementation_sha256": "a487f7529b419fd197472a68bcdfc1693d96175167ae198f431fb695b37963d7", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1698,7 +1698,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "54a6b01b7b225976f5c8ebf5b8a6c80385b741a7a684861e67c4b0cfe986456b", + "implementation_sha256": "a487f7529b419fd197472a68bcdfc1693d96175167ae198f431fb695b37963d7", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1775,12 +1775,12 @@ "legacy_adapter.imputation.late_producer_resource_semantics" ], "expected": { - "sha256": "777ba41a83bf75ee00937f694a08208e93dcd7c91c9d096d316affd67d424267", + "sha256": "4fba085d81a351cd42e9fa707ca956d8527a8187e8cea7992fc6b74c1a36b5b2", "stages": 38 }, "failures": [], "observed": { - "sha256": "777ba41a83bf75ee00937f694a08208e93dcd7c91c9d096d316affd67d424267", + "sha256": "4fba085d81a351cd42e9fa707ca956d8527a8187e8cea7992fc6b74c1a36b5b2", "stages": 38 }, "status": "covered" @@ -1887,7 +1887,7 @@ "alpha", "zeta" ], - "sha256": "90345ce0983f346297801be3e840e6f5cc384bf5615e8609fef8ba5ba98ed0e1" + "sha256": "eb16e67a9a108a2a74ec2b71c877cf1e2d5ec8e7d078897fec3103d3fb01f1f3" }, "failures": [], "observed": { @@ -1911,7 +1911,7 @@ "alpha", "zeta" ], - "sha256": "90345ce0983f346297801be3e840e6f5cc384bf5615e8609fef8ba5ba98ed0e1" + "sha256": "eb16e67a9a108a2a74ec2b71c877cf1e2d5ec8e7d078897fec3103d3fb01f1f3" }, "status": "covered" }, @@ -1975,7 +1975,7 @@ "take_up_contract", "us_qbi_reconciliation_contract" ], - "sha256": "a4e9df199923cf0e9e911717e804433d6274a6dbe9d4c46f544ab4680241f1f6" + "sha256": "fb6f7212e96062142589da241f6a3408132bce65273997f5525c58ecf0f240c9" }, "status": "covered" }, @@ -2687,7 +2687,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "8183ac1c8bf9adf9c6f609838590b8de4d07f6de12137117e33b20b590ad323f" + "spec_sha256": "4ad806f37703e9ac87000bd3c1c4b2b80925f37aab87bb263243dc62ae4b322c" } }, "report_schema_version": 3, @@ -2697,7 +2697,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "8183ac1c8bf9adf9c6f609838590b8de4d07f6de12137117e33b20b590ad323f" + "spec_sha256": "4ad806f37703e9ac87000bd3c1c4b2b80925f37aab87bb263243dc62ae4b322c" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index 258a04e6e8..41dbd1c09d 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -362,12 +362,12 @@ "acs_person_predictors": "878c788a6f037d7aca12b3586ea034eff04f3034ffa11935a736493042551f25", "authority": "51082a05e7ff8d2c901a9c0de54fdee7378f241cb377a9c0ddeeb12b1fc2db69", "early_families": "4aa9f736fd76e83955477ad1667e58f48f264783f05bdc7f0102cd32d61323bd", - "full_checkpoint": "90345ce0983f346297801be3e840e6f5cc384bf5615e8609fef8ba5ba98ed0e1", + "full_checkpoint": "eb16e67a9a108a2a74ec2b71c877cf1e2d5ec8e7d078897fec3103d3fb01f1f3", "gap_fill_schedule": "1c31f9868f7884347cc19cf1ff65da43f950b9114941a715bab168246db414a7", - "graph_nodes": '3c19bfdd4c690aec1e6dd1438c55675bff13f0a099f4db2f89f42d69e51adb87', + "graph_nodes": "3c19bfdd4c690aec1e6dd1438c55675bff13f0a099f4db2f89f42d69e51adb87", "geography_assignment": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c", "late_families": "69134b2aece677e1e71d98f423f2c92e5a82380aa7ebf4d415ffba9142d0e31e", - "late_resource_semantics": "c4218cf5d569caa6ef83b53f2b1563ab2cd52ed159e72da27db5921b18a87cad", + "late_resource_semantics": "a334aeaab2d7d55ac3cb4f60f950cc1d1947b4ecc84cabde4c529382a7da07cc", "late_schedule": "c9225891a5ce3522460d805ea047b96082f3befb704e4b8e886d27a4b73ea889", "ownership": "5f64f0aac49e2313177564f71876bffc8c81b3ded4df701e70930e60e9c98356", "primary_tuples": "dbb5314f85727d4734a37b5e2de9d775a3044e362a18d831521460e1d261ac98", @@ -435,11 +435,11 @@ # move both again; stable_identity_uniforms, the one function the US # keyed draws call, is unchanged, so no draw changes. # Merging the policyengine-us 2.145.3 engine refresh (#1676) moves both again. - "seed_map": 'ace6d76ea8a91ed8f8acb76cea9763d5057df5b2e157460a95ce104210be0637', - "seed_protocol": '54a6b01b7b225976f5c8ebf5b8a6c80385b741a7a684861e67c4b0cfe986456b', - "source_manifest": '777ba41a83bf75ee00937f694a08208e93dcd7c91c9d096d316affd67d424267', - "take_up": 'ca44532ca9e93e169e07acfd35d57efbacc1297b07006c4e546e05802efc420c', - "tail": 'f7f8282d48dbf1e01016cd551f5a0de289911140048d20812c920ace0d092936', + "seed_map": "172638c3a54c9ea16a4d7cbc6ad817a8f7600d076f411445c0aaea39a7042616", + "seed_protocol": "a487f7529b419fd197472a68bcdfc1693d96175167ae198f431fb695b37963d7", + "source_manifest": "4fba085d81a351cd42e9fa707ca956d8527a8187e8cea7992fc6b74c1a36b5b2", + "take_up": "ca44532ca9e93e169e07acfd35d57efbacc1297b07006c4e546e05802efc420c", + "tail": "f7f8282d48dbf1e01016cd551f5a0de289911140048d20812c920ace0d092936", } INVENTORY_REPORT_SCHEMA_VERSION = 1 diff --git a/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json b/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json index aee4995f64..5da9983ea8 100644 --- a/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json +++ b/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json @@ -1366,11 +1366,39 @@ "units vs the 22.20M FY2024 FNS national average (-1.4%) with no", "calibration pressure on counts.", "", - "average_monthly_persons is deliberately NOT mapped: the real SNAP", - "assistance unit is often a subset of the SPM unit (FY2024 FNS persons", - "per household is 1.88 vs 2.82 members per simulated taker unit), and", - "PolicyEngine-US does not model sub-unit participation, so a person", - "indicator overcounts by ~50% and would fight the household target." + "average_monthly_persons counts the members of these same units", + "(the entry below), so the two targets share one unit definition." + ] + }, + { + "source": "usda_snap", + "measure_id": "average_monthly_persons", + "base_variables": "is_snap_excluded_member", + "family": "usda_snap", + "metadata": { + "target_role": "snap_persons", + "fact_aggregation": "time_mean", + "measure_mode": "less_than_indicator_sum", + "indicator_less_than": "1.0", + "indicator_map_to": "person", + "indicator_filter_variable": "snap" + }, + "note": [ + "FNS average monthly persons (microcosm#1843). The count is the", + "people in SPM units with positive annual snap who are not excluded", + "from the SNAP unit (is_snap_excluded_member false: ineligible", + "students, ineligible immigrants, people failing the work", + "requirements), which is the sum of snap_unit_size over the units", + "the household target counts. snap is projected to person grain", + "(indicator_map_to), the pattern of the CMS APTC rows.", + "", + "PolicyEngine-US does not split an SPM unit into several SNAP", + "households, so where FNS counts adults sharing a home as separate", + "households the target is met by weight on small SPM units instead.", + "Before this target, the 27 November 2026 build had 2.53 SNAP-unit", + "members per recipient unit in January 2026 against 1.88 FNS persons", + "per household in FY2024; most of that gap is households with", + "children, which SNAP cannot split." ] }, { diff --git a/packages/microcosm-build/src/microcosm/build/us/source_stages.json b/packages/microcosm-build/src/microcosm/build/us/source_stages.json index c4e777b5de..e97d1401b1 100644 --- a/packages/microcosm-build/src/microcosm/build/us/source_stages.json +++ b/packages/microcosm-build/src/microcosm/build/us/source_stages.json @@ -2306,7 +2306,7 @@ "outputs": [ "takes_up_snap_if_eligible" ], - "notes": "Anchored count-calibration to FNS state caseloads (microcosm #372), following the medicaid_take_up pattern at SPM-unit grain. Reported recipients always take up; the fill draws at an in-build state rate (FNS average-monthly household count over weighted modeled-eligible units, an assignment prior, never cited as provenance) and is greedily calibrated to the FNS FY2024 state counts among eligible non-anchored units. Caseload semantics are fiscal-year average-monthly stocks - the same rows the snap_households weight-calibration targets compile from, so the seed and the calibration objective agree. CPS receipt underreporting is strongly state-dependent, so the national snap_take_up fill leaves the worst-underreporting states short of taker households no reweighting can recover. The assign operation deliberately carries no eligibility mask: off-domain units keep a draw-based propensity so eligibility-expanding reforms do not inherit a hard-coded zero response. States whose FNS count meets or exceeds modeled eligible weight saturate (all eligible units take up) and are recorded as saturated in diagnostics, not failed. Persons caseloads are deliberately untargeted: the SNAP assistance unit is often a subset of the SPM unit, so member counts overcount FNS participants by roughly half." + "notes": "Anchored count-calibration to FNS state caseloads (microcosm #372), following the medicaid_take_up pattern at SPM-unit grain. Reported recipients always take up; the fill draws at an in-build state rate (FNS average-monthly household count over weighted modeled-eligible units, an assignment prior, never cited as provenance) and is greedily calibrated to the FNS FY2024 state counts among eligible non-anchored units. Caseload semantics are fiscal-year average-monthly stocks - the same rows the snap_households weight-calibration targets compile from, so the seed and the calibration objective agree. CPS receipt underreporting is strongly state-dependent, so the national snap_take_up fill leaves the worst-underreporting states short of taker households no reweighting can recover. The assign operation deliberately carries no eligibility mask: off-domain units keep a draw-based propensity so eligibility-expanding reforms do not inherit a hard-coded zero response. States whose FNS count meets or exceeds modeled eligible weight saturate (all eligible units take up) and are recorded as saturated in diagnostics, not failed. The stage fills to household counts only; FNS average monthly persons is a weight-calibration target (snap_persons, microcosm #1843) over the SNAP-unit members of these units, so it moves weight between taker units rather than choosing them." }, { "stage": "relationship_inputs", diff --git a/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml b/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml index 29c90412b5..c1b960cafa 100644 --- a/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml +++ b/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml @@ -99,7 +99,7 @@ sources: stage_asset: id: source_stages path: microcosm.build.us/source_stages.json - sha256: 7ba871f1493c2cb5c4711f16e58be8e76dabfc9d0c1be0c738614ec695ec94e5 + sha256: 4d84cecde75ce9de64998b91d6e99782a50d2f31d4323039dfc0109e60615f60 stage_manifest: version: 1 country: us @@ -2386,8 +2386,9 @@ stages: deliberately carries no eligibility mask: off-domain units keep a draw-based propensity so eligibility-expanding reforms do not inherit a hard-coded zero response. States whose FNS count meets or exceeds modeled eligible weight saturate (all eligible units take up) and are recorded as saturated in diagnostics, - not failed. Persons caseloads are deliberately untargeted: the SNAP assistance unit is often a subset - of the SPM unit, so member counts overcount FNS participants by roughly half.' + not failed. The stage fills to household counts only; FNS average monthly persons is a weight-calibration + target (snap_persons, microcosm #1843) over the SNAP-unit members of these units, so it moves weight + between taker units rather than choosing them.' - stage: relationship_inputs survey: Census CPS ASEC source: https://www.census.gov/programs-surveys/cps.html diff --git a/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json b/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json index 8df9fec8c5..d83560080b 100644 --- a/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json +++ b/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json @@ -8,8 +8,8 @@ "us_data_source": "retired us-data pipeline (archived): utils/loss.py (eCPS loss matrix), db/etl_national_targets.py, db/etl_*.py, utils/national_target_parity.py", "family_granularity": "namespace.concept of the ledger source_record_id (us_target_family_id)", "governing_rule": "us-data-targeted => compiled unless source-absent; every reviewed exclusion carries a Chesterton's-fence {origin, purpose, verdict_basis}", - "compiled_families": "32", - "reviewed_exclusions": "64" + "compiled_families": "34", + "reviewed_exclusions": "62" }, "families": { "bea_nipa.business_current_transfer_receipts": { @@ -772,15 +772,7 @@ "status": "compiled" }, "usda_snap.national_average_monthly_persons": { - "status": "reviewed_exclusion", - "classification": "not_modeled", - "reason": "USDA FNS SNAP average-monthly PERSONS. A person indicator overcounts FNS participants ~50% (FY2024 persons-per-household 1.88 vs 2.82 simulated members); the household caseload is the calibrated count.", - "evidence": "INDICATOR_LEDGER_TARGETS average_monthly_households comment + test_snap_person_caseload_fact_is_not_compiled", - "fence": { - "origin": "not a us-data calibration target as a persons row: us-data calibrates SNAP dollars (CBO_PROGRAMS 'snap'), and the household caseload (usda_snap.*_average_monthly_households) is compiled.", - "purpose": "n/a \u2014 the household caseload is the model counterpart, not persons.", - "verdict_basis": "not_modeled: PolicyEngine-US does not model sub-unit SNAP participation, so a person indicator overcounts ~50% vs the compiled household caseload." - } + "status": "compiled" }, "usda_snap.national_benefits": { "status": "compiled" @@ -789,15 +781,7 @@ "status": "compiled" }, "usda_snap.state_average_monthly_persons": { - "status": "reviewed_exclusion", - "classification": "not_modeled", - "reason": "USDA FNS SNAP average-monthly PERSONS. A person indicator overcounts FNS participants ~50% (FY2024 persons-per-household 1.88 vs 2.82 simulated members); the household caseload is the calibrated count.", - "evidence": "INDICATOR_LEDGER_TARGETS average_monthly_households comment + test_snap_person_caseload_fact_is_not_compiled", - "fence": { - "origin": "not a us-data calibration target as a persons row: us-data calibrates SNAP dollars (CBO_PROGRAMS 'snap'), and the household caseload (usda_snap.*_average_monthly_households) is compiled.", - "purpose": "n/a \u2014 the household caseload is the model counterpart, not persons.", - "verdict_basis": "not_modeled: PolicyEngine-US does not model sub-unit SNAP participation, so a person indicator overcounts ~50% vs the compiled household caseload." - } + "status": "compiled" }, "usda_snap.state_benefits": { "status": "compiled" diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py b/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py index 64bd0d3899..3169a23786 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py @@ -28,9 +28,10 @@ are the FNS ``average_monthly_households`` facts (the same rows the ``snap_households`` calibration targets compile from), and the taker set is the model counterpart of the average monthly caseload — the take-up flag -carries no within-year churn. Persons targets are deliberately absent: the -real SNAP assistance unit is often a subset of the SPM unit, so a person -count over taker-unit members overcounts FNS participants by roughly half. +carries no within-year churn. The stage fills to household counts only. +FNS average monthly persons is a weight-calibration target (``snap_persons``, +microcosm#1843) over the SNAP-unit members of these units, so it moves weight +between taker units rather than choosing them. Two deliberate carry-overs from the Medicaid stage: diff --git a/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py b/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py index 2f824c52c2..26ed7b5827 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py @@ -322,9 +322,11 @@ def test_manifest_header_counts_match_parsed_families(self) -> None: assert int(manifest.reference["reviewed_exclusions"]) == len( manifest.reviewed_exclusions ) - assert len(manifest.compiled_families) == 32 - # 53, plus the 11 ed_fsa families of the 41b2fb2b feed (microcosm#1074). - assert len(manifest.reviewed_exclusions) == 64 + # 32, plus the two FNS persons families (microcosm#1843). + assert len(manifest.compiled_families) == 34 + # 53, plus the 11 ed_fsa families of the 41b2fb2b feed (microcosm#1074), + # less the two FNS persons families now compiled (microcosm#1843). + assert len(manifest.reviewed_exclusions) == 62 def test_wired_nipa_and_liheap_families_are_compiled(self) -> None: manifest = load_target_parity_manifest() diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 8e72000cc8..9b70dd293a 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -47,7 +47,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # #931's additions to stochastic_assignment move it again. # Merging the policyengine-us 2.145.3 engine refresh (#1676) moves it again. assert first.spec_sha256 == ( - '7828d622ccf20a7a4f568be9292db0ba060b89bf5a179f1633e020889720322e' + "b88a5d8fa65b271f8cfb494f3b23a2facc1b781561bb7a915d3c7202b532566a" ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py b/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py index c12f9585a5..4523942b10 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py @@ -25,7 +25,7 @@ def test_source_surface_classification_is_complete() -> None: } assert normative["stage_asset"] == { "id": "source_stages", - "sha256": "7ba871f1493c2cb5c4711f16e58be8e76dabfc9d0c1be0c738614ec695ec94e5", + "sha256": "4d84cecde75ce9de64998b91d6e99782a50d2f31d4323039dfc0109e60615f60", } assert operational["stage_asset"] == { "path": "microcosm.build.us/source_stages.json" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py index f2fafc8ca7..3f7f6976cc 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py @@ -48,7 +48,7 @@ "c991f34caf1e9bde876777a2785f42f736b0331013ce0a72c4e25c627863e9e5" ), ("fiscal_targets", "INDICATOR_LEDGER_TARGETS"): ( - "dbe04076e64d03cd561a0ce2087db3d36e87e93d7f7b1405633d23267e098d49" + "ab6b82de7a44ac9d41eedcd3521fffb59452d548fe50e3f0c00db40ceb22bf7e" ), ("fiscal_targets", "US_FISCAL_TARGET_SUPPORT_EXCLUSIONS"): ( "0557e4028686d83baffb643546ce607f3ccdad925fdd3069d20461fac4ef45ac" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py index a38e8f2b61..cd37bc257c 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py @@ -2404,11 +2404,10 @@ def test_state_snap_household_caseload_fact_compiles_with_state_fips() -> None: assert spec.metadata["state_fips"] == "36" -def test_snap_person_caseload_fact_is_not_compiled() -> None: - # The SNAP assistance unit is often a subset of the SPM unit, so a person - # indicator over taker-unit members overcounts FNS participants by ~50%. - # The persons measure must stay unmapped until sub-unit participation is - # modeled. +def test_snap_person_caseload_fact_counts_snap_unit_members() -> None: + # microcosm#1843: FNS average monthly persons counts the people in SPM + # units with positive annual snap who are not excluded from the SNAP + # unit, so the persons target shares the household target's units. registry = compile_us_fiscal_target_registry( [ *packaged_reference_facts(), @@ -2421,9 +2420,59 @@ def test_snap_person_caseload_fact_is_not_compiled() -> None: ] ) - assert not [ - spec for spec in registry.specs if "average_monthly_persons" in spec.name + specs = [spec for spec in registry.specs if "average_monthly_persons" in spec.name] + assert len(specs) == 1 + spec = specs[0] + assert spec.family == "usda_snap" + assert spec.value == 41_690_000 + assert spec.metadata["target_role"] == "snap_persons" + assert spec.metadata["base_variable"] == "is_snap_excluded_member" + assert spec.metadata["measure_mode"] == "less_than_indicator_sum" + assert spec.metadata["indicator_less_than"] == "1.0" + assert spec.metadata["indicator_map_to"] == "person" + assert spec.metadata["indicator_filter_variable"] == "snap" + assert "state_fips" not in spec.metadata + + +def test_state_snap_person_caseload_fact_compiles_with_state_fips() -> None: + registry = compile_us_fiscal_target_registry( + [ + *packaged_reference_facts(), + _usda_snap_caseload_fact( + measure_id="average_monthly_persons", + value=2_890_000, + record_set_slug="state_average_monthly_persons.nero", + value_id="ny", + geography_level="state", + geography_id="0400000US36", + entity_name="person", + ), + _usda_snap_caseload_fact( + measure_id="average_monthly_households", + value=1_507_000, + record_set_slug="state_average_monthly_households.nero", + value_id="ny", + geography_level="state", + geography_id="0400000US36", + ), + ] + ) + + specs = {spec.name: spec for spec in registry.specs} + persons = specs[ + "usda_snap.fy2024.state_average_monthly_persons.nero.ny.average_monthly_persons" + ] + households = specs[ + "usda_snap.fy2024.state_average_monthly_households.nero.ny" + ".average_monthly_households" ] + assert persons.value == 2_890_000 + assert persons.metadata["target_role"] == "snap_persons" + assert persons.metadata["state_fips"] == "36" + # Both rows compile: distinct roles and measures keep them from + # collapsing into one model target. + assert households.metadata["target_role"] == "snap_households" + assert households.metadata["state_fips"] == "36" def test_ssa_ssi_recipients_national_fact_is_a_nonbinding_reference() -> None: diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index 71c8d9f34e..b211125d32 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -381,7 +381,7 @@ def capture_equality(expected: object, actual: object) -> None: # Merging the policyengine-us 2.145.3 engine refresh (#1676) moves it again. # microcosm#1728's three declared US resources (target sets, local # target construction and compile registers) move it again. - "spec_sha256": "8183ac1c8bf9adf9c6f609838590b8de4d07f6de12137117e33b20b590ad323f", + "spec_sha256": "4ad806f37703e9ac87000bd3c1c4b2b80925f37aab87bb263243dc62ae4b322c", }, } diff --git a/test_support/microcosm_build/us_spec_bundle.py b/test_support/microcosm_build/us_spec_bundle.py index 083b848871..4923176bab 100644 --- a/test_support/microcosm_build/us_spec_bundle.py +++ b/test_support/microcosm_build/us_spec_bundle.py @@ -199,7 +199,7 @@ def _load_generator_module(): LEGACY_COMPATIBILITY_SHA256 = { "source_stages.json": ( - "7ba871f1493c2cb5c4711f16e58be8e76dabfc9d0c1be0c738614ec695ec94e5" + "4d84cecde75ce9de64998b91d6e99782a50d2f31d4323039dfc0109e60615f60" ), "support_spine.json": ( "68f37dc6ae6e0cde7ebccb53f88dd4a800e63456f838fa214ff98d1db8d815be" diff --git a/tools/build_us_acs_local_release.py b/tools/build_us_acs_local_release.py index 41c1d206c7..c9bbe0cfd2 100644 --- a/tools/build_us_acs_local_release.py +++ b/tools/build_us_acs_local_release.py @@ -6429,7 +6429,9 @@ def do_finalize(args) -> None: key = "population_state" elif name.startswith("pop_cd"): key = "population_cd" - elif name.startswith("usda_snap") and "average_monthly_households" in name: + elif name.startswith("usda_snap") and ( + "average_monthly_households" in name or "average_monthly_persons" in name + ): key = "snap_caseloads" elif name.startswith("usda_snap"): key = "snap_benefits" diff --git a/tools/build_us_target_parity_manifest.py b/tools/build_us_target_parity_manifest.py index d7c200255b..fbcf3660aa 100644 --- a/tools/build_us_target_parity_manifest.py +++ b/tools/build_us_target_parity_manifest.py @@ -210,28 +210,6 @@ def _fence(origin: str, purpose: str, verdict_basis: str) -> dict[str, str]: ), ) -_SNAP_PERSONS_EXCLUSION = ( - "not_modeled", - "USDA FNS SNAP average-monthly PERSONS. A person indicator overcounts FNS " - "participants ~50% (FY2024 persons-per-household 1.88 vs 2.82 simulated " - "members); the household caseload is the calibrated count.", - "INDICATOR_LEDGER_TARGETS average_monthly_households comment + " - "test_snap_person_caseload_fact_is_not_compiled", - _fence( - origin=( - "not a us-data calibration target as a persons row: us-data " - "calibrates SNAP dollars (CBO_PROGRAMS 'snap'), and the household " - "caseload (usda_snap.*_average_monthly_households) is compiled." - ), - purpose="n/a — the household caseload is the model counterpart, not persons.", - verdict_basis=( - "not_modeled: PolicyEngine-US does not model sub-unit SNAP " - "participation, so a person indicator overcounts ~50% vs the compiled " - "household caseload." - ), - ), -) - # (classification, reason, evidence, fence) keyed by exact family id. _JCT_OBBBA_NO_TAX_ANCHOR_EXCLUSION = ( "deferred", @@ -646,8 +624,6 @@ def _fence(origin: str, purpose: str, verdict_basis: str) -> dict[str, str]: ), ), ), - "usda_snap.national_average_monthly_persons": _SNAP_PERSONS_EXCLUSION, - "usda_snap.state_average_monthly_persons": _SNAP_PERSONS_EXCLUSION, } #: Keyed by vintage-free family id, so a repin to the next IRS diff --git a/tools/generate_us_bundle_from_constants.py b/tools/generate_us_bundle_from_constants.py index b3f500a856..b67f71520d 100644 --- a/tools/generate_us_bundle_from_constants.py +++ b/tools/generate_us_bundle_from_constants.py @@ -130,7 +130,7 @@ def _domain_builders() -> dict[str, Callable[[], object]]: # frozen files, is the forward YAML -> legacy-payload path. FROZEN_LEGACY_RESOURCE_SHA256 = { "source_stages.json": ( - "7ba871f1493c2cb5c4711f16e58be8e76dabfc9d0c1be0c738614ec695ec94e5" + "4d84cecde75ce9de64998b91d6e99782a50d2f31d4323039dfc0109e60615f60" ), "support_spine.json": ( "68f37dc6ae6e0cde7ebccb53f88dd4a800e63456f838fa214ff98d1db8d815be" From 2afbd9499dfe7293a4e5f19cd8213ec553988f67 Mon Sep 17 00:00:00 2001 From: David Trimmer <178813244+DTrim99@users.noreply.github.com> Date: Wed, 2 Dec 2026 13:35:11 -0500 Subject: [PATCH 2/2] Restate the parity manifest's family counts in the feed pin test (#1843) Co-Authored-By: Claude Opus 5.5 --- .../tests/engine_free/us/test_us_chronicle_feed.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py index d4fffa147c..dde890a4fe 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py @@ -212,8 +212,9 @@ def test_parity_resources_and_generator_restate_the_pin() -> None: assert feed_families["feed"] == generator.DEFAULT_FEED_NAME assert manifest["reference"]["feed"] == generator.DEFAULT_FEED_NAME assert generator.DEFAULT_FEED_PATH.name == generator.DEFAULT_FEED_NAME - assert manifest["reference"]["compiled_families"] == "32" - assert manifest["reference"]["reviewed_exclusions"] == "64" + # The two FNS persons families compile since microcosm#1843. + assert manifest["reference"]["compiled_families"] == "34" + assert manifest["reference"]["reviewed_exclusions"] == "62" #: The dimension values the pinned feed labels more than one way, as the