Skip to content

Conversation

@daphnehanse11
Copy link
Collaborator

@daphnehanse11 daphnehanse11 commented Jan 27, 2026

Summary

  • Fixed medicare_quarters_of_coverage variable which used an invalid adds syntax, causing MSP calculations to fail
  • Removed default_quarters_of_coverage parameter file (not a policy value from law)
  • Made medicare_quarters_of_coverage a pure input variable with no default
  • API users must explicitly provide medicare_quarters_of_coverage: 40 or is_premium_free_part_a: true

Principle

Default assumptions about a person's characteristics don't belong in the model as parameters. Policy parameters should only reflect values from law.

Test plan

  • msp_benefit_value.yaml tests pass (including integration test with explicit medicare_quarters_of_coverage)
  • base_part_a_premium.yaml tests pass

Fixes #7256

🤖 Generated with Claude Code

daphnehanse11 and others added 2 commits January 26, 2026 16:42
The `adds` attribute was incorrectly set to a parameter path that
resolves to a scalar integer (40), when it should be a list of variable
names. This caused `msp` calculations to fail with TypeError when the
full calculation chain was exercised.

Replaced the invalid `adds` with a proper formula that reads from the
parameter.

Added tests:
- medicare_quarters_of_coverage.yaml: Unit test for default value
- msp_benefit_value.yaml: Integration test exercising full calculation
  chain without mocking intermediate values

Fixes PolicyEngine#7256

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7260   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           10         7    -3     
=========================================
- Hits            10         7    -3     
Flag Coverage Δ
unittests 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.

@daphnehanse11 daphnehanse11 requested a review from hua7450 January 27, 2026 16:11
@hua7450
Copy link
Collaborator

hua7450 commented Jan 27, 2026

Maybe we should apply Max's comment in issue @daphnehanse11 ?

Per Max's review:
- Removed default_quarters_of_coverage parameter (not a policy value)
- Made medicare_quarters_of_coverage a pure input variable with no default
- API users must explicitly provide medicare_quarters_of_coverage or
  is_premium_free_part_a
- Updated integration test to provide explicit value

Principle: Default assumptions about person characteristics don't belong
in the model as parameters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Bug: medicare_quarters_of_coverage uses invalid adds syntax causing MSP calculation to fail

2 participants