Skip to content

Allocate taxable UC by recipient, not all to head#8498

Open
PavelMakarchuk wants to merge 2 commits into
mainfrom
fix-taxable-uc-allocation
Open

Allocate taxable UC by recipient, not all to head#8498
PavelMakarchuk wants to merge 2 commits into
mainfrom
fix-taxable-uc-allocation

Conversation

@PavelMakarchuk
Copy link
Copy Markdown
Collaborator

Closes #8494.

Summary

taxable_unemployment_compensation (Person, YEAR) was assigning the tax unit's entire taxable UI to the head and zero to the spouse via where(is_tax_unit_head, tax_unit_taxable_uc, 0). The original shortcut preserved the federal tax-unit AGI sum but broke per-person AGI used by state combined-return optimization (KY, AR, DE, IA, MS, MT, WV, MI). Inflating or zeroing one spouse's apparent AGI shifted state std deductions to the wrong person and produced incorrect state liability.

Fix

Mirror the existing taxable_social_security pattern (taxable_social_security.py:11-29): allocate tax_unit_taxable_unemployment_compensation across persons in proportion to each person's unemployment_compensation. The federal sum is preserved (shares sum to 1); per-person AGI now reflects the actual recipient.

def formula(person, period, parameters):
    tax_unit_taxable_uc = person.tax_unit("tax_unit_taxable_unemployment_compensation", period)
    person_uc = person("unemployment_compensation", period)
    tax_unit_uc = person.tax_unit.sum(person_uc)
    share = where(tax_unit_uc > 0, person_uc / tax_unit_uc, 0)
    return tax_unit_taxable_uc * share

Tests

  • New taxable_unemployment_compensation.yaml with 3 cases (spouse-only UC, proportional split, zero UC).
  • Existing test suite passes: 299 IRS taxable income tests + 369 KY tests + smoke-tested AR/DE/IA/MS/MT/WV/MI (~1,930 state tests total) — no regressions.

Open question

Running the issue's repro (KY 2025 joint, head $1.13 UC, spouse $10K wages + $19,124 UC) produces ky_income_tax = $994 after the fix, vs. the issue's expected ~$524 (TaxAct). The variable-level fix is correct (per-person UC matches reality), but the KY-side discrepancy needs separate investigation — possibly a different KY combined-return optimization issue, family-size credit, or TaxAct's own handling of the std deduction split. Flagging for KY-specific follow-up before closing the original taxsim issue.

Test plan

  • New YAML tests pass
  • No regressions in IRS taxable income or KY/AR/DE/IA/MS/MT/WV/MI states
  • CI passes
  • Validate KY $524 vs TaxAct in follow-up

🤖 Generated with Claude Code

`taxable_unemployment_compensation` was assigning the entire tax unit's
taxable UI to the head of household and zero to the spouse. The original
shortcut preserved the federal AGI sum but broke per-person AGI used by
state combined-return logic (KY, AR, DE, IA, MS, MT, WV, MI), inflating
or zeroing one spouse's apparent income and shifting state std deductions
to the wrong person.

Mirror the existing `taxable_social_security` pattern: allocate the tax
unit's taxable UC across persons in proportion to each person's
`unemployment_compensation`. The federal sum is preserved (shares sum
to 1); per-person AGI now reflects the actual recipient.

Closes #8494.

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

codecov Bot commented May 25, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #8498   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         1    -1     
  Lines           57        13   -44     
  Branches         1         0    -1     
=========================================
- Hits            57        13   -44     
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.

Cover the drift surfaces that the variable-level fix corrects:
- adjusted_gross_income_person: per-person federal AGI reflects actual
  UC recipient (spouse-only UC + both-spouses UC scenarios)
- ky_agi: per-person KY AGI no longer inflates head with spouse's UC

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk requested a review from MaxGhenis May 25, 2026 18:44
@PavelMakarchuk PavelMakarchuk marked this pull request as ready for review May 25, 2026 18:44
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.

taxable_unemployment_compensation collapses all UI to head, breaking per-person state AGI

1 participant