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.
…aders Apply each filer's US government interest classification on the Person record, floored at zero and capped at federally included interest and dividends, so the section 135 exclusion is not subtracted twice and a negative classification cannot offset another subtraction. The Montana Social Security worksheets go back to federal provisional income. Correct the 2025 rate-shortcut note in source_conflicts/candidates.yaml, rename the QBI case to say it pins the Montana add-back, and move the bond fixtures to the Montana subtractions tests. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
source_conflicts/candidates.yaml: Keep the 2025 rate-table rounding note and the surviving-spouse standard deduction entry. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DTrim99
left a comment
There was a problem hiding this comment.
Program review
Base repository: PolicyEngine/policyengine-us
PR number: 10772
Reviewed head SHA: 299a776
Merge base SHA: 8e81d66
Mode: incremental from 71a4484
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10772-review-sources.json
Review status: COMPLETE
Source Documents
- mt2024instr.pdf — cached original.
- mt2025instr.pdf — cached original.
- mca_15-30-2120.html — cached original.
Critical
None.
Should Address
None.
Suggestions
S1 — The new variable cites only the 2024 form line, though it computes 2025 and 2026 too (OPEN)
- Location.
policyengine_us/variables/gov/states/mt/tax/income/subtractions/mt_us_govt_interest_subtraction.py,referencetuple and the comment above it. - Trigger. Anyone tracing the 2025 or 2026 subtraction from the variable.
- Expected vs observed. Expected the 2025 instructions PDF p. 23 (Schedule I line 9) next to the 2024 PDF p. 25 (line 11). Observed: only the MCA and the 2024 p. 25 link. The 2025 link appears only on the parameter and in its list comment.
- Impact. Documentation only. The MCA citation covers every year.
- Source. 2025 Form 2 instructions PDF p. 23, line 9 (quoted above).
- Proposed severity. SUGGESTION.
S2 — The PR body's description of the new variable omits the supplied-AGI branch (OPEN)
- Location. PR body, "Changes", the
mt_us_govt_interest_subtractionbullet. - Trigger. A caller who supplies
adjusted_gross_income. - Expected vs observed. The bullet says the formula "caps it at the person's federally included interest and dividends". Since a18d3fc, that cap does not apply when AGI is supplied. The changelog says so ("including when callers supply federal adjusted gross income directly"); the body does not.
- Impact. Documentation only.
- Proposed severity. SUGGESTION.
Evidence Gaps
No material gaps reported.
Notes
- Round 2 covers the two author commits since the 11-13 review (3d669b4 and a18d3fc) and the two merges of main.
- Critical 1 (§ 135 interest subtracted twice): RESOLVED.
-
- The new
mt_us_govt_interest_subtractionnets each filer'sus_bonds_for_higher_edagainst that filer's classified US interest, spreads any exclusion entered on a dependent student over the filers, and caps at included interest plus dividends. Summed over the return, it equals the US interest left in federal AGI, which is what MCA 15-30-2120(3)'s "not already excluded" lead-in allows.
- The new
-
- Executed at the head: the 2024 single filer with $50,000 of wages and $5,000 of excluded EE interest now gets Montana taxable income of $35,400 and tax of $1,842.60, the same as main. The case is in
mt_taxable_income.yaml, with partial-exclusion, student, spouse and supplied-AGI cases.
- Executed at the head: the 2024 single filer with $50,000 of wages and $5,000 of excluded EE interest now gets Montana taxable income of $35,400 and tax of $1,842.60, the same as main. The case is in
- Social Security readers (3d669b4): from 2024 Montana's taxable Social Security is the federal amount. That matches the 2024 instructions (p. 5, "as calculated for federal tax purposes"), and 15-30-2120 has no Social Security adjustment from 2024. The helpers feed only the legacy
mt_agi_*outputs, so 2024+ tax is unchanged. - Supplied federal AGI (a18d3fc): when
adjusted_gross_incomeis an input, the cap at included interest and dividends is dropped, while the head/spouse mask and the § 135 netting stay. The default dataset doesn't supply AGI, so microsimulations always take the capped branch. - Suggestions: 1, 4 and 5 are resolved. 2 is resolved in the PR body except the Python test's CI timing.
- Suggestion 3 is still open and now inaccurate: the body says #10713 merges cleanly, but
git merge-treeagainst #10713's head (8d9f794) now conflicts inmt_subtractions.py, where both PRs edit the label and references. The conflict is trivial; please update the note. - Not traced: how a dependent student's § 135 exclusion splits between spouses under
enable_mt_mfss_2024_reform. The return total is unchanged, so baseline results don't depend on it. - The axiom line remains valid: rulespec-us#2148 is open and labelled
pe-parity, and the TY2026 RuleSpec reads the netted amount as an input.
Validation Summary
Local tests at the reviewed head (review venv, policyengine-core 3.37.2, matching uv.lock; imports resolved to the snapshot): all 94 Montana income tax YAML files (882 cases) reported a pass before the runner stopped at its 540 s deadline without printing pytest's summary line; the Python test passed in a second invocation. Diagnostics executed the § 135, student, spouse and supplied-AGI households on the head and main. Sources: MCA 15-30-2110 and 15-30-2120 and the 2024 and 2025 Form 2 instructions; manifest check passed. CI: 35/35 checks pass at 299a776.
Timing
setup seconds: 5.00s; scope seconds: 60.00s; parallel review seconds: 696.20s; policy role seconds: 500.70s; code role seconds: 696.20s; adjudication seconds: 90.00s; consolidation cleanup seconds: 56.70s; elapsed seconds: 975.00s
Review Severity
APPROVE. Open findings: 0 critical, 0 should address, 2 suggestions.
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.The Main column shows the original
Simulationresults at 61d9e85. The This PR values still hold with main merged in: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: addmt_us_govt_interest_subtractionto 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).mt_us_govt_interest_subtraction(Person): from 2024, Montana subtracts federally included US government interest and attributable dividends. The formula floors the classification at zero, caps it at the person's federally included interest and dividends, and accounts for section 135 exclusions recorded anywhere on the return. State US-government-interest subtractions exceed the interest in federal income (dependents, §135 exclusion, unchecked inputs) #10780 tracks the corresponding limits in other states.subtractions/mt_subtractions.yaml(moved frommt_us_govt_bond_interest.yaml): each case enters the interest as taxable interest too. The 2024 case expects 5,000, and a 2025 case also expects 5,000.mt_taxable_income.yaml: 23 Form 2 cases for 2024–2026. Most cases compute the federal base from household inputs (wages, medical expenses, mortgage interest, taxes paid, interest) and run through the federal model, so they also check which federal amounts Montana reads. The QBI case supplies the $10,000 federal deduction and checks Montana's add-back. Comments carry the worksheet and Form 2 arithmetic.mt_taxable_social_security.pyandmt_taxable_social_security_joint.py: from 2024 the direct Montana Social Security helpers take the federal taxable benefit amounts, so the new subtraction no longer lowers provisional income. A new case inmt_taxable_social_security.yamlpins it.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
This PR also checks 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). The next two bullets describe the original 15 cases on main at 61d9e85:mt_taxable_income.yamlpass on this branch with main merged in.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_jointandmt_agi_indivalso read it (from 2024 the two taxable Social Security helpers take the federal taxable benefit amounts instead), 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.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.yaml, three insubtractions/mt_subtractions.yaml, and the new case inmt_taxable_social_security.yaml.mt_historical_parameters.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. The generator uses valid interest classifications; YAML covers inconsistent inputs and the section 135 exclusion.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
Not measured. Inferred:
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. Validation used household cases.Coordination
source_conflicts/candidates.yaml. Before Tax railroad retirement benefits federally, exempt them from state income tax, and count them in program income #10696 merged main on 2026-11-30, it conflicted with this branch in 12 files.mt_taxable_social_security_joint.py, and Count railroad benefits in state tax worksheets, income tests and limits as each state's law does #10722 also changesmt_taxable_social_security.yaml.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–2025The 2026 RuleSpec pipeline takes the eligible amount at the tax-unit level; the TY2024–2025 follow-up requires the federal inclusion limit.
🤖 Generated with Claude Code