Skip to content

Apply Housing Benefit accommodation disregards from their start date - #2234

Draft
anth-volk wants to merge 2 commits into
fix-hb-qualified-childcarefrom
fix-hb-accommodation-dates
Draft

anth-volk wants to merge 2 commits into
fix-hb-qualified-childcarefrom
fix-hb-accommodation-dates

Conversation

@anth-volk

@anth-volk anth-volk commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2233

Implements approved Housing Benefit plan B2 only: 13 files, no new inputs. The accommodation disregard already exists through merged #2123, but the fiscal-year loader's 30-April sampling gives none of it in 2026-27 despite its 5 October 2026 commencement. This PR retains the seven monetary parameters' actual dates and uses the established fiscal_year_segments helper to calculate complete awards before and after each change.

Calculation

For each date segment, use the full applicable accommodation amount; cap earnings disregards and childcare against remaining earnings/tax credits; test the additional disregard against those full amounts; then apply the income floor, applicable-amount threshold, 65% taper and zero-award floor. Only then combine the completed awards by elapsed fiscal-year days. The baseline 2026-27 calculation has 182 days before commencement and 183 days afterwards. A fractional disregard applied before the nonlinear rules is not equivalent.

Example with annual earnings £1,000, standard disregard £260, applicable amount £500 and eligible rent £10,400: the pre-commencement annual-equivalent award is £10,244; afterwards earnings are fully disregarded and the award is £10,400. Annual entitlement is (10,244 × 182 + 10,400 × 183) / 365 = £10,322.21, not £10,400 from averaging income before applying its threshold.

The calculation reads reformed parameter schedules and clones only the leaves used to construct a temporary flat schedule. It does not change model parameters, parent links, supplied inputs or computed caches. Supplied annual income/disregard/childcare values and replacement formulas retain their override semantics. Tests cover zero parameter reforms, exact dated ranges, one-day reforms, fiscal-year-only reforms, supplied-period attribution, later set_input, replacement formulas and neutralization.

Sources and scope

Government sources are embedded in the parameter metadata and formula references: GB commencement, SI 2026/753 regulation 1, GB amounts and earnings-test amendment, SI 2026/978 regulation 2, NI commencement and amounts, SR 2026/157 regulations 1/2, GB award taper, regulation 71, and childcare earnings limits, regulation 27, with their NI counterparts.

Annual earnings, rent, ages, household composition and legal status remain constant across segments. Other parameters retain the existing annual convention. This is date integration for the accommodation provision, not a weekly household-history model. The annual income/childcare intermediates are not period-specific assessments; entitlement recomputes the period-specific amounts when needed. Pension-age and passported assessments retain their existing treatment. This PR does not change accommodation eligibility, working-age closure, rent valuation, take-up or datasets. C1 child allowances are expressly deferred under #2232.

Dependencies and validation

Stacked on #2229: #2211 → #2225 → #2219 → #2229 → this PR. #1925 owns the fixed childcare caps and should precede the childcare work; this PR does not duplicate those changes. Coordinate with #2131 when rebasing its shared entitlement file. Current main has changed the shared Housing Benefit files. Merge updated bases without rebasing or rewriting shared history. Merge main and retarget this PR only after #2229 has landed; preserve both the reconciled #2211 ordinary-income helper and #2225's corrected disabled-worker regression.

The 13-file scope uses the existing accommodation YAML file rather than adding the separately named YAML file proposed in the plan. Its old intentional-omission expectation is replaced, and its childcare fixtures use the existing childcare_expenses input. The current #2229 head retains aggregate spending and an age-based child count; detailed qualifying-care rules remain deferred to #2236, and no qualifying-charge input is added.

Historical author validation (not rerun by the 22 October job):

  • uv run --no-sync pytest policyengine_uk/tests/test_housing_benefit_accommodation_dates.py -q: 17 passed.
  • uv run --no-sync policyengine-core test policyengine_uk/tests/policy/baseline/finance/benefit/family/housing_benefit/applicable_income/housing_benefit_specified_or_temporary_accommodation_disregard.yaml -c policyengine_uk: 49 passed.
  • uv run --no-sync make format: formatting and lint passed.
  • git diff --check: passed.

Commands ran sequentially in the existing Python 3.13/core 3.32.13 environment, using the implementation worktree on PYTHONPATH. The first test run reproduced eight failures before implementation. A date-only reform fixture was corrected to use an explicit range for a multi-day override, and a separate one-day regression retains that distinction. No full suite, microsimulation, documentation build or CI polling; hosted CI is not confirmed.

22 October hand-off: this job ran 0 tests for this child and made no branch changes, push, retarget, merge or readiness change. Immediate parent #2229 remains unmerged. Its root #2211 reconciliation is committed locally but verification is blocked because available disk stayed below the required 55 GB decimal. After #2229 lands, merge main, resolve conflicts, and run focused foreground tests with -n 2 once load1 ≤110 and os.statvfs available disk ≥55 GB; then push once and retarget to main. The body has been corrected to match the current childcare fixtures and merge workflow.

Reproducer: policyengine_uk/tests/test_housing_benefit_accommodation_dates.py::test_first_year_combines_completed_awards

axiom: TheAxiomFoundation/rulespec-uk#375 queued
The specified-accommodation disregard dates extension to rulespec-uk#375, with the law, required outputs and companion tests: TheAxiomFoundation/rulespec-uk#375 (comment) (UK hub, 24 Oct).

@MaxGhenis

Copy link
Copy Markdown
Collaborator

Parent-gated build hand-off. Head remains de48e391989960e56c8454ec5aea9693e299dec5; no branch changes, push or retarget. Immediate parent #2229 is still OPEN/unmerged at c5e5f88471395f09d1ecd0770cbaee2c938c7807 (checked 22 October). Root #2211 has a local reconciliation awaiting the required disk gate: #2211 (comment)

Tests for this child: 0 executed in this job; no claim is made about the current head's CI. Preserve Anthony's corrected disabled-worker earnings-disregard regression (£1,929.20) when updating the base. Draft status unchanged; no merge/readiness/closure action.

Once #2229 lands, the pending commands are:

git fetch origin main fix-hb-accommodation-dates
git switch fix-hb-accommodation-dates  # create tracking branch if absent
git merge --no-ff origin/main
# Resolve, run focused foreground tests with -n 2 after load1 <=110 and
# os.statvfs available disk >=55 GB decimal; commit fixes and push once.
gh api -X PATCH repos/PolicyEngine/policyengine-uk/pulls/2234 -f base=main

Open items: parent landing; merge/test/push/body refresh as needed; retarget; hub independent review.

Corrected the published body to describe existing childcare_expenses fixtures (no new qualifying-charge input) and main merges instead of rebases. Historical author validation (17 Python tests / 49 YAML tests) is now explicitly labelled as historical, not rerun here. Preserve #2131's shared entitlement changes when resolving the future merge. No extra simulation.py edits have been made by this job.

@juaristi22 juaristi22 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at de48e391989960e56c8454ec5aea9693e299dec5. No actionable findings from independent policy/source and code reviews of the date-integration change.

GB and NI sources establish commencement on 5 October 2026; the intervening GB amendment’s 2 October start does not move the allowance forward. Computing completed awards within each date segment preserves the taper and floors before day-weighting.

Validation: 137 focused tests passed. An actual-income NI case produces £10214.80, matching 182/365 of the zero-allowance control plus 183/365 of the full-allowance control, and differs from tapering averaged income. Supplied overrides and parameter-parent links were also checked. The annual constant-circumstance approximation and documented whole-stack reconciliation prerequisites remain.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants