Skip to content

Model the claim of right repayment deduction and credit (26 U.S.C. 1341) and North Carolina's rules that depend on it - #10038

Open
MaxGhenis wants to merge 38 commits into
mainfrom
federal-claim-of-right-1341
Open

MaxGhenis wants to merge 38 commits into
mainfrom
federal-claim-of-right-1341

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A filer who repays income that was taxed in an earlier year under a claim of right gets federal relief under 26 U.S.C. 1341 when the repayment exceeds $3,000. PolicyEngine had no part of that section, so such a filer got no federal relief. This PR adds it, and wires the two North Carolina rules that depend on it.

Builds on #10028, merged into main as 557b539d77, which added the person-level input claim_of_right_repayment and North Carolina's deduction. At David's reviewed head, 17cad4b53b53919b743afa51969e9a9e8c5dfc9b, the branch had merged main at 6f34ccde23 (main a2f63c1235). The changes after that review are listed below; historical validation and impact measurements retain their original heads.

Federal:

  • claim_of_right_prior_year_tax_decrease, a tax-unit input labelled as a federal amount: the decrease in the filers' federal chapter 1 tax for the earlier year or years that would result solely from excluding all the income they repaid (section 1341(a)(5)(B)). It is a return-level amount, because separately computed decreases for two spouses do not add up to the decrease from excluding both. It counts tax after credits, including the alternative minimum tax, and leaves out the net investment income tax and payroll taxes.
  • claim_of_right_section_1341_eligible: the head's and spouse's repayments total more than $3,000 (gov.irs.deductions.itemized.claim_of_right.threshold). The model sums all repayment classes together; it does not implement the regulation's same-class aggregation rule.
  • claim_of_right_credit_applies: whether tax is computed under section 1341(a)(5). The model derives it by computing federal income tax both ways.
  • claim_of_right_deduction: the Schedule A line 16 deduction, used under section 1341(a)(4). It joins gov.irs.deductions.itemized_deductions.
  • claim_of_right_credit: the Schedule 3 line 13b credit, used under section 1341(a)(5). It joins gov.irs.credits.refundable.

North Carolina:

  • nc_claim_of_right_deduction is zero when the return is eligible for section 1341 and federal tax is computed under section 1341(a)(5) (G.S. 105-153.5(a)(2)d, last sentence). An ineligible repayment is not barred merely because the method flag is supplied as true.
  • nc_claim_of_right_payment, with the tax-unit input nc_claim_of_right_prior_year_tax_increase, the increase in the earlier year's North Carolina tax from including the repaid income (G.S. 105-266.2). The payment requires both section 1341 eligibility and the federal credit method, including when the method is supplied as an input. North Carolina had no refundable credits in the model, so this PR adds nc_refundable_credits and nc_income_tax_before_refundable_credits in the pattern other states use.

The PR coordinates eight other states' readers of the new federal amounts and preserves California's default carryover of the federal deduction (see "Other states").

Changes after review

  • Should 1 — California: carry the federal deduction into California itemized deductions by default, matching Schedule CA column A. Update the itemized-deduction expectation to $11,000, let California receive the deduction in the state property check, and add Publication 525 Example 40 as a California regression case: $44,950 taxable income and about $1,078.89 income tax. Document the California credit, column C deduction, and untaxed-income restrictions still to model.
  • Suggestion 1 — North Carolina eligibility: require claim_of_right_section_1341_eligible together with the credit-method flag for both the payment and the deduction bar; add boundary coverage for supplied method flags with repayments at or below $3,000.
  • Suggestion 2 — Input documentation: make the same-class aggregation simplification explicit in eligibility documentation and label the prior-year tax decrease as federal.
  • Suggestion 3 — Threshold references: remove section 67(b)(9) from the $3,000 parameter's references; retain it for the deduction's classification, which it supports.
  • Suggestion 4 — New York follow-up: include IT-196 line 34 for repayments over $3,000 alongside New York's credits and its retained 2% pool for smaller repayments.
  • Suggestion 5 — Wisconsin and status: the earlier review revision disclosed its worksheet-based exclusion and corrected the reviewed head's CI status to all 27 checks passed. The statute-first update below supersedes that exclusion: repayments remain in the itemized deduction credit base unless used for Wisconsin's separate claim of right credit.

The hub reran the microsimulation at the earlier review-revision head 60cb3dd35a: no record changes (see Microsimulation). That result and the earlier household/state-flow measurements are historical evidence for their stated heads, not validation of the current main merge and statute-first updates.

