Rename retirement contribution inputs to desired#8422
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
*_desiredfor IRA, 401(k), 403(b), and self-employed pension contributionselective_deferral_contribution_scaleandira_contribution_scale, so the proportional response is inspectable in the modelcapped_*variables, stale_reportedwording, and internaluncapped_*helper variables; formulas now read*_desireddirectlyBehavioral 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 useira_contribution_scalewithin 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/retirementuv run pytest policyengine_us/tests/core/test_input_variable_definitions.py policyengine_us/tests/code_health/variable_names.py -quv 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_usuncapped_*,capped_*,actual_*, and_reportedretirement contribution variables are absent