Skip to content

Conversation

@policyengine
Copy link

@policyengine policyengine bot commented Dec 14, 2025

Summary

Fixes #6964 - Mississippi income tax now correctly applies the federal $3,000 capital loss limitation instead of allowing unlimited capital losses to offset ordinary income.

Background

Mississippi Form 80-105 Line 40 ("Capital gain (loss)") flows from federal Schedule D, which already has the $3,000 loss limit applied per IRS regulations. Previously, PolicyEngine was using the raw capital_gains variable which sums unlimited capital gains and losses without applying the federal limitation.

Changes Made

  1. Created new variable loss_limited_capital_gains (policyengine_us/variables/household/income/person/capital_gains/loss_limited_capital_gains.py)

    • Person-level variable that allocates the tax unit's loss_limited_net_capital_gains proportionally to each person
    • When capital gains are positive, returns each person's original amount
    • When capital losses occur, applies the federal loss limitation proportionally across persons
  2. Updated MS income sources parameter (policyengine_us/parameters/gov/states/ms/tax/income/income_sources.yaml)

    • Changed from capital_gains to loss_limited_capital_gains
    • Added comment explaining the federal Schedule D $3,000 capital loss limit
  3. Added integration test (policyengine_us/tests/policy/baseline/gov/states/ms/tax/income/integration.yaml)

Test Results

All MS integration tests pass, including the new test case:

============================== 6 passed in 6.73s ===============================

Impact

This fix ensures Mississippi income tax calculations correctly follow federal Schedule D rules for capital loss limitations, preventing large capital losses from incorrectly zeroing out state tax liability.

🤖 Generated with Claude Code

Mississippi Form 80-105 Line 40 flows from federal Schedule D, which
has the $3,000 capital loss limit already applied. Previously, MS was
using unlimited raw capital gains/losses.

Changes:
- Created loss_limited_capital_gains variable that allocates tax unit's
  loss-limited capital gains proportionally to persons
- Updated MS income_sources.yaml to use loss_limited_capital_gains
  instead of capital_gains
- Added integration test for MS joint filers with large capital losses

Fixes #6964

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

codecov bot commented Dec 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ba52386) to head (4b7cc8c).
⚠️ Report is 42 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #6966   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         1    -1     
  Lines           26        17    -9     
=========================================
- Hits            26        17    -9     
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.

PavelMakarchuk and others added 3 commits December 15, 2025 16:49
- Fix variable to use capital_gains (Person-level) instead of
  net_capital_gains (TaxUnit-level)
- Add 12 unit tests covering all filing statuses, loss limitation
  scenarios, and proportional allocation for joint filers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk changed the title Fix MS income tax to apply federal ,000 capital loss limitation Fix MS income tax to apply federal capital loss limitation Dec 15, 2025
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.

MS income tax incorrectly allows unlimited capital losses to offset income

3 participants