Fix UT fully refundable EITC reform crash and zero-refund bug#8645
Open
PavelMakarchuk wants to merge 2 commits into
Open
Fix UT fully refundable EITC reform crash and zero-refund bug#8645PavelMakarchuk wants to merge 2 commits into
PavelMakarchuk wants to merge 2 commits into
Conversation
Mirrors the MO fix in #8642 for Utah's analogous bundled reform. - ut_refundable_credits: clear inherited adds/subtracts so the reform's formula doesn't trip the core engine's strict computation-mode check. - ut_non_refundable_credits: resolve the non_refundable parameter to a list of variable names before passing it to add() — the previous literal string was iterated character-by-character at calc time. - ut_fully_refundable_eitc: pay the uncapped potential credit (ut_eitc_potential) instead of the tax-liability-capped ut_eitc so the reform delivers a refund to zero-liability filers. Fixes #8644 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…erage - ut_non_refundable_credits: switch from `add() then subtract ut_eitc` to `ordered_capped_state_non_refundable_credits` with ut_eitc filtered out of the ordered list. The previous form overstated the non-refundable total whenever the bucket binds at liability — the ordered cap must walk the credit list to free each later credit's slot correctly. This matches the baseline ut_non_refundable_credits computation exactly, except EITC is removed because it is paid as refundable here. - Add three regression tests: W-2 wages cap (Utah Code § 59-10-1044) binding under the reform, a self-employment-only filer receiving no refundable credit (no W-2 wages → zero potential), and confirmation that the reformed credit is paid without double-counting at partial liability. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Fixes #8644
Problem
Triggering the bundled Utah fully-refundable-EITC contrib reform (
gov.contrib.states.ut.child_poverty_impact_dashboard.eitc.in_effect) crashed the simulation. After working around the crash, the reform also failed to actually pay the EITC as refundable for the low-liability filers refundability is meant to help — same dual-bug profile as the Missouri reform fixed in #8642.Three bugs fixed in
ut_fully_refundable_eitc_reform.py1.
add()received a parameter path string (crash).ut_non_refundable_credits.formulapassed the literal string"gov.states.ut.tax.income.credits.non_refundable"toadd(), which iterates it character by character —get_variable("g")returnsNone→AttributeError: 'NoneType' object has no attribute 'entity'. Now resolves the parameter to its list of variable names first.2. Mixed computation modes (crash on core ≥3.26.8).
ut_refundable_creditsredeclared aformulabut inheritedaddsfrom the baseline variable, tripping the engine's strict mode check (ValueError: ... mixes computation modes). Now setsadds = Noneandsubtracts = Noneexplicitly.3. Refundable credit capped at tax liability (silent zero-refund).
ut_fully_refundable_eitcreturnedut_eitc— the applied credit capped at UT tax liability — so a zero-liability filer received$0even though refundability should pay the full amount. Now usesut_eitc_potential(uncapped at liability; the W-2 wages cap mandated by Utah Code § 59-10-1044 still applies as designed). Same functional fix the MO PR applied viamo_wftc_potential.Verification
Reproduced the issue's exact script — runs without raising. Verified the reform's effect against baseline using the YAML regression test below: a Utah filer with
eitc = 5_000,employment_income = 30_000, andut_income_tax_before_non_refundable_credits = 0(i.e. zero state liability) now receives the fullut_eitc_potential = 1_000asut_refundable_credits, where the buggy reform returned$0.Tests
tests/policy/reform/ut_fully_refundable_eitc.yaml: verifies the full potential UT EITC is paid as refundable at zero liability, the nonrefundable portion is zeroed, and there's no double-counting when liability already absorbs the credit.tests/policy/contrib/states/ut/child_poverty_impact_dashboard/eitc/ut_fully_refundable_eitc.yamlupdated to drive from federaleitc(rather than injecting the cappedut_eitc), in line with the new uncapped behaviour.test_non_refundable_credit_downstream_consumers.pyinvariant still passes (the reform's reference tout_eitcinut_non_refundable_creditsis unchanged).🤖 Generated with Claude Code