Skip to content

Add Minnesota renter's credit#7956

Open
PavelMakarchuk wants to merge 7 commits intomainfrom
fix/mn-renters-credit
Open

Add Minnesota renter's credit#7956
PavelMakarchuk wants to merge 7 commits intomainfrom
fix/mn-renters-credit

Conversation

@PavelMakarchuk
Copy link
Copy Markdown
Collaborator

@PavelMakarchuk PavelMakarchuk commented Apr 8, 2026

Summary

  • add Minnesota renter's credit variables and parameters
  • wire the credit into Minnesota refundable credits and the state property tax credit umbrella
  • add regression and integration coverage for ordinary renter-credit cases

Testing

  • python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/credits/mn_rent_constituting_property_taxes.yaml --batches 1
  • python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/credits/mn_renters_credit_household_income.yaml --batches 1
  • python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/credits/mn_renters_credit.yaml --batches 1
  • python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/mn_integration.yaml --batches 1
  • python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states/mn/tax/income --batches 1
  • python -m pytest policyengine_us/tests/policy/baseline/gov/tax/income/test_legacy_state_umbrellas.py -q

Fixes #7938

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #7956    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           19         6    -13     
  Lines          336        92   -244     
  Branches         3         0     -3     
==========================================
- Hits           336        92   -244     
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 Sentry.
📢 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.

@PavelMakarchuk PavelMakarchuk marked this pull request as ready for review April 9, 2026 00:36
Copy link
Copy Markdown
Collaborator

@DTrim99 DTrim99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one issue to address:

[P2] Prorate assisted rent with AGI, not household income

In policyengine_us/variables/gov/states/mn/tax/income/credits/mn_renters_credit.py around lines 32-37, the assistance-paid-rent fraction is using mn_renters_credit_household_income, which is after age/disability/dependent/SEIU subtractions. Minn. Stat. 290.0693 Subd. 6(b) defines this fraction with adjusted gross income in both numerator and denominator, so older/disabled/dependent claimants in assisted facilities get under-credited here. Please base the proration ratio on the pre-subtraction household AGI/line-5 amount and add a test where assistance rent combines with an age or dependent subtraction.

PavelMakarchuk and others added 3 commits April 21, 2026 09:12
- Use AGI instead of household income in assistance rent proration per
  Minn. Stat. 290.0693, Subd. 6(b) (M1RENT Line 5, not Line 10)
- Add primary statutory references to age_threshold and
  dependent_subtraction_multiplier parameters
- Rename changelog from .fixed to .added (new feature, not bug fix)
- Remove trailing zeros in parameter values
- Add #page= anchors to all PDF references
- Fix single-string references to proper tuples
- Remove misleading mn_additions/mn_subtractions test inputs
- Standardize test naming and person naming conventions
- Add M1REF 2025 reference to refundable.yaml
- Add absolute_error_margin where missing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Simplifies the Minnesota renter's credit by removing inputs that added
complexity without corresponding benefit:

- mn_renters_credit_seiu_stipend_subtraction (always 0)
- mn_renters_credit_separate_lived_apart_all_year (always False)
- mn_renters_credit_shared_rent_fraction (always 1)
- mn_renters_credit_total_rent_from_crps (always = rent)
- mn_renters_credit_assistance_rent_paid (always 0)

Assistance-rent proration and MFS lived-apart branches removed from
parent formulas; tests updated accordingly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@DTrim99
Copy link
Copy Markdown
Collaborator

DTrim99 commented Apr 22, 2026

PR Review (via /review-pr)

