Skip to content

Pin England-scoped SLC and scotgov targets to their publication geographies - #758

Merged
MaxGhenis merged 1 commit into
mainfrom
slc-scotgov-geography-pins
Aug 24, 2026
Merged

Pin England-scoped SLC and scotgov targets to their publication geographies#758
MaxGhenis merged 1 commit into
mainfrom
slc-scotgov-geography-pins

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Follow-up to #754. That PR fixed the nine scotgov.council_tax_stock.* geography pins and deliberately left the other 14 no_fact_at_or_before_period holds unadjudicated. This PR adjudicates all 14 individually and activates the 11 that are mechanical pin bugs, leaving 7 deliberate holds with their rationales recorded below and in the pin-rule comments.

Per-id adjudication

Every hold was diagnosed against the pinned consumer feed (consumer_facts_uk.jsonl, sha 226358e7…, chronicle at 1cab809) by matching each target's non-geography selector and listing the geographies, periods and assertions of the facts it reaches, then checking the contract binding and the policyengine-uk model code for the country scope.

Fixed here (11):

target id(s) facts in feed why the pin was wrong
scotgov.scottish_child_payment_spending S92000003, fy2024 outturn + fy2025/fy2026 budget projections Same bug class as #754: the nation-substring rule sees no "scotland" in "scotgov"/"scottish_child_payment" and fell through to the UK pin. The benefit and the facts are Scotland-scoped. Resolves to the fy2025 projection (£471m) under allow_source_projection.
slc.borrowers.plan_{2,5}_{above_threshold,liable} (4) E92000001, academic years 2024–2029 (projections) The contract bindings already filter country == ENGLAND explicitly, and the facts are England-stamped; the GB default pin could never match. Resolve at AY2025.
slc.support.{maintenance_loan,parents_learning_allowance,adult_dependants_grant}_{recipients,spend} (6) E92000001, academic years 2013–2024 (observations) The bound model variables are England-gated by construction (maintenance_loan_in_england_system, parents_learning_allowance_eligible, adult_dependants_grant_eligible all require country == ENGLAND in policyengine-uk), and the facts are England-stamped. Resolve at AY2024 with uprating holds 2024→2025 recorded.

Deliberately still held (7): these are not pin bugs and activating them via a pin change would be wrong.

target id(s) why held
obr.council_tax_{england,scotland,wales}, obr.domestic_rates Facts exist at K02000001 (OBR Table 4.1 nation rows, chronicle#192) versus nation pins, but the joint verdict from the council-tax review stands: keep held until the UK council-tax binding is redesigned (the active obr.council_tax target is row 19, which includes NI domestic rates and an accruals adjustment with no household counterpart; the redesign should prefer publisher administrative targets or row 15).
dwp.pip.daily_living_{standard,enhanced}_claimants The FOI fact covers England and Wales (K04000001), but the binding has no country filter and the model's pip_dl_category is derived from FRS-reported amounts with no country restriction, so the model metric's footprint is GB. Activating with a K04000001 pin would compare a GB metric to an E&W count. Needs a binding decision (an England-and-Wales country filter), not a pin change.
slc.repayments.devolved_total Wrong twice over: "devolved" means Scotland + Wales + Northern Ireland (not GB, the current pin), the feed carries one fact per nation (no aggregate), and the bound metric name slc/student_loan_repayment/devolved is not computable by the compute path (its country map has no "devolved" entry). Needs a per-nation redesign of the contract target, not a pin.

Changes

  1. tools/generate_uk_target_references.py — replaces the Pin the scotgov council-tax stock targets to Scotland (activates the nine held CTAXBASE references) #754 stock-prefix special case with a TARGET_PREFIX_GEOGRAPHY_PINS table: scotgov. → Scotland, slc.borrowers. → England, slc.support. → England, each entry commented with the layer that fixes the geography (fact stamp, contract binding, or model country gate). slc.repayments.* intentionally stays with the substring rule.
  2. packages/microcosm-build/src/microcosm/build/ledger_targets.py — one-token fix: _is_period_token now strips the ay prefix alongside ty/cy/fy. The SLC series key one record set per academic year (…ay2013…ay2029); without this the per-year record sets defeat the period-invariant key, the latest-at-or-before tiebreak refuses, and all ten SLC ids landed in multi_fact instead of activating. New unit test test__given_academic_year_record_sets__then_latest_source_period_is_used locks the behaviour.
  3. Regenerated target_references.json (+11 references) and target_reference_membership.json: active 397 → 408, no_fact_at_or_before_period 18 → 7, multi_fact stays 1 (the documented genuine ONS residue). Reference-level diff verified: 11 added, 0 removed, 0 existing references changed — the ay normalisation perturbs nothing already active.
  4. Count pins updated in test_uk_target_references.py, test_uk_national_calibration.py, test_country_spec.py; the Pin the scotgov council-tax stock targets to Scotland (activates the nine held CTAXBASE references) #754 scoped-pin test is rewritten as test_prefix_geography_pins_carry_scotgov_and_england_scoped_slc_families, which also asserts the seven deliberate holds stay held.

Verification

  • Regenerated from the same pinned feed as Pin the scotgov council-tax stock targets to Scotland (activates the nine held CTAXBASE references) #754 (byte-identical reproduction recipe in that PR).
  • New actives resolve as expected: SCP → fy2025 £471m projection; borrowers → AY2025 projections; support → AY2024 observations (e.g. maintenance-loan recipients 1,159,761) with uprating holds 2024→2025 registered alongside the existing slc.repayments.england_* ones.
  • Full packages/microcosm-build pytest suite green locally; ruff format/check clean.

🤖 Generated with Claude Code

…aphies

Adjudicates the 14 UK target references still held as
no_fact_at_or_before_period after #754 and activates the 11 that are
mechanical geography-pin bugs: scotgov.scottish_child_payment_spending
(Scotland-stamped Scottish Budget facts vs a UK pin) and the ten
slc.borrowers.*/slc.support.* ids (England-stamped publications whose
contract bindings and model variables are England-scoped vs GB pins).
Also treats ay-prefixed academic-year record-set tokens as
period-bearing so the multi-year SLC series collapse to one
period-invariant series and resolve to the latest fact at or before the
target period. Active references 397 -> 408; the seven remaining holds
(four obr council-tax ids, two dwp.pip claimant counts,
slc.repayments.devolved_total) are deliberate and documented in the pin
rule and tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis merged commit e4ff47b into main Aug 24, 2026
4 checks passed
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.

1 participant