Merge with main (after #10039)

Merged gh/main at f19877374ac943756c15734e063fc259bff74b2c into this branch with a merge commit and no conflicts or manual resolutions. This includes #10039's requirement that household state tax totals equal each state's own income tax.

North Carolina now has the refundable G.S. 105-266.2 claim of right payment. Its nc_income_tax correctly uses adds = ["nc_income_tax_before_refundable_credits"] and subtracts = ["nc_refundable_credits"], so NC is removed from STATES_WITH_FORMULA_INCOME_TAX rather than restoring a formula. Both variables were already present in the corresponding state_income_tax_before_refundable_credits and state_refundable_credits parameter lists after the merge. The household aggregation tests cover NC's before-credit tax and refundable payment, including a payment exceeding its state tax.

Local macOS validation at 3fdef4dec2ee2263e8db26ef0f0c2fdb55e6c219, policyengine-core 3.33.2. Each file ran in its own foreground process with OMP/OpenBLAS/MKL/vecLib/NumExpr threads capped at 4 and OMP_WAIT_POLICY=PASSIVE.

File under policyengine_us/tests/ Passed
core/test_state_income_tax_accounting_invariants.py 100
unit/test_claim_of_right_section_1341_properties.py 47
policy/baseline/gov/states/nc/tax/income/credits/claim_of_right/nc_claim_of_right_payment.yaml 4
policy/baseline/gov/states/mt/tax/income/deductions/itemized/mt_claim_of_right_deduction.yaml 31
policy/baseline/gov/states/mt/tax/income/mt_taxable_income_joint.yaml 8
policy/baseline/gov/states/mt/tax/income/subtractions/mt_federal_obbba_subtraction.yaml 7
policy/baseline/gov/states/nc/tax/income/deductions/itemized/nc_claim_of_right_deduction.yaml 24
policy/baseline/gov/states/nc/tax/income/nc_income_tax.yaml 4
policy/baseline/household/income/household/household_state_tax_before_refundable_credits.yaml 10
policy/baseline/household/income/household/household_refundable_state_tax_credits.yaml 4
policy/baseline/household/income/household/household_net_income.yaml 5
policy/baseline/gov/states/tax/income/state_income_tax.yaml 6
policy/baseline/gov/states/ms/tax/income/ms_income_tax.yaml 7
policy/baseline/gov/states/ms/tax/income/ms_income_tax_before_refundable_credits.yaml 2
policy/contrib/states/mi/mi_surtax.yaml 10
policy/baseline/gov/states/al/tax/income/deductions/al_federal_income_tax_deduction.yaml 14
policy/baseline/gov/states/mo/tax/income/deductions/mo_federal_income_tax_deduction.yaml 13
policy/baseline/gov/states/or/tax/income/subtractions/or_federal_tax_liability_subtraction.yaml 11
policy/baseline/gov/states/wi/tax/income/wi_itemized_deduction_credit.yaml 3
policy/baseline/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.yaml 6
policy/baseline/gov/states/va/tax/income/deductions/va_itemized_deductions.yaml 7
policy/contrib/states/nc/eitc/nc_eitc.yaml 5
policy/contrib/states/nc/eitc/nc_eitc_excludes_use_tax.yaml 2
policy/contrib/states/nc/cdcc/nc_cdcc.yaml 9

339 passed across 24 files. make format (Ruff formatting and checks) also passed. No current-head microsimulation was run; the hub owns that check. The earlier test results and microsimulations below remain evidence only for their stated historical heads.

Merges with main after #10186 (858dca387b, 4b8cdd1eed)

The first merge, 858dca387b, resolved conflicts with #10186 ("Take the 2020 charitable deduction for non-itemizers above the line") by hand, in five files, keeping both sides:

Six combined regression cases (integration cases 7–12) were added and hand-calculated. The second merge, 4b8cdd1eed, had no conflicts. It brings in main's tips and overtime and Minnesota changes, which don't touch this PR's code.

Validation at 4b8cdd1eed: the build ran 248 tests across 15 files (47 §1341 properties, 41 charitable checks and 103 source-conflict checks), and 45 files were left to CI. An independent review approved this head after rerunning the resolution checks and the six cases; it also ran the §1341 invariants on a 2020/2021 grid, all passing. The results block under Tests below predates both merges.

Statute-first updates (2026-10-20)

Applied the six-jurisdiction verified backlog in 10038.md. These changes supersede the earlier MO/OR/WI worksheet choices; no # Source conflict markers or register entries are added. Items awaiting decisions d1741, d1742 or d1744 remain as built.

  • Alabama — us-al:federal-tax-deduction-credit-list. Follow the regulation's all-payment-credit rule from 2021: subtract claim_of_right_credit, actual net_premium_tax_credit, refundable AOC only and the residual al_other_federal_payment_credits input. Apply the payment-credit correction in both 2021 alternatives, preserving the pandemic recomputation, greater-of comparison and zero floor. The new inputs are return amounts, default zero; withholding, estimated/extension payments and amounts excluded by Act 2021-1 are outside the residual. An explicit legacy value prevents automatic backdating from changing pre-2021 treatment; a 2020 regression preserves it because the 2018–2020 worksheets were not verified. Ala. Admin. Code r. 810-3-15-.20(1)(d)2.
  • Missouri — us-mo:claim-of-right-federal-tax-deduction. Drop the section 1341 entry from ignored_credits. Federal relief reduces the deductible federal tax; RSMo 143.171(2)(1) does not authorize adding back the whole section 1341 credit. The witness is $340 remaining federal tax × 25% = $85, rather than $460.
  • Oregon — us-or:federal-tax-deduction-section-1341-credit. Drop the worksheet add-back. Retain max(0, income_tax + eitc) before the cap: ORS 316.680(1)(b) and 316.685(1) allow accrued federal tax and expressly disregard EITC. The witness subtraction is $2,500 after $1,500 of section 1341 relief, rather than $4,000.
  • Wisconsin — us-wi:claim-of-right-itemized-deduction-credit (including the duplicate us-wi:itemized-credit-section-1341-repayments and us-wi-itemized-credit-includes-repayment items). Drop the blanket repayment exclusion from the itemized deduction credit base. Wis. Stat. 71.07(5)(a)6–7 excludes a repayment only when it is used for the separate subsection (1) credit; IRC 67(b)(9) excludes section 1341 deductions from miscellaneous deductions. The separate Wisconsin repayment credit remains unmodeled. The witness potential credit is $1,250, rather than $250.
  • Montana — us-mt-repayment-deduction-omitted. Before 2024, carry a positive federal repayment deduction once into final and federal-itemization comparison aggregates, allocated to the repaying head/spouse. Add the separate 2017 miscellaneous pool after its 2% Montana-AGI floor, combining raw employee expenses, tax-preparation fees and qualifying small repayments classified by the modeled income class; disable it from 2018. From 2024, reconstruct the federal taxable-income base before its zero floor, add QBI back under subsection (2)(i), preserve Schedule 1-A deductions exactly once, and apply the capped state-income-tax adjustment before flooring at zero, consistent with MCA 15-30-2101(7) and 2024 Form 2 Worksheet A. Use the deduction actually taken and the full allowed federal itemized total, including separate wagering-loss deductions and federal limitations, with deducted state income tax added back only up to min(D, max(0, I - S)). Include the separate 2026 nonitemizer charitable deduction in the displayed federal deduction. The 2017 income-class input remains local to Montana; the federal aggregation simplification is unchanged. Keep business-level additions separate and preserve the federal-income-tax deduction's 2024 cutoff. This completes the federal-base/addback correction here rather than deferring it to Use the federal itemized total and deduction type for Montana from 2024 #10206. MCA 15-30-2120, 2023 HB 109 §4, 2017 Form 2 legal references.
  • Virginia — us-va-reduced-itemized-omits-repayment. Retain claim_of_right_deduction in the limited total and add the already-floored federal misc_deduction for 2017; the latter is zero from 2018. Both enter before section 68 reduction and proportional income-tax removal, with neither added to the exempt reduction.reducible list. Preserve main's 2018 infinity threshold. The witnesses retain the $24,981 limited deduction in 2025, produce $18,345 after the 2017 miscellaneous floor and preserve $30,000 in the 2018 unlimited branch. Va. Code 58.1-322.03(1)(a), 58.1-301(B)(5), 2024 IRC 68.

The law

26 U.S.C. 1341(a):

If— (1) an item was included in gross income for a prior taxable year (or years) because it appeared that the taxpayer had an unrestricted right to such item; (2) a deduction is allowable for the taxable year because it was established after the close of such prior taxable year (or years) that the taxpayer did not have an unrestricted right to such item or to a portion of such item; and (3) the amount of such deduction exceeds $3,000, then the tax imposed by this chapter for the taxable year shall be the lesser of the following: (4) the tax for the taxable year computed with such deduction; or (5) an amount equal to— (A) the tax for the taxable year computed without such deduction, minus (B) the decrease in tax under this chapter (or the corresponding provisions of prior revenue laws) for the prior taxable year (or years) which would result solely from the exclusion of such item (or portion thereof) from gross income for such prior taxable year (or years).

Section 1341(b)(1) and (b)(3), same page:

(1) If the decrease in tax ascertained under subsection (a)(5)(B) exceeds the tax imposed by this chapter for the taxable year (computed without the deduction) such excess shall be considered to be a payment of tax on the last day prescribed by law for the payment of tax for the taxable year, and shall be refunded or credited in the same manner as if it were an overpayment for such taxable year.

(3) If the tax imposed by this chapter for the taxable year is the amount determined under subsection (a)(5), then the deduction referred to in subsection (a)(2) shall not be taken into account for any purpose of this subtitle other than this section.

26 CFR 1.1341-1:

  • (a)(3): "For purposes of determining whether the amount of a deduction described in section 1341(a)(2) exceeds $3,000 for the taxable year, there shall be taken into account the aggregate of all such deductions with respect to each item of income (described in section 1341(a)(1)) of the same class."
  • (b)(3): "If the tax determined under subparagraph (1)(i) of this paragraph is the same as the tax determined under subparagraph (1)(ii) of this paragraph, the tax imposed for the taxable year under chapter 1 shall be the tax determined under subparagraph (1)(i) of this paragraph".

IRS forms and instructions:

  • Publication 525 (2025), Repayments, PDF pp. 36–37: "If the amount you repaid was more than $3,000, you can deduct the repayment as an other itemized deduction on Schedule A (Form 1040), line 16"; "Figure your tax under both methods and compare the results. Use the method (deduction or credit) that results in less tax"; and "consider the total amount being repaid on the return. Each instance of repayment isn't considered separately." Method 2: tax without the deduction, less the tax shown on the earlier return minus that tax refigured without the repaid income.
  • 2025 Schedule A instructions, line 16, PDF pp. 11–12: "Deduction for repayment of amounts under a claim of right if over $3,000."
  • 2025 Schedule 3, line 13b, under "Other Payments and Refundable Credits": "Section 1341 credit for repayment of amounts included in income from earlier years"; 2025 Form 1040 instructions, PDF p. 117.
  • The deduction is not a miscellaneous itemized deduction (26 U.S.C. 67(b)(9)), so neither the 2% floor nor the suspension of those deductions from 2018 (section 67(g), redesignated 67(h) by P.L. 119-21) applies to it. It is inside the overall limitation on itemized deductions: the 2017 Itemized Deductions Worksheet, PDF p. 14, line 2 removes only "gambling and casualty or theft losses included on line 28".

North Carolina:

  • G.S. 105-153.5(a)(2)d, last sentence: "No deduction is allowed if the taxpayer calculates the federal income tax for the year of repayment under section 1341(a)(5) of the Code."
  • G.S. 105-266.2, added by S.L. 1997-213 for taxable years beginning on or after January 1, 1995:

This section applies to a taxpayer who is subject to the alternative tax under § 1341(a)(5) of the Code for the current taxable year because the taxpayer restored an item of income that had been included in the taxpayer's gross income for an earlier taxable year. For the purpose of Article 4 of this Chapter, the taxpayer is considered to have made a payment of tax for the current taxable year on the later of the date the return for the current taxable year was filed or the date the return was due to be filed. The amount of this payment of tax is (i) the amount the taxpayer's tax under Article 4 for the earlier taxable year was increased because the item of income was included in gross income for that year minus (ii) the amount the taxpayer's tax under Article 4 for the current taxable year was decreased because the item was deductible for that year. To the extent this payment of tax creates an overpayment, the overpayment is refundable in accordance with G.S. 105-241.21.

Design notes

  • Leaf inputs; the method is normally derived. The two prior-year inputs are facts about earlier returns that the model cannot compute. The model normally computes whether (a)(4) or (a)(5) governs. A user modeling a pre-2018 year can supply claim_of_right_credit_applies because federal tax for those years is not verified; eligibility still gates federal relief and both North Carolina method conditions.
  • The comparison needs two more tax computations. Tax with the deduction and tax without it differ through brackets, the itemize-or-standard choice, credits and the AMT. claim_of_right_credit_applies follows the pattern of tax_unit_itemizes, id_receives_aged_or_disabled_credit and va_claims_refundable_eitc: two branches fix the method and compute income_tax, and the main simulation takes the cheaper one. Each branch makes its own itemize-or-standard choice.
  • The method branches start from inputs only. A parent simulation can hold a tax liability that an itemizing branch calculated with a method of its own choosing before the parent knew the method. A method branch that inherited it would compute the wrong tax (the review found a Texas household where this happens when tax_liability_if_itemizing is calculated first). get_override_branch gains inherit_calculated=False, which the two method branches use. When some tax unit repays more than $3,000, every itemizing branch also takes the simulation's method as an input next to tax_unit_itemizes, so none chooses its own. One helper, get_itemization_branch (tools/general.py), builds them for tax_unit_itemizes, tax_liability_if_itemizing and tax_liability_if_not_itemizing. This holds whatever is calculated first and under both settings of gov.simulation.branch_to_determine_itemization (review r2 found the setting-off case). Because the parent then already holds the method, those branches start from inputs too. When nobody qualifies and the method is derived, it is false everywhere, the extra input is left out, and the itemizing branches share the parent's cache as before. Branches still drop inherited values whenever the parent holds a value for an overridden variable: an equal value is not enough, because the parent's cache can predate a change to another input (review r3). Tests cover the review's household in every order under both settings, and r3's stale-parent sequence.
  • From 2026, tax_unit_itemizes opens the itemizing branch too (Net the 2026 section 68 taxable-income leg of the QBI and other non-itemized deductions #10136: the section 68 limitation nets itemized deductions of the QBI deduction, so the itemized total comes from the branch that itemizes). It asks for the branch through get_itemization_branch, with the same inputs tax_liability_if_itemizing uses, so the two share one branch. Inheriting the method is not enough. From policyengine-core 3.33 (Add chained CPI #560), set_input on a branch drops the values stored after the overridden variable's first store in the simulation. A branch fixing only tax_unit_itemizes therefore dropped the inherited method and chose its own as a filer forced to itemize. Its itemized deductions then decided itemization whenever the two liabilities tied, and always with itemization branching off. CI at 32b0c13a6a (core 3.33.3) failed two 2026 grid points this way. A 2026 household with branching off came out at $4,988 instead of $4,100; a test now covers it in every calculation order under both settings, and fails on the earlier code.
  • No extra tax computations when nobody qualifies. The formula returns false without the two method branches when no tax unit repays more than $3,000; only the eligibility check runs. That is every record in the current microdata (see "Microsimulation").
  • Ties go to the deduction (26 CFR 1.1341-1(b)(3)). The two taxes are compared to the cent, so a credit that saves one cent applies.
  • The credit is refundable. Schedule 3 line 13b is a payment, so the model subtracts the whole prior-year decrease. That equals (a)(5)(A) minus (a)(5)(B), with the excess refunded under (b)(1).
  • The $3,000 test uses the return's total (Publication 525), for the head and spouse. A dependent's repayment belongs on the dependent's own return. The regulation aggregates items of the same class; the model has one amount per person and sums different classes together, a simplification disclosed in claim_of_right_section_1341_eligible.
  • What "tax" is compared. Section 1341(a) compares "the tax imposed by this chapter", chapter 1. The branches compare income_tax, which is chapter 1 tax after credits plus the net investment income tax (chapter 2A) and unreported_payroll_tax. In the model neither addition depends on the repayment: the net investment income tax reads MAGI built from AGI and net investment income, and the deduction is below AGI. So the comparison ranks the methods as a chapter 1 comparison after credits would. Comparing after credits follows the IRS: the clawback FAQ says the taxpayer gets "whichever results in less tax (or a greater refund)", and Publication 525 says to "use the method (deduction or credit) that results in less tax". If the model later lets the repayment affect the net investment income tax, the comparison must move to chapter 1 tax.
  • claim_of_right_repayment does not join gov.irs.deductions.itemized.misc.sources.
    • Before 2018, a repayment of $3,000 or less was a miscellaneous itemized deduction subject to the 2% floor (2017 Schedule A instructions, line 23, PDF p. 12). Section 67(g) (now 67(h)) disallows it from 2018.
    • Federal income tax in PolicyEngine is verified from 2018 (programs.yaml); the brackets and the standard deduction have no earlier values. So the federal list entry would change no supported year.
    • Three state formulas read that list in every year. Arkansas (ar_misc_deduction_*) and New York (ny_misc_deduction) read total_misc_deductions, and North Carolina's deduction reads the list for its "other miscellaneous deductions" term. Adding the repayment there would count it twice in North Carolina and put it into Arkansas's 2% pool, where I found no Arkansas authority for it. New York does keep small repayments in its 2% pool (2025 IT-196 instructions, PDF p. 16); that belongs with New York's own claim of right rules (see "Follow-ups").
    • So this PR leaves the federal pre-2018 small-repayment deduction unmodeled and says so in claim_of_right_deduction.
  • G.S. 105-266.2, term (ii) is zero. Term (ii) is the decrease in this year's North Carolina tax "because the item was deductible". claim_of_right_repayment covers only repayments not deducted in arriving at AGI, which reach North Carolina only through its itemized deduction. Under section 1341(a)(5) G.S. 105-153.5(a)(2)d allows no such deduction, so for these repayments the payment is term (i), the input.
  • North Carolina contrib reforms. nc_eitc and nc_cdcc each replaced nc_refundable_credits. They now add their credit to the baseline list, as State EITC contrib reforms delete baseline refundable credits (ID, AZ, NC, WV) #8775 did for Idaho, Arizona and West Virginia. Their nc_income_tax overrides are gone because the baseline now subtracts refundable credits. The nc_cdcc override added nc_use_tax, which state_use_tax already counts; State EITC contrib reforms delete baseline refundable credits (ID, AZ, NC, WV) #8775 removed the same double count from nc_eitc.

Not modeled:

  • Repayments deducted in arriving at AGI (business income, capital gains). claim_of_right_repayment excludes them, so section 1341 for those repayments is out of scope.
  • Net operating loss and capital loss carrybacks under section 1341(b)(4) and (b)(5).
  • The regulation's "same class" aggregation. The input is one total per person, so repayments of different income classes are summed together for eligibility.
  • Federal relief for repayments of $3,000 or less before 2018 (above). The new Montana-specific 2017 pool does not establish full pre-2018 federal coverage.
  • Before 2018 the method is derived from a federal computation the model does not verify (no pre-2018 brackets or standard deduction). A user modeling an earlier year can set claim_of_right_credit_applies as an input; the 2017 YAML case does.
  • California's separate relief and restrictions. The federal deduction carries into Schedule CA line 16, column A by default. California's own credit and the corresponding column B removal (Form 540 line 78, labelled "IRC 1341"), the California deduction entered in column C when federal tax used the credit, and the bar for income California did not tax remain unmodeled. The instructions also remove federal deductions for Social Security repayments, whose income California does not tax.
  • North Carolina's payment for former residents. G.S. 105-266.2 does not require current residence, but the model computes a state's tax for its residents, so a filer who paid the earlier North Carolina tax and has since moved is not covered. nc_claim_of_right_payment says so.
  • Calculation order under behavioural-response reforms. Under a reform with labour-supply or capital-gains responses, a method or itemizing branch opened before the parent has measured those responses measures its own, with the method or itemization fixed, so the two method taxes can rest on different earnings. It does not arise in the default calculation order, in baseline simulations, or in current data (no record repays more than $3,000), and main's itemizing branches already behave this way. Calculating a value that triggers the measurements in the parent before branching, as marginal_tax_rate_on_capital_gains and marginal_tax_rate do, would remove it (review r8; in the follow-ups).
  • Arizona's addition to Arizona AGI. Leaving the federal deduction out of Arizona itemized deductions gives an Arizona itemizer the same taxable income as A.R.S. 43-1021(9)'s addition, but does not raise Arizona AGI, which Arizona's AGI-tested credits read. The Arizona claim of right credit (A.R.S. 43-1029) is not modeled either; both are in the follow-up chip.

Other states

A sweep of the other 41 income tax jurisdictions (reports in ~/reviews/us-hub/federal-1341/state-sweep/) identified state readers of the new federal amounts and leads for separate state relief. Earlier state-flow reports are historical; the current property check reflects the statute-first treatment below.

State treatment in this PR. Missouri, Oregon and Wisconsin retain main's statutory treatment rather than the earlier worksheet-based changes. Alabama's payment-credit rule and the Montana/Virginia omissions are corrected here.

State Treatment in this PR Source
Alabama Reduce the federal-income-tax deduction by all modeled federal payment credits, including section 1341 relief and actual net PTC; use refundable AOC only and provide a residual payment-credit input. Correct both 2021 alternatives. Ala. Admin. Code r. 810-3-15-.20(1)(d)2
California Carry the federal deduction into ca_itemized_deductions_pre_limitation through Schedule CA column A; separate California credit, column B/C adjustments and untaxed-income restrictions remain unmodeled. 2025 Schedule CA (540) instructions, Part II line 16
Montana Before 2024, include the repayment once in final and comparison aggregates and add the 2017 Montana-AGI miscellaneous floor. From 2024, follow the federal deduction election and cap the deducted state-income-tax addback by the full allowed itemized excess over the standard deduction. 2023 HB 109 §4, MCA 15-30-2120, 2024 Form 2 instructions
Arizona Leave the federal deduction out of az_itemized_deductions; the Arizona AGI addition and separate credit remain follow-ups. A.R.S. 43-1021(9), 43-1029
Kansas Subtract the federal repayment deduction in ks_itemized_deductions; retain this treatment pending the separate closed-list rewrite. K.S.A. 79-32,120(a)
Wisconsin Keep the repayment in the itemized deduction credit base when it is not used for the separate Wisconsin credit. The latter is not modeled. Wis. Stat. 71.07(5)(a)6–7, IRC 67(b)(9)
Missouri Keep section 1341 relief out of ignored_credits, allowing it to reduce the federal-income-tax deduction base. RSMo 143.171(2)(1)
Oregon Preserve the section 1341 reduction in accrued federal tax; add back EITC only before the cap. ORS 316.680(1)(b), 316.685(1)
Virginia Include the federal claim of right deduction and the federally floored 2017 miscellaneous deduction before the limited-deduction reduction and income-tax adjustment. Va. Code 58.1-322.03(1)(a), 58.1-301(B)(5)

For the property-test household (single, age 40, wages $60,000, charitable gifts $25,000, a $10,000 repayment, one per state, 2025), the fixed federal credit method can raise Alabama, Missouri and Oregon tax by reducing the deductible federal tax. The property test requires those taxes not to fall and at least one to rise, while requiring other states' taxes to remain unchanged for this household. Under the fixed deduction method it requires Arizona and Kansas to remain unchanged; Wisconsin is no longer in that exclusion list. These are household-specific checks without a supplied state repayment-credit input. Montana's elderly homeowner/renter credit remains a known exception for eligible filers because it counts federal refundable credits as household income.

Other federal deduction flows. The deduction continues to reach states that start from federal itemized deductions or federal taxable income, subject to their own rules. California's default carryover is checked separately by its YAML cases. Existing questions remain about Maine, New Mexico and Maryland reading a federal itemized total before section 68, and Colorado's addback coordination. The remaining state sweep reports are research leads, not certification of every state's law.

Other federal credit flows. Main counts federal income_tax_refundable_credits in Montana's elderly homeowner/renter credit household income (#9915); section 1341 relief therefore reaches that calculation. Idaho reads federal itemized deductions after the section 68 limitation; #10023's medical and health-premium coordination does not alter this flow.

Overlap with #10093. Any Oregon worksheet-list rewrite must preserve the statutory section 1341 reduction and the current Oregon witness; it must not restore the removed add-back. Kansas's current exclusion remains until its closed-list rewrite lands.

Overlap with #10070, #10110 and #10206. Preserve Montana wagering-loss entries when reconciling these branches. This PR now includes the from-2024 federal deduction election, full allowed federal itemized base and state-income-tax addback ceiling that the earlier body deferred to #10206. The post-2023 path carries the federal repayment deduction without a separate Montana repayment-list entry. Reconcile the overlapping #10206 implementation against this completed behavior rather than deferring it again.

Own rules, beyond the California default carryover. Separate state repayment credits, deductions or subtractions identified by the sweep remain outside this PR unless expressly described above: AR, AZ, CA, CT, GA, HI, IA, ID, IL, IN, LA, MA, MD, MI, MN, NE, NJ, NY and New York City, OH, OK, OR, SC, VA, WI and WV (KY and PA uncertain). See Follow-ups. Items awaiting decisions d1741, d1742 or d1744 remain unchanged.

Household on main vs this branch (2025, single, age 40)

Historical household comparison, before these review revisions. Computed at this branch's then-head 2d36a76bca and at the main it merged, 2f3053c845 (which includes #10028), from frozen snapshots of each. Script ~/reviews/us-hub/federal-1341/evidence/households.py; outputs households_{base,pr}_2d36a76bca.json there. On main the two prior-year inputs do not exist, so main gives the deduction-free federal tax and #10028's North Carolina deduction. The same households are YAML cases (integration.yaml cases 1 and 4; the last cases in nc_claim_of_right_deduction.yaml).

Household main This branch
Publication 525 Example 40: wages $65,700, charity $15,750, repays $5,000, prior-year decrease $568 (Texas) Federal tax $5,903 $5,155.50: the deduction ($5,335 by the credit)
Wages $40,000, standard deduction, repays $10,000, prior-year decrease $2,200 (Texas) $2,671.50 $471.50: the credit; the deduction would lose to the standard deduction
North Carolina: wages $80,000, property tax $4,000, charity $8,000, repays $5,000, prior-year decrease $1,100, prior-year NC increase $212.50 Federal $9,049; NC $2,677.50 Federal $7,949 (credit); NC $2,645.62: no deduction, $212.50 payment
Same, prior-year decrease $568 Federal $9,049; NC $2,677.50 Federal $8,145.21 (deduction); NC $2,677.50

The California regression uses wages of $65,700, gifts of $15,750, a $5,000 repayment, and a $568 federal prior-year decrease in 2025. At the reviewed head, California taxable income was $49,950 and ca_income_tax was $1,378.89. Carrying over the deduction gives expected taxable income of $44,950 and ca_income_tax of about $1,078.89. The California credit-method property still expects zero federal deduction and no repayment effect on California tax for the tested household.

Tests

Historical review-revision validation at 60cb3dd35a: the results in this block predate the current main merge and statute-first updates. Current-head results belong in the Merge with main section above.

Review revision head: 60cb3dd35a4f025af95cbde0deae952b48b366d6 (pushed as a fast-forward).

Fail-before checks reproduced the changed behavior:

  • California: $6,000 itemized deductions versus $11,000 expected; Example 40 taxable income $49,950 versus $44,950 and tax $1,378.89 versus $1,078.89.
  • North Carolina: supplied credit-method flags paid $300 below the eligibility threshold and incorrectly denied the $1,999/$2,000 boundary deductions and $1,500 historical deduction.
  • The matching North Carolina property assertion failed for both 2025 and 2026 before the eligibility gates.

Local pass-after validation: 219 passed, 0 failed, 0 errors across 24/24 completed passing files; 219 tests are expected in the complete matrix (142 YAML cases and 77 Python tests). 0 files remain unverified locally. Each direct foreground invocation sets OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 MKL_NUM_THREADS=4 VECLIB_MAXIMUM_THREADS=4 NUMEXPR_NUM_THREADS=4 OMP_WAIT_POLICY=PASSIVE; local policyengine-core is 3.33.2. Early invocations took 20–28 minutes wall time per file on this host; later invocations became faster. CI results are separate from these local checks.

File Expected Local pass-after result
test_override_branches.py 23 23 passed
claim_of_right_credit.yaml 3 3 passed
claim_of_right_credit_applies.yaml 7 7 passed
claim_of_right_section_1341_eligible.yaml 5 5 passed
integration.yaml 6 6 passed
tax_unit_claim_of_right_repayment.yaml 2 2 passed
claim_of_right_deduction.yaml 5 5 passed
az_itemized_deductions.yaml 11 11 passed
ca_itemized_deductions_pre_limitation.yaml 14 14 passed
ks_itemized_deductions.yaml 3 3 passed
mo_federal_income_tax_deduction.yaml 13 13 passed
mt_claim_of_right_deduction.yaml 5 5 passed
nc_claim_of_right_payment.yaml 4 4 passed
nc_claim_of_right_deduction.yaml 24 24 passed
nc_income_tax.yaml 4 4 passed
or_federal_tax_liability_subtraction.yaml 11 11 passed
va_reduced_itemized_deductions.yaml 5 5 passed
wi_itemized_deduction_credit.yaml 3 3 passed
nc_cdcc.yaml 9 9 passed
nc_eitc.yaml 5 5 passed
nc_eitc_excludes_use_tax.yaml 2 2 passed
test_claim_of_right_section_1341_properties.py 47 47 passed
test_nc_claim_of_right_properties.py 7 7 passed
ca_income_tax.yaml 1 1 passed

No microsimulation was run by that review-revision job; the hub's separate historical rerun at 60cb3dd35a is under Microsimulation. These historical results do not establish that the current main merge and statute-first updates pass.

Historical review-revision CI run 39155269843 at 2026-10-18 20:51:01 UTC: 27 passed, 0 failed, 0 pending.

Historical coverage described at the reviewed head; the historical review-revision results are above. YAML, with each expected value computed by hand from the cited source:

  • gov/irs/credits/claim_of_right/integration.yaml, 6 cases: Publication 525's Example 40 from the 2025, 2024 and 2018 editions; a standard-deduction filer for whom only the credit helps; a prior-year decrease above the year's tax (refunded); a joint return with a dependent. The 2024 and 2018 editions figure tax from the Tax Table, so the cases state both the rate-schedule amount PolicyEngine computes and the publication's figure.
  • claim_of_right_credit_applies.yaml, 7 cases: equal tax under both methods keeps the deduction; one cent and 50 cents more decrease switch to the credit; exactly $3,000; no prior-year decrease; and two cases with gov.simulation.branch_to_determine_itemization off.
  • claim_of_right_section_1341_eligible.yaml (5), tax_unit_claim_of_right_repayment.yaml (2), claim_of_right_credit.yaml (3).
  • claim_of_right_deduction.yaml, 5 cases, including the 2017 overall limitation (method fixed, since 2017 federal tax is not modeled) and the 2026 limitation under section 68 as amended by P.L. 119-21.
  • North Carolina: 5 new cases in nc_claim_of_right_deduction.yaml (one in 2016 with the method derived), nc_claim_of_right_payment.yaml (3), 1 in nc_income_tax.yaml.
  • One case each for Arizona, California, Kansas, Missouri, Oregon, Virginia and Wisconsin; 5 for Montana (2023–2025); 4 for the nc_eitc and nc_cdcc reforms.

tests/unit/test_claim_of_right_section_1341_properties.py (the Rest job's remaining Python group). Why Python: the method is chosen in override branches, and the failure this file detects is a branch that disagrees with a fresh simulation. That depends on calculation order and on reusing a simulation across years, which a YAML case cannot control. The file also states cross-case relations (monotonicity across the threshold) over a 350-point grid (repayment × prior-year decrease × wages × charity) for 2025 and 2026, and runs one 51-jurisdiction simulation set for 2025. The fixed-method reference simulations run the same deduction formula, so they check the branch machinery and the lesser-of rule, not the deduction's arithmetic, which the YAML cases check against Publication 525.

Invariants (the federal grids and updated state check)

  1. Lesser of. Income tax equals the smaller of (a) tax from a separate simulation with the deduction method fixed as an input and (b) tax from a separate simulation with no repayment, minus the prior-year decrease, compared to the cent. Ties go to (a). The method flag matches.
  2. Differential. Each branch's tax equals the corresponding separate simulation's.
    2a. Calculation order. Every reported variable is the same when a tax liability under one itemizing choice, or either method branch, is calculated first: over the grid with itemization branching on, and for the review's household with it on and off.
    2b. Later years. A second year calculated on the same simulation equals a simulation of that year alone.
  3. All or nothing, never both. The deduction is the whole repayment or zero; the credit is the whole decrease or zero; they are never both positive.
  4. Threshold. A repayment of $3,000 or less changes nothing in 2025 and 2026 (section 67(h), formerly 67(g)).
  5. Never raises tax; monotone. Tax is never above the no-repayment tax, never rises with the repayment (also across $3,000) and never rises with the prior-year decrease.
  6. Refund. When the credit applies and the decrease exceeds the tax, income tax is negative.
  7. North Carolina. Its deduction is zero when both section 1341 eligibility and the credit method apply and otherwise equals the deduction with the deduction method fixed; its payment is the prior-year increase when both conditions apply and zero otherwise; nc_income_tax equals tax before refundable credits minus the payment.
  8. States (tested household; updated for statute-first treatment). With the credit method fixed, Alabama, Missouri and Oregon tax cannot fall as deductible federal tax decreases; at least one rises in the fixture. The other states remain unchanged for this household. With the deduction method fixed, Arizona and Kansas remain unchanged; Wisconsin can receive the deduction in its itemized deduction credit base. California's default carryover is checked separately by its YAML cases. Montana's elderly credit remains a known exception for eligible filers. The current-head run is reported in the merge validation block, separately from historical counts.

Mutation check at 32b0c13a6a (scripts/mutants.py, then scripts/mutants_extra.py, on a frozen snapshot; evidence/mutants*_*.json). The unmutated control passes all 40 tests in the two property files. Eight single-line mutants:

  • Caught by the property files: the deduction ignoring the method, ties going to the credit, an inclusive threshold, the North Carolina bar dropped, the North Carolina payment ignoring the method, and the itemizing branches choosing their own method (the review r2 fix).
  • Caught by the YAML cases: the credit counting a dependent's repayment fails tax_unit_claim_of_right_repayment.yaml case 2 and integration.yaml case 6.
  • Caught by none: the method branches inheriting the parent's cache (inherit_calculated=True, undoing the review r1 fix) passes the property files, the core override-branch tests and the federal YAML. It survives for two reasons. First, since the review r2 fix every itemizing branch needs the parent's method before it opens, so when the method branches open (from inside the method's own formula) the parent holds no value that depends on a method and that the method branches' federal tax reads. A state branch can hold such a value, for example va_income_tax_if_claiming_refundable_eitc through federal tax_unit_itemizes, but federal tax reads no state liability: the SALT deduction uses estimated withholding. Second, from core 3.33 set_input on the method branch itself drops values stored after the method's first store. inherit_calculated=False stays as a cheap second guard (review r8).

Status.

  • CI at dc10cc58ce. Every check passed except the Rest job. It failed one test, test_known_violations_only_shrink, on an Illinois entry that main had already dropped from the ratchet (Drop the fixed Illinois AABD entry from the person-adds ratchet #10092). The main merge at 2d36a76bca brought that in.
  • CI at 32b0c13a6a. 25 of 26 checks passed. The Rest job failed three 2026 cases of the 1341 property file under policyengine-core 3.33.3: the itemizing-branch bug described in "Design notes", fixed in d1c695b2f7. CI resolves the latest compatible core (uv lock --upgrade-package policyengine-core). uv.lock pins 3.32.27 and this worktree's venv had 3.32.29, and both keep the inherited method. So the earlier local runs below passed. Later local runs used 3.33.3.
  • CI at the reviewed head, 17cad4b53b53919b743afa51969e9a9e8c5dfc9b: all 27 checks passed, run 38544852005, attempt 1. The run completed successfully and included the property tests under policyengine-core 3.33.3. This is the status of the reviewed head, before the changes listed above; new-head validation is reported separately.

Earlier locked runs at 32b0c13a6a on core 3.32.29 (~/reviews/us-hub/federal-1341/tests.sh through ~/reviews/us-hub/scripts/heavy_run.sh; logs in evidence/runs-32b0c13a6a/):

  • Baseline YAML: every new and changed federal, North Carolina and state file, plus itemized_taxable_income_deductions.yaml and tax_unit_itemizes.yaml, in one process: 145 passed in 151 s, peak 9.98 GB.
  • mt_claim_of_right_deduction.yaml (5 cases, including the new 2024 and 2025 cases), run directly: 5 passed.
  • nc_eitc/nc_cdcc contrib YAML, in its own process: 16 passed.
  • Both property files with tests/core/test_override_branches.py: 63 passed in 634 s, peak 3.09 GB. The slowest are the core random-household order test (146 s) and this PR's 51-jurisdiction check (30 s).
  • Code health (parameter keys, reference URLs, dead-URL guard, concatenated URLs, builtin sum, Rest groups, non-refundable consumers, in-place writes, uprating placement, person adds of group variables) and test_programs_registry.py: 833 passed, 10 skipped.

Historical locked local runs at the then-head, d1c695b2f7, on core 3.33.3 (the version CI resolves; logs evidence/*_d1c695b2f7.log):

  • Baseline YAML, the same files: 145 passed.
  • nc_eitc/nc_cdcc contrib YAML: 16 passed.
  • Both property files (now with the 2026 itemizing-branch test), tests/core/test_override_branches.py, and Measure a branch's behavioural responses against baseline policy, with its own cache #9913's test_behavioral_response_measurement_copies.py and test_behavioral_response_measurements.py: 109 passed.
  • Code health and test_programs_registry.py: 845 passed, 10 skipped.

From 2026-10-10 to 10-12 Fleet ops held this session off local tests and microsimulations while the shared host was saturated. Earlier direct runs in the worktree, at heads up to 03439621bc and before the review fixes:

  • New federal, North Carolina and contrib YAML files: 75 passed (before the state corrections).
  • The six state YAML files and va_itemized_deductions.yaml: 51 passed.
  • test_claim_of_right_section_1341_properties.py: 16 passed at head 4526aed52f (with the 51-jurisdiction check run for two years). It later expanded with the order, later-year, Texas and stale-parent tests, and the 51-jurisdiction check was limited to 2025. David verified 47 tests in this file at the reviewed head; the new-head count is reported above.
  • test_nc_claim_of_right_properties.py: 7 passed at head 03439621bc.
  • Code health (parameter keys, reference URLs, dead-URL guard, concatenated URLs, builtin sum, Rest groups, non-refundable consumers, in-place writes, uprating placement) and test_programs_registry.py: 820 passed, 10 skipped.

The historical household evidence above was recomputed at 2d36a76bca. Later pre-review commits change Montana's list and the 2026 itemizing branch, which none of those 2025 households reaches. The California carryover correction changed that state's household results, so the hub reran the microsimulation at the earlier head 60cb3dd35a (under Microsimulation). The historical review-revision validation superseded earlier local-test accounts for that head only; current-head validation is listed separately in the merge section.

Cost

  • CI group. The Rest job's remaining group on main (run 37926760594, as reported in Add North Carolina's claim of right repayment itemized deduction (G.S. 105-153.5(a)(2)d) #10028) has 2,151 tests: 1,315 s of test time, 24:05 wall clock, 12.8 GB max RSS on the 16 GB runner.
  • New file, local measurement (macOS, host load about 190; not comparable with Linux CI): 16 tests in 43.1 s with peak RSS 2,033 MB, when the 51-jurisdiction check ran for two years. The grid fixture (eight simulations of 350 tax units) took 5.4 s to 9.6 s. Each 51-jurisdiction check (three simulations that compute every state's tax) took 14.5 s to 17.0 s, so the file now runs it for 2025 only. This was an earlier local measurement. David's reviewed-head CI report records 47 tests in the file taking about 120 s; the 2,340-test remaining group took 20:53 wall clock and 7.76 GB maximum resident set.
  • Existing test_nc_claim_of_right_properties.py. Its repayments up to $250,000 now trigger the method comparison: 2.18 s and 1,012 MB at Add North Carolina's claim of right repayment itemized deduction (G.S. 105-153.5(a)(2)d) #10028's head, 14.14 s and 1,841 MB with the comparison running. Those tests check the deduction's arithmetic, so they now fix the method as an input: 1.98 s and 1,040 MB.
  • Microsimulation cost. No additional method-comparison branches when no record has a repayment above $3,000: the method formula returns before branching, and the itemizing branches keep sharing the parent's cache. The eligibility check still runs. Measured historically on the 2025 default dataset at d1c695b2f7: 566 s on main and 521 s on this branch, peak footprint 14,336 MB on each (see "Microsimulation").

Microsimulation

Current head 4b8cdd1eed: impact pending. The hub's run is queued and starts when the shared host reservation that began 2026-10-23 ends. The results below are for earlier heads.

Historical review-revision head 60cb3dd35a: no change (hub, 2026-10-19). This is not a microsimulation of the current main merge or statute-first update. 2025, default dataset, main at the merge base a2f63c1235 against 60cb3dd35a, under the shared heavy lock. All 22 shared outputs (the 20 below plus ca_income_tax and household_benefits) are identical on every record: federal income tax is $2,418,430,680,404 and California income tax $132,350,714,723 on both sides, and claim_of_right_repayment is $0 on every record of both sides. The four new variables exist only on the branch, so they are not compared. Comparison: ~/reviews/us-hub/fixes/10038-impact/compare.2025.json.

Historical impact, before these review revisions: no change. The measurements here remain evidence for their stated earlier heads. 2025, default dataset (79,729 tax units, 166,321 people), main a2f63c1235 against this branch at its then-head, d1c695b2f7. Both ran from frozen snapshots, base then branch, under one acquisition of the shared heavy lock, on policyengine-core 3.33.2. The driver is ~/reviews/us-hub/federal-1341/impact/pair.sh, with outputs in impact/out/ and the comparison in impact/compare.2025.json.

  • Shared variables. Every one of the 20 is identical on every record, with 0 records changed. They are income_tax, state_income_tax, household_net_income, taxable_income, itemized_taxable_income_deductions, tax_unit_itemizes, the federal, state and household refundable credit totals, household_tax_before_refundable_credits, nc_income_tax, the seven corrected state variables (MO, OR, KS, WI, AZ, VA, CA), mt_misc_deductions and claim_of_right_repayment. For example, federal income tax is $2,418,430,680,404 on both sides.
  • New variables. claim_of_right_deduction, claim_of_right_credit, claim_of_right_credit_applies and nc_claim_of_right_payment are zero on every record of the branch. claim_of_right_repayment is zero on every record, so no unit reaches the $3,000 threshold, and get_itemization_branch gives the itemizing branches exactly main's inputs.
  • Cost. 566 s for main and 521 s for the branch. Peak footprint was 14,336 MB on each side. The host was shared, so the timings carry noise, but the eligibility check adds no measurable cost.
  • Earlier run. The same comparison at 32b0c13a6a against main 2f3053c845 also changed 0 records (impact/runs-32b0c13a6a/).

Axiom

axiom: TheAxiomFoundation/rulespec-us#1657 queued (26 U.S.C. 1341 and N.C. Gen. Stat. 105-266.2), labelled pe-parity, filed by the US hub under Max's standing go (d1142).

  • rulespec-us main 16a667719 has no us/statutes/26/1341 module and no module for G.S. 105-266.2.
  • The issue gives the module paths, the verbatim law, the outputs, a pasteable review_finding and companion tests from Publication 525. It also supplies the section 1341(a)(5) bar that the North Carolina (a)(2)d draft (d1165) leaves as an input.
  • Blocker before dispatch: whether the pinned corpus release holds us/statute/26/1341 and us-nc/statute/105/105-266.2 is not verified; the issue lists that check.

Follow-ups (not in this PR)

  • Other states' own rules (chips, each to re-verify the sweep's leads before encoding):
    • credits tied to the federal method: NY, New York City, MD, VA, NE, LA (task_4c159ea6);
    • states that compute their own credit or method: AZ, CA, CT, GA, IA, ID, MI, MN, OK, OR, SC, WI (task_ea21fbfe);
    • states with their own deduction or subtraction: AR, HI, IL, IN, MA, NJ, OH, WV, with KY and PA to settle (task_497fdb9d). New York's retained 2% pool for small repayments and its deduction for repayments over $3,000 on 2025 IT-196 line 34, instructions PDF p. 17 are in the first chip. ny_itemized_deductions_max currently omits the latter, so the New York follow-up must add it.
  • Existing state gaps the sweep surfaced, none introduced here (task_835b6960): states that start from federal itemized deductions but read the pre-limitation total, which ignores section 68 from 2026 (ME, NM, MD); Colorado's add-back coordination; Kansas summing every federal non-SALT deduction; misc_deduction counted twice before 2018 in Mississippi and Missouri; Alabama's miscellaneous deduction reading the suspended federal one; Montana's pre-2024 casualty_loss_deduction projection through its miscellaneous list. Oregon's section 1341 carry-through is resolved here under the statute. The from-2024 Montana federal deduction election, full itemized base and state-income-tax ceiling formerly deferred to task_344fbc71 / Use the federal itemized total and deduction type for Montana from 2024 #10206 are now implemented here; only non-overlapping Montana work remains for that follow-up.
  • Branches under behavioural-response reforms (see "Not modeled"): calculate a value that triggers the response measurements in the parent before opening the itemizing and method branches, as marginal_tax_rate_on_capital_gains (capital_gains_responses.py) and marginal_tax_rate do. This applies to main's itemizing branches as well as this PR's.
  • An existing federal gap the review added: the AMT does not reverse the section 68 reduction, though section 56(b)(1)(E) says section 68 does not apply in computing alternative minimum taxable income. It predates this PR; it and Maryland were passed to the fourth chip.

Readings for Max

  • Missouri, Oregon, Wisconsin: statute-first update applied. The 2026-10-20 verified backlog supersedes the earlier d1204 worksheet choices. This PR drops the MO/OR add-backs and Wisconsin's blanket deduction exclusion.
  • Alabama: verified rule applied here from 2021. The regulation's all-payment-credit subtraction, actual net-PTC input, residual other-credit input and refundable-AOC correction are included in this PR; this is no longer queued for another chip. Pre-2021 extensions remain unverified.
  • Pending decisions d1741, d1742 and d1744: leave their items as built until Max rules.
  • Section 1341 for repayments deducted in arriving at AGI, and the pre-2018 small-repayment deduction (see "Not modeled").

🤖 Generated with Claude Code

MaxGhenis and others added 9 commits October 9, 2026 08:50
G.S. 105-153.5(a)(2)d, added by S.L. 2016-5 for 2014 and later, lets North
Carolina itemizers deduct repayments of income included in AGI in an earlier
year under a claim of right (Form D-400 Schedule A line 8). Repayments above
$3,000 are deductible in full; smaller ones are reduced by 2% of federal AGI
less other miscellaneous itemized deductions, which the 2016 and 2025 NCDOR
worksheets both reproduce. PE had no input for these repayments, so it adds
claim_of_right_repayment (person level; only the head's and spouse's count)
and moves North Carolina's uncapped itemized items into a parameter list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…C taxed

Review r1 (subfleet 20261009-090558-nc-itemized-review):
- S.L. 2026-31 section 1.8 rewrites G.S. 105-153.5(a)(2)d for taxable years
  beginning on or after January 1, 2026: the repaid amount must have been
  included in AGI "as modified in G.S. 105-153.5 and G.S. 105-153.6" in the
  earlier year. New person input
  nc_claim_of_right_repayment_excluded_from_income (the part NC deducted when
  received, such as repaid Social Security) and a dated parameter apply it.
- Count only the head's and spouse's other miscellaneous expenses against
  the pre-2018 floor; a dependent's are on the dependent's return.
- The property grid now varies property taxes (so the $20,000 cap binds) and
  adds a 2026 grid for the excluded part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h Carolina's 1341(a)(5) bar and G.S. 105-266.2 payment (WIP)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es that exclude them (AZ, KS, WI, MO, OR, VA); property tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fragment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to keep it at two seconds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…urn-level prior-year inputs, California and Montana flows

- The branches that fix the claim of right method start from inputs only, and
  the itemization branches settle the method in the parent first, so a tax
  liability calculated before the method is known cannot leak into them.
- Ties are compared to the cent, so a one-cent difference picks the credit.
- The prior-year federal decrease and NC increase are return-level inputs
  defined on chapter 1 and Article 4 tax.
- California leaves out the federal deduction (Schedule CA Part II line 16);
  Montana deducts it through 2023 (Form 2 itemized line 18).
- Section 67(g) is now 67(h); document the Arizona and NC coverage limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2 found that with itemization branching off, tax_liability_if_not_itemizing
used the parent's method when calculated first but chose its own after
income_tax. The itemizing branches now take the method as an input. A branch
keeps its parent's cache when an override equals the value the parent already
holds, so ordinary simulations still share it. Adds the review's Texas
household as an order test under both itemization settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 3 commits October 11, 2026 11:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… branches only when someone qualifies

Review r3 showed that keeping a parent's cache when an override equals the
parent's current value can reuse tax calculated before another input
changed. Branches again drop inherited values whenever the parent knows an
overridden variable. The itemizing branches add the claim of right method as
an override only when some tax unit repays more than $3,000, so simulations
without a qualifying repayment keep sharing the parent's cache. Adds the
review's stale-parent sequence as a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th use tax

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the add/add conflicts with #10028's squash (557b539) by
keeping this branch's 26 U.S.C. 1341(a)(5) bar on the North Carolina
deduction, its added NC cases and the method fixture in the NC property
grid, and keeps both sides' Arizona itemized deduction cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 13, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 13, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 13, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@DTrim99 DTrim99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for 1 should item; details in the full report above. The federal section 1341 rules check out: the lesser-of computation with ties going to (a)(4), the (b)(1) refundable excess, the (b)(3) exclusion across every federal and state reader, and no circularity. 13 expectations were hand-checked, 7 of the 8 state corrections were confirmed, and CI is green. Should 1: the PR keeps the federal deduction out of ca_itemized_deductions_pre_limitation, but the 2025 Schedule CA (540) line 16 instructions carry it over by default and remove it only in specific cases (a California credit claimed, the income not taxed by California, or Social Security repayments). As a result, a California resident using the federal deduction method gets no California relief: Pub. 525 Example 40 comes out $300 too high. Please let the deduction flow and document the California cases not modeled, or label the exclusion as a deliberate simplification. The stacked state PRs inherit this, so fixing it here covers them too.

MaxGhenis added a commit that referenced this pull request Oct 20, 2026
get_itemization_branch (tools/general.py) gives the itemizing and
not_itemizing branches to tax_unit_itemizes and both tax liability
variables, so every caller asks for the same inputs and shares one
branch. #10038 adds the same helper with a
claim of right override; whichever lands second keeps that version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 22, 2026
…10186)

* Take the 2020 charitable deduction for non-itemizers above the line

CARES Act sec. 2204 added 26 U.S.C. 62(a)(22) for taxable years beginning
in 2020: up to $300 ($150 married filing separately) of cash charitable
contributions by an individual who does not itemize, deducted on 2020
Form 1040 line 10b in arriving at AGI. The model took it from AGI with
the 2021 170(p) deduction instead.

- New charitable_contributions_ald in the 2020 above-the-line list, so
  AGI and every MAGI built from the list (Social Security, UC exclusion,
  IRA and student loan worksheets, which all subtract line 10b) see it.
- tax_unit_itemizes takes the itemized and standard deductions it
  compares from the branch with each choice in 2020, since AGI now
  depends on the choice.
- non_itemizers_amount (170(p)) is zero in 2020.
- charitable_deduction_for_non_itemizers is no longer listed among
  itemized deductions for 2020 and 2021, where it was added on top of the
  full charitable deduction once charitable_deduction stopped netting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test the 2020 above-the-line charitable deduction from the 2020 Form 1040

Unit cases for each filing status cap, itemizers, noncash gifts, 2019 and
2021; integration cases worked from Form 1040 lines 9-15, the Social
Security Benefits and Unemployment Compensation Exclusion worksheets, an
itemization choice the deduction flips, and the 2020 and 2021 itemizers
who no longer count the gifts twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the 2020 charitable deduction out of state AGI where states decoupled

Taking the deduction above the line moves it into every state AGI that
starts from federal AGI. States that did not adopt 62(a)(22) for 2020 add
it back:
- California: Schedule CA (540) Part I, Section C, line 22, column B.
- Indiana: IC 6-3-1-3.5(a)(26), Information Bulletin 119 (code 120).
- Kentucky: Schedule M line 5, by each spouse's share of federal AGI.
- Minnesota: Schedule M1NC line 6, through M1M line 16.
- North Carolina: D-400 Schedule S, Part A, line 16.
- New York: IT-558 addition A-003 (recomputed federal AGI).
Massachusetts Part B AGI, which subtracts the federal ALD list, disallows
it (TIR 20-9, B(6)). Arizona's 2020 standard deduction increase for
charitable contributions subtracts it (worksheet line 5C).

charitable_contributions_ald returns 0 in years that do not list it, so
these additions never reach the itemization choice outside 2020.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Take the 2020 charitable deduction off Michigan household resources

Michigan Treasury: for 2020 the cash contribution deduction is a deduction
from AGI 'and therefore Total Household Resources as well'; for 2021 it is
not. Line 30 now lists charitable_contributions_ald in 2020.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test invariants of the 2020 above-the-line charitable deduction

Seeded and Hypothesis households in seven states, 2020 and 2021: the
deduction is min(cash gifts, Form 1040 line 10b cap) for non-itemizers and
zero otherwise; AGI is wages less it; Schedule A totals are exactly their
components; the simulation's income tax is that of the chosen branch and
the lower of the two; California and New York add it back and
Massachusetts Part B AGI keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Apply the statute's $300 cap and Sol review r1 findings

- 62(a)(22) caps the 2020 deduction at $300 for every return; the 2020
  Form 1040 instructions' $150 for married filing separately has no basis
  in the statute, which governs (PolicyEngine statute-first rule,
  2026-10-19).
- Count only the head's and spouse's cash gifts to 170(b)(1)(A)
  organizations (resolved_charitable_cash_donations_50_pct); a dependent's
  gifts are on the dependent's own return. New
  charitable_contributions_ald_person gives each filer's part, by their own
  gifts, for per-person AGI; Kentucky adds back that part.
- Without branching (as CI runs YAML tests), the 2020 itemization choice
  counts what not itemizing takes off AGI with the standard deduction.
- The tuition and fees MAGI subtracts line 10b (2020 Pub. 970 Worksheet
  6-1 line 2).
- New York: ny_recomputed_federal_agi (IT-201 line 19a) adds back IT-558
  A-003; NY AGI, the IT-196 floors and limitation, and the credits read it
  (2020 IT-196, IT-213, IT-214, IT-216, IT-221).
- Minnesota: AMT income adds back M1NC line 6 (2020 M1MT line 4); the
  Social Security worksheet step 8 leaves out line 10b (2020 M1M p.8).
- Michigan's 2020 MI-1040CR line 30 cite is file page 28.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Share one itemization branch helper with the tax liability branches

get_itemization_branch (tools/general.py) gives the itemizing and
not_itemizing branches to tax_unit_itemizes and both tax liability
variables, so every caller asks for the same inputs and shares one
branch. #10038 adds the same helper with a
claim of right override; whichever lands second keeps that version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the 2020 charitable deduction out of CVRP income; cite MN Laws 2023

- CVRP counts income before adjustments (Implementation Manual), so
  line 10b does not lower it.
- Kentucky adds back each filer's part in ky_agi; ky_additions stays a
  pure input, so supplying it no longer drops the addback.
- Minnesota: Laws 2023, ch. 1, sec. 22(c)(2) and (d)(2), retroactive for
  2020, make the 62(a)(22) amount an addition and part of AMT income.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Answer Sol review r2: full deduction comparison and NY line 19a credits

- Without branching, the 2020 itemization choice compares everything each
  choice takes from gross income: taxable_income_deductions_if_itemizing
  (Schedule A, wagering losses, the QBI deduction it allows) against
  taxable_income_deductions_if_not_itemizing plus the AGI reduction.
- New York: get_ny_recomputed_branch, a branch with the 2020 charitable
  deduction zeroed and the federal itemization choice kept, so the NY and
  NYC EITC match the federal credit recomputed with IT-201 line 19a
  (IT-215) and the Empire State child credit's pre-TCJA federal credit
  uses line 19a (IT-213 Worksheet A).
- NYC household, school, child care and income tax elimination credits
  read ny_recomputed_federal_agi; it is no longer limited to New York
  units, since NYC tests set residence without the state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Answer Sol review r3: line 19a adds only the deduction

- The New York branch sets adjusted gross income to line 19a (federal AGI
  as reported plus IT-558 A-003) instead of zeroing the deduction and
  recomputing, which also moved taxable Social Security; this also covers
  a supplied adjusted_gross_income.
- For the Empire State child credit it keeps income tax before credits as
  reported (IT-213 Worksheet A lines 7-8); the EITC branch does not read
  it, because New York City income tax enters the federal SALT deduction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Carry the federal EITC as reported into the Empire State child credit

IT-213 Worksheet C line 7 carries federal Schedule 8812 line 13, whose
lines 12-13 use the earned income credit as reported, so the child
credit's branch keeps eitc with the reported federal tax (Sol review r4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Count non-itemizer charitable deductions when choosing itemization

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Preserve the 2020 above-the-line charitable deduction and 2021
non-itemizer treatment while retaining section 1341 method-aware
itemization branches. Keep the single Schedule A parameter block
with the claim-of-right deduction.

Add six hand-calculated 2020/2021 regressions combining charitable
deductions and both section 1341 methods, including comparisons
with itemization branching disabled.
@MaxGhenis
MaxGhenis requested a review from DTrim99 October 23, 2026 08:54
@DTrim99

DTrim99 commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

PR Review (round 2): Model the claim of right repayment deduction and credit (26 U.S.C. 1341) and North Carolina's rules that depend on it

PR #10038 (author: MaxGhenis), head 4b8cdd1eed, last reviewed at 17cad4b53b. Since then there are 14 author commits and 5 merges with main. Axiom: TheAxiomFoundation/rulespec-us#1657 queued.

Summary

All six round-1 findings are fixed. The federal section 1341 code has not changed since round 1, apart from two docstrings.

  • California (round-1 Should 1). California now carries the federal deduction, as Schedule CA column A does. The new Publication 525 Example 40 case for California is right: tax of $1,078.89 on $44,950.
  • The five suggestions. All are applied.
  • The merges. All nine hand-resolved blocks are correct, and nothing that main added was dropped.
  • Branch isolation. It still holds after main's Take the 2020 charitable deduction for non-itemizers above the line #10186 helper was folded in.

The new work goes well beyond round 1:

  • Statute-first state changes. The PR reworks Alabama, Missouri, Oregon, Wisconsin and Virginia to follow their statutes or regulations.
  • Montana.
    • It adds a 2017 2% miscellaneous pool.
    • From 2024 it rebuilds Montana taxable income from the federal base.
    • It moves Montana's state-income-tax addback ahead of the line 3 zero floor.

Most of this checks against the sources. Three items need changes:

  1. Montana from 2025. The pre-floor addback is right for 2024 (Worksheet A). The 2025 Form 2 moved the addback to Schedule I line 4, after the floor. The head applies the 2024 ordering to 2025 and 2026, and its property test asserts that.
  2. The source-conflict backlog. Four entries on main (AL, MO, OR, WI) will say the code follows the worksheet once this PR merges. In fact it follows the statute.
  3. Dead references. Two new links return 404. One is the only source for the new 2% Montana floor parameter.

Four suggestions follow. CI is 27/27 green at the head. The branch merges cleanly with current main.

Prior findings

Round-1 finding Status Evidence
Should 1: California left the federal deduction out of its itemized deductions Fixed claim_of_right_deduction is out of the exclusion tuple. The comment at ca_itemized_deductions_pre_limitation.py:27 lists what is not modeled: California's own credit and column B removal, the column C deduction, and the bar for untaxed income. The YAML case expects 11,000. CA is out of STATES_WITHOUT_THE_DEDUCTION (test_claim_of_right_section_1341_properties.py:85). The new ca_income_tax.yaml runs Example 40 for a California resident (see the hand trace below).
Suggestion 1: gate North Carolina on section 1341 eligibility Fixed nc_claim_of_right_payment.py:37 and nc_claim_of_right_deduction.py:73 use eligible & credit_applies. Boundary cases at repayments of 0, 2,999, 3,000 and 3,001 have the method supplied, and there is a 2016 case.
Suggestion 2: input documentation Fixed The label is now "Federal prior-year tax decrease …". The eligibility documentation says same-class aggregation (26 CFR 1.1341-1(a)(3)) is not modeled.
Suggestion 3: the section 67(b)(9) reference on the threshold Fixed Removed from threshold.yaml. It remains on the deduction.
Suggestion 4: the New York follow-up should cover IT-196 line 34 Fixed (body) The follow-ups name line 34 and the gap in ny_itemized_deductions_max.
Suggestion 5: the Wisconsin comment and the CI status Superseded and fixed Wisconsin now keeps the repayment in the credit base under Wis. Stat. 71.07(5)(a)6. The comment cites paragraphs 6–7 and IRC 67(b)(9). The body records that run 38544852005 passed 27/27 at 17cad4b53b.

Hand trace of Should 1 (2025 California brackets from rates/single.yaml):

  • Taxable income: $65,700 − ($15,750 + $5,000) = $44,950.
  • Tax: 1% × 11,079 = 110.79; 2% × 15,185 = 303.70; 4% × 15,188 = 607.52; 6% × 3,498 = 209.88. The total is 1,231.89. Less the $153 personal exemption credit, that gives $1,078.89, the expected value.
  • Round 1's figure: without the deduction, at $49,950, the same steps give $1,378.89.

New findings

Critical (must fix)

None.

Should address

1. Montana: from 2025 the state-income-tax addition must follow the line 3 zero floor. The head keeps the 2024 Worksheet A ordering in every year.

  • Where:
    • variables/gov/states/mt/tax/income/tax_calculation/mt_taxable_income_joint.py:44-71. formula_2024 runs from 2024 on, and line 56 reads federal_base = max_(0, federal_base + qbi_add_back + state_tax_add_back).
    • mt_federal_deductions.py:35-36 subtracts the addback in every year.
    • tests/unit/test_mt_taxable_income_properties.py:24,117,131 asserts the pre-floor ordering for YEARS = (2024, 2025, 2026).
    • The fragment changelog.d/mt-taxable-income-adjustment-order.fixed.md and the body's Montana item say the same.
  • 2024 is right. 2024 Form 2 instructions, PDF p. 15:

    "If you itemized your deductions, you must remove any state income taxes taken as an itemized deduction only to the extent that it does not reduce your deduction below your federal standard deduction. Use Worksheet A … Line 3 – Federal taxable income for Montana. If zero or less, enter zero."

  • 2025 changed the mechanics.
    • 2025 Form 2 instructions, PDF p. 5:

      "Taxpayers will no longer adjust federal itemized deductions to remove the state income tax deduction on line 2. Instead, any state income tax deductions included in the federal itemized deductions are reported on Schedule I, line 4 along with any other state income tax deductions included in federal taxable income."

    • PDF p. 13: "Line 2 – Form 1040, lines 12e and 13b. Report the total of Form 1040, lines 12e and 13b on this line."
    • PDF p. 22, Worksheet B line 11: "Enter here and on Schedule I, Part I, line 4."
    • 2025 Form 2, p. 1: line 3, "Subtract line 2 from line 1. If zero or less, enter 0 (zero)." Line 4, "Montana additions to federal taxable income from Schedule I, Part I, line 7."
  • The statute fits the 2025 form.
    • MCA 15-30-2120(1): the items in subsection (2) "are added to … federal taxable income". The addback in (2)(j) is one of them, on the same footing as (2)(a)–(h).
    • The head applies those other additions after the floor (mt_claim_of_right_deduction.yaml:441, "Federal taxable-income floor precedes Montana additions from 2024"). So under the head's own reading of the line 3 floor, only the 2024 worksheet put the state-tax item before it.
  • Effect (2025). A single filer has AGI of $10,000 and federal itemized deductions of $20,000, including $6,000 of state income tax. The standard deduction is $15,750.
    • Worksheet B: min(6,000, 20,000 − 15,750) = 4,250.
    • 2025 Form 2: line 3 = 0, line 4 = 4,250, so Montana taxable income is $4,250 (about $200 of tax at 4.7%).
    • The head: max(0, 10,000 − 20,000 + 4,250) = 0.
    • The property test's own witness (AGI 10,000, itemized 20,000, standard 14,600, state tax 6,000) is asserted to be 0 in 2025 and 2026. The 2025 form gives 5,400.
    • The cases are rare: an itemizer whose deductions exceed AGI and include state income tax.
  • Why Should, not Critical. It is a wrong 2025–2026 result, a claimed window. But the statute does not say how a negative IRC 63 base meets the additions. The PR follows the form's line 3 floor and errs only in where one item goes after 2024, which is in line with this batch's handling of form-reading errors.
  • Fix:
    • Keep the pre-floor adjustment for 2024 only. For example, add a boolean parameter that is true in 2024 and false from 2025, citing both instructions, or add a formula_2025.
    • From 2025, add mt_state_income_tax_itemized_add_back after the floor, together with the other additions. Stop subtracting it in mt_federal_deductions (Form 2 line 2).
    • Tests. Add a 2025 YAML witness for the household above (addback 4,250; mt_taxable_income_joint 4,250). Limit the property test's ordering to 2024, or replace it with year-specific YAML cases. As written it re-implements the formula in Python, which CLAUDE.md's test-design section discourages.
    • Wording. Reword the fragment, the comments and the body to say 2024.

2. Update the four source-conflict candidates this PR resolves.

  • What main says now. main's source_conflicts/candidates.yaml lists PR 10038 on four entries that describe the code before this head:
    • us-al:federal-tax-deduction-credit-list (years 2018–2025): follows: conflicting-source, state: open, "the statute-first rule requires correcting the worksheet-based model".
    • us-mo:claim-of-right-federal-tax-deduction: follows: conflicting-source, "the later statute-first rule requires a model change … Code not yet on main".
    • us-or:claim-of-right-federal-tax-subtraction: follows: unknown, "establish the statutory treatment before determining whether a model change is required".
    • us-wi:claim-of-right-itemized-deduction-credit: follows: conflicting-source, "requires including the repayment deduction if the statutory reading is confirmed".
  • What the head does. It follows the statute in all four: Missouri, Oregon and Wisconsin in every year, and Alabama from 2021. The PR does not touch candidates.yaml, so after the merge the public backlog says the code follows the worksheets.
  • CI can't catch this. test_source_conflicts.py checks only structure ("they do not judge whether code follows a statute").
  • Fix: in this PR:
    • Set pe_us.follows: statute for MO, OR and WI.
    • For AL, split the years: statute from 2021, the old list for 2018–2020 (see Suggestion 1).
    • Update state and the notes: drop "Code not yet on main" and "requires a model change".
    • Alternatively, register the entries if their sources are captured.

3. Two new reference links are dead.

  • The 2017 Montana Form 2 with Legal References (https://mtrevenue.gov/wp-content/uploads/2018/02/2017-Form2-with-Legal-References.pdf#page=6).
    • The link. It redirects to revenue.mt.gov and returns 404.
    • Where it is cited. It is the only Montana source for:
      • misc_floor.yaml:10, the value 0.02;
      • misc_floor_applies.yaml:12;
      • mt_misc_claim_of_right_repayment.py:12;
      • mt_misc_deductions_subject_to_floor_indiv.py:10 and _joint.py:10.
    • The value checks out. The Wayback copy (snapshot of 2024-01-07), PDF p. 6, Schedule III: "25 Multiply line 24 by 2% (0.02)"; "26 Subtract line 25 from line 23 … but not less than zero"; "28 Other miscellaneous deductions not subject to 2% of Montana AGI".
  • 2023 HB 109 (https://leg.mt.gov/bills/2023/HB0199/HB0109_X.pdf#page=17), cited in mt_claim_of_right_deduction.py:17 and the body.
    • The link. The path mixes HB0199 and HB0109, returns 404, and has no Wayback snapshot.
    • What it supports. I could not confirm.
  • Fix:
    • The 2017 form. Cite the archived copy (https://web.archive.org/web/20240107204047/https://mtrevenue.gov/wp-content/uploads/2018/02/2017-Form2-with-Legal-References.pdf#page=6). main already cites 2023 Montana bills through web.archive.org, for example the Montana rebate amount.yaml.
    • HB 109. Correct the bill number and link a live or archived enrolled copy. Or drop it, since MCA 15-30-2120 is already cited.

Suggestions

1. Alabama before 2021: the regulation the PR applies from 2021 governed earlier years too.

  • The rule. Ala. Admin. Code r. 810-3-15-.20(1)(d)2, PDF p. 2 has been in force since 2000 and was last amended in 2010. It deducts the tax "less all credits which reduce the amount of the taxpayer's federal income tax liability and all credits which are shown as 'Payments' on the federal income tax return. In no case will the amount be reduced below zero."
  • The head. credits.yaml:6-9 keeps the old list for 2015–2020. So a 2018–2020 Alabama filer gets no reduction for the new section 1341 credit, and the whole AOC is still subtracted from tax that already reflects its nonrefundable part.
  • A test pins it. al_federal_income_tax_deduction.yaml:308 expects 2,500. The regulation gives 5,000 − 1,000 − 1,500 − 1,000 − 750 = 750.
  • Why only a suggestion. State income tax is verified from 2021 (programs.yaml), so these years are outside the claimed window.
  • Fix: start the corrected list in 2018, or at least name the regulation's dates in the comment and drop the case that pins a result the regulation contradicts. The backlog entry covers 2018–2025.

2. Axiom line scope.

  • What the line covers. 26 U.S.C. 1341 and G.S. 105-266.2.
  • What it leaves out. The PR now also makes standalone state-law changes:
    • MCA 15-30-2120(2)(i)–(j) and the 2017 2% pool;
    • Ala. r. 810-3-15-.20(1)(d)2 (AOC refundable portion only, and net PTC) for every filer from 2021;
    • RSMo 143.171(2)(1);
    • ORS 316.685(1)(b);
    • Wis. Stat. 71.07(5)(a)6;
    • Va. Code 58.1-322.03.
  • Fix. rulespec-us main (fa888658b6) has no module for any of these. Add them to the line, either as queued issues or as n/a with a reason.
  • Replace aggr calls with add #1657's wording. It defines #tax_computed_under_subsection_a_5 by the comparison alone. Adding "when #section_1341_applies" would mirror the head's eligibility gate. Companion case F-H already implies it.

3. Changelog, body and a comment.

  • The changelog understates the scope. The claim-of-right fragment calls the Montana work "complete Montana … repayment and historical miscellaneous-deduction treatment". But:
    • From 2024, mt_taxable_income_joint starts from federal AGI less the federal deduction for every Montana filer, replacing the reconstructed Montana deductions. That is why all six mt_taxable_income_joint.yaml cases changed.
    • From 2021 Alabama subtracts only the refundable AOC, for every AOC claimant.
  • Fix. Say both in a fragment, and post the current-head microsimulation when it runs. The earlier "0 records changed" results predate these changes.
  • A misleading comment. mt_federal_deductions has no reader, yet misc_deductions.yaml:11 says it "takes the full federal deduction". Point the comment at mt_taxable_income_joint, or have that formula read it.

4. The Missouri and Oregon witnesses no longer exercise the credit.

  • The problem. mo_federal_income_tax_deduction.yaml:170 and or_federal_tax_liability_subtraction.yaml:116 still set claim_of_right_credit, but neither formula reads it now. The cases only check that income_tax passes through.
  • Fix: build them from a repayment household (repayment plus prior-year decrease), so that the credit flows, or drop the unused input.

Verified

  • Federal core.

  • Branch isolation and order independence (the ctc_limiting_tax_liability depends on calculation order for itemizers (no_salt branch reuses the parent's cached values) #9740 risk).

    • Method branches. They use inherit_calculated=False.
    • Itemizing branches. They take the parent's method as an input only when some unit qualifies. Otherwise the overrides equal main's, so households without a qualifying repayment see no new calculation-order effect.
    • Property tests. The calculation-order, later-year, Texas and stale-parent tests (47 in the file) pass in CI at the head.
    • 2020 and 2021. Integration cases 7–12 cover the paths with both settings of branch_to_determine_itemization. There is no cycle: the parent's method never reads the parent's tax_unit_itemizes.
    • Behavioural-response reforms. These remain disclosed as not modeled.
  • The new state rules, against their sources.

    • Missouri. RSMo 143.171(2)(1) uses the "federal income tax liability under Chapter 1 … after reduction for all credits thereon", with exceptions only for estimated payments, overpayments and sections 31, 27 and 34. Under (a)(5) the chapter 1 tax is itself reduced, so dropping the add-back is right.
    • Oregon. ORS 316.685(1)(b), 2023 ORS PDF p. 54 disregards only the EITC: "shall not take into account any amount of the earned income credit".
    • Wisconsin. It follows 71.07(5)(a)6. The merge kept main's mortgage-insurance exclusion.
    • Virginia. In 2017, misc_deduction (after the federal 2% floor) enters before the section 68 reduction. The $261,500 threshold matches applicable_amount.yaml, and 2018 stays unlimited.
    • Alabama from 2021. It matches the regulation quoted in Suggestion 1. The refundable-only AOC also matches the worksheet's line 29.
    • Montana's addback.
      • The cap. It matches MCA 15-30-2120(2)(j), "not to exceed the amount required to reduce the federal itemized amount … to the amount of the federal standard deduction".
      • 2025 Worksheet B. The isolation of state income tax matches it: lines 1–5 subtract local income, real estate and personal property taxes, and lines 8–9 apply the cap.
      • 2024. The pre-floor ordering matches Worksheet A.
    • Montana's federal base. QBI is kept out before the floor, and Schedule 1-A is deducted once (2025 Form 2 line 2 is lines 12e plus 13b).
    • Montana's 2017 pool. It is limited to 2017. The 2023 instructions show no 2% pool after the federal suspension.
  • No NH Add New Hampshire state supplementation for 2026 #10156 pattern. mt_claim_of_right_repayment_income_class (an int) is only compared between spouses, never used as a parameter key.

  • North Carolina accounting.

    • nc_income_tax = before-refundable minus nc_refundable_credits.
    • NC is out of STATES_WITH_FORMULA_INCOME_TAX, as the invariant test requires.
    • The household cases are below.
  • Merge resolutions: all nine blocks are correct.

    • 858dca387b, six blocks:
      1. itemized_deductions.yaml: main's single 2018 list plus claim_of_right_deduction. The PR's stale 2020/2022 blocks are dropped, consistent with Take the 2020 charitable deduction for non-itemizers above the line #10186 moving 2020 charitable gifts above the line.
      2. integration.yaml: cases 7–12 were added in the merge, not as a conflict. They are hand-checked below.
      3. tools/general.py: main's helper, plus the method override and the joined docstring.
      4. tax_liability_if_itemizing.py: identical to main.
      5. tax_liability_if_not_itemizing.py: identical to main.
      6. tax_unit_itemizes.py: main's file plus one comment.
    • bccaeca9a4, three blocks:
      7. The California YAML: both sides' cases kept.
      8. The Wisconsin YAML: both sides' cases kept.
      9. wi_itemized_deduction_credit_potential.py: the PR's dropped subtraction plus main's mortgage-insurance subtraction.
    • Nothing of main's was dropped. In 647fec60f9..4b8cdd1eed, every deletion is an intended NC list or comment change.
  • Tests: hand checks of the new and changed expectations.

    Expectation By hand
    Integration case 7 (2020, deduction) Schedule A 10,000 + 300 + 5,000 = 15,300; taxable income 104,700; 14,605.50 + 24% × 19,175 = 19,207.50. Credit: AGI 119,700 − 12,400 = 107,300 gives 19,831.50 − 100 = 19,731.50, so the deduction applies
    Case 8 (2020, credit) 19,831.50 − 1,000 = 18,831.50 < 19,207.50. Forced to itemize: 109,700 gives 20,407.50 − 1,000 = 19,407.50
    Case 9 (2021, deduction) 14,751 + 24% × 18,325 = 19,149. Credit: 12,550 + 300 = 12,850, taxable income 107,150, 19,737 − 100 = 19,637
    Case 10 (2021, credit) 18,737. Forced to itemize: 14,751 + 24% × 23,325 − 1,000 = 19,349
    Cases 11 and 12 (branching off) 12,600 < 12,400 + 300, and 12,700 < 12,850, so both take the standard deduction; the credit saves 100 (19,731.50 and 19,637)
    California Example 40 1,231.89 − 153 = 1,078.89 on 44,950. Pre-limitation total 15,750 + 5,000 = 20,750. The case's other test gives 6,000 + 5,000 = 11,000
    NC payment boundary Eligible F, F, F, T at 0, 2,999, 3,000 and 3,001; payments 0, 0, 0, 300
    NC deduction boundary 0; 2,999 − 1,000 = 1,999; 3,000 − 1,000 = 2,000; 0 when barred. 2016: 2,500 − 1,000 = 1,500
    NC households 100 − 30 = 70; 70 − 500 = −430; household 70 + 20 = 90. Two units: 70 + 800 + 30 = 900, refundable 500
    Alabama, 2025 and 2021 5,000 − 1,000 − 1,500 − 1,000 = 1,500; the floor case gives 0; the residual case 5,000 − 750 = 4,250. In 2021 both alternatives give 2,500. NIIT case: max(0 + 1,900 − 2,000, 0) = 0
    Alabama, edited comments Part I max(100 − 200 − 80, 0) = 0; max(5,000 − 1,000, 0) = 4,000 = Part II
    Missouri, Oregon, Wisconsin 25% × 340 = 85; max(0, 2,500 + 0) = 2,500; (3,000 + 12,000 + 20,000 − 10,000) × 5% = 1,250
    Virginia 2017 and 2018 8,000 − 2% × 350,000 = 1,000; 21,000 − min(16,800, 3% × 88,500 = 2,655) = 18,345. 2018: 30,000
    Montana 2023 aggregates 10,000 + 5,000 = 15,000 in both totals. Split 3,000 × (4,000, 2,000) / 6,000 = (2,000, 1,000)
    Montana 2017 pool 3,000 − 800 = 2,200. 2,000 + 1,000 + 300 − 800 = 2,500, total 10,000 + 400 + 2,500 = 12,900. Same class 4,000 > 3,000 gives 0. Two classes: joint 4,000 − 1,200 = 2,800; separate 1,200 and 1,600, giving 6,200 and 6,600. Dependents out: 3,000 − 1,200 = 1,800. Small and large classes: (2,000, 0) floor-subject, (0, 5,000) full, floor 800
    Montana addback min(6,000, 20,000 − 14,600) = 5,400, deduction 14,600. After limits 18,000 − 14,600 = 3,400. Below standard 0. Sales tax 0. 2025 capped SALT 10,000 − 1,000 − 5,000 − 2,000 = 2,000. Wagering 16,000 + 4,000 gives 5,400
    Montana taxable income, 2024–2026 Repayment kept once: 50,000 − 20,000 = 30,000. Floor before additions: 0 + 6,000 = 6,000. Business addition: 35,400 + 1,000 = 36,400. QBI: 50,000 − 18,600 + 4,000 = 35,400. 2026: 50,000 − 19,100 + 2,000 = 32,900. Schedule 1-A: max(0, 20,000 − 21,750) + 3,000 = 3,000. 2024 binding floor: 0 (right for 2024; see Should 1)
    mt_taxable_income_joint.yaml (6 cases) 40,000 − 5,500 = 34,500; 50,000 − 5,500 = 44,500; 45,000 − 11,000 = 34,000; 65,000; 0; 35,000 − 5,500 = 29,500
  • References. The other 32 new reference URLs resolve, and the Alabama, Montana 2024 and 2025, and ORS page anchors show the text cited.

  • Changelog. Two top-level fragments, typed added and fixed.

  • Source-conflict ratchet (checked statically on the merged tree).

Axiom

rulespec-us#1657 queued is valid for the federal and North Carolina provisions.

  • The issue. It is OPEN and labelled pe-parity. MaxGhenis filed it on 2026-10-11, and it has no comments.
  • It is dispatch-ready:
    • module paths;
    • corpus paths, with the check before dispatch recorded as the blocker;
    • the verbatim law;
    • the outputs;
    • a pasteable review_finding;
    • companion tests from Publication 525.
  • queued is still accurate. rulespec-us main (fa888658b6, 2026-10-23) has no us/statutes/26/1341 module and no us-nc/statutes/105/105-266.2 module.
  • It matches the head:
    • the comparison to the cent;
    • ties to (a)(4);
    • the deduction and credit outputs;
    • NC term (ii) zero;
    • companion cases that match the YAML.
  • One wording gap. The head's added NC eligibility gate is implied by case F-H, but not written into the (a)(5) output (Suggestion 2).
  • Scope. The line does not cover the PR's standalone state-law changes (Suggestion 2).

CI

All 27 checks pass (gh pr checks 10038, run 39911501765, attempt 1, on 4b8cdd1eed).

  • Timing. The run was created at 2026-10-23 06:26 UTC, after the 2026-10-21 ratchet fix, and its test_conflict_sounding_comments_do_not_grow passed.
  • Cost of the Python tests that build models (Rest shard-1 timing artifact, Linux CI):
    • The remaining group. 2,608 passed and 11 skipped, in 24:31 of wall clock with a maximum resident set of 8.09 GB on the 16 GB runner. At round 1 it was 2,340 tests, 20:53 and 7.76 GB. Most of the growth comes from main.
    • test_claim_of_right_section_1341_properties.py: 47 tests, 127.8 s. The only change since round 1 is the assertions in the 51-jurisdiction test; no new simulations.
    • test_nc_claim_of_right_properties.py: 7 tests, 0.7 s.
    • New test_mt_taxable_income_properties.py: 1 test, 0.6 s. It runs 6 derandomized examples of at most 6 single-person tax units for 3 years, and reuses the read-only system.
    • test_state_income_tax_accounting_invariants.py: only a set changed.
  • No local runs. Under the low-memory policy I ran nothing locally, so there are no local measurements.

Branch

Verdict: REQUEST_CHANGES

@DTrim99 DTrim99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 2: all six round-1 findings are fixed (CA carries the deduction, plus the NC gate, docs, threshold reference, NY follow-up and WI), the federal 1341 core is unchanged, and all nine hand-resolved merge blocks are correct. Three should-address items: (1) Montana: from 2025 the state-income-tax addback comes after the Form 2 line 3 zero floor (2025 instructions, Schedule I line 4), but the head keeps 2024's pre-floor order for 2025-26 ($4,250 of MT taxable income vs $0), so split the years and add a 2025 witness; (2) update the AL/MO/OR/WI candidates.yaml entries, which still say 'code not yet on main'; (3) fix the dead 2017 MT Form 2 and 2023 HB 109 links. Four suggestions. The stacked #10196/#10198/#10200/#10203 need to merge this head. Full report in the comment above.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants