Skip to content

Fix AR, MT and NM income tax gaps found in TAXSIM comparison sweep - #9585

Merged
DTrim99 merged 10 commits into
PolicyEngine:mainfrom
DTrim99:taxsim-sweep-ar-mt-nm-fixes
Oct 13, 2026
Merged

DTrim99 merged 10 commits into
PolicyEngine:mainfrom
DTrim99:taxsim-sweep-ar-mt-nm-fixes

Conversation

@DTrim99

@DTrim99 DTrim99 commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A comparison sweep of PolicyEngine against TAXSIM (latest NBER binary, opt(30)=1, 2021–2025) turned up five state income tax gaps in Arkansas, Montana and New Mexico. Each one is fixed here and checked against the form instructions. Review also surfaced a few small pre-existing gaps in the same lines of code, which are fixed here too.

State Fix Years
AR Count partnership and S-corporation income in AR gross income (Line 19) all
AR Stop flooring each spouse's net income at zero on joint returns. All income goes in Column A, so one spouse's loss offsets the other's income; the unit total is floored instead. all
MT Floor the capital gain credit at zero, so a net capital loss no longer produces a negative credit 2021–2023
MT Grant dependent exemptions to non-child dependents whose own Montana gross income is at or below the exemption amount. That gross income is the federal dependent gross income minus unemployment compensation. Treat permanently and totally disabled adult children as qualifying children. The extra disabled exemption applies to children only. 2021–2023
MT Leave a dependent's Montana additions and subtractions out of joint Montana AGI. A dependent's income is not on the filer's return. all
NM Exclude short-term gains from "net capital gains" (IRC §1222(11)) for the net capital gains deduction, and count capital gain distributions as long-term gains all (since 2019)

axiom: AR1000F lines 19, 23, 25 and 28 (Ark. Code § 26-51-404) TheAxiomFoundation/rulespec-us#1753 queued | MCA 15-30-2114(5), 15-30-2101(10), 15-30-2301 and 15-30-2110 (TY2021–2023) TheAxiomFoundation/rulespec-us#1754 queued | NMSA 7-2-34 (IRC 1222(11) base) TheAxiomFoundation/rulespec-us#1755 queued

Evidence

AR: partnership and S-corp income (Line 19)

2022 AR1000F instructions, p. 13 (same wording in 2025):

LINE 19. If you had income from rents, royalties, estates or trusts, profits (whether received or not) from partnerships, fiduciaries, small business corporations, etc., enter the amounts as reported on your federal Schedule E.

partnership_s_corp_income has never been in gross_income/sources/{individual,joint}.yaml, although rental_income (also Line 19) is. This was reported in taxsim #405, which was closed without a fix.

AR: joint returns use Column A only

2022 AR1000F instructions, p. 12 (same wording in the 2024 instructions, p. 12):

If your filing status is Married Filing Separately on the Same Return, both Column A and Column B must be used. Write your income in Column A and your spouse's income in Column B. For all other filing statuses, write all income in Column A only.

Before this PR, ar_agi_joint floored each person's net income at zero before summing. A spouse's business loss therefore could not offset the other spouse's wages. The per-person zero floor now applies only to dependents' income, which is attributed to the head. ar_net_taxable_income_joint and ar_low_income_tax_joint floor the combined total instead.

MT: capital gain credit

2022 Montana Form 2 instructions, p. 43:

This credit is equal to 2 percent of your net capital gains reported on Form 2, line 7.

The old formula multiplied 2% by capital_gains even when it was negative. For example, a return with a $11,418 short-term loss got a −$228 credit, which raised tax by $228.

MT: dependent exemptions

MCA 15-30-2114(5)(a) (2021) allows an exemption for each dependent:

(i) whose gross income for the calendar year in which the tax year of the taxpayer begins is less than or equal to the exemption amount provided in subsection (2)(a); or (ii) who is a qualifying child as defined in section 152 of the Internal Revenue Code

MCA 15-30-2101(10) defines that gross income:

"Gross income" means the taxpayer's gross income for federal income tax purposes as defined in section 61 of the Internal Revenue Code ... excluding unemployment compensation included in federal gross income under the provisions of section 85

The 2022 Form 2 instructions, p. 14 give the same test ("who does not have gross income of more than $2,710, unless the dependent is a 'qualifying child'") and limit the extra exemption to "a child who is disabled". The limits are $2,580 in 2021 and $2,960 in 2023.

The old formula granted exemptions only to qualifying children. Non-child dependents with low income, such as a 19-year-old non-student or a dependent parent, got nothing. The income test now uses a new Montana measure, mt_dependent_gross_income. It takes the federal dependent_gross_income, which counts only the dependent's own income, and subtracts the dependent's unemployment compensation, which MCA 15-30-2101(10) excludes. That is the only Montana difference from IRC §61 gross income in the statute and in the 2021–2023 Form 2 instructions.

Since #9691, dependent_gross_income follows Pub. 501 (2022), p. 2:

  • It counts only the IRC §86 taxable part of Social Security: no benefits are gross income "unless ... one-half of your social security benefits plus your other gross income and any tax-exempt interest is more than $25,000". That part is figured on the dependent's own IRC §86(b)(2) modified AGI. Modified AGI includes unemployment compensation even though Montana excludes it, because it is federal gross income. Modified AGI also nets capital losses within the IRC §1211(b) limit and subtracts the dependent's own adjustments to income. Two approximations remain in the federal variable: adjustments the model records only for the tax unit, such as health savings account contributions, are not attributed to dependents, and the IRC §461(l) excess business loss limit is not applied. The base amount is $0 for a dependent who is married filing separately and lives with their spouse.
  • It floors long-term and short-term gains at zero separately instead of netting them, because "gross income includes gains, but not losses".

An earlier revision of this PR computed taxable Social Security inside the Montana variable. It floored every income component at zero before computing provisional income, so a capital loss never lowered taxable Social Security. Reusing the federal variable fixes that and removes the duplicated IRC §86 code. For example, a 2022 dependent with $26,000 of unemployment compensation, $10,000 of Social Security and a $3,000 long-term loss has modified AGI of $23,000 and $1,500 of taxable Social Security. The dependent's Montana gross income is therefore $1,500, so the dependent now qualifies for the $2,710 exemption. The earlier revision computed $3,000 and denied it. irs_gross_income does not work for this test because it is zero for dependents.

