Repository navigation
Require the simulation API's latest PolicyEngine.py version before deploying - #4158
Merged
Merged
Conversation
…ploying The bundle check compared the simulation API's US and UK routes with the installed bundle's worker, so a Public API behind the simulation API was blocked only when the newer bundle kept the same US and UK versions. It now fails unless the installed PolicyEngine.py version is the policyengine.latest that the selected environment's /versions reports, and it runs on every pull request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4158 +/- ##
===========================================
+ Coverage 51.68% 88.22% +36.53%
===========================================
Files 267 285 +18
Lines 15193 16847 +1654
Branches 2435 2741 +306
===========================================
+ Hits 7853 14863 +7010
+ Misses 6685 1302 -5383
- Partials 655 682 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was previously deployed
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 #4157
Summary
The bundle check now fails unless the Public API's installed PolicyEngine.py version is the latest one the simulation API has published (
policyengine.latestin the selected environment's/versions). It no longer compares the simulation API's US and UK routes, and it runs on every pull request..github/request-simulation-model-versions.sh: after confirming that/versionsroutes the installed PolicyEngine.py version, it reads.policyengine.latest. It fails when that's missing, or when it differs from the installed version, for example "The Public API is on PolicyEngine .py 6.11.1, but the simulation API's latest is 6.12.0". The unused-usand-ukoptions and their route comparison are removed.policyengine_api/worker_spm_release.py:validate_installed_workerno longer requires the installed policyengine-us and policyengine-uk versions' routes to name the bundle's worker app. It still checks that the installed packages match the bundle manifest, and that the registry's SPM capability for the PolicyEngine.py version matches..github/check-policyengine-bundle-supported.sh:--if-changed-from-base, which skipped the check unless a pull request changed the bundle pin or one of seven listed files, is removed. The script now refuses any argument, so a stale caller fails instead of being ignored.pr.yml:ensure-policyengine-bundle-supported-by-simulation-apiruns the check with no condition and no longer fetches the full history. Its name and the step names inpr.ymlandpush.ymldescribe the new check.api.migration.bundle-supported-by-simulation-apistates the new requirement, and its rationale now points todocs/canonical-spm.md, which describes the check.docs/generated/rules.mdis regenerated.Why the US and UK routes can be dropped: the Public API sends
policyengine_versionwith every simulation request, so the gateway picks the worker by PolicyEngine.py version (_resolve_pinned_policyengine_route) and doesn't use theusorukroutes for those requests.Expected effect
latestback to an older version, so releases also fail until the Public API's PolicyEngine.py version matches it.latest. Pull requests use staging's.Testing
Each test was run on its own, and the new ones failed before the change:
tests/unit/test_worker_spm_release.py::test_release_accepts_country_routes_to_a_newer_worker(replaces the test that required the country routes to match). Before: "The us route resolves to a different worker application".tests/unit/test_cloud_run_deploy_scripts.py::test_simulation_version_guard_rejects_bundle_older_than_latestand::test_simulation_version_guard_rejects_registry_without_latest. Before: both exited 0.tests/unit/test_cloud_run_deploy_scripts.py::test_simulation_version_guard_uses_selected_endpoint(its registry now haslatest).tests/unit/test_cloud_run_workflow_configuration.py::test_every_pull_request_checks_the_bundle_against_the_simulation_api. Before: the step had--if-changed-from-base.python scripts/run_quality_guards.pypasses, and ruff passes on the changed Python files. This pull request's own run ofensure-policyengine-bundle-supported-by-simulation-apichecked staging's/versionsand passed: "PolicyEngine .py bundle 6.12.0 is the simulation API's latest". The simulation entrypoint relays the gateway's/versionsbody unchanged, and the gateway addslatestfrom its routing state.Environment variables
No new secrets or variables. The jobs that run the check read the same ones as before:
SIM_ENTRYPOINT: GitHub Actions environment variable instagingandproduction(bothcloud_run_simulation_entrypoint). It reaches the scripts through the jobenv:ofpr.yml'sensure-policyengine-bundle-supported-by-simulation-api(environmentstaging) andpush.yml'sensure-staging-model-version-aligns-with-sim-apiandensure-production-model-version-aligns-with-sim-api.SIMULATION_ENTRYPOINT_URL: GitHub Actions environment secret instagingandproduction, passed through the same three jobenv:blocks.OLD_SIMULATION_GATEWAY_URL: read only whenSIM_ENTRYPOINTisold_gateway_direct, which neither environment selects. Unchanged.github.base_refis no longer read.🤖 Generated with Claude Code