Complete #622: compile the UK target surface from Ledger facts at the 2024-25 line - #735
Conversation
Authoring-run receipt (regeneration at period 2025)Feed: merged UK consumer facts, 98,392 rows (chronicle post-#173 sex-split surface, bundle years 2023–2026 deduped on Deferral accounting (full classification committed as
Band-structure ruling (María, 2026-08-21): the incumbent's six-year terminal |
Compile-parity receipts (both gates green; every difference enumerated + signed in committed resources)Fixture A — production truth (
Fixture B — incumbent registry @ 12a1e028 / v1.56.16 (652-row union, 637 effective at 2025; frozen extraction via the incumbent's own
Resources: VerificationFull three-package pytest + Implementation trail: seven delegated runs with per-run reports; notable defects caught by receipt review along the way — the Fixture-A period mismatch, a drift classifier that flagged value-equal rows, benunit-grain constraint compilation aborting on real frames (fixed entity-general in |
…tion Resolver: period-token collapse for British year spellings, assertion-policy enforcement (observed-only default, source projections by declaration), and three declared multi-fact operations (sum, calendar_year_average, latest_plateau) partitioned to a single vintage. New country-agnostic modules: target_reference_authoring (contract + feed + period -> typed references + membership classification) and target_materialization (binding interpreter + the three counterfactual provider engines, duck-typed over a model adapter). gates.py gains the ledger compile-parity gate over the existing parity comparator; ledger_artifact.py gains the shared CLI pin helpers. The calibrate matrix now collapses any entity to the weight entity via declared relationships (benunit-grain references previously aborted on real frames). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ontract The contract grows to 189 declarations: the 85-90 sex bands split into uniform five-year 85-89 bands plus 90_plus tail constraints, and all five CSV-suppressed incumbent ancestors are signed (the two NICs-relief rows alongside the IT-relief trio). The active subset regenerates at calibration year 2025 (FRS 2024-25 line, #723): 387 references (identity, sum, and declared holds) from a committed generator, with the full membership classification shipped as a package resource. Parity fixtures freeze the production-2023 release surface and the incumbent registry at 12a1e028 (652 rows; 637 effective at 2025), with every difference enumerated and signed, including the property-income x1.9 undercount provenance (policyengine-uk-data#311/#230) behind that family's signed exclusion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
UK_CGT_TARGET_SPECS retires to the emptied-constants shim; the two totals compile from the hmrc/cgt_statistics facts (latest-not-after resolution to the 2023-24 outturn) and the calibration materializer takes the compiled registry instead of minting from module constants. Coverage requirements and the fenced band facts are unchanged; tests pin the compiled values to the pinned facts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ation seam Two release-blocking preflight gates prove the Ledger-backed compile against the frozen fixtures (production 2023 and incumbent 12a1e028 at 2025) with signed-difference enumeration in both directions. The national build tool adopts the shared ledger-artifact pin surface (one resolved artifact feeds the pin, the gates, and the #729 calibration stage, which is adapted to the 387-reference surface). Gate-battery digests are recomputed from the merged gates.json; the spec-fingerprint doc now matches the code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
chronicle#184 landed the DWP UC benefit-unit caseload facts; the staged feed rebuilt from chronicle main (107,550 facts, sha 226358e7…). dwp.uc.households activates with the adjudicated calendar_year_average operation over the nine CY-2025 monthly facts (mean 6,758,889 vs the incumbent's 6,700,000 — signed +0.9% difference; the Jan/Feb 2026 plateau months are correctly outside the year window). The only membership movement in the refresh: 388 active, 27 no-fact deferrals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
b437ab3 to
2bc8290
Compare
Receipts update — rebased onto main, UC caseload activated (post-chronicle#184)The branch now sits directly on main (#727 + #729 merged beneath it; base retargeted) as five curated commits. The staged feed rebuilt from chronicle main @ 1cab809: 107,550 facts (was 98,392; sha UC activation (the #731-adjudicated operation, first live use): The selector isolates Updated parity receipts: Fixture A 211 compiled (12 exact, 6 signed drift, 131 structural region-grain); Fixture B 388 compiled (187 exact, 163 signed drift incl. the UC row, 38 ledger-only, 287 deferred-side). Full pytest (three packages) + ruff green on the pushed tip, independently re-run. Related filings from review-prep: deferred-adjudications registry #736 (now incl. TCL-2026 retirement and UC element targets), rename issue #737 (lands right after this PR), chronicle facts request PolicyEngine/chronicle#187 (UC element counts + monthly split history). |
|
Automated review pass (Claude Code, low-effort single diff pass — no verification run).
|
… materializer Adversarial-review fixes (two findings, both confirmed): signed parity rows are now self-checking — the live comparison must reproduce each signed row's kind and values within tolerance, and stale or absorbed signatures fail the gate with named failures (evidence records every checked value). The UK national calibration stage prepares measures through the shared target_materialization interpreter and fails closed when any activated reference cannot be materialized; an integration test exercises all five binding classes from the packaged resources (the previous inline path read value_variable unconditionally and would have broken on value_expression and counterfactual-kind references at build time). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…se, assertion compat Multi-fact compiles now stamp their single-fact metadata from the value-representative member (the latest member for latest_plateau and as representative for the aggregates), carry the ordered member keys as ledger_member_aggregate_fact_keys, and name the operation — receipts point at facts that produced the value. The calibrate matrix collapse drops its sorted-id assumption for an argsort-backed lookup with an unsorted-frame regression. Selector 'assertion' is supported again with absent-counts-as- observation semantics (the UK contract still bans it; external references keep compiling). The signed-differences double-consumption finding was already fixed by the run-9 materialization — a generator-input regression now pins it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks @vahid-ahmadi — all four findings dispositioned in
Full three-package pytest + ruff green on the pushed tip, independently re-run; counts unchanged (388 active / 27 no-fact / 1 multi-fact / 1 signed-excluded); parity receipts unchanged (330 / 488 signed rows, all now live-checked). |
Rebase onto main past #735 (#622 target surface at the 2024-25 line) and #741: the UK spec bundle and the three gate-battery digests move because the merged tree changes the attested surface, so they are re-cut here in one reviewed step - policy, gates manifest, spec fingerprint, and the bundle sha, with the release-input coverage manifest regenerated over the same union. The national build record now carries both source_vintages additions (#735's ledger_facts and #723's frs). Part of #723. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ed-world CGT asserts, stage-bound mass receipts Five findings from the pre-push adversarial round, all dispositioned: 1. Gate-battery cross-shard triplet re-pinned in both mirrors from the live producer over the post-#733/#735 union (policy 5cb072a0, gates c5123517, fingerprint 23cf63b6) - the rebase had left main's pre-E8-gate values. 2. The Advani-Summers percentile-69 p95 corrected 15,190 -> 151,900, verified against CAGE WP 465 Table A1 (p. 39); all 61 rows checked value-for-value, single mismatch confirmed as the incumbent's dropped digit - fix-and-sign replaces replicate-and-document. The prior-draw loader now fails closed on any non-monotone quantile row. 3. Salary-sacrifice and student-loan receipts gain expected-vs-realized fields (expected mass = rate x pool, realization deviation), quantifying the Bernoulli realization the port-faithful mechanism accepts. 4. The CGT spine drift assert now binds every operation's full declared parameter mapping closed-world (extra keys rejected), not a subset. 5. Salary-sacrifice and student-loans declare stage-named mass-conservation reasons in both manifests (schema extended), emit matching MassChangeRecords, and the regenerated coverage manifest binds each family to its own receipt instead of the generic fallback (pre-E8 families keep the fallback - follow-up noted). Bundle spec sha re-pinned (17c820bc) for the manifest edits; gate triplet unchanged by them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closes #622: the UK household-sector target surface compiles from Ledger facts at the FRS 2024-25 line (calibration year 2025, per #723), with a compile-parity gate proving the surface against both production truth and the incumbent registry, release-manifest Ledger pins, and CGT single-homed onto references.
Lands on main — #727 and #729 merged beneath it; the Universal Credit caseload activates on the post-chronicle#184 feed. (Terminology note: the ledger→chronicle rename is deliberately excluded and lands as its own mechanical PR after this one — #737.)
What lands
Shared, country-agnostic (
microcosm/build/,microcosm/calibrate/):ledger_targets.py: period-token collapse for British year spellings (fy2024_25,census_2023— same-series vintages previously resolved as ambiguity errors); assertion-policy enforcement (observed-only default;allow_source_projectionby contract declaration); three declared multi-fact operations —sum,calendar_year_average,latest_plateau(the UK scorecard: populace_uk_2023 vs enhanced_frs_2024_25 vs admin benchmarks (2026) #731 ruling; Max's verified UC series as test vectors) — always partitioned to a single vintage.target_reference_authoring.py: contract + feed + period → typed references + membership classification (fan-out, geography/assertion pins, uprating holds; zero unexplained deferrals).target_materialization.py: the binding interpreter (prepared columns fromvalue_variable+ filters + household conditions) and the three counterfactual provider engines (parameter_gated_threshold,baseline_flag_crosstab,input_substitution_counterfactual— the JCT zero-variable pattern, duck-typed over a model adapter).gates.py: a parameterized ledger compile-parity gate over the existingledger_target_registry_parity_report, strict (name, period, value) projection.ledger_artifact.py: shared--ledger-facts/ sha-pin CLI helpers.calibrate/matrix.py: constraint rows now collapse any entity to the weight entity via declared relationships — benunit-grain references (112+ on this surface) previously aborted on any non-1:1:1 frame.UK surface:
85_89+90_plustail constraints (the incumbent's six-year terminal band leaves 91+ unconstrained); all five 410-Gone-suppressed incumbent ancestors signed (NICs pair + IT-relief trio); TCL year-surface accounting updated to the April-2025 facts.target_references.jsonregenerated at period 2025 against the post-chronicle#184 feed (107,550 facts): 388 active references (identity / 54 sum /calendar_year_averageon the UC caseload / 347 explicit holds) from 417 fan-out candidates; membership shipped astarget_reference_membership.json.dwp.uc.householdscompiles to the CY-2025 mean of the nine 2025 monthly caseload facts — 6,758,889 vs the incumbent's 6,700,000, a signed +0.9% difference. Deferrals: 27 no-fact, 1 multi-fact (Scotland households, signed), 1 signed-excluded (property-income amounts — the incumbent's ×1.9 undercount adjustment traces to policyengine-uk-data#311/Add coverage-universe targets for uninsured and private coverage #230; binding official Table 3.7 values would knowingly calibrate to 10/19 of the incumbent surface; registry: WS-C deferred adjudications and the reconciliation layer #736).UK_CGT_TARGET_SPECS→ emptied shim; totals compile fromhmrc/cgt_statisticsfacts (£65.937bn / 378k, the 2023-24 outturn).populace-uk-2023-dd68c73-…(149 rows @2023) and the incumbent at12a1e028(652 rows; 637 effective @2025), every difference enumerated and signed in committed resources.tools/build_uk_national_dataset.pyadopts the Ledger pin surface (one resolved artifact feeds the pins, the gates, and Add the UK national calibration step over ledger-backed target references #729's calibration stage, adapted to this surface).Parity receipts (full 107,550-fact feed)
Authoring receipts, the drift tables, and the implementation trail are posted as comments. Deferred adjudications are centralized in #736.
Out of scope
Running a calibration (#729 owns the seam; run-readiness is the narrowed #623);
local_targets.pyduck-typing retirement (#708); chronicle-side authoring; the FRS 2024-25 ingest itself (#723); the ledger→chronicle rename (#737).🤖 Generated with Claude Code