Skip to content

Fix MA gross income to allow self-employment losses to offset other income#7866

Open
PavelMakarchuk wants to merge 5 commits intomainfrom
fix-ma-se-loss-offset
Open

Fix MA gross income to allow self-employment losses to offset other income#7866
PavelMakarchuk wants to merge 5 commits intomainfrom
fix-ma-se-loss-offset

Conversation

@PavelMakarchuk
Copy link
Collaborator

Summary

Fixes MA gross income dropping self-employment losses, which inflated MA tax liability.

Closes #7864
Related: PolicyEngine/policyengine-taxsim#752, PolicyEngine/policyengine-taxsim#743

Root Cause

irs_gross_income intentionally floors each income source at zero (max_(0, ...)), routing losses through above_the_line_deductions. This produces correct federal AGI but ma_gross_income inherited the loss-free gross income without adding back the losses.

Per MA Form 1 Line 4, business income/loss allows negative values that offset other 5% income on Line 10.

Fix

Add back self-employment losses that irs_gross_income dropped:

se_income = add(tax_unit, period, ["self_employment_income"])
se_loss_adjustment = min_(se_income, 0)  # negative or zero
return max_(0, federal_gross_income + se_loss_adjustment - deductions)

Example

Single filer, 2024: $100K interest + -$100K self-employment

Variable Before After TaxAct
Federal AGI $0 $0 $0
MA Gross Income $100,000 $0 $0
MA Income Tax $4,780 $0 $0

Test plan

  • policyengine-core test policyengine_us/tests/policy/baseline/gov/states/ma/tax/ -c policyengine_us — all 55 tests pass

🤖 Generated with Claude Code

…ncome

irs_gross_income floors each income source at zero, dropping losses.
MA Form 1 Line 4 allows business losses to offset other 5% income,
so add back self-employment losses that were dropped.

Closes #7864

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

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d8084e1) to head (ac35815).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##             main     #7866       +/-   ##
============================================
+ Coverage   71.81%   100.00%   +28.18%     
============================================
  Files        4084         2     -4082     
  Lines       58886        32    -58854     
  Branches      288         0      -288     
============================================
- Hits        42288        32    -42256     
+ Misses      16583         0    -16583     
+ Partials       15         0       -15     
Flag Coverage Δ
unittests 100.00% <100.00%> (+28.18%) ⬆️

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 4 commits March 25, 2026 14:18
MA Form 1 allows losses on lines 6a/6b/7 to offset other 5% income:
  - Line 6a: Business/profession loss (self_employment_income)
  - Line 6b: Farm loss (farm_income)
  - Line 7: Rental, partnership, S-corp loss (rental_income,
    partnership_s_corp_income, farm_rent_income)

irs_gross_income floors each source at zero, dropping these losses.
This fix adds them back per the Form 1 line 10 instruction:
"Be sure to subtract any losses in lines 6 or 7."

Closes #7864

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Separates the Form 1 lines 6/7 loss adjustment into its own variable
for clarity. The loss adjustment captures business, farm, rental,
partnership, and S-corp losses that irs_gross_income dropped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <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.

MA gross income doesn't allow self-employment losses to offset other 5% income

2 participants