Skip to content

Add North Carolina's claim of right repayment itemized deduction (G.S. 105-153.5(a)(2)d) - #10028

Merged
MaxGhenis merged 3 commits into
mainfrom
nc-claim-of-right-deduction
Oct 12, 2026
Merged

MaxGhenis merged 3 commits into
mainfrom
nc-claim-of-right-deduction

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

North Carolina itemizers may deduct repayments of income that they included in AGI in an earlier year under a claim of right (Form D-400 Schedule A line 8). PolicyEngine had no input for these repayments and left the deduction out. This PR adds:

  • claim_of_right_repayment, a person-level input: the amount repaid this year of income included in AGI in an earlier year because it appeared the person had an unrestricted right to it (26 U.S.C. 1341), excluding repayments deducted in arriving at AGI;
  • nc_claim_of_right_repayment_excluded_from_income, a person-level input used from 2026: the part of that repayment North Carolina deducted from AGI when it was received, such as repaid Social Security benefits;
  • nc_claim_of_right_deduction, North Carolina's deduction under G.S. 105-153.5(a)(2)d;
  • gov.states.nc.tax.income.deductions.itemized.other_sources, a parameter list of the itemized items outside the $20,000 mortgage and property tax cap (charitable, medical, and now claim of right). It replaces a hard-coded list in nc_itemized_deductions, preserving the existing charitable and medical sources and adding the default-zero repayment deduction. Historical microdata comparisons showed no change; impact at the final merged head remains pending for the hub.

The law

N.C. Gen. Stat. § 105-153.5(a)(2)d, added by S.L. 2016-5 § 2.1.(a) for taxable years beginning on or after January 1, 2014 (§ 2.1.(d)):

d. Repayment in the current taxable year of an amount included in adjusted gross income in an earlier taxable year because it appeared that the taxpayer had an unrestricted right to such item, to the extent the repayment is not deducted in arriving at adjusted gross income in the current taxable year. If the repayment is three thousand dollars ($3,000) or less, the deduction is the amount of repayment less (i) the limitation provided under section 67(a) of the Code minus (ii) all other items deductible under section 67(b) of the Code, not to exceed the limitation provided under section 67(a) of the Code. If the repayment is more than three thousand dollars ($3,000), the deduction is the amount of repayment. 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.

S.L. 2026-31 § 1.8 (PDF pp. 5–6, approved July 2, 2026) rewrites the first sentence for taxable years beginning on or after January 1, 2026: "an amount included in adjusted gross income income, as modified in G.S. 105-153.5 and G.S. 105-153.6, in an earlier taxable year". The statute page on ncleg.gov did not yet show this on October 9, 2026.

NCDOR's Repayment of Claim of Right Worksheet, 2025 Form D-401 instructions, PDF p. 20 (the same on PDF p. 20 for 2021 through 2024), for repayments of $3,000 or less: line 3 is 2% of federal AGI ("If negative, enter the number zero"), and line 4, the deduction, is line 1 minus line 3.

Term (ii) is read from the 2016 worksheet (PDF p. 13), the first year NCDOR printed one. Other miscellaneous itemized deductions absorb the 2% floor first: line 5 = 2% of AGI − the other federal miscellaneous deductions (not below zero), and line 6 = repayment − line 5 (not below zero). Section 67(g) disallows those other deductions from 2018. That is why the 2018-and-later worksheet subtracts the whole floor. The formula encodes the statute, so it reproduces both worksheets: it subtracts the head's and spouse's miscellaneous expenses only while gov.irs.deductions.itemized.misc.applies is true.

