From 7f5e7230b853e61db5fe85837e163f7c64e606b8 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 01:14:00 +0000 Subject: [PATCH 1/3] Require a reg. 12(2) course for the reg. 60(1) education protection SI 2014/1230 reg. 60(1) (SR 2016/226 reg. 61(1) in Northern Ireland) protects only a person who fails the education condition on the migration day "because the person is undertaking a full-time course (see regulation 12(2) and 13 ...)". The model's migrated_student limb read only the closure claim and the migration-day qualifying young person status, so it also protected a young person on a non-advanced course with no maintenance funding, who met the condition that day and becomes a qualifying young person once their existing benefit ends. The limb now also needs a full-time course of advanced education or one with a student loan or grant for maintenance, read through undertakes_regulation_12_2_course, which uc_receiving_education now shares. Case 48 of uc_receiving_education.yaml is issue 2878's example (no Universal Credit; it got 5,112.96), case 38 now asserts the exception ends with the course, the oracle and the closure-dates property test require the course, and a fixed example adds an unfunded 18-year-old with a closure claim. Fixes #2878. Co-Authored-By: Claude Opus 5.5 --- changelog.d/2878.fixed.md | 1 + .../uc_receiving_education.yaml | 50 +++++++++- .../test_uc_receiving_education_properties.py | 91 +++++++++++++------ ...uc_is_excepted_from_education_condition.py | 27 +++++- .../uc_receiving_education.py | 40 +++++--- 5 files changed, 158 insertions(+), 51 deletions(-) create mode 100644 changelog.d/2878.fixed.md diff --git a/changelog.d/2878.fixed.md b/changelog.d/2878.fixed.md new file mode 100644 index 0000000000..dda287ff5c --- /dev/null +++ b/changelog.d/2878.fixed.md @@ -0,0 +1 @@ +The Universal Credit education protection for a claimant moved off legacy benefits (SI 2014/1230 reg. 60(1); SR 2016/226 reg. 61(1) in Northern Ireland) now needs a full-time course that the Universal Credit Regulations 2013 reg. 12(2) covers: advanced education, or a course with a student loan or grant for maintenance. A young person on another full-time course met the condition on the migration day, so the protection doesn't reach them, and the model no longer pays them Universal Credit through it. diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml index 35386bd3d5..2758596e1b 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml @@ -1077,9 +1077,7 @@ # to undertake that course" (SI 2014/1230 reg. 60(1)), so DWP now applies it # to them. Off the course, they don't receive education under reg. 12(2), so # they meet s. 4(1)(d) without an exception. DWP had published no rates for - # 2027 to 2028 by November 2026, so we assert no amount. The model keeps - # uc_is_excepted_from_education_condition true here although DWP no longer - # applies reg. 60(1) to the claimant, so we don't assert it. + # 2027 to 2028 by November 2026, so we assert no amount. period: 2027 input: people: @@ -1099,6 +1097,7 @@ region: NORTH_EAST output: uc_receiving_education: [false] + uc_is_excepted_from_education_condition: [false] meets_uc_education_condition: [true] is_uc_eligible: true @@ -1414,3 +1413,48 @@ uc_receiving_education: [false] is_uc_eligible: true universal_credit: 4_062.96 + +- name: Case 48, the 18-year-old of case 42 without maintenance funding gets no Universal Credit when the model derives the closure. + # Issue 2878. The claimant of case 42 takes a full-time course that is + # neither advanced education nor funded by a student loan or grant, earns + # £9,000 and pays a council rent of £6,000. On the migration day the Working + # Tax Credit award still existed, so SI 2014/1230 reg. 28 kept them out of + # the qualifying young person definition, and the Universal Credit + # Regulations 2013 reg. 12(2) doesn't cover their course: they met the + # condition in s. 4(1)(d) that day, so reg. 60(1) doesn't reach them. The + # claim ended the award the day before their Universal Credit award would + # start (reg. 8(2)(a)), so from then they count as a qualifying young person + # and receive education (reg. 12(1A)). No reg. 14(1) exception the model + # applies reaches them, so they fail the condition and get no Universal + # Credit. Under the earlier rule the model excepted them and paid + # 12 x £338.58 + £6,000 - 55% x £9,000 = £5,112.96. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 18 + current_education: POST_SECONDARY + is_in_full_time_education: true + employment_income: 9_000 + working_tax_credit_reported: 1_000 + benunits: + benunit: + members: [person1] + would_claim_uc: false + would_claim_uc_at_legacy_closure: true + households: + household: + members: [person1] + region: NORTH_EAST + tenure_type: RENT_FROM_COUNCIL + rent: 6_000 + output: + claims_uc_at_legacy_closure: true + is_qualifying_young_person_on_uc_migration_day: [false] + is_qualifying_young_person_for_uc_education: [true] + uc_receiving_education: [true] + uc_is_excepted_from_education_condition: [false] + meets_uc_education_condition: [false] + is_uc_eligible: false + universal_credit: 0 diff --git a/policyengine_uk/tests/test_uc_receiving_education_properties.py b/policyengine_uk/tests/test_uc_receiving_education_properties.py index a211977060..9479332452 100644 --- a/policyengine_uk/tests/test_uc_receiving_education_properties.py +++ b/policyengine_uk/tests/test_uc_receiving_education_properties.py @@ -69,12 +69,12 @@ report, when the model derives claims_uc_at_legacy_closure and legacy_benefits_closed itself: uc_is_excepted_from_education_condition holds exactly when, that year, they report a legacy benefit whose active parameter -reads false and their family claims at closure; and is_uc_eligible holds for -a full-time degree student exactly when that exception holds, and for anyone -not on a full-time course always. It reads the closure dates from the -parameters. With claims_uc_at_legacy_closure set true, which -test_education_condition_invariants draws in 2019, 2021 and 2024, the model -excepts them in any year. +reads false, their family claims at closure and they are on a full-time +degree; and is_uc_eligible holds for a full-time degree student exactly when +that exception holds, and for anyone not on a full-time course always. It +reads the closure dates from the parameters. With claims_uc_at_legacy_closure +set true, which test_education_condition_invariants draws in 2019, 2021 and +2024, the model excepts a claimant on a course reg. 12(2) covers in any year. """ import json @@ -463,7 +463,7 @@ def reference(case, result): couple_tax_credits_on_migration_day = any( person_of[j].get(name, 0) > 0 for j in couple for name in TAX_CREDITS ) - qyp, qyp_on_migration_day, recv = {}, {}, {} + qyp, qyp_on_migration_day, recv, reg_12_2_course = {}, {}, {}, {} for i, person in person_of.items(): qyp[i] = ( bool( @@ -486,8 +486,11 @@ def reference(case, result): "in_HE", False ) maintenance = person.get("has_education_maintenance_funding", False) - recv[i] = person["is_in_full_time_education"] and ( - advanced or maintenance or qyp[i] + reg_12_2_course[i] = person["is_in_full_time_education"] and ( + advanced or maintenance + ) + recv[i] = reg_12_2_course[i] or ( + person["is_in_full_time_education"] and qyp[i] ) foster = { i: person.get("uc_is_responsible_foster_parent_of_child_under_one", False) @@ -524,10 +527,14 @@ def reference(case, result): and bool(result["has_attained_state_pension_credit_qualifying_age"][i]) and bool(result["is_mixed_age_couple"][f]) ) + # Reg. 60(1) protects a person who fails the condition on the + # migration day "because the person is undertaking a full-time + # course (see regulation 12(2) and 13 ...)". reg_60 = ( in_couple_role and fam["benunit"]["claims_uc_at_legacy_closure"] and not qyp_on_migration_day[i] + and reg_12_2_course[i] ) exc[i] = limb_b or limb_c or limb_d or limb_e or limb_f or reg_60 claimants = [i for i in members if result["is_uc_single_or_joint_claimant"][i]] @@ -643,7 +650,9 @@ def single_family(people, closure=False, **household_inputs): ], ), # SI 2014/1230 reg. 28: an 18-year-old on a non-advanced full-time course - # who reports Housing Benefit, without and with a closure claim. + # who reports Housing Benefit, without and with a closure claim. With the + # claim, reg. 60(1) protects them only with maintenance funding, which + # brings the course within reg. 12(2) (issue 2878). dict( year=2026, families=[ @@ -673,6 +682,19 @@ def single_family(people, closure=False, **household_inputs): tenure_type="RENT_FROM_COUNCIL", rent=6_000, ), + single_family( + [ + person( + 18, + is_in_full_time_education=True, + current_education="POST_SECONDARY", + housing_benefit_reported=6_000, + ) + ], + closure=True, + tenure_type="RENT_FROM_COUNCIL", + rent=6_000, + ), ], ), ] @@ -900,7 +922,7 @@ def test_examples_reach_the_cases(): # Families: the issue's student; the student couples of EXAMPLES[1]; the # mixed-age couples of EXAMPLES[2]; the young Housing Benefit claimants. np.testing.assert_array_equal( - drawn["is_uc_eligible"], [False, False, True, True, False, True, True] + drawn["is_uc_eligible"], [False, False, True, True, False, True, True, True] ) assert drawn["universal_credit"][0] == 0 assert before["universal_credit"][0] > 0 @@ -909,22 +931,30 @@ def test_examples_reach_the_cases(): drawn["uc_is_excepted_from_education_condition"][1:5], [True, False, True, False], ) - # People 9 and 10: the young Housing Benefit claimants. Each claims + # People 9 to 11: the young Housing Benefit claimants. Each claims # Universal Credit, which ends their own Housing Benefit two weeks after # the award starts (SI 2014/1230 reg. 8(2A)). The UC predicate follows # that claim limb and reads reg. 5(5) only from reported Universal # Credit, so it gives true; the condition reads the status on the first - # day of the award, when the Housing Benefit still runs. - young = slice(9, 11) + # day of the award, when the Housing Benefit still runs. Only the funded + # one undertakes a course reg. 12(2) covers, so only they receive + # education, and the reg. 60(1) protection reaches only them: the third + # met the condition on the migration day (issue 2878). + young = slice(9, 12) np.testing.assert_array_equal( - drawn["is_qualifying_young_person_for_universal_credit"][young], [True, True] + drawn["is_qualifying_young_person_for_universal_credit"][young], + [True, True, True], ) np.testing.assert_array_equal( - drawn["is_qualifying_young_person_for_uc_education"][young], [False, False] + drawn["is_qualifying_young_person_for_uc_education"][young], + [False, False, False], ) - np.testing.assert_array_equal(drawn["uc_receiving_education"][young], [False, True]) np.testing.assert_array_equal( - drawn["uc_is_excepted_from_education_condition"][young], [False, True] + drawn["uc_receiving_education"][young], [False, True, False] + ) + np.testing.assert_array_equal( + drawn["uc_is_excepted_from_education_condition"][young], + [False, True, False], ) assert np.all(drawn["universal_credit"][5:] > 0) @@ -1095,17 +1125,18 @@ def test_reg_60_protection_follows_the_closure_dates(case): model derives claims_uc_at_legacy_closure and legacy_benefits_closed itself, uc_is_excepted_from_education_condition holds exactly when, in that model year, they report a legacy benefit whose active parameter reads - false and their family claims at closure - (would_claim_uc_at_legacy_closure). None of them meets a reg. 14(1) limb, + false, their family claims at closure (would_claim_uc_at_legacy_closure) + and they are on a full-time degree. None of them meets a reg. 14(1) limb, so the model excepts them only under its reg. 60(1) rule (SR 2016/226 reg. 61(1) in Northern Ireland), and it takes the closure from the active - parameters. The model then finds a full-time degree student among them - eligible for Universal Credit exactly when the exception holds, and anyone - among them not on a full-time course eligible either way. For a person off - a course the model keeps the exception, although DWP lifts the condition - under reg. 60(1), and the Department for Communities under reg. 61(1), - only while they continue the course (case 38 of - uc_receiving_education.yaml); this test pins that proxy.""" + parameters. DWP lifts the condition under reg. 60(1), and the Department + for Communities under reg. 61(1), only for a person who failed it on the + migration day because of a course reg. 12(2) covers and only while they + continue it, so a person off a course has no exception (case 38 of + uc_receiving_education.yaml). The model then finds a full-time degree + student among them eligible for Universal Credit exactly when the + exception holds, and anyone among them not on a full-time course eligible + either way.""" year = case["year"] simulation = Simulation(situation=closure_situation(case)) # The formulas read parameters at 1 January of the model year, and the @@ -1120,7 +1151,10 @@ def closed(path): node = getattr(node, key) return not bool(node) - expected = np.array( + # Each person is on a degree (current_education TERTIARY), so a full-time + # one undertakes a course reg. 12(2)(a) covers. + full_time = np.array([p["is_in_full_time_education"] for p in case["people"]]) + expected = full_time & np.array( [ drawn["would_claim_uc_at_legacy_closure"] and any( @@ -1136,7 +1170,6 @@ def closed(path): expected, context, ) - full_time = np.array([p["is_in_full_time_education"] for p in case["people"]]) np.testing.assert_array_equal( simulation.calculate("is_uc_eligible", year), ~full_time | expected, context ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py b/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py index 5b42c4658f..37dc7a2b46 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.universal_credit.uc_receiving_education import ( + undertakes_regulation_12_2_course, +) class uc_is_excepted_from_education_condition(Variable): @@ -21,13 +24,24 @@ class uc_is_excepted_from_education_condition(Variable): "qualifying age for State Pension Credit; and reg. 60(1), a member of " "a family that claims Universal Credit when DWP moves it off its " "legacy benefits (claims_uc_at_legacy_closure), which the model takes " - "as the qualifying claim under reg. 48 of the 2014 Regulations, and who " + "as the qualifying claim under reg. 48 of the 2014 Regulations, who " "didn't count as a qualifying young person for the condition on the " "migration day (is_qualifying_young_person_on_uc_migration_day, which " "applies reg. 28 of the 2014 Regulations to the award the claim " - "ended). The model needs no rule of its own for limb " - "(e)(i): it places responsibility for a child on the benefit unit, so " - "both members of the couple meet (c). Under (b), the decision maker " + "ended), and who undertakes a full-time course that reg. 12(2) of the " + "2013 Regulations covers: advanced education, or a course with a " + "student loan or grant for their maintenance. Reg. 60(1) protects only " + "a person who fails the condition on the migration day because of such " + "a course, and only while they continue it; the model reads the " + "model year's course inputs for both, so a person who leaves the " + "course loses the protection that year. A person outside the " + "definition on the migration day on a course reg. 12(2) doesn't cover " + "met the condition that day, so reg. 60(1) doesn't reach them, and " + "once their existing benefit ends they receive education as a " + "qualifying young person (reg. 12(1A)). The model needs no rule of " + "its own for limb (e)(i): it places responsibility for a child on the " + "benefit unit, so both members of the couple meet (c). Under (b), the " + "decision maker " "must determine limited capability for work before the course starts. " "The model can derive uc_limited_capability_for_work from disability " "status (is_disabled_for_benefits) without an assessment, so it can " @@ -130,11 +144,14 @@ def formula(person, period, parameters): # education under reg. 12(1A), not reg. 12(2); reg. 28 applies # first, so a person entitled to an existing benefit on the # migration day took reg. 12(2) and keeps the protection while they - # continue the course, after that award has ended. + # continue the course, after that award has ended. A course reg. + # 12(2) doesn't cover left them meeting the condition that day, so + # the protection needs a course it covers. migrated_student = ( claimant_or_partner & benunit("claims_uc_at_legacy_closure", period) & ~person("is_qualifying_young_person_on_uc_migration_day", period) + & undertakes_regulation_12_2_course(person, period) ) return ( disabled_with_limited_capability_for_work diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/uc_receiving_education.py b/policyengine_uk/variables/gov/dwp/universal_credit/uc_receiving_education.py index c6c546a1e4..e7abd8c8a9 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/uc_receiving_education.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/uc_receiving_education.py @@ -1,6 +1,29 @@ from policyengine_uk.model_api import * +def undertakes_regulation_12_2_course(person, period): + """Whether a person undertakes a course that the Universal Credit + Regulations 2013 reg. 12(2) covers: a full-time course of advanced + education (reg. 12(2)(a)), or another full-time course of study or + training with a student loan or grant for their maintenance (reg. + 12(2)(b)).""" + full_time = person("is_in_full_time_education", period) + # Reg. 12(3): a course leading to a degree, DipHE or HND, or "of a + # standard above a general certificate of education (advanced + # level), or above a Scottish national qualification (higher or + # advanced higher)". + education = person("current_education", period) + advanced = (education == education.possible_values.TERTIARY) | person( + "in_HE", period + ) + # Reg. 12(2)(b): "any other full-time course of study or training at + # an educational establishment for which a student loan or grant is + # provided for the person's maintenance" (reg. 2 takes both terms + # from reg. 68(7)). + maintenance_funding = person("has_education_maintenance_funding", period) + return full_time & (advanced | maintenance_funding) + + class uc_receiving_education(Variable): value_type = bool entity = Person @@ -46,19 +69,6 @@ class uc_receiving_education(Variable): def formula(person, period, parameters): full_time = person("is_in_full_time_education", period) - # Reg. 12(3): a course leading to a degree, DipHE or HND, or "of a - # standard above a general certificate of education (advanced - # level), or above a Scottish national qualification (higher or - # advanced higher)". - education = person("current_education", period) - advanced = (education == education.possible_values.TERTIARY) | person( - "in_HE", period - ) - # Reg. 12(2)(b): "any other full-time course of study or training at - # an educational establishment for which a student loan or grant is - # provided for the person's maintenance" (reg. 2 takes both terms - # from reg. 68(7)). - maintenance_funding = person("has_education_maintenance_funding", period) # Reg. 12(1A): "A qualifying young person is to be treated as # receiving education", whatever the course. SI 2014/1230 reg. 28 # applies first, so a person entitled to an existing benefit takes @@ -66,4 +76,6 @@ def formula(person, period, parameters): qualifying_young_person = person( "is_qualifying_young_person_for_uc_education", period ) - return full_time & (advanced | maintenance_funding | qualifying_young_person) + return undertakes_regulation_12_2_course(person, period) | ( + full_time & qualifying_young_person + ) From 6404b65959a8ce5263a7cdfcdee9f116294f75d6 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 09:28:54 +0000 Subject: [PATCH 2/3] Answer the review: when an off-course young person receives education, case 48's tax credit, an outcome example - The exception docstring says when a young person whom reg. 28 kept outside the definition on the migration day receives education: from the first day where the claim ends the benefit before the award (a tax credit, reg. 8(2)); where the benefit runs on (reg. 8(2A); SI 2019/1152 reg. 5), they meet the condition and reg. 5(5) keeps them outside the definition. It also says the annual proxy protects a person who starts a reg. 12(2) course after the migration day, and gives Northern Ireland's regs. 6 in place of regs. 5 and 8. - The changelog limits the migration-day statement to a young person an existing benefit kept outside the definition, and cites Northern Ireland's reg. 12(2). - Case 48 says how a single 18-year-old with no child holds Working Tax Credit (SI 2002/2005 reg. 4(1), First variation of the Second condition, para. (a)(ii)). - The receiving-education examples add case 48's claimant, so dropping the course condition now fails test_examples_reach_the_cases on is_uc_eligible, not only on the exception. Co-Authored-By: Claude Opus 5.5 --- changelog.d/2878.fixed.md | 2 +- .../uc_receiving_education.yaml | 27 ++++++---- .../test_uc_receiving_education_properties.py | 51 ++++++++++++++----- ...uc_is_excepted_from_education_condition.py | 39 ++++++++++---- 4 files changed, 85 insertions(+), 34 deletions(-) diff --git a/changelog.d/2878.fixed.md b/changelog.d/2878.fixed.md index dda287ff5c..afdb12377f 100644 --- a/changelog.d/2878.fixed.md +++ b/changelog.d/2878.fixed.md @@ -1 +1 @@ -The Universal Credit education protection for a claimant moved off legacy benefits (SI 2014/1230 reg. 60(1); SR 2016/226 reg. 61(1) in Northern Ireland) now needs a full-time course that the Universal Credit Regulations 2013 reg. 12(2) covers: advanced education, or a course with a student loan or grant for maintenance. A young person on another full-time course met the condition on the migration day, so the protection doesn't reach them, and the model no longer pays them Universal Credit through it. +The Universal Credit education protection for a claimant moved off legacy benefits (SI 2014/1230 reg. 60(1); SR 2016/226 reg. 61(1) in Northern Ireland) now needs a full-time course that reg. 12(2) of the Universal Credit Regulations 2013 (in Northern Ireland, of the Universal Credit Regulations (Northern Ireland) 2016) covers: advanced education, or a course with a student loan or grant for maintenance. A young person whom an existing benefit kept outside the qualifying young person definition on the migration day (SI 2014/1230 reg. 28; SR 2016/226 reg. 29), and who was on another full-time course, met the condition that day. The protection doesn't reach them, and the model no longer pays them Universal Credit through it. diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml index 2758596e1b..a78812ed88 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml @@ -1417,17 +1417,22 @@ - name: Case 48, the 18-year-old of case 42 without maintenance funding gets no Universal Credit when the model derives the closure. # Issue 2878. The claimant of case 42 takes a full-time course that is # neither advanced education nor funded by a student loan or grant, earns - # £9,000 and pays a council rent of £6,000. On the migration day the Working - # Tax Credit award still existed, so SI 2014/1230 reg. 28 kept them out of - # the qualifying young person definition, and the Universal Credit - # Regulations 2013 reg. 12(2) doesn't cover their course: they met the - # condition in s. 4(1)(d) that day, so reg. 60(1) doesn't reach them. The - # claim ended the award the day before their Universal Credit award would - # start (reg. 8(2)(a)), so from then they count as a qualifying young person - # and receive education (reg. 12(1A)). No reg. 14(1) exception the model - # applies reaches them, so they fail the condition and get no Universal - # Credit. Under the earlier rule the model excepted them and paid - # 12 x £338.58 + £6,000 - 55% x £9,000 = £5,112.96. + # £9,000 and pays a council rent of £6,000. They hold Working Tax Credit + # through a disability that puts them at a disadvantage in getting a job, + # the only route for a single claimant under 25 with no child (Working Tax + # Credit (Entitlement and Maximum Rate) Regulations 2002 reg. 4(1), First + # variation of the Second condition, para. (a)(ii)), but no disability + # benefit and no limited capability for work determination. On the + # migration day the Working Tax Credit award still existed, so SI 2014/1230 + # reg. 28 kept them out of the qualifying young person definition, and the + # Universal Credit Regulations 2013 reg. 12(2) doesn't cover their course: + # they met the condition in s. 4(1)(d) that day, so reg. 60(1) doesn't + # reach them. The claim ended the award the day before their Universal + # Credit award would start (reg. 8(2)(a)), so from then they count as a + # qualifying young person and receive education (reg. 12(1A)). No reg. 14(1) + # exception the model applies reaches them, so they fail the condition and + # get no Universal Credit. Under the earlier rule the model excepted them + # and paid 12 x £338.58 + £6,000 - 55% x £9,000 = £5,112.96. period: 2026 absolute_error_margin: 0.01 input: diff --git a/policyengine_uk/tests/test_uc_receiving_education_properties.py b/policyengine_uk/tests/test_uc_receiving_education_properties.py index 9479332452..6e3db744a4 100644 --- a/policyengine_uk/tests/test_uc_receiving_education_properties.py +++ b/policyengine_uk/tests/test_uc_receiving_education_properties.py @@ -652,7 +652,11 @@ def single_family(people, closure=False, **household_inputs): # SI 2014/1230 reg. 28: an 18-year-old on a non-advanced full-time course # who reports Housing Benefit, without and with a closure claim. With the # claim, reg. 60(1) protects them only with maintenance funding, which - # brings the course within reg. 12(2) (issue 2878). + # brings the course within reg. 12(2) (issue 2878). The last is YAML case + # 48's claimant, whose closure claim ends a Working Tax Credit award the + # day before the Universal Credit award starts (reg. 8(2)): unfunded, they + # count as a qualifying young person from the first day, receive + # education, and get no Universal Credit. dict( year=2026, families=[ @@ -695,6 +699,20 @@ def single_family(people, closure=False, **household_inputs): tenure_type="RENT_FROM_COUNCIL", rent=6_000, ), + single_family( + [ + person( + 18, + is_in_full_time_education=True, + current_education="POST_SECONDARY", + employment_income=9_000, + working_tax_credit_reported=1_000, + ) + ], + closure=True, + tenure_type="RENT_FROM_COUNCIL", + rent=6_000, + ), ], ), ] @@ -910,8 +928,9 @@ def test_education_condition_invariants(case): def test_examples_reach_the_cases(): """The examples exclude the issue's student, apply the couple rule both - ways and send the young Housing Benefit claimants down the ordinary - route, so the invariants run on each outcome. One simulation holds the + ways, send the young Housing Benefit claimants down the ordinary route + and leave issue 2878's unfunded closure claimant without Universal + Credit, so the invariants run on each outcome. One simulation holds the four examples, as drawn and under BEFORE.""" assert all(example["year"] == 2026 for example in EXAMPLES) case = dict( @@ -920,9 +939,10 @@ def test_examples_reach_the_cases(): ) drawn, before = run(case, variants=[DRAWN, BEFORE]) # Families: the issue's student; the student couples of EXAMPLES[1]; the - # mixed-age couples of EXAMPLES[2]; the young Housing Benefit claimants. + # mixed-age couples of EXAMPLES[2]; the young claimants of EXAMPLES[3]. np.testing.assert_array_equal( - drawn["is_uc_eligible"], [False, False, True, True, False, True, True, True] + drawn["is_uc_eligible"], + [False, False, True, True, False, True, True, True, False], ) assert drawn["universal_credit"][0] == 0 assert before["universal_credit"][0] > 0 @@ -939,24 +959,31 @@ def test_examples_reach_the_cases(): # day of the award, when the Housing Benefit still runs. Only the funded # one undertakes a course reg. 12(2) covers, so only they receive # education, and the reg. 60(1) protection reaches only them: the third - # met the condition on the migration day (issue 2878). - young = slice(9, 12) + # met the condition on the migration day (issue 2878). Person 12's claim + # ends their Working Tax Credit the day before the award (reg. 8(2)), so + # on the first day they count as a qualifying young person and receive + # education (reg. 12(1A)). The protection doesn't reach them, as it + # doesn't reach the third, so they fail the condition and get no + # Universal Credit, which main_eligibility (BEFORE) pays them. + young = slice(9, 13) np.testing.assert_array_equal( drawn["is_qualifying_young_person_for_universal_credit"][young], - [True, True, True], + [True, True, True, True], ) np.testing.assert_array_equal( drawn["is_qualifying_young_person_for_uc_education"][young], - [False, False, False], + [False, False, False, True], ) np.testing.assert_array_equal( - drawn["uc_receiving_education"][young], [False, True, False] + drawn["uc_receiving_education"][young], [False, True, False, True] ) np.testing.assert_array_equal( drawn["uc_is_excepted_from_education_condition"][young], - [False, True, False], + [False, True, False, False], ) - assert np.all(drawn["universal_credit"][5:] > 0) + assert np.all(drawn["universal_credit"][5:8] > 0) + assert drawn["universal_credit"][8] == 0 + assert before["universal_credit"][8] > 0 def test_student_head_moves_non_dependant_to_joint_tenant(): diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py b/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py index 37dc7a2b46..84594c6745 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py @@ -34,11 +34,21 @@ class uc_is_excepted_from_education_condition(Variable): "a person who fails the condition on the migration day because of such " "a course, and only while they continue it; the model reads the " "model year's course inputs for both, so a person who leaves the " - "course loses the protection that year. A person outside the " - "definition on the migration day on a course reg. 12(2) doesn't cover " - "met the condition that day, so reg. 60(1) doesn't reach them, and " - "once their existing benefit ends they receive education as a " - "qualifying young person (reg. 12(1A)). The model needs no rule of " + "course loses the protection that year, but a person who starts a " + "course reg. 12(2) covers after the migration day, or moves to " + "another such course, has it that year, which the law doesn't give. " + "A young person whom reg. 28 alone kept outside the definition on the " + "migration day, on a course reg. 12(2) doesn't cover, met the " + "condition that day, so reg. 60(1) doesn't reach them. Where the " + "claim ends that existing benefit before the award starts (a tax " + "credit, reg. 8(2) of the 2014 Regulations), they count as a " + "qualifying young person from the first day and receive education " + "(reg. 12(1A)). Where it runs on past the first day (Income Support " + "or Housing Benefit under reg. 8(2A), or income-related ESA under SI " + "2019/1152 reg. 5), reg. 28 still excludes them that day, so they " + "meet the condition, and reg. 5(5) of the 2013 Regulations then keeps " + "them outside the definition while they receive Universal Credit " + "(is_qualifying_young_person_for_uc_education). The model needs no rule of " "its own for limb (e)(i): it places responsibility for a child on the " "benefit unit, so both members of the couple meet (c). Under (b), the " "decision maker " @@ -65,21 +75,30 @@ class uc_is_excepted_from_education_condition(Variable): "placed, and for a friend or family carer, who is responsible for the " "child and so meets (c) under the law. In Northern Ireland the " "decision maker applies the same exceptions under reg. 14(1) of the " - "Universal Credit Regulations (Northern Ireland) 2016, and the same " - "protection under reg. 61 of the Universal Credit (Transitional " - "Provisions) Regulations (Northern Ireland) 2016, with regs. 29 and 49 " - "of those Regulations in place of regs. 28 and 48; the model doesn't " - "apply reg. 61(2) either." + "Universal Credit Regulations (Northern Ireland) 2016, with reg. 6 " + "of those Regulations in place of reg. 5, and the same protection " + "under reg. 61 of the Universal Credit (Transitional Provisions) " + "Regulations (Northern Ireland) 2016, with regs. 6, 29 and 49 of " + "those Regulations in place of regs. 8, 28 and 48: a claim ends a " + "rate rebate before the award starts (reg. 6(2)), and a rent rebate " + "or allowance runs on (reg. 6(2A)). The model doesn't apply reg. " + "61(2) either." ) definition_period = YEAR reference = ( "https://www.legislation.gov.uk/uksi/2013/376/regulation/14", "https://www.legislation.gov.uk/uksi/2013/376/regulation/2", + "https://www.legislation.gov.uk/uksi/2013/376/regulation/5", + "https://www.legislation.gov.uk/uksi/2013/376/regulation/12", + "https://www.legislation.gov.uk/uksi/2014/1230/regulation/8", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/28", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/48", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/49", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/60", + "https://www.legislation.gov.uk/nisr/2016/216/regulation/6", + "https://www.legislation.gov.uk/nisr/2016/216/regulation/12", "https://www.legislation.gov.uk/nisr/2016/216/regulation/14", + "https://www.legislation.gov.uk/nisr/2016/226/regulation/6", "https://www.legislation.gov.uk/nisr/2016/226/regulation/29", "https://www.legislation.gov.uk/nisr/2016/226/regulation/49", "https://www.legislation.gov.uk/nisr/2016/226/regulation/61", From 51e3c1121e1903150b09cb77650dc8566df65c2b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 09:47:27 +0000 Subject: [PATCH 3/3] Answer the fix check: Northern Ireland twins, ESA run-on references, case 48's Working Tax Credit conditions - The Northern Ireland sentence maps reg. 12(1) for reg. 12(1A) and SR 2019/152 reg. 4 for SI 2019/1152 reg. 5, and the references list both run-on regulations. - Case 48 gives the Working Tax Credit route in the past tense with its 16 hours and reg. 9(1)(c), and its comment is reflowed. - The examples test's docstring names YAML case 48's claimant. Co-Authored-By: Claude Opus 5.5 --- .../uc_receiving_education.yaml | 33 ++++++++++--------- .../test_uc_receiving_education_properties.py | 4 +-- ...uc_is_excepted_from_education_condition.py | 16 +++++---- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml index a78812ed88..bb32327918 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/universal_credit/uc_receiving_education.yaml @@ -1417,22 +1417,23 @@ - name: Case 48, the 18-year-old of case 42 without maintenance funding gets no Universal Credit when the model derives the closure. # Issue 2878. The claimant of case 42 takes a full-time course that is # neither advanced education nor funded by a student loan or grant, earns - # £9,000 and pays a council rent of £6,000. They hold Working Tax Credit - # through a disability that puts them at a disadvantage in getting a job, - # the only route for a single claimant under 25 with no child (Working Tax - # Credit (Entitlement and Maximum Rate) Regulations 2002 reg. 4(1), First - # variation of the Second condition, para. (a)(ii)), but no disability - # benefit and no limited capability for work determination. On the - # migration day the Working Tax Credit award still existed, so SI 2014/1230 - # reg. 28 kept them out of the qualifying young person definition, and the - # Universal Credit Regulations 2013 reg. 12(2) doesn't cover their course: - # they met the condition in s. 4(1)(d) that day, so reg. 60(1) doesn't - # reach them. The claim ended the award the day before their Universal - # Credit award would start (reg. 8(2)(a)), so from then they count as a - # qualifying young person and receive education (reg. 12(1A)). No reg. 14(1) - # exception the model applies reaches them, so they fail the condition and - # get no Universal Credit. Under the earlier rule the model excepted them - # and paid 12 x £338.58 + £6,000 - 55% x £9,000 = £5,112.96. + # £9,000 and pays a council rent of £6,000. While they had Working Tax + # Credit they worked at least 16 hours a week and had a disability that put + # them at a disadvantage in getting a job, the only route for a single + # claimant under 25 with no child (Working Tax Credit (Entitlement and + # Maximum Rate) Regulations 2002 reg. 4(1), First variation of the Second + # condition, para. (a), which also needs reg. 9(1)(c)). They hold no + # disability benefit and have no limited capability for work determination. + # On the migration day the Working Tax Credit award still existed, so SI + # 2014/1230 reg. 28 kept them out of the qualifying young person definition, + # and the Universal Credit Regulations 2013 reg. 12(2) doesn't cover their + # course: they met the condition in s. 4(1)(d) that day, so reg. 60(1) + # doesn't reach them. The claim ended the award the day before their + # Universal Credit award would start (reg. 8(2)(a)), so from then they count + # as a qualifying young person and receive education (reg. 12(1A)). No reg. + # 14(1) exception the model applies reaches them, so they fail the condition + # and get no Universal Credit. Under the earlier rule the model excepted + # them and paid 12 x £338.58 + £6,000 - 55% x £9,000 = £5,112.96. period: 2026 absolute_error_margin: 0.01 input: diff --git a/policyengine_uk/tests/test_uc_receiving_education_properties.py b/policyengine_uk/tests/test_uc_receiving_education_properties.py index 6e3db744a4..64c3c4d3c8 100644 --- a/policyengine_uk/tests/test_uc_receiving_education_properties.py +++ b/policyengine_uk/tests/test_uc_receiving_education_properties.py @@ -929,8 +929,8 @@ def test_education_condition_invariants(case): def test_examples_reach_the_cases(): """The examples exclude the issue's student, apply the couple rule both ways, send the young Housing Benefit claimants down the ordinary route - and leave issue 2878's unfunded closure claimant without Universal - Credit, so the invariants run on each outcome. One simulation holds the + and leave YAML case 48's unfunded closure claimant (issue 2878) without + Universal Credit, so the invariants run on each outcome. One simulation holds the four examples, as drawn and under BEFORE.""" assert all(example["year"] == 2026 for example in EXAMPLES) case = dict( diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py b/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py index 84594c6745..71b8d87e26 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/uc_is_excepted_from_education_condition.py @@ -75,14 +75,16 @@ class uc_is_excepted_from_education_condition(Variable): "placed, and for a friend or family carer, who is responsible for the " "child and so meets (c) under the law. In Northern Ireland the " "decision maker applies the same exceptions under reg. 14(1) of the " - "Universal Credit Regulations (Northern Ireland) 2016, with reg. 6 " - "of those Regulations in place of reg. 5, and the same protection " - "under reg. 61 of the Universal Credit (Transitional Provisions) " - "Regulations (Northern Ireland) 2016, with regs. 6, 29 and 49 of " + "Universal Credit Regulations (Northern Ireland) 2016, with regs. 6 " + "and 12(1) of those Regulations in place of regs. 5 and 12(1A), and " + "the same protection under reg. 61 of the Universal Credit " + "(Transitional Provisions) Regulations (Northern Ireland) 2016, with " + "regs. 6, 29 and 49 of " "those Regulations in place of regs. 8, 28 and 48: a claim ends a " "rate rebate before the award starts (reg. 6(2)), and a rent rebate " - "or allowance runs on (reg. 6(2A)). The model doesn't apply reg. " - "61(2) either." + "or allowance runs on (reg. 6(2A)), as income-related ESA does under " + "SR 2019/152 reg. 4 in place of SI 2019/1152 reg. 5. The model " + "doesn't apply reg. 61(2) either." ) definition_period = YEAR reference = ( @@ -91,6 +93,7 @@ class uc_is_excepted_from_education_condition(Variable): "https://www.legislation.gov.uk/uksi/2013/376/regulation/5", "https://www.legislation.gov.uk/uksi/2013/376/regulation/12", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/8", + "https://www.legislation.gov.uk/uksi/2019/1152/regulation/5", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/28", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/48", "https://www.legislation.gov.uk/uksi/2014/1230/regulation/49", @@ -99,6 +102,7 @@ class uc_is_excepted_from_education_condition(Variable): "https://www.legislation.gov.uk/nisr/2016/216/regulation/12", "https://www.legislation.gov.uk/nisr/2016/216/regulation/14", "https://www.legislation.gov.uk/nisr/2016/226/regulation/6", + "https://www.legislation.gov.uk/nisr/2019/152/regulation/4", "https://www.legislation.gov.uk/nisr/2016/226/regulation/29", "https://www.legislation.gov.uk/nisr/2016/226/regulation/49", "https://www.legislation.gov.uk/nisr/2016/226/regulation/61",