Repository navigation
Count Montana casualty losses once per return and only for the spouses who had them, less $100 and 10% of Montana AGI - #9888
Conversation
… the forms - Federal income tax deduction (through 2023): attribute federal tax to the spouse who earned the income and cap each spouse at $5,000, instead of prorating the jointly capped amount by Montana AGI (2022 Form 2 instructions, Itemized Deductions Schedule, line 4). - Child and dependent care expense deduction (through 2023): phase out on the couple's combined Montana AGI and split the result equally only for spouses filing separately on the same form; a single filer and a joint return take the whole deduction (Form 2441-M lines 3-7). - Elderly homeowner/renter credit: count federal AGI without regard to losses (MCA 15-30-2337(9)(a); Form 2EC line 9). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions Each spouse filing separately on the same form deducts their own federal income tax up to $5,000, so both spouses itemize and Montana tax is 6,295.56. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chedule - A married person filing on a separate form (federal filing status SEPARATE) cannot take the child and dependent care expense deduction: "married couples shall file a joint return or file separately on the same form" (MCA 15-30-2131(1)(c)(vi)(A)); 2022 instructions, line 14. - The 2023 credit schedule was the Elderly Homeowner/Renter Credit Schedule; it became Schedule 2EC in 2024. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ouse mt_misc_deductions is a Person variable whose `adds` list included the TaxUnit casualty_loss_deduction. policyengine-core evaluates `adds` with calculate(..., map_to=person), which projects a tax-unit value onto every member, so the joint path (summing over the tax unit) counted a couple's casualty loss once per member, and each spouse filing separately got the full amount. Replace it with two Montana variables following the 2021-2023 Form 2 instructions, Itemized Deductions Schedule line 15: complete federal Form 4684 using Montana AGI in place of federal AGI; spouses filing separately each complete their own Form 4684 (and a deduction attributable to one spouse is claimed by that spouse). - mt_casualty_loss_deduction_joint (TaxUnit): the unit's loss above 10% of mt_agi_joint, counted once. - mt_casualty_loss_deduction_indiv (Person): each spouse's own loss above 10% of their own mt_agi_indiv; dependents' losses go to the head, as mt_agi_indiv does with dependents' income. - casualty_loss/applies ends the line in 2024, when Montana discontinued its Itemized Deductions Schedule (2024 instructions, p. 8). With the child care deduction moved out of the misc list (stacked on fix-mt-separate-filing-allocations), the list held only the casualty loss, so the list parameter and mt_misc_deductions are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erties Montana's line 15 has filers complete federal Form 4684, whose line 11 reduces each casualty by $100 before the 10%-of-AGI floor (line 17). IRS Publication 547: a joint return is one individual for the $100 rule; spouses filing separately each reduce their own loss by $100. Add the federal amount as gov.irs.deductions.itemized.casualty.per_casualty_reduction (26 U.S.C. 165(h)(1)) and apply it once per joint return and once per spouse's column. The model has one loss amount per person, so each return's (or column's) losses are treated as one casualty, as the Arkansas casualty deduction already does. Add grid property tests: both variants match a closed-form Form 4684 reference; the joint return counts the unit's loss once whatever the number of members; separate filers deduct only their own loss; the deduction is non-negative, bounded, monotone; single-filer variants agree; and it ends in 2024. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions' into fix-mt-casualty-loss-misc-deduction
From the adversarial review of #9888 (law, code and test lenses, all approving): - A dependent's casualty loss belongs on the dependent's own return, as the dependent's income does (adjusted_gross_income_person, and so Montana AGI, leaves it out; Pub. 547: only the owner claims the loss). The joint path now sums non-dependents' losses (tax_unit_non_dep_add) and the separate path counts only the head's or spouse's own loss, instead of moving dependents' losses into the head's column while their income stayed out of it. - Say what the suspension flag models: PE has no input distinguishing federally declared disaster losses, so, like the federal deduction, no personal casualty loss is deductible from 2018 unless gov.irs.deductions.itemized.casualty.active is on. - Cite former MCA 15-30-2131(1)(a) (MCA 2021), which allowed the items of IRC 161 (including 165 losses), on the parameter and variables. - Describe the Form 4684 computation per lines 10-18 rather than as one form per return, and fix the separate-path test headers. - Add the 2008 $100 value to per_casualty_reduction (2008 and 2009 Form 4684 line 11), so it is defined before 2009. - Tests: natural-input dependent cases on both paths, and a 2024 case with filing status 2a allowed that exercises the separate path's applies gate (it fails if the gate is removed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… gets the whole group amount) (#9897) * Guard against person variables that add group variables policyengine-core evaluates adds/subtracts with calculate(..., map_to=<the variable's entity>), and map_result projects a group value onto every member with no split. A person variable that lists a tax unit or SPM unit variable therefore gives each member the whole group amount, and a group total counts it once per member (MT casualty loss #9888, MS HSA #9865, WV senior #9856, and OH, IL, CA Riverside and LA cases found the same day). The new code-health test scans the shared baseline system, resolving parameter-path lists across their whole history. Three boolean enrollment flags are allowed; the 10 current cases are known bugs that may only be removed. A premise test pins the projection on core's template country. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refresh group projection registry and scope boolean exemptions to reviewed edges --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ota itemized deductions (#10068) * Allow non-disaster casualty losses in California and Minnesota itemized deductions California and Minnesota read the federal casualty_loss_deduction, which is zero from 2018 under 26 U.S.C. 165(h)(5). Neither state follows that limit: Cal. Rev. & Tax. Code 17204(b) and Schedule CA (540) line 15; Minn. Stat. 290.0122, subd. 8, and Schedule M1CAT. Add ca_casualty_loss_deduction and mn_casualty_loss_deduction: the head's and spouse's loss, less $100, less 10% of federal adjusted gross income. Use them in place of the federal deduction in ca_itemized_deductions_pre_limitation, California's limitation exclusion list, mn_itemized_deductions, mn_amt_taxable_income (Schedule M1MT line 12) and the Walz HF1938 reform. The $100 comes from gov.irs.deductions.itemized.casualty.per_casualty_reduction, the same file #9888 adds, copied unchanged so the two merge cleanly in either order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Qualify the Minnesota casualty loss documentation for 2018 and 2020 Review r1: the 2018 Schedule M1CAT line 18 takes Schedule M1NC line 38 from filers of that schedule, and the 2020 Schedule M1SA takes a net qualified disaster loss from federal Form 4684 line 15 ($500, no 10% floor), deductible without itemizing. The model has neither input, so say so in the variable, the YAML header and the property test. No formula or expected value changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Say that the 2018 M1CAT sends its result to M1SA line 18 Review r2 (P3): the 2018 form has the same $100 reduction and 10% floor but a different destination line. Comment only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
PR Review: Count a Montana casualty loss once per joint return and only for the spouse who had itPR #9888 (author: MaxGhenis, head SummaryFor 2021–2023, Montana's Itemized Deductions Schedule line 15 allows a casualty and theft loss figured on federal Form 4684, with Montana AGI in place of federal AGI. Spouses filing separately on the same form each complete their own Form 4684. On The PR replaces that path with two variables:
Both leave dependents' losses out. Both are gated by a new The law and code are right. The stage-A source audit found no critical problems, and I re-checked the code independently.
The branch cannot merge yet. It is 189 commits behind
There is one should-address item and five optional suggestions. Critical (must fix)None. Should addressS1. Rebase onto
SuggestionsAll five are optional. 1. State the joint path's one-casualty convention in a
2. Baseline gives $0 for 2021–2023 even for federally declared disaster losses (documented deferral).
3. Optional readable YAML cases for edges that only the property test covers.
4. Source hygiene.
5. Itemized Deductions Schedule lines 16–18 have no hook once the misc list is gone (pre-existing, out of scope).
Verified correct
Axiom line assessmentThe PR body reads
CI status
Branch status
Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
The law and code are right. The new joint/indiv casualty deductions apply Form 4684 with Montana AGI ($100, then the 10% floor), leave dependents out, cover 2021-2023 only, and replace the person-level projection. The tests pass and rulespec-us#1516 is dispatch-ready. One should item (see the comment above): the branch is 189 behind and conflicting in 17 files. Rebase only this PR's three commits, don't take the branch's side of #9877's files (that would silently revert spouse_allocation_rate), and fix the two non-textual CI breaks (main's KNOWN_VIOLATIONS entry and the mt_misc_deductions name in the mortgage-interest property test). Then update the PR body and #9912.
The comment this branch added is the file's only change, and open PR #9888 deletes the file, so the comment would only cause a modify/delete conflict there. The variables' own comments already say the federal itemized total replaces the schedule from 2024. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6GED1QuDGy4RPfx6fD
Preserve current spouse allocations, medical deductions and claim-of-right repayments while adding the Montana casualty components. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expose the one-casualty convention in variable metadata, consolidate source references and cover spouse-only losses and 2023. Isolate the casualty property grid from other miscellaneous deductions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add sources and baseline cases for 2015 and 2017 to cover the model's parameter backdating. Extend the property grid across those years and document ordinary-loss limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assert the state casualty component separately while retaining the combined itemized deduction and the miscellaneous expense floor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve misc_deductions.yaml: keep main's 2017 start date and 2017 references, and keep casualty_loss_deduction out of the list. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…turns Both cases compute Montana AGI from wages and need no reform, because the federal casualty flag stays true through 2017. They fail if casualty_loss_deduction returns to Montana's miscellaneous deductions list. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…puts Date the casualty `applies` parameter from 2015, the first year its references cover. State in both formulas that the 2021-2023 instructions limit line 15 to federally declared disaster losses. Remove two casualty_loss_deduction test inputs that no Montana formula reads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Montana's Department of Revenue limits Form 2 line 15 to losses from federally declared disasters in its instructions for every year from 2018 to 2023. Line 15 sits on PDF page 29 in 2018, 34 in 2019, 31 in 2020, 34 in 2021, 35 in 2022 and 39 in 2023. Its 2017 instructions set no such limit. We now date the limit from 2018 in both casualty variables' comments. We also point the MCA 15-30-2131 references in the miscellaneous deduction list and the four itemized deduction totals to the Legislature's MCA 2021 page in place of law.justia.com. Two 2023 case names now lower-case the word after "In 2023,". No values change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…imit Both Montana casualty loss variables' comments now state the 2018 to 2023 disaster-only limit in one sentence. A second sentence names the Department of Revenue and the Form 2 instruction pages that state the limit at line 15. The earlier single sentence ran 39 words. No values change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Resolve misc_deductions.yaml: keep the wagering losses entry main added and the claim-of-right entry, and keep casualty_loss_deduction out of the list. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
David, here's where each item of your review stands at
One line of your summary no longer holds at this head: that the PR changes no baseline value. Three independent AI reviews followed yours, and the second approved 🤖 Generated with Claude Code |
The commits since this review answer each of its items except #9912, which needs main merged once this lands. My reply above maps each item to its commit, file and line.
|
US + core hub merge audit, us#9888 at
🤖 Generated with Claude Code |
Count Montana casualty and theft losses once per return and assign each separate deduction to the spouse who had the loss. The previous person-level miscellaneous deduction projected the federal tax-unit amount onto every member.
Add
mt_casualty_loss_deduction_jointandmt_casualty_loss_deduction_indiv, using Montana AGI for the deduction floor. Add them directly to the joint, separate and federal-itemization aggregators, includingmt_non_medical_itemized_deductions_indiv.Retain
mt_misc_deductionsand its parameter list for the claim-of-right repayment and wagering loss deductions added on main. Remove onlycasualty_loss_deductionfrom that list, and reuse the federalper_casualty_reductionparameter already on main.Sources
Montana taxpayers calculated Itemized Deductions Schedule line 15 with federal Form 4684, substituting Montana AGI for federal AGI. Spouses filing separately each calculated their own loss. See the 2022 Form 2 instructions, PDF pages 11 and 35–36.
For the modeled personal-use losses, taxpayers subtract $100 before applying the 10% AGI floor. Joint filers apply the reduction together; separate filers apply it to their own losses. See Form 4684, lines 11–12 and 17–18 and Publication 547, PDF page 10.
Montana taxpayers also used Form 4684 with Montana AGI for Schedule III line 20 in 2015, 2016 and 2017. Taxpayers applied the same reduction and floor to ordinary losses on the 2015 Form 4684.
Montana allowed these itemized deductions under former MCA 15-30-2131(1)(a). The Legislature repealed that section effective January 1, 2024, and the Montana Department of Revenue discontinued the schedule in its 2024 instructions, PDF page 8.
Invariants and tests
max(max(loss - 100, 0) - 0.1 * Montana AGI, 0)when enabled.YAML cases cover aggregation, ownership, Montana AGI, deduction boundaries, dependents, the suspension and the 2024 transition. Additional cases cover a spouse-only loss, 2023 and baseline deductions in 2015 and 2017. Two 2017 aggregator cases compute Montana AGI from wages with no reform, one on a joint return and one for spouses filing separately. Sixteen property cases check the formula, allocation, bounds and monotonicity across filing paths and the 2024 ending. The claim-of-right fixture supplies the Montana casualty component separately and retains its combined itemized deduction.
Local formatting and lint passed.
Pull request run 43740959422 at
e8c529843bpassed all 37 jobs on GitHub's merge with mainf28e759188.On Linux CI, a selective job ran the property file in 33.17 seconds within pytest, including 17.08 seconds of fixture setup, and took 69.46 seconds from command start to summary. A local macOS run took 39.72 seconds within pytest and peaked at 3.0 GB of memory. It ran
e425a8e737withcasualty_loss_deductionrestored to the miscellaneous list, whose total the file's fixture sets to zero. This PR adds the file, so no earlier timing exists. CI runs the property file in the existing Rest Python shards.Methodology choices
Treat recorded losses as one casualty per joint return or one casualty per spouse filing separately. The
casualty_lossinput does not distinguish events; taxpayers must apply a separate reduction to each event under Publication 547.Keep the existing federal casualty flag. The model lacks an input identifying federally declared disaster losses, so baseline deductions remain zero in 2018–2023 even for the disaster losses Montana allowed. From its 2018 instructions, PDF page 29 through 2023, the department allowed only losses from a federally declared disaster on line 15. Reforms that enable the flag exercise the corrected calculation.
Date Montana's casualty
appliesparameter from 2015. In its 2015, 2016 and 2017 Form 2 instructions, the department told taxpayers to figure casualty and theft losses on Form 4684 with Montana AGI. The model keeps the federal casualty flag true through 2017, so the new variables change 2015–2017 baseline values for returns with casualty losses. Besides counting each loss once, they subtract $100 before the floor, apply the floor to Montana AGI in place of federal positive AGI, and leave dependents' losses out. The model lacks inputs for qualified disaster exceptions and casualty gain netting.Microsimulation impact
This PR changes baseline results for tax years 2015 to 2017 only. The default dataset's records start in 2024, so no population estimate exists for those years.
Both new variables multiply by the federal casualty flag (joint, separate). So does the federal deduction that
mainadds through the miscellaneous list (casualty_loss_deduction.py, line 16). The flag reads true through 2017 and false from 2018, so values move only in 2015 to 2017 or under a reform that turns it on.In 2018 to 2023, the baseline casualty amount stays $0 on
mainand on this branch. From 2024, both give $0 whatever the flag reads. This branch returns 0 onceappliesturns false, and the miscellaneous list holds nothing from 2024 onmainas here.impact: baseline results change for tax years 2015 to 2017 only, on Montana returns with casualty losses; the default dataset starts in 2024, so no estimate exists, and later years stay unchanged without a reform
axiom: TheAxiomFoundation/rulespec-us#2259 queued (former MCA 15-30-2131(1)(a) through 2015–2017 Schedule III line 20; the corpus lacks those Form 2 instructions, so the signed encoder can't run yet); TheAxiomFoundation/rulespec-us#1516 queued, extended with a comment (2018–2023 line 15)
🤖 Generated with Claude Code