UK national calibration run-readiness: doctrine, live parity trio, US-format diagnostics, scorer, staging posture (#623) - #743
Draft
juaristi22 wants to merge 9 commits into
Draft
Conversation
… re-map, ingest scale ladder The frozen release object uk/frs_release.json (survey/base 2024, calibration 2025, SN 9563, DOI, UKDS zip sha, HF acquisition pins) drives lockstep asserts over the re-pinned raw-tab manifest: all 21 frs_table artifacts re-pinned to the 2024-25 tabs with the SPI-convention keys, six stages' SN 9252 prose defect fixed, and the typed spec moved in lockstep. TIME_PERIOD and the HMRC SPI/CGT build periods move to "2024"; the 2023-24 HMRC published surface is re-mapped as a signed nearest-available-vintage declaration (period_mapping: latest_published_tax_year) with the frozen original byte-untouched and the source-contract validator reconstructing the live canonical payload. take_up_contract build_year 2024 flips the two 2024 date-keyed rates. The ingest driver joins the #627 scale ladder (--sample-fraction post-frs_spine via the generic frame-sampling helpers) with receipt-postures on three full-scale fences at sampled rungs, and the WAS bridge-donor locator defect that refused every full-roster licensed run is fixed with a hermetic pin-coherence regression test. Part of #723. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The regenerator pins move to enhanced_frs_2024_25.h5 at the v1.56.14 tag (= incumbent-at-pin ebf733c) and the committed reference re-freezes at the new vintage: 145 columns (surface unchanged), period "2024", entity counts now test-pinned with the re-derived record-count identity (16,288 raw + 10,000 SPI) x 2 + 270 CGT band donors = 52,846 - no raw household is dropped at 2024-25 and the donor count follows the HMRC band file (30 x 9). The release-input coverage manifest regenerates against the new reference with the certified 2023 candidate unchanged (candidate side moves at #686); known gaps stay empty and the restored-column receipts hold. Part of #723. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The efrs-post-calibration input-mass descriptor is replaced in place (same name, #687's replacement model): enhanced_frs_2024_25.h5 identity and the totals_sha256 of the regenerated 131-column weighted-totals evidence, with the registry, gates.json, and the data-shard publication mirrors re-pinned in the same reviewed change per the gate-battery contract. No thresholds move - #723 records the re-measured baselines, #686 arms them. UK_REFERENCE_DATASET_NAME follows the incumbent's 2024-25 dataset name. Both per-reference reviewed exclusions are re-signed against the new reference (charitable_investment_gifts; owned_land on a fresh 2024-25 stability receipt), pending the approver's confirmation on the PR. Part of #723. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ise channel-blind scope note UK_REFERENCE_DATASET_NAME drops the _recalibrated suffix (adjudicated 2026-08-20): the pinned reference is the published enhanced_frs_2024_25.h5 itself and no recalibrated variant exists at this vintage, so the gate-report label now names the artifact exactly (June report strings keep their own label). The registry scope notes stop claiming the incumbent "structurally lacks" the SPI clone channel - the 2024-25 artifact carries the synthetic rows structurally but no admin-restored mass in the channel-exclusive columns, which is the fact the reviewed exclusions rest on; the approved exclusion reasons are untouched. Gate digests re-cut over the post-#729 union in the same change. Part of #723. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…block; self-describing June freeze Finding 1 (accepted): the family-coverage block rendered the #723 re-mapped period fields from the canonical manifest while hashing only the frozen mirror - evidence fields and their hash must name the same bytes. The block now carries a dual pin (source_manifest for the frozen June identity, canonical_source_manifest for the bytes the re-mapped fields come from) and a test binds each field set to the sha256 of the file it actually derives from. Finding 2 (rejected with armor): the committed replay report is the June evidence freeze and deliberately keeps mapped_build_period 2023 - it is evidence for the grandfathered release, not the 2024 line, and retires with the frozen manifest after #686 per #687; instead of regenerating it, a new assertion binds it to the FROZEN manifest's declared mapping so the partition is self-describing. Part of #723. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ibrated-candidate-623
…tree Both parents edit uk/gates.json and uk/country_package.json, so the merged manifest digests differ from either side's pins. Re-pinned by recomputation (never by picking a side): spec bundle e12a2cb8…, policy 404968fb…, gates manifest 59c7808d…, spec fingerprint bfb98736…. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…-format diagnostics, scorer, staging posture Work items 1-7 of the narrowed #623 plan (runs held per the 2026-08-21 adjudications; everything here is synthetic/hermetic): - uk_runtime/national_doctrine.py: every solver constant the national calibration inherits becomes a declared, tamper-tested doctrine value (epochs 256, lr 0.02, ratio 10.0, seed 0, loss cap 10.0, l0 0.0, free mass, uniform weights). - Single compile path: the stage consumes the driver's compiled registry at the release calibration year and materializes bindings through the shared target_materialization interpreter; prepared scratch columns are restored post-solve, so the staged frame survives the real HDFStore writer (closes #729 dispositions finding 4). - Canonical mass/weight conventions mirroring the rowwise path: declared mass reason, post-solve fence (CALIBRATED kind, exactly one appended record), household_weight_kind_chain + calibration_mass_change manifest. - The parity trio evaluates for real on armed builds: candidate side from the staged frame and solve diagnostics, reference side from the frozen eFRS parity instrument and the declared registry at name@period grain — never a copied reference; unarmed builds keep evidence_absent. - calibration_diagnostics.json is now produced by the same shared diagnostics producer the US release path uses (per-epoch loss trajectory, per-target rows), with a pinned US<->UK format-parity test; the build block carries the chronicle artifact provenance (facts/manifest shas, profile ids) and reserves score_vs_enhanced_frs. - tools/score_uk_national_candidate.py: #578 rule-1 scoring, both artifacts rescored on one frozen register, June-schema score block with a declared none_declared holdout basis. - Declared non-certified staging-candidate input posture (sha-gated with a mid-read race guard, refused for release candidates) and the held-run runbook, unblocking on WS-E E8+E10 or an explicitly named base. Implemented by Codex from the reviewed plan; review pass fixed the materialization period (declared calibration year, never the frame's base-year time_period) and the parity-evidence sourcing above. Part of #623 under #665. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d adapter Both PRs merged upstream, including María's adaptations of parts of this branch's work (c534517 routes calibration through the shared materializer; 1d066e5 is the cherry-picked #733 review fix). Reconciliation: - target_materialization.py and verify_uk_identity_stability.py: main's reviewed versions taken wholesale. - national_calibration.py: this branch's registry+period+doctrine stage kept (all tests and the driver target it); its private frame adapter replaced by a lifecycle subclass of main's shared UKFrameTargetAdapter — one adapter, now writer-safe (prepared scratch columns restored away post-solve, per the adjudicated materializer-owned lifecycle). - Main's packaged-binding stage tests ported to the registry+period API; the persistence assertion inverted to the adjudicated writer-clean invariant (result columns exactly equal the input columns); the materialization stub adapter adopts the shared count-variable convention. - Digest pins auto-merged to main's post-union re-cut and verified green by the pin suites — no re-measurement needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 22, 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.
Part of #623 under #665 (WS-D). Registry #736 item 10 asked to close-or-narrow #623 after #729 delivered the seam core; this PR is the narrowing, per the adjudicated plan (María, 2026-08-21): all calibration tooling lands now — solve doctrine, honest gate evidence, US-format diagnostics, candidate-vs-incumbent scoring, run posture — and the licensed armed run itself stays held until the WS-E spine completes E8 (#684) + E10 (#686), or María names a different base. Builds on merged #735 (the 2025 Ledger surface) and #733 (the FRS 2024-25 line).
What lands
uk_runtime/national_doctrine.pymirroringlocal_doctrine.py: every solver option the seam previously inherited silently (epochs 256, lr 0.02, max_weight_ratio 10.0, seed 0, loss cap 10.0, l0 0.0, free mass, uniform target weights) is a declared, tamper-tested constant. Doctrine v1 deliberately lifts Add the UK national calibration step over ledger-backed target references #729's values; first-run evidence is the revision path (adjudication 3).UKNationalCalibrationStageconsumes the driver's compiled registry atload_uk_frs_release().calibration_year(2025) and materializes bindings through the shared interpreter via a lifecycle subclass of the sharedUKFrameTargetAdapter: prepared scratch columns are restored away post-solve, so the staged frame survives the real HDFStore writer (closes Add the UK national calibration step over ledger-backed target references #729 dispositions finding 4, per adjudication 2 — materializer-owned lifecycle). The materialization period is passed explicitly — never the input frame's base-yeartime_period, which lags the calibration year.national_calibration_mass_reason()names the bound families; a post-solve fence requires the CALIBRATED kind and exactly one appended mass record; the stage manifest carries the rowwise-conventionweightsblock (household_weight_kind_chain,calibration_mass_change, solve block, doctrine echo)._stage_parity_evidencebuilds theuk_export_surface/uk_target_surface/uk_target_fitevidence from independently sourced sides: candidate from the staged frame and solve diagnostics, reference from the frozen eFRS parity instrument (parity_referenceparameter, driver passes the committed instrument) and the declared registry atname@periodgrain. A copied reference can never fabricate a pass; unarmed builds keep the honestevidence_absent, pinned in both postures.uk_calibration_diagnostics_payload/write_uk_calibration_diagnostics— the same shared producer the US release path imports (schema v6, per-epochloss_trajectory, per-target rows, loss attribution), so the calibration dashboard consumes UK and US files identically. A hermetic format-parity pin asserts the UK payload's shared layer equals the shared producer's output withuk_diagnosticsstrictly additive. Thebuildblock carries the chronicle artifact provenance (facts sha256, manifest sha256, profile ids), build id, code pins, and input posture — every target value traceable throughledger_facts_sha256(Publish Chronicle package IDs in calibration diagnostics targets #661).tools/score_uk_national_candidate.py: both artifacts rescored on the same frozen register withrelative_error_loss(cap 10.0), emitting the June-schemascore_vs_enhanced_frsblock ({candidate,incumbent}×{train,holdout,full}_loss + target_wins) with per-family wins. Signed differences:holdout_basis: "none_declared"(June's holdout split lives only in the archived pipeline); the diagnosticsbuildblock reservesscore_vs_enhanced_frs: nulluntil the licensed run merges the real receipt.--staging-candidate-input-sha256: sha-gated with a mid-read race guard, labeled tier in the build record, refused for release candidates) so the armed run is push-button on any pre-clone spine;docs/uk-national-calibration-runbook-623.mdrecords the exact command, the evidence-dir layout, and the two unblock conditions. Grain basis (adjudication 1): the incumbent's publishedenhanced_frs_2024_25.h5is itself pre-clone (52,846 households;clone_and_assignfeeds only its local-weights product), so pre-clone scoring is apples-to-apples — with one signed method difference to carry into the score receipt: incumbent national weights are a collapsed local solve, ours is a direct national solve under doctrine.Explicitly out of scope
Verification
Hermetic: doctrine pinned tests; single-compile-path + writer regression through the real
write_uk_national_frame; armed/unarmed parity-trio postures; mass-record fences; US↔UK diagnostics format-parity pin; scorer unit tests on synthetic twins; staging-posture flag matrix (adversarial refusals). Synthetic end-to-end in CI: armed synthetic build → real writer → full battery, US-format diagnostics, Logbook row withledger_factsbound ininput_pins_digest. Full three-shard suite + ruff green locally on the merged tip.🤖 Generated with Claude Code