Skip to content

Count all of New Mexico's modified gross income sources - #11173

Merged
hua7450 merged 2 commits into
mainfrom
nm-modified-gross-income-sources
Nov 20, 2026
Merged

hua7450 merged 2 commits into
mainfrom
nm-modified-gross-income-sources

Conversation

@DTrim99

@DTrim99 DTrim99 commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Part of #10812 (state credit income audit).
Part of #10062 (that issue also covers Iowa and Mississippi farm rent, which this PR leaves alone).

What was wrong

nm_modified_gross_income feeds the low income comprehensive tax rebate, the property tax rebate for persons 65 or older and the child day care credit. It missed most of the income NMSA 1978 § 7-2-2(L) lists, and it let losses reduce it in two ways the law bars:

  • It floored each source after summing over the tax unit, so a spouse's business loss reduced the head's business income.
  • It read capital_gains, which nets short-term against long-term, and long_term_capital_gains also nets the prior-year capital loss carryover.

The parameter file also ended with a comment ("income such as gambling winnings, insurance settlements, scholarships, grants and inheritance,") with nothing under it.

Sources, all read directly: NMSA 1978 § 7-2-2(L) (2025 code, Justia): "all income of the taxpayer and, if any, the taxpayer's spouse and dependents, undiminished by losses and from whatever source, including" 21 items; 3.3.1.10 NMAC; and the 2025 PIT-RC instructions (general definition and lines 4 to 11 on PDF page 4, the records table on page 2). I read the PIT-RC from the rendered pages, not its shifted text layer.

What changes

New entries in gov.states.nm.tax.income.modified_gross_income, each with its source in a comment:

Entry Source
farm_operations_income, farm_rent_income § 7-2-2(L)(2) net profit from business, (5) net rents; PIT-RC line 8, "net profit from business, farm, or rentals" (page 4)
partnership_s_corp_income § 7-2-2(L)(13) distributive share of partnership income; PIT-RC line 11, partnerships and S corporations (page 4)
non_sch_d_capital_gains (capital gain distributions without Schedule D) § 7-2-2(L)(3) gains from dealings in property; PIT-RC line 9 (page 4)
other_net_gain (Form 4797) PIT-RC line 11, "All ordinary gains from dealing in or selling property" (page 4)
general_assistance § 7-2-2(L)(19); 3.3.1.10(A)(1)(d) NMAC names general assistance; PIT-RC line 7 (page 4)
workers_compensation § 7-2-2(L)(18); PIT-RC line 6 (page 4)
disability_benefits (taxable and tax-exempt) 3.3.1.10(C) NMAC, "disability payments from whatever source"; PIT-RC records table, sick pay (page 2)
debt_relief § 7-2-2(L)(12); PIT-RC line 11 (page 4)
gambling_winnings (gross) PIT-RC line 11, "Gross gambling, gaming, and lottery winnings from any source without reducing winnings by any losses" (page 4)
financial_assistance (cash gifts) § 7-2-2(L)(21) gifts; PIT-RC line 10 (page 4)
educational_assistance 3.3.1.10(A)(2) NMAC, scholarships, grants and fellowships that need not be repaid; PIT-RC line 11 (page 4)
miscellaneous_income § 7-2-2(L), "from whatever source"; PIT-RC line 11, all income not on lines 4 to 10, such as cash prizes and awards (page 4)
section_911_excluded_income PIT-RC general definition, all income "regardless of whether that income is taxable by the U.S. Government" (page 4)

Formula changes:

  • Floor per person. Each person-level source is now floored at zero for each person before the tax unit sums it. Sources defined for the tax unit (tax_unit_social_security, other_net_gain, section_911_excluded_income) or a larger group (tanf) keep the tax-unit floor. Source: 3.3.1.10(B) NMAC ("zero is the lowest amount which may be reported for any item ... The loss from one business or activity shall not reduce the income from another business or activity") and PIT-RC line 8 (page 4: you "may not offset the loss of one business, farm, or rental against the profit of another").
  • Gross capital gains. capital_gains is replaced by short_term_capital_gains and a new person variable, nm_modified_gross_income_long_term_capital_gains: long_term_capital_gains plus long_term_capital_loss_carryover, the year's own long-term gain before the carryover. Each is floored on its own, so a short-term loss never reduces a long-term gain (or the reverse) and the carryover never reduces the year's gain; only the gain the carryover hid is restored, never the unused loss. Source: PIT-RC line 9 (page 4), "Enter your gross capital gains. Do not reduce them by capital losses", and § 7-2-2(L), "undiminished by losses". This follows the carryover add-back in az_property_tax_credit_capital_gains and the Montana elderly credit.

Military retired pay was added by #10769 and is unchanged.

Who is affected

