From ae482680ca5271a28ba44f6733cacfbac68c8913 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Wed, 19 Aug 2026 21:01:19 -0400 Subject: [PATCH 1/2] Refresh UK Universal Credit target contract --- .../622-uk-uc-contract-refresh.changed.md | 3 ++ .../build/uk/uk_national_targets.json | 51 +++++++++++++++++-- .../tests/test_uk_national_targets.py | 7 +-- 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 changelog.d/622-uk-uc-contract-refresh.changed.md diff --git a/changelog.d/622-uk-uc-contract-refresh.changed.md b/changelog.d/622-uk-uc-contract-refresh.changed.md new file mode 100644 index 00000000..588d60e5 --- /dev/null +++ b/changelog.d/622-uk-uc-contract-refresh.changed.md @@ -0,0 +1,3 @@ +Refresh the UK national target contract against policyengine-uk-data 1.56.16, +adding the Universal Credit benefit-unit caseload declaration and recording the +closed registry-parity delta. diff --git a/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json b/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json index 29eeea66..079ffee0 100644 --- a/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json +++ b/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json @@ -12,9 +12,10 @@ }, "registry_parity": { "source_repository": "policyengine-uk-data", - "pinned_ref": "ebf733c", - "registry_rows": 651, - "mapped_rows": 609, + "pinned_ref": "12a1e028afeef08d8b2d74ee03fd9de3a78b2dd3", + "pinned_version": "1.56.16", + "registry_rows": 652, + "mapped_rows": 610, "excluded_rows": 42, "mapped": { "dwp/benefit_capped_households": "dwp.benefit_cap.capped_households", @@ -25,6 +26,7 @@ "dwp/pip_dl_enhanced_claimants": "dwp.pip.daily_living_enhanced_claimants", "dwp/pip_dl_standard_claimants": "dwp.pip.daily_living_standard_claimants", "dwp/scotland_uc_households_child_under_1": "dwp.uc.scotland_households_child_under_1", + "dwp/uc/households": "dwp.uc.households", "dwp/uc/claimants_couple_no_children": "dwp.uc.households_couple_no_children", "dwp/uc/claimants_couple_with_children": "dwp.uc.households_couple_with_children", "dwp/uc/claimants_single_no_children": "dwp.uc.households_single_no_children", @@ -677,6 +679,7 @@ "hmrc.salary_sacrifice.it_relief_additional_rate": "New declaration backed by chronicle#139 salary-sacrifice facts; the incumbent source CSV is 410-Gone at ebf733c and its rows were silently suppressed by the bare-except drop in build_loss_matrix.py:376-394." }, "accounting_notes": { + "v1_56_16_refresh": "Compared with ebf733c, the governed registry surface adds dwp/uc/households. The four deleted universal-credit jobseeker dispatch names were not registry rows in the carried contract, so there were no parity entries to remove; obr/jobseekers_allowance remains a distinct published JSA expenditure target.", "cross_level_duplicate_names": "Name-only identity flattens two-level emissions for ons/uk_population, ons/scotland_children_under_16, and ons/scotland_babies_under_1.", "two_child_limit_year_surface": "The 15 dwp/uc/two_child_limit/* rows are 2026-only; the incumbent effective surface is 636 at calibration year 2025 and 651 at 2026. This is microcosm#622 Fixture-B input because the incumbent cannot self-report the year-specific surface.", "geography_level_order_canonicalization": "The 9 voa.council_tax_stock.* rows use country, region order to match the rest of the contract; consumers use membership only." @@ -9832,6 +9835,48 @@ "student_support_product": "adult_dependants_grant" } } + }, + { + "target_id": "dwp.uc.households", + "family": "dwp_universal_credit", + "geography_levels": [ + "country" + ], + "measurement": { + "entity": "benefit_unit", + "concept": "uk.benefit_unit.count", + "filters": [ + { + "concept": "uk.benefits.universal_credit.amount", + "operator": ">", + "value": 0 + } + ] + }, + "bindings": { + "policyengine": { + "metric_name": "dwp/uc/households", + "value_variable": "universal_credit", + "from_entity": "benunit", + "filters": [ + { + "variable": "universal_credit", + "operator": ">", + "value": 0 + } + ], + "notes": "Prepared benefit-unit indicator for receipt of Universal Credit; DWP household means the UC unit of assessment, not an ONS household." + }, + "axiom": { + "metric_name": "dwp/uc/households", + "status": "pending", + "value_rule": "uk.benefit_unit.count" + } + }, + "ledger_selector": { + "source_name": "dwp", + "source_concept": "dwp.uc_benefit_units" + } } ] } diff --git a/packages/microcosm-build/tests/test_uk_national_targets.py b/packages/microcosm-build/tests/test_uk_national_targets.py index fd339471..07995872 100644 --- a/packages/microcosm-build/tests/test_uk_national_targets.py +++ b/packages/microcosm-build/tests/test_uk_national_targets.py @@ -127,10 +127,11 @@ def test_uk_national_targets_shape_and_accounting(): assert resource["country"] == "uk" assert resource["allowed_value_operations"] == ["identity"] - assert len(resource["targets"]) == 186 + assert len(resource["targets"]) == 187 parity = resource["registry_parity"] - assert parity["pinned_ref"] == "ebf733c" + assert parity["pinned_ref"] == "12a1e028afeef08d8b2d74ee03fd9de3a78b2dd3" + assert parity["pinned_version"] == "1.56.16" assert parity["mapped_rows"] + parity["excluded_rows"] == parity["registry_rows"] assert len(parity["mapped"]) == parity["mapped_rows"] assert len(parity["excluded"]) == parity["excluded_rows"] @@ -140,7 +141,7 @@ def test_uk_national_targets_shape_and_accounting(): declared_target_ids = {target["target_id"] for target in resource["targets"]} assert mapped_target_ids | set(unmapped_declarations) == declared_target_ids assert all(reason for reason in unmapped_declarations.values()) - assert len(mapped_target_ids) == 183 + assert len(mapped_target_ids) == 184 def test_uk_national_targets_have_unique_target_ids(): From 7ff3f164380c86b34f1ed3b7f1bc719d796f49da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Juaristi?= <127882282+juaristi22@users.noreply.github.com> Date: Thu, 20 Aug 2026 13:32:50 +0200 Subject: [PATCH 2/2] Fix UC contract review findings --- .../622-uk-uc-contract-refresh.changed.md | 6 ++-- .../build/uk/uk_national_targets.json | 4 +-- .../tests/test_spec_engine_country_bundles.py | 2 +- .../tests/test_uk_national_targets.py | 30 +++++++++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/changelog.d/622-uk-uc-contract-refresh.changed.md b/changelog.d/622-uk-uc-contract-refresh.changed.md index 588d60e5..d9c041a9 100644 --- a/changelog.d/622-uk-uc-contract-refresh.changed.md +++ b/changelog.d/622-uk-uc-contract-refresh.changed.md @@ -1,3 +1,3 @@ -Refresh the UK national target contract against policyengine-uk-data 1.56.16, -adding the Universal Credit benefit-unit caseload declaration and recording the -closed registry-parity delta. +Refresh the UK national target contract to the 1.56.16 registry surface, adding +the Universal Credit benefit-unit caseload declaration and recording the closed +registry-parity delta. diff --git a/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json b/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json index 079ffee0..a018711a 100644 --- a/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json +++ b/packages/microcosm-build/src/microcosm/build/uk/uk_national_targets.json @@ -9843,7 +9843,7 @@ "country" ], "measurement": { - "entity": "benefit_unit", + "entity": "benunit", "concept": "uk.benefit_unit.count", "filters": [ { @@ -9856,7 +9856,7 @@ "bindings": { "policyengine": { "metric_name": "dwp/uc/households", - "value_variable": "universal_credit", + "value_variable": "benunit_count", "from_entity": "benunit", "filters": [ { diff --git a/packages/microcosm-build/tests/test_spec_engine_country_bundles.py b/packages/microcosm-build/tests/test_spec_engine_country_bundles.py index e487e8e0..b60dccd8 100644 --- a/packages/microcosm-build/tests/test_spec_engine_country_bundles.py +++ b/packages/microcosm-build/tests/test_spec_engine_country_bundles.py @@ -42,7 +42,7 @@ ), ( "uk", - "beed723a64944a2dc45c85a6853a51666885aba0aeca0e1ada6680a6352fb44c", + "942ad7df5537e244df7ede7230098e91c617dbdb11e4d0885a94bb3b4f912da5", { "benunit.benunit_id", "household.household_id", diff --git a/packages/microcosm-build/tests/test_uk_national_targets.py b/packages/microcosm-build/tests/test_uk_national_targets.py index 07995872..74867d9f 100644 --- a/packages/microcosm-build/tests/test_uk_national_targets.py +++ b/packages/microcosm-build/tests/test_uk_national_targets.py @@ -247,6 +247,36 @@ def test_uk_national_targets_declare_chronicle_loader_guarantees(): ] == "esa_income + esa_contrib" +def test_uk_uc_households_target_counts_benunits(): + resource = _load() + target = _target_by_id(resource, "dwp.uc.households") + + assert target["measurement"] == { + "entity": "benunit", + "concept": "uk.benefit_unit.count", + "filters": [ + { + "concept": "uk.benefits.universal_credit.amount", + "operator": ">", + "value": 0, + } + ], + } + assert target["bindings"]["policyengine"]["value_variable"] == "benunit_count" + assert target["bindings"]["policyengine"]["from_entity"] == "benunit" + assert target["bindings"]["policyengine"]["filters"] == [ + { + "variable": "universal_credit", + "operator": ">", + "value": 0, + } + ] + assert target["ledger_selector"] == { + "source_name": "dwp", + "source_concept": "dwp.uc_benefit_units", + } + + def test_uk_national_cgt_contract_names_match_runtime_specs(): resource = _load()