Repository navigation
Check each country's newest model release on Tuesdays and Fridays - #792
Merged
Merged
Conversation
Tests that fail before the change: a workflow checks each country's newest model release against the Microcosm builds the bundle pins on Tuesdays and Fridays and by hand, opens a draft certification pull request per run on a branch named after the country and model version, uploads a result file per country and opens or updates one failure issue per country. The UK-only certify-uk-release.yaml is gone, and the runner-variable tests cover the new workflow's jobs instead of the old one's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add .github/workflows/check-model-compatibility.yaml. On Tuesdays and Fridays at 06:17 UTC, and by hand for a named version, it picks each country's newest policyengine-us or policyengine-uk release, leaves out a country whose version the bundle already pins or already has a pull request, and runs scripts/bundle.py certify-build on the pinned national and local-area Microcosm builds with that version. A pass pushes a new branch certify/<country>/<model package>-<version> and opens a draft pull request as the GitHub App; earlier pull requests stay open. Every run uploads a compatibility-<country> result file, and a failure opens or comments on one issue per country, which the next pass closes. scripts/compatibility_workflow.py holds the plan, the result file and the issue handling, reading only the bundle manifest, PyPI and GitHub. Remove certify-uk-release.yaml, which read only policyengine-uk-data releases and so never promoted a Microcosm build, together with its runbook and the tests that read its YAML. The UK qualification script, modules, ledger script and data files stay for now; their docstrings no longer say the workflow runs them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests that fail before the change: the certification branch also names the national build (certify/<country>/<national build>/<package>-<version>), as certify-build names its own branches, so a newly pinned build is checked again for a version already checked against an older one. certify-build runs with --in-place, --output-dir and --pr-body-footer, and the pull request step commits only the files certify-build lists, with its pull request body and its title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check job now runs scripts/bundle.py certify-build with --in-place, --output-dir and --pr-body-footer, then commits only the files certify-build lists as changed and opens the draft pull request with its body and its title. The certification branch names the national build as certify-build's own branches do: certify/<country>/<national build>/<package>-<version>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These tests fail until the workflow and its script change: - A GitHub-hosted runner frees disk space before installing, because the US check needs about 16 GB free and the runner starts with about 14 GB. - The checkout comes first and keeps no token; the App token is made after certification, just before the push, because App tokens last an hour. - The pull request step's script, run with stand-in git and gh commands, sets up gh as git's credential helper before pushing, and runs under bash 3.2 as well. - A cancelled run is recorded as cancelled and leaves the issue alone. - The plan leaves out a version whose branch is already on GitHub without a pull request. Also tests the gh and git commands the plan uses, and removes two fake pull request listings that no test uses since the UK workflow's tests went. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review round 1: - The check job checks out first, without keeping a token, and makes the GitHub App token after certification, just before the push. App tokens last an hour and the US check can take several. gh sets itself up as git's credential helper for the push. - A GitHub-hosted runner deletes tool directories this job does not use before installing, so the US builds and certify-build's 5 GB margin fit. - A cancelled job is recorded as cancelled, with the job's status passed to the result steps, and leaves the failure issue alone. - The plan leaves out a version whose branch is already on GitHub without a pull request, since pushing it again would fail. - The pull request step upper-cases the country with tr, which bash 3.2 also runs, and the result steps use the runner's python3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review round 2: GitHub cancels a job that reaches its own time limit, so a check that ran too long would be recorded as cancelled and leave the failure issue alone. The test fails until the certification step has a time limit at least 20 minutes below the job's. Also runs the pull request step's script with `bash -e`, as GitHub runs a step that names no shell, and drops a monkeypatch option that was needed only before remote_branch_exists existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review round 2: the certification step now stops after 270 minutes, 30 before the job's limit. A check that runs too long is then recorded as a failed certification and opens or updates the failure issue, instead of being cancelled with the job. Also corrects two comments: which pull requests make the plan leave a version out, and what else certify-build writes to its output directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review round 3. These tests fail until: - the workflow's concurrency group queues waiting runs (queue: max) instead of letting a newly queued run cancel the one already waiting; - an error while planning one country (PyPI, gh, git or its manifest entry) leaves the other country in the matrix, names the failed country in an `unplanned` output, and a later step fails the plan job; - the check job runs for the planned countries even when the plan job failed for another. Also checks that the plan step passes --model-version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e other From review round 3: - The concurrency group sets queue: max, so a newly queued run waits behind the one already waiting instead of cancelling it. Two manual runs, one per country, no longer drop the first. - The plan plans each country separately. A country whose lookup fails (PyPI, gh, git or its manifest entry) is listed in the run summary with its error and named in a new `unplanned` output; the other country stays in the matrix. A step after the outputs then fails the plan job, and the check job runs for the planned countries unless the run was cancelled. actionlint 1.7.12 does not yet know the documented queue key (rhysd/actionlint#657); .py's CI does not run actionlint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pull request conflicted with main. main's #761 turned off certify-uk-release.yaml's schedule and dispatch triggers and edited its runbook and YAML tests; this branch removes all three, so the resolution keeps them removed, including the test #761 added for the turned-off triggers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Anthony's decision on review round 3's low-priority finding: a pull request for a model version and national build stopped the plan from checking that version again after a new local-area build was pinned. These tests fail until the branch is named certify/<country>/<national build>/<local-area build>/<package>-<version>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Branches are now certify/<country>/<national build>/<local-area build>/<package>-<version>. A pull request for a version checked against an earlier local-area build no longer stops the plan from checking that version against a newly pinned one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workflow runs scripts/bundle.py certify-build --in-place, which #794 adds. Merging its reviewed branch lets this branch test that certify-build accepts every option the workflow passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With #794 merged in, the certification step's command, filled in from a planned entry, parses as certify-build's own arguments and reaches them unchanged, for both countries. certify-build's branch_name also gives the branch the plan computes, so a pull request opened by either one stops the other from opening a second for the same check. These cover how the two scripts fit together, so they passed when first run; no code changed to make them pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub reported the pull request as conflicting after #789 (7c · 1) merged into main. This branch already held #789's changes through #794's branch, and git merges main without a conflict; the merge commit's files are the same as the branch head's. It gives the two branches one merge base again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub marked the pull request as conflicting after #794 merged, because the branch and main had two merge bases. git merges main without a conflict, and the result's files are the same as the previous head's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #787
What this changes
On Tuesdays and Fridays at 06:17 UTC, and by hand, a new workflow,
.github/workflows/check-model-compatibility.yaml, checks each country's newest model release against the Microcosm builds the bundle manifest pins. It replacescertify-uk-release.yaml, which checked policyengine-uk wheels only against policyengine-uk-data releases, and which #761 already limited to manual runs.Plan job (
ubuntu-latest, reads only).scripts/compatibility_workflow.py planreadssrc/policyengine/data/bundle/manifest.jsonand PyPI. For each country it takes the newestpolicyengine-usorpolicyengine-ukrelease, or the version typed into a manual run (country: both, us or uk;model_version: needs one country). It reads the pinned national and local-area builds from the manifest'srelease_manifest_uriandregional_release_manifest_uri, and names the branchcertify/<country>/<national build>/<local-area build>/<model package>-<version>, so a version is checked again whenever either pinned build changes. It leaves a country out when:It writes the countries left as the check job's matrix and a summary table to the run page. Each country is planned separately: if PyPI,
gh,gitor a country's manifest entry fails, that country is listed with its error and the other is still checked; a later step then fails the plan job, so the run shows as failed. Runs share one concurrency group withqueue: max, so a run queued behind a waiting run waits too instead of cancelling it.Check job (one per country left, run unless the run was cancelled, on the
CERTIFY_RUNNER_X64runner expression, soubuntu-latestwhile that variable is unset):mainwithout keeping a token.certify-buildwants 5 GB more free; the runner starts with about 14 GB.scripts/bundle.py certify-build --in-placewith the planned model version and the pinned builds, for at most 270 minutes (the job's limit is 300, and GitHub cancels a job at its limit rather than failing it). OnlyHUGGING_FACE_TOKENis passed to this step. It runs the compatibility check, and on a pass writes the compatibility record, the changelog fragment and the pull request body, plus a list of the files it changed.certify-build's title and body. Each run opens its own pull request and leaves earlier ones open, so any checked version can be merged.compatibility-<country>result file: the model version, the pinned builds,passed,failed(naming the step: setup, certification or pull_request) orcancelled, the pull request and the run. The drift report (8b · 2) reads it.ghcalls, with no AI involved.Also removed:
certify-uk-release.yaml;tests/test_uk_qualification_workflow.pyand two intests/test_uk_qualification_pipeline.py, with two fake pull request listings only they used;docs/engineering/runbooks/uk-qualification.md.Docstrings that pointed at the runbook or the workflow are updated. The rest of the UK pipeline, its Python code and
qualification-ledger.sh, stays for now. A later task removes it, keepinguk_uc_floor.json.Decisions (Anthony's)
17 6 * * 2,5.ghcalls.policyengine-corestays at the bundle's pin.compatibility-<country>artifacts.Tests
tests/test_model_compatibility_workflow.py(new) covers:ghandgit ls-remotecommands it runs;${{ inputs.* }},${{ matrix.* }}or${{ github.event.* }}inside anyrunscript;gitandghcommands.tests/test_ci_runner_variables.pynow lists the new workflow's two jobs.Local results. Only the added or changed tests were run, each by node ID:
52b4924tests,2e91435changeba76563tests,693a7b9change (certify-build --in-place)47fda41tests,38716cachange (review round 1)${COUNTRY^^}7c45d3ftest,89df93fchange (review round 2)9aac84btests,444a83fchange (review round 3)--model-version, is new coverage and passed)7c65aa0tests,6fd3adachange (local-area build in the branch name)a2a0c9dtests, after merging #794certify-buildfit together; no code changed to make them pass)certify-build's arguments with the same values, andcertify-build'sbranch_namegives the plan's branch, for both countriesmainwas merged in once (cd050c2) to resolve a conflict with #761. #761 had edited the old workflow, its runbook and its YAML tests, all of which this PR removes, including the test #761 added. After the merge, the bundle test and the runner-variable tests passed again. ruff format and check on the changed Python files report nothing. actionlint reports nothing except thequeuekey, which GitHub documents but actionlint 1.7.12 does not know yet (rhysd/actionlint#657); .py's CI does not run actionlint.Review
Three rounds of adversarial review, each by a fresh reviewer. The files are kept outside the repository.
Round 1 (head
93be013), five bugs, all fixed in47fda41(tests) and38716ca(change):ubuntu-lateststarts with about 14 GB. A step now frees disk space on GitHub-hosted runners.cancelled, and the issue is left alone.Round 2 (head
38716ca) confirmed round 1's fixes and answered four questions:gh auth setup-gitworks with onlyGH_TOKEN;job.statusiscancelledinalways()steps after a cancellation;runner.environmentexists; and the plan job can rungit ls-remote. One bug, fixed in7c45d3fand89df93f:cancelledand opened no issue. The certification step now has its own 270-minute limit.Round 3 (head
89df93f) confirmed round 2's fix. Three bugs:9aac84band444a83f: by default a newly queued run cancels the run already waiting in the concurrency group, so a second manual run dropped the first, or a waiting scheduled run. The group now setsqueue: max.gh,git, its manifest entry) stopped the other country's check too. Countries are now planned separately, as described above.7c65aa0and6fd3ada(Anthony chose this fix): the branch name held the national build but not the local-area build, so a version that already had a certification pull request, in any state, was not checked again after a new local-area build was pinned. The branch now names both builds.certify-build's own branches (7c · 2, when run without--in-place) name only the national build; this workflow does not use them.Bugs left, by priority
No bugs are left. Code-quality notes from the reviews:
failedalso covers acertify-buildrefusal (for example too little disk) and a failed pull request step after a passing check; the result file'sfailed_steptells them apart only ascertificationorpull_request.HUGGING_FACE_TOKEN.Earlier tasks
scripts/bundle.py check-compatibilityand the compatibility record, Check one Microcosm build against one model version and certify on the result #789) and 7c · 2 (scripts/bundle.py certify-build --in-place, Certify a Microcosm build of either country by release and build name #794) have both merged. The workflow runs from this repository'smain, so nothing it needs has to be published or deployed first.This PR was built on #794's branch, merged in as
214ba13.mainwas merged in again after #789 (657bfd0) and after #794 (a1f0e72): GitHub marked the PR as conflicting each time because the branch andmainhad two merge bases, though git merged them without a conflict, and neither merge changed any file.certify-build's own branches use the same name as this workflow's since #794'sf6d1e3f, at Anthony's request.Environment variables and secrets
HUGGING_FACE_TOKENenv:fromsecrets.HUGGING_FACE_TOKENAPP_ID,APP_PRIVATE_KEYwith:ofactions/create-github-app-token@v1certify/*. Whether the App's installation still has contents and pull-request write access here is unverified.GH_TOKENgithub.tokenand the App token stepenv:pull-requests: readfor the plan,issues: writefor the check.CERTIFY_RUNNER_X64,CI_RUNNER_EVENTSruns-onvars.expressionubuntu-latest.UV_VERSION,PYTHON_VERSION,UV_PYTHONenv:env:Other notes
policyengine-uk-releaserepository dispatch to this repository. Since Allow explicit local US data without unused bundle certification #761, nothing here receives it. The step cannot fail a release (continue-on-error: true), and Remove the release workflow's dispatch to policyengine.py policyengine-uk#2999 asks for it and its test to be removed.🤖 Generated with Claude Code