A permanently and totally disabled adult child now counts as a qualifying child (IRC §152(c)(3)(B)), as in is_qualifying_relative_dependent. For example, a 2022 dependent aged 30 with $5,000 of wages now gets $5,420 instead of $0, which lowers MT tax by $365.85.

MT: joint AGI leaves out dependents' additions and subtractions

2022 Montana Form 2 instructions, Line 7:

Enter the same amount of the unemployment compensation that you reported on your federal tax return. Unemployment compensation is exempt from Montana tax. Subtract this same amount on the Montana Subtractions Schedule, line 7.

Montana subtractions remove income that is on the filer's federal return. A dependent's income is not on that return: adjusted_gross_income_person is zero for dependents. Before this PR, mt_agi_joint still pooled every tax unit member's mt_additions and mt_subtractions. A dependent's unemployment compensation therefore lowered the filer's Montana AGI. Since #9903 it also lowered the AGI-based joint standard deduction. Additions and subtractions are now pooled over the head and spouse only, so a spouse's subtraction still offsets the other spouse's income (commit 216b329). For example, a 2022 filer with $50,000 of wages and a dependent with $3,000 of unemployment compensation now has Montana AGI of $50,000 instead of $47,000.

NM: net capital gains

2022 PIT instructions, PIT-1 line 15:

You may deduct all or part of your net capital gains reported and claimed on your federal tax return.

2023 PIT instructions, PIT-1 line 15:

For purposes of this deduction, "net capital gains" are defined by Section 1222(11) of the Internal Revenue Code. For Tax Year 2023 that section defines "net capital gains" as only net long-term capital gains less any net short-term capital losses.

The 2024 instructions (p. 33) carry the same §1222(11) definition. The shorter 2022 wording does not set a different rule. NMSA 7-2-34(D) has used IRC §1222(11) since 2019 HB6, section 14, which applies to tax years beginning January 1, 2019 (section 59(A), p. 105). From 2025 the same definition is in subsection (C) (2024 HB252, section 8, p. 30; applicability in section 42(B), p. 147).

The deduction therefore uses net long-term gain less any net short-term loss in every year, with no year-dated parameter. Capital gain distributions (non_sch_d_capital_gains) are long-term capital gains under IRC §852(b)(3)(B), so they now count as well. For example, a 2023 single filer with $5,000 of distributions now gets $2,000 instead of $0.

Two 2021 TAXSIM records that matched under the old formula now differ. The difference comes from TAXSIM including short-term gains; it is not a change in New Mexico law.

Validation against TAXSIM

I ran the sweep sample (150 records per state-year) through policyengine-taxsim, before and after this change, and compared state tax plus rebates to TAXSIM opt(30)=1. Tolerance: max($25, 0.1% of federal AGI). These counts are from the first revision. The review-round changes affect only inputs the sweep does not set: dependents' own income, disability status and capital gain distributions.

Year State Mismatches before Mismatches after Newly broken
2021 AR 64 46 1
2022 AR 37 14 0
2023 AR 44 20 0
2024 AR 56 33 1
2025 AR 63 42 0
2021 MT 29 18 0
2022 MT 28 15 1
2023 MT 41 25 0
2024–25 MT 6 6 0
2021–25 NM 104 104 0
Total 472 323 3

Why NM shows no change. In 2022–2024, TAXSIM deducts a flat $1,000 of net capital gains, not the greater of $1,000 or 40% that the instructions require. That gap is much larger than the short-term-gain change, so the affected records stay mismatched either way.

The 3 newly broken records:

  • AR 90246 (2021) and 91030 (2024): AR AGI now equals TAXSIM's exactly. The remaining gap comes from separate credit differences that were previously masked by an offsetting AGI error.
  • MT 40761 (2022): with the fix, PE's joint Montana computation now matches TAXSIM exactly (taxable income $89,709, tax $5,452.86), including exemptions for the two $0-income 20-year-old dependents. The remaining gap is that PE elects married filing separately on the same form, which is cheaper, and TAXSIM doesn't model that election. Before the fix, the two missing exemptions happened to offset that saving.

Repro rows (TAXSIM input format)

taxsimid,year,state,mstat,page,sage,depx,age1,age2,age3,pwages,swages,psemp,ssemp,dividends,intrec,stcg,ltcg,pensions,gssi,scorp,idtl
91082,2025,4,2,28,29,1,2,0,0,75375,66950,927,0,5798,328,0,13445,0,0,68696,2
90593,2021,4,1,61,0,0,0,0,0,133903,0,0,0,8149,1081,0,11377,16175,0,28447,2
90789,2021,4,2,60,57,0,0,0,0,0,36778,-7473,0,0,5,-435316,-24792,0,0,-202258,2
97483,2022,27,1,58,0,0,0,0,0,0,0,0,0,0,0,-11418,0,0,0,0,2
97859,2023,27,2,44,43,3,19,15,11,159631,27305,0,0,325,70,0,0,0,0,0,2
Record Fix TAXSIM opt30 siitax PE before PE after
AR 91082 (2025) S-corp income 8,308.79 4,968.25 8,309.39
AR 90593 (2021) S-corp income 10,652.85 8,974.49 10,652.85
AR 90789 (2021) joint loss offset 0.00 971.06 0.00
MT 97483 (2022) capital gain credit floor 0.00 228.35 0.00
MT 97859 (2023) adult dependent exemption 9,606.26 9,807.56 9,607.76

NM has no clean TAXSIM repro row. TAXSIM counts short-term gains in every year, and its flat $1,000 deduction in 2022–2024 keeps the affected records mismatched either way. The unit tests show the change instead: long-term $10,000 and short-term $5,000 gives a deduction of $4,000 (40% × $10,000) in 2021, 2022, 2023 and 2024. Counting the short-term gain would give $6,000.

