Repository navigation
UK stock cells: homes and the land under them in England and Wales (#1524) - #1597
Conversation
Five modules under microcosm.build, for the stock table of homes and its land values. None changes an existing file. - pinned_inputs: Chronicle manifest files, the pin check, the registration record and a manifest's licence fields. The pin check and registration are the home-stock builder's own code, which moves onto them next. - weighted_quantiles: weighted quantiles and grouped knots, moved unchanged from the home-stock library, plus the mean the knots imply and the knots contract a quantile reader needs. - cell_pooling: levels by value rank against quotas (the residual prototype's proxy bands, with a key tie-break), stratum weights, pools, fallbacks that never leave their parent, and allocation shares. - residual_land: unit cost, depreciation scaled to a target mean, the pooled and rank residuals, the cost level for a total and for a ratio (both solved exactly), scale-cap-rescale, Spearman's correlation, the log-ratio flags and checked convex means. - derived_resource: one JSON rendering with a table's rows one per line, payload and row digests (rows_sha256 keeps its bytes), and the reasons a committed file is stale. Tests in engine_free/shared: Hypothesis properties for each, and the moved quantile code checked bit for bit against the library's code as it stood at a575057. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UK high-value home stock library delegates to the new modules and gains what the stock cell builder shares with it. No committed resource changes: the library's outputs are the same arithmetic, checked bit for bit, and the tool that writes the resources is untouched. - Knots: value_knots calls weighted_quantiles.grouped_knots; AreaKnots and _weighted_quantiles are the shared class and function. - Digests and pins: rows_sha256 and sha256_of_file come from derived_resource and pinned_inputs. - dwelling_key, extracted from the Price Paid reduction, so a file linked to Price Paid (UCL's) can rebuild the same key. A golden test pins its values: they are pandas' hash, which no cache key records. - dwelling_stock(..., include_support_row=False): with it, the table also carries each dwelling's output-area row in the support. - dwelling_cache_name adds the NSPL's sha256 to the cache name, since the cached postcode_row indexes the NSPL. resolve_dwelling_cache reuses a cache under the old name only when the NSPL is the one the committed stock records: the 13 October cache, whose old name the Price Paid manifest reproduces. - build_dwelling_table and tenure_shares (now with a level, for the MSOA tenure chronicle#438 asks for), copied from the tool. The plan's rebuild check of the home-stock resources needs the raw Price Paid, HPI and VOA 2025 files and the 735820c feed, none of which is on this machine. So, as the plan says, the tool's half of this step is held back: tools/build_uk_high_value_home_stock.py keeps its own pin, tenure and cache code, and a test holds the library's copies equal to it. The tool's half waits for that check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four uk_runtime modules, each loadable by file path, so the builder tool can use them before its resources exist. None reads survey microdata. - voa_stock_tables: CTSOP 1.1 band counts, CTSOP 3.1 type shares and CTSOP 4.1 build periods, from the 2026 members (the zips renamed them). [z] reads as zero and [c] as a declared value, counted. The 43 type columns group by declared rules into D, S, T and F: bungalows split by the house mix (row, then area, then authority), other types spread over all four, and a column no rule matches is refused. Each row must add up to all_properties within VOA's rounding, so a missed or doubled column fails here. - ucl_price_paid_epc: UCL's linked file streamed from the zip inside bundle 1 through a window on the bundle, so nothing is extracted. Only the declared columns are read; each dwelling keeps the latest linked sale with a usable floor area and, separately, age band. The join is the rebuilt dwelling key, or the transaction id when the file has no address. Bundle 2's certificates give social rented cells by authority, type and age band, one certificate per building. The readme is read for the discover stage. No address leaves the module. - land_reference_facts: TPA's constants parsed as syntax, never run; TPA's land shares as ratios of totals; MHCLG's land per new home; Market Value Survey means; England's and Wales's Band D and England's tax base; EPC D3 floor areas with recoded councils counted once; the feed, then parameter, then absent resolution of ONS's level inputs; the feed-input fingerprint. - stock_cell_declarations: data only. The pooling (MSOA × band, minimums 30 sold homes for means and 100 for knots), the 13-point grid, EPC age bands, UCL's column names (unverified until discover runs), depreciation profiles (ONS's dwelling profile is not verified), the level inputs, the variants, the decision rule and the measurements. Tests on synthetic files: zip-in-zip stored and compressed, the transaction-id join, CTSOP markers and rounding, TPA constants in a file that would fail if it ran, and the declarations' consistency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ocosm#1524) tools/build_uk_stock_cells.py builds the stock table of homes in England and Wales and the land under them, from public data only. Stages: discover (UCL's readme and every header against the declared columns), dwellings (the home-stock builder's cache, reused when its NSPL matches), attributes (UCL's two bundles streamed into caches), cells and all. --variants, --check, --built-on and --threads as the plan sets out. The cells stage, in order: - homes placed through the committed support, each with its output-area row, and joined to UCL's floor area and age band by dwelling key; - VOA's counts by MSOA × band, its type shares and build-period mix; - social homes per authority by the home-stock rule (VOA all properties × TS054's social share), spread over MSOAs by TS054 by MSOA when the feed carries it, else uniformly, with the status recorded; - bands by value rank within MSOA × type against the private quota, and stratum weights; - the value block: VOA count, private and social counts, homes sold, the owner share, the mean value and 13 knots, each with its fallback level (authority, region, nation × band) when a cell has too few sales; - the structure block under each variant: floor area, TPA's relative cost and regional factor, the retained share, the unit cost and costs and values by value decile; social homes from the certificates; - the level: κ for target (a) and (b), each input from the feed, then a stated parameter, then absent. Without ONS's figures it runs at κ = 1 and with depreciation off, and says so; - rollups by authority and constituency for every variant, MHCLG's pattern (scaled, capped at value, rescaled), the decision rule, the three measurements and the other recorded comparisons. Wall time and peak memory go to a run log in the cache folder, not to the committed receipts, so a rebuild stays byte for byte. The Isles of Scilly take Cornwall's MHCLG values in the central case, as the issue says; the plan's Scilly variant becomes the one that leaves it without a value. The end-to-end test synthesises every input with pinned manifests: two builds from empty caches write the same bytes, --check passes and catches an edit, and the outputs hold the invariants (knots contract, land within value, land falls as κ rises, cells sum to authorities and authorities to constituencies, MHCLG's pattern keeps England's total, no address). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The discover stage on VOA's 2026 files confirmed CTSOP 3.1's 43 type columns and CTSOP 4.1's 30 periods. The two age scales meet only in places (VOA skips 1940 to 1944, and its 1993-1999 straddles the EPC's 1991-1995 and 1996-2002), so the post-stratification variant now uses declared groups that hold VOA's periods and the EPC's bands together, and the tool refuses a period in no group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sors (microcosm#1524) An energy certificate, or an EPC D3 quarter, from before a council merged names the old council. EPC D3 in the feed prints the 2020 to 2023 codes with their names (Buckinghamshire, the Northamptonshires, Cumberland, Westmorland and Furness, North Yorkshire, Somerset); the declarations add those and the 2019 changes as predecessors of the April 2023 roster's councils. - Social certificates map through the predecessors as well as the recoded aliases, and the cache key covers that mapping. The build records any certificate whose council is still off the roster. - EPC D3's mean floor area adds a merged council's quarters to its successor, while a recoded council still counts once per quarter. - The value block carries each MSOA's authority and region, so the rollups can be checked from the committed files alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The discover stage on bundle 1 (readme sha256 3d65cc41…e710) showed two things the declarations had guessed wrong: - ReShare keeps each bundle's files in a folder named for the bundle (856542_bundle_1/tranall_link_02122023.zip), so a member is now found by its file name when it is not at the top. - The linked file's floor area is the EPC's TOTAL_FLOOR_AREA. Its 107 columns carry Price Paid's fields in lower case (postcode, paon, saon, transactionid, dateoftransfer) and the EPC's in upper case, so the join on the rebuilt dwelling key stands. The synthetic bundles in the end-to-end test now use the same layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m#1524) The tool's half of the earlier library move, held back until the plan's rebuild check could run. tools/build_uk_high_value_home_stock.py now uses pinned_inputs for its manifests, pin checks and registrations, the library's tenure shares and dwelling table build, and the cache named for the NSPL it indexes (the 13 October cache stands in, since its NSPL is the one the committed stock records). Its old private names stay as aliases. METHOD_VERSION and VOA_CSV_MEMBER are unchanged. The check: the four committed resources (high_value_home_stock_facts.json, high_value_home_value_knots.json, high_value_home_stock.provenance.json and price_paid_property_support_bounds.json) were rebuilt from the pinned Price Paid, HPI, NSPL and VOA 2025 files with --built-on 2026-10-13, once with the tool as it stood and once moved. Both rebuilds equal every committed byte. The feed was 80a3482's, which carries the stock's inputs with the fingerprint recorded for 735820c (0547b04e…), with a manifest giving 735820c's identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first pass over UCL's certificates (25,449,991 read, as its readme says) deduplicated by UPRN, so every certificate without one shared the empty id and all but one were dropped. Only a certificate with a building id can repeat now; one without counts once, and the receipts count them. The social cache key names the rule, so the earlier cache is not reused. Both bundles' headers match the declarations, so UCL's columns record the readme they were checked against (3d65cc41…e710). The certificates spell their social tenures "rental (social)" and "Rented (social)", as declared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Chronicle manifests for Price Paid, the UK House Price Index and the NSPL (chronicle#349) carry no licence fields, so the stock cell builder refused them. licence_of now takes an optional declared licence for a manifest that states none, and records which of the two it quotes in license_source. A manifest's own licence always wins; a manifest that states some licence fields but no licence is still refused. The declared text is the licence and attribution the high-value home stock builder already states for these inputs (reviewed in #1240). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (microcosm#1524) The net and gross capital stock of dwellings now name the facts that chronicle#439 registers: MJF8 and MJF7 for 2024 under ons.capital_stocks2025. Until the pinned feed carries them, the build takes them as stated parameters, as it does E46Y. The builder also refuses a feed that carries a level input's source concept for its period in no fact the declaration selects (another spec prefix, or dimensions). Before, it fell back to the parameter without a word, and the re-pin test could not see it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cosm#1524) The five resources come from the build of 12 November 2026 on Chronicle feed 80a3482. They are registered in country_package.json and read through uk_runtime.stock_cells. ONS's E46Y and its net and gross capital stock of dwellings for 2024 are stated parameters, read from the workbooks that PolicyEngine/chronicle#439 pins, until the pinned feed carries them. With depreciation scaled to one less net / gross (0.455), target (a) solves at κ = 0.795, and all three parts of the decision rule pass. --check rebuilds the five files unchanged. The land side (the structure block, both rollups and the provenance) leaves the solve fingerprint as solve_scope.UK_POST_SOLVE_RESOURCES; the value block stays in. The invariant tests read the committed files alone; the feed-gated one also passes on feed 80a3482. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/uk-stock-cells-land-1524.md sets out the inputs, the method, the variants, the decision rule and the measurements, then the results of the committed build: κ = 0.795 (0.882 under target (b)), £7.24tn of land under £9.48tn of homes, all three rules passed, authority shares enough by the grain test, and the stock-value measurement failed in England and three regions. The changelog fragment records the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sm#1524) TS054 prints social renting from the council and other social renting as two rows under one spec id, told apart by their labels. tenure_shares kept only the last, so England's social share read 8.8% instead of 17.1% (Wales 7.8% instead of 16.5%), and the owner share of the private stock 0.672 instead of 0.740. It has done so since the high-value home stock's first build (#1240), and the stock cells inherited it. The shares now sum every row of a category. The same row twice is refused, and an area that carries every category must add up to its households, within 0.1% (Scotland's census perturbs its cells). The committed home-stock and stock-cell resources still carry the old shares until they are rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1524) The check took the Market Value Survey's private-sector mean as the plain average of its owner-occupier and private-renter means. Owner-occupied homes are worth more and are most of the private stock, so the benchmark was too low. It now weights the two means by the private stock's owner-occupied share in the same cells, and records that share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review of Must
Should
Nit
Checked and fine
CI at Verdict: the builder, the checks and the provenance are carefully put together. Item 1 changes every result in the note, though, so rebuild before the decision rule or the measurements are read. Then rerun item 2's check against a weighted survey mean. 🤖 Generated with Claude Code |
…ome stock (PolicyEngine/chronicle#439, microcosm#1524) The pin moves to 4ce631f5, the merge of PolicyEngine/chronicle#439: ONS's dwellings by sector, its capital stocks of dwellings and Census 2021 TS054 by MSOA (66,230 rows, 2,160,233 in all). The artifact is built from 4ce631f5; the merge adds no file to #439's head. The same change rebuilds the high-value home stock with both TS054 social-rent rows summed (4baabb2). Its private-sector counts fall by 10% to 12% (England's homes over £2 million from 193,201 to 169,605), and the stock's feed-inputs fingerprint is recorded for this feed. Every surface regenerates in the order docs/uk-chronicle-feed-repin.md gives: - the vendored resources (pin stamps only); - the DESNZ constituency resource (same 2,526 values); - the national references (only the three regional high-value homes targets move); - the local references (ten authority cells fall below the hvcts_la_household_floor and are deferred); - the local census; - both compile-parity receipts (only high-value homes rows move); - the coverage manifest; - the charter-H2 fixture (22 stage contract hashes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every level input now comes from the pinned feed: E46Y for 2024 and 2021, and ONS's net (MJF8) and gross (MJF7) capital stock of dwellings. Social homes spread over MSOAs by Census 2021 TS054 by MSOA, with both social-rent rows counted. κ (target a) is 0.807 and target (b) gives 0.880. All three parts of the decision rule pass, authority shares are enough by the grain test, and the stock-value check passes: England is +1.3% against the survey's private-sector mean weighted by tenure. Land is £7.08tn under £9.33tn of homes. --check rebuilds the five files unchanged. The methods note gives the new results and records why the earlier build failed the stock-value check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rebuilt high-value home stock puts ten more authority cells under the 400-home floor of microcosm#1301: 608 deferred, not 598. The local target surface keeps 27,157 candidates, not 27,167, and 4,190 signed deferrals and absences, not 4,180. The total of 31,347 references is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sm#1524) From the microcosm#1597 review. scale_cap_rescale scaled the free entries by remaining ÷ mass. When the free mass was subnormal, that overflowed: an entry was capped at its full cap, and the result added up to more than the total. Each free entry now takes its share of the free mass, which is at most one, and a negative remaining total is refused. convex_mean made its weights shares before multiplying, so value × a subnormal weight cannot underflow to zero. The builder's MHCLG pattern is the only caller of scale_cap_rescale, and its £ totals are far from that range. The property test's patterns are now zero or at least 1e-3, because the proportionality check cannot hold for subnormal entries. The two cases from the review are now fixed tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NS's (microcosm#1524) From the microcosm#1597 review of 0c7e68b, items 4, 5 and 7. - Item 5: the grain test now measures how much of a land tax at the rate that balances council tax falls on other cells under an authority share × cell value than under cell land: 50 × Σ|difference| ÷ council tax, over cells nationally and over each seat's cells. Before, it compared how much each pattern moves from council tax. Two patterns can move the same amount to different cells, so that could not see where the tax falls. The thresholds stay as fixed before the builder ran. The reading is now "cells are needed": 3.26 points against 3 nationally, and 92.3% of seats within 5 points. The amount each pattern moves, and how far seat totals differ, are recorded beside it. - Item 4: also_recorded.land_against_ons replaces household_land_against_e44n. Under targets (a) and (b), it gives the land under owner-occupied, privately rented and social homes. Beside it are E44N, E44R (the new level input whole_economy_land, from the pinned feed) and ONS's land under UK dwellings at end-2021, carried to 2024 by the UK HPI. Under (a), owner-occupied land is 99.1% of E44N, and the land under every home is 99.5% of E44R. - Item 7: receipts.floor_area_imputation counts the homes that take a pooled floor area, by region, by sale year and by pool level. That is 30.4% of homes, and 97.9% of them take their own cell's mean. The rebuild moves only the digests in the four data resources. κ, the cells, the land and every rollup value are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the microcosm#1597 review, item 6. The committed-resource tests checked structure only, and passed with half the social stock. They now pin: - England's social share against TS054's (4,005,663 of 23,436,085 households); - the owner share of private homes against 14,369,065 of 19,430,422; - VOA's 27,438,780 dwellings in England and Wales, as the split records them and within 0.2% in the cells; - the share of sold homes that take a pooled floor area. Each breakdown adds up to it, and under 5% of those means come from beyond the cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Vahid. Your review is of Must
Should
Nit
🤖 Generated with Claude Code |
The stock-cell provenance recorded each level input's Chronicle fact identity under a field named "key". The spec-only package check reads a "ledger.aggregate_fact.v2:<hex>" string as a Python entrypoint unless it sits under a named fact-key field. So three of the seven inputs were flagged: the three whose hex happens to start with a letter. The field is now aggregate_fact_key, as everywhere else in the packages. The rebuild moves only those seven field names; κ and the four data resources are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Round 2 at Round 1 items
New findings Must
Nit
Checked and fine
CI at Verdict: every method item from round 1 is answered, and I can reproduce the figures. The only thing between this and green CI is item 10, a one-field rename and a regenerated provenance. 🤖 Generated with Claude Code |
…1603) Main re-pinned the US spec-engine files this branch also pins. The six conflicts were all generated counts and digests; each took main's side and the five-step repin recomputed them on the merged tree (repin_us_spec_engine_contracts.py --legacy-only, generate_us_bundle_from_constants.py, repin_us_spec_engine_contracts.py twice per #1530, spec_engine_coverage.py). - Configuration fields: 42,401 (main's 42,395 plus this branch's six pointers for the two declared legacy resources); 41/41 inventory checks. - US bundle spec_sha256: d3a3c6c6fbcf4bd7cae760215b909214e5593d606da74aa8f78e6c347e3b41b5. - The three --check modes and tools/ci_test_plan.py verify exit 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main gained #1612, #1596, #1603, #1601 and #1597 since the 68bbff7 this branch last merged (45 commits, 174 files). #1601 ("US: one copy of each shared helper") edited microcosm.calibrate.solve, an attested kernel module, and regenerated the shared pins, so the five pin files conflicted. No code or test file conflicted. Each conflict block takes main's text, with this branch's #1096 comment sentence kept after main's, and the tools then wrote the values for the merged tree: - docs/evidence/spec-engine/us-f0-coverage.json: main's five blocks (eight digest lines), then rewritten by tools/spec_engine_coverage.py (two map, two protocol, two implementation and two spec digests; 42395/42395 fields, 41/41 checks). - spec_engine/inventory_coverage.py: main's #1585 comment and digests, then the #1096 sentence after it; tools/repin_us_spec_engine_contracts.py wrote seed_map 8d0542f7 and seed_protocol 3ab23e82 (main: 270cf649, a696ad74; this branch before: cd5c2f2c, 75891f4d). - test_spec_engine_loader.py: main's digest line under the #1096 comment line; the repinner wrote the golden fac42090 (main: 1ff3b42c; branch: a7b6a302). - test_us_multispine_pool_tool.py: the #1096 comment line and main's digest line; the repinner wrote spec_sha256 fa75bd68 (main: bd526d8c; branch: b768e100). - parity/kernels/calibrate/pins.json: main's line, then tools/graph_parity_repin.py calibrate wrote implementation_hash 07e4330f and node_key 2972c813 (main: 018974ad, 30ad70b1; branch: 1b3e2a71, f9472a28). direct.csv, graph.json and inputs.csv did not move and equal main's, so the default path's bytes are main's. The repinner and the coverage tool ran twice each, then both passed --check; the repinner's first pass moved test_spec_engine_coverage_tool.py's count and its second restored main's. tools/ci_test_plan.py verify passes with main's 968 test files. ruff format changed only the quotes the repinner writes. solve.py merged without conflict. #1601 and this branch both changed calibrate: #1601 moved its option checks into _check_mass, _check_epochs_and_weight_ratio, _checked_l2_options and _check_l2_anchor_shape, and this branch rewrote the mass_parametrization paragraph of its docstring. The merged function has #1601's code and this branch's docstring. Every other definition is one side's alone: the merged file is main's plus exactly this branch's edit. #1601's new solve_constraint_system calls _optimize, which this branch changed, with the signature it still has; under mass_parametrization="softmax" it now runs the exact per-step projection. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main gained 47 commits since the 68bbff7 this branch last merged: #1612 (a test of the build-folder publisher), #1596 (the US bundle generator's tombstone renewal), #1603 (UK local-area releases enter build folders through the registry), #1601 (US: one copy of each shared helper, #1585) and #1597 (UK stock cells, #1524). Four files conflicted, all of them pin files. No conflicted hunk takes a whole-file side: each takes main's text, keeps this branch's comment sentences, and leaves the value to the tools. - spec_engine/inventory_coverage.py, one hunk at seed_map and seed_protocol: main's seven comment lines byte for byte (#1585), then this branch's two sentences (#1444 and #1453) on three new lines. - tests/engine_free/shared/test_spec_engine_loader.py, one hunk: the golden value. This branch's two comment lines had merged cleanly. - tests/engine_workflow/us/test_us_multispine_pool_tool.py, one hunk: this branch's two comment lines, whose first is main's line, and the spec_sha256. - docs/evidence/spec-engine/us-f0-coverage.json, five hunks, digests only. One conflict git did not report, in tests/engine_free/us/test_us_spine_blindness.py. #1601 made us_runtime/support_mix.py re-export microcosm.build.holdout's hash_holdout_uniform as hash_uniform. This branch's test_out_of_runtime_implementations_are_exactly_the_runtime_re_exports requires the registry of out-of-runtime implementations to name every such re-export, so it fails on the merged tree though each parent passes alone. The registry gains ("support_mix.py", "microcosm.build.holdout"), so the runtime scans read holdout.py. The pool tool's import graph does not reach support_mix.py (only the support-mix bake-off tool imports it), so the pool test now requires the graph to reach exactly the re-exports in the new _POOL_BUILD_RE_EXPORTS (local_jurisdictions.py), each of which must be registered. The pinned graph size stays 84. main's support_mix.py is unchanged. Both sides changed five definitions, none of them in its logic. Three hold a pin (EXPECTED_HASHES and the two pinned tests above): with the digests masked, the merged AST equals main's and this branch's. The other two are unions. BINDING_MODULES_ADDED_AFTER_BASE in test_transport_evidence_kernels.py holds main's stochastic_assignment and this branch's two modules, 26 names. The imports of tools/build_us_fiscal_refresh_release.py hold main's recert and this branch's rederive_us_local_jurisdiction_flags. Every other definition in the files both sides changed was changed by one side, and the merged AST equals that side's. In tools/build_us_fiscal_refresh_release.py main re-bound US_POPULATION_AGGREGATE_VARIABLES, _signed_component and _engine_known_periods to the shared rules in microcosm.data.compatibility_recertification, and this branch changed _main and added _with_local_jurisdiction_flags. In test_us_fiscal_refresh_builder.py each side added tests. Pins on the merged tree, each written by its tool: - tools/repin_us_spec_engine_contracts.py: seed_map a402868b and seed_protocol 27fd0f86 in inventory_coverage.py; the golden 7a2c31e2 in shared/test_spec_engine_loader.py; the US spec_sha256 3ec2d79d in engine_workflow test_us_multispine_pool_tool.py. Its covered_item_count in engine_contract test_spec_engine_coverage_tool.py ends at main's 41. - tools/spec_engine_coverage.py: us-f0-coverage.json (the seed map and protocol, the seed-stream implementation digest and spec_sha256, each twice); 42395/42395 configuration fields and 41/41 inventory checks. - Unmoved by the merge, as the coverage tool observes them again: full_checkpoint 47d4474d and the stacked pool's code digest 3c5e14be, this branch's values on lines main did not touch. The calibrate parity fixture (direct.csv, graph.json, inputs.csv, pins.json) is byte-identical to main's; this branch changes nothing under microcosm.calibrate. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Summary
Implements #1524, workstream 1 of #1521 (scoped in PolicyEngine/uk-land-value-tax#20).
tools/build_uk_stock_cells.pybuilds a table of every home in England and Wales, in cells of an MSOA × a council tax band. Each cell holds value, depreciated building cost, and land as the remainder at one national cost level κ. Authority and constituency rollups cover every variant. Five resources underuk/are read throughuk_runtime.stock_cells. The method and results are indocs/uk-stock-cells-land-1524.md.This PR also does two more things:
4ce631f5, the merge of Add dwellings by sector, ONS's capital stocks of dwellings and Census 2021 tenure by MSOA (#438) chronicle#439. That adds ONS's dwellings by sector, its capital stocks of dwellings and Census 2021 TS054 by MSOA. The stock cells now read all their ONS inputs from the feed.The builder reads public administrative data only, and no survey microdata. It checks each raw input against its Chronicle registration. Addresses never leave the build caches.
Results of the committed build
An earlier build in this PR failed the stock-value check, with England at +6.7%. It had two causes, and both are fixed here:
The thresholds are proposals for Max and Vahid to set.
The tenure bug and the high-value home stock
TS054 prints social renting from the council and other social renting as two rows under one spec id.
tenure_shareskept only the last of them:The shares now sum every row of a category. The same row twice is refused. An area that carries every category must add up to its households, within 0.1%, because Scotland's census perturbs its cells.
The rebuilt home stock lowers the counts by 10% to 12%:
In Wales the counts fall by 8.5% to 12.2%.
What else moves:
hvcts_la_household_floorof 400 homes (UK local-area release: publish a K=15, 150,000-household dense dataset in at most two builds #1301) and move from active to signed deferred. The local receipt moves 340 high-value homes rows and drops those ten.Commits
d943405a4pinned_inputs,weighted_quantiles,cell_pooling,residual_land,derived_resourceb61eb991458192b6c3729517538f1166d8039ff95b4f0d794635ffe0f1be9e2154172ec333f0902b750be085a322b1871ee0c7e68b791153cd7fb4baabb2c5497f4a69d1fe2c74b14ce631f5, the home-stock rebuild and every regenerated surface41ff8933a29a14b212645119f07scale_cap_rescaleandconvex_meanstay exact for subnormal masses (review item 3)00d1f1290ee5adbe34326b47d05aggregate_fact_key, the field the spec-only package check admitsInputs and pins
4ce631f5.license_source: declared.stock_cells_structure.json, both rollups and the provenance) issolve_scope.UK_POST_SOLVE_RESOURCES. The value block stays in the solve fingerprint.Review of 13 November
Vahid's review of
0c7e68bis answered in commits:4baabb2c5,497f4a69dand the re-pin.645119f07covers the subnormal masses.00d1f1290covers the land against ONS's land, the grain test's statistic and the imputation receipt.ee5adbe34adds the anchor tests.The rebuild for items 4, 5 and 7 leaves κ, the cells, the land and every rollup value as they were. Only the digests and the provenance's new and changed records move. The MHCLG pattern, the only caller of
scale_cap_rescale, is byte-identical.CI runs the engine-free suite with
--maxfail=1. So before each push, the test files that read the regenerated surfaces ran locally.Checks
--checkprintedcurrentfor the build at41ff8933a. The rebuild at00d1f1290passes the feed-fingerprint test on the pinned feed.tools/ci_test_plan.py verify: ok at the head.ee5adbe34failed on the spec-only package check, which read three of the level inputs' fact keys as Python entrypoints. A read-only sweep then found 42 test files that read what this PR changes. 40 of them ran locally on326b47d05and passed, excepttest_uk_cgt_projection's check that the UK engine is absent: the local environment has theukextra, and CI's engine-free job does not. The other two neednpm cifirst (test_uk_orrery_reconstruction) or skip paths under.claude/(test_us_plan, whose banned names appear in no added line).Not done
🤖 Generated with Claude Code