Fix MA gross income to allow self-employment losses to offset other income#7866
Open
PavelMakarchuk wants to merge 5 commits intomainfrom
Open
Fix MA gross income to allow self-employment losses to offset other income#7866PavelMakarchuk wants to merge 5 commits intomainfrom
PavelMakarchuk wants to merge 5 commits intomainfrom
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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>
hua7450
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_incomeintentionally floors each income source at zero (max_(0, ...)), routing losses throughabove_the_line_deductions. This produces correct federal AGI butma_gross_incomeinherited 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_incomedropped:Example
Single filer, 2024: $100K interest + -$100K self-employment
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