Fix MT CTC reform entity level issue#7750
Conversation
Technical DetailsRoot CauseThe When ExampleA tax unit with 4 people receiving $2,699 credit:
Fix PatternFollows the same pattern that should be used for all credits added to entity = Person
...
is_head = person("is_tax_unit_head", period)
return is_head * eligible * creditRelated Files
|
038e4f7 to
8a82fc8
Compare
|
Updated to fix both files after rebasing from upstream/main:
Both now use Verified fix: |
Change mt_ctc and mt_hb268 from TaxUnit to Person entity to fix cost inflation. Montana's refundable credits calculation (mt_refundable_credits_before_renter_credit) is at Person entity level. When TaxUnit variables were added via the `adds` directive, PolicyEngine broadcast the tax unit value to each person, causing ~4.57x cost inflation. Fix follows the pattern used in mt_newborn_credit: - Change entity from TaxUnit to Person - Assign credit only to head of tax unit to avoid duplication Before fix: Ratio 4.57x (credit $239M, income change $1,093M) After fix: Ratio 1.00x (credit $239M, income change $239M) Also updates tests to expect person-level outputs where only head receives credit. Fixes PolicyEngine#7749 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ac060e7 to
bbc2086
Compare
|
Updated tests to expect person-level outputs. Since Before: All 16 previously failing tests should now pass. |
Add households sections with state_code: MT to tests that were missing them. Required because defined_for = StateCode.MT needs the state code in the household entity. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Updated tests to include |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Fix MT CTC Reform Entity Level Issue🟢 Overall Assessment: APPROVEThis PR correctly fixes a microsimulation cost inflation issue by changing the entity level from TaxUnit to Person and assigning credits only to the tax unit head. The approach follows established patterns used by other Montana credits (MT EITC, MT newborn credit). 🔴 Critical Issues (1)1. HB268 Missing Qualifying Child Filter
🟡 Should Address (4)1. Inconsistent Rounding Method
2. MT CTC Variables Missing References
3. MT CTC Parameters Missing References
4. HB268 Variable References Missing Page Numbers
🟢 Suggestions (Test Coverage)Missing Test Scenarios:
Validation Summary
What's Correct✅ Entity change from TaxUnit to Person - follows established patterns Next StepsTo auto-fix issues: Or address manually:
🤖 Review generated by PolicyEngine validator agents |
- Add ctc_qualifying_child filter to HB268 credit calculation to prevent non-qualifying dependents from contributing to credit amounts - Change HB268 from floor division (//) to np.ceil() for consistent ceiling behavior (any fraction triggers reduction) - Add MT CTC filing status tests: HEAD_OF_HOUSEHOLD, SEPARATE, SURVIVING_SPOUSE - Add MT CTC age boundary tests: 0, 5, 6, 17 - Add MT HB268 age boundary tests: 0, 5, 6 - Add MT HB268 ceiling reduction test for $50,500 AGI Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Federal CTC qualifying child must be under age 17, so age 16 is the upper boundary for qualifying children, not age 17. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The MT CTC reform covers children aged 0-17, but ctc_qualifying_child only includes ages 0-16. This extends eligibility to also include 17-year-old dependents who meet other requirements. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Evidence
Before fix:
After fix:
Test plan
Fixes #7749
🤖 Generated with Claude Code