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 36 commits into
mainfrom
federal-claim-of-right-1341
Open

MaxGhenis wants to merge 36 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.

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

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>
MaxGhenis added a commit that referenced this pull request Oct 14, 2026
…o the in-ma-wv-claim-of-right branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 14, 2026
…o the nj-claim-of-right branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 14, 2026
…o the hi-claim-of-right branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 14, 2026
…o the ar-claim-of-right branch

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

DTrim99 commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

PR Review: 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 17cad4b53b, merge-base a2f63c1235). 63 files (+1,990/−98), 19 commits. Axiom: TheAxiomFoundation/rulespec-us#1657 queued. This is the base of a stack: #10203 (AR), #10200 (HI), #10196 (IN/MA/WV) and #10198 (NJ) each contain this head.

Summary

When a filer repays more than $3,000 of income taxed in an earlier year under a claim of right, section 1341 makes the year's tax the lesser of two amounts:

  • (a)(4): the tax computed with a deduction for the repayment.
  • (a)(5): the tax computed without it, minus the decrease in the earlier year's tax.

This PR models that rule and the North Carolina rules that depend on it.

  • Federal.
    • Inputs: the person-level claim_of_right_repayment (from Add North Carolina's claim of right repayment itemized deduction (G.S. 105-153.5(a)(2)d) #10028) and a new return-level claim_of_right_prior_year_tax_decrease.
    • claim_of_right_section_1341_eligible: the head's and spouse's repayments exceed gov.irs.deductions.itemized.claim_of_right.threshold ($3,000).
    • claim_of_right_credit_applies: computes income_tax in two override branches that fix the method. It picks (a)(5) only when that is lower to the cent.
    • claim_of_right_deduction: Schedule A line 16, added to itemized_deductions.
    • claim_of_right_credit: Schedule 3 line 13b, added to gov.irs.credits.refundable.
    • Branch plumbing: get_override_branch(inherit_calculated=False) for the two method branches. get_itemization_branch makes every itemizing branch take the simulation's method once any unit qualifies.
  • North Carolina.
    • The (a)(5) bar: nc_claim_of_right_deduction is zero under (a)(5) (G.S. 105-153.5(a)(2)d).
    • The payment: nc_claim_of_right_payment (G.S. 105-266.2), with the input nc_claim_of_right_prior_year_tax_increase. It flows through the new nc_refundable_credits and nc_income_tax_before_refundable_credits.
    • Contrib reforms: nc_eitc and nc_cdcc now add their credits to the baseline list.
  • Eight other states stop misreading the new federal amounts:
    • AZ, CA, KS and WI leave the deduction out.
    • MO and OR add the credit back to their federal tax bases.
    • MT adds the deduction to its miscellaneous deductions.
    • VA keeps it in its limited itemized deduction worksheet.

The federal and North Carolina work is right:

  • The law checks out. Every statute, regulation, form and publication quote in the code and PR body matches its primary source at the pages given (Verified correct).
  • The lesser-of rule is right.
    • Ties go to (a)(4), as 26 CFR 1.1341-1(b)(3) requires.
    • The (b)(1) excess is refunded.
    • Under (a)(5) the deduction is zero for every federal and state reader, as (b)(3) requires.
  • There is no circularity. The federal SALT deduction reads estimated withholding, not state tax. The method branches start from inputs.
  • The arithmetic is right. I hand-checked 13 expectations, including both branches of the lesser-of rule, $3,000 against $3,001, the joint return, the (b)(1) refund and North Carolina's payment.
  • Seven of the eight state corrections follow the cited law or form.
  • The tests pass.
    • CI is green on core 3.33.3.
    • Locally, 138 YAML cases pass at the head and 117 pass on a resolved merge with main.

One should-fix: the California change misreads the Schedule CA instructions.

  • What California does. It carries the federal deduction over by default. It removes the deduction only when it takes its own credit or did not tax the income.
  • What leaving it out does. A California resident gets no relief at all. For Publication 525's Example 40 household, California tax comes out $300 too high.

Five suggestions follow.

Critical (must fix)

None.

Should address

1. California: leaving the federal deduction out contradicts the Schedule CA default and drops California relief in the common case.

  • Where:

    • variables/gov/states/ca/tax/income/deductions/itemized/ca_itemized_deductions_pre_limitation.py:38-42 adds claim_of_right_deduction to the excluded federal deductions. The comment reads: "California chooses between its own claim of right deduction and credit whichever method federal tax used, and allows neither for income it did not tax, so the federal deduction does not carry over."
    • tests/.../ca/tax/income/deductions/itemized/ca_itemized_deductions_pre_limitation.yaml:417-427 ("The federal claim of right repayment deduction does not carry over") pins 6,000.
    • tests/unit/test_claim_of_right_section_1341_properties.py:82-85 lists CA in STATES_WITHOUT_THE_DEDUCTION.
    • The PR body's "Other states" table calls the flow-through what "would have gone wrong".
  • What the instructions say. The source is the 2025 Schedule CA (540) instructions, Part II, "Line 16 – Other Itemized Deductions", under "Claim of right". Column A carries the federal Schedule A amounts.

    "If the amount repaid was not taxed by California, no deduction or credit is allowed. ... If you claimed a credit for the repayment on your federal tax return and are deducting the repayment for California, enter the allowable deduction on line 16, column C. If you deducted the repayment on your federal tax return and are taking a credit for California, enter the amount of the federal deduction on line 16, column B. ... If you choose to take the credit instead of the deduction for California, add the credit amount on line 78, the total payment line, of Form 540."

    • When the federal deduction comes out. Only in three cases: California takes its own credit, California did not tax the income, or the repayment is of Social Security benefits.
    • When both returns deduct, nothing is entered, and the federal deduction stays in California itemized deductions.
    • The comment's first half is right, but its conclusion doesn't follow. California does choose for itself, whichever method federal tax used. But the instructions only adjust when the two methods differ. When both returns deduct, the federal deduction carries over.
  • Effect at the head. I ran Publication 525 (2025) Example 40 as a California resident: wages $65,700, gifts $15,750, a $5,000 repayment and a $568 prior-year decrease. Federal tax uses the deduction: $4,893.47, against $5,493.47 without the repayment.

    Case California taxable income ca_income_tax
    Repays $5,000 (this PR) $49,950 $1,378.89
    No repayment $49,950 $1,378.89
    No repayment, $5,000 more California itemized deductions (gifts) $44,950 $1,078.89
    • What the deduction is worth. $300, which is 6% of $5,000.
    • California's own choice would also be the deduction. California's credit is the decrease in the earlier year's California tax. If the filer's earlier California marginal rate was no higher than 6%, that credit is at most about $300. California's comparison then picks the deduction, and Schedule CA leaves it in.
    • The model gives nothing, so California tax is $300 too high.
    • This is not a regression. main gives the same result, because the federal deduction did not exist before. But the PR's change and its new test lock that result in.
  • Fix (preferred):

    • Drop claim_of_right_deduction from the exclusion tuple, so the deduction carries over as in column A.
    • Change the YAML case to expect 11,000 and rename it.
    • Remove CA from STATES_WITHOUT_THE_DEDUCTION. The credit-method half of the 51-jurisdiction test still holds for California, because the deduction is zero under (a)(5).
    • Reword the comment to list what is not modeled:
      • California's own credit (the column B removal, entered on Form 540 line 78 as "IRC 1341").
      • The California deduction when federal tax used the credit (column C).
      • The bar for income California did not tax.
  • Alternative: keep the exclusion as a deliberate simplification. Then reword the comment, the test name and the PR-body row to say that it denies all California relief, contrary to the Schedule CA default, until the California follow-up lands.

Suggestions

1. Gate North Carolina on section 1341 eligibility, as the federal amounts are.

  • The gap. nc_claim_of_right_payment.py:28-36 and nc_claim_of_right_deduction.py:71-72 read only claim_of_right_credit_applies. claim_of_right_credit and claim_of_right_deduction test eligible & ....
  • When it matters.
    • With the derived method the results are the same, because claim_of_right_credit_applies already includes eligibility.
    • But the PR tells users modeling pre-2018 years to supply the method as an input. A user who sets it to true for a repayment of $3,000 or less gets no federal credit. North Carolina would still pay the prior-year increase and deny the small-repayment deduction.
  • The law. G.S. 105-266.2 applies only to "a taxpayer who is subject to the alternative tax under § 1341(a)(5)", which requires a repayment over $3,000.
  • Fix:
    • Add claim_of_right_section_1341_eligible to both conditions.
    • nc_claim_of_right_payment.yaml case 1 then needs the eligibility input.

2. Tighten the input documentation.

  • The same-class rule.
    • What the variable says. claim_of_right_section_1341_eligible.py:13 says the threshold "applies to the total repaid on the return, not to each repayment". That is Publication 525's caution.
    • What the regulation says. 26 CFR 1.1341-1(a)(3) aggregates "with respect to each item of income (described in section 1341(a)(1)) of the same class".
    • Fix. The PR body lists the class rule as not modeled; say so in the variable too. Then a user with repayments of two classes knows that the model adds them together.
  • A "federal" label. claim_of_right_prior_year_tax_decrease.py:7 has no "federal" in its label, and Model Hawaii's claim of right deduction and credit (section 1341 as operative in Hawaii from 2022) #10200 adds hi_claim_of_right_prior_year_tax_decrease. A label such as "Federal prior-year tax decrease from excluding repaid claim of right income" keeps the two apart in the app.

3. Drop the section 67(b)(9) reference from parameters/gov/irs/deductions/itemized/claim_of_right/threshold.yaml:11-12.

  • It doesn't show the value. Section 67(b)(9) reads "the deduction under section 1341 (relating to computation of tax where taxpayer restores substantial amount held under claim of right)". It does not mention $3,000.
  • Nothing is lost. The other three references corroborate $3,000, and claim_of_right_deduction.py already cites 67(b)(9) for the point it supports.

4. Make the New York follow-up cover IT-196 line 34.

  • The form. 2025 IT-196 instructions, PDF p. 17: "Line 34: Deduction for repayment of amounts under a claim of right if over $3,000".
  • The model. ny_itemized_deductions_max.py:26-37 sums a fixed list that leaves it out. So under the federal deduction method, New York gives no deduction.
  • The follow-up. The body's New York item names the credits tied to the federal method and the 2% pool for small repayments. Add line 34 to it.
  • Not a regression. The deduction did not exist before this PR.

5. Update a comment and the PR body.

  • Wisconsin.
    • What the comment cites. wi_itemized_deduction_credit_potential.py:21-27 cites 71.07(5)(a)7 alone.
    • What the statute also says. Wis. Stat. 71.07(5)(a), PDF p. 39, paragraph 6, excludes "the amount claimed for repayment of income previously taxed under this chapter if that amount is used in calculating the credit under sub. (1)". That suggests the repayment counts otherwise.
    • Fix. Say, as the PR body does, that the reading follows Schedule 1 and that the statute is unclear. Schedule 1's lines 1–4 are medical expenses, interest, gifts to charity and casualty losses.
  • Status. The PR body's "Status" section and the hand-off comment still say CI at the head is running. Run 38544852005 passed all 27 checks at 17cad4b53b.

Verified correct

  • Federal law. Each citation below shows the stated text or value.

    Source Content
    26 U.S.C. 1341 (a)(1)–(5), (b)(1) and (b)(3) match the PR body's quotes word for word. $3,000 since the 1954 Code, matching threshold.yaml 1954-01-01: 3_000.
    26 CFR 1.1341-1 (a)(3): same-class aggregation. (b)(1)(ii): the decrease is "net of any increase in tax imposed by section 56" and is "not limited to the amount of the tax for the taxable year". (b)(2): the restoration is not taken into account under (a)(5). (b)(3): equal tax uses (a)(4). (d)(4)(i): the "tax previously determined" is the amount shown on the return. (i): the excess is a payment.
    Pub. 525 (2025), PDF pp. 36–37 Schedule A line 16; "Figure your tax under both methods ... Use the method (deduction or credit) that results in less tax"; "consider the total amount being repaid on the return"; the method 2 steps. Example 40: $568 decrease, $5,156 by method 1 and $5,335 by method 2. The text's "Your tax under method 2 is $5,903" is an IRS slip; the table gives $5,335, which the PR uses.
    Pub. 525 (2024), PDF p. 37 Example 40: $568 decrease; Tax Table $5,165 and $6,048; method 2 gives $5,480.
    Pub. 525 (2018), PDF p. 34 Example 40: $750 decrease; Tax Table $5,834 and $6,934; method 2 gives $6,184.
    2025 Schedule A instructions The line 16 heading is on PDF p. 11. "Deduction for repayment of amounts under a claim of right if over $3,000" is on p. 12.
    2017 Schedule A instructions Line 23 (p. 12): repayments of $3,000 or less, under the 2% floor. Line 28 (p. 13): repayments over $3,000. Worksheet line 2 (p. 14) takes out only lines 4, 14 and 20, gambling and casualty or theft losses on line 28, and qualified contributions. The single threshold is $261,500.
    2025 Schedule 3 and Form 1040 instructions, PDF p. 117 Line 13b, "Section 1341 credit for repayment of amounts included in income from earlier years", is in Part II, "Other Payments and Refundable Credits". It flows to line 15 and then to Form 1040 line 31.
    26 U.S.C. 67 (b)(9) keeps the section 1341 deduction out of miscellaneous itemized deductions. P.L. 119-21 redesignated the suspension as (h).
    IRS clawback FAQ, Q1 "whichever results in less tax (or a greater refund)". This supports comparing income_tax after refundable credits.
  • North Carolina law.

    • The bar. 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."
    • The payment. G.S. 105-266.2 matches the body word for word. S.L. 1997-213 §2: "effective for taxable years beginning on or after January 1, 1995", matching nc/tax/income/credits/refundable.yaml 1995-01-01.
    • Term (ii) is zero, as the PR says. Under (a)(5) the item is neither deducted federally nor, by (a)(2)d, for North Carolina.
  • The lesser-of mechanics.

    • claim_of_right_credit_applies compares the two branches' income_tax rounded to cents with a strict <, so ties keep the deduction.
    • It returns false without branching when no unit qualifies.
    • The credit branch gives the tax without the deduction minus the whole decrease, as a refundable credit. That equals (a)(5)(A) minus (B), with the (b)(1) excess refunded, as on Schedule 3 line 13b.
  • (b)(3) across readers.

    • Federal. claim_of_right_deduction is zero under (a)(5), so the itemized lists, the §68 limitation, taxable income, the QBI limit and the AMT all see no deduction.
    • AMT under (a)(4). The AMT add-back list (salt_deduction, misc_deduction) leaves the deduction allowed, as §56(b)(1)(A)(i) together with §67(b)(9) requires.
    • §68 under (a)(4). The deduction is inside the limitation. The 2017 case gives min(3% × 138,500, 80% × 50,000) = 4,155. The 2026 case gives 2/37 × 100,000 = 5,405.41, with the single 37% bracket starting at $640,600.
    • States. The state formulas in 22 jurisdictions that read a federal itemized total or federal taxable income see zero under (a)(5). NC and MT read the repayment directly but are gated on the method.
    • No double count. NC's itemized total uses its own deduction, and MT sums its own list.
  • The federal tax deduction states agree with each other. AL, IA, LA and MT read income_tax_before_refundable_credits, and MO and OR now add the credit back. So all six use the tax without the deduction under (a)(5), the Form 1040 line 22 basis.

  • No circularity or stale branches.

    • SALT. The federal SALT deduction reads state_withheld_income_tax; for NC that is the rate × (AGI − the single standard deduction). So no federal path reads a state liability.
    • Method branches. They start from inputs.
    • Itemizing branches. The only itemizing and not_itemizing branches come from get_itemization_branch.
    • Alabama's 2021 branch. It is created after the parent computes federal tax, so it inherits the method.
    • Marginal tax rate branches. They delete calculated arrays and re-derive the method.
    • Federal contrib reforms. Every reform that overrides income_tax_refundable_credits reads gov.irs.credits.refundable, so the new credit reaches it.
    • NC contrib reforms. The framework applies nc_eitc before nc_cdcc, which makes the stacking case work.
  • North Carolina plumbing.

    • Both before-refundable lists now use nc_income_tax_before_refundable_credits instead of nc_income_tax.
    • nc_refundable_credits joins the three refundable lists.
    • Nothing else reads nc_income_tax.
  • Seven of the eight state corrections follow the cited source.

    State Change Source Verdict
    AZ Out of az_itemized_deductions A.R.S. 43-1021(9) adds "the deduction referred to in section 1341(a)(4)" to Arizona gross income. 43-1029(B) computes Arizona tax "without the deduction, minus the decrease". Right for itemizers. The AGI addition and the Arizona credit are disclosed as not modeled.
    CA Out of ca_itemized_deductions_pre_limitation Schedule CA (540), line 16 See Should 1
    KS Subtracted in ks_itemized_deductions K.S.A. 79-32,120(a)(5), from 2020: charitable contributions, medical care, qualified residence interest and property taxes, each at 100% Right
    MO Added to ignored_credits 2025 MO-1040 instructions, PDF p. 7, Line 9 chart: "Line 22 minus ... Line 27a and 29; Schedule 2, Part 1, Line 3; Schedule 3, Part 2, Line 9". No line 13b. Follows the chart (the decided reading, d1204). RSMo 143.171 "after reduction for all credits thereon" could support the other answer, as the body says.
    MT mt_claim_of_right_deduction in the miscellaneous list from 2021 2023 Form 2 instructions, PDF p. 39, line 18: "the same deductions that are allowed on your federal Form 1040, Schedule A, line 16". 2024, PDF p. 15, Worksheet A line 1: "Enter your total federal itemized deductions from Form 1040, line 12". Right
    OR Credit added back in or_federal_tax_liability_subtraction 2025 OR-17, PDF pp. 71–72: line 1 is Form 1040 line 22; lines 6–8 take out only the American Opportunity, refundable adoption and premium tax credits Follows the worksheet (decided). The prose on p. 71 ("Federal income tax credits, except for the EITC, reduce your federal tax subtraction") is disclosed.
    VA Added to reduction.applicable 2025 Schedule A: line 16b "Other" (p. 1). Worksheet line 1 includes 16c; line 2 takes only lines 4, 9 and 15 and gambling on 16a; the single threshold is $332,700 (p. 2). Right
    WI Out of the itemized deduction credit base 2025 Form 1, PDF p. 4: Schedule 1 lines 1–4 only Follows Schedule 1 (decided). See Suggestion 5.
  • Inputs and aggregation.

    • Both new inputs are return-level, YEAR and USD, and documented.
    • The repayment is per person. Head and spouse are summed, and dependents are excluded because they file their own returns.
    • The prior-year decrease is one return-level amount, as the body explains.
  • Tests: hand checks.

    Expectation By hand
    claim_of_right_credit_applies case 1 (tie) 5,903 − 747.50 = 5,155.50 = 1,192.50 + 12% × 33,025, so (a)(4)
    Case 5 (one cent) 5,903 − 747.51 = 5,155.49 < 5,155.50, so (a)(5)
    Cases 3 and 4 ($3,000 against $3,001) $3,000 doesn't qualify: 5,903. $3,001: taxable income 46,949; 1,192.50 + 12% × 35,024 = 5,395.38
    integration case 2 (2024) 1,160 + 12% × 33,350 = 5,162; 1,160 + 4,266 + 22% × 2,800 = 6,042; 6,042 − 568 = 5,474
    Case 3 (2018) 952.50 + 3,501 + 22% × 6,250 = 5,828.50; 4,453.50 + 22% × 11,250 = 6,928.50; 6,928.50 − 750 = 6,178.50
    Case 5 ((b)(1) refund) 1,192.50 + 12% × 12,325 = 2,671.50; 2,671.50 − 3,000 = −328.50
    Case 6 (joint return with a dependent) 2,000 + 2,000 = 4,000; the dependent's 9,000 is excluded. 90,000 − 31,500 = 58,500; 2,385 + 12% × 34,650 = 6,543; less the 500 dependent credit = 6,043. Credit method: 5,543
    claim_of_right_deduction cases 4 and 5 4,155 (2017 limitation) and 5,405.41 (2026 limitation)
    NC, credit method Federal: 64,250 of taxable income gives 9,049; 9,049 − 1,100 = 7,949 beats 8,145.21. NC: 67,250 × 4.25% = 2,858.13; less the 212.50 payment = 2,645.63
    NC, deduction method 63,000 × 4.25% = 2,677.50
    VA 30,000 − min(24,000, 3% × 167,300) = 24,981
    MO (340 + 1,500) × 25% = 460
    Python, 2026 itemizing branch Standard deduction 16,100 + 1,000: 1,240 + 12% × 30,500 = 4,900; 4,900 − 800 = 4,100. Deduction method: 4,588. Itemizing under the credit method: 5,788 − 800 = 4,988

    The boundary cases, both lesser-of branches, the joint split, the (b)(1) refund and the state interactions are all covered.

  • Code patterns.

    • No policy values are hard-coded; the threshold is a parameter.
    • State variables are gated with defined_for.
    • nc_refundable_credits and nc_income_tax use adds and subtracts.
    • No new variable duplicates an existing concept.
    • get_override_branch keeps its old behavior by default (inherit_calculated=True).
  • Python coverage and cost.

    • Why Python. The property file tests what YAML can't: each branch against a fresh simulation, and calculation order. This meets CLAUDE.md's test for Python coverage.
    • Cost in CI. It runs in Rest shard-1's remaining group (2,340 passed). That group took 20:53 wall clock with a 7.76 GB maximum resident set on the 16 GB runner. The 1341 file's 47 tests took about 120 s of that, and the NC file's 7 tests 0.7 s.
  • Changelog. changelog.d/federal-claim-of-right-1341.added.md is top-level and typed added. The merged tree adds only this fragment; Add North Carolina's claim of right repayment itemized deduction (G.S. 105-153.5(a)(2)d) #10028's fragment was already consumed.

  • Local runs (policyengine-core 3.32.29; CI uses 3.33.3).

    • At the head: 138 YAML cases in this PR's 20 test files, all passing. That is the 6 federal files, 3 NC files, 8 state files and 3 contrib files.
    • On a resolved merge with main: 117 cases in 15 of those files (4 federal, the 3 NC and the 8 state files), all passing.

Axiom line assessment

Valid: rulespec-us#1657 queued.

  • The issue qualifies. Replace aggr calls with add #1657 is OPEN and labelled pe-parity; MaxGhenis filed it on 2026-10-11.
  • It has every part of the Add AMT parameters for 2020-2023 #1467 model:
    • Module paths: us/statutes/26/1341.yaml, us-nc/statutes/105/105-266.2.yaml, and the bar in us-nc/statutes/105/105-153.5/a.yaml.
    • Corpus paths.
    • The verbatim law.
    • The required outputs.
    • Companion tests from Publication 525, the same source as the YAML cases.
  • It records its blocker. Whether the pinned corpus release holds the two sections is not verified, and each billed encoder run needs separate approval.
  • queued is still accurate. rulespec-us main (172bf04e4d, 2026-10-14) still has no us/statutes/26/1341 module and no 105-266.2 module.
  • It matches the head:
    • The comparison to the cent, with ties to (a)(4).
    • The deduction and credit outputs.
    • The NC payment with term (ii) zero.
    • The companion cases match the PR's YAML.
  • The eight state corrections need no module. They adjust how PolicyEngine's state formulas read the new federal amounts. rulespec-us has no statute modules for the Kansas, Arizona, Wisconsin or Missouri provisions; us-ks, for example, holds only policies.

CI status

All 27 checks pass (gh pr checks 10038, run 38544852005, attempt 1, on head 17cad4b53b).

  • Core version. CI upgraded policyengine-core from the lock's 3.32.27 to 3.33.3.
  • The property tests ran. Rest shard-1's log shows all 47 tests in test_claim_of_right_section_1341_properties.py and all 7 in test_nc_claim_of_right_properties.py passing. That includes the 2026 itemizing-branch tests that failed at 32b0c13a6a.
  • YAML and microsimulation. The baseline and contrib shards and the Microsimulation job pass.
  • Partner tests. The PR touches no partner test files, and the Household API Partners job passes.

Branch status

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.

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>

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