Skip to content

Guard remaining MD local tax variables against unknown counties - #9147

Merged
MaxGhenis merged 1 commit into
mainfrom
fix/md-local-unknown-county
Jul 24, 2026
Merged

Guard remaining MD local tax variables against unknown counties#9147
MaxGhenis merged 1 commit into
mainfrom
fix/md-local-unknown-county

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Extends #9116 (issue #8975) — same crash class, remaining instances.

Problem

md_applicable_local_tax_rate and md_flat_rate_county_tax carry the identical unguarded pattern that #9116 fixed in md_withheld_income_tax:

safe_county = where(in_md, county, "ALLEGANY_COUNTY_MD")   # guards non-MD only
flat_rate = p.flat_rate[safe_county]                       # UNKNOWN key -> crash

An MD household whose county resolves to County.UNKNOWN (the default when county_fips is unmapped/absent) raises ParameterNotFoundError: The parameter 'gov.local.md.flat_rate.UNKNOWN' was not found, crashing any computation of MD local income tax. The #8975 harness only hit the SALT-withholding chain, so these two siblings survived that report; verified pre-fix on this branch that the new UNKNOWN test case raises exactly that error.

Fix

Extend the same guard used by #9116 to both variables:

safe_county = where(in_md & (county != "UNKNOWN"), county, "ALLEGANY_COUNTY_MD")

No modeling-convention change: UNKNOWN falls back to the same default county the non-MD path already uses.

Tests

  • New md_flat_rate_county_tax.yaml: Allegany baseline (3.03% × $30,000 = $909, hand-checked) + UNKNOWN case pinned equal to it (raised ParameterNotFoundError before the fix).
  • md_applicable_local_tax_rate.yaml: Allegany baseline (0.0303) + UNKNOWN case pinned equal.
  • Local run: MD local dir 19/19; full gov/states/md/tax/income 189/189.

🤖 Generated with Claude Code

md_applicable_local_tax_rate and md_flat_rate_county_tax carried the
same unguarded flat_rate[county] indexing that #9116 fixed in
md_withheld_income_tax: an MD household whose county resolves to
County.UNKNOWN (the default when county_fips is unmapped or absent)
raised ParameterNotFoundError for gov.local.md.flat_rate.UNKNOWN,
crashing any computation of MD local income tax. Extend the same
UNKNOWN fallback to the default MD county to both variables.

Extends #9116; same crash class as #8975.

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

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

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

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

@MaxGhenis
MaxGhenis merged commit caeff45 into main Jul 24, 2026
35 checks passed
@MaxGhenis
MaxGhenis deleted the fix/md-local-unknown-county branch July 24, 2026 00:22
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