Tests

  • New and updated YAML cases for ar_agi_joint, ar_net_taxable_income_joint, ar_gross_income_indiv, the AR integration tests, mt_capital_gain_credit, mt_dependent_exemptions_person, the new mt_dependent_gross_income and mt_agi_joint tests, and nm_net_capital_gains_deduction.
  • MT (all 2022 unless noted), each with the arithmetic in comments:
    • unemployment compensation only: exemption $2,710, mt_income_tax $1,731.65, down $182.93;
    • unemployment compensation plus wages at $2,710 (eligible) and $2,711 (not eligible);
    • $12,000 of Social Security below the base amount (eligible);
    • taxable Social Security at the limit ($60,840 of benefits) and $1 over it ($60,844), which covers the IRC §86 branch;
    • $26,000 of unemployment compensation, $10,000 of Social Security and a $3,000 long-term loss: modified AGI $23,000, taxable Social Security $1,500, Montana gross income $1,500, exemption $2,710;
    • a long-term gain with a short-term loss (mt_income_tax $1,894.57, up $182.92), and a short-term gain with a long-term loss;
    • the 2021 limit ($2,580 passes, $2,581 fails) and the 2023 limit ($2,961 fails);
    • a derived qualifying-child pair with no flag input: a 22-year-old full-time student gets $2,710, a non-student gets $0;
    • a permanently and totally disabled adult child: $5,420, mt_income_tax $1,548.72, down $365.85;
    • mt_agi_joint: a dependent's $3,000 of unemployment compensation leaves the filer's Montana AGI at $50,000, and a spouse's $3,000 still offsets the joint return's income.
  • MT fixtures note that is_tax_unit_spouse: false is required, because without it the adult is inferred as the spouse and skips the income test.
  • NM: 2021 and 2024 cases for the §1222(11) rule, a 2021 short-term-only case, and a capital gain distributions case.
  • AR: a joint $30,000/−$45,000 case asserts $0 tax (a per-spouse floor would give $396.75); a loss on the head instead of the spouse gives $904.16; and a 2021 case confirms partnership income is in the earlier source list.
  • Existing nm_net_capital_gains_deduction inputs moved from capital_gains to long_term_capital_gains, so they keep testing the same amounts.
  • The existing ar_agi_joint case with a spouse at −100 now expects −100 rather than 0.
  • Locally on this revision, file by file: mt/tax/income/exemptions (59 passed), mt_agi_joint.yaml and mt_capital_gain_credit.yaml (5 passed), every AR and NM YAML file this PR touches (88 passed), and test_ar_gross_income_source_line_comments.py (2 passed). The first revision also passed gov/states/{ar,mt,nm}, gov/states/tax, gov/states/household, and the SALT refund and AMT integration tests (1,749 passed), plus the partner contract tests (620 passed). No partner files changed.

Arkansas joint deduction floors

Because one spouse's loss can now offset the other's income on a joint return, the couple's combined AGI can be negative. Three Arkansas joint itemized deductions (medical, casualty loss and miscellaneous) take a percentage of that combined AGI as a floor, so a negative AGI made each deduction larger than the expense: $1,000 of medical expenses produced a $1,500 deduction. The combined AGI is now floored at zero in those three floors, as the federal deductions do, with one test per deduction (commit b584e8b). The medical case was already wrong on this branch before merging main; main added the other two.

Follow-ups (filed; out of scope here)

#9678 (federal dependent_gross_income counting total Social Security and netting capital losses) was closed by #9691 on 2026-10-02. The Montana income test now builds on that fix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH

- AR: count partnership/S-corp income in gross income (AR1000F Line 19);
  stop flooring each spouse's net income separately on joint returns
  (all income goes in Column A), flooring the unit total instead.
- MT: floor the capital gain credit at zero on net capital losses; allow
  dependent exemptions for non-child dependents with gross income at or
  below the exemption amount, with the disabled extra exemption for
  children only.
- NM: from TY2023, compute net capital gains per IRC 1222(11) (net
  long-term gain less net short-term loss), excluding short-term gains.

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

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (909176a) to head (2ce9b1c).
⚠️ Report is 37 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #9585   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         6    +2     
  Lines           76       106   +30     
  Branches         2         1    -1     
=========================================
+ Hits            76       106   +30     
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.

@PavelMakarchuk PavelMakarchuk 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.

Two correctness issues need addressing before merge: the Montana dependent-income test uses a variable that excludes dependents, and the New Mexico parameter introduces an unsupported 2023 effective date. Both were reproduced with isolated checks of the current-head formulas. All 37 hosted checks pass, but the current regression fixtures do not catch these issues. This was a manual code/source review with isolated formula checks, not the complete-review workflow or a new full-model test run. The Arkansas changes and Montana capital-gain credit floor look sound.

@PavelMakarchuk

Copy link
Copy Markdown
Collaborator

Program Review

Complete review confirms the two existing blockers. Request changes; no additional correctness blocker found.

Source Documents

Branch Status

The reviewed branch is 9 commits behind main; rebase before merging. Staleness did not affect this review, which used the captured head and explicit merge-base diff.

Critical (Must Fix)

  1. [C1] Montana's new dependent-income test cannot reject computed dependent income. In policyengine_us/variables/gov/states/mt/tax/income/exemptions/dependent/mt_dependent_exemptions_person.py:25–26, irs_gross_income is zero for dependents because its own formula excludes them. Actual-formula reproduction: a non-child dependent with $3,000 earnings in 2022 receives a $2,710 exemption, although the state income limit is $2,710 and the correct exemption is zero. The new tests override irs_gross_income, hiding this dependency failure. Use an appropriate dependent-income measure—consider existing dependent_gross_income—and test actual earnings/interest below, at and above the threshold. Montana instructions, file p.14. Both baseline code-path tracing and independent 600-DPI source verification confirm this defect.

  2. [C2] New Mexico's 2023 start date is unsupported. policyengine_us/parameters/gov/states/nm/tax/income/deductions/net_capital_gains/excludes_short_term_gains.yaml:3–8 explicitly includes positive short-term gains in 2021–2022. The enacted 2019 law already incorporates IRC §1222(11), excluding those gains; its applicability provision covers tax years from January 1, 2019. For 2022, $10,000 long-term plus $5,000 short-term gains yield a $4,000 deduction, not $6,000. Correct the historical gate, explanation and new 2022 regression expectation. The erroneous older arithmetic pre-existed, but this PR newly codifies it as an intentional legal transition. HB6 §14(D), file p.41, §59(A), file p.105. Code-path tracing and independent 600-DPI verification confirm the mismatch; this does not claim 2019 was the definition's earliest origin.

