Repository navigation
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>
… losses off the filer's return 26 U.S.C. 165(h)(1) reduces each personal casualty loss by $100 (Form 4684 line 11) before the 10%-of-AGI floor (line 17); a joint return is one individual for the $100 rule (165(h)(4)(B)). Only the owner of the property claims the loss, so a tax unit dependent's loss belongs on the dependent's own return, as their income already does. - casualty_loss_deduction (federal, TY2015-2017 and reforms): non-dependent losses less gov.irs.deductions.itemized.casualty.per_casualty_reduction (from #9888), then the floor. - ny_casualty_loss_deduction: IT-196 line 20 uses the 2017 federal rules, so the same computation on federal AGI, ungated by the federal suspension. - al_casualty_loss_deduction: Ala. Code 40-18-15(a)(6) adopts 165(h) as in effect from time to time (40-18-1.1), and Schedule A line 19a takes Form 4684 after its disaster limit, so the deduction follows the federal suspension flag; the floor uses Alabama AGI, not below zero. - hi_casualty_loss_deduction: Hawaii's own $100 (HRS 235-2.4(l)(1)) on Hawaii AGI, and from 2026 Act 35, SLH 2026, makes 165(h)(5) operative. Adds YAML cases that fail on main and a Hypothesis/grid property test of the four copies against a closed-form reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion Main's max_(0, loss - al_agi * floor) gave every Alabama filer with negative AGI a deduction of 10% of |AGI| even with no loss; the zero clamp on the floor removes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Review: Apply the Form 4684 $100 per-casualty reduction and drop dependents' losses in the federal, NY, AL and HI casualty deductionsPR #9912 (author: MaxGhenis, head SummaryThe PR fixes two errors in PolicyEngine's four copies of the Form 4684 Section A computation:
All four now compute
The law and the code agree. I checked § 165(h), Form 4684, Pub. 547, NY IT-196-I, the Alabama Code, Form 40 and Schedule A, the ADOR OBBBA summary, HRS § 235-2.4, Act 35 and the N-11 instructions at their anchored pages (see Verified correct).
Baseline changes:
What blocks approval is the rebase (S1). Replaying just these two commits onto Critical (must fix)None. Should addressS1. After #9888 is rebased, replay only this PR's two commits onto
SuggestionsBoth are optional. 1. After the rebase,
2. New York reads the federal $100 and 10% parameters for a rule that New York freezes at 2017.
Verified correct
Axiom line assessmentThe PR body has two lines:
Both are valid.
CI status
Branch status
Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
This review covers only the two commits on top of #9888. The law and code agree: the $100 comes before the 10% floor and a joint return is one individual under § 165(h), NY uses the 2017 rules via IT-196, AL has its post-2018 gate, and HI applies HRS 235-2.4(l)(1). The tests pass and the axiom issues are dispatch-ready. One should item (see the comment above): after #9888 is fixed, rebase by replaying only this PR's two commits. The NY pre-TCJA deductions expectation must become 23,900, and main's #9849 reference block in hi_casualty_loss_deduction.py must go to avoid a duplicate reference. Then refresh the PR body.
Stacked on #9888, which is stacked on #9877. It reuses #9888's
gov.irs.deductions.itemized.casualty.per_casualty_reduction(2008: 100, 2009: 500, 2010: 100) instead of adding a duplicate. Until both merge, this diff includes their commits; the change reviewed here is the two commits after #9888's head (266f3e2,43eed2a). Merge #9877 and #9888 first.The bugs
PolicyEngine has four copies of the Form 4684 casualty-loss computation outside Montana and Arkansas. All four had the same two errors:
loss − 10% × AGI. 26 U.S.C. 165(h)(1) allows a personal casualty loss only "to the extent that the amount of the loss to such individual arising from each casualty, or from each theft, exceeds $500 ($100 for taxable years beginning after December 31, 2009)". 165(h)(3)(B) applies that before the 10% floor of 165(h)(2)(A). On 2017 Form 4684 this is line 11, "Enter $100", before line 17's "10% of your adjusted gross income".casualty_lossover every tax-unit member. A dependent's loss belongs on the dependent's own return, as the dependent's income already does:irs_gross_incomeleaves it out of AGI. IRS Publication 547 (2017), PDF p. 10 says "If two or more individuals (other than a husband and wife filing a joint return) have losses from the same casualty or theft, the $100 rule applies separately to each individual". PDF p. 4 requires proof "That you were the owner of the property".casualty_loss_deduction(federal)activeis false from 2018 (PE's first modeled year is 2015)activeonny_casualty_loss_deductional_casualty_loss_deductionhi_casualty_loss_deductionThe rule, by jurisdiction
Federal. Pub. 547 (2017, PDF p. 10): "If you and your spouse file a joint return, you are treated as one individual in applying the $100 rule" (165(h)(4)(B)). "If you and your spouse have a casualty or theft loss and you file separate returns, each of you must reduce your loss by $100." P.L. 119-108 (Sept. 11, 2026; TY2025+) rewrote (h)(1) as "$100 ($500 in the case of any qualified disaster-related personal casualty losses …)", so $100 remains the amount for every loss PE models.
New York. 2025 IT-196 instructions, line 20 (PDF p. 3): "Your New York itemized deduction for casualty and theft losses is calculated using the federal rules that applied to tax year 2017." The deduction is allowed only to the extent "the amount of each separate casualty or theft loss is more than $100, and … the total amount of all losses during the year (reduced by the $100 limit in number 1 above) is more than 10% of the amount on Form IT-201, line 19". In the worksheet (PDF p. 4), line 11 is a preprinted 100 and line 17 is "10% of your federal AGI from Form IT-201, line 19". NY Tax Law § 615(a) freezes federal itemized deductions "as such deductions existed immediately prior to the enactment of Public Law 115-97", so NY is not limited to declared disasters. The 2024 instructions are the same.
Alabama. Ala. Code § 40-18-15(a)(6) allows the loss "as determined in accordance with subsections (c)(3) and (h) of 26 U.S.C. § 165". § 40-18-1.1(b) defines "26 U.S.C." as the Code "as in effect from time to time". The 2025 Form 40 instructions (PDF p. 20) say "A casualty or theft loss is determined in the same manner as on your federal return" except for the timing rule and the floor of "10% of the Alabama adjusted gross income". They also say each separate loss must be "more than $100". Schedule A line 19a takes Form 4684 line 15 or 16, which comes after the $100 (line 11) and, from 2018, after the limit to declared-disaster losses (line 14). The Department of Revenue's OBBBA Executive Summary (PDF p. 8) lists 165(h)(5) as "Tied to Federal: Yes" through § 40-18-15(a)(6) for TY2026 on. For 2018–2025 the limit follows from rolling conformity and that form flow.
Hawaii. HRS § 235-2.4(l) (DOTAX compilation, PDF p. 12) makes § 165 operative except that "(1) The amount prescribed by section 165(h)(1) … shall be a $100 limitation per casualty" and "(3) Section 165(h)(5) … shall not be operative". 2025 N-11 instructions, Worksheet A-5 (PDF p. 34): line 19 is the 2017 Form 4684 line 16 (after the $100), line 21 is 10% of Hawaii AGI ("If zero or less, enter zero"), and line 22 is the difference, not below zero. Act 35, SLH 2026 (HB 2329 CD1, signed May 26, 2026) strikes (l)(3) for taxable years beginning after December 31, 2025. DOTAX Announcement 2026-06 (PDF p. 2): "Hawaiʻi will conform to IRC section 165(h)(5), which disallows personal casualty loss deductions, except those attributable to federal or state declared disasters."
The fix
All four now compute
max(max(non-dependent loss − $100, 0) − 10% × AGI, 0), usingtax_unit_non_dep_add(as #9888 does for Montana):positive_agi), timesactive.active. With no input that distinguishes disaster losses, PE treats Alabama like the federal deduction and Montana (Count a Montana casualty loss once per joint return and only for the spouse who had it #9888): no personal casualty loss from 2018 unless a reform switchesactiveon, and then Alabama follows.gov.states.hi.tax.income.deductions.itemized.casualty_loss.per_casualty_reduction(100, HRS § 235-2.4(l)(1)), and…casualty_loss.non_disaster_losses_allowed(true from 2018, false from 2026, Act 35). The floor uses Hawaii AGI floored at zero. The URLs move fromdocumentationtoreference.Methodology notes and choices for the reviewer
ar_casualty_loss_deduction_*do the same. This under-reduces only for filers with more than one casualty in a year.filing_statusis SEPARATE only throughis_separated, which also clearsis_tax_unit_spouse, so a formula-built SEPARATE unit holds one spouse. A tax-unit-level $100 and floor are then that spouse's own, as Pub. 547 requires. No SEPARATE branch was added.exclusion. Values match for every year PE models Hawaii itemized deductions (2018+). If you would rather Hawaii read Count a Montana casualty loss once per joint return and only for the spouse who had it #9888's federal parameter, it is a one-line change.positive_agiand Hawaii's Worksheet A-5, so the deduction never exceeds the reduced loss.max_(0, loss - al_agi * floor)added 10% of a negative AGI to the loss.Invariants
For every input, for each of the four copies:
activefor federal and Alabama, 1 for New York, andnon_disaster_losses_allowedfor Hawaii.casualty_lossnever changes the filer's deduction.Tests
casualty_loss_deduction.yaml(federal, 12 cases). 11 fail on main; the 2018 suspension case is a guard.ny_casualty_loss_deduction.yaml(9 cases, TY2025, the current year). All 9 fail on main. They cover the $100 boundary, the floor after the reduction, a loss under $100, Pub. 547 Example 1 ($14,800 loss and $80,000 AGI give $6,700), a joint return, a dependent's loss, and NY allowing the loss while the federal deduction is $0.al_casualty_loss_deduction.yaml: 2 cases become 12, and 11 fail on main. The 2021 case expecting 1,900 now expects 0, since 2021 losses are limited to declared disasters. The arithmetic case moves to 2017: (2,000 − 100) − 100 = 1,800.hi_casualty_loss_deduction.yaml: 4 cases become 13. Two existing cases move from the worksheet: 100 → 0 and 200 → 100. 10 of the cases fail on main, including the 2026 Act 35 case. A reform case shows a federalactivereform does not reach Hawaii.ny_pre_tcja_deductions.yaml: 5,000 → 4,900, andny_itemized_deductions_max26,500 → 26,400.~/reviews/us-hub/casualty-165h/fails_on_main.txt.activeon inline. 279 passed. The pytest filestest_casualty_loss_deduction_properties.py,test_mt_casualty_loss_deduction_properties.py,test_ar_misc_casualty_deduction_properties.pyandtest_itemized_deduction_limitation_properties.pypassed (44).tests/unit/test_casualty_loss_deduction_properties.py.Impact
The certified default dataset (
populace_us_2024.h5@populace-us-2024-spm-20260909, sha2566496cc43…, verified) has a nonzerocasualty_losson 48 of 166,321 person records.A 2026 microsimulation pair is queued under the heavy lock: base is #9888's head
e352ed05bband the PR is266f3e2, each run from a frozen package snapshot. It covers the four deductions, NY/AL/HI itemized deductions and income taxes, andhousehold_net_income. Results will be added here. In 2026 the federal deduction is $0 in both runs (activefalse), so only NY, AL and HI can move.Axiom
axiom: us/statutes/26/165/h TheAxiomFoundation/rulespec-us#1516 queued (federal Step 1 extended in this comment: the pinned release's scope, (c)(3) and (h)(3)(B), P.L. 119-108 versioning, and companion cases F1–F13 mirroring
casualty_loss_deduction.yaml)axiom: us-ny/statutes/TAX/615, us-al/statutes/40-18-15 (a)(6), us-hi/statutes/235-2/4 TheAxiomFoundation/rulespec-us#1521 queued (dispatch-ready
review_findings and companion cases mirroring the NY, AL and HI YAML tests)Neither is encoded-correct: no § 165(h) or state-copy module exists. The encoder path is blocked for three reasons, all recorded in the issues: each signed run needs Max's approval; the state modules import the federal module, which must be signed first; and Hawaii's N-11, NY's IT-196-I and Act 35 need corpus ingestion.
Follow-ups (filed separately)
Found while researching this PR, each confirmed from the forms and queued as a separate task:
ny_pre_tcja_deductions.yamlmax case still encodes 7.5%; this PR does not touch that line.ny_itemizesrequires federal itemizing, but NY has let filers itemize either way since 2018.al_agipools dependents' income, though the Form 40 booklet says dependents file their own returns. In baseline this is moot here, because Alabama's casualty deduction is now gated off from 2018.🤖 Generated with Claude Code