Repository navigation
Conversation
Use each return's reported tax election, retain elected sales tax in Utah and Vermont, and correct Virginia medical and worksheet calculations. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the input interception in Core's setter with a plain election input that defaults to not reported. The federal line 5a amount, Virginia, Utah and Vermont read it directly, so deleting, restoring and branching inputs work as they do for any other variable. Vermont adds back only the income tax on line 5a after an income-tax election. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An election covers one tax year. Virginia compares nearly equal taxes exactly, and Vermont floors a reported negative income tax at zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A supplied amount a dollar from both taxes counted as sales tax. Amounts now match to the cent, or to the stored precision where that is coarser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use conformity AGI for Virginia's medical and Pease limitations. Remove rounding-only deductions and honor reported sales-tax elections in state income tax addbacks. Floor negative elected payments before deducting them. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DTrim99
left a comment
There was a problem hiding this comment.
Program review
Base repository: PolicyEngine/policyengine-us
PR number: 11146
Reviewed head SHA: 48b40f7
Merge base SHA: 094934a
Mode: full
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-11146-review-sources.json
Review status: COMPLETE
Source Documents
- va-code-58.1-322.03.html — cached original.
- va-schedule-2024.pdf — cached original.
- va-schedule-2025.pdf — cached original.
- va-2024-sch-a-instr.pdf — cached original.
- va-2025-sch-a-instr.pdf — cached original.
- va-2026-draft-sch-a-instr.pdf — cached original.
- va-schedule-adj-2025.pdf — cached original.
- irs-i1040sca-2024.pdf — cached original.
- co-dr104-book-2022.pdf — cached original.
- ia-104-2018.pdf — cached original.
- mt-form2-instr-2024.pdf — cached original.
- ut-tc40inst-2025.pdf — cached original.
- vt-in155-2017.pdf — cached original.
Critical
None.
Should Address
A1 — Colorado still adds back income tax when an unreported line 5a holds the larger sales tax (OPEN)
- Severity: This is pre-existing output that the PR leaves unchanged, but the PR rewrote this line and chose the contrary fallback.
- Location:
policyengine_us/variables/gov/states/co/tax/income/additions/co_state_addback.py:33-34,sales_tax_elected(tax_unit, period, False). - Trigger: a CO itemizer in 2024 with no election reported, $4,000 state income tax, $5,000 state sales tax, $90,000 wages and $20,000 charitable gifts.
- Expected vs observed: federal line 5a is $5,000 of sales tax (
state_and_local_sales_or_income_tax= 5,000;salt_deduction= 5,000), so no state income tax was deducted. Under the CO book,co_state_addbackshould be 0. The model returns 4,000. Withstate_and_local_tax_election: SALES_TAX, the same federal return gives 0. The PR's own rule for unreported elections ("the federal calculation uses the larger tax") and its IA, MT, VA and VT fallbacks (~(income >= sales)or equivalent) would also give 0. - Impact: CO taxable income is overstated by up to the state income tax for itemizers whose sales tax exceeds their income tax. That is about $170 at CO's 2024 rate in this case. Microsimulation never supplies the election, so all such filers take this path.
- Source and reproduction: DR 0104 Book 2022 p.5 (manifest entry
co-dr104-book-2022.pdf). Script: /tmp/policyengine-command-runs/ea33c0bb2b64/pr-11146-policy-diag/co_fallback.py; log: /tmp/policyengine-command-runs/ea33c0bb2b64/pr-11146-policy-diag/co_fallback.log (exit 0, 12 s, imports resolved to the snapshot). - Remedy direction: use the same larger-tax fallback as IA and MT,
~(income_taxes >= sales_taxes), and add an unreported sales-larger case.
Coordinator assessment: Main does the same, so this isn't a regression, and I've kept it should-address. But the PR rewrites this line and its own stated rule is to fall back to the larger tax, which Iowa, Montana, Vermont and Virginia now do. Microsimulation never supplies an election, so every Colorado itemizer whose sales tax exceeds their income tax takes this path. In the run, a 2024 household with $4,000 of income tax and $5,000 of sales tax has $4,000 added back, against $0 with an explicit sales-tax election.
A2 — Montana subtracts a negative income tax after an explicit income-tax election (OPEN)
- Location: policyengine_us/variables/gov/states/mt/tax/income/deductions/mt_state_income_tax_itemized_add_back.py:39-41.
- Trigger: 2025, MT, itemizer,
state_and_local_tax_election: INCOME_TAX,state_withheld_income_tax: -100,state_sales_tax: 1000, charitable 25,000. - Observed: federal line 5a = 0, but
mt_state_income_tax_itemized_add_back= -100. The addback is negative, so it acts as a subtraction. With NOT_REPORTED the same household gets 0. - Expected: 0. Nothing was deducted on the income-tax line, and this follows the PR's own rule that explicitly elected payments floor at zero, which it applies in the federal formula, UT and VT. The fix is
max_(0, min_(state_income_tax, ...)), or using the floored line 5a, plus a test. - Why this PR: the explicit-election path is new. Before this PR the case was unreachable, because
income >= saleswas false. - Impact: only a negative supplied income tax triggers it. Calculated
state_withheld_income_taxis tax before refundable credits and is normally non-negative. That limits the impact, but the result does not match the PR's stated design. - Evidence: /tmp/policyengine-command-runs/ea33c0bb2b64/pr-11146-code-diag/diag.py and diag.log.
A3 — Oregon ignores an explicit sales-tax election when income and sales taxes tie (OPEN)
- Location: policyengine_us/variables/gov/states/or/tax/income/deductions/or_itemized_deductions.py:27-33. The formula is unchanged, but it consumes line 5a.
- Trigger: 2025, OR,
state_and_local_tax_election: SALES_TAX, state income tax 3,000 + local income tax 1,000 = sales tax 4,000, real estate tax 5,000, charitable 20,000. - Observed:
or_itemized_deductions= 26,000. Oregon's exact-match inference treats the tie as income tax and keeps the 1,000 local income tax. With sales tax 4,000.50 the result is 25,000. - Expected: 25,000. An explicit federal sales-tax election means Schedule OR-A line 5 omits local income tax, as the formula's own comment says.
- Why this PR: the PR adds the explicit election and fixes exactly this tie for Utah ("Utah preserves an explicit sales election when tax amounts tie"). Oregon was not updated. Using
sales_tax_elected(tax_unit, period, <existing inference>)would match the UT pattern. - Impact: an exact tie plus the new optional input. No current dataset sets the election. For an affected household, the overstatement equals the local income tax.
- Evidence: /tmp/policyengine-command-runs/ea33c0bb2b64/pr-11146-code-diag/diag.log.
A4 — Two Virginia conformity aggregation changes have no failing-without test (OPEN)
- Location: policyengine_us/variables/gov/states/va/tax/income/additions/va_additions.py:16 adds
va_conformity_addition. policyengine_us/variables/gov/states/va/tax/income/va_subtractions_person.py:38-43 proratesva_conformity_subtractionacross spouses. - Gap: no test asserts
va_additions,va_agiorva_agi_personwhen a conformity addition is supplied. The only conformity-addition case checksva_conformity_agi, medical and itemized deductions. No test covers person-level proration of the conformity subtraction.va_subtractionsis covered:va_agi: 350,000in "Virginia uses conformity subtractions…" fails without the change. - Behavior: a code trace finds it correct. These are pure sums, and the person-level additions are prorated in va_agi_person.py. Missing coverage is not proof of a defect.
- Fix: add one tax-unit
va_agicase withva_conformity_addition, and one jointva_subtractions_personcase withva_conformity_subtraction.
A5 — References were removed or are missing for the changed Virginia and Vermont logic (OPEN)
- Severity: SHOULD ADDRESS (reference standard).
- Location and observed:
vt_2017_itemized_deduction_addback.py:20-25: the PR deletes the 2017 IN-155 and the Department's 2017 IN-155 worksheet references. The formula still cites "IN-155 line 1" (line 31) and "the Department's worksheet" (line 50). IN-155 line 4 ("state and local income taxes from ... Schedule A, Line 5a") is the source for the election logic this PR changes. The remaining statute pages do not show the worksheet's line structure.va_capped_state_and_local_sales_or_income_tax.py: the class has noreference, though the newformula_2024implements the separate line 5a cap (2024 instructions p.1-2; 2025 instructions p.1-2).va_itemized_deductions.py:11andva_reduced_itemized_deductions.py:11still cite only the 2021 schedule. They now implement the 2024+ worksheet: line 5a, line 11 rounding, line 18 and the zero entry. The comment atva_reduced_itemized_deductions.py:113attributes the zero rule to "Form 760", but the rule is in the Schedule A instructions (2024 p.2; 2025 p.1).worksheet_allows_sales_tax.yaml:10-13: the titles cite "lines 5a and 18" with#page=1, but the line 18 sales-tax rule is on page 2 of both instructions. Per the reference convention, the title should end#page 1-2.
- Expected: keep the IN-155 and worksheet references for VT. Add 2024 and 2025 Schedule A instruction and worksheet references (with physical pages) to the three VA variables. Fix the page range.
- Impact: none on outputs; auditability of the changed rules.
A6 — The new Virginia parameters start in 2024 although the cited instructions date the rules from 2019 (OPEN)
- Severity: SHOULD ADDRESS (parameter-date standard). Model outputs before 2024 are unchanged and the PR body defers them to #11157.
- Location:
medical_expense_floor.yaml:3(2024-01-01: 0.10);worksheet_allows_sales_tax.yaml:3-4(2013-01-01: false,2024-01-01: true). - Expected vs observed: both cited instructions (2024 p.1; 2025 p.1) say "For taxable years beginning on or after January 1, 2019, Virginia deconforms from the increase in the medical expense deduction". Va. Code § 58.1-322.03(1)(a) reduces federal itemized deductions only by income taxes, so elected sales tax was kept before 2024 too. The 2024 date is a model-implementation boundary, not an effective date. The
falsevalue records that Virginia did not keep elected sales tax before 2024, which the sources do not support.medical_expense_flooralso uses0.10, where the repository style is0.1. - Impact: the legal history in the parameter tree is misleading for reforms and readers. The model's pre-2024 results stay on the old path, which still uses the federal 7.5% medical floor and removes sales tax for those years. That behavior predates this PR.
A7 — axiom: needed is reserved for external contributors; the author is a repository admin (OPEN)
- Severity: SHOULD ADDRESS, consistent with the earlier PRs in this run.
- Location: PR body, line
axiom: needed. - Trigger: snapshot
CLAUDE.md:151-155("Axiom Parity"). It requiresaxiom: <legal id> encoded-correct | <rulespec PR> encoded | <rulespec issue> queued | n/a: <reason>. It allowsaxiom: neededonly "If you are an external contributor". The author is MaxGhenis, andgh api repos/PolicyEngine/policyengine-us/collaborators/MaxGhenis/permissionreturnsadmin. - Expected vs observed: the PR changes enacted-law provisions: Va. Code § 58.1-322.03(1)(a) and the Schedule A worksheet, the IRC 164(b)(5) election, and the CO, IA, MT, UT and VT addbacks. So
n/adoes not apply. A maintainer should give anencoded-correct,encodedor dispatch-readyqueuedline (CONTRIBUTING.md "Axiom parity"). - Impact: repository completion requirement not met; no model output effect.
Suggestions
None.
Evidence Gaps
No material gaps reported.
Notes
- The Virginia rules and the federal election match the sources: the 10% medical floor, the line 5a cap, line 11 rounding to three decimals, the zero entry when income tax is the only itemized deduction, and the 2024–2026 thresholds. Every Virginia test value recomputed by hand matches. IRC 164(b)(5) supports the federal election, and the state addbacks' form instructions support using the elected tax when an election is reported.
- Federal results don't change for households that supply neither the election nor line 5a, because the default is still the larger tax. HI, ID, NM and SC use line 5a whichever tax it holds, so they now get the elected amount, which is intended. There are no circularity, entity, period or vectorization problems in the Virginia changes.
Validation Summary
Local tests at the reviewed head (review venv, policyengine-core 3.37.2; imports resolved to the snapshot): 945 YAML cases and 105 Python tests passed, 0 failed. They cover the VA income tax folder, the federal SALT tests, the changed CO, IA, MT, UT and VT files, and the HI, ID, NM, OR, SC, ME and MS files that read line 5a. Diagnostic runs reproduced the Colorado, Montana and Oregon cases. Sources: 13, all valid in the manifest check. CI: 35/35 checks pass at 48b40f7.
Timing
setup seconds: 5.00s; scope seconds: 60.00s; parallel review seconds: 475.70s; policy role seconds: 475.70s; code role seconds: 420.10s; adjudication seconds: 120.00s; consolidation cleanup seconds: 37.00s; elapsed seconds: 573.00s
Review Severity
COMMENT. Open findings: 0 critical, 7 should address, 0 suggestions.
Agent-written for Max, by a Codex cloud task and Claude Code for Max Ghenis; no person has reviewed it yet.
Change
Apply Virginia’s Schedule A worksheet from 2024. Use Schedule ADJ conformity additions and subtractions to calculate the Virginia 10% medical floor and Pease limitation. Reconstruct gross medical expenses from a positive federal deduction using the federal floor when reported expenses are unavailable. Apply the separate line 5a cap and three-decimal line 11 rounding, and enter zero when income tax is the only itemized deduction.
Report each tax year’s federal income-tax or sales-tax choice through
state_and_local_tax_election. If the election and line 5a are both absent, the federal calculation uses the larger tax. Explicitly elected calculated payments floor at zero. A supplied line 5a takes precedence. Virginia’s unreported-election fallback treats it as sales tax when the stored amounts are within half a cent and it is closer to sales tax than income tax. Ties and unmatched amounts get income-tax treatment. Colorado, Iowa, and Montana honor explicit federal elections in their income-tax adjustments. Utah also floors the income tax it subtracts at zero, including a negative supplied line 5a. Vermont’s 2017 calculation keeps its elected-income-tax treatment. On the 2017 federal form, line 5a was line 5.The worksheet path in this PR starts in 2024. The official 2023 Schedule A also shows the 10% medical floor, the sales-tax election, and three-decimal worksheet precision; returns before 2024 keep the existing calculation here, and #11157 applies the worksheet from 2019. This path uses the existing Virginia filing-status thresholds and modeled income and deduction inputs. The modeled return assumes full-year residence and matching filing status. Separate inputs for personal-property taxes, foreign income taxes claimed as itemized deductions, and Virginia charitable mileage are outside this change.
Core treats a supplied line 5a (
state_and_local_sales_or_income_tax) as an array input. If only one tax unit supplies it, other tax units receive $0. Reporting the election and component taxes lets each tax unit calculate its own line 5a. Core stores dollar inputs in 32 bits, which can move an exact line 11 half-thousandth across the Virginia rounding boundary. After setting or deleting an election on a root simulation with cached results, calldrop_computed_arrays()before recalculating. Setting an input on a branch refreshes dependent results.Verification
axiom: needed
🤖 Generated with Claude Code