Should Address

  1. [A1] Arkansas loss integration coverage. ar_agi_joint.yaml:52 asserts only intermediate signed income; ar_net_taxable_income_joint.yaml:110 forces low-table selection. Add an explicit married joint household with asymmetric spouse profits/losses, checking table selection and final tax for positive, zero and negative combined income. Include the separately changed ar_low_income_tax_joint floor.
  2. [A2] New Mexico cross-spouse netting coverage. Extend nm_net_capital_gains_deduction.yaml:94 with gains on one spouse and short-term losses on the other; include exact cancellation and excess losses. Current tests cover aggregate inputs but not these aggregation boundaries.

Suggestions

None separately counted. Reference-title wording and unchanged model limitations are not merge blockers.

PDF Audit Summary

Category Count
Confirmed correct, distinct rules 14
Mismatches, code-path and 600-DPI verified 2
Mismatches rejected 0
Introduced unmodeled items 0

Correct-rule count deduplicates repeated years and overlapping source passages: 2 Arkansas, 5 Montana, 7 New Mexico. Existing disability/dependency approximations, capital-loss carryover/residency details and unrelated credit interactions were not promoted to new findings. The Arkansas visual source is the 2025 booklet; no comprehensive historical audit of every source-list year is claimed.

Validation Summary

Check Result
Regulatory accuracy C1 and C2 confirmed
Reference quality C2 corroboration failure; all 3 newly added file-page anchors correct
Code patterns All 10 categories reviewed; no additional blocker
Formatting/structure Six changed Python files parse; metadata/changelog present
Test coverage C1/C2 fixtures mask or preserve errors; A1/A2 coverage gaps
CI 37/37 checks passed at reviewed head

Actual formula bodies were executed in isolated NumPy checks reproducing both disputed results. No new full-model, YAML-suite or microsimulation run was performed locally; hosted CI supplies suite coverage.

Review completed in approximately 19 minutes, using 3 reused delegate workers across 20 roles. All five collected PDFs were fully rendered and sequence-verified: 480 pages at 300 DPI, plus 2 external pages and 3 independent 600-DPI verification renders (485 total; 0 cache hits). Topic auditors visually read the relevant pages, not all 480. To protect disk space, 470 bulk PNGs and the inspected 600-DPI PNGs were deleted after verification; PDFs, reports, operative 300-DPI evidence and verification hashes remain. The full render cache is therefore no longer reusable. No repository source edits.

Review Severity: REQUEST_CHANGES

Next Steps

Fix C1 and C2, add the targeted regression coverage, and rerun complete review before approval. The fix-pr workflow can apply the corrections.

…nition

Test Montana's non-child dependent exemption against the dependent's own
gross income (dependent_gross_income) instead of irs_gross_income, which
is zero for dependents, with earnings-derived below/at/above-limit cases.
Apply New Mexico's IRC 1222(11) net capital gain definition in every year
(NMSA 7-2-34(D), 2019 HB6) and drop the unsupported pre-2023 exception.
Add Arkansas joint asymmetric profit/loss and New Mexico cross-spouse
netting coverage.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
@DTrim99

DTrim99 commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator Author

Fixes applied (2ce9b1c): Pavel's review

[C1] Montana dependent income test.

  • mt_dependent_exemptions_person now tests a non-child dependent's own gross income with dependent_gross_income instead of irs_gross_income, which is zero for dependents. The 2022 Form 2 instructions (p.14) are now in the variable's references.
  • The cases that set irs_gross_income directly are gone. Earnings-derived cases replace them at the $2,710 limit for 2022:
    • wages just below the limit and exactly at it: eligible;
    • wages above the limit: not eligible (your $3,000 repro);
    • wages plus interest together above the limit: not eligible;
    • a qualifying child with wages above the limit: still eligible.

[C2] New Mexico net capital gain.

  • The excludes_short_term_gains parameter and its pre-2023 exception are removed.
  • nm_net_capital_gains_deduction now applies the IRC §1222(11) definition in every year: net long-term gain less any net short-term loss. It cites NMSA 7-2-34(D) and 2019 HB6 §14.
  • The 2022 case with $10,000 long-term and $5,000 short-term gains now gives $4,000: max(40% × 10,000, 1,000).
  • Two 2021 TAXSIM sweep records that matched under the old formula now differ. The PR description flags that as a TAXSIM-side difference, not a change in PolicyEngine law.

[A1] Arkansas joint loss coverage. ar/tax/income/integration.yaml gains four married-joint households, each with one spouse's loss offsetting the other's wages:

  • positive combined income on the regular table;
  • positive combined income on the low-income table;
  • a loss that exactly cancels wages (zero combined income);
  • a loss that exceeds wages (negative combined income).

Together they cover table selection, final tax and the ar_low_income_tax_joint floor.

[A2] New Mexico cross-spouse netting. nm_net_capital_gains_deduction.yaml gains four joint-couple cases:

  • one spouse's short-term loss partially offsets the other's long-term gain;
  • the loss exactly cancels the gain;
  • the loss exceeds the gain;
  • short-term gain and loss net across the spouses before offsetting the long-term gain.

Other updates: the changelog and the PR description's MT and NM sections are updated.

Verification: all 37 CI checks pass at 2ce9b1c, including the full baseline state shards, and ruff format is clean. The branch is still behind main, but it merges cleanly, so I haven't rebased.

@PavelMakarchuk

Copy link
Copy Markdown
Collaborator

Program Review (incremental re-review)

All four prior findings (C1, C2, A1, A2) are resolved. One new blocker remains: Montana's dependent income test needs a Montana-specific gross-income measure.

Source Documents

Branch Status

The branch is 2 commits ahead of and 57 commits behind main. Rebasing before merge is recommended. This review used the captured head and explicit diffs, so the staleness did not affect any finding.

Prior findings