Design notes

  • Leaf inputs. Before this PR, PE had no input for claim-of-right repayments. The repayment and, from 2026, the part North Carolina excluded when received are facts about the taxpayer's returns. The model derives the deduction from them.
  • Head and spouse only. A dependent's repayments and miscellaneous expenses belong on the dependent's own return. YAML cases cover both.
  • The $3,000 test applies to the return's total. Worksheet line 1 is a single amount for the return. From 2026 the test applies to the amount the first sentence allows.
  • Not modeled: the section 1341(a)(5) bar.
    • Under 1341(a), federal tax for the repayment year is the lesser of tax with the deduction (1341(a)(4)) and tax without it minus the prior-year tax decrease (1341(a)(5)). So the method is computed, not elected.
    • PE models no part of section 1341 federally at this head. The stacked follow-up #10038 adds it, with the prior-year tax decrease as a leaf input, and then wires this bar; the hub re-stacks and reviews that PR after this build.
    • Until then this PR applies the deduction method. Section 1341 applies only when the federal repayment exceeds $3,000. The omitted section 1341(a)(5) bar therefore does not affect federal repayments of $3,000 or less, or (a)(4) filers.
    • For (a)(5) filers it may overstate the North Carolina deduction. From 2026, that includes a filer whose federal repayment exceeds $3,000 while the NC-eligible part is smaller.
    • North Carolina separately treats (a)(5) filers as having paid tax equal to the prior-year NC tax on the item, less the current-year NC saving (G.S. 105-266.2, refundable). PE does not model that either, so the net error for an (a)(5) filer can go either way.
    • Before this PR, no repayer could get the deduction.
  • Not modeled: from 2026, repayments of amounts that North Carolina added to AGI but federal AGI excluded. This remains a coverage limitation.

Historical household comparisons (2025, North Carolina, single)

The earlier main and claim-branch runs are saved in ~/reviews/us-hub/nc-itemized-other/evidence/households_{main,claim}.json (script households.py there). These are prior-run examples, rather than measurements repeated at the final merged head.

Household main NC income tax Branch NC income tax
Wages $80,000; real estate taxes $4,000; charity $8,000; repays $5,000 of 2024 wages $2,858.12 (no way to enter the repayment; the $12,750 standard deduction beats $12,000 itemized) $2,677.50: itemized $17,000; taxable income $63,000 × 4.25%
Same, charity $12,000, repays $2,500 $2,720.00 $2,681.75: deduction $2,500 − 2% × $80,000 = $900

Tests

Current tested head: 81528e0207591db0a453552cfba4d8c1c12a43c6. The first three YAML files ran individually, and the remaining six ran in one permitted baseline batch; the repeated standalone standard-deduction run is counted once. Python test files ran individually, all in the foreground. The lightweight untracked wrapper completes each test module, session and fixture teardown, then skips interpreter finalization. The six-file YAML batch reported 23 passed; its outer /usr/bin/time -l exited 1 afterward because the sandbox denied sysctl kern.clockrate during timing-resource reporting.

The incomplete test_parameter_yaml_keys.py attempts are preserved and excluded from pass counts: the initial pytest 9 attempt stopped with a Python segmentation fault (exit 139); a shared-startup retry was interrupted (exit 130); an isolated importlib retry was interrupted before assertions (exit 2); and a default-import-mode retry with a conftest cutoff stopped after partial progress (exit 2). None produced a complete test result. The fatal traceback references pytest capture and logging; the crash cause remains unconfirmed. The completed code-health runs used workspace-local pytest 8.4.2, matching the lock, with the existing shared policyengine-core 3.32.15 dependencies, default prepend import mode, --confcutdir=policyengine_us/tests/code_health, unbuffered and uncaptured output (-u -s), and no custom periodic traceback thread. These environment and invocation changes do not establish the crash cause. Version evidence is saved in hub-evidence/pytest-env-versions.log; the completed results are reported below.

The test_rest_python_groups.py invocation additionally set PYTEST_DISABLE_PLUGIN_AUTOLOAD=1, inherited by its child collectors; pytest built-in and module-local fixtures remain available. Its children only collect placeholders with --collect-only --noconftest: they neither import the collected test modules nor execute their cases. The guard checks make -n output and uses a stub pytest command with synthetic success, failure and kill outcomes to test group orchestration. Its workflow checks read YAML; it runs no Rest groups, SPM tests or microsimulations.

