Repository navigation
Restore neutral pre-2021 pension-age cohort flags - #2628
Conversation
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
Standard reform costings (change in gov_balance)
Standard reforms: change in each reform's target
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. Checks failing on both base and head (1)
Counted-once checkEach of 86 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
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.
@juaristi22 thanks, first-round review at 3a37c76ee. The fix is right and the tests pin it. One should, on the PR body only.
What I checked
- Law, against legislation.gov.uk. SI 2021/188 reg 1(2) brings the GB HB split into force on 1 April 2021, and reg 2 inserts "before 1st April 2021" and the £177.10 / £270.30 rows. NI SR 2021/70 does the same. England SI 2021/29 reg 1(2) applies to schemes for financial years from 1 April 2021, and reg 7 adds "before 1st April 2021" and replaces £187.75 / £280.85 with £191.15 / £286.05. Before that there was one pension-age allowance: SI 2006/214 Sch 3 (version from 8 April 2020) and SI 2012/2885 Sch 2 (from 6 April 2020) both show £187.75 single and £280.85 couple. So a flag that is true for every unit before FY2021-22 matches the law, and
formula_2021lines up with the model's fiscal-year convention. - The YAML amounts: 187.75 x 52 = 9,763; 280.85 x 52 = 14,604.2; 177.10 x 52 = 9,209.2; 191.15 x 52 = 9,939.8. All match the cases.
- Tests in a fresh venv at head:
test_housing_benefit_pension_age_cohorts.py80 passed; the new YAML 4 passed; every YAML file undertests/policywhose path names HB or CTR, 624 passed; the other HB and CTR Python test modules, 145 passed. With the two*_attained_pension_age_before_cutoff.pyfiles reset to the merge basecd8972e94, 14 of the new Python cases and 2 of the 4 YAML cases fail (the 2015/2020 ones), and the 2021+ controls pass. So the tests pin the change. - CI at head: all 16 checks pass.
Reproducer:andchangelog.d/2610.fixed.mdare present. Mergeable, no conflicts.
Findings
-
should: PR body,
axiom: needed. Same point as on #2595: the template keepsneededfor external contributors, and on a maintainer PR it leaves the parity step with no owner (the Fix evidence check accepts it, so CI passes). rulespec-uk already has an openpe-parityissue for exactly this rule, TheAxiomFoundation/rulespec-uk#108 (HB pension-age applicable amount, pre/post April 2021 cohort split). Adding the pre-2021 single-allowance case there, with SI 2021/188 reg 1(2) and SI 2021/29 reg 1(2) as the start dates, would let this readaxiom: TheAxiomFoundation/rulespec-uk#108 queued. A body edit is enough; no code change. -
nit:
formula_2021in both files still opens withif cutoff is None: return ones. Sincebackdate_parametersalways gives the cutoff a value from 2015, andformula_2021only runs from 2021 anyway, that branch can't run. The same is true ofp.pension_age_cutoff is Noneinhousing_benefit_applicable_amount.py:38andcouncil_tax_reduction_applicable_amount.py:71. Harmless, but dropping or commenting them would stop the next reader assuming they matter. Fine to leave.
What looks right
- The post-2021 bodies are untouched: claimant/partner masks, integer date comparison, reformable cutoff. The boundary tests (31 March vs 1 April 2021 attainment) and the reform test show that.
- Explicit inputs still win, and the CTR flag stays neutral outside England without adding a new money rule there.
- The PR is honest about its scope: historical rates and the under-65 categories stay with #2207.
Overlap and merge order: #2207 (in the merge queue) edits housing_benefit_applicable_amount.py and its YAML, not the files here, so no conflict.
🤖 Generated with Claude Code
vahid-ahmadi
left a comment
There was a problem hiding this comment.
@juaristi22 second round at 3a37c76ee, approving.
Earlier findings
axiom: needed(was a should): still open, but we now treat it as a nit on maintainer PRs, so it no longer blocks. When you have a moment, adding the pre-2021 single-allowance case to TheAxiomFoundation/rulespec-uk#108 and changing the line toaxiom: TheAxiomFoundation/rulespec-uk#108 queuedwould still be the tidy end state.- Unreachable
cutoff is Nonebranches (nit): unchanged, fine to leave.
At head: no code change since the first round, all 16 checks pass, mergeable with no conflicts.
🤖 Generated with Claude Code
Fixes #2610
The Housing Benefit and Council Tax Reduction cohort flags read a 2021 cutoff that parameter preprocessing had extended back to 2015. As a result, the documented neutral flag could be false in years before the cohort split existed. This restores neutral
Trueflags before fiscal year 2021-22 and keeps the existing cohort calculation from annual 2021 onward.The
formula_2021routes use the model's existing fiscal-year convention. They represent FY2021-22, rather than asserting commencement on 1 January: the GB and Northern Ireland Housing Benefit amendments start on 1 April 2021, and the English CTR amendment applies to financial years beginning on or after that date.Both existing post-2021 method bodies are preserved, including their reformable cutoff, claimant/applicant and partner masks, and integer date comparisons. The change retains the current rate parameters, eligibility and take-up rules, input overrides, and the English-only lower-allowance guard in the CTR amount consumer.
The added cases cover ordinary adults without cohort or pensioner-routing overrides, exact attainment-date boundaries, partner versus unrelated-member roles, a changed cutoff, explicit user inputs, regional controls, and component fixtures with omitted age inputs. Those component fixtures explicitly supply upstream pensioner routing to isolate allowance selection; they do not establish natural pensioner entitlement or paid awards. Default natural-household cash impact remains unproved. Historical rates, under-65 categories and the existing fixture qualifications remain separate work in #2207.
Validation:
AssertionErrorfailures for the 2015/2020 HB and CTR flags, plus two passing 2021 controls. All native processes were reaped, and source, runtime stat/link and eight critical-file guards passed.make formatand lint passed. Formatting preserved all 1,715 Python ASTs and every non-Python file byte, including YAML. One ordinary local commit is frozen at3a37c76ee9e0b7fe0baa7465160d82b772bbb632(tree6d364c67572f48886cdf98bbe67ae1fd4847eed7, sole parentcd8972e9432bb537b3df62d6e364a33f55d33c58), with a clean worktree. Independent committed review is pending.The 2020 GB HB and England CTR monetary cases use the official weekly amounts of £187.75 for a single person and £280.85 for a couple, multiplied by the model's existing 52-week convention. The 2021 England CTR cases use its directly sourced higher/lower rates. HB's higher-rate and 2015 component checks use the unchanged model parameter symbolically. These checks do not certify the full suite, private microdata, historical NI rates, deployed results or a combined current-main run.
Official sources checked:
Reproducer:
policyengine_uk/tests/test_housing_benefit_pension_age_cohorts.py::test_pre2021_cutoff_is_neutral_without_entitlement_overrides;policyengine_uk/tests/policy/baseline/gov/dwp/housing_benefit_pre_cutoff_period.yamlaxiom: needed