ID Status Evidence
C1 RESOLVED mt_dependent_exemptions_person.py:30 now reads dependent_gross_income. A 2022 dependent with $3,000 of wages now gets $0, and the $2,580, $2,710 and $2,960 limits pass at the limit and fail $1 above it. The fixtures no longer override irs_gross_income.
C2 RESOLVED excludes_short_term_gains.yaml is deleted and nothing references it. The formula applies IRC 1222(11) in every year (nm_net_capital_gains_deduction.py:25-26), and the 2022 case expects $4,000 (nm_net_capital_gains_deduction.yaml:127).
A1 RESOLVED Four joint households at ar/tax/income/integration.yaml:398, 436, 476, 509 cover the regular table ($904.16), the low income table ($135), and zero and negative combined income ($0). They include ar_low_income_tax_joint.
A2 RESOLVED Four joint cases at nm_net_capital_gains_deduction.yaml:145, 166, 188, 208 give $6,000, $0, $0 and $3,200. Each result differs from what a per-spouse calculation would give.

Critical (Must Fix)

  1. [C3] Montana's dependent income test uses federal gross income, not Montana's definition. Switching to dependent_gross_income follows the prior review's suggestion and fixes the always-pass defect in C1. However, that shared measure differs from Montana "gross income" (MCA 15-30-2101(10), which applies to 15-30-2114(5)(a)) in three ways.

    Each example below is for 2022: an adult dependent who is not a qualifying child, claimed by a taxpayer (the tax-unit head) with $50,000 of wages.

    • Unemployment compensation (UC). Montana gross income is IRC 61 gross income "excluding unemployment compensation." A dependent with $3,000 of UC gets $0 instead of $2,710, which overstates MT tax by $182.92. Sources: MCA 15-30-2101(10) and the 2022 Form 2 instructions, p.7 and p.21.
    • Social Security (SS). Only the taxable share under IRC 86 is gross income, but dependent_gross_income.py:4-7 substitutes total social_security. A 70-year-old parent with $12,000 of SS has provisional income of $6,000, below the $25,000 base, so none of it is taxable. The parent still gets $0 instead of $2,710, which overstates tax by $182.93. Sources: 26 USC 86 and Pub. 501, p.19.
    • Capital losses. Gross income counts gains but not losses, while capital_gains nets short- and long-term amounts before the floor at dependent_gross_income.py:35. A dependent with $3,000 of long-term gains and $2,000 of short-term losses shows $1,000 of gross income and gets $2,710 instead of $0. That understates tax by $182.92, where the merge base returned the correct $0. Source: Pub. 501, p.2.

    All three are classified as critical because each is a verified wrong Montana value from the income-test branch this PR adds. The SS and capital-loss behavior comes from the shared variable, but Montana reaches it only through this change.

    Location: policyengine_us/variables/gov/states/mt/tax/income/exemptions/dependent/mt_dependent_exemptions_person.py:30.

    Suggested fix: a narrow Montana-specific measure keeps the rest of the fix intact.

    • Start from dependent_gross_income and subtract the dependent's unemployment_compensation. This is exact for 2021–2023, because all UC was federally included in those years.
    • Count only the IRC 86 taxable share of SS, computed on the dependent's own income with the $25,000 single base. At a minimum, exclude SS when provisional income is below the base.
    • Floor long_term_capital_gains and short_term_capital_gains separately instead of netting them.

    Changing the shared variable instead would also change federal qualifying-relative and head-of-household results. An MT-local adjustment plus a tracking issue may therefore be simpler.

    Add tests for a UC-only dependent, an SS-only parent (pin is_tax_unit_head on the taxpayer) and a long-term gain with a short-term loss. The existing parent case at mt_dependent_exemptions_person.yaml:126 has $0 of income. Consider also citing MCA 15-30-2114(5)(a) and 15-30-2101(10).

Should Address

  1. [A3] Montana tests cover only 2022 wages and a supplied qualifying-child flag. Every case in policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/exemptions/mt_dependent_exemptions_person.yaml supplies is_qualifying_child_dependent, and the only full boundary set is for 2022. Add these cases:

    • 2021: $2,580 gives $2,580, and $2,581 gives $0 (2021 instructions, p.13).
    • 2023: $2,961 gives $0 (2023 instructions, p.16).
    • A derived qualifying-child pair: a 22-year-old with $5,000 of wages and no flag input gets $2,710 as a full-time student and $0 otherwise.
  2. [A4] One test case covers the New Mexico gate removal. Only the 2022 case at policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/nm_net_capital_gains_deduction.yaml:127 separates the new code from the deleted gate. Add these cases:

    • 2021, $10,000 long-term plus $5,000 short-term gains: $4,000 (the old code gave $6,000).
    • 2021, $10,000 of short-term gains only: $0 (the old code gave $4,000).
    • A 2024 regression guard with $10,000 long-term plus $5,000 short-term gains: $4,000.

    The rule's source is HB 6 §59(A), p.105.

Suggestions

  1. [S1] New Mexico citation precision.
    • The comments at nm_net_capital_gains_deduction.py:12,22 and nm_net_capital_gains_deduction.yaml:78-79 cite 7-2-34(D) "in every supported year." From 2025, 2024 HB 252 §8 moved the definition to subsection (C) (p.30; applicability §42(B), p.147). The rule is unchanged, so only the subsection letter needs a year range.
    • Cite HB 6 §59(A) (p.105) for "since 2019."
    • Relabel the quote at yaml:80-82 as PIT-1 line 15 text (2023, p.32). It is not PIT-ADJ text.
  2. [S2] Reference completeness.
    • Add the 2021 (p.13) and 2023 (p.16) Form 2 dependent pages next to the 2022 reference at mt_dependent_exemptions_person.py:10-13.
    • The comment at policyengine_us/tests/policy/baseline/gov/states/ar/tax/income/integration.yaml:393-396 cites "(AR1000F instructions)" with no year or page. Cite the 2024 instructions, p.12 instead.
  3. [S3] Montana fixture clarity.
    • Adult-dependent fixtures need is_tax_unit_spouse: false, because dependent_gross_income.py:29 masks income by ~is_tax_unit_head_or_spouse. Without that input, the adult is inferred as the spouse and the test silently passes: $3,000 of wages gives $2,710. A one-line comment would keep the override from being removed.
    • The test at mt_dependent_exemptions_person.yaml:175 uses is_qualifying_child_dependent: false to mean "not a child." Its name or comment should say the person is not the taxpayer's child, for example a parent.
  4. [S4] Arkansas test hardening.
    • The final ar_income_tax: 0 at integration.yaml:509 would also result under a per-spouse floor. A joint case with $30,000 of wages and a −$45,000 spouse loss would catch that on the final tax: the correct result is $0, while a per-spouse floor gives $396.75.
    • Two more cases would add protection: one with the loss on the head instead of the spouse, and one in 2021 that confirms partnership_s_corp_income is in the earlier source list.
  5. [S5] PR description. The summary table still lists New Mexico "Years: 2023+". The code and changelog now apply the rule in every year since 2019.

