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.
Keep New York's recomputed AGI and medical floor. Preserve Montana's newer itemized deductions alongside the pending casualty changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exclude dependent losses from Delaware's casualty allocation denominator. Cover each spouse's own loss and unchanged allocations when a dependent adds a loss. Clarify the New York source comment without changing its income base. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the Montana implementation from main. Apply Delaware’s shared filer expense filter to casualty and wagering losses and preserve both sets of cases. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Explain how a reform to the federal floor can change Hawaii’s deduction. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Exercise Hawaii in 2017 and add a joint example with a dependent loss and negative AGI. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Check the federal deduction in both years and choose inputs that expose the old Alabama and Hawaii calculations. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Correct the Montana comparisons and describe Delaware's expense and income shares. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
DTrim99
left a comment
There was a problem hiding this comment.
Program review
Base repository: PolicyEngine/policyengine-us
PR number: 9912
Reviewed head SHA: 76e2e73
Merge base SHA: 8769cc7
Mode: incremental from 43eed2a
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-9912-review-sources.json
Review status: COMPLETE
Source Documents
- de_code_t30_c011_sc02.html — cached original.
- de_pit_res_instr_2025.pdf — cached original.
- hrs_235.pdf — cached original.
- govinfo_usc26_165.html — cached original.
- plaw_119_21.pdf — cached original.
Critical
None.
Should Address
A1 — The Delaware axiom line names rulespec-us#1513, but that issue has no casualty or dependent-loss companion cases (OPEN)
- Location: PR body, Axiom section, third line:
axiom: us-de/policies/income_tax/spouse_itemized_deduction_allocation TheAxiomFoundation/rulespec-us#1513 queued (extend it with casualty and dependent-loss companion cases). - Trigger: commit 214a4a4 (carried through the main merge as
FILER_ONLY_DEDUCTIONS) changes Delaware's spouse allocation of the casualty deduction and adds four DE YAML cases. - Expected: CLAUDE.md "Axiom Parity" says a
queuedissue "must be dispatch-ready and labelledpe-parity. It needs the module path and corpus citation, the verbatim law, the required outputs, and companion tests from the same external source as your YAML tests." - Observed: #1513 is OPEN and labelled
pe-parity, but it was last updated on 2026-10-06, before the Delaware commit (2026-11-13). Its body and comments never mention casualty (grep -i casualtyfinds nothing; saved atpr-9912-axiom-1513.txt). Its only allocation output is the genericde_itemized_deductions_specific_allocation. The axiom line itself says the extension still has to be done ("extend it with …"). So the queued issue is not dispatch-ready for this PR's Delaware change. - Impact: process and parity only; no modeled result changes. The Delaware RuleSpec module would be encoded without fixtures for the casualty or dependent-loss allocation.
- Source: snapshot
CLAUDE.md:151-155;gh issue view 1513 --repo TheAxiomFoundation/rulespec-us. - Fix: add a #1513 comment with the casualty step and companion cases. They should come from the same sources as the DE YAML: Pub. 547's owner rule, and PIT-RES 2025 instructions p. 7 (specific allocation, else income proration) and p. 12. Then drop "extend it with" from the axiom line.
- Proposed severity: SHOULD ADDRESS (an axiom-line problem, per the brief).
Coordinator assessment: This is the only blocking item. The model changes are correct and tested. A comment on #1513 with the casualty step and companion cases from Pub. 547 and the PIT-RES 2025 instructions, plus removing "extend it with" from the axiom line, clears it.
Suggestions
S1 — The § 165 GovInfo link floats to the latest edition, but its comment says "2024 Code" (OPEN)
- Location:
casualty_loss_deduction.py, thereferencetuple:# 26 U.S.C. 165 (2024 Code)abovehttps://www.govinfo.gov/link/uscode/26/165?type=usc&year=mostrecent&link-type=html. The PR body uses the same URL. - Observed: the link is right today. It redirected on 2026-12-02 to
USCODE-2024-title26-…-sec165.htm, which has (h)(1) "$500 ($100 for taxable years beginning after December 31, 2009)", the (h)(2)(A) 10% floor and (h)(4)(B). It also has the pre-OBBBA (h)(5), "Limitation for taxable years 2018 through 2025". The companion citation, P.L. 119-21 § 70109 at physical page 93, is correct: it strikes ", and before January 1, 2026" and adds State declared disasters. Butyear=mostrecentwill move to the 2025 edition when GovInfo publishes it, and the "2024 Code" label will then be wrong. The 2024 edition also leaves out later (h)(1) amendments, which the prior review saw on LII as P.L. 119-108. They don't change the $100 for any loss PE models. - Impact: citation durability only; no modeled result changes.
- Fix: pin
year=2024in the link, or change the label to "most recent edition". - Proposed severity: SUGGESTION.
S2 — The PR body still has two placeholders that are now stale (OPEN)
- Location: PR body, "CI at this head is pending." and "impact: pending a comparison at the final head."
- Observed: CI is 35/35 SUCCESS at 76e2e73. S1 item 3 of the prior review asked the author to fill in or remove the Impact placeholder. It was replaced by another "pending" placeholder, while the PR still changes baseline results for New York, Alabama (from 2018) and Hawaii (from 2026).
- Impact: reviewer-facing accuracy only.
- Fix: update the CI line. Then either add the comparison or delete the Impact line. The repository has no rule requiring an impact line.
- Proposed severity: SUGGESTION.
Evidence Gaps
No material gaps reported.
Notes
- This round covers the seven author commits since the 10-12 review and two merges of main.
- The round-1 should-address item is RESOLVED. #9888 merged on 11-15, and the PR's diff against its merge base now holds only the casualty files.
ny_pre_tcja_deductions.yamlexpects 23,900.hi_casualty_loss_deduction.pyhas one reference tuple. The body no longer asks for #9877 or #9888 to merge first. - Suggestion 1 (Delaware allocation with a dependent's loss) is RESOLVED.
casualty_loss_deductionis now filer-only in both numerator and denominator. A couple with a $20,000 and a $10,000 loss gets [13,266.67, 6,633.33, 0] with or without a dependent's $30,000 loss. That follows 30 Del. C. § 1109(a), Pub. 547's owner rule and the PIT-RES Line 13 specific allocation. - Suggestion 2 (NY reads the federal parameters) is RESOLVED by documentation.
- New behavior verified: Hawaii's 10% floor comes from operative § 165(h)(2)(A) under HRS § 235-2.4(l), which is documented. Hawaii 2017 is (loss − $100) − 10% of AGI. The four corrected fixtures and the Montana cleanup check by hand. With the merge-base formulas swapped in, all four fixtures and all four new Delaware cases fail, so they discriminate.
- Merging with current main (72 commits ahead) is clean. The casualty tests pass on the merged tree, apart from the files run 1 didn't reach before its deadline.
- For #1521, companion A2's AL input differs from YAML Case 2 (11,000 vs 9,500). Both give $0 under the law, so refreshing A2 is optional housekeeping.
Validation Summary
Local tests at the reviewed head (review venv, policyengine-core 3.37.2, matching uv.lock; imports resolved to the snapshot), split because of machine load. Run 1 (the federal casualty file and the DE, HI and MT itemized folders) reached its 540 s deadline with 182 of 570 items passed and 0 failed. Run 2 passed the NY, AL and MT casualty YAMLs (89 of 89) and the casualty property and code-health pytest files (18 of 18). Every PR-touched file that was reached passed, and CI's full suite is green at this head. The same runs on a merge with current main gave 0 failures. Sources: 26 U.S.C. 165 and P.L. 119-21 § 70109, 30 Del. C. § 1109, the PIT-RES 2025 instructions, Pub. 547 (2017) and HRS § 235-2.4; manifest check passed. CI: 35/35 checks pass at 76e2e73.
Timing
setup seconds: 6.00s; scope seconds: 60.00s; parallel review seconds: 1142.80s; policy role seconds: 269.50s; code role seconds: 1142.80s; adjudication seconds: 90.00s; consolidation cleanup seconds: 46.60s; elapsed seconds: 1334.00s
Review Severity
COMMENT. Open findings: 0 critical, 1 should address, 2 suggestions.
We apply the $100 per-casualty reduction before the 10% income floor in the federal, New York, Alabama and Hawaii deductions, and we leave dependents’ losses out of them. In Delaware, we allocate the federal casualty deduction to the filers who sustained the losses.
Main already holds the federal reduction parameter.
Changes and sources
ny_pre_tcja_deductions.yaml, itemized deductions total $23,900 after the medical floor and the $100 casualty reduction. 2025 IT-196 instructions · 2025 IT-196 worksheet · 2020 IT-196 instructionsInvariants
For each of the four deductions, we calculate
gate × max(max(loss − reduction, 0) − floor × max(AGI, 0), 0)from the head’s and spouse’s losses. We use federal AGI for the federal deduction, New York’s recomputed federal AGI for New York, and state AGI for Alabama and Hawaii.The result ranges from zero to the reduced loss, and dependents’ losses never change it. As losses rise, the deduction stays flat or rises, and as AGI rises, it stays flat or falls. The state variables return zero outside their state. The four formulas agree when their gates, parameters and income bases match.
Methodology choices
Merge with main
We merged main at
8769cc75bc2efc7a3287834fc75a85c326343af6, which holds #9888’s Montana casualty change. The merge retains main’s Montana casualty formulas. We updated the comments in two Montana test files to apply the $100 reduction to the federal deduction. Their assertions stay the same. In Delaware, casualty losses join wagering losses in main’s filer-only expense list, and the test file keeps main’s two wagering cases beside the four casualty cases.The federal calculation can also change D.C. and Delaware deductions, Wisconsin and Utah credit bases, and Virginia’s itemized deductions before the reduction. A change in federal tax can flow through to Montana’s deduction for federal income tax. The federal path is active in the 2015–2017 baseline and can reopen under reforms.
Tests
casualty_loss_deduction.yamlal_casualty_loss_deduction.yamlde_itemized_deductions_indv.yamlhi_casualty_loss_deduction.yamlmt_itemized_deductions_joint.yamlmt_itemized_deductions_indiv.yamlny_casualty_loss_deduction.yamlny_pre_tcja_deductions.yamltest_casualty_loss_deduction_properties.pyruns eight tests. One Hypothesis test checks the reference formula, state gates, and agreement across active copies. Its explicit example, a joint return with $60 and $60 of losses, a dependent’s $20,000 loss and AGI of −$10,000, gives $20 in each active copy. Seven grid cases check the active copy-years within 2017, 2025, and 2026. Each checks boundary losses, monotonicity and that a dependent’s loss changes nothing.Taking casualty losses out of Delaware’s filer-only list fails three of the four Delaware casualty cases. The case where only the dependent has a loss passes either way.
CI at this head is pending.
Microsimulation impact
impact: pending a comparison at the final head.
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)axiom: us-de/policies/income_tax/spouse_itemized_deduction_allocation TheAxiomFoundation/rulespec-us#1513 queued (extend it with casualty and dependent-loss companion cases)
🤖 Generated with Claude Code