Skip to content

UK stock cells: homes and the land under them in England and Wales (#1524) - #1597

Merged
juaristi22 merged 23 commits into
mainfrom
claude/uk-1524-stock-cells-dad940
Nov 14, 2026
Merged

juaristi22 merged 23 commits into
mainfrom
claude/uk-1524-stock-cells-dad940

Conversation

@juaristi22

@juaristi22 juaristi22 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements #1524, workstream 1 of #1521 (scoped in PolicyEngine/uk-land-value-tax#20). tools/build_uk_stock_cells.py builds 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 under uk/ are read through uk_runtime.stock_cells. The method and results are in docs/uk-stock-cells-land-1524.md.

This PR also does two more things:

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

  • Level: κ (target a) = 0.807, from the feed. The buildings add up to E46Y × England and Wales's share of UK dwellings (0.888). Depreciation is scaled to one less net ÷ gross capital stock (MJF8 £2,526bn ÷ MJF7 £4,632bn, a mean of 0.455). Target (b), the check, gives 0.880.
  • Totals: £7.08tn of land under £9.33tn of homes (0.760), at calendar-2024 prices. That is 22.76m private and 4.70m social homes.
  • Decision rule: all three pass:
    • authority ranks correlate at 0.968 to 0.996 across the variants;
    • κ lies in 0.75 to 1.25;
    • the cost per m² is below the new-build lower quartile in every region.
  • Grain test: cells are needed. An authority share × cell value places 3.26 points of a balancing land tax on other cells than cell land does, against a threshold of 3. Within seats it is under 5 points in 92.3% of seats, which meets the 90% threshold, so the national test decides, narrowly. The statistic changed in review: the first build compared how much each pattern moves from council tax, a gap of 1.40 points, which cannot see where the tax falls.
  • Land against ONS's land: under target (a), owner-occupied land alone is £4.52tn, 99.1% of E44N (£4.56tn, the UK households sector's land of every kind). The land under every home is £7.08tn: 99.5% of E44R (£7.12tn, the UK's land of every kind), and 13.0% above ONS's land under all UK dwellings carried to 2024 (£6.27tn). Under target (b), owner-occupied land is 96.2% of E44N. Both checks pass, but only just. These figures are for the choice of route to the level on Project scope: land value tax results for every constituency uk-land-value-tax#20.
  • Stock value: passes. In England, the sales-based private mean is £372,470 against the Market Value Survey's £367,739, a gap of +1.3% (the threshold is 5%). The regions range from −4.0% (North East) to +8.1% (North West), within the 10% threshold.

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 check averaged the survey's owner-occupier and private-renter means half and half. It now weights them by the private stock's owner-occupied share.
  • The tenure bug halved the social stock and lowered the owner share.

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_shares kept only the last of them:

Social share, bug Social share, fixed Owner share of private, bug Owner share, fixed
England 8.8% 17.1% 0.672 0.740
Wales 7.8% 16.5% 0.717 0.791

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%:

England Before After
Private-sector homes over £1m 1,049,214 938,587
over £1.5m 391,430 345,885
over £2m 193,201 169,605
Owner-occupied homes over £2m 115,921 101,763

In Wales the counts fall by 8.5% to 12.2%.

What else moves:

  • National references: only the three regional high-value homes targets move. There are still 1,710 active references. The national compile-parity receipt moves their 28 rows.
  • Local references: ten authority cells fall below the existing hvcts_la_household_floor of 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.
  • Other surfaces: the local census and the release coverage manifest change only their digests. The H2 fixture moves the contract hashes of 22 stages: 19 that bind vendored resources and 3 that bind the stock.
  • Outside this repo: figures already published from the old stock are not updated here. The candidate evaluation's frozen scoring register is due to be re-frozen before the next national solve.

Commits

Commit What it does
d943405a4 Country-neutral modules: pinned_inputs, weighted_quantiles, cell_pooling, residual_land, derived_resource
b61eb9914 The high-value home-stock library onto them
58192b6c3 UK readers (VOA CTSOP, UCL, the feed's reference facts) and declarations
729517538 The builder and its synthetic end-to-end test
f1166d803 VOA's build periods grouped with the EPC's age bands
9ff95b4f0 Merged councils' certificates and quarters count towards their successors
d794635ff UCL's bundles read as ReShare packs them
e0f1be9e2 The home-stock tool onto the shared code; its rebuild is byte-identical
154172ec3 Social certificates without a UPRN count once each
33f0902b7 Licences declared for the three manifests that state none
50be085a3 The capital stocks read from the feed; a feed with a level input in an unexpected shape is refused
22b1871ee The five resources, their registration, the loaders, the post-solve scope and the invariant tests
0c7e68b79 The methods note and the changelog fragment
1153cd7fb Merge of main
4baabb2c5 Tenure shares sum TS054's repeated rows
497f4a69d The stock-value check weights the survey's tenure means
1fe2c74b1 The re-pin to 4ce631f5, the home-stock rebuild and every regenerated surface
41ff8933a The stock cells rebuilt on the new feed, with the results
29a14b212 The battery and small-cell tests count the ten authority cells the tenure fix defers
645119f07 scale_cap_rescale and convex_mean stay exact for subnormal masses (review item 3)
00d1f1290 Review items 4, 5 and 7: the grain test's statistic, the land against ONS's land, and the floor-area imputation receipt; the cells rebuilt
ee5adbe34 Review item 6: the committed cells anchored to TS054 and VOA
326b47d05 The level inputs' fact keys are named aggregate_fact_key, the field the spec-only package check admits

Inputs and pins

  • Raw inputs: Price Paid, the UK HPI, the NSPL, VOA CTSOP 1.1, 3.1 and 4.1 (2026), UCL's linked file and certificates, and Tax Policy Associates' model. Each is checked by sha256 and size against its manifest in Chronicle 4ce631f5.
  • Licences: the manifests of Price Paid, the UK HPI and the NSPL state no licence, and Chronicle reads none. The provenance records the licence that the home-stock builder states for them, marked license_source: declared.
  • Solve scope: the land side (stock_cells_structure.json, both rollups and the provenance) is solve_scope.UK_POST_SOLVE_RESOURCES. The value block stays in the solve fingerprint.

Review of 13 November

Vahid's review of 0c7e68b is answered in commits:

  • Items 1, 2 and 9: were already done by 4baabb2c5, 497f4a69d and the re-pin.
  • Item 3: 645119f07 covers the subnormal masses.
  • Items 4, 5 and 7: 00d1f1290 covers the land against ONS's land, the grain test's statistic and the imputation receipt.
  • Item 6: ee5adbe34 adds the anchor tests.
  • Item 8: the licence fields in Chronicle's manifests are a Chronicle change, so they are not in this PR.

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

  • Every commit: ruff and the touched tests.
  • Re-pin chain: each step as the re-pin note orders it, then the feed-gated tests on the new artifact: the home stock's, the stock cells' and the pin tests.
  • Stock cells: --check printed current for the build at 41ff8933a. The rebuild at 00d1f1290 passes the feed-fingerprint test on the pinned feed.
  • Review round: before the first push, the 28 test files that read the regenerated surfaces. Before the second, the 16 touched or related files. All passed.
  • tools/ci_test_plan.py verify: ok at the head.
  • Third push: CI at ee5adbe34 failed 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 on 326b47d05 and passed, except test_uk_cgt_projection's check that the UK engine is absent: the local environment has the uk extra, and CI's engine-free job does not. The other two need npm ci first (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

juaristi22 and others added 16 commits November 12, 2026 12:44
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>
@vahid-ahmadi

Copy link
Copy Markdown
Contributor

Review of 0c7e68b. I read the diff against #1524's body as edited on 12 November and my two rounds there, reran the new and moved tests, and checked the committed resources against Census 2021 TS054 (Nomis), chronicle#439's documentation and the provenance's own figures. Comments are on method and code only. D4, the route to the level and the thresholds are still open on PolicyEngine/uk-land-value-tax#20, so I make no call on them here.

Must

  1. Social rented homes are about half what the census says, because one of the two social categories overwrites the other. uk_runtime/high_value_home_stock.py:787 does social[code] = value. TS054 has two social rented categories, "rents from council or local authority" and "other social rented", and both arrive under uk.local_geography.tenure.social_rent.v1, so the last one read wins. The owner branch two lines up adds; this one doesn't. The committed output shows it: every authority's social_homes in la_land_shares.json is VOA's count × the "other social rented" share alone.

    • Tower Hamlets: 0.220 in the resource; census other social 26,540 / 120,539 = 0.220; both categories 0.358.
    • Southwark: 0.127 against 16,558 / 130,820 = 0.127; both 0.397.
    • Barnsley: 0.042 against 4,522 / 108,053 = 0.042; both 0.197 (16,772 council homes dropped).
    • England: 8.84% against the census 17.09% (4,005,663 / 23,436,085). Wales: 7.8% against 16.5%.
    • In total the resource has 2,410,299 social homes in England and Wales. With both categories it would be about 4,700,000.

    So about 2.3 million social homes sit in private cells at sales-based means. owner_share_of_private is understated too (England 0.670 in the value block, against 0.740 from the census, 14,369,065 owners over 19,430,422 private households). The level, every land total, the three decision rule results and the stock value check all rest on these counts. tools/build_uk_stock_cells.py:768 reads it by authority, and :775 reads Compile the preflight preview registry with aging on #439's MSOA facts through the same function. chronicle#439 (merged 17:58 on 12 November) puts both MSOA categories under the same spec id, and its own note says they "should be added together". So the switch from uniform to msoa will repeat the error. The value block is inside the solve fingerprint (solve_scope.py), so this is cheaper to fix before it lands than after.
    Suggested fix: social[code] = social.get(code, 0.0) + value. Add a unit test with two social facts for one area, and rebuild. Once fixed, the home-stock tool's rebuild will no longer be byte-identical to main, which is expected.

  2. The stock value check fails mostly because of how the survey mean is formed. tools/build_uk_stock_cells.py:2144 and :2163 take the unweighted mean of the survey's owner-occupier and private-renter means. That gives private renters half the weight, but they are about a quarter of private homes. Hand-check for England, using the survey means (£398k owner occupied, £289k private rented, at 1 July 2024) and TS054's private tenures as weights (14,369,065 owners and 4,794,889 private renters):

    • weighted mean (398 × 14,369,065 + 289 × 4,794,889) / 19,163,954 = £370.7k;
    • on the check's calendar-2024 basis (its own factor, 341,753.68 / 343,500 = 0.9949) about £368.8k;
    • against the sales-based £364,796, that is about −1.1%, inside the 5% threshold. The committed figure is +6.7%.

    Each region's benchmark moves the same way wherever owner occupiers' mean is above private renters'. Item 1 pulls the sales-based mean up, since council homes in cheaper cells leave the private count. So rerun the check after both fixes, before looking for a cause in the sale prices.
    Suggested fix: weight the two survey means by private tenure (the survey's own stock counts if the feed has them, otherwise TS054 by region), and say which in survey_private_sector_rule.

  3. CI is red at head on both engine-free jobs. test_residual_land.py::test_scale_cap_rescale_holds_the_total fails on Hypothesis cases with a subnormal entry. With raw=[1, 0, 5e-324], cap=[1, 1, 2] and a total of 1.5, scale_cap_rescale returns [1, 0, 2], which sums to 3. At residual_land.py:265, remaining / mass overflows, the subnormal entry becomes inf and is capped at its full cap. Then the mass <= 0 branch at :260 exits without raising, because remaining is now negative. Locally, test_convex_means_lie_between_their_values also failed, on weights [5e-324]: convex_mean (:319) multiplies the value by the weight and that underflows to 0. CI passed it only on the draw.
    Suggested fix: either keep subnormals out of the strategies (allow_subnormal=False, since the real inputs are £ totals and counts) or guard the functions: treat a mass or weight total below np.finfo(float).tiny as zero, and raise if remaining < 0.

Should

  1. Say plainly where the level sits against ONS's land. Under target (a), the land under England and Wales's homes is £7.24tn. That is above E44R, ONS's land for the whole UK, every sector and every kind of land, at £7,117,771m at end-2024 in the 2025 edition. It is also above the feed's UK land under dwellings at end-2021 (£5.9tn). Owner-occupied land alone, Σ private count × owner share × land per home over the committed cells, is £4.43tn, 97% of E44N (£4.56tn, UK households). The household landlords' part of private rented land would take it past E44N. Target (a) fixes buildings to E46Y. So any amount by which sales-based value exceeds ONS's implied dwelling value lands entirely in land. This is round 1 item 2's point about a £ total against a ratio. Which route anchors the level is open on #20.
    Suggested change: report household-held land (owner occupiers plus household landlords) against E44N, not all-tenure land. Put the £ land under (a) and (b) beside ONS's land under dwellings, carried to 2024 by a stated index. Then the choice on #20 rests on the figures. Do this after item 1, since the social stock moves both.

  2. The grain test compares how much moves, not where it moves. tools/build_uk_stock_cells.py:2046 takes abs(national["cell_land"] - national["authority_share"]), the difference between two totals of council tax moved. :2047 does the same by seat. Two patterns that move the same amount to different cells score a gap of 0. So "authority shares are enough" doesn't follow from 1.44 points.
    Suggested change: measure the two patterns against each other, 50 × Σ|rate_c × land_c − rate_a × land_a| / Σ tax, nationally and by seat. Then say in the note what the reading implies for the cells, since UK: a stock table of homes by small area and band, and land values for every English local authority #1524's table says this test decides whether they are needed.

  3. The committed-resource tests check structure but pin no real quantity. test_uk_stock_cells.py would pass with item 1's counts. Suggested change: add a few anchors with tolerances: England's social share near TS054's 17.1%, the owner share of private homes near 0.74, VOA's 27,438,780 dwellings, and the share imputed to authority or region means.

Nit

  1. 4,733,362 of 15,567,861 homes (30.4%) take their cell's mean floor area, and the EPC D3 variant moves κ from 0.795 to 0.836. Report the imputed share by region and by sale period in the provenance, since UCL's file ends in October 2023.
  2. For Price Paid, the UK HPI and the NSPL, the provenance records a licence marked license_source: declared because their Chronicle manifests state none. Adding the field to those three manifests in Chronicle would let the provenance read every licence from its source, as UK: a stock table of homes by small area and band, and land values for every English local authority #1524 plans.
  3. chronicle#439 merged at 17:58 on 12 November, after this PR opened. The re-pin and rebuild can follow item 1, and the PR body's "Not done" list can move up.

Checked and fine

  • England and Wales's share of UK dwellings: 27,438,780 / (27,438,780 + 2,623,149 + 848,541) = 0.888. × E46Y £2,525,540m = £2,241.9bn, matching the provenance's target. E46Y and MJF8 (£2,526bn) match chronicle#439's documentation.
  • Mean depreciation 1 − 2,526 / 4,632 = 0.455. Target (b)'s ratio 5.9 / (5.9 + 2.097) = 0.738.
  • The builder's first commit (12:44 on 12 November) came after the rule was written into UK: a stock table of homes by small area and band, and land values for every English local authority #1524's body (11:08). The rule's three tests and thresholds match the body.
  • The 2026 VOA members (voa_stock_tables.py:61-63). Scilly imputed and flagged. Cumberland flagged mhclg_missing:before_floor. MHCLG's capped authorities recorded per variant (28 in the central case). Barnsley and Sheffield carry code_alias.
  • Cells sum to authorities, and authorities to seats. Land lies in [0, value] and falls as κ rises. The digests chain. The land side is out of the solve fingerprint.
  • Tests run locally, 9 files: the six new shared and UK unit files, test_uk_high_value_homes, test_uk_land_reference_facts and test_uk_voa_stock_tables. 102 passed, 2 skipped (feed-gated), 2 failed (item 3).

CI at 0c7e68b: engine-free (3.13 and 3.14) fail, each 1 failed and 26,324 passed (item 3), so ci fails. Lint, wheels, the engine and integration jobs pass.

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

juaristi22 and others added 6 commits November 13, 2026 05:33
…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>
@juaristi22

Copy link
Copy Markdown
Collaborator Author

Thanks, Vahid. Your review is of 0c7e68b. The head is now ee5adbe34, and each item is answered below.

Must

  1. Social rows: done. tenure_shares now sums every row of a category (4baabb2c5). It refuses the same row twice. An area that carries every category must add up to its households, within 0.1%, because Scotland's census perturbs its cells. test_tenure_shares_sum_the_rows_of_a_category covers two social facts for one area. The cells and the high-value home stock are rebuilt on Chronicle 4ce631f5 (Add dwellings by sector, ONS's capital stocks of dwellings and Census 2021 tenure by MSOA (#438) chronicle#439), which carries TS054 by MSOA.
    • England: social share 17.1% (was 8.8%); owner share of the private stock 0.740 in the census shares (was 0.672).
    • Wales: 16.5% (was 7.8%); 0.791 (was 0.717).
    • Social homes: 4.70 million (was 2.41 million).
    • As you expected, the home-stock rebuild is no longer byte-identical to main. England's private-sector homes over £2m fall from 193,201 to 169,605. Ten more authority cells fall under the 400-home floor and are deferred (29a14b212 updates the two tests that count them).
  2. Survey mean: done (497f4a69d). The check weights the survey's two means by the private stock's owner-occupied share in the same cells (Census 2021 TS054), and survey_private_sector_rule says so. England is now +1.3% (£372,470 against £367,739). The regions range from −4.0% (North East) to +8.1% (North West). The North West is inside its threshold, but the gap is not yet explained.
  3. Subnormals: done (645119f07).
    • scale_cap_rescale gives each free entry its share of the free mass, which is at most one, so the scale cannot overflow. It refuses a negative remaining total.
    • convex_mean makes its weights shares before it multiplies.
    • Your two cases are now fixed tests. The property test's patterns are zero or at least 1e-3, because its proportionality check cannot hold for subnormal entries.
    • CI at 41ff8933a failed for another reason: the battery and small-cell tests still counted 598 deferred authority cells. 29a14b212 updates them.

Should

  1. Level against ONS's land: done (00d1f1290). The provenance's also_recorded.land_against_ons now gives the land under owner-occupied, privately rented and social homes, under targets (a) and (b). Beside them are E44N, E44R and ONS's land under UK dwellings at end-2021, carried to the 2024 mean by the UK HPI for the UK. Households' land lies between the owner-occupied land and all private land. I have no source for the household landlords' share, so the build reports the two bounds, not a point:

    • Under (a), central:
      • owner-occupied £4.52tn, 99.1% of E44N (£4.56tn);
      • privately rented £1.86tn;
      • social £0.71tn;
      • every home £7.08tn: 99.5% of E44R (£7.12tn), and 13.0% above ONS's land under all UK dwellings carried to 2024 (£6.27tn, × 1.062 by the UK HPI from December 2021).
    • Under (b): owner-occupied £4.39tn (96.2% of E44N); every home £6.88tn (+9.8%).

    Both bounds pass, but only just. E44N also holds Scotland's, Northern Ireland's and households' other land. So under (a), households' land is above E44N once household landlords hold more than 2.2% of the privately rented land. The note now says this plainly. The route to the level stays open on Project scope: land value tax results for every constituency uk-land-value-tax#20.

  2. Grain test: done (00d1f1290). The test is now 50 × Σ|cell land tax − authority-share land tax| ÷ council tax, over cells nationally and over each seat's cells. The thresholds stay as fixed before the build. The amount each pattern moves from council tax, and how far seat totals differ, are recorded beside it. The reading changes:

    • The two patterns place 3.26 points of the land tax on different cells, against the threshold of 3.
    • Within seats the distance is under 5 points in 92.3% of seats (threshold 90%). Seat totals are within 5 points in 91.3%.
    • So the reading is now "cells are needed", decided narrowly by the national test.
    • Each pattern's amount moved is unchanged (24.0 / 22.6 / 24.0 / 26.3), which is a check on the refactor.

    The note says what this implies: an authority share spread by value is no substitute for the cells' own land. Since the gap is near a proposed threshold, the reading is yours and Max's to confirm.

  3. Anchors: done (ee5adbe34). test_uk_stock_cells.py now checks:

    • England's social share against TS054 (4,005,663 / 23,436,085);
    • the owner share of private homes against 14,369,065 / 19,430,422;
    • VOA's 27,438,780 dwellings;
    • the imputed floor-area share and where the means come from.

Nit

  1. Imputation: done (00d1f1290). The provenance's receipts.floor_area_imputation counts the homes that take a pooled floor area by region, by sale year and by pool level.
    • Overall, 4,733,362 of 15,567,722 homes (30.4%).
    • By pool: 97.9% take their own cell's mean, 2.0% their authority × band's and 0.04% their region × band's. None takes the nation's.
    • By region: from 29.4% (London) to 32.7% (Wales).
    • By the year of the latest sale: 59.2% for 1995–2008, 7.5% for 2009–2021, 18.6% for 2022–2023 and 42.3% for 2024–2026.
  2. Licences: agreed. Adding the licence fields to the Price Paid, UK HPI and NSPL manifests is a Chronicle change. It is not in this PR.
  3. Re-pin: done (1fe2c74b1, 41ff8933a).

🤖 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>
@vahid-ahmadi

Copy link
Copy Markdown
Contributor

Round 2 at ee5adbe34. I read the diff from 0c7e68b (the eight commits after the merge of main), María's reply of 13 November and the updated note, reran the touched tests, ran the new tests against the old code and resources, and rechecked the committed figures by hand. Comments are on method and code only. The route to the level, the thresholds and the grain reading stay open on PolicyEngine/uk-land-value-tax#20.

Round 1 items

  1. Social rented undercount: fixed (uk_runtime/high_value_home_stock.py:812, with the households check at :820). In la_land_shares.json the social share is now Tower Hamlets 0.359, Southwark 0.397, Barnsley 0.197; England 17.2% and Wales 16.5% on VOA's counts (TS054: 17.09% and 16.5%). Social homes total 4,700,438. The households check ran on 350 authorities and 7,264 MSOAs. test_tenure_shares_sum_the_rows_of_a_category fails on the old function.
  2. Survey mean: fixed (tools/build_uk_stock_cells.py:2211). Hand-check for England: 0.7377 × £398k + 0.2623 × £289k = £369.4k, × 0.9949 = £367.5k, against the reported £367,739 (+1.3%).
  3. Subnormals: fixed (residual_land.py:260, :271, :336). Both new cases fail on the old code. The property strategy now draws entries of 0 or at least 1e-3, so the subnormal path is covered by the two fixed tests only, which is enough given the guard in the code. CI is still red at head, for a new reason (item 10).
  4. Level against ONS's land: fixed (tools/build_uk_stock_cells.py:2295; note, "The land against ONS's land"). I reproduce the carried figure: the UK HPI for the UK, 2024 mean over December 2021, is 1.0626, and £5.9tn × 1.0626 = £6.27tn. 4.518 / 4.560 = 99.1% of E44N, 7.085 / 7.118 = 99.5% of E44R, and (4.560 − 4.518) / 1.857 = 2.2%.
  5. Grain test metric: fixed (tools/build_uk_stock_cells.py:2110). It is now the distance between the two land taxes, 3.26 points nationally and 92.3% of seats under 5 points.
  6. Anchors: fixed (test_uk_stock_cells.py:90, :107, :121). On the round 1 resources, test_the_tenure_split_matches_the_census and the floor-area test fail. test_the_cells_hold_voas_dwellings passes on both, as expected, since VOA's counts did not move.
  7. Floor area: fixed (tools/build_uk_stock_cells.py:1394, receipts.floor_area_imputation).
  8. declared licences: open, by agreement. This is a Chronicle change.
  9. Re-pin to chronicle#439: fixed (uk/chronicle_feed.json at 4ce631f5).

New findings

Must

  1. CI is red at head, because the new feed keys look like Python entrypoints. test_spec_only_country_packages.py::test__given_country_specs__then_no_python_entrypoints_are_declared fails on both engine-free jobs (1 failed, 20,028 passed), and it fails locally too. The offenders are stock_cells.provenance.json level.inputs.{dwellings_gross_capital_stock, dwellings_whole_economy, dwellings_whole_economy_2021}.key. The cause is in uk_runtime/land_reference_facts.py:413, which writes the Chronicle id under a field named key. The check admits ids only under aggregate_fact_key and the other names in _FACT_KEY_FIELDS. Anywhere else, it tests the value against \b[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)+:[a-zA-Z_]\w*\b. So ledger.aggregate_fact.v2:af220bca… (and the ids starting fdfc… and e053…) match, while the four ids that start with a digit (1752…, 0e5f…, 9a77…, 4daf…) pass by luck. That is why households_land passed at 0c7e68b, and why the three inputs that moved to the feed with the re-pin trip it now.
    Suggested fix: write the field as aggregate_fact_key, so _is_fact_key_field admits all seven ids whatever their first character, and regenerate the provenance. It would also be worth adding test_spec_only_country_packages.py to the files run before a resource push.

Nit

  1. also_recorded.land_against_ons prints owner_occupied_below_e44n: pass under both targets (tools/build_uk_stock_cells.py:2334). But the note says households' land is above E44N once household landlords hold more than 2.2% of the privately rented land under (a). Under (b) the same point is 9.5% ((4.560 − 4.387) / 1.812). Recording these two shares in the provenance beside the status would carry the note's point into the resource that #20 reads.

Checked and fine

  • The households check's tolerance (0.1%, or half a household) catches a dropped TS054 row and allows for Scotland's perturbed cells. The test's "short" case trips it.
  • The stock-value check uses the owner share of the same cells. Its regional figures match the note: North West +8.1%, North East −4.0%.
  • land_tax refuses negative or non-finite land. The four patterns' amounts moved (22.6 to 26.3 points) match the reply.
  • Arithmetic in the note: owner-occupied plus privately rented land is (4.518 + 1.857) / 4.560 = 140% of E44N; under (b), 4.387 / 4.560 = 96.2% and 6.881 / 6.268 = +9.8%.
  • Tests run locally: test_residual_land, test_uk_high_value_homes, test_uk_stock_cells, test_uk_stock_cells_tool, test_uk_battery_bindings, test_uk_local_small_cell_rule and test_spec_only_country_packages. 210 passed, 2 skipped (feed-gated), 1 failed (item 10).

CI at ee5adbe34: complete. Engine-free (3.13 and 3.14) fail on item 10, so ci fails. Lint, wheels, the engine and integration jobs pass.

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

@juaristi22
juaristi22 merged commit 085672f into main Nov 14, 2026
12 checks passed
MaxGhenis added a commit that referenced this pull request Nov 14, 2026
…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>
MaxGhenis added a commit that referenced this pull request Nov 15, 2026
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>
MaxGhenis added a commit that referenced this pull request Nov 15, 2026
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>
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