Skip to content

Conversation

@MaxGhenis
Copy link
Contributor

Closes #7290

Summary

Missouri income tax now correctly handles capital loss deductions for joint filers where one spouse has no income.

Changes

  • Modified mo_adjusted_gross_income to allocate above-the-line deductions proportionally by gross income rather than equally between spouses
  • Added integration test for the capital loss scenario

Root Cause

The previous implementation split above-the-line deductions equally between spouses. When one spouse had no income, their share of the deduction was "lost" because they couldn't use it (the max_(0, fed_agi) would clip it). This caused MO AGI to be higher than federal AGI for joint filers with capital losses and unequal income.

Test

  • Added integration test MO joint with capital losses uses federal $3,000 limit (issue 7290) to verify:
    • Federal AGI = $51,000 ($54,000 wages - $3,000 capital loss limit)
    • MO AGI now correctly equals federal AGI
  • All 243 existing MO tests continue to pass

Related Issues

Closes #7290

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (66ccff2) to head (4405d64).
⚠️ Report is 439 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##             main     #7303       +/-   ##
============================================
+ Coverage   72.72%   100.00%   +27.27%     
============================================
  Files        3757         1     -3756     
  Lines       54115        29    -54086     
  Branches      267         0      -267     
============================================
- Hits        39353        29    -39324     
+ Misses      14742         0    -14742     
+ Partials       20         0       -20     
Flag Coverage Δ
unittests 100.00% <100.00%> (+27.27%) ⬆️

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.

The where() function evaluates both branches before selecting, which causes
divide-by-zero warnings when unit_gross_income is 0. Using np.divide with
a mask prevents evaluation of the division when the mask is False.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@MaxGhenis
Copy link
Contributor Author

Related: PolicyEngine/policyengine-taxsim#627 (MO joint 2024 capital loss discrepancy)

The np.divide out parameter already serves as the default value, so no
outer where() is needed. Just pass the default allocation as the out.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

MO income tax incorrectly allows unlimited capital losses to offset income

2 participants