Fix MT v32 (State AGI) returning $0 in TAXSIM output#901
Merged
Conversation
The taxsim_v32_state_agi adapter reads PE-US's unified state_agi variable, which sums gov.states.household.state_agis. That list points to mt_agi_indiv (Person, defined_for mt_married_filing_separately_on_same_return_eligible) — for joint, single, and HoH MT filers this returns 0, even though MT tax is computed correctly off mt_agi_joint. Route MT through an override in OUTPUT_ADAPTER_OVERRIDES so v32 reads mt_agi_joint (the tax-unit-level MT AGI that applies to all filing statuses except MFS-on-same-return). Also update variable_mappings.yaml for consistency with the override path. Reported in #862. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
For Montana filers, the
v32(State AGI) output of the TAXSIM emulator returned$0regardless of filing status, even though MT tax was computed correctly. Root cause: thetaxsim_v32_state_agiadapter reads PE-US's unifiedstate_agi→taxsim_state_agi→ sumsgov.states.household.state_agis, which for MT listsmt_agi_indiv— a person-level variabledefined_for = "mt_married_filing_separately_on_same_return_eligible"that returns0for joint, single, and HoH filers.The MT tax computation itself runs off
mt_agi_joint(tax-unit level) and is unaffected — only the displayedv32was wrong, which made TAXSIM output look like PE skipped MT AGI.Fix
Add
"taxsim_v32_state_agi": {"MT": ["mt_agi_joint"]}toOUTPUT_ADAPTER_OVERRIDESso MT routes throughmt_agi_joint, the tax-unit-level MT AGI that applies to all filing statuses except MFS-on-same-return (which is rare in TAXSIM inputs). Also align the per-state fallback invariable_mappings.yaml(mt_agi→mt_agi_joint) for consistency.Test plan
tests/test_state_output_adapters.py:$0, now$80,000(federal AGI = MT AGI when no MT-specific subtractions).$0, now$150,481.69.tests/test_state_output_adapters.pyandtests/test_mappers.pypass (47 tests).Reported in
policyengine-taxsim#862
🤖 Generated with Claude Code