Repository navigation
Conversation
This was referenced Oct 9, 2026
anth-volk
force-pushed
the
fix-hb-accommodation-dates
branch
from
October 9, 2026 17:40
a859805 to
de48e39
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_segmentshelper 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. Upstream main advanced while this batch was in progress; its new commits do not change these HB files. Rebase dependent branches as their bases merge.
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 fixture uses the qualifying-charge input introduced by #2229.
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.axiom: needed