Repository navigation
Description
Summary
ctc_limiting_tax_liability gives different values for itemizing tax units depending on which variables the simulation computed before it. It reads income_tax_before_credits from a no_salt branch. Simulation.get_branch clones the parent simulation, including values it has already computed, when the branch is first created, and reuses that branch afterwards. Two cases follow:
- Federal tax already computed in the parent: the branch appears to return the cached with-SALT
income_tax_before_credits. Settingsalt_deductionto 0 has no effect. - CTC-limiting liability requested first: the branch computes a fresh no-SALT liability, which is higher for itemizers.
The nonrefundable/refundable CTC split and income_tax follow whichever value was produced first. A baseline and a reform simulation can then disagree for reasons unrelated to the reform.
Code: ctc_limiting_tax_liability.py L14-L28 (the branch was added for #8059), and policyengine-core Simulation.get_branch, which clones the parent and caches the branch by name.
How it showed up
Run the Pennsylvania 50% CTC match contributed reform (gov.contrib.states.pa.ctc.ctc_match) on the Pennsylvania households of the Populace ACS local-area file (populace-us-2024-buildo-acs-local-767312d60-20260923T074941Z), for 2026, with policyengine-us 2.19.0, in two different calculation orders. The variable pa_ctc_match reads ctc_limiting_tax_liability, refundable_ctc, and non_refundable_ctc directly.
| Computed first in each simulation | Tax units whose federal income_tax changes |
Weighted federal change | Households losing net income |
|---|---|---|---|
pa_income_tax, then income_tax, then household_net_income |
146 | +$2.83M | 2,878 (76 records, average −$555) |
household_net_income |
0 | $0 | 0 |
In the first order, among the 146 tax units:
ctc_limiting_tax_liabilityrises by $3.96M in total, and $2.83M of refundable CTC becomes nonrefundable.income_tax_before_credits,salt_deduction, andtax_unit_itemizesdo not change.- Only 76 of the 146 receive a match at all.
Example tax unit: it itemizes and has no child under 6, so its match is $0.
| Baseline | Reform (first order) | |
|---|---|---|
income_tax_before_credits |
$1,645 | $1,645 |
ctc_limiting_tax_liability |
$1,645 | $2,145 |
| Refundable CTC | $4,406 | $3,906 |
Net income falls by $500.
A refundable state credit cannot lower net income, so the losers are an artifact of calculation order. In the reform simulation, pa_income_tax pulls ctc_limiting_tax_liability before the parent has computed federal tax, so the branch takes the fresh no-SALT path. The baseline simulation takes the cached path.
Impact
- Any formula that reads the federal CTC pieces before
income_taxis computed can trigger it. That includes state CTC matches and microsimulation scripts that compute state tax first. - We have not seen it in the app, which appears to compute household net income first. A dashboard pipeline hit it.
- Separate from the order problem, the two paths disagree on the rule. The docstring says SALT is excluded on purpose, as a known simplification to break the cycle. The cached path in practice uses the with-SALT liability, which is the statutory limit.
Suggested fix
- Make the value independent of calculation order. Either create the
no_saltbranch without the parent's computed values, or explicitly clear its cachedincome_tax_before_credits(and dependents) afterset_input. - Decide which liability is intended.
salt_deductionnow readsstate_withheld_income_taxrather than state liability, so check whether the no-SALT workaround is still needed to break refundable_ctc ↔ income_tax dependency cycle surfaces on itemizing branch #8059's cycle. - Add a regression test: an itemizing household with children, calculating
ctc_limiting_tax_liabilityfirst versusincome_taxfirst, asserting equal results.
Found while building the Pennsylvania child tax credit options dashboard; the dashboard pipeline now computes household net income first as a workaround.
🤖 Generated with Claude Code
Activity
DTrim99 commentedon Nov 20, 2026
#9741 fixed this (merged 2026-10-06, first released in 2.29.9).
ctc_limiting_tax_liabilityno longer uses ano_saltbranch: it limits the credit by the actual liability, SALT included, and comparison branches now go throughget_override_branch.Checked on main at 390a43b against 1.715.2. The test covers 99 married itemizers with 2-4 children in MT, CA and NY, with $40,000-$90,000 wages, $30,000 mortgage interest and $9,000 property tax, for 2026. It computes the CTC split in four orders:
income_tax,household_net_income,ctc_limiting_tax_liabilityornon_refundable_ctcfirst.ctc_limiting_tax_liability,non_refundable_ctc,refundable_ctcorincome_taxdepends on the orderScript
Closing as fixed by #9741.