Skip to content

Fix UT fully refundable EITC reform crash and zero-refund bug#8645

Open
PavelMakarchuk wants to merge 2 commits into
mainfrom
fix-ut-fully-refundable-eitc-reform-crash
Open

Fix UT fully refundable EITC reform crash and zero-refund bug#8645
PavelMakarchuk wants to merge 2 commits into
mainfrom
fix-ut-fully-refundable-eitc-reform-crash

Conversation

@PavelMakarchuk

Copy link
Copy Markdown
Collaborator

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.py

1. add() received a parameter path string (crash). ut_non_refundable_credits.formula passed the literal string "gov.states.ut.tax.income.credits.non_refundable" to add(), which iterates it character by character — get_variable("g") returns NoneAttributeError: '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_credits redeclared a formula but inherited adds from the baseline variable, tripping the engine's strict mode check (ValueError: ... mixes computation modes). Now sets adds = None and subtracts = None explicitly.

3. Refundable credit capped at tax liability (silent zero-refund). ut_fully_refundable_eitc returned ut_eitc — the applied credit capped at UT tax liability — so a zero-liability filer received $0 even though refundability should pay the full amount. Now uses ut_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 via mo_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, and ut_income_tax_before_non_refundable_credits = 0 (i.e. zero state liability) now receives the full ut_eitc_potential = 1_000 as ut_refundable_credits, where the buggy reform returned $0.

Tests

  • New 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.
  • Existing contrib tests at tests/policy/contrib/states/ut/child_poverty_impact_dashboard/eitc/ut_fully_refundable_eitc.yaml updated to drive from federal eitc (rather than injecting the capped ut_eitc), in line with the new uncapped behaviour.
  • All 180 Utah baseline tests still pass.
  • The test_non_refundable_credit_downstream_consumers.py invariant still passes (the reform's reference to ut_eitc in ut_non_refundable_credits is unchanged).

🤖 Generated with Claude Code

PavelMakarchuk and others added 2 commits June 15, 2026 22:07
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>
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.

UT fully refundable EITC reform (create_ut_fully_refundable_eitc) crashes when triggered

1 participant