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

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

Stacked on #10028 (branch nc-claim-of-right-deduction), which adds the person-level input claim_of_right_repayment and North Carolina's deduction. Review the commits after 3b57231636 that are not merges (the branch has since merged #10028's updated head and main). Merge #10028 first.

Federal:

  • claim_of_right_prior_year_tax_decrease, a tax-unit input: the decrease in the filers' 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).
  • 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 now zero when federal tax is computed under section 1341(a)(5) (G.S. 105-153.5(a)(2)d, last sentence).
  • 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). 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.

Eight states read the federal amounts this PR changes in ways their own laws or forms do not follow. The PR corrects each (see "Other states").

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 derived. The two new inputs are facts about earlier returns that the model cannot compute. Whether (a)(4) or (a)(5) governs is computed, never entered.
  • 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, the two itemizing branches (tax_liability_if_itemizing, tax_liability_if_not_itemizing) also take the simulation's method as an input next to tax_unit_itemizes, so they never choose their own, 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 the method 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.
  • 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.
  • 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 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.
  • Repayments of $3,000 or less before 2018 (above).
  • 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.
  • 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.
  • 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/) asked which have their own claim of right rule and whether the new federal deduction and credit reach each state's calculation correctly. I then ran a differential on this branch: every state, with and without a $10,000 repayment, under each federal method (~/reviews/us-hub/federal-1341/state_flow_grid.json).

Corrected in this PR. I fetched and read each source below. For Missouri, Oregon and Wisconsin the PR follows the worksheet each variable already cites; the statutes could support the other answer, and decision d1204 asks Max whether to switch (see "Readings for Max").

State What would have gone wrong Fix Source
California The federal deduction flowed into California itemized deductions Leave it out of ca_itemized_deductions_pre_limitation 2025 Schedule CA (540) instructions, Part II line 16: California applies its own deduction-or-credit choice, and "If the amount repaid was not taxed by California, no deduction or credit is allowed"; a federal deduction for repaid Social Security benefits is removed on line 16, column B
Montana The federal deduction lowered Montana's federal income tax deduction (2021–2023) without reaching Montana itemized deductions Add mt_claim_of_right_deduction to Montana's miscellaneous deductions, 2021–2023 2023 Form 2 instructions, PDF p. 39, itemized line 18: "These deductions are the same deductions that are allowed on your federal Form 1040, Schedule A, line 16."
Arizona The federal deduction flowed into Arizona itemized deductions Leave it out of az_itemized_deductions (see "Not modeled" for the AGI addition) A.R.S. 43-1021(9) adds "the deduction referred to in section 1341(a)(4)" back to Arizona gross income; A.R.S. 43-1029 computes Arizona tax "without the deduction"
Kansas Same, through itemized_deductions_less_salt Subtract it in ks_itemized_deductions K.S.A. 79-32,120(a) lists charitable contributions, medical care, qualified residence interest and property taxes only
Wisconsin It enlarged the itemized deduction credit Subtract it in wi_itemized_deduction_credit_potential 2025 Form 1, Schedule 1, PDF p. 4, which the variable cites, has lines for medical expenses, interest, gifts to charity and casualty losses only. Wis. Stat. 71.07(5)(a), PDF p. 39 is less clear: paragraph 7 excludes miscellaneous itemized deductions, which section 67(b)(9) says this is not, and paragraph 6 excludes a repayment only when it is used for Wisconsin's own credit
Missouri The federal credit shrank the federal income tax deduction Add it to ignored_credits 2025 MO-1040 instructions, Line 9, PDF p. 7, the chart ignored_credits already follows: Form 1040 Line 22 minus Lines 27a and 29, Schedule 2 Part 1 Line 3 and Schedule 3 Part 2 Line 9; Schedule 3 line 13b is not subtracted. RSMo 143.171 speaks of tax "after reduction for all credits thereon"
Oregon The federal credit shrank the federal tax liability subtraction Add it back in or_federal_tax_liability_subtraction 2025 Publication OR-17, federal tax worksheet, PDF pp. 71–72, which the variable cites: Form 1040 line 22 less the American Opportunity, refundable adoption and premium tax credits. The same page's prose says "Federal income tax credits, except for the EITC, reduce your federal tax subtraction"
Virginia High-income itemizers lost the deduction, because the limited-deduction worksheet uses its own list Add it to reduction.applicable 2025 Virginia Schedule A, PDF pp. 1–2: line 16b "Other" is in worksheet line 1 and not in line 2

After these fixes, for the tested household (single, age 40, wages $60,000, charitable gifts $25,000, a $10,000 repayment, one per state, 2025) with no state input supplied, the repayment changes no state's income tax when the federal credit method is fixed, and none in Arizona, California, Kansas or Wisconsin when the deduction method is fixed. A property test checks both. That is a result for that household under these conventions, not a claim that section 1341(b)(3) binds the states. It does not hold for every household: Montana's elderly homeowner/renter credit counts the federal credit as household income (next paragraph), so a Montana filer eligible for that credit can see state tax change under the credit method.

