Repository navigation
Fix Pennsylvania taxable income for alimony and 401(k)/403(b) deferrals - #11162
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11162 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 4 +3
Lines 24 73 +49
=========================================
+ Hits 24 73 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hua7450
left a comment
There was a problem hiding this comment.
Thanks, David. Both fixes check out. Pennsylvania does not tax alimony ("Alimony" under "Income not taxable for PA PIT purposes", 2025 PA-40 IN p. 8), and with taxable_alimony_income subtracted, Schedule SP eligibility income counts alimony exactly once for pre-2019 and post-2018 divorces (8,000 in your case, 11,000 on main). Employee deferrals to 401(k) and 403(b) plans are PA compensation under 61 Pa. Code 101.6(c)(8)(ii)(B) and the Line 1a instruction, while health premiums and HSA payroll contributions are correctly left out. The head and spouse handling is symmetric, the per-spouse forgiveness share matches the new line 9, and all 11 new expected values derive by hand. One small fix before I approve.
Before merge
pa_taxable_elective_deferralscan go negative.min_(deferrals, employment_income - federal_wages)has no zero floor, so a negativeemployment_incomegives a negative add-back even with no deferrals. Wages of -1,000 plus 5,000 of interest now give PA taxable income of 4,000; main gives 5,000.max_(0, employment_income - (pre_tax_contributions - deferrals)) - federal_wagesfloors it, matches your ten cases, and also fixes the mixed case where other pre-tax items push federal wages to zero (wages 10,000, 401(k) 8,000, premiums 4,000: the current cap adds back 8,000, where PA compensation is 6,000). Please add one negative-wage case.
Optional
- Dependent care in 2021 and 2022. 61 Pa. Code 101.6(i)(2) says coverage under a dependent care plan "would constitute compensation", and Act 34 of 2023 excluded it only from tax year 2023. The new list starts in 2021 and the PR body rules dependent care out on the 2025 instructions alone. The gap is on main already; either a dated entry for 2021-2022 or a line saying those years are left out would cover it. The PIT Guide (08-2025, p. 32) and the unamended regulation still call it taxable, so it is also a candidate for
source_conflicts/candidates.yaml. - Withholding (follow-up).
pa_withheld_income_taxstill follows federal AGI, so it now differs from PA tax on exactly the two fixed items: 1,657.80 withheld against 1,842 of tax in your 60,000 / 6,000 case. The federal SALT deduction and paycheck withholdings do not see the fix. - Schedule SP line 10 counts employee cafeteria-plan payments for health coverage (2025 PA-40 IN p. 38), which
pa_eligibility_incomeomits. It predates this PR; worth adding to the "Not in this PR" list. - Authority for the two items left out. 72 P.S. 7303(a.6) for HSA payroll contributions and Act 34 of 2023 for dependent care would be better citations than the instructions alone.
- Tests. The 2019-divorce case does not assert
pa_eligibility_income(52,000 by trace), which would pin "counted once" on the post-2018 side. The cases at lines 227 and 243 are the same deferral class, and those at 164 and 181 the same pre-2019 class. The three cap cases would sit better in apa_taxable_elective_deferrals.yaml.
Pennsylvania does not tax alimony, so the part of it in federal gross income now comes off PA taxable income. Pennsylvania taxes an employee's traditional 401(k) and 403(b) deferrals as compensation, so they are now added back to the federal wages that leave them out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Compute the add-back as PA compensation (employment income less non-deferral pre-tax deductions, floored at zero) minus federal wages, so negative wages no longer produce a negative add-back and cafeteria-plan premiums are not added back. Add tests for negative wages and premiums that zero out federal wages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e41c062 to
35db7d5
Compare
|
Thanks, Ziming. Fixed in 35db7d5, rebased on main. Fixed (your "Before merge" item)
Skipped (optional, not in this round): dependent care in 2021-2022, the withholding follow-up, Schedule SP line 10, citations for the two items left out, and test reorganization. Verification: the PA income tax tests pass locally after the rebase (124/124). An independent check confirmed the formula and both new values by hand. Ruff is clean. |
hua7450
left a comment
There was a problem hiding this comment.
Thanks, David. pa_taxable_elective_deferrals is now PA compensation, max_(0, employment_income - (pre_tax_contributions - deferrals)), less federal wages, so the add-back can't go negative and stops at what Pennsylvania counts when other pre-tax items push federal wages to zero. The two new cases pin both (negative wages give 5,000 of taxable income; 10,000 of wages with an 8,000 deferral and 4,000 of premiums add back 6,000). Comparing the PR's own diff before and after the rebase, those are the only changes. Approving.
Part of #10812 (state credit income audit).
What was wrong
Two bugs in
pa_total_taxable_income(PA-40 line 9). It starts from federal gross income, addspa_other_additionsand subtracts the listgov.states.pa.tax.income.nontaxable_income_sources. Both bugs change Pennsylvania income tax itself, and they also flow into Tax Forgiveness eligibility income (Schedule SP line 1) and the use tax estimate.taxable_alimony_income, so alimony under a pre-2019 divorce stayed in PA taxable income.divorce_yeardefaults to 2010, so this hit all modeled alimony. Pennsylvania does not tax alimony: the 2025 PA-40 instructions list "Alimony" under "Income not taxable for PA PIT purposes" (2025 PA-40 IN, page 8). Schedule SP line 3 then addedalimony_incomeon top, so eligibility income counted pre-2019 alimony twice.irs_employment_income, which is wages minuspre_tax_contributions, so traditional 401(k) and 403(b) deferrals never counted. Pennsylvania taxes them:What changes
nontaxable_income_sources.yamlgainstaxable_alimony_income, with the 2025 PA-40 IN page 8 reference. Only the part federal gross income holds comes off, so alimony under a 2019-or-later divorce is untouched.taxable_elective_deferral_sources.yaml, holdingtraditional_401k_contributionsandtraditional_403b_contributions, with the three sources above.pa_taxable_elective_deferralssums that list. It adds back no more than federal wages actually left out (employment_income - irs_employment_income), because federal wages are floored at zero.pa_total_taxable_incomeadds the head's and spouse'spa_taxable_elective_deferrals, the same way it already subtracts only their nontaxable amounts. A dependent's deferrals stay off the filer's return, as their wages do.pa_tax_forgiveness_eligible_shareapproximates each spouse's own PA taxable income. It now adds the same deferrals, so the per-spouse split matches the new total.pa_other_additionsdocumentation now says the deferrals are already included, so users don't enter them twice.Pre-tax items I left out, because no PA source I read says they are taxable:
Who is affected
Retirement distributions (reported, not changed)
Contributions Pennsylvania taxed going in become basis in the plan. The model handles distributions this way:
retirement_age_threshold),pa_nontaxable_pension_incomeandpa_nontaxable_retirement_distributionsexclude the whole federally taxable pension, IRA, 401(k), 403(b), SEP and Keogh distribution. Basis doesn't matter then.Tests
Moved from #10812 (
pa_eligibility_income_audit.yaml) intotaxable_income/pa_total_taxable_income.yaml, sincepa_total_taxable_incomeis the variable they fix:pa_eligibility_income8,000, and now also assertspa_total_taxable_income: 5_000, as the review asked, to show the double count came from PA taxable income. Before this PR: 11,000 and 8,000.pa_total_taxable_incomeandpa_eligibility_incomeof 10,000, and now also asserts federal wages of 9,000 and the 1,000 add-back. Before this PR: 9,000.Added in
pa_total_taxable_income.yaml:Added in
forgiveness/pa_tax_forgiveness_amount.yaml:No existing expected values changed. No partner test failed.
Not in this PR
Other Pennsylvania gaps from the #10812 review, left for a later PA credits PR:
pa_eligibility_income) misses interest on U.S. obligations (line 2), life insurance proceeds (line 4), nontaxable scholarships (line 9) and cash from people outside the household (line 10). These are the other four cases inpa_eligibility_income_audit.yaml.pa_property_tax_or_rent_rebate_income) has four gaps:Tested on Modal: run
w1-pa-a, 240/240 passed: 238 YAML test files (every Pennsylvania test, all 144 partner files, and the other state, household and contrib files that read PA income tax) and 2 pytest files (test_source_conflicts.py,test_claimable_filer_nj_pa_invariants.py). The runner also received the two changed parameter files, which hold no tests and failed only for that reason.🤖 Generated with Claude Code