Repository navigation
Conversation
MCA 15-30-2120(3)(b)(i) subtracts interest from obligations of the United States government from federal taxable income. The model's 2024 and 2025 subtraction lists omitted us_govt_interest_person, so from 2024 it taxed that interest (2024 Form 2 Schedule I, Part I, line 11; 2025 line 9). Restore it in both lists and correct the 2024 expectation in mt_us_govt_bond_interest.yaml, which recorded the bug. Add mt_taxable_income.yaml: end-to-end Form 2 cases for 2024-2026, hand computed from the forms and the revised Worksheet A / Worksheet B, run from household inputs through the federal model. Add test_mt_us_govt_interest_subtraction.py, a Hypothesis test of three invariants for 2024-2026: Montana taxable income falls by exactly min(u, taxable income before the subtraction) when the head or spouse holds the bonds and not at all when a dependent does; Montana tax does not rise; Montana taxable income stays nonnegative. Fixes #9707. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ding Review follow-ups for #9707: - Bond interest cases now enter the interest as taxable interest too, the model's input contract. - The property test runs a third, no-interest variant and derives the US interest that federal AGI includes, replacing the hard-coded dependent rule; it also checks that federal taxable income matches across variants and allows float32 rounding at the compared magnitude, since the 2025-2026 senior deduction phase-out leaves cents. A senior case with cents joins the pins. - New 2026 Form 2 case for the subtraction; corrected the medical comment (the repealed 2023 schedule also floored medical at 7.5% of Montana AGI). - Comment on the subtraction list and the test docstring point to #10780 for the (3) lead-in's inclusion limit. - source_conflicts/candidates.yaml: us-mt:rate-table-offset-rounding, the 2025 rate table's whole-dollar offsets against the statute's brackets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Interest excluded under 26 U.S.C. 135 satisfies u <= taxable interest, so the contract also needs "none of it excluded under section 135" (review nit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Review: Subtract US government interest from Montana taxable income from 2024SummaryThe PR fixes #9707. From 2024 the model stopped subtracting interest on US obligations from Montana taxable income. The PR:
I researched the law before reading the code:
The code reuses the existing One finding is critical. Interest that federal AGI already excluded under 26 U.S.C. 135 is subtracted a second time. I ran no Python or tests. Each claim rests on one of these:
Critical (must fix)1. The subtraction removes interest that federal AGI already excluded under §135 (
Fix, either way:
Don't cap the subtraction at Should addressNone. Suggestions1. Pin the dependent bondholder in YAML and reconsider the Python test (R, CI)
2. Fill in the PR body's pending items (CI)
3. Correct the coordination note. The note says #10713 "merges cleanly with this branch". Its 4. Relabel for the 2024+ base (optional). Both labels still describe the pre-2024 AGI base:
From 2024 these subtract from federal taxable income under 15-30-2120(3). (R) 5. Use a variable-named test file (optional). Verified correct
Axiom line assessmentThe line reads
Output 6 of the issue counts the subtraction "only 'to the extent they are included'" in federal taxable income. Once the Axiom module is encoded, it will diverge from PE on §135 households until Critical 1 is fixed. CI statusAll 36 checks pass at head Branch status
Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
Requesting changes: 1 critical, 0 should address, 5 suggestions (details in the report above). The subtraction itself matches MCA 15-30-2120(3)(b)(i) and the 2024 and 2025 Form 2 instructions. It reuses us_govt_interest_person, counts only the head and spouse, and all 17 hand checks match.
- Critical: § 135 education savings-bond interest is already left out of federal AGI by the
us_bonds_for_higher_edadjustment, and the PR subtracts it again. The (3) lead-in limits the subtractions to amounts "not already excluded as a deduction".- A 2024 single filer with $50,000 of wages and $5,000 of EE bond interest should have Montana taxable income of $35,400 and tax of $1,842.60. The PR gives $30,400 and $1,547.60.
maingets this household right, so it's a regression in claimed years, even though the PR defers it to #10780.- Netting
us_bonds_for_higher_edout in the person-level subtraction, plus a YAML case, would fix it.
Fixes #9707.
What was wrong
MCA 15-30-2120(3)(b)(i) subtracts "interest from obligations of the United States government and exempt-interest dividends attributable to that interest" from federal taxable income. Form 2 reports the subtraction on Schedule I, Part I: line 11 in 2024 (instructions, PDF p. 25) and line 9 in 2025 (instructions, PDF p. 23). The 2024 and 2025 entries of
gov.states.mt.tax.income.subtractions.subtractionsleft outus_govt_interest_person, so from 2024 the model taxed that interest. The 2024 case inmt_us_govt_bond_interest.yamlexpected 0, so the suite recorded the bug.Each row below comes from a
Simulationrun on main (61d9e85) and on this branch:The 2025 tax column applies the brackets of MCA 15-30-2103(1) and (3): 5.9% less 253.20 single and 506.40 joint. The 2025 instructions' rate table (PDF p. 18) rounds those amounts to $253 and $506, which gives 1,767.75 and 2,355.50. This PR records the difference as source-conflict candidate
us-mt:rate-table-offset-rounding; the model and tests follow the statute.Changes
subtractions.yaml: addus_govt_interest_personto the 2024 and 2025 lists (2026 uses the 2025 list), with the statute and form line in comments, and cite MCA 15-30-2120(3)(b)(i). A comment notes the (3) lead-in's inclusion limit and points to State US-government-interest subtractions exceed the interest in federal income (dependents, §135 exclusion, unchecked inputs) #10780.mt_us_govt_bond_interest.yaml: each case enters the interest as taxable interest too. The 2024 case now expects 5,000, and a new 2025 case also expects 5,000.mt_taxable_income.yaml: 15 Form 2 cases for 2024–2026. Each starts from household inputs (wages, medical expenses, mortgage interest, taxes paid, interest) and runs through the federal model, so it also checks which federal amounts Montana reads. Comments carry the worksheet and Form 2 arithmetic.test_mt_us_govt_interest_subtraction.py: a Hypothesis test of the invariants below.source_conflicts/candidates.yaml:us-mt:rate-table-offset-rounding(see above).The rest of the 2024+ base
The task was to check Montana's whole 2024+ base. #10038 (merged 2026-11-07) rebuilt it from federal taxable income, with the QBI add-back (MCA 15-30-2120(2)(i)) and the capped state income tax add-back ((2)(j)). Its 2024+ cases, like main's other Montana cases, mostly enter federal amounts (
adjusted_gross_income,itemized_taxable_income_deductions,tax_unit_itemizes,salt_deduction,standard_deduction) as inputs. This PR's cases start from household inputs instead, with values hand computed from the 2024 and 2025 Form 2, the revised 2024 Worksheet A and the 2025 Worksheet B (instructions, PDF p. 22). On main:I also checked three things in the code:
mt_taxable_income_joint.formula_2024sumsmt_additionsandmt_subtractionsover the head and spouse only. That matches federal AGI:irs_gross_incomezeroes every income source of a tax-unit dependent, so a dependent's interest never reaches the return.mt_interest_exemption_personis 0 from 2024, becausegov.states.mt.tax.income.exemptions.appliesis false from 2024.mt_subtractions.mt_agi_joint,mt_agi_indivand the two taxable Social Security helpers also read it, so for a household with US government interest the legacymt_aginow nets that interest too. None of them reaches 2024+ Montana tax:formula_2024reads none of them;mt_income_tax_before_refundable_credits_unittakes the joint computation, andmt_agi_indivapplies only wheremarried_filing_separately_on_same_return_allowedholds; that parameter turns false in 2024;mt_agi_jointreturn 0 or the federal amounts from 2024 (state_specific_deduction_appliesand the child care deduction'sin_effectturn false in 2024;misc_floor_appliesturned false in 2018);taxsim_state_agi, and its aliasstate_agi, report federal AGI for Montana from 2024 (states_using_federal_agi).Not in this PR
formula_2024reads none of them, so gating them changes no 2024+ tax.state_standard_deductionandstate_itemized_deductionsstill read them; Harmonize state_standard_deduction and state_itemized_deductions coverage #8275 and Montana: obsolete *_for_federal_itemization copies put a state-withholding proxy and the repealed federal-tax deduction into state_itemized_deductions (TAXSIM v35) #9806 track that.us_govt_interest_personas entered, so US interest entered above taxable interest, or excluded federally under 26 U.S.C. 135 (us_bonds_for_higher_ed), still reaches the subtraction. Consistent inputs (US interest within taxable interest, head or spouse) give the right answer, and a dependent's interest stays off the return. Several other states also subtract a dependent's US interest. State US-government-interest subtractions exceed the interest in federal income (dependents, §135 exclusion, unchecked inputs) #10780 covers all of it across states.mt_additionsholds onlymt_other_additions, an input, so the model leaves out, for example, interest on other states' bonds (MCA 15-30-2120(2)(a)). That needs its own issue.Tests
mt_taxable_income.yamland 3 inmt_us_govt_bond_interest.yaml.test_mt_us_govt_interest_subtraction.pypasses: a worked test for 2024–2025, then 10 derandomized Hypothesis examples plus 8 pinned households for 2024–2026.test_source_conflicts.pypasses with the new candidate.CI cost
test_mt_us_govt_interest_subtraction.pyis the only Python addition, and it builds one smallSimulationper example. It checks what the YAML cases can't: the invariants over generated household mixes (single and joint, dependent holders, partial US shares, the zero floor, seniors whose taxable income carries cents), and that federal taxable income stays equal across the classification variants.remaining-1(shard 4). That group ran 2,055 tests in 20:36 of wall time at a peak RSS of 9.75 GiB (GNU time's 10,226,288 KiB); the whole shard job took 25:43.Invariants
The test runs each household three times: the bondholder's taxable interest and US interest set to (I, u), (I, 0) and (0, 0). The inputs keep to the model's input contract: u ≤ I on the same person, with none of it excluded under 26 U.S.C. 135. Let TI₀ be Montana taxable income without the subtraction, and u_in = min(u, AGI(I) − AGI(0)), the US interest that federal AGI includes (u for a head or spouse, 0 for a dependent). For every household and each year from 2024 to 2026:
From 2025 the enhanced senior deduction phases out at 6% of MAGI, so taxable income can carry cents. Comparisons allow the larger of one cent and four float32 steps at the compared magnitude.
The pinned households cover the zero floor binding, a dependent holding the bonds, interior cuts (single and joint), and a senior whose taxable income carries cents. A wider local run of the same assertions also passed: 152 households a year (24 seeded draws of 6 households plus the 8 pinned). In 2024, 2025 and 2026 the floor bound 4, 3 and 3 times, a dependent held bonds 29 times each year, interior cuts occurred 7, 8 and 7 times, and taxable income carried cents 0, 2 and 2 times.
Microsimulation impact
Pending: 2025 and 2026, default dataset, main against this branch.
us_govt_interest_personhas no formula, and the certified default dataset (populace_us_2024.h5, sha2566496cc43…, which matchesDEFAULT_DATASET_SHA256) has no column for it among its 378, so every record's subtraction stays at 0. I'll replace this section with the measured results.Coordination
subtractions.yamland merges cleanly with this branch.subtractions.yaml's reference list. This branch also edits that end: it retitles the 2024 instructions reference and adds the MCA 15-30-2120(3)(b)(i) reference. Keeping both sides' entries resolves it.Axiom
axiom: MCA 15-30-2120(3)(b)(i) encoded-correct for TY2026 (rulespec-us
us-mt/policies/income_tax/resident_core_liability_pipeline.yaml, companiondirect title 15 modifications and state tax addback) | TheAxiomFoundation/rulespec-us#2148 queued for TY2024–2025🤖 Generated with Claude Code