Fix tax_unit_itemizes tied-federal-tax fallback (#8210)#8213
Draft
PavelMakarchuk wants to merge 1 commit intomainfrom
Draft
Fix tax_unit_itemizes tied-federal-tax fallback (#8210)#8213PavelMakarchuk wants to merge 1 commit intomainfrom
PavelMakarchuk wants to merge 1 commit intomainfrom
Conversation
Closes #8210. Supersedes #8209. When tax_liability_if_itemizing == tax_liability_if_not_itemizing — common at low/moderate incomes where refundable EITC + ACTC absorb any federal-tax difference between the two branches — tax_unit_itemizes was falling back to: state_standard_deduction < state_itemized_deductions This used two helpers with asymmetric coverage: - state_standard_deduction lists 8 states (incl. CO, ID, MO, NM) that adopt the federal standard deduction - state_itemized_deductions only lists 5 states (CT, GA, ND, SC, UT) that adopt federal itemized deductions; for CO/ID/MO/NM/VT/LA/etc. it sums state-specific itemized line items, which for many states is $0 For a CO joint filer with $50k of itemizable expenses and tied federal tax, the fallback compared $31,500 < $0 → False → don't itemize. TaxAct/TAXSIM itemize. Same mechanism caused VT/LA TAXSIM diffs via dependent CDCC. Fix: when federal tax is tied, fall back to the federal-level deduction comparison (standard_deduction vs itemized_taxable_income_deductions), matching the non-branching path and the IRS / TaxAct / TAXSIM-comparison default. Note: state_standard_deduction and state_itemized_deductions remain in the codebase — they map to TAXSIM v34/v35 outputs in policyengine-taxsim's variable_mappings.yaml. tax_unit_itemizes simply no longer reads them internally. Tests: - 7 unit tests in tax_unit_itemizes.yaml — updated tied-tax cases to use federal-level inputs - ME me_deductions.yaml — updated tied-tax case (same input pattern) - CO integration: new 2025 joint filer with property tax + mortgage, itemizes (TAXSIM #870) - VT integration: new 2025 joint filer scenario, itemizes (TAXSIM #869) - All 13,825 state-level tests pass; 817 federal IRS tests pass. Residual numeric gaps to TaxAct/TAXSIM (CO ~$65 on income tax, VT ~$1) are pre-existing state-model issues outside this PR's scope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8213 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 1 -1
Lines 35 18 -17
Branches 0 1 +1
=========================================
- Hits 35 18 -17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8210. Supersedes #8209.
Bug
When
tax_liability_if_itemizing == tax_liability_if_not_itemizing(common at low/moderate incomes where refundable EITC + ACTC absorb any federal-tax difference between the two branches),tax_unit_itemizesfalls back to:These helpers have asymmetric state coverage:
state_standard_deduction.pylists 8 states (CT, ID, MO, ND, NM, SC, UT, CO) that adopt the federal standard deduction.state_itemized_deductions.pylists only 5 states (CT, GA, ND, SC, UT) for federal itemized. For CO/ID/MO/NM/VT/LA/etc., it sums state-specific line items, which for many states is$0.For a CO joint filer with $50k of itemizable expenses and tied federal tax:
state_standard_deduction = $31,500,state_itemized_deductions = $0, fallback returnsFalse→ don't itemize. TaxAct/TAXSIM both itemize.Downstream effects
vt_cdcc = 0.72 × capped_cdcc; capped_cdcc depends on federal tax → cascadescapped_cdccFix
When federal tax is tied, fall back to the federal-level deduction comparison (
standard_deductionvsitemized_taxable_income_deductions). This matches:Daniel Feenberg confirmed in the issue that TAXSIM's PE-comparison mode uses this naive rule.
Note on the helper variables
state_standard_deductionandstate_itemized_deductionsremain in the codebase. They map to TAXSIM v34 ("Standard Deduction") and v35 ("Itemized Deductions") outputs inpolicyengine-taxsim'svariable_mappings.yaml.tax_unit_itemizessimply no longer reads them internally.Tests
tax_unit_itemizes.yaml— tied-tax cases retargeted to federal-level inputs.me_deductions.yaml— tied-tax case retargeted (same input pattern).tax_unit_itemizes: true. Locks in TAXSIM MA income tax docs are broken #870 fix.tax_unit_itemizes: trueandvt_cdcc: 0. Locks in TAXSIM Create issues for eachprogram x statecombination with the GitHub API #869 fix.Residual gaps to TaxAct (out of scope)
Both are pre-existing state-model issues — the fix gets us from "very wrong" to "within rounding/state-add-back precision."
Test plan
🤖 Generated with Claude Code