Require policyengine-core 3.32.8 and test uprated inputs supplied only before 2015 - #9650
Conversation
e97d4fc to
ae49ff2
Compare
policyengine-core divided by a missing uprating-index value whenever a later year read an uprated input supplied only for a year before 2015, raising TypeError. policyengine-core 3.32.8 (PolicyEngine/policyengine-core#551) holds the index flat where it has no value. Require it, and cover every affected variable (312, grouped by where each is defined) with a differential check against the same input supplied for 2015, plus the reported household. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ae49ff2 to
dfca154
Compare
|
Merge audit (2026-09-28 open-PR sweep): |
|
Admin-merging: the only block is the required approving review, which Max cannot give on his own PR. |
Problem
An uprated input supplied only for a year before
FIRST_MODELED_YEAR(2015) fails as soon as a later year reads it.CountryTaxBenefitSystembackdates parameters only to 2015-01-01, so the uprating index has no value at, say, 2013-01-01. policyengine-core then computedindex(2015) / None:#9626 flagged this as a separate, pre-existing follow-up.
Fix
The fix is in core: PolicyEngine/policyengine-core#551, released in policyengine-core 3.32.8. Where an uprating index has no value, uprating now holds it flat, so an input supplied for 2013 carries over unchanged to 2015 and is uprated from there. That matches how
backdate_parametersalready extends each parameter's earliest value back to 2015. The same core PR also fixes base-period selection when a later known period was stored first. This PR adds the policyengine-us regression tests and requires that release.Affected variables
312 of the 365 variables that have
upratingat runtime. All are inputs, and each uses an index that starts at the 2015 floor:add_default_upratingcovers implicitly; the rest are declared or listed inINPUT_VARIABLES.The other 53 use CPI-U, which starts in 1913, and are unaffected. A grep for
uprating =inpolicyengine_us/variablesfinds only 146 files. It misses the 219 variables that get uprating fromadd_default_uprating, and it shows the pre-rewrite path for the 72 thatadd_per_capita_upratingrepoints to a_per_capitaseries. The test builds the list from the loaded system, not from grep.Tests
policyengine_us/tests/core/test_pre_first_modeled_year_uprated_inputs.py(new):in_nyc, and unconditional, for 38 groups. Each group's household has its state (andin_nyc) set for every year the test reads. Geography has formulas, so it isn't carried forward. For each, an input supplied only for 2013 (or 2014-12 for the 4 monthly variables):income_taxandhousehold_net_incomefor 2015 match the same household with the interest supplied for 2015.Against core 3.32.7's
simulation.py, 39 of 40 cases fail with the reportedTypeError; only the affected-set check, which runs no simulation, passes. With 3.32.8, 40 of 40 pass.Dependency
This PR raises the floor to
policyengine-core>=3.32.8, the release containing PolicyEngine/policyengine-core#551.uv.lockwas relocked with uv 0.12.13, the version CI pins, and only the policyengine-core entry changes. With uv 0.12.13,release_lock.py --committedand--rehearseboth pass locally.Core 3.30.2 → 3.32.8 also picks up the 3.31.x–3.32.7 releases. pe-us PR CI already tests against the newest core, since it runs
uv lock --upgrade-package policyengine-corebefore its test jobs, so recent PRs have been tested on those releases.Before core merged, an earlier revision of this PR pinned core to the #551 commit, and the full suite passed against it: every baseline, contrib, microsimulation, partner and rest job.
Review
An independent Opus 5.5 review (Subfleet, code reading only) requested changes. I checked each finding by running it, then fixed it:
state_codefor 2020 fell back to CA, so the comparison looked at masked zeros for every non-CA state group. It now sets geography for both years and asserts the 2020 value is nonzero. With the old setup, the guard fails 36 groups: every non-CA state plusin_nyc.axiom: n/a: engine fix to variable uprating in policyengine-core plus regression tests; no policy rule changes
🤖 Generated with Claude Code