🔴 Critical (Must Fix)

  1. CI failure — Full Suite - Rest is failing with a microsimulation entity mismatch when calling household_net_income:

    ValueError: Input [...] is not a valid value for the entity household
      (size = 41314 != 669 = count)
    

    The failure surfaces inside the adds chain that eventually calls person_weightperson.household(\"household_weight\", period). Unit/YAML tests pass, but the vectorized microsim path does not. Because mn_renters_credit is newly rolled into mn_refundable_credits (and taxsim_state_property_tax_credit via gov.states.household.state_property_tax_credits), the interaction with household_net_income needs to be reproduced locally with Microsimulation(dataset='hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5') and sim.calc('household_net_income', period=2025) to isolate the offending variable. This blocks merge.

  2. Broken dependent-claimant exclusion — mn_renters_credit_eligible.py:25-28:

    claimants = tax_unit.members(\"is_tax_unit_head_or_spouse\", period)
    claimant_is_dependent = tax_unit.any(
        claimants & tax_unit.members(\"is_tax_unit_dependent\", period)
    )

    A tax unit head/spouse is never also a tax unit dependent by definition, so claimant_is_dependent is always False and the Minn. Stat. §290.0693 Subd. 1(i) "cannot be claimed as a dependent" disqualification is inoperative. is_tax_unit_dependent describes dependents within this tax unit, not whether the filer is claimed on someone else's return. Needs a different signal (e.g., an explicit input flag or a variable like is_tax_unit_claimed_dependent).

  3. Existing reviewer (DTrim99) — assisted-rent proration: Minn. Stat. §290.0693 Subd. 6(b) prorates rent constituting property taxes for rent-assisted residences using the AGI/line-5 amount in both numerator and denominator. The current mn_rent_constituting_property_taxes just multiplies net rent (after housing_assistance) by 17%, which under-credits older/disabled/dependent claimants in assisted facilities. Please resolve that thread explicitly.

🟡 Should Address

  1. Duplicate max_credit > 0 check: mn_renters_credit_eligible.py:35 includes (p.max_credit.calc(household_income) > 0), but mn_renters_credit.py:30 already applies min_(max_credit, ...). The eligibility check happens twice.

  2. age_threshold.yamlperiod field: Age threshold values don't prorate or accumulate — other age-threshold parameters in the codebase use period: eternity. Current file uses period: year.

  3. Code-style: unnecessary parameter aliasmn_rent_constituting_property_taxes.py:17 binds p = parameters(period).gov.states.mn.tax.income.credits.renters and only uses p.rent_fraction. Either rename for clarity or access directly.

  4. Code-style: nested p.credits.renters.* accessors in mn_renters_credit_household_income.pyp = parameters(period).gov.states.mn.tax.income then p.credits.renters.age_threshold, p.credits.renters.dependent_subtraction_multiplier. Clearer to bind the alias at the .renters level.

  5. Variable name claimants (in both mn_renters_credit_eligible.py and mn_renters_credit_household_income.py) refers to head-or-spouse status; claimant in the MN statute has a specific meaning tied to the filer. Consider is_head_or_spouse for clarity.

  6. mn_rent_constituting_property_taxes uses p.rent_fraction, but that parameter is scalar with unit: /1 and period: year. The 17% rate is actually statutory and has been stable since 2014; consider period: eternity and cite Minn. Stat. §290.0693 Subd. 1(j) more directly (current ref is correct but the period is misaligned).

  7. Test gaps:

    • No test where filer is claimed as dependent elsewhere (exclusion rule) — blocked by critical Run black formatting on docs #2.
    • No test where percent_of_income * household_income > rent_constituting_property_taxes (excess_rent clamps to 0).
    • No test for >5 dependents (above highest bracket).
    • Integration test mn_integration.yaml Case 3 only covers a single filer — add a case with age ≥ 65 or disability subtraction to confirm the household-income chain.

🟢 Suggestions

  1. Parameter description style: Descriptions like "Minnesota sets the minimum age for the age-based household income subtraction under the renter's credit" deviate from the standard pattern ([State] [verb] this [X] under the [Full Program Name] program). Consider "Minnesota sets this minimum age for the age-based household income subtraction under the Renter's Credit program" etc.

  2. Label consistency: mn_renters_credit_qualifying_crp label \"Has a qualifying Minnesota renter's credit CRP\" is written as a verb phrase; the rest of the PR uses noun phrases.

  3. References: The PDF URLs under /2026-03/ are future-dated (MN's 2025 return materials). Worth confirming these URLs are stable in MN's CMS.


Validation Summary

Check Result
Regulatory accuracy 2 issues (dependent-claimant check, assisted-rent proration)
Reference quality Acceptable; minor style
Code patterns 5 style/pattern issues
Test coverage 4 gaps
CI status 1 failing (microsim)

Next Steps

To auto-fix fixable items: /fix-pr 7956. CI failure and statutory issues (critical #2 and #3) likely need human review.

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.

MN Renter's Credit (§290.0693) not implemented

2 participants