Repository navigation
Conversation
The SPM subtracts what parents paid for child care and lists no child care benefit among its noncash resources. PolicyEngine subtracted pre-subsidy expenses and added only the Colorado, Washington and West Virginia subsidies to resources, so a subsidy in the other 48 states lowered SPM resources. Net child_care_subsidies from the expense instead, and take the three states out of spm_unit_benefits and the four reform copies of that list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add YAML cases for the formula's edges and for New York, Texas, Alaska, Washington, West Virginia and Colorado through their real programs, and property tests for the invariants. The whole-model form of "a subsidy never lowers SPM resources" fails where SNAP, TANF and credits fall by more than the expense, so the property holds those fixed and one test pins the intended case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The differential passed on the old code because its identity holds when the expense does not move. It now also requires the fall the Census definition gives, with explicit examples in states that left the subsidy out and states that counted it as a resource. Income comparisons get a tolerance above float32 rounding, which tripped the exact comparison at the fixture's $400,000 of earnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviews by GPT-6.1 Sol and Opus 5.5 found three problems at 343f8fe. - Before 2024 the SPM expense has no formula, so removing the Colorado, Washington and West Virginia subsidies from resources made them reach no SPM path. A 2023 Washington subsidy lowered SPM income. Those three now stay resources until 2024, and years before 2024 match main. - The 2024 program block left out the DC, Tennessee and Texas subsidies, which pay in 2024. All 51 now start at 2024, the first year the SPM expense reads the list, and the test checks every block from then on. - The formula read the pre-subsidy input and ignored a direct out-of-pocket amount. It now reads childcare_expenses, the model's out-of-pocket variable, for a unit with a child. Also add paying-subsidy cases for 2024 and 2025, correct the intended violation's wording, record that datasets fill the pre-subsidy input from reported spending, and route the property tests to the group for retained full systems. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The baseline keeps Colorado, Washington and West Virginia subsidies as resources before 2024, because the SPM expense has no formula then. The four reform copies of spm_unit_benefits dropped them in every year, so each override now restores what main carried: all three in the Texas rebate, Colorado in the Tlaib copies. Qualify the docstring's identity for a direct childcare_expenses input, and correct the integration YAML header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The list test reads list literals only, so it could not see the pre-2024 clause in the four reform copies. A 2024 case in each reform's YAML file now fails if the clause loosens and a subsidy counts as a resource on top of the lower expense. Also qualify the docstring for person-level pre-subsidy inputs and for the Tlaib copies, which carry only Colorado's subsidy before 2024, and note in the integration header that one case sets no care hours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idies # Conflicts: # policyengine_us/tests/policy/baseline/household/income/spm_unit/spm_unit_benefits.yaml
…idies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Datasets fill spm_unit_pre_subsidy_childcare_expenses from the ASEC's SPM_CHILDCAREXPNS, which already holds what parents paid after any subsidy, so netting a modeled subsidy from it counted the subsidy twice. Over a dataset the expense now keeps the reported amount under baseline policy, and a reform moves it by the change in subsidy: min(W + max(E - (S1 - S0), 0), C). Household calculations keep the input as a price and net the subsidy, as before. Add properties for both rules and a differential between them, and a microsimulation test over the shipped population. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…olicy side Main's #9698 now branches a reform's baseline arm again after the constructors move the pre-response inputs. Over a dataset, the SPM expense reads its baseline subsidy from that arm, so pin it there: - Add tests/core/test_reform_baseline_arm_inputs.py. Under a reform that changes nothing, the reform and its arm match a plain run on 102 households of raw columns, two families in every state, and on a situation that names New York only through state_code_str. With _rebuild_baseline_branch disabled, both cases fail. - Keep the parent's raw earnings and hours in the repeal test, which then fails in New York without the rebuild. - Set work expenses and the earnings cap on the policy side only in property 8, with an example that fails if the rule reads either from the arm. - Drop the dead branch_name guard, document the entry points that build no arm, and word the reported-spending reading as an inference from the ASEC question. - Update _baseline_measurement_branch's docstring, which still said the arm keeps the raw inputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docstring still named _rebuild_baseline_arm, which this branch dropped when it merged main. Main's #9698 calls it _rebuild_baseline_branch. Name the moved inputs through PRE_RESPONSE_INPUTS, which also lists sstb_self_employment_income. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_rebuild_baseline_branch cloned the reform simulation and rebound the clone's holders to baseline variables, but it kept each holder the reform had built in another entity or with other ETERNITY storage. Construction, subsample and _baseline_measurement_branch all drop those. Under a reform that stores child_care_subsidies for all time, a New York family with a $500 input got S0 = $500 from the arm, where baseline policy pays it $13,916.40, so its reform expense came out $14,000.00 where the dataset rule gives $27,416.40. - Call _drop_holders_built_for_another_policy before _rebind_holders. - Add test_the_arm_calculates_what_the_reform_stores_for_all_time, and check in every arm test that each holder suits its arm's variable. - Check holder binding before subsampling as well. Under the redefining reform, the arm copied an empty yearly holder for the baseline's ETERNITY is_household_head. - Document that apply_reform builds no arm while a simulation built with reform= keeps its arm, and word the input's after-subsidy reading as the model's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#9503 lists household_child_care_subsidies in every household_state_benefits block in place of the per-state entries. It counts each subsidy up to the family's pre-subsidy bill. The differential test's helper looked only for child_care_subsidies or the state's own variable, so after the merge it returned 0 while household_net_income counted the subsidy, and test_spm_and_household_measures_agree would miss by that amount. - subsidy_counted_by_household_measure now reads whichever child care variable the list names: household_child_care_subsidies, the aggregate, the state's variable or a program that variable adds. It fails if the list names two. - test_no_subsidy_is_a_spm_resource also checks that no SPM benefit list names household_child_care_subsidies. - test_household_measure_counts_each_subsidy_once checks that every household_state_benefits block from 2024 names household_child_care_subsidies once and no other subsidy variable or program. Adding co_ccap_subsidy to the 2026 household block fails the new test, and adding household_child_care_subsidies to spm_unit_benefits fails the SPM check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sol's r7 review found that dropping a holder the reform built with other ETERNITY storage also drops inputs that baseline policy can hold. With a yearly $500 subsidy for 2026 in the dataset both runs read, under a reform that stores child_care_subsidies for all time, the arm calculated $13,916.40 as S0 and the reform's expense came out $27,416.40 instead of $14,000.00. A reform simulation now keeps each input whose variable baseline policy defines in the same entity but with other ETERNITY storage. Every place that drops such holders (the constructor's arm, the rebuilt arm, a subsample's arm and the baseline measurement branch) then sets those inputs again, skipping any the baseline's definition can't hold. subsample carries them over to the sample by person ID, and keeps them when it fails before core rebuilds. Also: #9503's program-list test checked no block on this branch and now checks every block from 2024; invariant 9 states its price condition; the changelog names the replay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record of inputs a reform stores apart from baseline policy now keeps what core stored, drops inputs core deleted or replaced, and reaches a subsample through core's own export, so core samples and reweights them. The behavioural-response measurement branch no longer sets them, as on main, which fixes main's test_baseline_measurement_drops_incompatible_holders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's New York CCAP changes (#10817, #10827) count the Family Assistance grant a family takes up and waive the family share for it. TANF reads employment_income_before_lsr, which a household simulation fills from employment_income but the YAML runner leaves at zero, so the New York cases now give pre-response earnings, as a household run stores them. Colorado's single parent fee (#10721) sets that family's fee at $1,518. The microsimulation test imports the fixture under its Microcosm name (#10687). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Core's apply_reform binds holders through _bind_to_tax_benefit_system, which drops a holder the new definition cannot use, with its recorded inputs. The docstring said apply_reform keeps a simulation's own inputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-session review of 5b05e30 found three ways the baseline arm's record of stored-apart inputs went wrong, each reached only by a constructed harness: - An input core skipped, for a neutralized variable or a period after the variable's end, was kept with the value the holder stored for all time. set_input now keeps an input only when core's count of stored inputs rises. - A write the record didn't see, such as one on the holder itself, came back into play once a later input passed the current-value check. Before keeping an input, the record now checks that its last input under the key is what the holder stores there, and starts the key's record again if not. - Under a yearly reform of a variable baseline policy stores for all time, a holder write under another year was exported after the kept columns, so a subsample's arm ended with it. A variable whose holder holds an input the record doesn't account for is now calculated in the arm, and a subsample drops it from the record it rebuilds. _input_key now uses core's storage period. Four arm tests pin these and the removal of a failed subsample's export. Every case in the integration YAML now gives pre-response earnings, since TANF reads them and the YAML runner leaves them at zero; the asserted outputs don't change. Docstrings now say which callers drop holders, that a flat situation's inputs go through set_input, and why clone copies the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-session review of 3ba8fc7 found that the record keyed an input by the period it was set for. A yearly holder can store one input under several years, or under fewer than the period spans: given 24 months from January 2025 while 2026 already held an input, core stored 2025 alone. The record then held no input under 2025 and marked the variable missed, so the arm calculated a role the plain run reads. Core's count of stored inputs also rose for an input whose years the holder's handler skipped. Core stamps every value it stores with a sequence number. set_input now draws the next number before the input and keeps it under each key stamped since, for its year on a yearly holder and with the period set for on a holder for all time. The value checks between calls stay as they were, since core's apply_reform stores preserved inputs again with new stamps. A write the record misses that stores the very array it kept last still goes unnoticed; the docstrings now say so. The role-order test now covers 12 and 24 months from January, and the holder-write test covers an edit to the stored array in place. The review's dispatch harnesses (one month, two years, 12 and 24 months, a month before 2026, and dataset month columns) now give the arm the plain run's role. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A simulation with no reform has no arm and no "baseline" entry, so subsample makes no copy and must put nothing back when core raises. The test checks that core's ValueError for a call with neither n nor frac reaches the caller and that the simulation still has no arm. Without the restore's arm_copy check, the restore deletes a missing "baseline" key and raises KeyError while handling core's ValueError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Core rebuilds a subsample's arm with get_branch("baseline"), which returns
the simulation itself when that is its own name. A branch named "baseline"
under another branch shares its parent's arm, so its subsample gave it
baseline policy and dropped its arm. subsample now raises before it changes
anything and says to name the branch something else.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Over a dataset, spm_unit_pre_subsidy_childcare_expenses reads as what parents paid after any subsidy; in a household, as the price before it. export_source_inputs and extract_person turn a dataset simulation into a situation, so its reload read the same inputs as a household's, and the Manhattan family's expense fell from $14,000 to $83.60. Both now write "_dataset_inputs": true for a simulation whose inputs came from a dataset. This package's builders strip the key and mark the simulation they build, inside core's __init__ and so before core clones it into a reform's baseline arm. The expense reads one predicate, holds_dataset_inputs; no other reader of is_over_dataset uses it. Snapshots stay at version 1, and one without the key reloads as a household. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Over a dataset, core gives a reform's baseline arm each value the dataset gives. export_source_inputs lists a value given for a formula variable among the overrides, and reload_source_inputs set those on the reform side only, so the reload's arm calculated them and the reform side read S0 from that arm. A marked reload now sets each override on its arm too. Export lists, under _baseline_arm_overrides, what the source's arm held for each override it doesn't share (null for nothing), so a value a caller set on the reform after construction stays off the reload's arm. A marked reload skips a variable baseline policy doesn't define, and refuses one the reform stores in another entity or with other ETERNITY storage, as construction over a dataset does. An unmarked snapshot reloads as before. The dump wrapper writes the dataset mark to __entities__/dataset_inputs.json, and the restore wrapper sets it, so a restored dump of a dataset simulation keeps the dataset rule. A mark other than true or false raises ValueError in the builder, the reload and the restore. The round-trip test now takes its branch before the reload calculates anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reorder the SPM child care expense's documentation so "that arm" follows the arm it names, and say that export_source_inputs marks a snapshot, extract_person a situation and dump_simulation a dump. A simulation restored from a marked dump has no arm, as core's restore_simulation builds none, so the documentation no longer gives it one. The Social Security levers page now says what a marked reload gives a reform's baseline arm and where a dump holds the mark, and the changelog fragment names the snapshot mark and the refusal to subsample a simulation named "baseline". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Social Security component or pure input that a caller sets on a reform after construction reaches both sides of a reload through the snapshot's sources and provenance envelope, so the arm-override list doesn't cover it. Say so, name the `_dataset_inputs` key, limit the refusal to values the arm would get, and state what a reload with `reform=` gives the arm of a snapshot taken without one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Social Security component that a caller sets on a reform after construction gets a null in the arm-override list, yet reaches the reload's arm through the provenance envelope, as a pure input does through the sources. Describe the comparison, the listing and the skip in their own sentences, then the two paths that bypass them, and say when a reload raises on the mark's value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reform rebuilt from an extract_person or sample_person situation of a reform simulation gives its arm the reform side's values, so its arm takes a formula value set on the reform after construction, where a marked snapshot's arm keeps the source arm's value. A restored dump returns an expense it already holds as dumped. Other dataset-only rules read the reload, not the expense, as a household. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comments on _baseline_arm_overrides, export_source_inputs and _set_overrides_on_the_arm now say the snapshot lists each formula override whose recorded input the arm lacks or records differently, with the arm's recorded input or null, and that a pure input or Social Security component set after construction reaches both sides of a reload. Comments and docstrings only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Core's baseline arm is a copy of what the reform side holds at the end of construction. A marked reload with reform= now sets the overrides the arm shares, rebuilds the arm with _rebuild_baseline_branch and then sets what the source's arm held apart, so a neutralized or ended override acts as it does over a dataset. Export lists each value set on the arm alone and the arm's copy of each override changed after construction, compares enums by name and members, and raises for a redefined variable changed on the reform. county reads the dataset mark, and the builders set the mark true or false, so an overwrite replaces it. Tests, docs and changelog follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs page and the changelog fragment now name three rules that still read a marked reload as a household, not four. The unemployment rule keys by person_id, which a marked reload and an extracted situation carry. The county wording now covers a calculated county, an extracted situation and a restored marked dump. A marked reload's equality claims now hold within listed limits, two of them new: a value deleted from the reform side after construction, and the equal-value skip under a reform that moves a variable to another entity. Docstrings and comments in social_security_inputs.py and the arm test file follow the same corrections. The reload's mark comment and the reform snapshot test's docstring no longer say the mark must precede core's construction arm. No executable line changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs page and the arm test file's module docstring now list two more cases among the snapshot limits. Three rules read a marked reload as a household, so their values can differ from the source's and from a dataset simulation's. And a pure input that a caller deletes from a reform simulation's arm alone after construction comes back on the reload's arm, since `sources` reach both sides. Both texts also scope the equal-value case to a variable whose two entities have the same count. The changelog fragment now says when export refuses: the reform redefines a formula variable other than the four Social Security benefits, and a caller then changes the value it held at construction on the reform side. One comment in `tools/social_security_inputs.py` now uses the active voice. This corrects two claims in the message of bea4257. It said the changelog fragment names the three household rules, but the fragment names none of them. It also said the equality claims hold within the listed limits, but no limit list carried these two until this commit. No executable line changes: the Python edits touch one module docstring and one comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changelog fragment and the docs page now say when export refuses a snapshot of a reform simulation whose inputs came from a dataset. Export refuses where a caller set on the reform side a value that differs from the copy the baseline arm kept from construction. It refuses only for a formula variable under the reform, and only where the reform changes its entity, definition period, type, enum, ETERNITY storage, set_input handler or end. A new formula alone doesn't count, and export never refuses on the four Social Security benefits. The docs page adds that export doesn't refuse where the caller also set the variable for that period on the arm itself. This corrects the message of eb6ab79. It said export refuses when "the reform redefines a formula variable", but export compares only the parts of a definition listed above, so a reform that replaces a formula alone gets no refusal. The fragment also said "over a dataset", while export applies the same refusal to any reform simulation whose inputs came from a dataset, a marked reload included. No executable line changes: this commit touches only the docs page and the changelog fragment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs page now says export doesn't refuse where the caller also set the variable on the arm itself, and the arm stores that value for the same period as the reform side's value. Under a reform that makes a monthly input a yearly formula, export still refuses where baseline policy's set_input handler stores a yearly value the caller sets on the arm as twelve months. This corrects the message of 2395a0b. It said export doesn't refuse where the caller also set the variable "for that period on the arm itself". Export skips that value only where the arm stores it for the same period as the reform side's value, so under a reform that makes a monthly input a yearly formula, export can still refuse. The changelog's first refusal sentence now puts "naming the variable" after the variable it names, with the same meaning. No executable line changes: this commit touches only the docs page and the changelog fragment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set snapshot overrides on the simulation the reload builds. Keep the dataset mark and restore main's county rule for marked situations. Cover a marked household county and an unmarked reload's overrides. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Raise when a marked situation builds a baseline arm or overwrites a household simulation that already holds one. Refuse snapshots of reform simulations whose inputs came from a dataset. Cover the refusals and the unmarked cases that still work. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Explain when snapshots, extracted situations and dumps keep the dataset reading of the child care expense. State when construction and export raise. Record the Python bool check for the mark. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Carry the latest county input a branch can read. Check both calculation orders on a household whose FIPS code changes between years. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Makefile keeps the reform benefit test group and adds the child care invariants to the remaining heavy tests. policyengine_us/reforms/congress/tlaib/boost/boost_middle_class_tax_credit.py appends the BOOST credit to the shared benefit list. policyengine_us/reforms/congress/tlaib/economic_dignity_for_all_agenda/edaa_end_child_poverty_act.py appends the EDAA credit to the shared benefit list. policyengine_us/reforms/congress/tlaib/end_child_poverty_act.py appends the ECPA credit to the shared benefit list. policyengine_us/reforms/states/tx/rebate/tx_rebate.py appends the Texas rebate to the shared benefit list. policyengine_us/variables/household/income/spm_unit/spm_unit_benefits.py excludes three child care subsidies from resources once the deduction accounts for them. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
- Test shared reform benefits across the child care deduction start - Account for other benefits in the child care repeal comparison Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DTrim99
left a comment
There was a problem hiding this comment.
Program review
Base repository: PolicyEngine/policyengine-us
PR number: 10569
Reviewed head SHA: cc36311
Merge base SHA: 5f85c22
Mode: full
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10569-review-sources.json
Review status: PARTIAL
Source Documents
- spm_techdoc.pdf — cached original.
- asec2024_ddl.pdf — cached original.
- ecfr_273_9.html — cached original.
- ecfr_273_10.html — cached original.
- itwg_observations_proxy.txt — cached original.
Critical
C1 — Over a dataset from 2024, childcare_expenses gives units with no child their whole reported amount, which raises SNAP (OPEN)
-
Location: the dataset branch of
childcare_expenses.formula_2024,policyengine_us/variables/household/expense/childcare/childcare_expenses.py:35-38(reported_childcare_expenses, lines 5-15). -
Trigger: a dataset (or marked) simulation, 2024 or later, with an SPM unit that has
spm_unit_pre_subsidy_childcare_expenses> 0 and no member under 18.- The household branch and main's formula both sum
pre_subsidy_childcare_expenses, which allocates E only to children, so such a unit gets $0. - The new dataset branch returns
max(E - (S1 - S0), 0)at the SPM unit with no child test. spm_unit_capped_work_childcare_expensesnets units with no child on purpose.childcare_expensesis a different variable, and SNAP, 22 state TANF income and deduction variables, the RI/ND/NC LIHEAP income definitions and the IL AABD child care exemption read it (31 readers in all).
- The household branch and main's formula both sum
-
Executed (
d4_nochild_dataset.py, NY 2026, a 40-year-old earning $12,000 and a 19-year-old dependent, E = $5,000):head, dataset main, dataset head, household childcare_expenses$5,000.00 $0.00 $0.00 snap_dependent_care_deduction(Jan)$416.67 $0.00 $0.00 snap(2026)$3,156 $1,969 $1,969 -
Expected: $0 and $1,969, as on main and in the household path. The SNAP formula's own comment cites 7 CFR 273.9(d)(4), which covers care for a child under 18 or an incapacitated person. Care for incapacitated adults goes through
care_expenses. -
Prevalence (
d5_populace_nochild.py; reads the h5 columns only, no simulation):populace_us_2024.h5(HF snapshot 9a814a3b) has 4,272 records with E > 0. Of these, 229 records (508,829 weighted SPM units, $4.02B of weighted reported E) have no member under 18. The PR's population tables predate this shared rule, and the body calls them unverified at this head. -
Fix: in the dataset branch, return 0 where
add(spm_unit, period, ["is_child"]) == 0, matching the person allocation. Add a dataset test for a unit with no child that assertschildcare_expensesandsnap_dependent_care_deduction. -
Proposed severity: critical. It is an executed wrong SNAP amount in a claimed year (2026) on the default dataset path. The coordinator may weigh that it reaches only dataset runs.
Coordinator assessment: I've kept this critical. It is an executed wrong SNAP amount in a claimed year on the default dataset path: $3,156 against $1,969 for the executed household. It also reaches 31 readers of childcare_expenses (SNAP, 22 state TANF variables, three LIHEAP income definitions and IL AABD). About 509,000 weighted SPM units in the default file have reported child care and no member under 18. 7 CFR 273.9(d)(4), which the policy review read, covers dependent care for a child or an incapacitated person; adult care goes through care_expenses. The household path and main both give $0. The suggested child test in the dataset branch, plus a dataset test, fixes it.
Should Address
A1 — The Tennessee SNAP timing branch still nets tn_ccap when tn_child_care_subsidies is abolished (OPEN)
-
Location:
policyengine_us/variables/gov/usda/snap/income/deductions/snap_dependent_care_deduction.py:33-57. -
Trigger: the branch checks only
gov.abolitions.child_care_subsidiesand list membership, then subtractstn_ccapdirectly. A reform that abolishes or neutralizestn_child_care_subsidieszeroes the annual subsidy (andchildcare_expensesrises to the full bill), buttn_ccapstill pays, so the SNAP deduction keeps netting it. -
Executed (
d3_tn_snap.py, TN 2026, parent $18,000 at 30 hours a week, child aged 3 in full-time care, $12,000 bill):Reform child_care_subsidieschildcare_expensesJan snap_dependent_care_deductionJan snapBaseline $9,938.80 $2,061.20 $171.77 $212 Abolish tn_child_care_subsidies$0 $12,000 $171.77 $211 Abolish tn_ccaporchild_care_subsidies$0 $12,000 $1,000.00 $460 -
Expected: a deduction of $1,000 and SNAP of $460 under the
tn_child_care_subsidiesabolition. The branch understates SNAP by $249 a month, and it disagrees withchildcare_expensesand the SPM expense in the same run. -
Fix: also skip the branch when
tn_child_care_subsidiesis abolished, or scale the nettedtn_ccapby whethertn_child_care_subsidiespays. Add a YAML case. -
Design note: a state-specific branch inside the federal SNAP variable that reads core's private
_get_recorded_input_arrayis fragile. A Tennessee monthly amount exposed through the subsidy variables would avoid both. -
Proposed severity: should-address. It needs a reform to trigger.
A2 — Axiom line uses the external-contributor form for a maintainer's SNAP policy change (OPEN)
- Location: PR body, final lines ("axiom: needed ..."); rule in repository CLAUDE.md lines 152-156.
- Trigger: the PR changes the SNAP dependent care deduction. The Tennessee subsidy is now applied in the month paid in household runs (
snap_dependent_care_deduction.pyformula). From 2024, over datasets, reported payments are no longer netted. - Expected: CLAUDE.md requires
axiom: <legal id> encoded-correct | <rulespec PR> encoded | <rulespec issue> queued | n/a: <reason>.axiom: neededis reserved for "an external contributor [who] cannot complete the Axiom work". Aqueuedissue must be dispatch-ready and labelledpe-parity. - Observed: the author's association is MEMBER (
gh api .../pulls/10569). The line names no rulespec PR or issue, though the body itself says the SNAP timing "needs one". The SPM part could properly ben/a: statistical measure. - Impact: Axiom parity for 7 CFR 273.9(d)(4) / 273.10(d)(2) has no tracking item. I could not search rulespec-us (the repo is not visible to this account), so the existence of a module or issue is unverified. The finding rests on the line's form.
- Proposed severity: SHOULD ADDRESS.
A3 — SPM benefits parameter still lists the three subsidies from 2024; the removal is hardcoded in the formula (OPEN)
- Location:
policyengine_us/variables/household/income/spm_unit/spm_unit_benefits.pylines 16-30 (if period.start.year >= 2024:plus a literal tuple of three names);policyengine_us/parameters/gov/household/spm_unit_benefits.yaml(single0000-01-01value, lines 57/61/69; description "PolicyEngine counts these sources as SPM unit benefits"). - Trigger: any period from 2024. Example: a user or reform that reads the parameter, or edits it to count
co_ccap_subsidy. - Expected: dated policy structure lives in parameters (repo musts: no hardcoded policy values; CLAUDE.md "NEVER use period.start.year ...").
spm_unit_benefitsis the only reader of the parameter (grep), andadd_to_list_parameterextends every dated value. A2024-01-01value without the three would therefore carry the change and keep reforms working. - Observed: from 2024 the parameter still claims the three are counted while the formula silently drops them. A parameter-level edit to restore one is ignored.
- Impact: no wrong output under current law. The parameter misdescribes SPM resources in the app and API, and the gate is invisible to parameter-based reforms.
- Proposed severity: SHOULD ADDRESS (repository standard / transparency). The code reviewer may raise the same point; merge them if so.
Coordinator assessment: The code review flagged the same filter (its code-3). A dated 2024-01-01 value of gov.household.spm_unit_benefits without the three subsidies would carry the change. add_to_list_parameter in the four reforms extends every dated value, so reforms keep working, and the parameter stops describing SPM resources the model no longer counts. It also removes the period.start.year gate that the repository CLAUDE.md rules out.
Suggestions
S1 — PR body describes "four reform copies" of the SPM list that do not exist (OPEN)
- Location: PR body, Fix section ("drops ... from
spm_unit_benefitsand from the four reform copies of that list ... The Tlaib copies hold only Colorado's") and "What this PR does not change" ("The Tlaib reform copies carry only Colorado in those years, as on main"). - Observed: at merge base 5f85c22 and at the head, all four reforms extend the parameter with
add_to_list_parameter(boost_middle_class_tax_credit.py:72,end_child_poverty_act.py:88,edaa_end_child_poverty_act.py:95,tx_rebate.py:51). They hold no copy, and WA and WV are filtered under the reforms too (thetest_reform_benefit_lists.pyexample for WV 2024 uses all three). - Impact: the code and tests behave correctly. The description is stale and could mislead the merge record.
- Proposed severity: SUGGESTION.
S2 — SNAP deduction references drop the statute and omit the billed-month rule (OPEN)
- Location:
snap_dependent_care_deduction.pyreference. - Observed: the PR removes 7 U.S.C. 2014(e)(3), the statutory basis for the deduction. It adds 273.10(d)(3), which is income/expense averaging and supports spreading an annual amount. It does not cite 273.10(d)(2) ("a deduction shall be allowed only in the month the expense is billed or otherwise becomes due"), which is the rule behind applying the subsidy in the month paid.
- Expected: keep the statute and add
https://www.ecfr.gov/current/title-7/section-273.10#p-273.10(d)(2). - Proposed severity: SUGGESTION.
Evidence Gaps
- The population effect at this head is unmeasured. Over a dataset from 2024, baseline
childcare_expenseschanges from max(E − S, 0) to E. So SNAP, the CDCC, state TANF and LIHEAP move wherever the dataset pays a modeled subsidy: in a six-unit dataset run, a NY family's SNAP goes from $303 to $4,353. code-1 adds a further shift. The PR body's poverty and budget tables come from 606699d, before this rule. Microsimulations don't run on this machine, so this needs a CI or Modal run. - One local failure is unidentified. The first, contended Python run printed one failure before its deadline. By position it is the Hypothesis test
test_spm_and_household_measures_agree; a bounded rerun passed and saved no failing example. CI is green at the head. It is either a flaky counterexample or a load artifact.
Notes
- The core change is sound and matches Census:
-
- The SPM subtracts what parents paid for child care, capped with other work expenses at the lowest earner's earnings (SPM Technical Documentation p. 17).
-
- No child care benefit appears among SPM noncash resources (section 4.3.1).
-
- The ITWG recommendation agrees.
-
- So counting a subsidy once, as a lower expense, is right, and dropping CO, WA and WV from SPM resources from 2024 follows the Census definition.
-
- Reading the ASEC child care amount (HCHCARE_VAL, "amount paid ... by household members") as after-subsidy is reasonable. Moving it by S1 − S0 avoids double netting.
-
- On SNAP, both paths deduct only out-of-pocket cost under 7 CFR 273.9(d)(4). Tennessee's month-paid rule follows 273.10(d)(2).
- Executed checks that pass:
-
- Manhattan family. The household and SPM net income now move by the same $8,321.86. The expense is $83.60, and the family leaves SPM poverty.
-
- Dataset repeal runs (NY, CO). The SPM and household changes now agree. On main, the CO repeal raised SPM net income by $4,182.71 while household net income fell by $8,299.29.
-
- Double counting. CO, WA and WV count once.
-
- Recursion. There is no false cycle, because core filters frames by branch name.
-
- Classification. A household
Simulationis never classified as a dataset.
- Classification. A household
- Evaluating S0 adds the arm's
child_care_subsidiestree, not a full baseline. The PR measured +26% forspm_unit_net_incomeover 5,000 households; the review didn't measure it at full scale. - Merges: only 19f31c9 and 513aa0b carry resolution hunks, and no main entry was lost. The PR merges cleanly with current main.
- Not run locally (CI is green on them):
tests/core/test_reform_baseline_arm_inputs.pyand the microsimulation test file. The snapshot, dump and builder machinery was reviewed by reading only.
Validation Summary
Local tests at the reviewed head (review venv, policyengine-core 3.37.2, matching uv.lock; imports resolved to the snapshot), slowed by machine contention: the first YAML run reached its deadline with 149 cases passed and 0 failed; the first Python run had 10 passed and 1 unidentified failure (see gaps). The bounded rerun had 15 Python tests passed, 1 skipped and 0 failed (both invariants passed), plus the SNAP dependent care and reform YAMLs reached, with 0 failures. Diagnostics executed the Manhattan household on main and the head, a six-unit dataset Microsimulation with no-change and repeal reforms, the no-child dataset case, the Tennessee timing case and a column-only prevalence read of the default h5. No microsimulation of the full dataset was run. Sources: the Census SPM Technical Documentation, the ITWG Observations (2010), the 2024 ASEC data dictionary, 7 CFR 273.9 and 273.10, and 23-OCFS-ADM-18; manifest check passed. CI: 37 checks pass and 1 skipped at cc36311.
Timing
setup seconds: 20.00s; scope seconds: 60.00s; parallel review seconds: 997.60s; policy role seconds: 509.50s; code role seconds: 997.60s; adjudication seconds: 200.00s; consolidation cleanup seconds: 77.30s; elapsed seconds: 1702.00s
Review Severity
REQUEST_CHANGES. Open findings: 1 critical, 3 should address, 2 suggestions.
Problem
For a Manhattan parent earning $30,000 with a child in full-time care at $14,000 a year,
ny_ccappays $13,916.40. On main at469ad12cb9(2.90.2), turning that subsidy on raiseshousehold_net_incomeby $8,321.86 and lowersspm_unit_net_incomeby $5,594.54.On main, SPM resources count only the Colorado, Washington and West Virginia subsidies, and the SPM deduction uses pre-subsidy expenses. So in the other 48 states a subsidy cuts SNAP and tax credits, and nothing in the SPM offsets the cut.
Fix
Census subtracts what parents paid for child care (SPM technical documentation, PDF page 17), and its list of noncash benefits (section 4.3.1) has no child care benefit. So from 2024 the model counts a subsidy in the SPM once, as a lower expense.
In a household calculation, the user enters the price of care before any subsidy as
spm_unit_pre_subsidy_childcare_expenses, while both dataset builds fill that input with what parents reported spending. Sospm_unit_capped_work_childcare_expenseshas two rules. In them, W stands for work expenses, C for the earnings cap, E for the input, S1 for the subsidy the simulated policy pays and S0 for the subsidy baseline policy pays.min(W + max(E - S1, 0), C), ormin(W + max(X, 0), C)for a unit with a child givenchildcare_expensesXmin(W + max(E - (S1 - S0), 0), C)with a baseline arm, andmin(W + max(E, 0), C)without oneOver a dataset, the model grosses the reported amount up by the baseline subsidy at run time and then nets the simulated subsidy from the result. Under baseline policy the formula reads no subsidy and keeps
min(W + max(E, 0), C), the amount Census subtracts. In both rules the floor applies before child care can affect work expenses.holds_dataset_inputspicks the rule, andsimulation.baselinesupplies S0, as it does formedicaid_slcsp_state_denominator. The predicate holds over a dataset (simulation.is_over_dataset), in a simulation built from a marked snapshot or situation of one, and in one restored from a marked dump of one.export_source_inputsmarks a snapshot of a dataset simulation with"_dataset_inputs": true, andextract_personmarks a situation extracted from one the same way. This package's builders turn the mark into an attribute on the simulation they build, so later branches keep the dataset rule too. Ata92315ef96the Manhattan family's reload read as a household, and its expense fell from $14,000 to $83.60; now it keeps $14,000. A snapshot without the mark, as main'sexport_source_inputswrites, reloads as a household, and so does one markedfalse. A mark with a value other than a PythonboolraisesValueError. Main'sreload_source_inputsreads only a snapshot's version, period keys, provenance envelope, sources and overrides. So it ignores the mark, and snapshots stay at version 1 (read from main's code, not run). Main's builders would reject the mark in anextract_personsituation, as they reject any unknown key (read from core's code).A simulation built with
reform=from a marked snapshot or situation raisesValueErrorin_rebuild_baseline_branch, so a marked situation or snapshot builds withoutreform=. A builder refuses a replacement if a baseline exists and either set of inputs came from a dataset. Dataset reforms, their branches and their samples refuseexport_source_inputsanddump_simulation. A dataset simulation without a baseline arm can be dumped and restored with the reported-payment reading. The baseline arm can be exported or dumped by itself. Core restores one arm. Dataset construction and builders still allowMicrosimulation(reform=...)to build and gross up the expense. Unmarked snapshots and situations still takereform=as on main. Main creates snapshots and extracted situations without the mark, so both build underreform=and return household numbers. #11284 tracks paired serialization.childcare_expenses, the model's out-of-pocket variable, for a unit with a child. That variable allocates expenses to children, so for a unit with no child the formula netschild_care_subsidiesfrom the unit's own input. A caller can give a unit with a child its out-of-pocket amount aschildcare_expenses, which then replacesmax(E - S1, 0). Main reads only E, so for a unit with a child given only $6,000 ofchildcare_expenses, the expense moves from $0 on main to $6,000. A unit with no child ignores that input. Members'pre_subsidy_childcare_expenses, given directly, also replace E for a unit with a child, sincechildcare_expensessums them. Once a caller gives one member's amount, every member holds an input, so a child given none counts zero rather than a share of E. For example, with E of $10,000, $6,000 given for one child, no subsidy, W of $1,000 and C of $20,000, the expense moves from $11,000 on main to $7,000, whether the unit has one child or two. YAML cases pin each of these.co_ccap_subsidy,wa_child_care_subsidiesandwv_child_care_subsidiesfromspm_unit_benefitsand from the four reform copies of that list. The expense has no formula before 2024, so SPM resources keep those subsidies in those years wherever main counts them, and every year before 2024 matches main. The Tlaib copies hold only Colorado's. A YAML case in each reform's file pins 2023 and 2024.child_care_subsidieslist holds all 51 state programs. The DC, Tennessee and Texas programs pay in 2024, but main's list leaves them out until 2025. From 2024, over a dataset, the sharedchildcare_expenseskeeps reported payments under baseline policy and moves them by the subsidy change under a reform. SNAP, HUD and the other readers of this variable use that amount. Household calculations still start from gross bills, so adding the three programs lowerschildcare_expensesin those states in 2024. For Tennessee households with level bills, SNAP applies the modeled subsidy in the month it pays. A supplied annual out-of-pocket amount is divided over the year. The historical formula applies before 2024. Over Populace 2024 the three programs pay nothing, so the default file's 2024 results don't move.latest_readable_countycarries a stored county to other years from inputs only. Main could also carry a county calculated for another year, so the arm's first read could change a reform's expense. At2642c26b34, reading 2025 first gave a $24,290 expense in Cook County, and with no prior read it gave $22,778 in Adams County. On Linux ata094fe5930, both orders give Adams County, an $8,778 subsidy and a $22,778 expense.At
1b9dec8316, the Manhattan family's expense falls from $14,000 to $83.60, its SPM net income rises by $8,321.86, as its household net income does, and it leaves SPM poverty.Over a dataset, a unit reporting $14,000 keeps a $14,000 expense under baseline policy. Repealing New York's subsidy raises that expense to $27,916.40 and lowers SPM net income by the same $8,321.86.
test_repeal_moves_dataset_and_household_income_by_the_same_amountpins this in New York and Texas.Adding subsidies to resources instead would depart from the Census definition and fail in two places. It would add income at the earnings cap, where the expense doesn't fall. It would also overcount wherever a program pays more than the family spends. Vermont pays its state rate regardless of the provider's charge, and in the audit it paid $22,828 against a $1,200 bill.
Why the dataset needs its own rule
Both dataset builds fill the input from the ASEC's reported spending,
SPM_CHILDCAREXPNS: Populace inmicrocosm/build/us_runtime/childcare.pyandpolicyengine-us-dataindatasets/cps/cps.py. The ASEC asks parents how much they spent on child care, and Census subtracts that amount as it stands. This rule reads the amount as what parents paid after any subsidy, so netting a modeled subsidy from it would count the subsidy twice. Over the default file in 2026, netting cut the SPM expense by $1.135B at606699d640, and by $7.280B with schedules set at640753a617. So the builds keep the reported amount, and the model moves it only by the change in subsidy a reform makes.The baseline arm
The dataset rule reads S0 from the reform's baseline arm. Core builds that arm inside its
__init__.Simulation.__init__andMicrosimulation.__init__then moveemployment_income,self_employment_income,sstb_self_employment_income,weekly_hours_workedandlong_term_capital_gainsto their pre-response variables, and fillstate_codefromstate_code_str. Atd4d391788d, the arm kept the raw inputs and read 0 from the pre-response variables. In a household situation it paid the Manhattan family $3,498 in New York TANF and no child care subsidy, where a plain run paid no TANF and a $13,916.40 subsidy. Over a dataset that stores raw hours, aspolicyengine-us-data's CPS build does (cps.py:481), the dataset rule would have carried that gap into the SPM.#9698, which this branch merges from main, branches the arm again after the moves (
_rebuild_baseline_branch). That rebuild bound the copied holders to baseline variables but kept each holder the reform had built in another entity or with otherETERNITYstorage. The SPM mixin's constructor,subsampleand_baseline_measurement_branchall drop such holders. Under a reform that storeschild_care_subsidiesfor all time, the arm read a New York family's $500 input for all time as S0, where baseline policy pays the family $13,916.40. The family's reform expense came out $14,000.00, where the rule gives $27,416.40. This PR makes the rebuild drop those holders too. A dropped holder takes its inputs with it, though, so dropping alone would have the arm calculate S0 in place of a subsidy the caller gave, even a yearly one that baseline policy can hold.So where the rebuild would drop a holder that holds an input the caller gave, it raises
ValueErrornaming the variable (_refuse_inputs_baseline_policy_drops). Under the reform that storeschild_care_subsidiesfor all time, a $500 subsidy given for all time or for 2026, through a dataset or a situation, raises. The guard has three limits:system.py:561) at its end. At the constructor's own drop site, core has already dropped the holder and its record of the input.The behavioural-response measurement branch drops the same holders and calculates those variables without the guard, as on main. Main's
test_baseline_measurement_drops_incompatible_holderssets such an input after construction and expects the branch to calculate the variable assimulation.baselinedoes. The branch has no baseline of its own, so its SPM expense keeps E and reads no subsidy.The household rule reads no S0, so the arm doesn't move a household calculation's SPM expense. No reform in
policyengine_us/reformsredefines a variable in another entity or with other all-time storage, so none reaches the drop or the guard, and a static test below keeps it so.Subsampling gives both arms the same household selection and replays each arm's recorded inputs under its own policy. When a branch samples, it gets an arm on its own sample and the parent retains its arm. A failed rebuild restores both populations and the branch state. An existing simulation named
"baseline"with an arm still refuses sampling.Tests and a docstring that #10975 added on main assumed a subsampled branch keeps its parent's unsampled baseline and matched people by ID. An input supplied only to one arm continues to affect the comparison after sampling. This includes a $1,000 FICA contribution set only on the reform: its $71.06 payroll adjustment, $1,000 × 0.0765 ÷ 1.0765, stays after sampling. For explicitly mismatched payroll populations, the person-ID fallback remains available. This PR updates #10975's variable documentation to match.
This PR also adds
tests/core/test_reform_baseline_arm_inputs.py, which pins the rebuilt arm on the dataset path this rule reads, and updates the docstring of_baseline_measurement_branch, which still said the arm keeps the raw inputs.Invariants
I test these with Hypothesis in
policyengine_us/tests/test_spm_child_care_subsidy_invariants.py.For a household calculation:
childcare_expensesand its members' pre-subsidy expenses to their formulas, the model's expense equals the formula above, written from the documentation rather than from the code. YAML cases pin achildcare_expensesinput X, which replacesmax(E - S1, 0)withmax(X, 0)for a unit with a child and which a unit with no child ignores.0 <= expense(0) - expense(S) <= S, and a larger subsidy never raises the expense.spm_unit_benefitsunchanged and raisesspm_unit_net_incomeby the fall in the expense, so the SPM counts it once.childcare_expensesand its members' pre-subsidy expenses to their formulas. A unit with a child given onlychildcare_expensesX getsmin(W + max(X, 0), C), where main reads no X and givesmin(W, C).*_child_care_subsidiesvariable, and no program one of them adds, appears inspm_unit_benefitsor a reform's copy of it, and all 51 appear in every program block. Everyhousehold_state_benefitsblock from 2024 counts them only throughhousehold_child_care_subsidies, which Count all child care subsidies in household benefits #9503 added.household_child_care_subsidiescounts in the household measure, plus the fall in the expense.Over a dataset:
min(W + max(E, 0), C), whatever subsidy the model pays, in a plain simulation and in a reform's baseline arm.In
tests/microsimulation/test_spm_child_care_reported_expense.py,Microsimulationloads the shipped population, so the dataset flag and the baseline arm come from the path a user's run takes. One test checks property 7 on every record of the default dataset. The other runs a real reform on a 500-household slice that holds units with both a modeled subsidy and reported spending. It checks that the baseline arm matches a plain run and that the reform arm follows the rule.tests/core/test_reform_baseline_arm_inputs.pychecks the arm itself. Under a reform that changes nothing, the reform and its baseline arm compute what a simulation with no reform computes, on four pre-response variables and seven outputs from the subsidy to household net income. It runs a dataset of raw columns with two families in every state, and a situation that names New York only throughstate_code_str. It also checks that the arm owns its policy and holds no value the reform's policy produced, and that every holder in either arm suits that arm's definition of its variable. Its other tests:child_care_subsidiesfor all time, a $500 subsidy for all time or for 2026, from a dataset or in a situation, raisesValueErrornaming the variable from_rebuild_baseline_branch.sstb_self_employment_incomewhile it moves that input, even where the caller gave none. Under a reform that stores the variable for all time, the reform then holds an empty holder for all time, which the guard leaves alone, and the arm holds none."baseline". The branch's subsample still gets S0 of $6,000 and an expense of $12,000, as a subsample of the reform itself does. A subsample given neithernnorfracraises and leaves each branch as it found it, and a retry gets the same S0 and expense.get_branch("baseline")on a branch, a clone of it, a deeper branch of that name and a reform simulation renamed"baseline"each raise when they subsample. Each keeps its policy, arm, branches and name, and the first still reads S1 of $0 and an expense of $27,916.40.extract_personkeeps the same expense. A snapshot without the mark reads $83.60 and $0. A snapshot or situation markedfalsereads $83.60 for the first family. A mark of"true"or1raises. Under the repeal, an unmarked reload keeps $40,000 of countable income and $2,000 of work expenses for the first family. Its arm calculates $30,000 and $19,200 of countable income and $0 of work expenses for both families.reform=. Over a dataset the repeal gives the two families $27,916.40 and $12,000 of expenses. The source and its branch refuse export. The source's arm pays $13,916.40 and $6,000 in subsidies; it exports, and its reload keeps the $14,000 and $6,000 expenses. A marked situation cannot overwrite an existing household simulation with an arm; an unmarked one can. An unmarked reform situation exports and reloads unmarked, with an arm and the source's reform-side expense.build_from_dictcan overwrite a simulation. A marked simulation overwritten with a situation markedfalse, or with no mark, reads $5,222 as a household, and an unmarked one overwritten with a marked situation reads $14,000. A dataset that gives Cook FIPS for 2025 and Adams FIPS for 2026 gives the same 2026 expense and subsidy in both calculation orders after the fix.dump_simulationbefore any calculation, restores with the reported expense, $14,000 and $6,000, and the $1,200 Social Security benefit its source reads. With the mark file removed, it restores as a household, at $83.60 and $0, and with1in it the restore raises. A household simulation's dump holds no mark.The integration and capped-expense YAML cases cover reported care in DC, Tennessee and Texas, Tennessee's January and October SNAP deductions, and both negative-input floors.
tests/core/test_shipped_reforms_store_no_variable_apart.pyreads the source of every reform inpolicyengine_us/reformswithout importing it. It fails on a reform that redefines a variable in another entity or with other all-time storage. It also fails on one that passesupdate_variable,add_variableorreplace_variableanything but a class defined in its own file or a loop over such classes. It reads an attribute that a class body sets by plain assignment or by annotated assignment with a value. It doesn't read one set through a tuple target, an augmented assignment, a nested block, a later assignment on the class or a base other thanVariableor a baseline variable. A second test checks that the scan flags the reforms that the arm tests andtests/core/test_spm_system.pybuild to store a variable apart, and a third that it flagsdefinition_period: str = ETERNITY.test_subsampling_never_changes_which_policy_a_holder_belongs_tointests/core/test_spm_system.pynow checks every holder before it subsamples as well.The five new invariant cases and the slice test all fail against the formula that nets the subsidy from a reported payment (
513aa0bb66). At5a6557a92a, with_rebuild_baseline_branchdisabled, all three arm tests then in the file and the New York repeal case failed. A no-change reform then got the expense wrong for 32 of the arm test's 102 households, by up to $13,916.40.At
1b9dec8316, I made each change below in turn and ran the tests named. Each fails at least one:"baseline"entry fails the test of a branch named"baseline", whose new arm then repeals the subsidy as the reform does."baseline".test_baseline_measurement_drops_incompatible_holders, which then raise onis_household_head.system.py:562), with the constructor's own drop in place, fails the rebuild's-drop test. The guard's-limit test andtest_subsampling_never_changes_which_policy_a_holder_belongs_tostill pass without it.test_subsampling_never_changes_which_policy_a_holder_belongs_to, which then raises on the reform's ownis_household_head.test_policy_over_a_dataset_moves_the_expense_by_the_subsidy_changeon an explicit example.childcare_expensescases and the two that give a member's pre-subsidy amount.test_the_scan_reads_an_annotated_assignment, which then misses a reform that storeschild_care_subsidiesfor all time that way.a92315ef96adds documentation text and one test to1b9dec8316. At it, I reran the arm test file, #10975's tests and YAML cases and the documentation checks, all of which pass. Removing the restore's check that it made a copy there fails the new test, whose subsample, with no arm, then raisesKeyErrorin place of core'sValueError.On top of
f396fd159a,fb52cd26a9removes the marked reload's arm rebuild and export's arm map, and restores main's county rule.e279007dcfadds the construction, builder overwrite and export refusals.2642c26b34updates the docs, changelog and arm test docstring.a094fe5930carries counties across years from dataset inputs only.f396fd159a, and2395a0b6aa,eb6ab79b76andbea42576febelow it, change text only: the docs page, the changelog fragment, and docstrings and comments intools/social_security_inputs.pyandtests/core/test_reform_baseline_arm_inputs.py.f396fd159achanges only the docs page and the changelog fragment. The docs page now says when a value the caller also set on the arm stops export's refusal, and the changelog's first refusal sentence names the variable last.2395a0b6aachanges only the docs page and the changelog fragment, which now list the changes to a variable's definition that make export refuse a snapshot.eb6ab79b76adds two snapshot limits and the same-count condition to the docs page and the arm test file's module docstring. It also rewrites the changelog's refusal sentence and puts one comment in the active voice. A comparison of both Python files' syntax trees, docstrings removed, found them equal to31766a0aa5's, so none of the four commits changed an executable line (run atf396fd159a, as at2395a0b6aa,eb6ab79b76andbea42576fe). Ruff and the documentation checks pass there too. Below them,31766a0aa5has a marked reload rebuild its arm as construction does, hascountyread the mark, and has the builders set the mark either way. Below that,d367d8c1bachanges only comments and docstrings intools/social_security_inputs.py, and the three commits below that,688fc8d7af,d10cddb410andcf7a43e027, change only the docs page's paragraph on snapshots.a7c00425d3updates the docs, the changelog and the capped-expense variable's documentation, and202b79eb80below it gives a marked reload's arm the snapshot's overrides, marks dumps and checks the mark's value.e9fc366e76added the subsample refusal toa92315ef96, and439c863eeathe snapshot mark.On Linux at
a094fe5930, the arm, Social Security inputs, real-core and state-machine files pass. So do the marital-unit snapshot test, Social Security history, four county Python files and both county YAML files. The integration and capped-expense YAML, reach scan, documentation checks, SPM consumer check, payroll, SPM system, invariant and derived-system tests also pass. I ran the whole arm test file for each mutation below except the county input-period mutation. For that mutation I ran the order test and three county files. Each mutation fails at least the test named:countyread the mark fails the marked household county test, whose reload reads Cook County. 26 passed, 1 failed.test_dataset_arms_match_a_simulation_with_no_reformwhen the dataset reform builds. 16 passed, 11 failed.test_a_dataset_snapshot_reloads_with_the_dataset_readingwhen its marked no-reform reload builds. 22 passed, 5 failed.At
31766a0aa5, these mutation checks also ran:truefails the builder overwrite test: a marked simulation overwritten with an unmarked situation stays marked."true"without raising, and the dump test, which accepts1.is_over_datasetalone in the formula fails it at the same branch.extract_person, fails theextract_persontest at $83.60."baseline"fails its test, whose subsample then doesn't raise.Dropping Texas from the 2024 program block, or every block from 2024 on, fails
test_latest_blocks_list_every_state_program. Listingco_ccap_subsidybesidehousehold_child_care_subsidiesin the 2026 household block fails the household list test, and listinghousehold_child_care_subsidiesinspm_unit_benefitsfails the SPM resource test.Intended violation
A subsidy can lower SPM resources at the whole-model level. SNAP, TANF and tax credits read out-of-pocket expenses, so a subsidy can cut them by more than the SPM expense falls. At the earnings cap the expense can't fall at all, and below the cap a benefit cliff can cut more than the expense falls. Household income loses the same benefits but also counts the subsidy, so it can rise while SPM income falls. SPM net income fell in 22 of the 1,395 subsidized cells in the grid below, and
test_subsidy_at_the_cap_can_lower_spm_incomepins one case.Audit of all 51 subsidies
I ran these audits on household calculations at
606699d640against main at469ad12cb9, and this head keeps that commit's household rule. Main has since changed the Vermont, New Hampshire, Nevada, Texas, New York and Colorado subsidies (#10584, #10575, #10598, #10622, #10623, #10636, #10817, #10821, #10827, #10721), so those states' counts can differ at the merged head.child_care_subsidiesleft out paying state programs in DC, Tennessee and Texas in 2024, and in DC, North Carolina, Oregon and Texas in 2021 to 2023. From 2024 they agree. This PR leaves 2021 to 2023 unchanged, because the SPM expense formula starts in 2024.meets_ccdf_activity_testset. Every state pays somewhere on the grid, and the identity in invariant 6 holds in every cell.meets_ccdf_activity_test, TANF enrollment, homelessness and protective care, and the family had none of them set. Stop requiring an activity input from Nevada's working parents #10575 has since stopped requiring the activity input from working parents.employment_income_before_lsr, which a household simulation fills fromemployment_incomebut the YAML runner leaves at zero. With a bareemployment_income, Family Assistance saw no earnings, paid the Manhattan family $3,498 and waived its $83.60 family share. So every case in this PR's integration YAML now gives pre-response earnings, as a household run stores them, and the New York subsidy stays $13,916.40. With bare earnings, the Alaska, Washington, West Virginia and Tennessee cases also paid TANF grants that a household run doesn't, though their asserted outputs matched. Since Charge Colorado families one child care parent fee under section 3.124 #10721, the Colorado case's single parent pays a $1,518 fee, and the model pays a $12,482 subsidy.household_state_benefitslisted 23 of the 51 subsidies. Since Count all child care subsidies in household benefits #9503, the list counts all 51 throughhousehold_child_care_subsidies, up to the family's pre-subsidy bill for child care and after-school care.Population impact
I computed these tables from saved full-file arrays for 2026 (
populace_us_2024.h5@populace-us-2024-spm-20260909): main at469ad12cb9, and this PR's taxes and benefits at606699d640. The population and schedule tables report runs at the commits named with each table, and they describe those revisions. The shared reported-payment rule can now change programs that readchildcare_expenses, including when the annual subsidy program lists agree. The branch was checked only with fabricated households, so these tables remain unverified at it.All of the change comes from the three subsidies leaving resources. Main adds modeled Colorado and Washington subsidies ($270.7M and $255.9M) on top of what those families reported paying, and this PR stops that. In these runs, the two program lists match from 2025, so
child_care_subsidies,childcare_expensesand SNAP equal main's on every record in 2026, with or without schedules. The deduction differs from main on 0 records, and SPM net income differs on 35. Five records (116,936 people, 64,207 children) enter poverty and none leave. Washington's rate moves from 12.00% to 13.44% on 4 records, and no other state's rate moves by 0.01 point.With schedules set
The default dataset has no schedule columns, so most programs pay nothing. As a sensitivity, I gave every child under 13 in a unit with child care expenses a full-time schedule on both sides: 8 hours a day, 5 days a week, 21 days a month. I ran main at
469ad12cb9and this PR's taxes and benefits at640753a617.child_care_subsidiesFive records (126,465 people) enter poverty and none leave. Washington moves as above, and West Virginia's rate moves from 14.03% to 14.56% on 1 record.
Costs and limits of this rule
childcare_expenseskeeps its historical formula, which subtracts a modeled subsidy from a reported payment. So over a dataset, SNAP and the other readers of that variable can subtract aid already excluded from the family's reported cost. This path predates this PR.household_child_care_subsidies(Count all child care subsidies in household benefits #9503) caps the subsidy household net income counts at the family's bill: its members'pre_subsidy_childcare_expensesplus after-school expenses. By default that person-level variable spreads E evenly across the unit's children, so the bill holds all of E for a unit with a child and none of it for a unit without one. Over a dataset, where E holds the reported amount, household net income counts the subsidy only up to that bill, or in full where the bill comes to zero.spm_unit_net_incometook 29.6 s in a plain run and 37.4 s in the reform arm of a no-change reform.social_security_retirementfor all time, a dataset that gives the component raises at construction, naming it.tools/social_security_inputs.pyrecords such an input on a source branch of its own, and the guard matches that record by name.Microsimulation(dataset=..., reform=..., tax_benefit_system=...)loads the dataset under the system given, then applies the reform.apply_reformdrops the holder of a variable the reform stores apart, with its record of the input, before construction rebuilds the arm. So under a reform that stores the subsidy for all time, nothing raises, and the reform and its arm both calculate the subsidy, where a plain run reads the dataset's subsidies.set_inputon a reform simulation reaches only that arm. A caller who sets schedule columns on a reform simulation has to set them onsimulation.baselinetoo, or the model computes S0 without them.reform=, andapply_reformbuilds none. A simulation built withreform=keeps its arm, under baseline policy, through any reform applied later.Microsimulation(tax_benefit_system=...)withoutreform=, orapply_reformon a simulation built withoutreform=, leaves no arm, so the expense keeps E, and subsidy changes don't move it. Inpolicyengine_us, only tests call the first form."baseline"with an arm still refuses sampling. ItssubsampleraisesValueErrorbefore it changes anything, and the message says to name the branch something else, such asget_branch("trial"). Such a simulation comes fromget_branch("baseline")on a branch, from a clone of one, or from a rename by hand.reform=, and later branches keep it. Construction withreform=raises, and a builder refuses a replacement if a baseline exists and either set of inputs came from a dataset. Dataset reforms, their branches and their samples refuseexport_source_inputsanddump_simulation. As on main,county,medicaid_slcsp_state_denominator,in_alaand the local sales tax's county carryover read a reload as a household.is_receiving_unemployment_compensationuses the dataset reading when a reload or extraction carriesperson_idas an input.sample_personcallsextract_person, so its situation carries the mark (a probe ran this atd10cddb410). A reload has no dataset, and core'ssubsamplereads the dataset's time period, and its name when the caller gives no seed. So a reload can subsample only where a caller attaches a dataset by hand. Even then, core'ssubsampleraises aTypeErroron the reload's string person ids, marked or not (probes ran both atd10cddb410). Core restores one arm. A dataset simulation without a baseline arm can be dumped and restored with the reported-payment reading, and the baseline arm can be exported or dumped by itself. Two copies carry no mark and so read as a household: aSimulation(populations=...)built from another simulation's populations, and a situation built by hand from a snapshot'ssources(both read from code, not run). Atdd82d0e596(2026-10-11), policyengine.py calls none ofextract_person,sample_person,export_source_inputs,reload_source_inputs,dump_simulationandrestore_simulation. Its US household path builds its own situation from the six entity groups, so it never meets the mark (read, not run, from that revision). The dump and restore hooks access the mark through holders. A marked simulation without holders can lose the mark, and a simulation that reuses another's populations can pick up the source holders' mark. The dump-mark limit and removed arm paths are tracked in #11284.test_county_branch_reuse.py:85–89).policyengine-us-data's CPS build also storesspm_unit_capped_work_childcare_expensesitself, fromSPM_CAPWKCCXPNS(cps.py:786), and the model accepts it as an input. Over that file neither rule runs in the stored year, as on main.scripts/microsim.pyraises this input to an assumed price over a dataset, but it reads subsidies and not the SPM, so this rule doesn't reach it.Migration
For paired results, rebuild from the source dataset with
reform=. For baseline-only results, export or dumpsimulation.baseline, or build the source dataset without a reform. Replace a marked situation by building a fresh simulation withoutreform=. Rebuild both arms from the source dataset where a workflow on main dumped or overwrote a dataset reform.Test cost
test_spm_child_care_subsidy_invariants.pystays inREST_REMAINING_HEAVY_TESTS, and it retains one reformed system and builds two more for the real-reform cases. Its tests ran for 206 s in CI at6946cd74a4. On Linux ata094fe5930, its 12 tests took 184 s.test_spm_child_care_reported_expense.pyadds two tests: one reads only the expense and its inputs from aMicrosimulation()over the whole file, and the other runs on a slice. The earlier CI figures were 7 s and 31 s. The PR's record gives no SHA for those two timings. These runtimes describe their measured revisions. On Linux at the branch, 1,309 cases in 114 related YAML files pass, and 1,318 pass on a merge with main. At the branch, the 32 arm tests took 505 s, the 47 payroll tests 297 s and the 77 SPM system tests 346 s. Ata094fe5930, the 3 reach scan tests took 29 s. Peak memory for these Linux runs is unmeasured.tests/core/test_behavioral_response_measurement_copies.pyneeds more than 6 GiB alone, the local limit, so only CI runs it whole. At31766a0aa5, main'stest_baseline_measurement_drops_incompatible_holderspasses its 2 cases in 7.9 s on a Mac. Linux runs used policyengine-core 3.37.2; those at31766a0aa5used 3.37.1 on a Mac.What this PR does not change
_select_subsample_sourcesintools/social_security_inputs.py, can still raiseKeyErrorafter person IDs are replaced. A failed rebuild restores the pre-call simulation. A regression test forces an error after core replaces the populations and checks that a retry succeeds.axiom: needed
The SPM part needs no encoding: Census publishes the SPM as a statistical measure, and rulespec-us encodes no SPM provision. The SNAP timing this PR adds needs one: the RuleSpec module references 7 CFR 273.10(d), but its companion cases supply zero dependent care expenses.
🤖 Generated with Claude Code