Pre-existing issues (not introduced by this PR; non-blocking)

  • [P1] Montana: permanently and totally disabled adult child. mt_dependent_exemptions_person.py:26 identifies qualifying children by age and student status only, so it misses IRC 152(c)(3)(B). A 2022 dependent aged 30 who is permanently and totally disabled, has is_disabled, and earns $5,000 in wages gets $0. The law gives $5,420, so MT tax is overstated by $365.85.
    • The merge base also returned $0. This PR routes the person into the new income test instead.
    • Fix: qualifying_child = is_qualifying_child_dependent | (is_tax_unit_dependent & is_permanently_and_totally_disabled). This mirrors is_qualifying_relative_dependent.py:29-31.
    • Sources: 2022 Form 2 instructions, p.14 and p.15; 26 USC 152.
  • [P2] New Mexico: capital gain distributions omitted. nm_net_capital_gains_deduction.py:20 reads only long_term_capital_gains. Distributions in non_sch_d_capital_gains are long-term gains under IRC 852(b)(3)(B), so they belong in the IRC 1222(11) net capital gain. A 2023 single filer with $5,000 of distributions gets $0 instead of $2,000.
    • Adding "non_sch_d_capital_gains" to that add() list fixes it without double counting.
    • Sources: HB 6, p.41; 26 USC 852.
  • [P3] New Mexico: base for married filing separately. nm_net_capital_gains_deduction.py:28-34 halves each separate unit's own deduction. §14(B) halves the deduction "allowed on the joint return."
    • 2023, $2,000 of long-term gains for each spouse: $500 each, where the law gives $800 each.
    • 2023, +$20,000 for one spouse and −$15,000 for the other: $4,000 and $0, where the law gives $1,000 each. The couple claims twice the $2,000 joint deduction.
    • The fix requires combining gains across the marital unit. If that is out of scope, document the limitation.
    • Sources: HB 6, p.41; 2023 PITbook, p.53.
  • [P4] Arkansas: joint filing is mandatory when a spouse has negative income. ar_files_separately.py:66-72 picks the separate path whenever it is cheaper. The instructions say: "IF ONE SPOUSE HAD A TOTAL NEGATIVE INCOME, YOU MUST FILE MARRIED FILING JOINTLY."
    • 2024, $27,850 of wages and a −$10 spouse partnership loss: the model files separately for $405.59. The required joint return owes $412: $470 from the low income table less $58 of personal credits.
    • The PR moves the $28,450/−$300 case from joint ($344.05) to separate ($442.70, against $443). The remaining $0.30 is formula rounding only.
    • The rule is now enforceable, because ar_agi_joint carries signed spouse income.
    • Sources: 2024 instructions, p.12 and p.29.
  • [P5] Arkansas: tax formula instead of the tax table. integration.yaml:398 asserts $962.16 and $904.16, computed by formula. The 2024 table's 35,100–35,200 band gives $961, which yields $903 after credits (p.31). The model uses this convention everywhere in Arkansas; the gap is at most about $2.45 below $100,000. Optionally, note the table value in the test comment.

Verified correct

  • Montana:
    • The dependent income limits equal each year's exemption amount: $2,580, $2,710 and $2,960.
    • <= matches "not … more than."
    • Qualifying children skip the income test.
    • Wages and interest are added together.
    • A disabled child gets two exemptions, totaling $5,420 (p.15).
    • The exemption ends in 2024.
  • New Mexico:
    • The deduction is the greater of min(NCG, $1,000) and 40% × NCG, with IRC 1222(11) netting (HB 6, pp.40–41). It applies from 2019 (§59(A)), which the 2023 and 2024 books confirm.
    • The 2022 case gives $4,000.
    • Joint netting uses the couple's combined amounts.
    • No references to the deleted parameter remain.
  • Arkansas: the new cases check out against the 2024 booklet:
    • combined Column A income;
    • the joint low income table: $283 at 26,001–26,100, with a $28,300 ceiling (p.29);
    • the $29 personal credit (p.12);
    • the additional credit of $45 × 2 (p.25).

PDF Audit Summary

Category Count
Confirmed correct 22
Mismatches (code-path + visually verified, introduced) 3
Mismatches rejected 0
Unmodeled items 3
Pre-existing issues 5
  • Confirmed correct: 9 Montana and 13 New Mexico rules and values, including the external 2021 and 2023 Montana limit check. The Arkansas test inputs were also checked against the 2024 booklet.
  • Mismatches: all 8 queued mismatches passed both code-path tracing and independent 600-DPI source verification, and none were cleared. Three are introduced (C3) and five are pre-existing (P1–P5).
  • Unmodeled items: these are unchanged and not counted as findings:
    • New Mexico's bar on combining the deduction with the Venture Capital Investment Act credit (§14(C));
    • Montana's support, relationship and physician-certification tests, which is_tax_unit_dependent and is_disabled approximate;
    • Pub. 501's gross-receipts treatment of business, rental and partnership income.

Validation Summary

Check Result
Regulatory Accuracy C1 and C2 resolved; C3 is new (Montana gross-income scope); 5 pre-existing issues
Reference Quality All 3 new references verified (correct file-page anchors); 2 non-blocking suggestions (S1, S2)
Code Patterns 10 of 10 categories pass; no dangling references to the deleted parameter; no new hard-coded values
Formatting Changed Python files parse; changelog fragment is top-level and updated
Test Coverage A1 and A2 resolved; the three changed YAML files pass locally (44/44); gaps in C3, A3 and A4
PDF Value Audit 22 confirmed; 3 introduced mismatches; 0 rejected; 5 pre-existing
CI Status Passing (37/37)