Deduction flows left as they are. Under the federal deduction method the deduction reaches the states that start from federal itemized deductions or federal taxable income: AL (through its federal tax deduction), CO, DC, GA, IA, ID, KY, MD, ME, MN, MO, MS, NE, NM, ND, OK, OR, SC (to 2025), UT and VA. Three kinds of question remain, none introduced by this PR:

  • States' own rules, which this PR does not model (next paragraph).
  • Existing gaps the new deduction exercises: Maine, New Mexico and Maryland read the federal itemized total before the section 68 limitation, which binds again from 2026; Colorado does not coordinate its two add-backs. These are in the fourth chip.
  • California has its own deduction-or-credit choice. Leaving the federal deduction out prevents it carrying over automatically; California's own relief, for income California taxed, waits for that chip. It is not a claim that California denies relief.
  • I did not verify each remaining state's law myself; the sweep's reports are the evidence for "consistent", and they are leads.

Credit flows left as they are. main now counts federal income_tax_refundable_credits in Montana's elderly homeowner/renter credit household income (#9915), so the section 1341 credit counts there too. ARM 42.4.301(2)(b), which that variable cites, says "federal refundable tax credits received"; the credit is one. Idaho already read federal itemized deductions after the section 68 limitation (itemized_taxable_income_deductions), so the deduction reaches it as intended; #10023 added medical and health-premium coordination to that formula without changing this flow.

Overlap with #10093. #10093 rewrites or_federal_tax_liability_subtraction to the OR-17 worksheet's own credit list, which leaves out the section 1341 credit; the follow-up session also plans to replace ks_itemized_deductions with Kansas's closed list. If #10093 lands first, this PR drops its Oregon edit and the Oregon YAML case takes income_tax_before_refundable_credits: 4_000 as its input (expected unchanged); if this PR lands first, #10093 drops it. The Kansas edit stays until the closed-list rewrite actually lands.

Own rules, not modeled here. The sweep reports that these jurisdictions have their own claim of right credit, deduction or subtraction: 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). I verified Arizona's and Wisconsin's statutes myself; the rest are research leads with sources in the reports. See "Follow-ups".

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

Computed at head 8f268ca794, before the review fixes, and not rerun at the final head (host held). The same households are YAML cases (integration.yaml cases 1 and 4; the last cases in nc_claim_of_right_deduction.yaml), so CI checks their federal tax or credit and North Carolina tax at the final head.

~/reviews/us-hub/federal-1341/evidence/households_{main,pr10028,branch}.json (script households.py there). main is ff479aa74a; #10028 is 3b57231636.

Household main #10028 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,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 $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,858.12 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,858.12 Federal $9,049; NC $2,677.50 Federal $8,145.21 (deduction); NC $2,677.50

Tests

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; 4 for Montana; 3 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 (stated and executed over the grids)

  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 whenever the credit method applies and otherwise equals the deduction with the deduction method fixed; its payment is the prior-year increase when the credit method applies and zero otherwise; nc_income_tax equals tax before refundable credits minus the payment.
  8. States (tested household). For the household above, with the credit method fixed the repayment changes no state's income tax in the model; with the deduction method fixed it changes none in Arizona, California, Kansas or Wisconsin, and some other state's. Montana's elderly credit is a known exception for eligible filers.

Mutation check, at head 4526aed52f: six single-line mutants (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, the credit counting dependents) each failed the property file. To repeat at the final head.

Status. The tests run in this PR's CI, at its head. Locked local runs (~/reviews/us-hub/scripts/heavy_run.sh) were not made at the final head: from 2026-10-10 Fleet ops held this session off tests and microsimulations while the shared host was saturated (load 170–330, 10–20 tickets queued for the heavy lock on 2026-10-11). 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 now has 33 tests: the check runs for 2025 only, and the order, later-year, Texas and stale-parent tests were added after the reviews.
  • 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.

Not yet repeated at the final head: the mutation check and the household evidence below. The YAML cases and property tests added after review r1 (California, Montana, the 2016 North Carolina case, the cent comparison, both itemization settings, the stacked contrib credits, the order and stale-parent tests) have not run anywhere but CI.

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. A measurement under the lock was not possible while the host was held; CI's Rest-job timing report for the remaining group will show the cost.
  • 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. The microsimulation below is to confirm the results; its timing will show the cost.

Microsimulation

Pending. The 2025 pair compares main 7dc07567eb (the main this branch last merged) with this branch at de58d20b95, on the default dataset, from frozen snapshots of each, base and branch back to back under one acquisition of the shared heavy lock (driver ~/reviews/us-hub/federal-1341/impact/pair.sh, queue-aware; dry-run checked). An earlier attempt was withdrawn while still waiting for the lock, at Fleet ops' request, because the host was saturated. It runs when the host allows: the US + core hub has offered to run it after hand-off, and the result is added here. If the head changes first, the snapshots are retaken.

Expected: no record changes. #10028's four runs found claim_of_right_repayment zero on every record of the default dataset, and this PR's formulas return before branching in that case.

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 is in the first chip.
  • 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; Oregon's subtraction falling by refundable credits its worksheet does not list; Montana's casualty_loss_deduction projected to every person in its miscellaneous list.
  • 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 (decision d1204). The PR follows the worksheet each variable already cites. The statutes could support the other answer (table above). Merging does not change the existing methodology for these variables; it applies it to the new credit and deduction.
  • Alabama. Alabama's regulation subtracts every federal credit shown as a payment from its federal income tax deduction, while its 2018–2025 worksheets list specific credits and omit Schedule 3 line 13b. The model's Alabama formula reads its own credit list, so the section 1341 credit does not reduce the Alabama deduction. The fourth chip queues that question rather than this PR.
  • 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>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 11, 2026 19:19

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.

1 participant