Skip to content

Bump policyengine-core floor to 3.24.4 (closes #8066)#8069

Closed
MaxGhenis wants to merge 1 commit intoPolicyEngine:mainfrom
MaxGhenis:bump-core-floor-3.24.4
Closed

Bump policyengine-core floor to 3.24.4 (closes #8066)#8069
MaxGhenis wants to merge 1 commit intoPolicyEngine:mainfrom
MaxGhenis:bump-core-floor-3.24.4

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

Bump policyengine-core floor to 3.24.4 and drop the temporary Python-version restriction on uv.lock. Closes #8066.

Why

policyengine-core 3.24.0 added a strict validator that errors on breakdown / parameter-children mismatches — the exact class of bug that hit Martin Holmer on us 1.644.0 and 1.645.0 (issue #8055) and that three partial-fix PRs had to chase: #8045, #8049, #8051.

But bumping the core floor used to be blocked by three coupled regressions inside core 3.24.0–3.24.3:

  1. Simulation.apply_reform wiped user-provided dataset inputs (the H3 cache invalidation hit _memory_storage._arrays for user inputs as well as formula-output caches).
  2. Holder.get_array fell back only to default, missing the parent-branch walk needed by country-package nested branches (e.g. no_salt under itemizing).
  3. GroupPopulation.clone passed the source population (not the clone) to holder.clone, so group-entity holders on cloned branches pointed at the wrong simulation.

Together these caused the tax_unit_itemizes.yaml integration test to crash with TypeError: int() argument ... not 'NoneType' (state_fips wiped) plus an infinite recursion in tax_liability_if_itemizing.

PolicyEngine/policyengine-core#475 fixed all three, shipped in core 3.24.4 (latest at time of writing: 3.25.0).

Effect

  • test_system_import.py (added in Add regression test for parameter breakdown mismatch (closes #8055) #8058) now actually does work: constructing CountryTaxBenefitSystem() runs the strict validator, so any future breakdown/children mismatch fails CI rather than reaching end users at import time.
  • PyPI installs no longer silently pull a core version with the partial-fix regressions in 3.24.0–3.24.3.
  • The [tool.uv] environments = ["python_version >= '3.11'"] restriction can be removed — core 3.24+ supports 3.9 and 3.10 on PyPI.

Verified locally

  • 794/794 tests pass under policyengine_us/tests/policy/baseline/gov/irs/ with core 3.25.0.
  • tax_unit_itemizes.yaml 7/7 pass (was 2 failing on core 3.24.1).
  • test_system_import.py passes as expected.

Test plan

  • IRS test suite: 794 passed
  • Full CI passes

Core 3.24.4 ships the fixes from PolicyEngine/policyengine-core#475:
- `Simulation.apply_reform` preserves `set_input` values (the H3
  cache invalidation used to wipe user-provided dataset inputs)
- `Holder.get_array` walks up `simulation.parent_branch` before
  falling back to `default`, so nested branches (e.g. `no_salt`
  under `itemizing`) still see ancestor inputs
- `GroupPopulation.clone` passes the cloned population to
  holder.clone so branch-aware lookups resolve correctly

Together these unblock the strict breakdown/children validator
added in core 3.24.0. Before 3.24.4, bumping the floor triggered
`TypeError: int() argument ... not 'NoneType'` in the
`tax_unit_itemizes.yaml` integration test (state_fips was wiped
by apply_reform) plus an infinite recursion in
`tax_liability_if_itemizing`.

With 3.24.4 (or later), the existing `test_system_import.py`
regression test now actually catches breakdown/children mismatches
at CI time — the class of bug that caused issue PolicyEngine#8055 and the
three partial-fix patches PolicyEngine#8045, PolicyEngine#8049, PolicyEngine#8051. Verified locally
against core 3.25.0: all 794 IRS tests pass.

Also remove the `[tool.uv]` environments restriction
(`python_version >= '3.11'`) since core 3.24+ supports 3.9/3.10
directly on PyPI — the lockfile now resolves cleanly across the
full 3.9-3.14 range.

Closes PolicyEngine#8066.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxGhenis
Copy link
Copy Markdown
Contributor Author

Superseded by a rebased PR (the original branch accumulated 3 rounds of GitHub runner preemptions / test cancellations; rebasing onto current main gives a clean CI run).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core 3.24.x Enum cast regression blocks core floor bump

1 participant