Skip to content

Remove the UK qualification pipeline - #797

Open
anth-volk wants to merge 8 commits into
mainfrom
claude/7c-5-remove-uk-qualification
Open

anth-volk wants to merge 8 commits into
mainfrom
claude/7c-5-remove-uk-qualification

Conversation

@anth-volk

@anth-volk anth-volk commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #796
Do not merge: Anthony's explicit approval

Tracker task 7c · 5 ("1. Collector/Emitter"): remove the UK qualification pipeline that the removed certify-uk-release.yaml ran.

What this changes

Removed

  • scripts/check_uk_candidate.py.
  • In policyengine.provenance: replay_probe, uk_candidate, uk_qualification, qualification and qualification_ledger.
  • .github/qualification-ledger.sh.
  • Data files only the pipeline read: src/policyengine/data/qualification/{uk.json, replay_policy.md, uk_replay_exceptions.json, uk_review_bounds.json, uk_budget_critical_inputs.json}.
  • The vendored scorecard schemas replay_receipt.v1.json and replay_status.v1.json.
  • Tests only the pipeline used, with their fixtures: replay_exceptions/, uk_metrics/, uk_qualification/, the two real replay receipts under uk_replay/, and the three contract reports under uk_contract/ that only the candidate tests read.

The qualified_exact_pair basis is removed entirely.

  • certify-data (and bundle.py certify-data) no longer takes --qualified-pair-id.
  • DataCertification loses qualification_pair_id and qualification_ledger_url.
  • A model that neither the build nor a publisher claim covers is refused with "…a new data build, a published compatibility claim or a compatibility check of the exact pair (bundle.py check-compatibility) is required."
  • No .py release pinned a certificate on that basis. A bundle whose certificate still names it is now refused when the model loads, online and offline, instead of being read as some other basis.

scripts/release_consumers.py builds both documents itself, with the code moved unchanged from uk_qualification:

  • the policyengine-release repository dispatch;
  • the scorecard's released_bundle replay request, now checked with jsonschema against the vendored qualification_request.v1.json instead of the removed pydantic copy of it.

Both are printed exactly as before. tests/fixtures/release_consumers/ holds the two documents the unchanged code printed, and the tests compare the new output with them byte for byte.

"qualification": null stays in the dispatch. It is kept purely to avoid the challenges of changing other apps: API v2's simulation service and the UK Budget dashboard read it (a null or missing value is accepted by both). bundle.uk is unchanged.

