Repository navigation
Read stored draws for UC, student loans and PIP - #2877
Conversation
Port policyengine-us's scanner for engine-time randomness and hash draws as a code-health test. EXEMPT lists the package's SHA-256 digests, which fingerprint, key caches or check content; RATCHET lists today's draws: the splitmix64 helper, the formulas and uprating that call it, and the seeded numpy draws in participation and two scenarios. Cases that need newer syntax are filtered at collection, so no Python reports a skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6H1FBndAKeuXdSGuft
The guard's docstring now says it looks for draws and not for the clock (#2875). The comments on the splitmix64 and Universal Credit entries say which constants the scan recognises, which entries reach the hash and how Simulation.__init__ applies the modifier. Two test rows follow PolicyEngine/policyengine-us#10447 at 221f2fe44, and a changelog fragment records the guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e reads it Define uc_new_claimant_health_element_draw, pip_phase_in_draw and would_claim_student_loan as yearly inputs with no formula, and register them with the supplied-input helpers. supplied_input_periods, and with it supplied_by, latest_supplied_input_period and supplied_input, now count a recorded key only when its branch is the one core reads for the period and the tier core reads there still holds the input. latest_supplied_input_period ranks with core's _latest_input_key. set_model_value refuses the three new columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6HUE9hj2BPEjEXLL68
input_source(population, name, period) names the supplied input policyengine-core reads for a registered draw, returns None where none reaches the period, and raises for anything else. In a simulation built from data, Simulation.calculate applies it before core, drops the request's fast-cache entry, and checks core's answer against the source after. calculate_add, calculate_divide and calculate_output refuse a draw, and each counts as a running calculation. set_input refuses a new draw while a calculation runs or a derived value of the draw is stored, and checks would_claim_student_loan's raw values before core casts them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6HUE9hj2BPEjEXLL68
…cenario Each consumer asks input_source whether a stored input reaches the year. The UC rebalancing modifier compares uc_new_claimant_health_element_draw, promoted to float64, with the new-claimant share; the PIP scenario does the same with pip_phase_in_draw and the phase-in share; student loan uprating uses the stored would_claim_student_loan decision after checking its raw values. Without the column, each runs its existing seeded draw, inline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6HUE9hj2BPEjEXLL68
…e core versions The core Dataset route refuses a dataset carrying a stored column whose person, benefit unit or household identifiers do not survive the int32 cast, and one whose stored columns or exempting outcomes are supplied for a later period but not the first, or whose draws change between periods, before it exports anything. A code-health test fails when uv.lock or the installed policyengine-core holds a version outside the qualified set, and another fails on any package read of a stored draw that skips calculate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6HUE9hj2BPEjEXLL68
…eachable branch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6HUE9hj2BPEjEXLL68
…umers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6HUE9hj2BPEjEXLL68
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
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; standard reform costings (change in gov_balance); standard reforms: change in each reform's target. Checks failing on both base and head (1)
Counted-once checkThe check raised each of 92 components by £1 per unit in 2026-27 and read every head of its totals 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 response that is not finite breaks every rule. The check measures a head that breaks a rule twice more: once holding every other head at its baseline value, and once holding every other head at its value after the first £1 while the component rises again. The head fails where either measurement still shows the response. The check cannot hold a head at a value that is not finite. In each unit where another head is not finite after the first £1, it holds that head at its baseline value, and the second measurement judges no household the unit belongs to. There a head fails wherever it first broke a rule, or wherever the check could not confirm whether its response contains the component. 0 failed and the check skipped 0.
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
|
juaristi22
left a comment
There was a problem hiding this comment.
Review status: COMPLETE at 5a784a7e926d4bc5b1471770ae67d4f96f139140. No findings or material evidence gaps.
Independent code/test and policy/source review covered the stored UC health and PIP draws, student-loan take-up, supplied-input precedence, provenance/cache/lifecycle checks and Core Dataset routing. The change introduces allocation inputs rather than new statutory rules.
Validation: 202/202 focused repository tests passed on the lock-matched Core 3.34.1 environment, plus one synthetic final-output/order check. The stored UC draw changes LCWRA, final Universal Credit and household net income by the same £2,550.48; reversing calculation order gives identical results. The unchanged #2873 randomness guard was checked byte-for-byte against its prior reviewed head; its earlier 384 passes were reused, not rerun or added to the 202 count. All 20 hosted checks currently pass at this exact head.
Equivalence remains conditional on the supplied reference decisions and covered thresholds. This review does not certify producer calibration, private datasets, population effects, arbitrary-share float64 equivalence or the author's full dual-Core-version/mutation totals. The disclosed shadowed-input/carry-ranking changes and seeded fallback boundary remain explicit.
Approval withheld: this PR is still a draft and its description requires #2873 to land first. The completed review can be reused when readiness, parent integration and exact-head checks are reassessed.
Main gained Simulation.subsample and policyengine_uk/utils/subsample.py through #2308 on 9 November, after this branch's last CI run. The guard scans the whole package, so the merge queue ran it over that code and removed #2873 for a failed check on 11 November. The merge has no conflict: main does not touch the guard or its changelog fragment. On the merged tree the guard reports eight draw patterns, all in the subsample code; the next commit handles them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On main's code the guard reports eight draw patterns, all in the subsample tool that #2308 added. Five sit in policyengine_uk/utils/subsample.py, where it hashes the seed, makes a generator and draws households. The other three are the calls that reach them, in draw_household_counts, subsample_simulation and Simulation.subsample. This commit lists the eight in a third allowlist, SAMPLING_TOOLS. The two package tests allow RATCHET and SAMPLING_TOOLS summed per key. draw_helpers still reads EXEMPT alone, so the tool's functions stay draw helpers and a use of one from any other scope counts there as a draw helper call. RATCHET, RATCHET_CEILING, EXEMPT and the scanner do not change. Four new guard tests pin the list. The tool's three functions are draw helpers. A formula that uses a listed sampler fails. The list names only the subsample tool and shares no key with RATCHET or EXEMPT. No package module uses an attribute named subsample, because the scan does not follow method calls. A new test in test_subsample.py checks that the draw neither reads nor moves numpy's or the standard library's global random stream. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
697529b merges main 74db8b6 into #2873's guard branch and adds the SAMPLING_TOOLS allowlist for Simulation.subsample's draw. It brings main's rewrite of policyengine_uk/utils/supplied_inputs.py (#2308, 3e45f83 and 42414bd) and the move to policyengine-core 3.34.9 (#2897). supplied_inputs.py stopped on three hunks. Each takes main's side: 1. The supplied_input_periods docstring. 2. Its filter: main's _supplied_without_reading, which counts a recorded input that Holder._stores_user_input finds in either tier, and reads a value only where the model stored one (set_model_value). 3. supplied_input: main's walk over _visible_branch_names, returning the nearest branch's surviving recorded input, as core's Simulation._get_recorded_input_array does. Git kept both sides' _supplied_value_storage and stored_supplied_value, since neither existed at the merge base. Python binds main's later pair, so here #2877's _counted_input runs on main's tier rule. The next commit gives #2877's tier helper its own name and leaves one definition of each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge kept two copies of _supplied_value_storage and stored_supplied_value, and Python bound main's, so #2877's _counted_input quietly ran on main's tier rule. The two copies answer different questions: - Main's (from #2308) counts the recorded input: a surviving input in a tier where Holder._stores_user_input finds it, memory first, on the nearest branch that still stores one. Core's Simulation._get_recorded_input_array and _get_set_input_periods use the same rule, and main tests its helpers against them. supplied_input, supplied_input_periods, latest_supplied_input_period, supplied_by, stored_as_input and stored_supplied_value keep it. - #2877's counts the input a calculation reads: only on the branch Holder._branch_storing names, only in the tier the engine reads there (memory before disk), and only for a key the simulation records (policyengine_core.holders.helpers._is_input). stored_draws.input_source names, through _counted_input, the input Simulation.calculate will read, and check_draw_answer then compares core's answer with it. So _counted_input keeps #2877's rule, under its own name, _engine_read_storage, and main's copies are the only stored_supplied_value and _supplied_value_storage. The module docstring now says which reader uses which rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two of #2877's four tightening tests asserted the engine-read rule on the general helpers, which now keep main's recorded rule. They assert it on _counted_input instead, and assert main's rule on the general helpers beside it: - test_a_child_branch_value_over_a_parent_input_is_not_supplied_on_the_child becomes ..._is_not_counted_on_the_child. - test_an_input_on_disk_counts_only_when_memory_does_not_hide_it splits: the memory_cache=False case (both rules agree) becomes test_an_input_on_disk_counts_when_memory_holds_nothing, and the True case becomes test_an_input_on_disk_under_a_memory_cache_is_supplied_but_not_counted. The other two, where both rules agree, are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Hypothesis test over sequences of set_input, put_in_cache, set_model_value, deletions, writes to disk, calculations and get_branch checks, on a branch and a child made at any step: the general helpers against core's _stores_user_input, _get_recorded_input_array and _get_set_input_periods; _counted_input against Holder._is_input and Holder.get_array; and that supplied_input returns every value _counted_input counts. An example test covers a neutralised variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
core#653: Population.get_holder gives a holder the current definition when its entity and ETERNITY storage match. Rewrites the two tests that assumed otherwise, and adds tests for the stale holders core still keeps: one from an ETERNITY definition (public API; the request check refuses it) and one of another entity (set directly; the holder's-definition check refuses it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each draw and the stored student loan decision read after a subsample equals the kept record's stored value, in each stored year and carried into 2027, on the simulation and on a branch made after it, and input_source names that input with the sequence number core records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Building the simulation already makes the draw's holder under its year definition, so updating the system to an ETERNITY definition left that holder in place and the test's first assertion failed on core 3.34.9. apply_reform drops a holder whose ETERNITY storage no longer fits, and the next lookup makes one for the ETERNITY definition. Restoring the year definition on the system directly then leaves that holder, and the request check refuses the read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main locks and requires core 3.34.9 (#2897). The four files the version gate names pass on 3.34.9 at this head. 3.33.3 and 3.34.1 leave the set: this branch requires 3.34.9 and has not run the four files there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Simulation.build_from_populations keeps another simulation's entities, so get_holder gives an adopted holder that system's definition while this simulation's own definition stays current. The new test adopts a holder whose reform makes the draw an int and checks that calculate refuses it. The property test's example of an input on disk under a cached value now caches a non-derived value, since core stores no derived value over an input. The core version gate lists test_supplied_inputs.py and test_subsample.py among the files to rerun on a new core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On core 3.34.9 a holder takes on a neutralised current definition (core#653), so test_a_neutralised_draw_raises trips both halves of the neutralised check at once and nothing tested either half alone. The new test adopts a holder through build_from_populations with a neutralise reform on one side, then the other, and expects each to raise. Also notes in check_both_rules that the holder._is_input comparison checks consistency, and the get_array equality is the independent check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
juaristi22
left a comment
There was a problem hiding this comment.
Reviewed be2b70e691a6b67b9857245f7389cbfa46ece2d6: COMPLETE, no findings or material evidence gaps.
The follow-up covers the supplied-input rewrite, Core 3.34.9 holder/adoption semantics, provenance and carry refusals, neutralisation on both sides of adoption, and stored-draw subsampling. Parent #2873’s merged head 697529ba5 is integrated; this approval follows the new review rather than transferring an earlier one.
Validation: 215 repository tests passed, plus three synthetic contracts through final UC/PIP/student-loan consumers. Snapshot imports, 17 selected lock pins and all 194 Core payload files matched; formatting/lint and diff checks passed. No private data, installation or full-main suite was run. Statutory policy review is inapplicable to this engine infrastructure change.
The current-head required checks and readiness were refreshed immediately before approval.
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>
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>
Addresses #2874
axiom: n/a: microsimulation-only: stored inputs for engine draws, no rule changes
This branch merges #2873's head 697529b, which carries main at 74db8b6, so it brings main's supplied-input rewrite (#2308) and policyengine-core 3.34.9 (#2897). #2873 merged into main as f6b7fbd, and the branch merges with main at b007ac8 without conflicts.
What and why
Three new yearly inputs, with no formula:
uc_new_claimant_health_element_draw(benefit unit, float, default 1.0): a uniform in [0, 1) that the dataset build stores. In each Universal Credit rebalancing year with no status for the year,add_universal_credit_reformgives a benefit unit the new-claimant LCWRA rate when the draw falls belownew_claimant_share.pip_phase_in_draw(person, float, default 1.0): the PIP phase-in scenario removes a person's PIP in a year from 2025 to 2029 when the draw falls below that year's share.would_claim_student_loan(person, bool, default False): the stored take-up decision thatuprate_student_loan_plansuses for new borrowers.Each consumer uses the stored input when the dataset supplies it and runs its own seeded draw, unchanged and inline, when it does not. The UC modifier and the PIP scenario ask
input_sourcewhether a supplied draw reaches the year, read it throughSimulation.calculate, and compare it with the share in float64. Student loan uprating reads the column from the projected table after checking its raw values. No published dataset carries these columns yet, so outputs on today's data change only wherelatest_supplied_input_periodnow ranks two earlier periods differently (below).Reading a stored draw
utils/stored_draws.pyregisters the two draws with their entity, value type and definition period.input_source(population, name, period)returns the period, branch, tier and sequence number of the supplied input policyengine-core reads, None where no supplied input reaches the period, and raises otherwise. It changes nothing in storage and returns no array. It refuses:year:2026:2,month:2026-06:12,year:2025-01-15);defined_for,calculate_output,adds,subtractsorrequires_computation_after; a neutralised or abolished draw; core's macro cache; carry turned off where the read needs it;In a simulation built from data,
Simulation.calculateruns the check after its input-lifecycle and stale-record cleanups and drops the request's fast-cache entry. For a source-backed draw it calls core withmap_to=None, checks that core's answer equals the source's array (same dtype and shape) and that the source has not changed, then maps it.calculate_add,calculate_divideandcalculate_outputrefuse a registered draw. A context variable counts running pe-uk calculations on any simulation, andset_inputrefuses a new draw while one runs or while the holder stores a derived value of the draw. Situations keep core's path.Supplied-input helpers
SUPPLIED_INPUT_VARIABLESnow holds the three new columns, andset_model_valuerefuses them.latest_supplied_input_periodnow ranks with core's_latest_input_key, so of the supplied periods before the request it picks the one core's carry-over would pick: a period of the variable's own unit before one of another unit, and of two that start on one day, the one that ends last (test_latest_supplied_period_matches_core_carry_order;test_two_periods_starting_on_one_day_rank_by_core_ordershows the tie).The general helpers (
supplied_input,supplied_input_periods,latest_supplied_input_period,supplied_byandstored_supplied_value) keep main's rule: they count the nearest branch's surviving recorded input, in a tier whereHolder._stores_user_inputfinds it, as core's_get_recorded_input_arrayand_get_set_input_periodsdo. The formulas and scenarios on main that call them, includingadd_universal_credit_reform's check of a supplieduc_LCWRA_element, get the same answers as on main, apart from that ranking.stored_as_inputalso keeps main's code, which asks core'sHolder._is_input, so it reads only the first tier that holds the slot.input_sourcenames the input a calculation reads, so it counts a recorded key through_counted_inputand its tier helper_engine_read_storage._counted_inputcounts the key only on the branchHolder._branch_storingnames for the period, and only while the tier core reads there (memory before disk) holds the input as core's_is_inputdecides. The two rules part in two cases, and in each one core'scalculatereads another value:_counted_inputcounts nothing on the child (test_a_child_branch_value_over_a_parent_input_is_not_counted_on_the_child);_counted_inputcounts nothing (test_an_input_on_disk_under_a_memory_cache_is_supplied_but_not_counted).The two rules also part on a key the simulation never recorded. The general helpers pass only recorded keys, so main's
_supplied_value_storagedoes not check the record, and with no location record for a slot it takes either tier.input_sourcepasses the key of the branch core reads, recorded or not, so_counted_inputneeds core's_is_input, which checks the record. At the merge commit 0e75f18, Python bound main's copies of_supplied_value_storageandstored_supplied_value, so_counted_inputcounted a non-derived value no one supplied. There, on core 3.34.9,test_a_non_input_carry_source_raisesandtest_a_child_branch_value_over_a_parent_input_raises_on_the_childfail becauseinput_sourceraises in neither case, and both pass after the split.The core Dataset route
Before it exports,
Simulation.build_from_datasetrefuses a dataset that carries any stored column (the UC deduction draws,months_since_last_birthday,warm_home_discount_random_drawand the three new columns) when any person, benefit unit or household identifier fails to survive the int32 cast, naming the entity and identifiers. It also refuses a dataset whose stored columns,attends_private_school_random_draw,uc_receives_new_claimant_health_elementorattends_private_schoolit supplies for some period but not the first, or whose draws change between periods. None of pe-uk's own core-route fixtures carries such a column, so the route refuses none of them.Core versions
QUALIFIED_CORE_VERSIONSrecords 3.34.9, the version main locks.tests/code_health/test_core_version_gate.pyfails whenuv.lockor the installed core holds another version, and says what to rerun before adding one. It readsuv.lockfrom the source tree or the directory the tests run from, so it runs without a skip when CI tests the built wheel.In core 3.34.9 (PolicyEngine/policyengine-core#653),
Population.get_holdergives a kept holder the current definition when its entity and ETERNITY storage match, so a draw read afterupdate_variablefollows the current default.test_a_cached_default_is_compared_with_the_default_the_holder_followsandtest_a_holder_given_another_definition_follows_the_current_onecheck that. Core keeps a holder whose ETERNITY storage no longer fits, as when a reform gives the draw ETERNITY storage and code then restores the year definition on the system directly, and the request check refuses it (test_a_holder_core_keeps_from_an_eternity_definition_is_refused). The holder's-definition check refuses a holder thatSimulation.build_from_populationsadopts from a simulation whose system gives the draw another type: core'sPopulation.clonekeeps that system's entity, soget_holdergives the adopted holder that system's definition while this simulation's own stays current (test_a_holder_adopted_from_another_system_is_refused). The neutralised check reads both definitions, so a neutralised definition on either side refuses the read (test_a_neutralised_definition_on_either_side_of_an_adoption_is_refused). When the other system moves the draw to another entity, core's own entity check refuses the read first, so the test of a holder of another entity sets one directly (test_a_holder_kept_with_another_entity_raises).Invariants
input_sourcebefore core and the answer check after; ADD, DIVIDE and output refuse draws; the fast cache never answers one._stores_user_input,_get_recorded_input_arrayand_get_set_input_periods(property test)._counted_inputcounts a key exactly when the simulation records it,Holder._is_inputholds on the branch core reads, and the model did not store the value; each counted value equalsHolder.get_array's and, for a variable that is not neutralised,supplied_input's. For a neutralised variable_counted_inputstill counts the input whileget_arrayreads the default, andinput_sourcerefuses a neutralised draw first (example test).Simulation.subsample, each draw and stored take-up decision reads as the kept record's value in each stored year and the year after, on the simulation and on a branch, andinput_sourcenames that input with the sequence number core records.Test plan
test_supplied_input_tightening.py: registration, ranking (with a Hypothesis property against core's order),_counted_input's rule beside the general helpers' rule, and theset_model_valuerefusal.test_stored_draw_input_source.py: provenance, requests, definitions (with the holders core 3.34.9 keeps), disk tier, dispatch, setter, lifecycle, restore and the differential against core's owncalculate.test_stored_draw_consumers.py: each consumer with and without its column, precision, precedence, validation and properties.test_stored_draw_core_route.py: identities for each entity, supplied periods, and the with/without differential on both routes.test_supplied_inputs.py: a property test of both rules against core on a branch and its child, and a neutralised example.test_subsample.py: stored draws afterSimulation.subsample.code_health/test_core_version_gate.pyandcode_health/test_stored_draw_reads.py(no package read of a draw skipscalculate).At c353315 on core 3.34.9, one process per file or directory:
test_input_records.py,test_subsample.pyandtest_supplied_inputs.pygave 15, 63 and 66 passed;supplied_inputsorstored_drawsgave 592 passed, 0 failed;policyengine_uk/tests/code_healthgave 3785 passed and 1 failed.test_check_fix_pr.py::test_pytest_default_collection_confirms_function_and_class_namesrunspytest.mainwith plugin autoload off, so it rejects the run'sPYTEST_ADDOPTS="-n 0"; with that variable unset,test_check_fix_pr.pygave 168 passed;uc_receives_new_claimant_health_elementoruc_LCWRA_element, which the UC modifier sets, gave 154 passed, 0 failed underpolicyengine-core test. No YAML test names the three draws.402197bf5addstest_a_holder_adopted_from_another_system_is_refused, makes the disk-under-cache example of the property test intest_supplied_inputs.pycache a non-derived value (core stores no derived value over an input, so the old example built nothing), and addstest_supplied_inputs.pyandtest_subsample.pyto the files the version gate says to rerun on a new core. At402197bf5,test_stored_draw_input_source.pygave 66 passed,test_supplied_inputs.py66 andcode_health/test_core_version_gate.py3. CI at that head passes all 21 checks: the Test workflow run plus Aggregate impact, Changelog fragments and Fix evidence.be2b70e69addstest_a_neutralised_definition_on_either_side_of_an_adoption_is_refused, which tests each half of the neutralised check alone, and notes intest_supplied_inputs.pywhich of its checks is independent of core. It changes no package code.ruff format --check,ruff check,ruff check --select F811,F821 policyengine_uk(ruff 0.17.2),git diff --checkand.github/check_fix_pr.pypass. Before this merge, at 5a784a7, mutations of each refusal, of each consumer's float64 promotion, of the fast-cache eviction, of theset_model_valuerefusal, of both core-route checks, of #6's validation and of its loader each failed a test; this branch has not rerun them.Differentials
A grid of hand-built households for 2025 to 2027 stores each draw column in every year, in 2026 only, or not at all, and reads the draws and the UC status on the default branch and on a branch made from it (named reform, with no reform applied), and
uc_LCWRA_elementand PIP after the phase-in scenario on the default branch. A second set projects a 2025 dataset with student loan take-up absent, legacy, all true and all false. #2877's head (5a784a7) on core 3.34.1, and c353315, whose package code this head keeps, on 3.34.1 and on 3.34.9, agree on all 861 values, with no errors at any point.After
Simulation.subsample(n=4, seed=2)on a data-built fixture with both draws and take-up stored for 2025 and 2026, each read equals the kept record's stored value in 2025, 2026 and 2027, on the simulation and on a branch made after it, andinput_sourcenames that input with the sequence number core records (test_stored_draws_follow_the_records_a_subsample_keeps).What later stages finish
Stage 2 adds protected storage and sealed populations, with a storage check inside
input_source. Phase 2 fails closed: it removes the seeded fallbacks, registers the other required draws and outcomes, and addsmonths_since_last_birthday's answer check and inclusive lookup.Generated by Claude Code