Repository navigation
Add a claim input for the Universal Credit housing costs element - #2951
Conversation
Add would_claim_uc_housing_costs_element, a benefit unit input that defaults to true, and make uc_housing_costs_element defined_for it, as uc_childcare_element is for uc_childcare_element_claimed. A dataset can then represent a Universal Credit award that carries no housing costs element for a family that rents. uc_work_allowance already gives such an award the higher work allowance. Fixes #2950 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vahid-ahmadi
left a comment
There was a problem hiding this comment.
Thanks, María. The change is small and does what #2950 proposes. I found nothing blocking. There is one point on what the input will mean once Microcosm sets it, and two nits.
Checked at ab70ae3
-
Who reads the element. Every reader of
uc_housing_costs_elementoutside its own file:uc_maximum_amountsums it, so a nil element lowers the award.uc_work_allowancekeys onhousing > 0, so the award gets the higher allowance. That's what reg 22(2) gives an award with no amount for housing costs.- The non-dependant Pension Credit branch (
uc_non_dep_receives_pension_credit) sets the element to zero as an input, so the newdefined_forcan't affect it. housing_benefit_eligibleandclaims_universal_creditmention it only in their documentation.
So the gate only ever zeroes the element, and nothing else changes while the input is true.
-
Housing Benefit.
housing_benefit_eligibledoesn't read the element, so the new work-allowance case correctly giveshousing_benefit: 0: the UC claim ends the reported award, and the family isn't in specified accommodation. -
Tests. The two changed YAML files give 16 passed locally, including the three new cases. CI's YAML and Python test lanes hadn't reported when I looked, and neither had the aggregate impact check.
-
Placement. The new input sits beside
would_claim_uc_childcare, and the take-up plan row matches how the other UC element inputs are described.
1. What a false will mean in the data (for microcosm#1710 more than for this PR). A renting award statement can show no housing element without anyone declining it. Examples: housing costs not yet reported or verified for that assessment period; a liability treated as non-commercial or contrived (Sch 2 paras 7 and 9); or non-dependant deductions that use up the rent. The model already explains some of these. Where non-dependant deductions use up the eligible rent, the model's element is already zero, so setting the flag changes nothing there. Under current law that's harmless. Under a reform, though, a flagged family is frozen out of any change to the element (LHA rates, non-dependant deductions, the cap). That's right for a family that genuinely won't claim, and wrong for one whose zero comes from a rule the reform changes. Two suggestions:
- When Microcosm sets the flag, set it only where the baseline model would otherwise pay a positive element. That way it carries only the zeros the model can't explain.
- Have the input's documentation say it stands for "an award with no housing costs element for a reason the model doesn't simulate (not claimed, or a liability DWP doesn't treat as eligible)", not only a decision not to claim.
The name can stay as it is, to match the other claim inputs.
Nits
- The docstring says the input defaults to true "for the policy calculator". It defaults to true for every caller, including the Enhanced FRS and any Microcosm build that doesn't set it. The changelog and the take-up row already say that, so the docstring could just say "defaults to true".
- One more YAML case would pin the default directly: the same renting family with the input left unset gets the element. The existing cases cover this implicitly, but a test named for it would catch a later change to
default_value.
Review drafted with AI assistance and checked against the code at ab70ae3e825048c4381862c9a69c28e8974c045b.
Following review: the input's documentation now says that false stands for an award with no housing costs element for a reason the model doesn't simulate, that such a family gets no element under any reform, and that a dataset should set it false only where the model would otherwise pay an element. The input defaults to true for every caller; a YAML case now pins that default, and the take-up plan row matches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Aggregate impact on certified data: passBase Checks: 0 broken by this change, 1 failing on both sides, 0 fixed. Moves flagged for review: 0 (thresholds in Notes
Moves flagged for reviewNone. Spending by benefit and service
Caseloads
Household net income by decileNo household's net income changes in any year. No change in any year: receipts by tax head; government balance, each component counted once; model totals; household income totals; population; poverty rates; people in poverty; inequality; mean household net income in each side's own deciles; standard reform costings (change in gov_balance); standard reforms: change in each reform's target. Checks failing on both base and head (1)
Counted-once checkThe check raised each of 92 components by £1 per unit in 2026-27 and read every head of its totals household by household: its own head must rise by exactly £1, no other tax head may move, no other benefit may rise, and the model's own total must move by what its heads moved. A response that is not finite breaks every rule. The check measures a head that breaks a rule twice more: once holding every other head at its baseline value, and once holding every other head at its value after the first £1 while the component rises again. The head fails where either measurement still shows the response. The check cannot hold a head at a value that is not finite. In each unit where another head is not finite after the first £1, it holds that head at its baseline value, and the second measurement judges no household the unit belongs to. There a head fails wherever it first broke a rule, or wherever the check could not confirm whether its response contains the component. 0 failed and the check skipped 0.
Provenance
Dataset: Receipts by tax head: head levels
Spending by benefit and service: head levels
Caseloads: head levels
Government balance, each component counted once: head levels
Model totals: head levels
Household income totals: head levels
Population: head levels
Poverty rates: head levels
People in poverty: head levels
Inequality: head levels
Mean household net income in each side's own deciles: head levels
Standard reform costings (change in gov_balance): head levels
Standard reforms: change in each reform's target: head levels
|
|
Thanks Vahid. All three are in 267e4a6.
On 267e4a6, the Universal Credit and benefit cap YAML tests give 788 passed, and |
vahid-ahmadi
left a comment
There was a problem hiding this comment.
Follow-up at 267e4a6. Thanks, María. All three points are addressed, and I have nothing further.
- The input's documentation and the take-up plan row now say that false stands for a nil element the model doesn't simulate, and that a dataset should set it only where the model would otherwise pay one. Your plan for the Microcosm stage (award statement's element zero, and a positive baseline element) matches.
- The docstring now just says it defaults to true.
- The new default case passes. With the input unset, the private renter gets the full £5,000, and
would_claim_uc_housing_costs_elementreads true. The two changed YAML files give 17 passed locally, and CI's YAML lane is green.
On the bot's "Aggregate impact: FAIL" comment: that run was on the old head (ab70ae3) and was cancelled when 267e4a6 was pushed, so no report was produced. It isn't a result. The new head's aggregate impact and Python lanes were still running when I looked.
Review drafted with AI assistance and checked against the code at 267e4a6ab3174d5802e897d37ff48367677926e6.
Fixes #2950
axiom: n/a: adds a dataset claim input that defaults to true; no rule or parameter value changes
Summary
Adds
would_claim_uc_housing_costs_element, a benefit unit input that defaults to true, and gatesuc_housing_costs_elementon it. A dataset can then represent a Universal Credit award that carries no housing costs element for a family that rents. Outputs don't change until a dataset sets the input.Changes
would_claim_uc_housing_costs_element: new input, besidewould_claim_uc_childcare. False stands for an award with no housing costs element for a reason the model doesn't simulate, so a dataset should set it only where the model would otherwise pay an element.uc_housing_costs_element:defined_forthe new input, asuc_childcare_elementis foruc_childcare_element_claimed; documentation updated.docs/book/assumptions/takeup-analysis-plan.md): a row for the new input.changelog.d/uc-housing-element-claim-input.added.md.Tests
uv run policyengine-core test policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit policyengine_uk/tests/policy/baseline/gov/dwp/benefit_cap -c policyengine_uk: 788 passed, including the four new cases.defined_forremoved, the three gate cases fail and the other cases in their two files pass. Withdefault_valuefalse, the default case fails.uv run pyteston the 12 Python test files that readuc_housing_costs_elementor the work allowance (LHA maximum, accommodation take-up, benefit cap, lodger child, AFIP housing contribution, single claim, legacy closure, carer element, two Council Tax Reduction files, earned income before the work allowance, variable module release): 74 passed, none failed or skipped (on ab70ae3; 267e4a6 changes only documentation and a YAML case).ruff format --check .andruff check .: clean, somake formatchanges nothing.make documentation(one table row added).🤖 Generated with Claude Code