Skip to content

Run all of policyengine-us main's Python tests against the Core under test - #682

Open
hua7450 wants to merge 3 commits into
masterfrom
policyengine-us-all-python-tests
Open

hua7450 wants to merge 3 commits into
masterfrom
policyengine-us-all-python-tests

Conversation

@hua7450

@hua7450 hua7450 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Why

#635 added a job that runs policyengine-us main's tests against the Core under test, but only a hand-picked list of 13 fast files. Core 3.41.0 (#675) then broke two policyengine-us SPM tests that weren't on the list, and policyengine-us main went red the same day.

Since 2026-10-01, policyengine-us main has had 185 failed runs. Four of them were caused by a Core release, and all four broke Python tests:

Date Core release Tests that broke On the old list?
Oct 3 3.32.15/16 test_formulas_do_not_write_into_cached_arrays.py No
Oct 27 3.33.13 test_social_security_input_state_machine.py Yes
Dec 1 3.39.0 test_social_security_input_state_machine.py Yes
Dec 3 3.41.0 2 tests in test_spm_system.py No

Most of the other failures were version-bump push races, Publish failures and runner shutdowns. The YAML failures in that period were policyengine-us's own: for two of them, the last green release run before the failure used the same Core version, and the third (Oct 7) failed in one run and never again. So this PR runs every Python test and leaves the YAML tests out.

What changes

On PRs marked ready (not drafts), six jobs replace the single policyengine-us job:

  • plan finds policyengine-us's latest successful release run (an "Update PolicyEngine US" run on main that passed on its first attempt) and downloads that run's JUnit reports. It checks out the run's commit and plans the Rest Python shards with policyengine-us's own rest_python_shards.py, using those reports as timings.
  • Rest Python (one job per shard, 7 today), Microsimulation, SPM and Contrib Python each install policyengine-us at that commit with this Core, using a new composite action .github/actions/policyengine-us-main. They then run the tests with the same commands policyengine-us's CI uses: the shard runner, make test-microsimulation, make test-other-python-spm, and the files make test-policy-contrib-python runs.
  • compare sets this Core's results against the release run's reports, then posts the check policyengine-us compatibility (grey and neutral for breaks, as before; green otherwise) and one bot comment. The bot now posts that comment whether or not anything breaks, and edits it on each push.

Other changes:

  • The released side now comes from policyengine-us's own release run, so it isn't rerun here. Each PR push costs one run of the suite, about 250 runner-minutes and about 35 minutes of wall-clock time.
  • The comparison rules are unchanged. It also says which run it compared against, for example "policyengine-us release run N at abc1234".
  • The release run keeps no report of the contrib Python tests. Because it passed them all, any contrib failure here counts as a break.
  • A test job that fails to set up, loses its runner, or (for contrib) stops early fails compare before anything is posted to the PR.
  • pull_request now also triggers on ready_for_review, so marking a draft ready starts the jobs.
  • The hand-picked list and the select command are removed. Tests policyengine-us adds are covered without any change in Core.
  • AGENTS.md, docs/engineering/skills/github-prs.md and the skills index tell agents to wait for that comment at the PR's head commit before reporting a PR, and what each result means (no breaks, N breaks, or no comment because a job failed).

Result on this PR

  • At b5c5006, against release run 47176564722 (Core 3.40.1), the check reported that this Core breaks exactly 3 tests: the Social Security input state machine test and the two test_spm_system.py tests that Core 3.41.0 broke. The old list missed the SPM tests. Fix policyengine-us for policyengine-core 3.41.0's on-demand current-law copy policyengine-us#11729 fixed all 3.
  • After that merged, I reran the plan job. Against release run 47202942027 (d16c0d4), it reported no breaks: 12,059 passed in the release run and 12,177 with this Core (the extra tests are contrib, which the release run doesn't report). The check turned green.

Checks

  • ruff format --check . and ruff check --select F on the changed Python files both pass.
  • I ran the plan job's release-run step locally with my own GitHub token. It picked run 47176564722 (88873cb, Core 3.40.1) and downloaded 7 Rest shard reports, the Microsimulation reports and the SPM report.
  • I ran compare on those reports:
    • Against themselves: 12,054 passed and 15 skipped, with no breaks.
    • Against a candidate holding only the SPM report: it flagged the 11,938 missing tests and exited 1.
  • Not run locally: the Core test suite, including the updated tests/core/test_country_main_tests.py. CI runs it.
  • Not run locally: actionlint, because Docker wasn't running. The Lint workflows job runs it.
  • Answered by this PR's run: the job's default GITHUB_TOKEN can download policyengine-us's release run reports, so no extra token is needed. It can't read that run's job logs, so the comment leaves out which Core the release run used.

🤖 Generated with Claude Code

… test

The policyengine-us main job ran a hand-picked list of 13 fast files. Core
3.41.0 broke two SPM tests on policyengine-us main that the list did not
include, and since 2026-10-01 the list would have caught only two of the four
Core releases that broke policyengine-us's Python tests.

On PRs marked ready, jobs now check out the commit of policyengine-us's
latest successful release run, install this Core, and run its Python tests
as that run did: the Rest shards from its own planner, Microsimulation, SPM
and the contrib Python tests. Compare sets the results against that run's
JUnit reports instead of a second run with the Core release, so each PR
push costs one run of the suite. The YAML tests stay out: no Core release
broke one in that time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hua7450
hua7450 requested a review from anth-volk December 3, 2026 20:02
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

policyengine-us main against this Core

No policyengine-us test breaks: every policyengine-us Python test that passed in policyengine-us release run 47202942027 at d16c0d4 still passes with this Core.

Checked at 3f9e0ba (run).

…ait for 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.

1 participant