Kept, because other code reads them:

  • the Universal Credit floor check (uk_uc_floor.py, uk_uc_floor.json, scripts/check_uk_uc_floor.py);
  • policyengine.provenance.receipt and canonical (the UK Budget dashboard recomputes certificate digests with receipt);
  • the UK Budget reform contract modules (API v2's simulation service imports them), with evaluate_case_rows.json;
  • the scorecard's golden request and receipt fixtures, which test_canonical_json reads.

Docs. The certification guide describes qualified_exact_pair as removed. Its history paragraph says the qualification receipts are kept on the uk-qualification-ledger branch, which stays unchanged (manual task 7c · 6, which would have replaced it with a tag, was cancelled; a458dac2).

The changelog entry is removed, which the release workflow turns into a minor version bump: a command-line option, a certification basis and public modules go away.

Effects outside .py

  • Microcosm's tools/certify_uk_cut_in_policyengine_py.py calls uk_qualification.certified_constant_replacements and rewrite_certified_constants. It will fail at its constant-rewrite step from this merge until 8d · 1 removes the tool. Certification of Microcosm builds goes through scripts/certify_build.py (7c · 2), which has its own copies of those two functions.
  • UK staging lease (4 h) is shorter than the qualify job's 330-minute limit #662 (the staging lease in uk_qualification.py) no longer applies once this merges. It is left open for Anthony to close.

Tests

Tests that fail before the change (41c3ca41), then the change (ca0e70ee):

  • tests/test_retired_uk_qualification.py:
    • the removed modules and files stay gone, and the files other code reads stay;
    • the runtime basis sets hold no qualified-pair basis;
    • certification's refusal names the compatibility check;
    • certify-data refuses --qualified-pair-id;
    • a bundled qualified_exact_pair certificate is refused online and offline.
  • tests/test_release_consumers.py: the dispatch and the scorecard request are printed byte for byte as the old code printed them, and carry the fields API v2's simulation service and the UK Budget dashboard compare. It also has the earlier request tests, ported from the removed pipeline tests: size from the manifest or the file, the dataset's own location, a missing size source, and a request the schema refuses.
  • Changed:
    • tests/test_release_build_folders.py: the qualified folder-build test now expects the refusal.
    • tests/test_local_data_manifest.py: the default certificate is the built_with_model_package one real bundles carry. Its exact-pair tests use a compatibility_checked_exact_pair certificate with its record. The differential with the frozen main implementation drops the three cases that relied on a qualified certificate.
    • tests/test_certify_data_release.py and tests/test_compatibility_certification.py: assertions about the removed wording and parameter.

Local results, each test selected by node ID (no full suite):

  • On the commit with the failing tests (41c3ca41), 62 test cases from 28 tests ran: 25 failed, all on assertions, and 37 passed. The tests that pass there are meant to pass on both commits: the byte-for-byte document checks, the files that stay, and the reworked existing tests.
  • On the change (5e2b47ab, with the changelog entry), 64 test cases passed: the same tests plus the two existing tests this change updated.
  • Review fixes: the release-check test failed on its assertion (f51b08ab) and passed after the fix (de23c5a0). The tests that only restore coverage passed when added (86060ff8, 3d43d169).

Review

Two rounds of adversarial review, each by a fresh reviewer.

Round 1 (head 5e2b47ab) found one bug, rated medium: Microcosm's UK certification tool imports the removed uk_qualification helpers. This is the accepted effect described above, so it is not changed here. Its code-quality points were fixed:

  • The strict TRACE release check (generate_trace_tros, which bundle.py generate and check run with --strict-tros) now refuses a qualified_exact_pair certificate, as loading the model does: a failing test first (f51b08ab), then the fix (de23c5a0).
  • New tests restore two behaviours whose tests went with the pipeline (86060ff8):
    • a model load checks the installed policyengine-core against a compatibility-checked certificate;
    • the scorecard request leaves out null requested_by members and keeps nulls inside expected_release_bundle, as the removed model did. The old builder was run on the same input and gives the same result.
  • A receipt docstring no longer refers to the removed supported_years check.

Round 2 (head 86060ff8) found no bugs. It named two more kept behaviours without a test, and 3d43d169 adds them:

  • a manifest built with another model package is refused;
  • a certificate on a publisher claim that names a core still loads, online and offline, while another core runs.

The reviews stopped after round 2 because it found no bugs. Bugs left: none, apart from the accepted Microcosm effect.

Merge

  • This PR waits for Anthony's explicit approval (line 2). Anthony asked for a manual review.
  • Earlier tasks: 7c · 1 to 7c · 4 are all merged, which is enough: this PR builds on main and pins, installs or documents no release they publish. 7c · 7 (deleting the candidate/uk/* branches) comes after this merge; 7c · 6 was cancelled.
  • It builds on no other PR branch.

Environment variables

push.yaml changes only in its comments. The NotifyConsumers job's scripts/release_consumers.py reads the same variables as before:

Variable Read by Provider Wiring
HUGGING_FACE_TOKEN (also HF_TOKEN, HUGGINGFACE_HUB_TOKEN if set) scorecard-request, through hugging_face_auth_headers GitHub Actions secret HUGGING_FACE_TOKEN Step-level env: of "Build the scorecard's released-bundle replay request"; the other two names are not set in the job
GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID, GITHUB_RUN_ATTEMPT, GITHUB_SHA scorecard-request (requested_by) GitHub Actions default variables Present in every step
VERSION Passed as --version The Publish job's version output Step-level env: of both steps
POLICYENGINE_SKIP_COUNTRY_IMPORTS .py's import Set by the script itself (os.environ.setdefault) None needed
APP_ID, APP_PRIVATE_KEY actions/create-github-app-token (unchanged) GitHub Actions secrets with: of the token steps; not read by the changed code

🤖 Generated with Claude Code

anth-volk and others added 7 commits December 4, 2026 20:50
New tests require that the modules, script, ledger helper and data files
only certify-uk-release.yaml used are gone, that certification names the
compatibility check instead of qualification, that certify-data no longer
takes --qualified-pair-id, and that loading a bundle whose certificate is
on the retired qualified_exact_pair basis is refused.

tests/test_release_consumers.py requires scripts/release_consumers.py to
build the policyengine-release dispatch and the scorecard's released-bundle
request itself, printing exactly the documents the old builders printed
(written to tests/fixtures/release_consumers/ by the unchanged code).

Existing tests that used a qualified-pair certificate as their default now
use the built_with_model_package certificate real bundles carry, or a
compatibility-checked certificate with its record where they test the
exact-pair refusals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
certify-uk-release.yaml, which ran it, was removed earlier. This removes
the rest: scripts/check_uk_candidate.py, the replay probe, the UK
candidate, qualification and ledger modules, .github/qualification-ledger.sh,
the data files and vendored scorecard receipt and status schemas only the
pipeline read, and their tests and fixtures.

The qualified_exact_pair basis goes with it. Certification no longer takes
--qualified-pair-id, a model that neither the build nor a publisher claim
covers is now pointed to the compatibility check, and a model refuses to
load a bundle whose certificate names the retired basis.

scripts/release_consumers.py now builds the policyengine-release dispatch
and the scorecard's released-bundle request itself, and checks the request
against the vendored qualification_request.v1.json. Both documents are
unchanged. The dispatch keeps its qualification member, always null, only
so that API v2's simulation service and the UK Budget dashboard, which read
it, need no change.

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

Review round 1 found that the strict TRACE release check no longer
recognises the retired qualified_exact_pair basis, so such a bundle would
pass the release and then fail every UK import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The strict TRACE release check now refuses the qualified_exact_pair basis,
as loading the model does, so such a bundle cannot be released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 found two behaviours left without a test once the
pipeline's tests went: a model load reads the installed policyengine-core
for a compatibility-checked certificate, and the scorecard request leaves
out null requested_by members while keeping nulls in
expected_release_bundle. Also drop the receipt docstring's mention of the
removed pipeline's supported_years check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 found two kept behaviours without a test: a manifest built
with another model package is refused, and a certificate on a publisher
claim that names a core still loads while another core runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk requested a review from juaristi22 December 4, 2026 17:51
@anth-volk
anth-volk marked this pull request as ready for review December 4, 2026 17:51
Manual task 7c · 6, which would have replaced the uk-qualification-ledger
branch with a tag, was cancelled, so the branch stays and the docs name it.

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.

Remove the UK qualification pipeline from .py

1 participant