Repository navigation
Conversation
wa_pte_income_eligible and wa_pte_tier index the Washington county-keyed income thresholds with every household's county_str. defined_for masks the output but policyengine-core still runs the formula over the whole population, so any simulation with a household outside Washington (or a Washington household with an UNKNOWN county) raised ParameterNotFoundError in every year. Full-population microsimulations crashed on wa_senior_disabled_property_tax_exemption. Look those households up under Adams County, the county the model assigns a Washington household that gives none, as the MD and IN county-tax formulas already do. Adds vectorized YAML cases that put a Washington household and a South Dakota household in one simulation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as ready for review
October 11, 2026 19:13
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10113 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 2 -2
Lines 76 30 -46
Branches 2 0 -2
=========================================
- Hits 76 30 -46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Status. The code and tests are final. Still pending: the independent review, and the full-population microsim for 2026 and 2027, which is queued behind the shared heavy lock. The runner checks every record: non-WA results are zero, tier is 0–3, and the exemption is between 0 and the property tax. Results will go in a comment.
Problem
A full-population
Microsimulationon the default dataset (populace_us_2024) crashes when it computeswa_senior_disabled_property_tax_exemption:The crash turned up while running the #10103 microsim on 2026-10-11. The tree it ran on was the #10085 head, close to main.
wa_pte_income_eligibleandwa_pte_tierindex the county-keyed WA income thresholds with every household'scounty_str.defined_for = StateCode.WAdoes not stop the formula from running on other households. In policyengine-core 3.32.15,Simulation._calculateruns the formula over the whole population and only applies thedefined_formask afterwards. It skips the formula only when no household passes the mask. So any simulation with at least one WA household and one household elsewhere raised the error. A WA household whose county isUNKNOWNraised it too.This is not specific to 2027. A 51-household simulation, one household per state plus DC, raised the same error for 2024, 2026 and 2027 on
upstream/main(ae3782f). Full runs have not hit it because nothing outside theproperty_tax_exemptionfolder uses these variables. The exemption does not feedhousehold_net_income.Fix
Mask the county before the lookup, the same way
md_flat_rate_county_tax,md_applicable_local_tax_rateandin_county_taxdo:defined_formask then sets their result to zero, as before.UNKNOWNcounty get Adams County thresholds instead of a crash. Adams County is what the model'scountyformula (viafirst_county_in_state) assigns a WA household that gives no county. This matches the MD precedent (issue md_withheld_income_tax: ParameterNotFoundError for MD household with county=UNKNOWN (no UNKNOWN guard) #8975, Allegany County).Tests
The new vectorized YAML cases put WA and non-WA households in one simulation. A single out-of-state household would not test the guard, because an all-false
defined_formask skips the formula entirely.wa_pte_income_eligibleCase 12 (2024): King County, South Dakota, and twoUNKNOWN-county households at and $1 over the Adams County Tier 3 threshold. Expected[true, false, true, false].wa_pte_tierCase 15 (2027): King County at the 2027 Tier 1 threshold after the $7,500 standard deduction, South Dakota, andUNKNOWNfalling to Adams County Tier 2. Expected[1, 0, 2].wa_senior_disabled_property_tax_exemptionCases 19 and 20: the 2026 and 2027 King County households from Cases 16 and 17, each beside a Marshall County, SD household. Expected[4_320, 0]and[5_340, 0].All four cases fail on
upstream/mainwith theParameterNotFoundErrorabove and pass with the fix. All WA YAML tests pass locally (824).Invariants
county_key == county_strwheneverstate_code_str == "WA"and the county isn'tUNKNOWN. Every WA county in theCountyenum (39) is a key oftier_1,tier_2andtier_3.wa_pte_tier == 0,wa_pte_income_eligible == falseand the exemption is zero for non-WA households (thedefined_formask, unchanged).UNKNOWN. In that case every key passed to the threshold lookup is a WA county key, soParameterNotFoundErrorcan't be raised for any household mix. In the default dataset every household's county FIPS matches its state. A household whose county is in a different state from itsstate_code(say WA with an Oregon county) still raises, as it does in the MD and IN formulas.Other county-keyed lookups (checked, not changed here)
I probed the other formulas that index a county-keyed parameter, with one household per state and DC in one 2026 simulation, then again with
UNKNOWN-county households added:vt_renter_credithas the same out-of-state crash. It indexes VT county tables with thecountyenum and has no guard. Onlytaxsim_state_property_tax_credituses it, so full runs don't compute it. It also crashes for tax units larger than 8, which needs a policy decision.UNKNOWN. They mask other states' counties but notUNKNOWN. In the default dataset every household has a valid county FIPS that matches its state, so only household input withcounty: UNKNOWNreaches this.I'm proposing these as a separate follow-up.
axiom: n/a: microsim crash guard, no change to any WA rule; real-county WA results are unchanged
🤖 Generated with Claude Code