Skip to content

Guard Washington property tax exemption county lookups - #10113

Merged
MaxGhenis merged 3 commits into
mainfrom
fix-wa-pte-county-lookup
Dec 1, 2026
Merged

MaxGhenis merged 3 commits into
mainfrom
fix-wa-pte-county-lookup

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Status. The full-population runs for 2026 and 2027 are pending. They check that results outside Washington are zero, that the tier is 0 to 3, and that the exemption is between zero and the property tax.

Problem

A full-population Microsimulation on the default dataset (populace_us_2024) crashes when it computes wa_senior_disabled_property_tax_exemption:

File ".../senior_disabled/income/wa_pte_income_eligible.py", line 24, in formula
    return income <= p.tier_3[county]
ParameterNotFoundError: The parameter 'gov.states.wa.dor.property_tax_exemption.senior_disabled.income.thresholds.tier_3.MARSHALL_COUNTY_SD' was not found in the 2027-01-01 tax and benefit system.

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_eligible and wa_pte_tier index the county-keyed WA income thresholds with every household's county_str. defined_for = StateCode.WA does not stop the formula from running on other households. In policyengine-core 3.32.15, Simulation._calculate runs the formula over the whole population and only applies the defined_for mask 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 is UNKNOWN raised 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 the property_tax_exemption folder uses these variables. The exemption does not feed household_net_income.

Fix

Before indexing the Washington thresholds, keep the household’s county when its state is Washington and the county appears in the required threshold tables. Use ADAMS_COUNTY_WA otherwise. Income eligibility reads Tier 3, and the tier formula reads all three tables.

  • Households outside WA get Adams County thresholds, and the defined_for mask then sets their result to zero, as before.
  • Washington households with an UNKNOWN or out-of-state county get Adams County thresholds. Adams is also the county the model supplies when a Washington household gives neither county nor FIPS.
  • WA households with a real county are unchanged: all 39 WA counties are keys in every tier file, so the guard never fires for them.

Tests

The mixed-state cases exercise the lookup before the state mask. A standalone non-Washington household exercises the all-false mask. The remaining cases cover Washington households with a mismatched, unknown or omitted county.

  • wa_pte_income_eligible Case 12 (2024): King County, South Dakota, and two UNKNOWN-county households at and $1 over the Adams County Tier 3 threshold. Expected [true, false, true, false].
  • wa_pte_tier Case 15 (2027): King County at the 2027 Tier 1 threshold after the $7,500 standard deduction, South Dakota, and UNKNOWN falling to Adams County Tier 2. Expected [1, 0, 2].
  • wa_senior_disabled_property_tax_exemption Cases 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].
  • Added cases cover Washington with a Multnomah County, Oregon key in both formulas, five tax units in one UNKNOWN household, explicit UNKNOWN and Adams benefits, the omitted-county default, and a standalone South Dakota household.

The four numbered cases above fail on main with the ParameterNotFoundError shown. At this head, 124 cases across seven Washington property tax exemption YAML files were traced by hand. CI runs them.

Invariants

  • Unchanged for Washington households with a real county. All 39 valid Washington county keys retain their own threshold rows.
  • Zero outside WA. wa_pte_tier == 0, wa_pte_income_eligible == false and the exemption is zero for non-WA households (the defined_for mask, unchanged).
  • No unknown key reaches the lookup. Both formulas pass only keys present in the Washington threshold tables. Unsupported keys use Adams, and the state mask still zeroes results outside Washington.

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:

  • Already guarded against other states' counties: MN CCAP, MD local tax, MD CCS, IN county tax, CO CCAP, WI Shares, and the county-group formulas (PA and KS TANF; NY, IL and TN CCAP; VA CCSP).
  • vt_renter_credit had the same crash. #10725 guards its county lookups and caps household size at eight for the income-table lookup. The credit reaches household and SPM benefits through state_property_tax_refunds.
  • MN CCAP, WI Shares and MD CCS crash for an in-state household whose county is UNKNOWN. They mask other states' counties but not UNKNOWN. In the default dataset every household has a valid county FIPS that matches its state, so only household input with county: UNKNOWN reaches this.

Follow-ups are #11355 for the Washington survivor and disability filing rules, #11356 for Part B coverage across different months, and the remaining county lookups in the other programs.

axiom: n/a: microsim crash guard, no change to any WA rule; real-county WA results are unchanged

🤖 Generated with Claude Code

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>
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8999568) to head (07fd94e).
⚠️ Report is 388 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main    #10113   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         2    +1     
  Lines           24        33    +9     
=========================================
+ Hits            24        33    +9     
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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Agent review for Max, written by Claude Code for Max Ghenis.

Review record for 2228eb730cef5fc821ea593ca18b1a73435c5dc2:

  • A Codex cloud task reviewed this commit in a full round 1 (GPT-6.2 Sol at Extra High effort; chat https://chatgpt.com/local/6b0c7cab-9f20-83ea-a5c8-b65a8210d0e2). Its verdict is approve, with no P0 or P1 findings.
  • It reproduced the mixed-state crash on the merge base in 2024, 2026 and 2027, and the in-state UNKNOWN crash. At this commit, all 50 other jurisdictions return false or zero on all three outputs, and all 39 Washington county keys keep their results. It ran the three changed YAML files (12, 15 and 20 cases) and the full Washington YAML suite (824 cases in 79 files), all passing; the four new cases fail on the merge base as intended. It checked the county thresholds for every period against the Department of Revenue tables, RCW 84.36.381 and 84.36.383.
  • It listed no tests it could not run. The full-population run in the description was outside its household-only scope.
  • Follow-ups, not blockers:
    • P2: the comments at wa_pte_income_eligible.py:23 and wa_pte_tier.py:23 say the lookup cannot raise ParameterNotFoundError, but a Washington household with an Oregon county still raises it, as the description says.
    • P2: the new benefit cases pair King County with a South Dakota county; an end-to-end case with UNKNOWN would cover that path.
    • P2 (predates this PR): age_threshold.yaml uses age 62 in 2019, while SSB 5186 sets age 61 for taxes collected from 2016.
    • P3: write the changelog fragment in the past tense.
  • Main has since changed the same Washington files (Align Washington property tax exemption age with the collection year #10839, collection-year age), so main was merged in with no conflicts (ede16549), and a scoped check of that merge is queued.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
@MaxGhenis MaxGhenis changed the title Fix WA property tax exemption crash for households outside Washington Guard Washington property tax exemption county lookups Nov 30, 2026
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Agent-written for Max, by Claude Code for Max Ghenis.

Review records for this PR, restated here so each stays on the page.

@MaxGhenis
MaxGhenis merged commit 100a485 into main Dec 1, 2026
37 checks passed
@MaxGhenis
MaxGhenis deleted the fix-wa-pte-county-lookup branch December 1, 2026 04:43
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.

1 participant