Skip to content

Fix ok_federal_ctc crash under fully-refundable CTC reforms - #9323

Open
DTrim99 wants to merge 1 commit into
PolicyEngine:mainfrom
DTrim99:fix/ok-federal-ctc-afa
Open

Fix ok_federal_ctc crash under fully-refundable CTC reforms#9323
DTrim99 wants to merge 1 commit into
PolicyEngine:mainfrom
DTrim99:fix/ok-federal-ctc-afa

Conversation

@DTrim99

@DTrim99 DTrim99 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes #9322.

The AFA contrib reform (gov.contrib.congress.afa) replaces gov.irs.credits.non_refundable with a list omitting non_refundable_ctc (fully-refundable restructure), and ok_federal_ctc unconditionally .index()ed that entry — so any Oklahoma simulation under the AFA raised ValueError("'non_refundable_ctc' is not in list"). Oklahoma is the only state that indexes the federal credit list this way, so the crash is OK-specific.

When the non-refundable CTC is absent there is no non-refundable portion to allocate against liability; the credit allowed for the Oklahoma Child Care/Child Tax Credit is the refundable CTC. Baseline behavior is unchanged (the guard only takes effect when a reform removes the credit from the list).

Test: exercises the exact production path (Reform.from_dict with the contrib flag) for an OK household and asserts ok_federal_ctc == refundable_ctc > 0.

🤖 Generated with Claude Code

The AFA contrib reform (gov.contrib.congress.afa) replaces the federal
non-refundable credit list without non_refundable_ctc (the credit becomes
fully refundable), and ok_federal_ctc unconditionally called
.index("non_refundable_ctc") on that list — so any Oklahoma simulation
under the AFA raised ValueError("'non_refundable_ctc' is not in list").

When the non-refundable CTC is absent from the list there is no
non-refundable portion to allocate against liability; the credit allowed
for the Oklahoma Child Care/Child Tax Credit is the refundable CTC.

Found running the AFA against every state's microdata (the crash is
Oklahoma-specific because only ok_federal_ctc indexes the credit list).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (57743a2) to head (69e4aa5).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #9323   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         1    -2     
  Lines           65        25   -40     
  Branches         0         1    +1     
=========================================
- Hits            65        25   -40     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DTrim99
DTrim99 requested a review from PavelMakarchuk August 21, 2026 15:54
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.

ok_federal_ctc crashes under fully-refundable CTC reforms (AFA): ValueError("'non_refundable_ctc' is not in list")

1 participant