Skip to content

Rename retirement contribution inputs to desired#8422

Merged
MaxGhenis merged 8 commits into
mainfrom
codex/ira-contributions-desired
May 24, 2026
Merged

Rename retirement contribution inputs to desired#8422
MaxGhenis merged 8 commits into
mainfrom
codex/ira-contributions-desired

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

@MaxGhenis MaxGhenis commented May 24, 2026

Summary

  • rename pre-limit retirement contribution source inputs to *_desired for IRA, 401(k), 403(b), and self-employed pension contributions
  • make the plain contribution variables the statutory rule-engine outputs, applying elective deferral, IRA, and self-employed pension limits directly
  • add explicit scale variables, elective_deferral_contribution_scale and ira_contribution_scale, so the proportional response is inspectable in the model
  • remove the public retirement capped_* variables, stale _reported wording, and internal uncapped_* helper variables; formulas now read *_desired directly

Behavioral assumption

When desired contributions exceed a shared statutory limit, PolicyEngine applies a proportional scale-down across that limit group. This preserves the household's desired allocation shares rather than prioritizing any one account type first. For example, if desired traditional/Roth 401(k)/403(b) deferrals exceed the elective deferral limit, each desired deferral is multiplied by elective_deferral_contribution_scale. Traditional/Roth IRA contributions use ira_contribution_scale within the IRA limit.

Alternatives would be to prioritize pre-tax accounts, Roth accounts, IRA before workplace plans, or the reverse. Those need an explicit ordering preference that we do not observe in the input data, so proportional scaling is the neutral default and keeps the rule engine deterministic.

Verification

  • uv run ruff check policyengine_us/variables/household/expense/retirement
  • uv run pytest policyengine_us/tests/core/test_input_variable_definitions.py policyengine_us/tests/code_health/variable_names.py -q
  • uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/household/expense/retirement/elective_deferral_limit.yaml policyengine_us/tests/policy/baseline/household/expense/retirement/ira_contribution_limit.yaml -c policyengine_us
  • PolicyEngine YAML focused tests: retirement, saver's credit, payroll, Medicare, PR, MA, CRFB, tax-exempt, Biden, UT, and MN cases passed in focused batches
  • runtime variable check: desired inputs and scale variables exist; stale uncapped_*, capped_*, actual_*, and _reported retirement contribution variables are absent

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (92fdab8) to head (0f63ec1).
⚠️ Report is 74 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #8422    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            2        18    +16     
  Lines           57       199   +142     
  Branches         1         0     -1     
==========================================
+ Hits            57       199   +142     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

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 changed the title Rename IRA contribution inputs to desired Rename retirement contribution inputs to desired May 24, 2026
@MaxGhenis MaxGhenis merged commit f69caec into main May 24, 2026
26 checks passed
@MaxGhenis MaxGhenis deleted the codex/ira-contributions-desired branch May 24, 2026 15:26
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