Skip to content

Give migration directions for the removed gov.dwp.carer_premium.couple parameter (generalise add_removed_parameter_aliases) #2137

Description

@MaxGhenis

Problem

#2001 (merged as 3518331, released in 2.117.0) removed gov.dwp.carer_premium.couple. It held the single rate, and the law pays gov.dwp.carer_premium.single once for each qualifying claimant or partner. A saved policy or reform that still sets couple now fails with a bare lookup error:

ValueError: Could not find the parameter gov.dwp.carer_premium.couple (failed at couple).

Main already has a mechanism that fails with migration directions instead, REMOVED_PARAMETERS in policyengine_uk/utils/parameters.py. It is used for gov.dwp.state_pension.age.male and .female. But add_removed_parameter_aliases installs every alias under parameters.gov.dwp.state_pension.age. Adding the key gov.dwp.carer_premium.couple to the dict would therefore create gov.dwp.state_pension.age.couple and leave the carer premium path unchanged.

Proposed fix

  1. In add_removed_parameter_aliases, resolve each removed path's parent node from the path itself, instead of using the fixed State Pension age node.
  2. Then add "gov.dwp.carer_premium.couple" to REMOVED_PARAMETERS, with directions like: "The carer premium is now paid per qualifying claimant or partner; change gov.dwp.carer_premium.single (the per-person amount)."
  3. Test that Reform.from_dict({"gov.dwp.carer_premium.couple": ...}) and a scenario naming the path both raise the new message. Also test that no alias appears under gov.dwp.state_pension.age.

Found by the independent review of #2001 after its merge with main (finding 5). It is not a correctness issue, because the reform already fails loudly.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions