Fix leakage in constrained non-household amount targets#765
Merged
Conversation
Collaborator
|
Integ tests take long enough that I ported two minor CI/CD fixes from #749 to this PR. |
Evaluate constrained person-, tax-unit-, and SPM-unit amount targets at their native entity before rolling amounts up to households in the unified matrix builder, preventing mixed-eligibility households from leaking non-qualifying dollars into rows such as filer-only total_self_employment_income.
c140707 to
755257c
Compare
Collaborator
|
Taking liberty of merging. Error is spurious ACA issue previously identified. |
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.
Fixes #763
Summary
The unified calibration matrix builder was leaking non-qualifying dollars into constrained amount targets whose native entity is not
household. Before this change, the builder would pre-aggregate those targets to household, evaluate constraints at person level, promote the result to a household-levelany(), and then assign the full household amount whenever any qualifying person was present. In mixed-eligibility households, that overstated rows such as filer-onlytotal_self_employment_income.What This Changes
This PR changes constrained non-household amount targets to be filtered at their native entity before they are rolled up to household contributions in the matrix.
Concretely, the builder now:
person,tax_unit,spm_unit, orhousehold)_calculate_target_values_standalone()so baseline constrained amount targets with non-household native entities select qualifying entity amounts first and only then sum those qualifying amounts back to householdThis preserves the existing behavior for household-native amount targets and leaves count-target semantics unchanged.
Effect On Issue #763
For the motivating case from the issue:
total_self_employment_income = 10,000, filertotal_self_employment_income = 5,000, non-filerThe constrained filer-only target now contributes
10,000instead of the previous15,000. More generally, any constrained amount target whose native entity isperson,tax_unit, orspm_unitnow includes only qualifying entity amounts.Regression Coverage
This PR adds regression tests covering:
any()semantics