Repository navigation
Conversation
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>
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Review: Model the claim of right repayment deduction and credit (26 U.S.C. 1341) and North Carolina's rules that depend on itPR #10038 (author: MaxGhenis, head SummaryWhen 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:
This PR models that rule and the North Carolina rules that depend on it.
The federal and North Carolina work is right:
One should-fix: the California change misreads the Schedule CA instructions.
Five suggestions follow. Critical (must fix)None. Should address1. California: leaving the federal deduction out contradicts the Schedule CA default and drops California relief in the common case.
Suggestions1. Gate North Carolina on section 1341 eligibility, as the federal amounts are.
2. Tighten the input documentation.
3. Drop the section 67(b)(9) reference from
4. Make the New York follow-up cover IT-196 line 34.
5. Update a comment and the PR body.
Verified correct
Axiom line assessmentValid:
CI statusAll 27 checks pass (
Branch status
Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
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.
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>
Merge upstream main at 86d3ae6. Keep California's federal section 1341 deduction carryover and $11,000 regression alongside main's mortgage insurance premium exclusion cases. Keep Wisconsin's repayment in the itemized deduction credit base under Wis. Stat. 71.07(5)(a)6-7, while excluding federally deductible mortgage insurance premiums as introduced by upstream commit 7545b2c (#10003). Preserve both sets of references and regression cases without changing either parent's expected values.
…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>
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
mainas557b539d77, which added the person-level inputclaim_of_right_repaymentand North Carolina's deduction. At David's reviewed head,17cad4b53b53919b743afa51969e9a9e8c5dfc9b, the branch had mergedmainat6f34ccde23(maina2f63c1235). 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 joinsgov.irs.deductions.itemized_deductions.claim_of_right_credit: the Schedule 3 line 13b credit, used under section 1341(a)(5). It joinsgov.irs.credits.refundable.North Carolina:
nc_claim_of_right_deductionis 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 inputnc_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 addsnc_refundable_creditsandnc_income_tax_before_refundable_creditsin 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
claim_of_right_section_1341_eligibletogether 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.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/mainatf19877374ac943756c15734e063fc259bff74b2cinto 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_taxcorrectly usesadds = ["nc_income_tax_before_refundable_credits"]andsubtracts = ["nc_refundable_credits"], so NC is removed fromSTATES_WITH_FORMULA_INCOME_TAXrather than restoring a formula. Both variables were already present in the correspondingstate_income_tax_before_refundable_creditsandstate_refundable_creditsparameter 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-core3.33.2. Each file ran in its own foreground process with OMP/OpenBLAS/MKL/vecLib/NumExpr threads capped at 4 andOMP_WAIT_POLICY=PASSIVE.policyengine_us/tests/core/test_state_income_tax_accounting_invariants.pyunit/test_claim_of_right_section_1341_properties.pypolicy/baseline/gov/states/nc/tax/income/credits/claim_of_right/nc_claim_of_right_payment.yamlpolicy/baseline/gov/states/mt/tax/income/deductions/itemized/mt_claim_of_right_deduction.yamlpolicy/baseline/gov/states/mt/tax/income/mt_taxable_income_joint.yamlpolicy/baseline/gov/states/mt/tax/income/subtractions/mt_federal_obbba_subtraction.yamlpolicy/baseline/gov/states/nc/tax/income/deductions/itemized/nc_claim_of_right_deduction.yamlpolicy/baseline/gov/states/nc/tax/income/nc_income_tax.yamlpolicy/baseline/household/income/household/household_state_tax_before_refundable_credits.yamlpolicy/baseline/household/income/household/household_refundable_state_tax_credits.yamlpolicy/baseline/household/income/household/household_net_income.yamlpolicy/baseline/gov/states/tax/income/state_income_tax.yamlpolicy/baseline/gov/states/ms/tax/income/ms_income_tax.yamlpolicy/baseline/gov/states/ms/tax/income/ms_income_tax_before_refundable_credits.yamlpolicy/contrib/states/mi/mi_surtax.yamlpolicy/baseline/gov/states/al/tax/income/deductions/al_federal_income_tax_deduction.yamlpolicy/baseline/gov/states/mo/tax/income/deductions/mo_federal_income_tax_deduction.yamlpolicy/baseline/gov/states/or/tax/income/subtractions/or_federal_tax_liability_subtraction.yamlpolicy/baseline/gov/states/wi/tax/income/wi_itemized_deduction_credit.yamlpolicy/baseline/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.yamlpolicy/baseline/gov/states/va/tax/income/deductions/va_itemized_deductions.yamlpolicy/contrib/states/nc/eitc/nc_eitc.yamlpolicy/contrib/states/nc/eitc/nc_eitc_excludes_use_tax.yamlpolicy/contrib/states/nc/cdcc/nc_cdcc.yaml339 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 conflictmarkers or register entries are added. Items awaiting decisions d1741, d1742 or d1744 remain as built.us-al:federal-tax-deduction-credit-list. Follow the regulation's all-payment-credit rule from 2021: subtractclaim_of_right_credit, actualnet_premium_tax_credit, refundable AOC only and the residualal_other_federal_payment_creditsinput. 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.us-mo:claim-of-right-federal-tax-deduction. Drop the section 1341 entry fromignored_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.us-or:federal-tax-deduction-section-1341-credit. Drop the worksheet add-back. Retainmax(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.us-wi:claim-of-right-itemized-deduction-credit(including the duplicateus-wi:itemized-credit-section-1341-repaymentsandus-wi-itemized-credit-includes-repaymentitems). 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.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 tomin(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.us-va-reduced-itemized-omits-repayment. Retainclaim_of_right_deductionin the limited total and add the already-floored federalmisc_deductionfor 2017; the latter is zero from 2018. Both enter before section 68 reduction and proportional income-tax removal, with neither added to the exemptreduction.reduciblelist. 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):
Section 1341(b)(1) and (b)(3), same page:
26 CFR 1.1341-1:
IRS forms and instructions:
North Carolina:
Design notes
claim_of_right_credit_appliesbecause federal tax for those years is not verified; eligibility still gates federal relief and both North Carolina method conditions.claim_of_right_credit_appliesfollows the pattern oftax_unit_itemizes,id_receives_aged_or_disabled_creditandva_claims_refundable_eitc: two branches fix the method and computeincome_tax, and the main simulation takes the cheaper one. Each branch makes its own itemize-or-standard choice.tax_liability_if_itemizingis calculated first).get_override_branchgainsinherit_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 totax_unit_itemizes, so none chooses its own. One helper,get_itemization_branch(tools/general.py), builds them fortax_unit_itemizes,tax_liability_if_itemizingandtax_liability_if_not_itemizing. This holds whatever is calculated first and under both settings ofgov.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.tax_unit_itemizesopens 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 throughget_itemization_branch, with the same inputstax_liability_if_itemizinguses, so the two share one branch. Inheriting the method is not enough. From policyengine-core 3.33 (Add chained CPI #560),set_inputon a branch drops the values stored after the overridden variable's first store in the simulation. A branch fixing onlytax_unit_itemizestherefore 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 at32b0c13a6a(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.claim_of_right_section_1341_eligible.income_tax, which is chapter 1 tax after credits plus the net investment income tax (chapter 2A) andunreported_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_repaymentdoes not joingov.irs.deductions.itemized.misc.sources.programs.yaml); the brackets and the standard deduction have no earlier values. So the federal list entry would change no supported year.ar_misc_deduction_*) and New York (ny_misc_deduction) readtotal_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").claim_of_right_deduction.claim_of_right_repaymentcovers 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.nc_eitcandnc_cdcceach replacednc_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. Theirnc_income_taxoverrides are gone because the baseline now subtracts refundable credits. Thenc_cdccoverride addednc_use_tax, whichstate_use_taxalready counts; State EITC contrib reforms delete baseline refundable credits (ID, AZ, NC, WV) #8775 removed the same double count fromnc_eitc.Not modeled:
claim_of_right_repaymentexcludes them, so section 1341 for those repayments is out of scope.claim_of_right_credit_appliesas an input; the 2017 YAML case does.nc_claim_of_right_paymentsays so.main's itemizing branches already behave this way. Calculating a value that triggers the measurements in the parent before branching, asmarginal_tax_rate_on_capital_gainsandmarginal_tax_ratedo, would remove it (review r8; in the follow-ups).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.
ca_itemized_deductions_pre_limitationthrough Schedule CA column A; separate California credit, column B/C adjustments and untaxed-income restrictions remain unmodeled.az_itemized_deductions; the Arizona AGI addition and separate credit remain follow-ups.ks_itemized_deductions; retain this treatment pending the separate closed-list rewrite.ignored_credits, allowing it to reduce the federal-income-tax deduction base.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_creditsin 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
mainvs this branch (2025, single, age 40)Historical household comparison, before these review revisions. Computed at this branch's then-head
2d36a76bcaand at themainit merged,2f3053c845(which includes #10028), from frozen snapshots of each. Script~/reviews/us-hub/federal-1341/evidence/households.py; outputshouseholds_{base,pr}_2d36a76bca.jsonthere. Onmainthe two prior-year inputs do not exist, somaingives the deduction-free federal tax and #10028's North Carolina deduction. The same households are YAML cases (integration.yamlcases 1 and 4; the last cases innc_claim_of_right_deduction.yaml).mainThe 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_taxwas $1,378.89. Carrying over the deduction gives expected taxable income of $44,950 andca_income_taxof 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:
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.test_override_branches.pyclaim_of_right_credit.yamlclaim_of_right_credit_applies.yamlclaim_of_right_section_1341_eligible.yamlintegration.yamltax_unit_claim_of_right_repayment.yamlclaim_of_right_deduction.yamlaz_itemized_deductions.yamlca_itemized_deductions_pre_limitation.yamlks_itemized_deductions.yamlmo_federal_income_tax_deduction.yamlmt_claim_of_right_deduction.yamlnc_claim_of_right_payment.yamlnc_claim_of_right_deduction.yamlnc_income_tax.yamlor_federal_tax_liability_subtraction.yamlva_reduced_itemized_deductions.yamlwi_itemized_deduction_credit.yamlnc_cdcc.yamlnc_eitc.yamlnc_eitc_excludes_use_tax.yamltest_claim_of_right_section_1341_properties.pytest_nc_claim_of_right_properties.pyca_income_tax.yamlNo microsimulation was run by that review-revision job; the hub's separate historical rerun at
60cb3dd35ais 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 withgov.simulation.branch_to_determine_itemizationoff.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.nc_claim_of_right_deduction.yaml(one in 2016 with the method derived),nc_claim_of_right_payment.yaml(3), 1 innc_income_tax.yaml.nc_eitcandnc_cdccreforms.tests/unit/test_claim_of_right_section_1341_properties.py(the Rest job'sremainingPython 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)
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.
nc_income_taxequals tax before refundable credits minus the payment.Mutation check at
32b0c13a6a(scripts/mutants.py, thenscripts/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:tax_unit_claim_of_right_repayment.yamlcase 2 andintegration.yamlcase 6.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 exampleva_income_tax_if_claiming_refundable_eitcthrough federaltax_unit_itemizes, but federal tax reads no state liability: the SALT deduction uses estimated withholding. Second, from core 3.33set_inputon the method branch itself drops values stored after the method's first store.inherit_calculated=Falsestays as a cheap second guard (review r8).Status.
dc10cc58ce. Every check passed except the Rest job. It failed one test,test_known_violations_only_shrink, on an Illinois entry thatmainhad already dropped from the ratchet (Drop the fixed Illinois AABD entry from the person-adds ratchet #10092). Themainmerge at2d36a76bcabrought that in.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 ind1c695b2f7. CI resolves the latest compatible core (uv lock --upgrade-package policyengine-core).uv.lockpins 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.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
32b0c13a6aon core 3.32.29 (~/reviews/us-hub/federal-1341/tests.shthrough~/reviews/us-hub/scripts/heavy_run.sh; logs inevidence/runs-32b0c13a6a/):itemized_taxable_income_deductions.yamlandtax_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_cdcccontrib YAML, in its own process: 16 passed.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).sum, Rest groups, non-refundable consumers, in-place writes, uprating placement, personaddsof group variables) andtest_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; logsevidence/*_d1c695b2f7.log):nc_eitc/nc_cdcccontrib YAML: 16 passed.tests/core/test_override_branches.py, and Measure a branch's behavioural responses against baseline policy, with its own cache #9913'stest_behavioral_response_measurement_copies.pyandtest_behavioral_response_measurements.py: 109 passed.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
03439621bcand before the review fixes:va_itemized_deductions.yaml: 51 passed.test_claim_of_right_section_1341_properties.py: 16 passed at head4526aed52f(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 head03439621bc.sum, Rest groups, non-refundable consumers, in-place writes, uprating placement) andtest_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 head60cb3dd35a(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
remaininggroup onmain(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.remaininggroup took 20:53 wall clock and 7.76 GB maximum resident set.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.d1c695b2f7: 566 s onmainand 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,mainat the merge basea2f63c1235against60cb3dd35a, under the shared heavy lock. All 22 shared outputs (the 20 below plusca_income_taxandhousehold_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, andclaim_of_right_repaymentis $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),
maina2f63c1235against 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 inimpact/out/and the comparison inimpact/compare.2025.json.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_deductionsandclaim_of_right_repayment. For example, federal income tax is $2,418,430,680,404 on both sides.claim_of_right_deduction,claim_of_right_credit,claim_of_right_credit_appliesandnc_claim_of_right_paymentare zero on every record of the branch.claim_of_right_repaymentis zero on every record, so no unit reaches the $3,000 threshold, andget_itemization_branchgives the itemizing branches exactlymain's inputs.mainand 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.32b0c13a6aagainstmain2f3053c845also 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).main16a667719has nous/statutes/26/1341module and no module for G.S. 105-266.2.review_findingand 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.us/statute/26/1341andus-nc/statute/105/105-266.2is not verified; the issue lists that check.Follow-ups (not in this PR)
ny_itemized_deductions_maxcurrently omits the latter, so the New York follow-up must add it.misc_deductioncounted twice before 2018 in Mississippi and Missouri; Alabama's miscellaneous deduction reading the suspended federal one; Montana's pre-2024casualty_loss_deductionprojection 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.marginal_tax_rate_on_capital_gains(capital_gains_responses.py) andmarginal_tax_ratedo. This applies tomain's itemizing branches as well as this PR's.Readings for Max
🤖 Generated with Claude Code