Test file Result Execution
nc_claim_of_right_deduction.yaml 17 passed Individual YAML file
nc_itemized_deductions.yaml 4 passed Individual YAML file
nc_standard_or_itemized_deductions.yaml 1 passed Individual YAML file
nc_standard_deduction.yaml 3 passed Six-file baseline YAML batch
nc_income_tax.yaml 3 passed Six-file baseline YAML batch
nc_income_tax_before_refundable_credits.yaml 3 passed Six-file baseline YAML batch
wagering_losses_deduction.yaml 3 passed Six-file baseline YAML batch
taxable_income_deductions_if_itemizing.yaml 2 passed Six-file baseline YAML batch
ar_gambling_loss_deduction.yaml 9 passed Six-file baseline YAML batch
test_nc_claim_of_right_properties.py 7 passed Individual Python file
test_parameter_yaml_keys.py 34 passed Individual Python file
test_reference_urls.py 32 passed Individual Python file
test_no_concatenated_reference_urls.py 48 passed Individual Python file
test_rest_python_groups.py 12 passed Individual Python file

YAML total: 45 passed across nine unique files. The six-file batch accounts for 23 passing cases in 62.04 s of pytest time; the repeated standalone standard-deduction run adds no cases to this total.

Python total: 133 passed across five files (property 7, parameter keys 34, reference URLs 32, no-concatenated URLs 48, Rest groups 12). Together with 45 YAML cases across nine files, 178 current-head cases passed across all fourteen targeted files.

Partner contract tests were neither run nor edited. Static inspection of the 144 partner YAML files found neither new repayment input, and no partner movement attributable to this PR was identified.

Standalone test_parameter_yaml_keys.py: 34 passed in 3,169.53 s of pytest time; 3,267.67 s from wrapper start through module completion; 285,949,952 bytes maximum RSS; module exit status 0. This is a local sandbox measurement. Evidence: hub-evidence/pytest_parameter_yaml_keys.pytest8.{log,metrics.json}.

Standalone test_reference_urls.py: 32 passed in 2,491.45 s of pytest time; 2,594.51 s from wrapper start through module completion; 753,172,480 bytes maximum RSS; module exit status 0. Evidence: hub-evidence/pytest_reference_urls.{log,metrics.json}.

Standalone test_no_concatenated_reference_urls.py: 48 passed in 1,149.98 s of pytest time; 1,181.61 s from wrapper start through module completion; 60,555,264 bytes maximum RSS; module exit status 0. Evidence: hub-evidence/pytest_no_concatenated_reference_urls.{log,metrics.json}.

