Repository navigation
Fix program registry model references - #2443
Conversation
vahid-ahmadi
left a comment
There was a problem hiding this comment.
Fine once the Benefit Cap prefix is narrowed.
@juaristi22, the JSA, ESA and DLA fixes and the Maternity Allowance change are right, and the new tests catch them. One gap is left from the issue.
- should,
policyengine_uk/programs.yaml:322:benefit_capstill hasparameter_prefix: gov.dwp, the whole DWP tree. That is the same defect you fixed for Maternity Allowance. The PR body says #2089 handles it, but #2089 merged on 17 October and left this line alone.gov.dwp.benefit_capresolves to aParameterNode(I checked), so the fix is one line. - nit,
policyengine_uk/tests/test_program_registry.py:31: the prefix test only checks that the prefix resolves to a node, so a whole-department prefix likegov.dwppasses. A simple guard would catch the next one: reject prefixes with only two segments unless the entry is listed as an allowed exception.gov.ofgem(line 550, energy price guarantee) would then need a decision too, since it also coversenergy_price_cap.
What I checked
- Confirmed
jsa,esa,dlaandwinter_fuel_paymentexist inCountryTaxBenefitSystem().variables, and thatminimum_wagenow usesgov.hmrc.minimum_wage(#2053 merged). pytest policyengine_uk/tests/test_program_registry.py: 94 passed. Withprograms.yamlreverted to main: 4 failed (jsa, esa, dla, Maternity Allowance), 91 passed.ruff checkandruff format --checkon the new test file: clean.- Five other open PRs edit
programs.yaml(#1910, #1966, #2007, #2066, #2322).git merge-treeshows no conflict with any of them in that file. - Reproducer and axiom lines are present;
fixedfragment type is right. CI is green on the current head.
🤖 Generated with Claude Code
b1ea3f4 to
d6fe42c
Compare
|
Narrowed Benefit Cap’s advertised parameter prefix to Commit |
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; components the model counts twice; 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 checkEach of 84 components was raised by £1 per unit in 2026-27, and every head of its totals was read 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 head that breaks a rule is measured again twice: with every other head held at its baseline value, and with every other head held at its value after the first £1 while the component rises again. It fails where either still shows the response. 0 failed; 0 were skipped.
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
Components the model counts twice: 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
|
vahid-ahmadi
left a comment
There was a problem hiding this comment.
Approving. The Benefit Cap prefix is fixed and the new test guards it.
@juaristi22, thanks. Status of my earlier points:
- should, Benefit Cap prefix: Fixed.
policyengine_uk/programs.yaml:322is nowgov.dwp.benefit_cap, andtest_benefit_cap_does_not_advertise_unrelated_parameterschecks the subtree. - nit, two-segment prefix guard: Not done, which is fine for this PR.
gov.ofgem(energy price guarantee, line 551) still coversenergy_price_cap, so a follow-up could narrow it.
No new findings.
What I checked
- The fix commit
d6fe42c19only changesprograms.yaml, the registry test and the changelog fragment. The rest of the force-push is a rebase onto main.git range-diffshows the first commit unchanged. pytest policyengine_uk/tests/test_program_registry.py: 95 passed. With the Benefit Cap prefix put back togov.dwp, the new test fails (1 failed, 94 passed).ruff checkandruff format --checkon the test file: clean.- No merge conflict with main. Six other open PRs edit
programs.yaml(#1910, #1966, #2007, #2066, #2322, #2504).git merge-treeshows no conflict in this PR's files with any of them. Some of those branches conflict with current main in files this PR doesn't touch. With #2504 merged in, the registry tests pass (97 passed). - The PR body has
Reproducer:andaxiom: n/alines, and thefixedfragment is updated. All 15 CI checks pass ond6fe42c19, and the aggregate-impact report shows no change.
🤖 Generated with Claude Code
…ment-charge No conflicts. programs.yaml auto-merged: main's registry fixes (#2443) and this branch's notes on income tax, the Winter Fuel Payment and PAWHP touch different entries. #2493's 2022 full-year director NI and #2506's aggregate-impact runtime identity read nothing this branch changes; the director tests read income_tax only in 2022, before the charge. Main: 6990350 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #2116
The public program registry pointed JSA, ESA and DLA at variable names that do not exist. Their entries now use the model's lowercase aggregate variables. Maternity Allowance no longer advertises the entire DWP parameter tree, since its reported value has no dedicated policy parameter subtree.
The new tests check every declared variable and parameter prefix through
CountryTaxBenefitSystem.modelled_policies, plus the Maternity Allowance regression. Winter Fuel Payment already has a valid mapping following #2038 and remains unchanged. Benefit Cap now advertises its own parameter subtree. The new regression checks its advertised Benefit Cap leaves and excludes unrelated DWP programs.Reproducer: policyengine_uk/tests/test_program_registry.py::test_program_variables_exist, policyengine_uk/tests/test_program_registry.py::test_maternity_allowance_does_not_advertise_unrelated_parameters, policyengine_uk/tests/test_program_registry.py::test_benefit_cap_does_not_advertise_unrelated_parameters
Initial validation:
uv run --no-sync --offline make formatpassed with no formatting changes and no lint errors.axiom: n/a: registry references and validation only; no policy rules or calculation changes.
Review follow-up: the focused Benefit Cap regression failed on the old whole-DWP prefix and passed after narrowing it. This round reused frozen Python 3.13/Core 3.33.2 with target-worktree imports; integrated validation will be recorded in the review reply.