Model runs on the reviewed head reproduced every model value above. No repository files were edited.

Review Severity: REQUEST_CHANGES

Next Steps

Apply the narrow Montana refinement in C3 and add the A3 and A4 cases. P1–P5 can be addressed here or tracked separately.

To auto-fix issues: run the fix-pr workflow for this PR.

@PavelMakarchuk PavelMakarchuk 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 for the quick turnaround. All four findings from my previous review (C1, C2, A1, A2) are resolved; full incremental re-review here: #9585 (comment)

One new item is blocking:

  • C3: The Montana dependent test now uses dependent_gross_income, which follows the federal gross-income definition. Montana's own definition differs in three ways: it excludes unemployment compensation (MCA 15-30-2101), counts only taxable Social Security, and counts gains without netting losses. Each case moves 2022 MT tax by about $183. You followed my earlier suggestion here, so this is a narrow refinement to that fix: a Montana-specific gross-income measure.

The five pre-existing items in the report are non-blocking: the MT disabled adult child, NM capital gain distributions, the NM MFS base, AR mandatory joint filing, and AR formula vs table.

DTrim99 and others added 3 commits September 29, 2026 12:50
Test Montana's non-child dependent exemption against a new
mt_dependent_gross_income (MCA 15-30-2114(5)(a) and 15-30-2101(10)):
federal gross income excluding unemployment compensation, counting only
the IRC 86 taxable part of Social Security on the dependent's own income,
and flooring long- and short-term gains separately instead of netting.
Also count a permanently and totally disabled adult child as a qualifying
child, count New Mexico capital gain distributions, and fix docs and tests
from the review.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
AR conflict: kept main's 2016-2018 unemployment cases and the PR's partnership/S-corp case in ar_gross_income_indiv.yaml, and added partnership_s_corp_income to main's new 2015-01-01 gross income source blocks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
With one spouse's loss now offsetting the other's income, the summed
ar_agi_joint can be negative. Main's medical, casualty loss and
miscellaneous joint deductions multiply that total by their AGI floor rate,
so a negative total enlarged each deduction beyond the expense. Floor the
total at zero, as the federal deductions do with positive_agi.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
@DTrim99

DTrim99 commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator Author

Fixes applied (57a635e, merge 78624a8, b584e8b): Pavel's re-review

C3 (blocking), Montana-specific dependent gross income: the non-child dependent test now uses a new Person variable, mt_dependent_gross_income, in place of the federal dependent_gross_income. It follows MCA 15-30-2114(5)(a) and 15-30-2101(10):

  • federal IRC 61 gross income, excluding unemployment compensation;
  • only the IRC 86 taxable part of Social Security, computed on the dependent's own income with the single $25k/$34k base (from the existing federal parameters, no literals);
  • long- and short-term gains each floored at zero, not netted.

Six 2022 cases reproduce your tax effects exactly: −$182.92 (unemployment), −$182.93 (Social Security) and +$182.92 (capital losses), each being 2,710 × 6.75%. ARM 42.15.403 is cited without subsection numbers because both copies blocked download; the two MCA sections are confirmed word for word.

Pre-existing items fixed here, in files this PR changes:

  • P1: a permanently and totally disabled adult child now counts as a qualifying child, getting the $5,420 exemption (−$365.85 of tax) where it was $0.
  • P2: New Mexico now counts capital gain distributions ($2,000 where it was $0).

Also:

  • Tests and docs: A3, A4, S3 and S4 tests; S1 and S2 docs; the changelog; and the PR description (the Montana measure, the stale irs_gross_income bullet, and the New Mexico wording).
  • Merge with main: the only conflict was cases appended at the end of ar_gross_income_indiv.yaml, and both sides' cases are kept. main added a 2015 block to the AR gross-income source lists, and the merge adds partnership/S-corp income to it, so the PR's fix covers every year. main's AR formula edits were reference-only.
  • New bug from the merge, fixed in its own commit (b584e8b): now that a spouse's loss can offset on a joint return, the couple's combined AGI can be negative. Three AR joint itemized deductions (medical, casualty, miscellaneous) use a percentage of it as a floor, so a negative AGI made each deduction larger than the expense ($1,000 of medical expenses produced a $1,500 deduction). Combined AGI is now floored at zero in those floors, as the federal deductions do, with one test per deduction. It's a separate commit so it can be reviewed or dropped on its own.

Follow-ups filed:

Verification: Arkansas income tax passes 475/475, Montana exemptions 57/57 and New Mexico deductions 84/84, all run after the merge. No existing expected value changed, ruff format is clean, and no partner tests were touched. The branch is even with main.

PavelMakarchuk added a commit that referenced this pull request Oct 5, 2026
…income

#9585 already adds partnership_s_corp_income to
Arkansas line 19. Drop it here to avoid duplicate work, and keep the parts
#9585 does not cover: estate_income (line 19) and farm_operations_income
(line 20, Schedule F).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PavelMakarchuk added a commit that referenced this pull request Oct 5, 2026
* Count pass-through, estate and Schedule F income in Arkansas gross income

AR1000F line 19 covers partnership, S corporation, estate and trust income
reported on Schedule E, and line 20 is Schedule F farm income. Add
partnership_s_corp_income, estate_income and farm_operations_income to both
Arkansas gross income source lists in every period. Fixes #9793.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Leave partnership/S-corp income to #9585; keep estate and Schedule F income

#9585 already adds partnership_s_corp_income to
Arkansas line 19. Drop it here to avoid duplicate work, and keep the parts
#9585 does not cover: estate_income (line 19) and farm_operations_income
(line 20, Schedule F).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
DTrim99 and others added 2 commits October 12, 2026 11:14
Resolve the Arkansas gross income source lists against main's estate,
Schedule F and gambling income additions, keeping this branch's
partnership and S-corporation income on the same form line as estate
income, and keep both sides' gross income tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
… return

