Skip to content

Remove mixed computation metadata from variables#8330

Merged
MaxGhenis merged 1 commit into
mainfrom
remove-uprating-from-formula-variables
May 17, 2026
Merged

Remove mixed computation metadata from variables#8330
MaxGhenis merged 1 commit into
mainfrom
remove-uprating-from-formula-variables

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

@MaxGhenis MaxGhenis commented May 17, 2026

Summary

  • remove redundant uprating metadata from variables already computed by formulas or adds
  • remove dead class-level adds pointers from state variables whose formulas already add the parameter-defined variable lists explicitly
  • make default uprating apply only to plain input variables, so system-level mutation cannot recreate mixed computation modes
  • preserve microdata dataset-extension uprating for computed columns through a data-construction-only override map, including computed variables that previously received the default AGI uprater
  • keep a changelog fragment so this cleanup releases before PolicyEngine Core enforces mutually exclusive computation modes

Verification

  • red-state runtime test: test_variables_use_at_most_one_computation_mode failed with 21 conflicts before the default-uprating fix
  • AST scan for variables mixing formula, adds/subtracts, and uprating: conflicts=0
  • runtime scan after CountryTaxBenefitSystem() under current core: conflicts=0
  • runtime scan after CountryTaxBenefitSystem() with local PolicyEngine Core PR Add legislative reference for SNAP's 30% expected food contribution #495 on PYTHONPATH: conflicts=0
  • default-uprated computed-variable override scan: missing_overrides=0
  • uv run --no-sync pytest policyengine_us/tests/test_system_import.py policyengine_us/tests/microsimulation/data/test_extend_single_year_dataset.py -q
  • PYTHONPATH=/Users/maxghenis/policyengine-core uv run --no-sync pytest policyengine_us/tests/test_system_import.py -q
  • uv run --no-sync ruff check on touched variable, default-uprating, economic-assumptions, and test files
  • uv run --no-sync ruff format --check on touched variable, default-uprating, economic-assumptions, and test files
  • uv run --with towncrier towncrier build --draft --version 1.691.14

Companion cleanup for UK: PolicyEngine/policyengine-uk#1677. Core guard PR: PolicyEngine/policyengine-core#495.

@MaxGhenis MaxGhenis force-pushed the remove-uprating-from-formula-variables branch from 9194c8b to 0e85944 Compare May 17, 2026 14:00
@MaxGhenis MaxGhenis changed the title Remove uprating metadata from formula variables Remove mixed computation metadata from variables May 17, 2026
@MaxGhenis MaxGhenis force-pushed the remove-uprating-from-formula-variables branch from 0e85944 to 198980f Compare May 17, 2026 14:14
@MaxGhenis MaxGhenis force-pushed the remove-uprating-from-formula-variables branch from 198980f to f4a38b0 Compare May 17, 2026 14:20
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.57%. Comparing base (8cb60e7) to head (f4a38b0).
⚠️ Report is 29 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main    #8330      +/-   ##
===========================================
- Coverage   100.00%   94.57%   -5.43%     
===========================================
  Files            3       14      +11     
  Lines           63      166     +103     
  Branches         0        2       +2     
===========================================
+ Hits            63      157      +94     
- Misses           0        9       +9     
Flag Coverage Δ
unittests 94.57% <ø> (-5.43%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaxGhenis MaxGhenis merged commit f5baff9 into main May 17, 2026
24 of 25 checks passed
@MaxGhenis MaxGhenis deleted the remove-uprating-from-formula-variables branch May 17, 2026 15:04
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.

1 participant