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>
…ate property test Under the federal credit method, section 1341(b)(3) keeps the repayment out of every state that only follows the federal deduction, so their tax must not change. States with their own claim of right relief may lower tax under either method. The test now reads which states have their own rule from the model's variable names (<state>_claim_of_right_...), so a state PR adds its variables without editing this list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
N.J.S.A. 54A:5-2 lets a loss reduce only income of its own category, and TAM 2011-7 applies that to claim of right repayments: New Jersey has no section 1341 credit, and "any repayment ... may be applied against other income earned in the same category and in the same tax year", reporting zero if the offset leaves the category negative. A new person-level input, nj_claim_of_right_repayment_category (wages by default), says which category the repaid income was. The return's offset in each category is the smaller of the filers' repayments and their income in it, borne by each spouse in proportion to their own income in the category. It comes off New Jersey gross income, so total income, ANCHOR and property tax relief income all see it. YAML cases include the TAM's wage example; property tests check the cap, the per-spouse bound, federal-method independence and that tax never rises. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eral credit Reviews of #10195, #10196 and #10198 found that reading own-rule states from variable names weakened the cross-state test: North Carolina and Montana lost their exact check, nothing asserted that a state's own relief actually lowered its tax, and any future <state>_claim_of_right_ input would exempt a state. Now an explicit, sourced map names each state whose relief applies under the federal credit method and the variable that carries it. Under that method each listed state whose variable is in the model must lower the household's tax by more than $1, and every other state's tax must not change. The same commit is on every state branch, so they still merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd Worksheet D Review of #10198 found that a repaid pension still counted in the pension exclusion's base, NJ-1040 line 28a's Line A ("Amount from line 20a"), and that Worksheet D's $3,000 test, line 4 ("the amount from line 15"), ignored a wage repayment. Both lines are net of the offset under N.J.S.A. 54A:5-2 and TAM 2011-7. - The per-category computation moves to nj_claim_of_right_category_offset; new nj_claim_of_right_pension_offset and nj_claim_of_right_wage_offset carry the two categories those lines read. - nj_eligible_pension_income nets out the pension offset; Worksheet D's earnings test nets out the wage offset. - A new OTHER category is not offset, so a repayment of prizes, estate income or another unmodeled category need not be mislabeled as wages. - The property test is now a differential: on a grid of single and joint returns aged 40 and 70, a repayment gives the same New Jersey AGI and taxable income as a simulation with no repayment and that much less income in its category. Reverting either fix fails it. It also checks that each category's sources are New Jersey gross income sources. - YAML: Case 3 asserts New Jersey AGI; new cases for a pension repayment at age 70, Worksheet D after a wage repayment, and the OTHER category. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eral credit Reviews of #10195, #10196 and #10198 found that reading own-rule states from variable names weakened the cross-state test: North Carolina and Montana lost their exact check, nothing asserted that a state's own relief actually lowered its tax, and any future <state>_claim_of_right_ input would exempt a state. Now an explicit, sourced map names each state whose relief applies under the federal credit method and the variable that carries it. Under that method each listed state whose variable is in the model must lower the household's tax by more than $1, and every other state's tax must not change. The same commit is on every state branch, so they still merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eral credit Reviews of #10195, #10196 and #10198 found that reading own-rule states from variable names weakened the cross-state test: North Carolina and Montana lost their exact check, nothing asserted that a state's own relief actually lowered its tax, and any future <state>_claim_of_right_ input would exempt a state. Now an explicit, sourced map names each state whose relief applies under the federal credit method and the variable that carries it. Under that method each listed state whose variable is in the model must lower the household's tax by more than $1, and every other state's tax must not change. The same commit is on every state branch, so they still merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eral credit Reviews of #10195, #10196 and #10198 found that reading own-rule states from variable names weakened the cross-state test: North Carolina and Montana lost their exact check, nothing asserted that a state's own relief actually lowered its tax, and any future <state>_claim_of_right_ input would exempt a state. Now an explicit, sourced map names each state whose relief applies under the federal credit method and the variable that carries it. Under that method each listed state whose variable is in the model must lower the household's tax by more than $1, and every other state's tax must not change. The same commit is on every state branch, so they still merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A repayment now offsets the repayer's own income in its category first, and only the excess offsets the other spouse's (the joint return's category line combines both). Proportional sharing let a younger spouse's pension repayment cut the older spouse's pension exclusion. New YAML cases 12 and 13 give a mixed-age couple New Jersey AGI of $42,000 when the younger spouse repays and $50,000 when the older one does; case 5 now splits $2,000 and $4,000. - The interest category's cap leaves out interest on U.S. obligations, which New Jersey subtracts from gross income separately, so a repayment cannot offset exempt Treasury interest and reach wages (case 11). - The property grid adds spouses of the other age with their own pensions; its reference takes the repayer's income first. The category lists are checked for completeness against non_negative_sources and the pension exclusion's sources in every year block. Restoring proportional sharing fails the grid; counting exempt interest fails case 11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
…rom 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>
…anch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hand-off to the US + core hub (New Jersey; state claim of right lane, session local_d0c92ac9).
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hand-off update (2026-10-14): new head |
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>
…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>
|
Hand-off update (2026-10-14, supersedes the earlier one today): head |
PR Review: Offset New Jersey claim of right repayments within their income category (N.J.S.A. 54A:5-2)PR #10198 (author: MaxGhenis, head SummaryNew Jersey has no counterpart to section 1341. Under TAM 2011-7, a filer applies a repayment against income of the same N.J.S.A. 54A:5-1 category in the year of repayment, as 54A:5-2 allows for losses. A category left negative is reported as zero. The model had no such offset, so a repayment changed nothing in New Jersey. The PR adds:
The New Jersey work is right:
Two should-fixes:
Three suggestions follow. This branch also inherits #10038's unresolved Should 1, so it can be approved only after #10038 is fixed and this branch merges #10038's new head. Critical (must fix)None. Should address1. The axiom line isn't valid, and no rulespec-us issue covers New Jersey's offset.
2. Three of the six offset categories have no test: with their mappings swapped, every test still passes.
Suggestions1. Update the body's cost line, and limit the method-independence wording to the grid.
2. Anchor the form references, and update two stale anchors in files this PR edits.
3. Say that a person's whole repayment takes one category.
Verified correct
Cross-cutting checks
Inherited from #10038#10038's posted findings are in this branch unchanged. Fix them in #10038, then merge its new head here.
Axiom line assessmentInvalid (Should 1).
CI statusAll 27 checks pass (
Branch status
Own findings: 0 critical, 2 should, 3 suggestions. Changes are requested for this PR's two should-fixes (the axiom line, and tests for the dividends, gambling winnings and alimony categories) and for the inherited #10038 Should 1. Approve once those are fixed, #10038 is fixed, and this branch merges #10038's new head. Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
Requesting changes; details in the full report above. This PR's own findings are 0 critical and 2 should. (1) The axiom line "not yet queued" is not an allowed form, and no rulespec-us issue or module covers the 54A:5-2 offset (#1635 proposes a module only for category (h)'s loss rule). Please file a dispatch-ready pe-parity issue. The TAM needs an ingest, and since rulespec-us re-pinned its corpus today, re-check #1635's blocker rather than restating it. (2) Dividends, gambling winnings and alimony have no tests: with DIVIDENDS and GAMBLING_WINNINGS swapped and ALIMONY mapped to wages, all 14 YAML cases and 4 property tests still pass. Please add three cases (4,500 of dividends repaid → 4,500; 4,500 of gambling winnings repaid → 4,000; 2,000 of alimony repaid against 1,500 → 1,500). This branch also carries #10038's unresolved Should 1 (California), so approve once these are fixed, #10038 is fixed, and this branch picks up #10038's new head. The New Jersey law checks out (TAM 2011-7, 54A:5-1 and 5-2, the 2025 NJ-1040 instructions), the offset stays within its category with a zero floor and no double count, and all 14 cases were hand-checked.
Summary
New Jersey has no section 1341 credit. A filer who repays income taxed in an earlier year instead offsets the repayment against income of the same category in the year of repayment. PolicyEngine had no such offset, so a repayment changed nothing in New Jersey. This PR adds it.
Stacked on #10038 (branch
federal-claim-of-right-1341), which models 26 U.S.C. 1341. Review the commits afterdc10cc58ceexcept the merges of #10038's heads2d36a76bca(its merge of main),32b0c13a6a(Montana's miscellaneous itemized list takes the claim of right deduction from 2024, so Montana's tax now changes under the federal deduction method; under the credit method that deduction is zero)6f34ccde23(its second merge of main),d1c695b2f7(itemizing branches inherit the claim of right method under core 3.33) and17cad4b53b(changelog and docstring), which bring in no change of this PR's. Head2e246c383c.nj_claim_of_right_repayment_category(person input, enum, defaultWAGES): the N.J.S.A. 54A:5-1 category of the repaid income: wages (a), interest (e), dividends (f), gambling winnings (g), pensions and annuities (j), alimony (n), another category the model does not offset (OTHER), or income New Jersey did not tax when received (NOT_TAXED).nj_claim_of_right_offset(person): the reduction in New Jersey gross income.nj_gross_incomesubtracts it.nj_claim_of_right_pension_offsetandnj_claim_of_right_wage_offsetare its pension and wage parts.nj_eligible_pension_income(the pension exclusion's base, NJ-1040 line 28a's "Line A. Amount from line 20a") nets out the pension part, and Worksheet D's $3,000 earnings test (line 4, "the amount from line 15") nets out the wage part.gov.states.nj.tax.income.gross_income.claim_of_right_category_sources.*: the income sources in each category, matching the lines ofnon_negative_sources.The law
N.J.S.A. 54A:5-2:
TAM 2011-7, Claim of Right Repayment Refunds (IRC 1341), issued January 13, 2011:
The TAM also says New Jersey does not let a filer amend the earlier year's return to recover the tax. The 2025 NJ-1040 instructions (PDF p. 9) state the same category rule ("You cannot apply a net loss in one category of income against income or gains in a different category") and do not mention repayments.
Design notes
min(the head's and spouse's repayments in the category, their income in it), and no one's income in a category goes below zero. Which spouse bears the offset matters for the pension exclusion, which counts only an eligible spouse's pension (2025 instructions, Line A, "Joint Filers: If only one spouse is 62 or older or disabled, enter only the pension income of that spouse"): a 70-year-old's pension exclusion is cut by their own pension repayment, and by a younger spouse's only by the part that exceeds the younger spouse's own pension income (if each has a $20,000 pension and the younger repays $30,000, the older spouse's pension bears $10,000). That attribution is this PR's reading; no source speaks to joint repayments.claim_of_right_category_exempt_sources). New Jersey also taxes interest on other states' municipal obligations (2025 instructions, PDF pp. 10-12), which the model's New Jersey income does not include, so a repayment cannot offset it here. Otherwise a repaid $8,000 of bank interest could offset $5,000 of exempt Treasury interest and, through the later subtraction, reduce wages.NOT_TAXED, and one of another categoryOTHER. No dataset setsclaim_of_right_repayment, so the default affects only households that enter a repayment.nj_agialready adds every tax unit member's total income, dependents included; that predates this PR.)Not modeled:
OTHER.claim_of_right_repaymentis defined as income included in federal AGI, so it cannot carry them.claim_of_right_repaymentalso excludes repayments deducted in arriving at AGI, such as repaid business income deducted on Schedule C.Household on
main, #10038 and this branch (2025, single, age 40)Script:
~/reviews/us-hub/claim-of-right-states/scripts/households.py; outputsevidence/households_*.json.main95eefa51e5; #10038dc10cc58ce; this branchff55ec8f42.mainTests
gov/states/nj/tax/income/adjusted_gross_income/nj_claim_of_right_offset.yaml, 14 cases, each computed by hand: a wage repayment like the TAM's ($8,000 off $50,000); a repayment above wages reporting wages as zero while interest stays; a repaid pension at age 70 offsetting pensions only, with the pension exclusion then zero and New Jersey AGI $10,000; repaid unemployment compensation (NOT_TAXED) and anOTHERcategory offsetting nothing; a joint return where the head's $6,000 wage repayment offsets the head's $2,000 of wages and then $4,000 of the spouse's; the federal credit method; another state; a 70-year-old repaying $8,000 of a $50,000 pension (line 20a $42,000, exclusion $42,000, New Jersey AGI $30,000); a 65-year-old whose wage repayment brings line 15 to $2,000, so Worksheet D's unused exclusion applies; a repayment of interest that finds only exempt Treasury interest; a couple of 70 and 40, each with a $20,000 pension, where an $8,000 pension repayment gives New Jersey AGI of $42,000 when the younger spouse repays and $50,000 when the older one does; and an $8,000 interest repayment against $10,000 of interest, $5,000 of it Treasury interest, which offsets the $5,000 New Jersey taxes (gross income $35,000, total income $30,000).tests/unit/test_nj_claim_of_right_properties.py(the Rest job'sremaininggroup). Why Python: its main check is a differential against a separate simulation, on a grid that crosses ages, pensions and filing status, which is how the two exclusion bugs in review r1 would have been caught.Invariants (stated and executed over a 576-return grid: category × repayment × head wages × head pension × head age 40 or 70 × single, joint with a same-age spouse with wages, or joint with an other-age spouse with a pension)
min(repayment, the filers' income in that category), taken from the repayer first and then the spouse. This reaches the pension exclusion, including for mixed-age couples, and Worksheet D. (Both simulations pin the medical expense deduction: lowering wages in the reference can qualify a couple over 65 for a Medicare Savings Program, which removes their Part B premiums, while the repayment does not.)non_negative_sourcesexcept line 26's other income, without overlap, and the pension category equals the pension exclusion's sources.Mutation check: reverting the pension exclusion fix, reverting the Worksheet D fix, dropping the category cap, and restoring proportional sharing between spouses each fail the property test; counting exempt interest fails YAML case 11; an interest category that offsets nothing fails case 14.
The cross-state test from #10038 now has an explicit, sourced map of the states whose own relief applies under the federal credit method; each listed state whose variable is in the model must lower the household's tax by more than $1, and every other state, North Carolina and Montana included, must be unchanged. #10195, #10196 and #10200 carry the identical commit.
Local runs at
ff55ec8f42(macOS, one file at a time): the new YAML file passes 14 cases; the existing New Jersey exclusion files (27 cases), the twonj_gross_income.yamlfiles andtax/income/integration.yaml(17 cases) pass; the property file passes 4 tests in 4.6 s at 1.42 GB peak (22.3 s wall with import); the cross-state per-state test passes in 8.7 s. Details:evidence/tests.md.Cost
The new property file adds about 4 s to the
remaininggroup, measured locally (not CI); its process peaks at 1.42 GB including the model import, which the group's process already holds. It builds four simulations of 576 returns and frees them at teardown. For scale, #10038 reports theremaininggroup onmainat 2,151 tests, 24:05 wall clock and 12.8 GB peak on the 16 GB runner (run 37926760594, as reported in #10028); this PR's CI run will give the Linux figures.Microsimulation
2025, default dataset (
populace_us_2024atpopulace-us-2024-spm-20260909), run 2026-10-13 under the shared heavy-run lock: #10038's headdc10cc58ceagainst this branch atff55ec8f42(later commits only merge #10038's later heads and change tests or documentation). Driver and outputs:~/reviews/us-hub/claim-of-right-states/impact/(multi.sh;compare.nj.2025.json).claim_of_right_repaymentis $0 on every record (weighted sum $0), sonj_claim_of_right_offsetare $0 everywhere.income_tax,state_income_tax,household_net_income,claim_of_right_credit_appliesornj_gross_income,nj_agi.The change takes effect only for households that enter a repayment; the dataset has none.
Axiom
axiom: N.J.S.A. 54A:5-2 as applied by TAM 2011-7 — not yet queued. The rulespec-us
pe-parityissue is drafted and held; filing waits for Max's go (decision d1459), or the US hub may file it under d1142.us-nj/statutes/54a/5-2module;us-nj/policies/income_tax/2026_resident_ordinary_core.yamlcites 54A:5-2 for the property-disposition (c) and rents (d) categories only.us-nj/statute/54a:5-2holds the statute; TAM 2011-7 has no corpus row, so it needs an ingest first.Review
Independent review r1 (Opus 5.5, as the GPT-6.1 Sol lanes were held;
~/reviews/us-hub/claim-of-right-states/reviews/out-10198.md, REQUEST CHANGES) and the response (reviews/response-10198.md): the pension exclusion's base and Worksheet D's earnings test now see the offset; anOTHERcategory exists; the property test is a differential across ages and filing status; the cross-state test uses an explicit map; the PR wording is corrected.Review r2 (
reviews/out-10198-r2.md, REQUEST CHANGES): the repayer's own income is now offset first (proportional sharing mis-stated a mixed-age couple's pension exclusion); exempt Treasury interest is left out of the interest cap; New Jersey-only taxable repayments are listed as not modeled; the source-list check is now a completeness check.Reviews r2 and r3 ran on GPT-6.1 Sol. Review r3 (
reviews/out-10198-r3.md, APPROVE) asked for a positive interest case (now case 14) and wording fixes, now made. A delta review of the changes since (r4, Opus 5.5,reviews/out-delta-r4.md) approves this head.Follow-ups
🤖 Generated with Claude Code