Prefer capital gains components in PUF top-tail guard#168
Merged
Conversation
Contributor
Author
|
Local proof against the completed #167 artifact seed data:
So this patch catches the same artifact shape that #167 missed before we spend another rebuild. |
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
long_term_capital_gains_before_response/long_term_capital_gainsplusshort_term_capital_gains)capital_gainsonly when component variables are absentcapital_gainswith high LTCG still entering the open-ended AGI binWhy
The post-#167 rebuild still regressed on the same target:
1.24507744766851470.7685371816961414state/MD/adjusted_gross_income/amount/1000000_infThe guard had
affected_rows=0because it used storedcapital_gains ~= $14.3Mfor the bad MD row. PolicyEngine-US does not treat storedcapital_gainsas authoritative here: during simulation setup it copieslong_term_capital_gainsintolong_term_capital_gains_before_responseand removescapital_gainsfrom input variables, so formulas use LTCG/STCG components. The same row hadlong_term_capital_gains ~= $95.0M, which should have triggered the guard.Validation
uv run ruff check src/microplex_us/pipelines/us.py tests/pipelines/test_us.pyuv run ruff format --check src/microplex_us/pipelines/us.py tests/pipelines/test_us.pyuv run --extra dev python -m pytest tests/pipelines/test_us.py -k 'puf_support_clone_top_tail_guard'(5 passed)uv run --python 3.13 --extra dev --extra policyengine python -m pytest tests/pipelines/test_us.py(179 passed, 6 expected warnings)