New Mexico filers who claim the low income comprehensive tax rebate, the property tax rebate for persons 65 or older or the child day care credit, and who have any of the newly counted income, a person-level loss beside another member's income from the same source, or capital losses or a carryover beside capital gains. Modified gross income can only rise under this change (each new entry is floored at zero, and floors per person or per part are never below the old floors), so these rebates and credits fall or are lost, and New Mexico refundable credits fall for those filers. No one's modified gross income falls. A capital_gains value entered directly with no short- or long-term parts no longer counts; the model's inputs and the household calculator use the parts.

Tests

Moved from #10812 (nm_modified_gross_income_audit.yaml), all 14 cases, into nm_modified_gross_income.yaml: farm income (36,000), partnership income (32,000), one spouse's business loss (30,000), capital losses don't reduce gains (10,000), capital gain distributions (20,500), general assistance (8,000), workers' compensation (28,000), disability benefits (26,000), discharge of indebtedness (25,000), gross gambling winnings (24,000), cash gifts (22,000), scholarships (24,000), miscellaneous income (21,500) and excluded foreign earned income (30,000). Comments keep the arithmetic and citations, now with PIT-RC line numbers; the "main:" values are dropped. The review listed no rewrites for these cases.

Added, with arithmetic in each comment:

  • nm_modified_gross_income.yaml: a farm loss doesn't reduce wages (20,000); one spouse's capital loss doesn't reduce the other's gain (10,000); a carryover hides part of the year's gain (2,000 + 5,000 = 7,000); a carryover larger than the year's gain restores only the gain (20,000 + 3,000 = 23,000); a long-term loss for the year with a carryover counts as zero (20,000); a Form 4797 gain counts (23,000) and a Form 4797 loss is floored for the tax unit (20,000).
  • nm_property_tax_rebate_eligibility.yaml: a 70-year-old with 12,000 of Social Security and 4,000 of workers' compensation is at the 16,000 limit (eligible), and with 4,001 is just above it (ineligible).

Existing tests changed:

  • nm_modified_gross_income.yaml, "NM mixed positive and negative income sources" (2024): 105,000 → 115,000. The short-term gain of 10,000 no longer nets against the long-term loss of 15,000: 100,000 interest + max(10,000, 0) + max(−15,000 + 0, 0) + 5,000 dividends = 115,000 (PIT-RC line 9). The old value let a capital loss reduce a gain, which the law bars.
  • "NM capital losses should not reduce modified gross income": comment only (each part floored); the value stays 50,000.

Not in this PR

Other New Mexico gaps in the #10812 audit, left for later:

  • The New Mexico SSI state supplement (nm_ssi_state_supplement) under public assistance.
  • Pell grants (pell_grant) beside educational_assistance.
  • Other income "from whatever source" with its own inputs: strike_benefits, survivor_benefits, gi_cash_assistance, pfml_benefits.
  • Railroad Retirement (PIT-RC line 5), in Count railroad benefits in state tax worksheets, income tests and limits as each state's law does #10722, which edits the same parameter and test files; whichever PR merges second needs a small rebase.
  • Income from life insurance and endowment contracts (§ 7-2-2(L)(10)): the audit found two readings of what pension_income already holds.
  • No inputs: a home-sale gain excluded from federal income (PIT-RC line 9), inheritances, income in respect of a decedent, insurance and court settlements, cost-of-living allowances, room and board as compensation, gifts of marketable goods.
  • The input limits noted in the comments: bankruptcy discharges inside debt_relief can't be separated (PIT-RC line 11 leaves them out); losses netted inside one person's input (several businesses, or Schedule D distributions inside a net long-term loss) can't be undone; no short-term carryover memo exists.
  • Whose income: both spouses' income when they file separately (PIT-RC general definition); the variable sums one tax unit.