mt_agi_joint pooled every tax unit member's Montana additions and
subtractions, but a dependent's federal AGI is not on the filer's return
(adjusted_gross_income_person is zero for dependents). A dependent's
subtraction, such as unemployment compensation, therefore lowered the
filer's Montana AGI and, since main's PolicyEngine#9903, the joint standard
deduction. Pool additions and subtractions over the head and spouse only.

The adult-dependent exemption case had pinned the leaked AGI of 47,000;
under the law the filer's Montana AGI is 50,000 and the tax is 1,731.65.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 12, 2026
…me-tax-table

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 12, 2026
…plit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
Keep both the joint negative-AGI medical deduction case and main's
self-employed premium case (PolicyEngine#10055).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 12, 2026
…me-tax-table

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 12, 2026
…plit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
@DTrim99
DTrim99 requested a review from hua7450 October 12, 2026 20:00
Main's code-health test pins the AR1000F line for every Arkansas gross
income source. Partnership and S-corporation income is reported with
Schedule E income: line 18 for 2015-2017 and line 19 from 2018.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 13, 2026
…me-tax-table

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 13, 2026
…plit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH

@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.

[P2] Preserve deductible losses when calculating the dependent's taxable Social Security

In policyengine_us/variables/gov/states/mt/tax/income/exemptions/dependent/mt_dependent_gross_income.py:64-68, provisional_income reuses other_gross_income, whose components were floored at zero on line 49. That drops deductible capital losses from the Social Security calculation. The positive-only gross-income total for Montana's dependent test and the modified adjusted gross income used by IRC 86(b)(2) need separate treatment.

Local 2022 reproduction: a non-child dependent has $26,000 unemployment compensation, $10,000 Social Security, and a $3,000 long-term capital loss; the filer has $50,000 wages, and the dependent is not the spouse.

  • Social Security MAGI is $23,000; adding half the benefits gives provisional income of $28,000 and taxable Social Security of $1,500.
  • Montana excludes the unemployment compensation, leaving $1,500 of dependent gross income, below the $2,710 exemption threshold.
  • The PR instead computes $3,000 of dependent gross income and denies the $2,710 exemption.

On this branch, the existing dependent_taxable_ss_magi and dependent_taxable_social_security variables already return the correct $23,000 and $1,500. Please reuse dependent_taxable_social_security for this component, retaining the positive-only non-Social-Security gross-income components and Montana's unemployment exclusion. Add coverage to the corresponding gross-income and exemption YAML files.

Validation: 127 changed-file cases passed; two independent cases reproduce the incorrect gross income and denied exemption. The affected runtime code and dependencies are unchanged on reviewed head a434b88b17d5b2e084de7e97005e56058448af3b.

…ncome

mt_dependent_gross_income recomputed taxable Social Security itself and
floored every income component at zero before forming provisional income,
so a dependent's capital loss never lowered taxable Social Security. A 2022
dependent with $26,000 of unemployment compensation, $10,000 of Social
Security and a $3,000 long-term loss got $3,000 of Montana gross income and
no exemption, instead of $1,500 and the $2,710 exemption.

MCA 15-30-2101(10) defines Montana gross income as IRC 61 gross income
excluding unemployment compensation, and the 2021-2023 Form 2 instructions
name no other difference. Since PolicyEngine#9691 the federal dependent_gross_income
counts gains but not losses and only the IRC 86 taxable part of Social
Security, figured on the dependent's own modified AGI (which nets capital
losses, subtracts the dependent's adjustments and uses the $0 base for a
dependent living with a spouse). Montana gross income is now that amount
minus the dependent's unemployment compensation, which removes the
duplicated IRC 86 code and its approximations.

Adds the capital-loss case to both MT dependent test files and drops a test
comment that described the pre-PolicyEngine#9691 federal treatment of Social Security.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
@DTrim99

DTrim99 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

Fixes applied (6fea3d2)

Should-address

  • @hua7450 P2: a dependent's capital loss was dropped from IRC 86 provisional income. mt_dependent_gross_income is now the federal dependent_gross_income minus the dependent's unemployment compensation (MCA 15-30-2101(10); unemployment compensation is the only Montana difference, which I also checked against the 2021-2023 Form 2). Since Count only taxable Social Security and gross gains in the qualifying-relative income test #9691, the federal variable counts only taxable Social Security and floors long-term and short-term gains separately. The duplicated IRC 86 code is gone. Your repro is now a case at the bottom of both mt_dependent_gross_income.yaml and mt_dependent_exemptions_person.yaml: MAGI 23,000, taxable SS 1,500, Montana gross income 1,500, exemption 2,710. The old formula gives 3,000 and denies the exemption.
  • Axiom line: added. It links three dispatch-ready pe-parity issues: rulespec-us#1753 (AR), Fix MO WFTC year #1754 (MT) and Add out of pocket medical expenses and health insurance premiums from CPS #1755 (NM).

Suggestions

Also since the last review

  • Merged main. Main's new Arkansas line-comment check now includes partnership and S-corporation income: line 18 for 2015-2017, line 19 from 2018.

Verification

@DTrim99
DTrim99 requested a review from hua7450 October 13, 2026 14:55
@DTrim99
DTrim99 merged commit 815ba0b into PolicyEngine:main Oct 13, 2026
26 checks passed
DTrim99 added a commit that referenced this pull request Oct 13, 2026
Keep main's California SSP values in spm_unit_benefits.yaml alongside the
modeled-UI case, and route the two unemployment compensation readers that
main added through total_unemployment_compensation: the Montana dependent
gross income subtraction (#9585) and the Montana elderly credit add-back,
so they match dependent_gross_income and count modeled state UI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 13, 2026
#9585 landed as a squash commit; keep this branch's New Mexico deduction
and tests, which build the separate-filer split on top of it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
DTrim99 added a commit that referenced this pull request Oct 13, 2026
#9585 landed as a squash commit; keep this branch's tax-table band and
mandatory joint filing expectations in the Arkansas integration cases.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
MaxGhenis added a commit that referenced this pull request Oct 14, 2026
Resolves the conflict in ar_misc_deduction_joint.py with main's #9585:
the miscellaneous pool keeps this branch's sources list, and Arkansas AGI
keeps main's floor at zero.

Co-Authored-By: Claude Opus 5.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.

3 participants