You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UK clone stages can number identifiers past the 32-bit range policyengine-uk stores #1194
id_multiplier_for_values (packages/microcosm-build/src/microcosm/build/uk_runtime/rowwise_geography.py) returns 10 ** len(str(max_id)). The UK clone stages add k * multiplier to every identifier of copy or arm k: cgt_structure (2 copies), cgt_residential_split (arm j per combination of liable gainers) and cgt_support. The only identifier range checks I found in the UK build are against int64 overflow.
policyengine-uk stores all five identifier variables as 32-bit integers (person_id, benunit_id and household_id already; person_household_id and person_benunit_id from PolicyEngine/policyengine-uk#2273), which hold whole numbers up to 2,147,483,647. The UK adapter (microcosm/frame/adapters/policyengine_uk.py) passes the tables to UKSingleYearDataset without renumbering.
populace_uk_2023.h5 already has identifiers up to 967,010,009 (person_id), so the multiplier is 10^9:
copy or arm 1: up to 1,967,010,009 (in range)
copy or arm 2 and up: 2,967,010,009 and more (out of range)
any stage that sizes its multiplier after a copy has passed 10^9 gets 10^10, so its copy 1 is already out of range
I have not measured a built frame; this is from the code and populace_uk_2023.h5.
Effect in policyengine-uk
The entity structure is built from the identifier arrays as given, so memberships stay right. The stored identifier values wrap: calculate("household_id"), to_input_dataframe() and UKSingleYearDataset.from_simulation return different numbers, and anything rebuilt from them may not match. After PolicyEngine/policyengine-uk#2273 the simulation gives an EntityIdWarning naming the columns. Once identifiers stay in range, that warning could become an error.
Suggested fix
Check in id_multiplier_for_values (or each clone stage) that the largest identifier after cloning fits 2,147,483,647, and renumber compactly where it would not. Alternatively, renumber in the UK adapter before simulating and map results back by position.
e9aa8d333 renumbers the identifiers at the release boundary. Each entity's identifiers become 1 plus the rank of the build identifier, so every stored identifier fits the 32-bit integers policyengine-uk uses. The build's identifiers ride along as person_build_id, benunit_build_id and household_build_id, and both readbacks refuse an identifier outside the range.
ac6088f2c makes the calibration measure the engine on the same identifiers, so the solve and the release agree on any engine read keyed on them.
The clone stages still number past the range inside the build. No engine read sees those identifiers.
Activity
juaristi22 commentedon Oct 15, 2026
Fixed by #1271, merged on 15 October (
71b9b8b).e9aa8d333renumbers the identifiers at the release boundary. Each entity's identifiers become 1 plus the rank of the build identifier, so every stored identifier fits the 32-bit integers policyengine-uk uses. The build's identifiers ride along asperson_build_id,benunit_build_idandhousehold_build_id, and both readbacks refuse an identifier outside the range.ac6088f2cmakes the calibration measure the engine on the same identifiers, so the solve and the release agree on any engine read keyed on them.The #1095 tracker ticks the item (uk-data#558).