Skip to content

Lock policyengine-uk 2.179.2 and store UC's new-claimant draw by claim recency - #1687

Draft
juaristi22 wants to merge 10 commits into
mainfrom
uk-pe-uk-bump-2179-new-claimant-draw
Draft

juaristi22 wants to merge 10 commits into
mainfrom
uk-pe-uk-bump-2179-new-claimant-draw

Conversation

@juaristi22

@juaristi22 juaristi22 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The UK lock moves from policyengine-uk 2.177.7 to 2.179.2, the newest release (microcosm#1095). uv.lock moves that package alone: policyengine-core stays at 3.34.10 on the UK side and 3.32.5 on the US side.

2.179.0 (PolicyEngine/policyengine-uk#2877) lets a dataset store uc_new_claimant_health_element_draw, the uniform per benefit unit that the engine compares in each rebalancing year with gov.dwp.universal_credit.rebalancing.new_claimant_share to pay the lower new-claimant health element. A new last spine stage, uc_new_claimant_draw, stores it ordered by claim recency and age, and keeps it uniform, so the engine keeps the parameter's share while the units on the lower rate are the most recent claims. This is item 2 of the plan for the Milburn gaps, kept out of #1663.

The new inputs, signed at their defaults

2.179.2 adds 25 engine inputs (378 to 403). The build writes one of them, the draw. The other 24 stay at their defaults, each in UK_ENGINE_DEFAULT_INPUTS (would_claim_student_loan in the take-up register) with the error it can make, for María's signature:

  • The fourteen uk_total_* UK totals (2.178.0, Give household situations no share of national totals, and let data carry UK totals policyengine-uk#2901), at 0. Where the data carries them, the shares of corporate wealth and consumption divide by the UK's totals, so a simulation of part of the UK gets each household's national share. At 0 the shares divide by the simulated households' own totals, as before 2.178.0. The whole released file and the build's engine blocks give the same shares either way, so no figure the build reads moves. A user who filters the file to one region or an extract allocates each national total over that part alone: business rates, corporate SDLT, corporate land, consumer-incident tax changes and the carbon tax's corporate part are overstated for its households. add_uk_totals can write them at release (a follow-up).
  • Three routes for a young person who has left education (2.178.3), at false: before the Child Benefit terminal date, and in the 20-week Child Benefit and Child Tax Credit extension periods. The FRS records no leaving date or registration, so a young person who left education during the year stops counting from leaving; Child Benefit, and the young persons that follow it, are understated for those weeks.
  • Four size-criteria and family inputs (2.178.7), at false: a child placed for adoption, an adopter who is the child's foster parent or close relative, a foster parent between placements, and a person with a non-resident overnight carer. The build reads none of them. A placed child counts as the adopter's own; a foster parent between placements and a renter whose disabled member has an overnight carer miss an additional bedroom, so the UC housing element and Housing Benefit are understated for them.
  • pip_phase_in_draw (2.179.0): only the opt-in PIP phase-in scenario reads it, and it keeps its own seeded draw, as before 2.179.0.
  • would_claim_student_loan (2.179.0): the engine keeps its own draw for new borrowers in later years, keyed on person_id at its 40% graduate rate, as before 2.179.0.
  • housing_benefit_report_is_rate_rebate_only (2.179.2), at false: the FRS's Housing Benefit code does not tell a Northern Ireland rate rebate from a rent rebate, so the engine reads every report as a rent rebate or allowance; only the first-day test of the UC education condition in Northern Ireland reads it.

uc_receives_new_claimant_health_element's signed entry is restated: the build still supplies no status for any year, and the engine now assigns it from the stored draw.

What the build's engine reads return now

  • 2.177.9: a carer's Universal Credit award with the carer element counts against the severe disability premium, Pension Credit's severe disability addition and Scotland's working-age Council Tax Reduction carer premium.
  • 2.178.1 and 2.178.8 (Council Tax Reduction): the pensioner schemes add the disabled child and enhanced disability premiums for each qualifying child, and the pensioner schemes and Scotland's working-age scheme deduct only the tax and National Insurance each allows.
  • 2.178.3: Child Benefit and Child Tax Credit count a 16-year-old who has left education until the 31 August after their birthday; Child Benefit stops counting a young person on their own Universal Credit, ESA, income-based JSA or Income Support, and Child Tax Credit one on their own Income Support. The Housing Benefit, legacy benefit and Council Tax Reduction young persons follow Child Benefit's.
  • 2.178.7: the LHA size criteria count other families' children, give a foster child no bedroom of their own and add the foster parent's bedroom; a UC renter whose claim counts a non-dependant from another family loses the shared accommodation rate; Housing Benefit counts a child placed with a non-dependant, boarder or lodger.
  • 2.179.1: Marriage Allowance's least-tax search applies the rate test at the statutory limits.
  • 2.179.2: the UC qualifying young person test leaves out a person reporting their own legacy benefit while the model pays it; the education condition reads it on the first day of a claimant's award, and Scotland's working-age Council Tax Reduction reads it too.
  • No change to the build's reads: 2.177.8 (citations, and Scottish income tax for 2018-19 to 2021-22), 2.178.0 (the UK totals, at 0), 2.178.2, 2.178.4 and 2.178.5 (tests and a comment), 2.178.6 (a fuel duty reform's VAT) and 2.179.0 (the stored draws' reads).

No economic pin moves: the vendored uprating pins and the bonus-sacrifice anchor change only their version stamps.

policyengine-core: 2.179.2 qualifies 3.34.9, the lock holds 3.34.10

2.179.2's stored-draw check reads policyengine-core's private storage members, and QUALIFIED_CORE_VERSIONS names only 3.34.9; policyengine-uk does not enforce it at runtime. Its qualification tests, run here on 3.34.10 (the six files its docstring names, with test_uc_rebalancing.py and the code-health draw reads): 293 tests, 291 passed and 2 failed. Both failures are in test_stored_draw_input_source.py, and that file passes in full on 3.34.9 (68 of 68). Both cover a simulation whose data supplies no draw: 3.34.9 caches the default it returns for a later year, and policyengine-uk then refuses a later input or a changed default; 3.34.10 leaves that default uncached (its own fix), so the later input or default takes effect and the refusal the tests expect never comes. The build supplies the draw before any read, and on that path the reads return the stored draw on 3.34.10: the route, consumer and rebalancing tests pass, and so does this PR's engine test. The core pin does not move here; qualifying 3.34.10 is policyengine-uk's.

The new-claimant draw

  • Population: the benefit units the engine pays Universal Credit with the LCWRA element at the calibration year, on the frame as it stands (one engine read; the stage is the last of the spine, so every writer of an award input has run).
  • Order: claim recency, the completed months from DWP's claim start (FRS BENEFITS.UCSTART, which the spine already reads for the start-up period) to the interview, fewest first; then the age of the youngest claimant or partner, youngest first; then a uniform keyed on the unit.
  • Claims with no linked start (unlinked reporters, take-up entrants, legacy-closure movers, SPI-channel units) take months drawn from the linked claims whose youngest claimant or partner is in the same age band (16-24, 25-34, 35-44, 45-54, 55+), pooled until they rest on 30 source households.
  • Uniform: each unit of the population takes the midpoint of its slice of the population's weight, so at the stage's weights the share of the population below any number is that number. Every other unit takes an identity-keyed uniform. So the draw is uniform overall, and the engine keeps DWP's share each year.
  • Stored as a survey-year input, which the engine carries into every projected year: each year's new claimants are the units below that year's share.
  • Limits: the calibration reweights the units, so the share at the release's weights moves with how it reweights recent claims (measured below); a unit that gets the element only later, such as one moved off income-related ESA from 2027-28, takes the identity uniform, as the engine's own draw treats every unit.
  • Wiring: frs_spine carries the recency as frs_uc_claim_months (benefit unit, -1 where none), which the release drops; the stage spec in sources.yaml and source_stages.json with its operation schema; the graph cell, kernel, spine and fixture registrations; the coverage manifest; the export surface's allowed columns (terminal_gates, gates.json, and the data contract's gate digests); the H2 fixture.

Measurement

Two national arms, each a spine and a calibration on this machine, on Chronicle 4ce631f5 (main's feed pin) at review date 2026-11-17 with emitter 0.16.0:

  • control: main at f86134f11 (policyengine-uk 2.177.7). Main's later commits through cfd5a2a5e, this branch's base, change no UK build code.
  • head: this branch at 9b89c7c45 (policyengine-uk 2.179.2 and the new stage).

The criteria were fixed before the head arm ran. The 2027-28 figures are Great Britain's, read on each arm's release at its own weights with its own engine; the head is also read without the stored draw, which isolates the draw on the same data and engine.

Health. Both arms pass 7 of 7 seam gates. The head's final loss is 0.00510 against the control's 0.00512, with 98.7% of the 1,534 bound rows within 10% against 98.8%: one row, which no release changes, crosses the line by a fraction of a point. The weight-ratio gate passes on both arms. The spine ran in 14 minutes; the new stage takes 20 seconds. The spine's peak memory was 14.0 GB, against 9.3 GB on the control and 12.4 GB on #1663's latest arm; the control ran on a busy machine, so the comparison is loose, and the new stage's share of the rise is not isolated.

The bump's own moves (2025). No bound row's error moves by more than about a point, and LCWRA households stay at 1.5%. The held-out checks of PR3 move by under a point; nine regional PIP award-category checks move by 1 to 5 points with the weights, and no release changes them. The draw changes nothing in 2025, where the new-claimant share is zero.

The draw. The release carries it on every benefit unit, and drops frs_uc_claim_months. Over all benefit units at the release's weights, 10.8%, 12.8%, 15.8% and 22.2% fall below 0.11, 0.13, 0.16 and 0.22.

Share of Great Britain's units paid UC with the element that get the new-claimant rate (head / control / head read without the draw):

  • 2026-27: 11.5% / 9.9% / 10.0% (the parameter is 11%);
  • 2027-28: 12.8% / 11.6% / 11.7% (13%);
  • 2028-29: 16.0% / 15.7% / 15.8% (16%);
  • 2029-30: 20.0% / 20.9% / 21.0% (22%).

The units the stage ranks are exactly the units the release pays the element in 2025, and at the stage's weights their draws are uniform (22.0% below 0.22). The calibration then gives the most recent claims a little more weight and the next ones a little less, which leaves 2029-30 two points short of the parameter. The engine's own draw lands a point short each year on the same file.

2027-28, Great Britain:

  • Units with an LCWRA claimant aged 16 to 24 on the new-claimant rate: 24.4% on the head, 10.4% on the control and 10.3% on the head without the draw; the head's other units are at 11.7%.
  • People aged 16 to 24 receiving the element: 24.1% on the new-claimant rate, against 10.3% on the control.
  • The element paid to the young units: £975m, against £1,056m on the control and £1,061m without the draw, so the draw itself lowers it by £86m (8.1%).
  • The element in total: £12.98bn, against £13.09bn on the control (-0.8%), since the head's overall share sits nearer the parameter.

Tests

Local, on this machine, counted by --junitxml, one process at a time:

  • Engine-free, the touched surfaces: the 289 UK files, the shared machinery files (country spec, gate battery and its contract pins, gates, coverage, source runtime, stochastic assignment, and the spec-engine files that read the UK bundle), microcosm-data's contract tests and microcosm-frame's concept-mapping tests, in about 30-file processes. Every file passes at the head except test_uk_orrery_reconstruction.py, which needs npm ci in tools/orrery-contract (CI's runner does it). The files that failed on the first pass were the ones this PR's later steps fix (the H2 fixture, the release-cut gate digests), and they pass on rerun; test_uk_cgt_projection.py's check that the engine is absent passes with the engines blocked, as on CI, and so do the new stage's and the carrier's files (274 tests).
  • Engine tier, the files whose rules or texts this PR touches: 116 passed (12 files: the education condition, limited capability, PIP categories, trading allowance status, DfE spring term, ISA income contract, uprating pins, bonus anchor, coverage, take-up population, the new draw, the concept mapping).
  • H2: the fixture is regenerated at the head; the H parity test, the graph evidence and terminal-gate files and the graph roster file pass (108 tests).
  • tools/ci_test_plan.py verify, tools/spec_engine_coverage.py --check (42,404 of 42,404 fields), the concept coverage and the coverage manifest are current.

CI at b3fb0505a: all 12 checks pass (lint, wheels, installed-emitter, integration-uk, and engine-free, engine-uk and engine-us on Python 3.13 and 3.14).

Signatures

Awaiting María's signature: the 24 defaults above, each with the error it can make, and the restated uc_receives_new_claimant_health_element entry.

Not in this PR

  • Writing the uk_total_* columns at release with add_uk_totals, so a regional filter of the file shares national totals correctly.
  • Qualifying policyengine-core 3.34.10 in policyengine-uk's QUALIFIED_CORE_VERSIONS (upstream).

Disclosure

National figures only (UK, Great Britain), each on 30 or more survey households; sub-national rows appear only as how far their errors move, never singly by name or value; no record-level value, maximum or minimum; no cell under 3 households, and none that another figure here gives back by difference. The policyengine-uk figures are its parameters and versions.

🤖 Generated with Claude Code

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, María. This is a careful bump, and the draw stage is clean. Nothing blocks. Paths are under packages/microcosm-build/src/microcosm/build/.

One point (low, disclosure): the receipt's probe shares don't check both sides of each probe.

  • Where: share_below (uk_runtime/uc_new_claimant_draw.py:520-522) gates population_share_below and first_band_share_below (:551-559) only on the support of the whole population or 16–24 band.
  • The gap: nothing checks how many source households sit below and above each probe. The sibling receipts check both sides (uk_runtime/carers_allowance_take_up.py:811-812, uk_runtime/frs_disability.py:725-727).
  • Example: in a synthetic case with 40 older units and 5 young households, where one young household is the most recent claim, the 16–24 band prints support "3-9" and shares of 0.2 at every probe. Each share rests on that single household.
  • On the national file the young band is surely larger, so this is about the rule more than about this build.
  • Suggestion: withhold a share when either side of its probe rests on 1 or 2 households, as the siblings do.

Notes, no change needed unless you want one:

  • Two UC rows on one benefit unit: frs_uc_claim_months refuses such a unit (uk_runtime/frs_spine.py:2569-2572), while frs_uc_start_up_period takes the later start (:2470-2471). The refusal fails closed, and the 2024-25 file has no such unit, so the two rules can differ without harm. A one-line note in either place would help.
  • What sets a claim's recency: the order uses the UC claim start, not when LCWRA was found, which the FRS doesn't record. Is a sentence on that worth adding to the stage notes, since the protected group is described by when the health element applied?
  • Disclosure sign-off: within the ranked population, the released draw is a monotone function of the admin-linked UCSTART recency, so each unit's recency rank can be read off it. This is probably covered by how uc_is_in_startup_period is already treated, but it's worth naming in the sign-off.
  • The signed would_claim_student_loan entry: test_no_spine_column_writes_an_input_signed_at_the_engine_default (tests/engine_free/uk/test_uk_terminal_gates.py:549) checks only UK_ENGINE_DEFAULT_INPUTS, so a future stage writing would_claim_student_loan (now in the take-up register) wouldn't trip it. This gap was already there; it's a small extension.
  • The 2.178.3 bullet leaves out upstream's 24-hours-of-work limit on the Child Tax Credit left-education routes. It only matters for 2024, so it's wording only.
  • The lock-hash move (APPROVED_UV_LOCK_SHA256, us_runtime/worker_identity.py:30) is required. It matches the new uv.lock, but a US primary-QRF worker identity recorded under main's lock will need regenerating.

Also checked, with no issues found:

Against the 2.179.2 wheel:

  • uc_reform.py:222-225 pays the lower rate where draw < share, so the most recent claims get the lowest draws. The direction is right.
  • The draw is a benefit-unit yearly input, carried from the survey year.
  • The engine conditions only on uc_LCWRA_element > 0.
  • The population is read in 2025, before the first rebalancing year.

The stage:

  • It is the last of the 57 spine stages.
  • The order is months, then youngest age, then an identity tie-break.
  • The midpoint uniform holds at the stage's weights (0.1101 / 0.1300 / 0.1601 / 0.2200 on a random 5,000-unit check).
  • The pools work: empty and short bands merge, and zero-weight donors are never drawn.
  • The salts are unique, and row order can't change the result.
  • UCSTART parsing refuses malformed or future starts.
  • frs_uc_claim_months is dropped at release, the code identity covers the helpers, and the specs, schema, manifest and contract digests agree.

The bump:

  • uv.lock moves only policyengine-uk, with no transitive change; core stays 3.34.10 for the UK and 3.32.5 for the US.
  • Exactly 25 inputs are added (378 to 403), with none removed or retyped. Each of the 24 signed texts matches the engine code, and nothing writes them.
  • The core argument holds, and is a little stronger than stated. The engine's own consumers check input_source before reading a draw, so the cached-default difference between 3.34.9 and 3.34.10 can't be reached from engine code. A probe of both unsupplied draws over 2025–2028 gives identical results on both cores. Upstream's qualification tests give 148 of 150 on 3.34.10 and 150 of 150 on 3.34.9, as you found.
  • The behaviour notes match upstream's changelog for the versions spot-checked, and the re-pinned rebalancing source matches the new uc_reform.py.

Tests:

  • The engine-free files for the stage, spine, graph, source stages, terminal gates, coverage, receipts, country spec, core pins, concept mapping and contract pass, about 2,000 tests with none failing.
  • The engine-tier files I could run pass on 2.179.2 with core 3.34.10.
  • I couldn't run the H2 parity test or spec_engine_coverage.py --check in a hand-built venv. CI passes all 12 checks at this head.

Review drafted with AI assistance and checked against the code at b3fb050.

juaristi22 and others added 10 commits November 20, 2026 12:57
The UK side moves from policyengine-uk 2.177.7 to 2.179.2; uv.lock moves
that package alone, so policyengine-core stays at 3.34.10 on the UK side
and 3.32.5 on the US side, and APPROVED_UV_LOCK_SHA256 follows.

2.179.2 adds 25 engine inputs (378 to 403). Each stays at its default
and is signed with the error it can make: the fourteen uk_total_* UK
totals (2.178.0), the Child Benefit and Child Tax Credit routes for a
young person who has left education (2.178.3), the four adoption,
fostering and overnight-care inputs of the size criteria (2.178.7),
the three stored draws (2.179.0; would_claim_student_loan in the
take-up register) and the Northern Ireland rate rebate flag (2.179.2).

The texts that describe the locked engine were checked against the
diff from 2.177.7 to 2.179.2 and now cite 2.179.2. The concept
coverage, the uprating pins and bonus anchor (stamps only), the core
pin test and the release input coverage manifest follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
policyengine-uk 2.179.0 (PolicyEngine/policyengine-uk#2877) reads a
stored uniform per benefit unit, uc_new_claimant_health_element_draw:
in each rebalancing year a unit with the LCWRA element gets the
new-claimant rate where its draw falls below new_claimant_share.
Without it the engine draws in benefit-unit order, so who gets the
lower rate is random with respect to everything the file records.

A new last spine stage, uc_new_claimant_draw, stores the draw:
- its population is the units the engine pays Universal Credit with
  the LCWRA element at the calibration year (one engine read);
- within it, units are ordered by claim recency, the completed months
  from DWP's claim start (FRS BENEFITS.UCSTART) to the interview, then
  by the age of the youngest claimant or partner, youngest first;
- a unit without a linked claim start takes months drawn from the
  linked claims in its age band, pooled to 30 source households;
- each unit takes the midpoint of its slice of the population's
  weight, and every other unit an identity-keyed uniform, so the draw
  is uniform overall and the engine keeps the parameter's share.

frs_spine carries the recency as the benefit-unit carrier
frs_uc_claim_months, which the release drops. The draw leaves
UK_ENGINE_DEFAULT_INPUTS and joins the export surface's allowed
columns, so the data contract's gate digests follow, and the signed
entry for uc_receives_new_claimant_health_element is restated. The
stage spec and its schema branch, the graph cell, the kernel, spine
and fixture registrations, the coverage manifest, the roster pins and
the build graph doc follow. Tests: the stage's own (engine-free and
on the locked engine) and the carrier's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…179.2

2.179.0 changes add_universal_credit_reform in one way: inside each
rebalancing year it reads the dataset's stored new-claimant draw where
one reaches the year, and draws the seeded stream only for a year with
none, lazily, with the same generator and length as before. The loop
still iterates the module's REBALANCING_YEARS, which the adapter's cut
(uk_rebalancing_years_through) narrows, and no year reads another, so
the cut holds. _add_inactive_health_element_formula is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…9.2 and the draw stage

The rebase onto main dropped the earlier regeneration (9b89c7c), which main's
#1663 fixture changes conflicted with; this regenerates it on the rebased tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The FRS asks salary sacrifice on adults' job records, so the forest is fitted on
adults, but it predicted for everyone not asked who had pay. Since frs_spine carries
a dependent child's CHILD.CHEARNS as employment_income (#1663), every child with pay
was given a forest-predicted sacrifice. A dependent child not asked
(is_hbai_dependent_child) now sacrifices none of their pay, the stage refuses a frame
without the flag, and the receipt counts them beside the people not asked who have no
pay. The stage spec's target population says so (Vahid's final review of #1663, and
María's reply of 19 November 2026).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The HMRC pay leaf (hmrc_spi_pay, which hmrc_spi_employed_income sums) came from
ADULT.INEARNS alone. Since #1663 a child whose CHILD.CHEARNS is above the personal
allowance pays income tax, so they counted as a taxpayer with no HMRC employment
income: out of the employment-income rows, or in too low an income band.
frs_hmrc_spine_leaves now declares and checks child.tab and takes a child-table
person's pay as max(0, CHILD.CHEARNS) * 52, as an adult's is max(0, ADULT.INEARNS) * 52.
It refuses a person on both tabs. The spec's retained constituent and the source
contract name both raw sources (Vahid's final review of #1663, and María's reply of
19 November 2026).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
draw_spi_bonuses' rule (BONUS_SACRIFICE_SPI_DRAW, and the stage spec's
spi_bonus_draw) has SPI-channel adults draw a bonus share of pay from base-FRS
adults, but its call passed every row. Since #1663 a dependent child's CHILD.CHEARNS
is their pay, so paid children joined the donors with no bonus and moved the pay
cells' edges, which set the adults' draws. Both masks are now gated on adult records
(not is_hbai_dependent_child). A child can't become a bonus-sacrifice candidate below
the upper earnings limit, so the fix moves only the adults' draws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
policyengine-uk 2.178.0 (pe-uk#2901) lets data carry the UK totals of the
components of its two share keys, corporate_sector_wealth and consumption, so a
simulation of part of the file (a region, an extract, a household subset) gives
each household its share of the national totals rather than of the part's own.

The release boundary now writes the fourteen uk_total_* household columns, each the
same on every row, as the component's sum at the frame's household weights, as
policyengine_uk.utils.uk_totals.uk_totals sums it (national_frame.uk_household_totals).
uk_dataset_year_frame sums them again at the weights the file stores, which
policyengine-uk projects by population as it projects the weights. Every release
writer and the graph's readback go through it.

The fourteen leave UK_ENGINE_DEFAULT_INPUTS, and the export surface allows them as
new since the reference build, which moves the gate battery's policy, manifest and
fingerprint and the release cut's part digests in the data contract. Engine tests:
the components and sums are policyengine-uk's own, and a household subset of a
written release keeps each household's UK share (María's call of 19 November 2026;
her ruling D-e on pe-uk#2896).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
María signed, for now, the ten inputs 2.179.2 adds that the build leaves at the
engine's default, and the restated uc_receives_new_claimant_health_element entry:
the three left-education routes, the four size-criteria and family inputs,
pip_phase_in_draw, housing_benefit_report_is_rate_rebate_only and, in the take-up
register, would_claim_student_loan. Each reason now ends with her signature of
19 November 2026, pending review, in place of the request for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juaristi22
juaristi22 force-pushed the uk-pe-uk-bump-2179-new-claimant-draw branch from b6c56eb to 41053d9 Compare November 20, 2026 13:31

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up at 41053d9, covering the six commits since my review at b3fb050: df8bdde79, b111fb0fa, eadf58035, 8c0e62e41, 713e0f05d and 41053d980. Paths are under packages/microcosm-build/src/microcosm/build/.

The child-pay fixes and the UK totals read well, and CI passes all 12 checks at this head. One request on the description and measurement, and one low point.

1. The description and the measurement predate these commits (medium).

  • Stale description:
    • "Not in this PR" still lists writing the uk_total_* columns, which 713e0f05d now does.
    • "The new inputs, signed at their defaults" still counts 24, including the fourteen totals. Ten remain.
    • "Signatures" still says awaiting. 41053d980 signs them pending review.
    • The three child-pay fixes aren't described.
  • Measurement: the arms ran at 9b89c7c45, before these commits. María's reply on #1663 (19 November) said the adult gate and the HMRC leaf "would move the build the final arm certified, so they go in a follow-up PR with its own measurement". They are now in this PR, together with the bonus-draw change, which moves adults' draws through the pay cells' edges.
  • Ask: could the head arm be rerun, or the moves reported? Specifically the bound hmrc.salary_sacrifice.* rows, the HMRC employment-income and taxpayer rows, and the bonus-sacrifice totals. If nothing material moves, a line saying so would do.

2. The UK totals are tested at the dataset year only (low). test_a_household_subset_of_the_release_keeps_its_uk_share reads 2024. policyengine-uk uprates each uk_total_* "like the column it sums, times population" (utils/uk_totals.py), while the weights project by population. A second read in a projected year, such as 2027, would check that the shares still sum to one there and that the subset still matches.

Checked, with no issues found:

  • Salary sacrifice (uk_runtime/salary_sacrifice.py):
    • predict_mask now excludes is_hbai_dependent_child, which frs_spine sets as ~adult_record, the child-table people.
    • Paid children who weren't asked are set to 0 and counted in the receipt.
    • A missing flag, or one that isn't boolean, is refused.
    • The SPI bonus draw's donors and drawers are adults only.
  • HMRC pay leaf (uk_runtime/frs_hmrc_source.py):
    • A child-table person's pay is max(0, CHILD.CHEARNS) * 52, the same as an adult's INEARNS.
    • A person on both tabs, a duplicate, or non-finite earnings is refused.
    • child.tab is a declared, identity-checked artifact.
  • UK totals (uk_runtime/national_frame.py, weight_year.py):
    • The release boundary writes the fourteen columns, and uk_dataset_year_frame sums them again at the stored weights.
    • Every release writer goes through both: graph_national, graph_terminal and full_build_cli.
    • The components match policyengine-uk 2.179.2's uk_total_columns().
    • The fourteen leave the defaults register.
  • Local runs:
    • The salary-sacrifice, FRS-HMRC-source, SPI-spine and engine-free weight-year files: 127 passed.
    • Both new engine tests on policyengine-uk 2.179.2: 2 passed.

Review drafted with AI assistance and checked against the code at 41053d9.

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.

2 participants