Standalone test_rest_python_groups.py: 12 passed in 1,872.34 s of pytest time; 1,909.60 s from wrapper start through module completion; 40,943,616 bytes maximum RSS; module exit status 0. Evidence: hub-evidence/pytest_rest_python_groups.{log,metrics.json}.

  • nc_claim_of_right_deduction.yaml, 17 cases from the worksheets and the statute:
    • the floor; exactly $3,000 (still reduced); $3,001 (deducted in full); a floor above the repayment; negative AGI;
    • a joint return with a dependent's repayment excluded;
    • 2022 under section 67(g);
    • three 2016-worksheet cases with other miscellaneous expenses, including a dependent's;
    • 2025 and 2026 cases for the S.L. 2026-31 rewrite;
    • a non-NC household; the itemized total outside the $20,000 cap; and an nc_income_tax integration case.
  • test_nc_claim_of_right_properties.py, in tests/unit (the Rest job's remaining Python group). It runs a 720-point grid (repayment × AGI × other miscellaneous expenses × charity × property tax), one vectorized simulation each for 2016 and 2025, and a 240-point 2026 grid. The Python file compares the model with independent line-by-line implementations of the 2016 and 2025 worksheets over these finite grids. It also checks bounds, monotonicity, additivity outside the cap, and tax direction across grid points, including the standard-deduction crossover. The worksheet comparisons follow the worksheets' line structure.

Invariants checked over the finite grids

  1. Worksheet agreement: the deduction equals the 2016 worksheet in 2016 and the 2025 worksheet in 2025 at every grid point.
  2. Bounds in the 2016/2025 grids: 0 ≤ deduction ≤ repayment, and deduction = repayment whenever the repayment exceeds $3,000.
  3. Monotonicity: non-decreasing in the repayment, including across the $3,000 threshold; non-increasing in AGI; non-decreasing in other miscellaneous expenses.
  4. Other miscellaneous expenses change the deduction in 2016 and never in 2025 (section 67(g)).
  5. Additivity outside the cap: North Carolina itemized deductions rise by exactly the deduction, also when property taxes already exceed the $20,000 cap.
  6. Tax direction: North Carolina income tax never rises with the repayment, also across the standard-deduction crossover.
  7. From 2026 the deduction is the 2025 worksheet applied to the part North Carolina taxed. In 2025 that split has no effect, and the 2026 deduction never exceeds the 2025 one.

Current property-test cost

Standalone test_nc_claim_of_right_properties.py: 7 passed in 9.14 s of pytest time; 298.33 s from wrapper start through module completion, including startup; 975,110,144 bytes maximum RSS, measured with Darwin resource.getrusage; module exit status 0. The long startup reflected slow sandbox filesystem access. This local run is not a CI cost estimate. Metrics are saved in hub-evidence/pytest_property.metrics.json, with the pytest summary in hub-evidence/pytest_property.log.

Historical test and cost evidence

The following measurements predate this merge and are retained as context:

  • Prior CI group. The Rest job's remaining group on main (run 37926760594) collected 2,151 tests, including 11 skipped: 1,315.161 s of test time, 24:05.67 wall clock, 12,816,372 kB maximum RSS on the 16 GB runner.
  • Prior isolated local measurement. The earlier body and r2 review reported this file alone at 7 tests in 1.08 s (four simulations), with 1,107 MB peak RSS against 1,037 MB for importing policyengine_us and computing one household. No standalone log for that measurement was found in the saved evidence directory; the current isolated measurement above supersedes it for this head.
  • Prior comparison. The merged precedent test_ar_gambling_properties.py accounted for 32 cases and 4.636 s in that CI group.

Prior locked runs (~/reviews/us-hub/nc-itemized-other/evidence/):

  • main ff479aa74a: the NC and gambling YAML files, 28 passed.
  • This branch 3b57231636, YAML: nc_claim_of_right_deduction.yaml plus those files, 45 passed in 9.24 s.
  • This branch, Python: test_nc_claim_of_right_properties.py plus four parameter, reference and Rest-group code-health files, 133 passed in 29.84 s; 49.11 s wall clock and 1,244,741,632-byte maximum RSS for the combined run. These are combined-run measurements.

Hub microsimulation impact (current head)

A real microsimulation on the default dataset, main at the merge base 35f3c1f92a against this PR's head 81528e0207, for 2026. The runs went one at a time under the shared heavy-job lock. Sums are weighted.

Output 2026 change 2026 records changed (weighted)
nc_itemized_deductions +0 0 (0)
nc_income_tax +0 0 (0)
state_income_tax +0 0 (0)
income_tax +0 0 (0)
household_net_income +0 0 (0)
household_benefits +0 0 (0)

Variables this PR adds (nc_claim_of_right_deduction) have no value on the base side, so the table leaves them out.

Comparison files are in fixes/10028-impact/ on the hub host.

Historical microsimulation evidence

The prior body and evidence logs attribute four real microsimulation runs on the default dataset (hf://datasets/policyengine/populace-us/populace_us_2024.h5@populace-us-2024-spm-20260909, 79,729 tax units): main ff479aa74a and this branch 3b57231636, for 2025 and 2026. They ran one at a time under the shared lock (~/reviews/pe-us-merge-backlog-2026-10-02/impact/lockrun.sh). Record-by-record comparisons are in ~/reviews/us-hub/nc-itemized-other/evidence/impact-ncit-c-{2025,2026}.json. The saved run JSONs and run logs do not record commit SHAs; attribution to ff479aa74a and 3b57231636 comes from the prior PR body, evidence summary, and r3 review. These results are historical evidence and do not replace the hub's impact run at the current head.

Year NC income tax, main Change Records changed (state_income_tax, nc_income_tax, nc_taxable_income, nc_itemized_deductions, nc_standard_or_itemized_deductions, household_net_income)
2025 $16.606bn $0 0 for every variable
2026 $16.560bn $0 0 for every variable

Those historical comparisons show no change because the dataset has no claim-of-right repayments. claim_of_right_repayment and nc_claim_of_right_deduction are zero on every record. The change matters for households that report a repayment, as in the table above. The parameter-list refactor changed no record in those historical runs.

Axiom

axiom: TheAxiomFoundation/rulespec-us#1656 queued

RuleSpec parity issue #1656 was filed by MaxGhenis on October 11, 2026 at 14:05:53 UTC with the pe-parity label. It covers the claim-of-right repayment deduction in G.S. 105-153.5(a)(2)d and the wagering-loss deduction in (a)(2)e, including their dated amendments, prerequisites and companion cases. It was filed from the existing draft at ~/reviews/us-hub/nc-itemized-other/axiom/nc-105-153.5-a2-d-e-issue.md. Encoding remains pending. The hub corrected the issue's status line to "queued" on 2026-10-11.

The draft records the prior RuleSpec/corpus checks:

  • In rulespec-us main 207486d8b5, us-nc/statutes/105/105-153.5/a.yaml is status: deferred: it encodes the $3,000 threshold and leaves #deduction_amount deferred.
  • Its prerequisites 26 U.S.C. 67(a)/(b)/(g) and 165(d) were not encoded at that checked head.
  • The axiom-corpus TY2026 builder applies S.L. 2026-31 § 1.8 and S.L. 2026-41 § 44.2 to this section; the prior checks found that scope unpublished. The hub rechecks the draft's corpus conditions before dispatch.

Follow-ups (not in this PR)

The PR remains a draft. The hub owns the confirmation review at the pushed head, marking ready, CI, landing, and re-stacking #10038 afterward.

  • North Carolina's wagering losses deduction, G.S. 105-153.5(a)(2)e (S.L. 2026-41 § 44.2, from 2025), is developed on branch nc-wagering-losses-deduction, stacked on this one. It awaits its federal prerequisites and hub review. It cannot land before Federal gross income omits gambling winnings but still deducts wagering losses; OBBBA 90% wagering loss limit (2026+) not modeled #9637 is fully fixed:
    • federal gross income must count gambling winnings;
    • the deduction must apply the 90% share of losses from 2026;
    • only the head's and spouse's gambling may count.
      Guards on that branch fail until all three are fixed.
  • #10038, federal section 1341: the claim-of-right deduction above $3,000 (Schedule A line 16), the credit computation under 1341(a)(5), and then the 1341(a)(5) bar above. The hub owns re-stacking and reviewing that follow-up.

🤖 Generated with Claude Code

MaxGhenis and others added 2 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>
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Context from the session that opened this PR, for the US + core hub, which now owns it. I will not push to this branch.

Reviews (GPT-6.1 Sol via Subfleet). Files are in ~/reviews/us-hub/nc-itemized-other/:

  • r1 review-out.md: REQUEST CHANGES. It found the S.L. 2026-31 § 1.8 rewrite and dependents' miscellaneous expenses; both are fixed in 3b57231636. The author's response is review-response-r1.md.
  • r2 review-r2-out.md: the code is sound; REQUEST CHANGES on documentation only. It withdrew the request that the section 1341(a)(5) bar needs Max.
  • r3 review-r3-out.md: one wording fix, in the held Axiom draft's status line.
  • r4 review-r4-out.md: it confirmed that fix. Its one FAIL was that its sandbox could not reach GitHub to verify the upstream head.
  • None of these reviewed 81528e0207, the hub's merge of main. My rebase onto main fe0c3a6, saved as wip/rescue-10028-rebase (6f37b3baa2), had a range-diff identical to 3b57231636.

Evidence is in ~/reviews/us-hub/nc-itemized-other/evidence/:

  • households_*.json;
  • the locked test logs, at 3b57231636;
  • impact-ncit-c-{2025,2026}.json: real microsims against main ff479aa74a, zero change on every record, because the dataset has no repayments;
  • ci-rest-timings/: the remaining-group baseline used for the test-cost note.

Known gaps, documented in the variable and the body:

Follow-ups:

@MaxGhenis MaxGhenis closed this Oct 11, 2026
@MaxGhenis MaxGhenis reopened this Oct 11, 2026
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 11, 2026 23:20
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (909176a) to head (81528e0).
⚠️ Report is 414 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main    #10028   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         3    -1     
  Lines           76        56   -20     
  Branches         2         2           
=========================================
- Hits            76        56   -20     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaxGhenis
MaxGhenis merged commit 557b539 into main Oct 12, 2026
45 of 49 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

US + core hub merge audit, us#10028 at 81528e0207591db0a453552cfba4d8c1c12a43c6 (squash): Add North Carolina's claim of right repayment itemized deduction (G.S. 105-153.5(a)(2)d).

@MaxGhenis
MaxGhenis deleted the nc-claim-of-right-deduction branch October 12, 2026 09:27
MaxGhenis added a commit that referenced this pull request Oct 13, 2026
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 14, 2026
…ut note

main compiled the North Carolina claim of right fragment into CHANGELOG.md
when #10028 merged, so the copy left on this branch would print it again.
The period_branch module docstring said set_input on a branch clears
nothing, which policyengine-core 3.33 changed (review r8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Nov 7, 2026
…41) and North Carolina's rules that depend on it (#10038)

* Add North Carolina's claim of right repayment itemized deduction

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>

* From 2026 limit North Carolina's claim of right deduction to income NC 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>

* Model the section 1341 claim of right deduction and credit; wire North Carolina's 1341(a)(5) bar and G.S. 105-266.2 payment (WIP)

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

* Keep the federal claim of right deduction and credit out of state rules that exclude them (AZ, KS, WI, MO, OR, VA); property tests

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

* Document the unmodeled pre-2018 small repayment deduction; changelog fragment

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

* Fix the federal method in the North Carolina worksheet property test to keep it at two seconds

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

* Remove a stray empty log file

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

* Address review: isolate the method branches, compare to the cent, return-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>

* Keep the simulation's claim of right method in the itemizing branches

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>

* Merge main into North Carolina claim of right deduction

* Merge PR 10028's branch (with main) into the section 1341 branch

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

* Restore conservative branch invalidation; fix the method in itemizing 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>

* Merge main into the section 1341 branch

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

* Test both NC contrib credits stacked on the claim of right payment with use tax

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

* Merge main into the section 1341 branch

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>

* Carry the claim of right deduction into Montana itemized deductions from 2024

From 2024 Montana Form 2 line 2 takes the federal itemized deductions
(2024 instructions, Worksheet A line 1: Form 1040 line 12), which include
Schedule A line 16. The miscellaneous list was empty from 2024, so a
Montana itemizer lost the federal claim of right deduction. Review r5b
(P3-1) found it.

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

* Merge main into the section 1341 branch

Resolves the period_branch.py conflict with #9913 (5c51e0d) by taking
main's _input_keys docstring, which no longer says whether Core's clone
copies or shares the input-key set.

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

* Give every itemizing branch the simulation's claim of right method

From 2026 tax_unit_itemizes opens the itemizing branch for the section 68
limitation (#10136) with only tax_unit_itemizes overridden. From
policyengine-core 3.33 (#560), set_input on a branch drops the values stored
after the overridden variable was first stored anywhere in the simulation,
so that branch lost the inherited section 1341 method and chose its own as a
filer forced to itemize. Its itemized deductions then decided itemization on
a liability tie, or always with itemization branching off: CI failed two 2026
grid points, and a 2026 household with branching off came out at $4,988
instead of $4,100.

get_itemization_branch builds the itemizing and non-itemizing branches for
all three callers, adding the method as an input whenever someone qualifies,
so they share one branch and none chooses a method. A 2026 test covers that
household in every calculation order under both itemization settings; it
fails before this change.

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

* Drop #10028's merged changelog fragment; date period_branch's set_input note

main compiled the North Carolina claim of right fragment into CHANGELOG.md
when #10028 merged, so the copy left on this branch would print it again.
The period_branch module docstring said set_input on a branch clears
nothing, which policyengine-core 3.33 changed (review r8).

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

* Clarify federal claim of right input documentation

* Keep claim of right threshold references specific to its value

* Explain Wisconsin claim of right worksheet interpretation

* Carry the federal claim of right deduction into California itemized deductions

* Require section 1341 eligibility for North Carolina repayment relief

* Merge remote-tracking branch 'gh/main' into federal-claim-of-right-1341

* Align NC refundable claim-of-right accounting with state tax invariants

* Apply statute-first claim-of-right treatment in AL MO OR WI and VA

* Complete Montana repayment deductions and federal taxable income base

* Preserve Alabama federal deduction credit treatment before 2021

* Document Alabama credit-list verification boundary

* Correct entities in Montana repayment regression fixtures

* Remove duplicate household inputs from Montana fixtures

* Merge remote-tracking branch 'gh/main' into federal-claim-of-right-1341

* Fix Montana state-tax adjustment before taxable-income floor

* Correct tax-unit inputs in Montana property test

* Merge main into federal-claim-of-right-1341

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.

* Merge main into federal-claim-of-right-1341

Preserve the 2020 above-the-line charitable deduction and 2021
non-itemizer treatment while retaining section 1341 method-aware
itemization branches. Keep the single Schedule A parameter block
with the claim-of-right deduction.

Add six hand-calculated 2020/2021 regressions combining charitable
deductions and both section 1341 methods, including comparisons
with itemization branching disabled.

* Merge current main into federal-claim-of-right-1341

* Merge main into federal-claim-of-right-1341

Conflicts resolved:
- Wisconsin itemized deduction credit: keep main's explicit Schedule 1
  component list (#10311) and add claim_of_right_deduction to it, so the
  section 1341 repayment stays in the credit base as this PR intends
  under Wis. Stat. 71.07(5)(a)6-7.
- Alabama and Wisconsin YAML tests: keep both sides' cases.

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

* Montana: add the state-income-tax addback after the line 3 floor from 2025

The 2024 Form 2 Worksheet A reduces the federal deduction by the capped
state-income-tax addback before line 3's zero floor. The 2025 form stops
adjusting line 2 and reports the addback on Schedule I line 4, a Montana
addition after the floor, as MCA 15-30-2120(1) treats the (2)(j) item
alongside the other additions. A new boolean parameter is true in 2024 and
false from 2025 (2026 follows the 2025 form by convention), and both
mt_taxable_income_joint and mt_federal_deductions read it.

Adds 2025 and 2026 YAML witnesses (the review's AGI 10,000 / itemized
20,000 household gives 4,250 in 2025), keeps the 2024 pre-floor witnesses,
limits the property test to 2024, and points the misc_deductions comment at
mt_taxable_income_joint, which is what reads the federal base.

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

* Alabama: apply the regulation's payment-credit list from 2015

Ala. Admin. Code r. 810-3-15-.20(1)(d)2 subtracts all credits shown as
payments on the federal return, and its current text dates from a 2010
amendment, so it governs every year the parameter covers, not only 2021 on.
The legacy pre-2021 list (total AOC, no section 1341 credit or net PTC) is
dropped, and the 2020 case that pinned it now expects
5,000 - 1,000 - 1,500 - 1,000 - 750 = 750.

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

* Update the four source-conflict candidates this PR resolves

main's backlog still described the code before this PR: AL, MO and WI as
following the worksheets and OR as unknown. The head follows the statute or
regulation in all four, so set pe_us.follows to statute and state to ruled,
replace the notes that said a model change was still needed, start AL's
years in 2015 (the corrected credit list now applies from the parameter's
first year), and cite ORS 316.685(1)(b), the EITC-only disregard the OR
code follows.

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

* Replace two dead Montana references

The 2017 Montana Form 2 with Legal References now 404s at its original
address; cite the Wayback Machine copy of 2024-01-07, whose PDF p. 6
Schedule III lines 25, 26 and 28 the reviewer confirmed. Drop the "2023 HB
109" reference: its URL mixes HB0199 and HB0109, returns 404, and what it
was meant to support could not be confirmed; MCA 15-30-2120 is already
cited for the deduction.

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

* Rebuild the Missouri and Oregon section 1341 witnesses from a repayment

Both cases set claim_of_right_credit as an input that neither formula reads,
so they only checked that income_tax passes through. They now use the
federal integration case 4 household (2025, $40,000 wages, $10,000
repayment, $2,200 prior-year decrease), where the credit method wins and
flows through income_tax: 2,671.50 - 2,200 = 471.50. Missouri deducts
25% x 471.50 = 117.875 and Oregon subtracts 471.50. Adding the credit back
in either formula fails its case.

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

* Run the section 1341 property grid in 2020 too

main's #10186 made the 2020 itemization choice compare two branches with
different AGI (the 2020 above-the-line charitable deduction), and no
invariant in this file ran on that path. Add 2020 to YEARS (last, so the
tests that read YEARS[0] and YEARS[1] keep 2025 and 2026) and run the
calculation-order test in 2020 as well. Every existing assertion is kept;
all 58 tests pass. Locally the file went from 182 s to 220 s and its peak
RSS from 3.2 GB to 3.5 GB.

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

* Changelog: state the Montana and Alabama scope for every filer

The claim-of-right fragment described the Montana work as repayment
treatment, but from 2024 every Montana filer's taxable income now starts
from the federal base (all six mt_taxable_income_joint cases changed), and
every Alabama AOC claimant now subtracts only the refundable part.

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

* Merge remote-tracking branch 'origin/main' into federal-claim-of-right-1341

* Pin Montana's QBI add-back before the zero floor with a reachable 2026 case

The old 2025 case supplied a positive QBI deduction at a binding floor, which
the model can't produce before 2026. From 2026 the 199A(i) $400 minimum can
exceed taxable income, so a derived household now pins the order: MCA
15-30-2101(22) and 15-30-2120(2)(i) add the deduction back to federal
taxable income before Form 2's line 7 floor, giving 0, not 400.

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

* Pin aca_ptc to 0 in Oregon's section 1341 witness

Once #10093 nets the premium tax credit in Oregon's subtraction, this
household's modeled credit would zero the subtraction. Pinning it keeps the
case isolating the section 1341 credit at 471.50.

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

* Drop the unreachable 2025 branches from the Montana property test

YEARS is (2024,), so the Schedule 1-A draw and the year >= 2025 branches
never ran; YAML cases cover 2025 and 2026.

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

* Document mt_federal_deductions as display-only

mt_taxable_income_joint computes its own deduction term from
taxable_income_deductions, which also holds the QBI deduction and the
Schedule 1-A deductions, so the two differ (e.g. 15,750 against 21,750 in
the 2025 tip case) and the formula can't read this variable.

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

* Start the Alabama credit-list item at 2018, the first worksheet compared

The code applies the regulation's list from 2015, but worksheets before 2018
went unchecked, so the item can't claim a conflict for 2015-2017.

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

* Explain Montana's QBI add-back order from Form 2, not section 63

The comment argued from federal taxable income having no floor, which
would also remove the line 3 floor the code keeps for Montana's other
additions. The order follows the form: line 2 leaves the QBI deduction
out, and line 3 floors line 1 minus line 2 at zero.

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

* Merge main

Main removed gov.household.household_refundable_credits and
gov.household.household_tax_before_refundable_credits, which no formula
read after it dropped the abolish-tax structural reforms. This branch had
added North Carolina to both. The merge keeps the removal; this branch's
North Carolina entries stay in gov.household.household_refundable_state_credits
and the gov.states.household lists.

Main's new North Carolina use tax case under the payroll tax repeal enters
nc_income_tax, which this branch's state list no longer reads: the list now
counts North Carolina tax before refundable credits. The case now enters
nc_income_tax_before_refundable_credits, and its totals stay at 1,020.

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

* Merge main into federal-claim-of-right-1341

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

* Merge main into federal-claim-of-right-1341

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

* Merge main into federal-claim-of-right-1341

#10094 also adds an entry to
source_conflicts/candidates.yaml. Git merges the two cleanly, and the
merged register keeps unique ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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