axiom: needed (rulespec-us has no us-nm module for NMSA 1978 § 7-2-2(L) or 3.3.1.10 NMAC; rulespec-us#1636 covers only (L)(15); no encoder run was authorized for this PR)

Tested on Modal: run w1-nm-a, 250/250 passed (241 YAML files: the New Mexico folder, every partner file and every other YAML file with a New Mexico household; plus 9 Python files: test_source_conflicts.py, test_state_estate_income_invariants.py, test_claimable_filer_nm_invariants.py, test_claimable_filer_federal_invariants.py, test_dependent_elsewhere_head_spouse_swap_invariance.py, test_reference_urls.py, test_parameter_yaml_keys.py, test_no_builtin_sum_over_entity_calls.py and test_household_spm_resource_parity.py).

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main    #11173   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         3    +2     
  Lines           24        49   +25     
  Branches         0         2    +2     
=========================================
+ Hits            24        49   +25     
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 Harness.
📢 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.

@DTrim99
DTrim99 requested a review from hua7450 November 19, 2026 23:50

@hua7450 hua7450 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, David. N.M.S.A. 7-2-2(L), 3.3.1.10 NMAC and the 2025 PIT-RC support every new entry, the per-person floor and counting capital gains gross. Nothing the law excludes is counted and nothing is counted twice. The four consumers (the low-income comprehensive tax rebate, the property tax rebate and its eligibility, and the child day care credit) all use the 7-2-2 definition, so no threshold needs to change. The newly read benefits are plain inputs, so there is no cycle. Two small fixes before I approve.

Before merge

  1. += in the formula. nm_modified_gross_income.py lines 42 and 48 use total += ..., both on lines this PR adds. The repo rule is to write the addition out (total = total + ...).
  2. Partnership and S corporation results are netted before the floor. The list adds partnership_s_corp_income, which sums the two, so one's loss reduces the other's income. 3.3.1.10(B) NMAC: "The loss from one business or activity shall not reduce the income from another business or activity." With partnership_income: 30_000 and s_corp_income: -20_000, the regulation gives 30,000 and the formula gives 10,000, which passes the $16,000 property tax rebate test. Listing partnership_income and s_corp_income separately fixes it, as you did for capital gains.

Optional

  • A directly entered capital_gains no longer counts, so that household's income falls against main. The PR body says so and also says "No one's modified gross income falls". Either add the fallback Montana keeps or correct the sentence.
  • Whose income counts. The PIT-RC says "all household members" and the statute says spouse and dependents. The code follows the statute, but there is no source_conflicts/candidates.yaml entry.
  • Section 911. section_911_excluded_income includes the Form 2555 housing deduction, which is not income.
  • Title and changelog say "all". Cash income with existing variables is still left out (nm_ssi_state_supplement, railroad_benefits, survivor_benefits, strike_benefits, pfml_benefits, gi_cash_assistance, pell_grant). The PR body lists them as follow-ups.
  • Tests. No s_corp_income case, no dependent case, and no new source carried through to the rebates or the day care credit.

DTrim99 and others added 2 commits November 20, 2026 11:13
Add farm, partnership and S corporation income, capital gain
distributions, Form 4797 gains, general assistance, workers'
compensation, disability benefits, discharged debt, gross gambling
winnings, cash gifts, scholarships, miscellaneous income and excluded
foreign earned income to New Mexico modified gross income (NMSA 1978
7-2-2(L), 3.3.1.10 NMAC, 2025 PIT-RC lines 4 to 11).

Floor each person-level source per person, so one spouse's loss no
longer reduces the other's income, and count short- and long-term
capital gains separately with the long-term carryover added back, so
capital losses no longer reduce gains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y in NM modified gross income

Add nm_modified_gross_income_partnership_s_corp_income, which floors
partnership and S-corp income at zero separately and falls back to the
combined partnership_s_corp_income input when neither part is set. List
it in the NM modified gross income sources in place of
partnership_s_corp_income, avoid in-place += on the formula's array, and
add test cases for an S-corp loss and a combined-only input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DTrim99
DTrim99 force-pushed the nm-modified-gross-income-sources branch from b0d6dd0 to 6524da4 Compare November 20, 2026 16:15
@DTrim99

DTrim99 commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks, Ziming. Fixed in 6524da4, rebased on main.

Fixed (your "Before merge" items)

  1. +=. nm_modified_gross_income.py lines 42 and 48 now write the addition out.
  2. Partnership and S-corp floored separately. A new Person helper, nm_modified_gross_income_partnership_s_corp_income, replaces partnership_s_corp_income in the list. It floors partnership_income and s_corp_income at zero separately, per 3.3.1.10(B) NMAC. With partnership 30,000 and S-corp −20,000 it gives 30,000, against 10,000 before.
    • Fallback. When neither component is set, the helper falls back to a directly entered partnership_s_corp_income, the way Montana does in mt_elderly_homeowner_or_renter_credit_gross_household_income. Without it, inputs that set only the combined variable would drop out of NM income entirely. The TAXSIM emulator's scorp mapping does that, and so do 75 YAML tests. A second new case checks it: a combined-only 50,000 gives 50,000.
    • Default microdata stores the two components, so it uses the per-component branch.

Skipped (optional, not in this round): the directly entered capital_gains fallback and PR-body sentence, a register entry on whose income counts, Section 911, the title/changelog "all", and the extra tests.

Verification: the NM modified gross income file and the four consumers' tests pass locally after the rebase (95), as does test_state_estate_income_invariants.py. An independent check caught the combined-input gap before the push; the fallback fixes it.

@DTrim99
DTrim99 requested a review from hua7450 November 20, 2026 16:15

@hua7450 hua7450 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, David. Both fixes are in. The += lines are written out, and the new nm_modified_gross_income_partnership_s_corp_income floors partnership and S corporation income each on its own (falling back to a combined amount entered directly). The new cases pin both (a 30,000 partnership gain beside a 20,000 S corporation loss counts 30,000). Comparing the PR's own diff before and after the rebase, those are the only changes. Approving.

@hua7450
hua7450 merged commit de02774 into main Nov 20, 2026
40 checks passed
@hua7450
hua7450 deleted the nm-modified-gross-income-sources branch November 20, 2026 17:46
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.

2 participants