Repository navigation
Conversation
…ption MCA 15-30-2120(3)(n) and (8), from tax year 2024: the lesser of half the return's military retirement pay or its Montana earned income (Form WMRE lines 2-5), plus half of military survivor benefits. An input records the section (9) residency and five-year conditions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… June 30, 2023) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's #10331 drops the disability income exclusion from Montana's subtractions for 2024 on, after SB 399 repealed it. This branch adds the working military retirement exemption to the same lists. The resolution keeps both: the exemption joins the 2024 and 2025 lists, the exclusion stays out, and the references keep both changes' sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
David, I'd like your read on two Montana choices here:
If you can look by Tuesday afternoon, we can merge it before the Veterans Day post (PolicyEngine/policyengine-app-v2#1523). |
PR Review: Model Montana's working military retirement and survivor benefit exemptionSummaryThe structure follows the law. MCA 15-30-2120(3)(n)(i) and (8)(a) give a retiree "the lesser of: (i) the amount of Montana source wage income on the return; or (ii) 50% of the taxpayer's military pension or military retirement income". (3)(n)(ii) gives "up to 50% of all income received as survivor benefits", with no earnings cap. (9) adds the residency and five-year conditions. The rates (0.5 and 0.5), the 2024 start, pooling the earnings cap over the return, carrying the return's amount on the head, keeping dependents out, the zero floor on each business source, and the per-person eligibility mask all match the statute, Form WMRE (2025) and its instructions. The exemption flows through the 2024+ federal-taxable-income path ( One critical problem remains. Two of the four earnings sources that set the cap are the wrong PolicyEngine variables:
Three should items remain: the PR's two statute-over-form readings have no source-conflict candidate entries; four new terms are unpinned by tests; and one reference title carries page text. On the two questions in the thread:
Critical (must fix)
Should address
Suggestions
Verified correct
Axiom line assessment
rulespec-us#2075 is OPEN and labelled
It records the encoding debt (the held It matches the head's behavior. Its output 4 is stated at the level of the law ("net income from a trade or business and net farm income"), so the Critical fix doesn't contradict it. When the fix lands, consider adding a farm companion test, such as "$30,000 of military retirement income and $40,000 of net farm income gives output 5 = 15,000". Also consider correcting "SB 124" (Suggestion 5). CI statusAt head 2eeb5d3, 36 checks pass and 7 are skipped, with none failing or pending. The passing checks include:
The head already includes main, so CI ran the merged tree. Locally on that tree:
Branch statusThe branch is 3 commits ahead and 0 behind main. #10331 (merged today) edited No file overlaps with the sibling military retirement PRs (#10702 UT, #10714 MI, #10715 ID, #10716 DE, #10717 ID). Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
Requesting changes per the review above: 1 critical (the earnings cap reads self_employment_income and farm_income, so it drops SSTB business income and Schedule F farm income that 15-30-2120(8)(b) counts, and counts a non-AGI input; use total_self_employment_income and farm_operations_income), 3 should (record two statute-over-form readings; four unpinned terms; a reference title), 5 suggestions.
MCA 15-30-2120(8)(b) counts net income from a trade, business, profession or occupation and net farming income. The cap read self_employment_income (non-SSTB Schedule C only) and farm_income (the Schedule J averaging input, outside AGI). A new earned_income_sources parameter lists irs_employment_income, total_self_employment_income, partnership_s_corp_income and farm_operations_income, and the formula loops over it with the per-source zero floor. Also records three readings as source-conflict candidates (Schedule E income, both subtractions on one return, the per-source loss floor), pins the 2024 subtractions entry, the partnership and farm sources, the filer mask on earnings and the eligibility mask on survivor benefits, adds the ARM 42.15.1510(3)(a) and (b) examples, documents the armed forces scope, passive income and when the eligibility default stops being exact, drops page text from the RIC memo title, adds the 2024 Form 2 instructions as a source for the 2024 start, and removes the stale Montana limitation from military_retirement_pay_survivors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… candidates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the source_conflicts/candidates.yaml conflict by keeping main's new entries and this PR's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pages 2 and 3 follow the form's column order, one paragraph or list item per line, and page 1 follows its visual reading order, so every quoted WMRE excerpt matches the capture verbatim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. 09ed698f28 makes the code, test and documentation changes below, and the later commits add the Form WMRE capture, merge main and reflow the capture. Critical
Should address
Suggestions
538c7c8cc3 merges main; its one conflict, in At ceb2f71, the 251 tests in |
DTrim99
left a comment
There was a problem hiding this comment.
Program review
Base repository: PolicyEngine/policyengine-us
PR number: 10713
Reviewed head SHA: ceb2f71
Merge base SHA: f2b6108
Mode: full, with a recheck of David's earlier review (head 2eeb5d3)
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10713-review-sources.json
Review status: COMPLETE
Source Documents
- mca-15-30-2120-current.html — cached original.
- mca-15-30-2120-2023.html — cached original.
- form-wmre-2025.pdf — cached original.
- arm-42.15.1501.html — cached original.
- arm-42.15.1510.html — cached original.
- ch0586-2025.pdf — cached original.
- ric-veteran-tax-benefits-2025.pdf — cached original.
- form2-instr-2024.pdf — cached original.
Critical
None.
Should Address
A1 — Wages and business income earned outside Montana count toward the cap with no recorded conflict or documentation (OPEN)
- Severity: SHOULD ADDRESS (repository source-conflict requirement; PolicyEngine can't model the condition)
- Location:
policyengine_us/parameters/gov/states/mt/tax/income/subtractions/military_retirement/earned_income_sources.yaml:5,8,13;policyengine_us/variables/gov/states/mt/tax/income/subtractions/military_retirement/mt_military_retirement_exemption.py:10-23(documentation);source_conflicts/candidates.yaml(no entry). - Statute vs. form:
- MCA 15-30-2120(8)(b) limits "Montana source wage income" to "(i) wages, salary, tips, and other compensation for services performed in the state; (ii) net income from a trade, business, profession, or occupation carried on in the state; and (iii) net income from farming activities carried on in the state".
- ARM 42.15.1501(2) adds that this definition "is not the same as the definition of Montana source income in 15-30-2101".
- The 2025 WMRE instructions (PDF p. 3) tell residents to enter "the total wages included on Form 1040, line 1z" (line 2) and "the total business income included on Form 1040, Schedule 1, line 3" (line 3), with no work-location test.
- What the PR does: It counts every head and spouse dollar of
irs_employment_income,total_self_employment_income,partnership_s_corp_incomeandfarm_operations_income, which is the form's reading. The PR body justifies this with "PolicyEngine-US models full-year residents, so all of the return's wages ... count as Montana source". That doesn't follow: a full-year resident can earn wages for services performed in another state. - Trigger: TY2026, a full-year Montana resident (eligible) with $30,000 of military retired pay and $40,000 of wages from a job physically performed in North Dakota or Wyoming (a commuter).
- Statute: (8)(b)(i) excludes those wages, so the subtraction is 0.
- Form and head: min(0.5 × 30,000, 40,000) = 15,000. This follows from the code: line 5's source is summed with no location input.
- Why it matters: CLAUDE.md line 141 and CONTRIBUTING.md#source-conflicts say to record every statute/form choice as a
source_conflicts/candidates.yamlitem in the ruling PR. The PR records three such readings but not this one, and the variable's documentation doesn't mention it. Since PolicyEngine-US has no input for where wages are earned, following the instructions is defensible. It just needs to be recorded. - Fix:
- Add a candidate, for example
us-mt:military-retirement-exemption-wage-location, with sources (8)(b), ARM 42.15.1501(2) and WMRE lines 2-3 (p. 3), andfollows: instructions(orgap-fill, with a note that no work-location input exists). - Add one sentence to the
mt_military_retirement_exemptiondocumentation. - No code change is needed. The affected group (residents who physically work out of state) is likely small.
- Add a candidate, for example
Suggestions
S1 — No YAML case asserts Montana taxable income or tax for the new exemption (OPEN)
-
Severity: SUGGESTION
-
Location:
policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/subtractions/mt_military_retirement_exemption.yaml(22 cases; the furthest output ismt_subtractions) -
Trigger: any eligible return, 2024+.
-
Expected vs observed: the behavior is correct, but nothing pins the step from
mt_subtractionstomt_taxable_income_jointandmt_income_tax. Diagnostics (executed,pr-10713-code-diagnostics.json), single, age 45, $30,000 retired pay, $50,000 wages, eligible vsmt_military_retirement_exemption_eligible: false:Year MT taxable income mt_income_taxChange 2024 50,400 vs 65,400 2,727.60 vs 3,612.60 885.00 = 15,000 × 5.9% 2025 49,250 vs 64,250 2,652.55 vs 3,537.55 885.00 = 15,000 × 5.9% 2026 48,900 vs 63,900 2,311.60 vs 3,159.10 847.50 = 15,000 × 5.65% Survivor, 2025, age 70, $20,000 benefits and $10,000 interest: tax goes from 27.73 to 0. Montana taxable income drops from 590 (taxable income 6,250 less the 5,660 old-age subtraction) to 0.
-
Remedy: add one end-to-end case, for example the 2026 row (
mt_income_tax: 2_311.6).
S2 — mt_other_subtractions documentation doesn't warn against entering the newly modeled exemption (OPEN)
- Severity: SUGGESTION
- Location:
policyengine_us/variables/gov/states/mt/tax/income/subtractions/mt_other_subtractions.py:11-16 - Trigger: a user who, while the exemption was documented as "not yet modeled" (the limitation this PR deletes from
military_retirement_pay.py), entered it inmt_other_subtractions. - Expected vs observed: the input's documentation lists what PolicyEngine computes separately ("Do not include interest exemptions, tuition subtractions, old age/disability exclusions, federal deductions, or state tax refunds ..."). The military retirement and survivor benefit exemption (Form 2 Schedule I Part I line 13, per Form WMRE line 8 and Part III line 2) is now computed too but isn't on the list, so such a household would subtract the amount twice.
- Remedy: add "the military retirement and survivor benefit exemption (Form WMRE)" to that sentence.
S3 — Say what the RIC memo's $24.8 million measures (OPEN)
- Severity: SUGGESTION
- Location:
policyengine_us/variables/gov/states/mt/tax/income/subtractions/military_retirement/mt_military_retirement_exemption_eligible.py:25-29. - Evidence:
- The memo's figures match the PR's documentation: RIC memo, November 2025, PDF p. 1, table "USE OF EXEMPTION ...": 1,711 residents, $24,754,179; total ">1,783", $25,530,804.
- But the memo's prose calls the total a "loss of revenue of $25.5 million".
- Inference: the figures must be exempted income, not tax. As revenue, $24.8 million over 1,711 residents would mean roughly $14,500 of tax each, or about $250,000 of exempted income each at Montana's top rate. That's impossible when the exemption is at most half of a military pension.
- Fix: Write "$24.8 million exempted" so nobody benchmarks the aggregate revenue change against it. This affects documentation only, with no computational effect.
Evidence Gaps
No material gaps reported.
Notes
- Earlier review: every item is resolved.
- Critical 1: the earnings cap now lists
irs_employment_income,total_self_employment_income,partnership_s_corp_incomeandfarm_operations_income, and drops the Schedule Jfarm_income. New cases pin SSTB (15,000), Schedule F (15,000), Schedule J (0) and loss netting (6,000). - Should 1: three candidates record the same-return, loss-floor and Schedule E readings. Their quotes match the WMRE and its capture.
- Should 2: each of the four terms is pinned, and removing any one flips a case.
- Should 3 and Suggestions 1-5 are done.
- On policy-1: the code follows the WMRE instructions (lines 2-3 take all Form 1040 wages and Schedule 1 line 3 business income). PolicyEngine-US has no input for where wages were earned, so that is a defensible choice, but CONTRIBUTING asks the PR that takes the reading to record it. MCA 15-30-2120(8)(b) counts only "Montana source wage income": services performed in the state, and business or farming carried on in the state. ARM 42.15.1501(2) says this is not the 15-30-2101 definition. Example: a 2026 resident commuting to North Dakota with $30,000 of military pay and $40,000 of wages gets 0 under the statute and 15,000 in the model.
- Code side: eligibility, the earnings cap, the survivor exemption and the filer masks are correct and tested. The PR merges cleanly into current main, and the changed tests and the Montana subtraction directory pass.
Validation Summary
Local tests at the reviewed head pass (the changed tests plus the Montana subtraction directory; review venv, imports from the snapshot). Sources: MCA 15-30-2120, ARM 42.15.1501, the 2025 WMRE form and instructions (sha256 matches the repo's capture), the RIC memo (November 2025), 2025 Mont. Laws ch. 586 and the 2024 Form 2 instructions, checksums validated. CI on the head: 38/38 succeeded.
Timing
policy role seconds: 351.00s; code role seconds: 689.00s; parallel review seconds: 689.00s; elapsed seconds: 800.00s
Review Severity
COMMENT. Open findings: 0 critical, 1 should address, 3 suggestions.
What was missing
PolicyEngine-US did not model Montana's working military retirement and survivor benefit exemption.
military_retirement_pay.pyandmilitary_retirement_pay_survivors.pylisted it as a limitation and the Montanasubtractions.yamlmarked it "not yet modeled", so PolicyEngine-US taxed all of a Montana military retiree's pay.The law
Change
gov.states.mt.tax.income.subtractions.military_retirement:rate(0.5) andsurvivor_rate(0.5);in_effect(false before 2024, true from 2024; parameters extend their first value backward, so the rates alone would have reached 2023);earned_income_sources:irs_employment_income((8)(b)(i), WMRE line 2),total_self_employment_income((8)(b)(ii), line 3: all Schedule C income, including a specified service trade or business),partnership_s_corp_income(line 4) andfarm_operations_income((8)(b)(iii), line 5: Schedule F).mt_military_retirement_exemption_eligible(Person, default true) for the (9) residency and five-year conditions, which PolicyEngine-US cannot derive.mt_military_retirement_exemption(Person). The head's record carries the return's amount:in_effect× [min(rate× the eligible head's and spouse'smilitary_retirement_pay, the return's earned income) +survivor_rate× their eligiblemilitary_retirement_pay_survivors]. Earned income sums each source inearned_income_sourcesover head and spouse and floors each sum at 0, as WMRE lines 3 to 5 do. Dependents' pay and income do not count.subtractions.yamladds the variable to its 2024 and 2025 lists (2026 carries 2025 forward).military_retirement_pay.pyandmilitary_retirement_pay_survivors.pydrop their Montana limitation lines.Readings taken
Three readings go into
source_conflicts/candidates.yaml(step 1 of CONTRIBUTING.md#source-conflicts; no marker until the register holds them):us-mt:military-retirement-exemption-schedule-e-incomeus-mt:military-retirement-and-survivor-exemptions-same-returnus-mt:military-retirement-exemption-business-loss-floorsource_conflicts/sources/us-mt/form-wmre-2025.txt(pdftotext 26.09.0, pages 1 to 3, sha256851ebc5378ce1855177456fd497a2d72333469cc2b0aad9dcd8b6e1e81607ed6) holds the 2025 Form WMRE text these readings quote, for the register'spending_textswhen the readings move there. Page 1 follows the form's visual reading order, and pages 2 and 3 follow its column order with one line per paragraph or list item. Each of the seven Form WMRE excerpts the three candidates quote appears in the capture verbatim. The capture keeps the form's text as printed, including "Senate Bill 124" and the line 5 instruction's "Schedule 1, line 11" (Schedule 1 reports farm income on line 6).Assumptions
mt_military_retirement_exemption_eligibledefaults to true, which overstates the exemption in two known ways. From 2024, it includes a resident from before July 2023 whose pay or benefits began while living in another state (WMRE's example of Albert, who moved to Montana in 2021 after his pay began in Georgia in 2020). From 2029, it also includes every filer whose five years have run out, starting with those whose five years began in 2024 (WMRE: "The last year these taxpayers can claim the exemption will be tax year 2028"). As a benchmark, the committee memo reports 1,711 resident claimants and $24.8 million for tax year 2024 (more than 1,783 claimants and $25.5 million with nonresidents and part-year residents). The input has no formula, so it stays a calculator input.military_retirement_payandmilitary_retirement_pay_survivorscover every uniformed service; (3)(n)(i) covers the armed forces, the guard and the reserves. The variable assumes none of the pay comes from the NOAA Corps or the Public Health Service.Invariants
For every input:
A local randomized check (300 tax units and 572 people: 60% married, 30% with a dependent; random pay, survivor benefits, wages, Schedule C income including SSTB losses, partnership and S corporation income, Schedule F income, Schedule J
farm_income, rents, farm rent, estate income and eligibility; seed 20261111; not committed, following this repo's YAML-first test policy) found every invariant held in TY2024 and TY2026. The exemption equaled an independent restatement of Form WMRE on every unit, Montana income tax never exceeded a reform that setsin_effectto false, and every TY2023 amount was 0.Tests
mt_military_retirement_exemption.yaml, 22 cases:mt_subtractions15,000; $8,000 of wages binds (8,000); no earnings gives 0; $10,000 of survivor benefits alone gives 5,000; retired pay and a spouse's survivor benefits on one return give 10,000; a retiree who is also a survivor beside an ineligible spouse with wages and pay gives 16,000.farm_income(0); rents, Form 4835 farm rent and estate income (0); a dependent's pay (0); a dependent's wages (0).mt_subtractions15,000; TY2023 (0).Removing each new term fails at least one case:
irs_employment_incomefromearned_income_sourcestotal_self_employment_incomepartnership_s_corp_incomefarm_operations_incomeself_employment_income(non-SSTB only) instead oftotal_self_employment_incomefarm_income(Schedule J) to the listsubtractions.yamlentryfilermask on earningsfilerinstead ofeligibleAt 09ed698f28 (this branch, with main merged at 3386304d28), all 1,122 cases under
tests/policy/baseline/gov/states/mtpass, and so do the 107 tests intests/code_health/test_source_conflicts.pyandtests/code_health/test_military_retirement_readers.py. ruff format and check pass on the changed Python files.At e65f906ee7, which adds the first version of the capture, the 103 tests in
tests/code_health/test_source_conflicts.pyand the 22 cases inmt_military_retirement_exemption.yamlpass.At ceb2f71466, which reflows the capture on top of a merge of main (538c7c8cc3), the 251 tests in
tests/code_health/test_source_conflicts.py, the 4 intests/code_health/test_military_retirement_readers.pyand the 22 cases inmt_military_retirement_exemption.yamlpass, and so do all 1,229 tests undertests/policy/baseline/gov/states/mt, main's Montana changes included.Before and after
TY2026, a single filer age 55 with $30,000 of military retired pay, before this fix (2eeb5d3) and after (09ed698):
farm_income(AGI $30,000)A married couple, one spouse age 45 with $30,000 of military retired pay and $60,000 of wages, TY2026, at 09ed698: Montana income tax is 2,716.60 with
in_effectset to false and 2,011.60 with the 15,000 exemption (2eeb5d3 gave the same 2,011.60). With no pension the couple owes 1,306.60, so Montana's tax on the pay falls from 1,410 to 705. A retired couple, ages 67 and 65, with $45,000 of military retired pay, $30,000 of Social Security and no earnings gets no exemption. Every 09ed698 figure in this section holds at ceb2f71466.axiom: us-mt/statute/15-30-2120 queued (TheAxiomFoundation/rulespec-us#2075)
🤖 Generated with Claude Code