Register one UK full-build graph with all-geography calibration - #901
Draft
juaristi22 wants to merge 280 commits into
Draft
juaristi22 wants to merge 280 commits into
juaristi22 wants to merge 280 commits into
Conversation
…ntegration-20260909
`Frame` deeply freezes its metadata and its mass records, but a frozen dataclass still yields to `object.__setattr__`. Passing the version's own `_FrozenMapping` leaves and `MassChangeRecord`s by reference therefore made every kernel -- and anything retaining a context past its own mutation check -- a live handle on the population: one `object.__setattr__` on a shared record rewrote the version's log, and unlike a table nothing would have noticed. The projection now hands out a deep copy of the metadata and rebuilt mass records, through the same rule `_observer_snapshot` already followed (now one shared `_detached_record`). `_context_digest` binds all three fields: the metadata through the frame format's own store codec, each mass record field by field, and the projected column order. The codec is guarded, so a value `Frame` would never have admitted is reported as the mutation it is rather than raising while the comparison is computed. The properties cover both halves, and are not vacuous: the rewrite is asserted to have landed on the retained copy before the live version and the next node are asserted unchanged. The observer property now rewrites nested metadata and mass records too -- rewriting tables alone never touched these fields. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The review's F2 asked for a design-kind `WeightUpdate` to re-anchor
`Population.design_weights`, on the grounds that a later calibration cap
is otherwise "off by k" and that an `EXPAND` afterwards leaves anchors
"mixed". Read against the source, the first is the declared semantics and
the second is not what the code does.
An anchor is the design weight a row entered the population carrying.
`Population.design_weights` is captured once, at CREATE
(`Population.from_frame`), and afterwards only carried by stable entity id
(`_carry_design_weights`), which `patch` hands to `Population.from_frame`
explicitly so the re-derive-from-the-frame default is never taken.
`_carry_design_weights` maps an EXPAND's *copied* rows back to their
source row's original anchor; only a row with no lineage at all reads the
current frame, because it has no earlier weight to be anchored on. So the
values move and no anchor does -- for retained, cloned and entrant rows
alike -- which the new properties assert by running the same EXPAND over
an updated and an un-updated population and comparing the anchors.
`max_weight_ratio` with `weight_anchor='design'` is therefore still
relative to the original design weights, which is what its refusal has
always said ("original design weight"). Re-anchoring would let an
unrelated normalization silently widen every cap declared upstream of it
by that normalization's factor. The review's own T2 case is asserted as
the intended outcome: calibrated weights equal to design weights doubled
by an update are refused at a cap of 1.5 and admitted exactly at 2.0,
reporting a realized ratio of 2.0. The `WeightUpdate` docstring and
amendment 25 now say all of this instead of "ancestry is untouched".
F4: the required-replay property only showed that a hit succeeds. The
stored record's axis binding is now rewritten to the same ids in reverse,
and to a short axis, and each is refused on a run that must hit the
record with no kernel called -- so the check runs on the replay path and
rejects there. A third property re-files the record unchanged and still
replays, so the two refusals are about the binding rather than about
re-filing. The weak test is renamed to the claim it does support.
F5: amendment 25 claimed a re-solve of an existing calibration as a case
it covers. `calibrate.adam@1` emits no `receipt['weight_update']`, so
that declaration would be refused as unverifiable; it is now marked a
future consumer adaptation, in the amendment and in the two docstrings
that repeated it.
F6: the node mass-policy mismatch message said "weight transition's" on a
path both declarations reach.
`decl.py` is re-locked for the amendment-25 text.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ntity Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`_remapped_expand_memberships` aligns clone ordinals: a copied group needs the same number of copies of every incumbent member, so cloning household 10 without copying persons 1 and 2 would have been refused rather than proving anything about anchors. The clone now carries its members, which also lets the property assert the remapped memberships; the entrant household still joins with none, which is allowed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… plan Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
MaxGhenis
force-pushed
the
microcosm-us-launch-integration-20260909
branch
from
September 13, 2026 20:39
83f2561 to
15ebde8
Compare
… into uk-full-build-graph-reconcile
Merge origin/uk-full-build-graph-registration (051fb97) into the #893 integration head (2300e56) after taking origin/uk-context-framing-fix-20260913 (072c2e8, amendments 25 and 26). Resolution rules: the graph package, its tests, the charter and the interface lock are #918's; #901's own draft of WeightUpdate and the frame-context fields, its test_weight_update.py and its charter section are dropped. US-owned tests and tools/spec_seed_identity_diagnostics.py are #893's; #901's 10 September review fixes to them (and the us_spine_stage_contracts.json fixture and the VerifiedParameterAssets test) are superseded. UK files #901 rewrote into shims or cut down are #901's. Stage roster is 29: #901's 28 plus frs_relationships from #903; the retained-leaves / SPI pair stays retired. Ports of HEAD-side UK changes into #901's modules: #903's frs_relationships transform in uk_runtime/spine_build.py and its ons_household_type enum-domain gate artifact through one shared uk_spine_gate_artifacts() used by the spine-phase gate kernel, the full-build final gates and the driver test; #855's hierarchy decode in graph_targets.registry_from_payload and on the local target surface (_surface_records encodes it as TargetRegistry.to_json does, _local_specs decodes it and keeps it out of metadata), so the schema-8 hierarchy the shared uk_local_target_surface now emits survives the surface artifact and reaches diagnostics. Invented UK test registries take their hierarchy from one shared tests/uk_hierarchy_fixtures.py helper. Dropped run_graph(population_retention="lazy") from full_build_cli: the shared executor on main has no such mode (see the #893 reconciliation record). Pins regenerated on the merged tree: calibrate H1 parity, the H2 uk_spine.json fixture, the UK country-bundle spec digest, the UK release-input coverage manifest, APPROVED_UV_LOCK_SHA256 / LOCK_SHA256 for the merged uv.lock, and the microcosm.graph/kernel.py contract in the US implementation inventory. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…rtifact TargetSpec.to_dict / from_dict are the single encoding for a spec carried by any artifact: TargetRegistry.to_json / from_json and the UK full-build target-registry artifact (graph_targets.registry_payload / registry_from_payload) now share it instead of repeating the schema-8 hierarchy decode inline. to_dict is dataclasses.asdict, so registry JSON bytes and content versions are unchanged; from_dict accepts the nested hierarchy mapping, an already-decoded CalibrationHierarchy, or None, and keeps the constructor's target-id check. Shared-package change (microcosm- calibrate); flagged for the PR body. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The reconciliation onto the #893 head took #893's engine-parameter-file admission and its test, and dropped this branch's VerifiedParameterAssets approach with its test_spec_seed_identity_parameter_assets.py. The spec-seed-diagnostics job still listed that file by name, so its bootstrap step failed on collection. The five remaining files pass locally with the job's flags (102 tests); every other hard-coded test path in the workflow exists. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UK population construction and calibration currently span source-spine, national and joint-local drivers, with transformations and acceptance evidence outside the executable graph. This change registers one full build from canonical raw FRS sources through geographic replication, target compilation, calibration, optional exact-count sizing, gates, diagnostics and checked export.
Stacked on #893 at
1cebe3547543bf2917a7af7362bfbb22a05bf964; review againstmicrocosm-us-launch-integration-20260909.--target-geographies countryexplicitly filters the same graph. Pool copies K, exported household count k and target scope remain independent; failed support or fit checks never narrow scope automatically.frs_hmrc_retained_leavesandhmrc_spi_incomestages; retain the canonical spine replacements already present in Consolidate the US survey graph build and enrichment pipeline #893. Retire independent national/joint-local scientific drivers. Legacy command names route into the new full-build/readiness interfaces, but retired flags fail explicitly: these are entry-point shims, not compatibility with old invocation scripts. Usemicrocosm-build-uk/tools/build_uk_full.pyfor the maintained build interface.The coverage manifest also drops the historical pre-spine
hmrc_cgt_gainsentry, which already declaredhmrc_cgt_gains_spineas its replacement. Canonical CGT coverage remains required at build, with pinned source verification, capital-gains output/rewrite checks, the conserved-mass receipt and all 76 published facts fenced from calibration. This removes validation of the old certified-input-H5 route, not canonical CGT construction.The context mutation guard now includes immutable frame metadata, mass records and declared column order.
_context_digestchecks for input mutation around kernel execution; it does not directly construct node keys. The shared implementation source changes deliberately change implementation and cache identities. The H1 parity refresh also resolves inherited stale implementation pins: direct input and numerical fixture bytes remain unchanged, and old/new node identities were independently reconstructed. The PR workflow now runs for non-main base branches so stacked PRs receive CI; that trigger remains after merge.The latest parent adds supplied-parent US export verification and moves US atomic assignment after initial cloning, with a typed geography-gate artifact consumed before financial fitting. Its shared artifact is opt-in. The UK graph retains its existing ladder and assignment method; adopting shared atomic assignment and changing UK stage order remain subsequent work.
Validation includes direct-versus-graph target/matrix/solver parity, required replay, real preflight refusal before solving/export, CLI failure/export evidence, and UK source-spine H2 parity. UK regression runs covered 2,018 distinct cases; corrected fixture cases passed fresh reruns, and the inherited licensed-reference mismatch below remains explicit. Both UK engine and UK-spine jobs passed on the preceding pushed head.
On the merged source, all 521 source-provenance audit cases, 89 shared/UK adapter checks and nine previously failing survey/default/manifest cases pass. Python 3.13 and 3.14 produce identical 438 audit contracts and 1,071 references. All six wheels were rebuilt: 475 Python files and 155 resources match source, wheel and installation, and all 54 installed versions match the lock. The engine-free wheel environment passes 125 shared/UK/export checks; canonical CLI help retains the all-geography default.
All 69 affected parent US acceptance cases pass across seven files, including export comparison, post-clone identity, financial/population graph execution, age-calibration replay and origin-budget integrity checks.
The final ordered regression passes all 101 cases: the complete 58-case PUF file followed by all 43 affected survey/budget cases from CI. All cases execute without skips, errors or failures. An observer checks every teardown and confirms zero changes to sealed producer identities or source bytes.
The reviewed repairs and merged parent are pushed at
051fb972b19d319d58277bd63306d0d0e0947ce2. GitHub CI on this exact head is running; local acceptance does not substitute for its final result.CI repairs cover issues introduced by this stack and failures in the moving parent:
051fb972, with all 65 source stamps verified against that exact commit. Its output remains candidate-only. Align the expected module list with all 44 maintained calibration modules.One local test with a licensed cached eFRS file exposes an inherited reference mismatch: the frozen extraction uses PolicyEngine-UK 2.89.0, while both parent and current locks use 2.97.0. The unchanged parent generator reproduces the difference against the pinned H5. The historical reference remains unchanged.
A native f001 smoke reached the UC capital-coherence donor-support refusal, reproduced by a direct call to the maintained helper. The available ladder has the older digest. A full native run against the corrected ladder and native certification remain outstanding; this PR does not publish or certify a production dataset. The maintained command, operation inventory and migration boundaries are documented in
docs/uk-full-build-graph.md.Reconciliation update (2026-09-14, head
434fb64d)The branch is fast-forwarded onto the current
microcosm-us-launch-integration-20260909head (2300e56b, zero behind main) plus the #918 head (072c2e88, charter amendments 25 and 26). Until #893 takes #918, the diff against the base shows #918's graph changes as well as this PR's; none of the graph-package edits below are this PR's own.Resolution rules for the 34 conflicting files:
WeightUpdateand the frame-context fields, itstest_weight_update.py, its charter section and its B2/kernel-contract edits are dropped.context_frameanduk.full.normalizecall Add weight updates and frame context to graph kernels #918's signatures unchanged.tools/spec_seed_identity_diagnostics.py: Consolidate the US survey graph build and enrichment pipeline #893's side. The "CI repairs" bullets above that describe US test fixes from 10 September (the parameter-CSV admission and itsVerifiedParameterAssetstest, the PUF monkeypatch restore, the survey-diagnostics reconstruction, theus_spine_stage_contracts.jsonfixture) are superseded by Consolidate the US survey graph build and enrichment pipeline #893's own later fixes and are no longer in this branch.frs_relationshipstransform inuk_runtime/spine_build.pyand itsons_household_typeenum-domain gate artifact through one shareduk_spine_gate_artifacts()used by the spine gate kernel, the final gates and the driver test; Publish calibration hierarchy schema 8 #855's schema-8 hierarchy carried through the target-registry artifact and the local target surface.frs_relationshipsfrom Add the frs_relationships UK spine stage and rebind the ONS household-composition cells (#791) #903; thefrs_hmrc_retained_leaves/hmrc_spi_incomepair stays retired.run_graph(population_retention="lazy")is dropped fromfull_build_cli: the shared executor on main has no retention mode (see the Consolidate the US survey graph build and enrichment pipeline #893 reconciliation record). The full build now holds every population version until the run ends; memory on a K-clone build under eager retention is unmeasured.calibrateH1 parity pin, the H2uk_spine.jsonfixture, the UK country-bundle spec digest, the UK release-input coverage manifest,APPROVED_UV_LOCK_SHA256/LOCK_SHA256for the mergeduv.lock, and themicrocosm.graph/kernel.pycontract in the US implementation inventory.Shared-package change (flagged):
microcosm-calibrategainsTargetSpec.to_dict/TargetSpec.from_dict, the one dict codec for a spec carried by any artifact.TargetRegistry.to_json/from_jsonand the UK full-build target-registry artifact use it; registry bytes and content versions are unchanged. Raised because the UK reader had to repeat the schema-8 hierarchy decode that #855 put inline infrom_json.Verification on the reconciled tree: graph suite 775/775; spec-engine, lock and merge-touched US tests 1242 passed plus a 72-test confirmation lane; UK full-build, evidence, adapter and calibrate tests 415 passed plus 51 on the six files the fixes touched; registry codec tests 30/30;
tools/spec_engine_coverage.py --check42156/42156 and 41/41;tools/ci_test_groups.py --verifyok;ruff checkclean. The engine and wheels CI shards were not run locally. A native full build against the committed references has not been run on this head; it waits for the Chronicle schema fix that lands on main next and the rebase that picks it up.Deferred by design, to be decided once the stage reordering fixes how weights flow into calibration: adopting the US origin-budget (per-household grouped bounds) for the UK solve, including its reference weight; and declaring the executor design cap on the calibrated node.