Skip to content

Allow a UK local-area release on an accepted model mismatch (hold: needs María's routing call) - #699

Draft
MaxGhenis wants to merge 1 commit into
mainfrom
accept-regional-model-mismatch
Draft

MaxGhenis wants to merge 1 commit into
mainfrom
accept-regional-model-mismatch

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Draft, hold. Which regional route the Budget-week UK pairs take is María's call (microcosm cut runbook Q13). This change is ready in case she picks the accepted-mismatch route.

Why

  • Each rolling Microcosm UK national re-cut before the 28 Oct Budget lands on a newer policyengine-uk.
  • The only local-area (dense) cut, microcosm-uk-2024-25-dense-20261019T000432Z-ee5c2dbe, was built on 2.132.6 and claims ==2.132.6. So certify-data refuses to keep routing constituency and local-authority regions to it.
  • A new dense cut takes 2–13 h to build, and its two-build sign-off last took about 30 h.
  • Dropping the routing loses area regions from sim-api's UK default.
  • Area receipts are uncertified already: the certificate covers the national dataset only (Certify the Microcosm UK national and local-area pair with policyengine-uk 2.132.6 #685).

What

bundle.py certify-data --accept-regional-model-mismatch "<who accepted it and why>":

  • Scope. UK only.
  • Routing. Keeps the regional release routed when it does not cover the pinned model, and records this in data_releases.uk:
    "regional_certification": {
      "compatibility_basis": "accepted_model_mismatch",
      "certified_for_model_version": "<X>",
      "built_with_model_version": "<Y>",
      "accepted_reason": "<reason>",
      "area_receipts": "uncertified"
    }
  • Typing. The record is a typed field on CountryReleaseManifest, so consumers see it rather than Pydantic silently dropping it.
  • Warning. Certification emits a warning naming both versions.
  • Refusals. It refuses:
    • an empty reason;
    • a regional release that already covers the version, so a certificate never records a mismatch that isn't there;
    • a run without a regional release.
  • Core. The core must still be covered; a core mismatch is never accepted.
  • National certificate. The national certificate and its compatibility_basis are unchanged.

The cost, stated in the docs

  • The local-area file was built and calibrated under the older model.
  • policyengine-core ignores, with a logged warning, any column the newer model no longer defines (simulation.py, "column(s) that do not match any variable … were ignored").
  • Inputs that the newer model added take their defaults in area runs.
  • A certification PR that uses the flag should list that input-surface difference.

Tests

tests/test_certify_data_release.py (66 pass locally on Python 3.13):

  • the refusal without the flag;
  • the routed and recorded case: record contents, the typed model, sim-api still routing both area types, and the warning;
  • the refusal when the release already covers the version;
  • empty and blank reasons;
  • the core still enforced;
  • no regional release;
  • bundle.py forwarding the flag.

Companion: PolicyEngine/microcosm#1348 adds tools/certify_uk_cut_in_policyengine_py.py, which passes this flag only when asked.

axiom: n/a: certification tooling, no policy encoding

🤖 Generated with Claude Code

…ismatch

certify-data refuses a regional release that neither was built with nor
claims the pinned policyengine-uk. The only Microcosm local-area cut is on
2.132.6, a new one takes 2-13 hours plus a two-build sign-off, and area
receipts are uncertified anyway (the certificate covers the national
dataset only, #685). So each national re-cut on a newer policyengine-uk
had to drop area regions or wait for a dense rebuild.

--accept-regional-model-mismatch REASON (UK only) keeps the regional
release routed and records regional_certification in the bundle: basis
accepted_model_mismatch, both model versions, the reason and
area_receipts: uncertified. It refuses an empty reason, a regional release
that already covers the version, and a run without a regional release; the
core must still be covered. The national certificate is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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