Fix MO refundable EITC reform crash and zero-refund bug#8642
Conversation
The bundled Missouri refundable-EITC contrib reform crashed at calculation time and, once running, paid no refundable credit to zero-liability filers. Three issues fixed in mo_refundable_eitc_reform.py: 1. mo_refundable_credits passed a parameter path string to add(), which iterates it character by character and raises AttributeError. Resolve the parameter to its list of variable names first. 2. mo_refundable_credits redeclared a formula but inherited adds from the baseline, tripping the core engine's mixed computation-mode check. Set adds = None and subtracts = None explicitly. 3. mo_refundable_wftc returned mo_wftc, the credit capped at tax liability, so the reform paid $0 refundable for low-liability filers. Use mo_wftc_potential so the full credit is refundable. Fixes #8640 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Case 1 now asserts mo_wftc: 0 (capped) alongside mo_refundable_wftc: 1000 (uncapped), so the capped-vs-uncapped contrast that is the actual fix is guarded; reverting the fix would now fail the test. - Case 2 now asserts mo_income_tax: 0 and mo_income_tax_before_refundable_ credits: 1000, genuinely verifying the credit offsets liability exactly once (no double counting) rather than re-asserting case 1's outputs. - Fix grammar in the mo_refundable_wftc comment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The refundability fix (mo_refundable_wftc now reads mo_wftc_potential) broke two pre-existing tests that encoded the old capped behavior: - The contrib reform test injected mo_wftc directly and asserted the refundable amount equaled it. Rewrite it to drive the credit from the federal EITC and assert the full uncapped potential is paid (with mo_wftc capped to 0 at zero liability), which is what the fix corrects. - The applied-credit downstream-consumer guard listed the reform as a consumer of the applied mo_wftc. The reform now consumes mo_wftc_potential instead - exactly the pattern the guard recommends - so drop the stale entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Review — #8642: Fix MO refundable EITC reform crash and zero-refund bugA focused bug fix to the Missouri refundable-EITC contrib reform ( 🔴 Critical (Must Fix)None. The fixes are correct and the PR is merge-ready on the code. (The one failing CI job is unrelated infrastructure flakiness — see below — not a PR defect.) 🟡 Should Address
🟢 Suggestions
Findings detail
Validation Summary
Review Severity: COMMENTNo blocking issues — the fixes are verified correct. Recommendations are test-coverage enhancements and one pre-existing forward-compat note. Next Steps
|
…note DTrim99 review on #8642: - Add a multi-refundable-credit regression test (mo_property_tax_credit pinned to a positive value) that proves the reform's mo_refundable_credits formula sums all entries in `gov.states.mo.tax.income.credits.refundable` alongside mo_refundable_wftc rather than replacing them. Closes the silent-regression gap the original tests didn't cover. - Add zero-EITC boundary case (potential WFTC = 0) and partial-liability case (liability=400, potential=1,000) to pin down the capped-vs-uncapped refund boundary; the partial case asserts mo_income_tax=-600 (the refund flowing through), guarding against a future double-count regression that would land at -1,000. - Add `absolute_error_margin: 0.01` to every currency assertion in the new reform-test yaml, matching project convention. - Add forward-compat comment on the reform's mo_non_refundable_credits formula: today the bucket is just `[mo_wftc]` so the simplified formula is equivalent to the baseline, but if MO adds a second nonrefundable credit later this would silently drop it — at that point switch to the UT/OH pattern (ordered-cap walk with mo_wftc filtered out). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…into fix-mo-refundable-eitc-reform-crash
PR Review — #8642: Fix MO refundable EITC reform crash and zero-refund bugThe Missouri member of a three-PR family of state refundable-EITC reform fixes (alongside #8645 UT and #8657 OH). Reviewed read-only for correctness, code patterns, and test coverage. All three claimed fixes verified correct; CI fully green (26/26 checks). 🔴 Critical (Must Fix)None. The fixes are correct and merge-ready. 🟡 Should Address
🟢 Suggestions
Findings detailAll three fixes verified against source:
Validation Summary
Review Severity: APPROVEThe three fixes are correct and well-tested with strong boundary coverage. The only items are a one-cent margin on the contrib YAML and a pre-existing forward-compat note. Sibling fixes for OH/UT are already in flight (#8657 / #8645). |
Fixes #8640
Problem
Triggering the bundled Missouri refundable-EITC contrib reform (
gov.contrib.states.mo.child_poverty_impact_dashboard.eitc.in_effect) crashed the simulation. After working around the crash, the reform also failed to actually make the WFTC refundable for the low-liability filers refundability is meant to help.Three bugs fixed in
mo_refundable_eitc_reform.py1.
add()received a parameter path string (crash).mo_refundable_credits.formulapassed the literal string"gov.states.mo.tax.income.credits.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).
mo_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).
mo_refundable_wftcreturnedmo_wftc— the applied credit capped at MO tax liability — so a zero-liability filer received$0even though refundability should pay the full amount. Now usesmo_wftc_potential(the uncapped credit). This is the functional fix that makes the reform do what it claims.Verification
Reproduced the issue's exact script — runs without raising. Verified the reform's effect against baseline for a Missouri single parent, 2 kids, $20k earnings, 2026 (federal EITC $7,316 → potential WFTC $1,463):
mo_refundable_creditsmo_income_taxhousehold_net_incomeAlso confirmed no double-counting at positive liability: a moderate-income case yields a delta exactly equal to the previously-lost (nonrefundable-capped) portion of the credit.
Tests
tests/policy/reform/mo_refundable_eitc.yaml: verifies the full potential WFTC is paid as refundable at zero liability, the nonrefundable portion is zeroed, and there's no double-counting when liability already absorbs the credit.🤖 Generated with Claude Code