Repository navigation
Conversation
The staging and production releases both read SIMULATION_ENTRYPOINT_URL from their GitHub environment, and both secrets point at the production Simulation Entrypoint, so staging's live simulation tests ran on production simulation workers. Before each release deploys, a new script reads the revision header from the selected URL's /health response and fails unless the revision belongs to that environment's service: policyengine-simulation-entry-staging for staging, policyengine-simulation-entry for production. The shared old gateway reports no environment and is not checked. 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 #3982 +/- ##
===========================================
+ Coverage 46.17% 84.08% +37.91%
===========================================
Files 239 255 +16
Lines 13987 15368 +1381
Branches 2272 2555 +283
===========================================
+ Hits 6458 12922 +6464
+ Misses 6958 1686 -5272
- Partials 571 760 +189 ☔ 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 #3981
Summary
.github/scripts/check_simulation_entrypoint_environment.sh:/healthfrom the URL thatSIM_ENTRYPOINTselects and reads thex-policyengine-simulation-revisionheader;-NNNNN-xxxsuffix to get the service name;policyengine-simulation-entry-staging(staging) orpolicyengine-simulation-entry(production).old_gateway_directis not checked, because the old gateway is one shared Modal app that reports no environment.push.yml: bothensure-*-model-version-aligns-with-sim-apijobs setDEPLOYMENT_ENVIRONMENTand run the check first. These jobs already run before every release's database migrations and deploys.docs/migration/cloud-run-operations.mddocuments which URL each environment's secret holds, and the check. Changelog fragment added.Migration scope: no route groups or user-visible API contracts change. Only the release workflow and its documentation do.
Merge order (do not merge first)
Today the staging secret points at production, so the new check would fail every release at its staging step. Merge only after these steps:
productionsecret unchanged.Rollback: set the staging secret back to
https://simulation.api.policyengine.organd revert this PR.Environment variables
DEPLOYMENT_ENVIRONMENTpush.yml(staging/production)env:of eachensure-*jobSIM_ENTRYPOINTstaging/productionenvironment variable, bothcloud_run_simulation_entrypointenv:(${{ vars.SIM_ENTRYPOINT }}) in jobs bound to that environmentSIMULATION_ENTRYPOINT_URLstaging/productionenvironment secretenv:(${{ secrets.SIMULATION_ENTRYPOINT_URL }}); the deploy jobs pass it to Cloud Run throughdeploy_cloud_run_candidate.shGATEWAY_AUTH_ISSUER,GATEWAY_AUTH_AUDIENCE,GATEWAY_AUTH_CLIENT_ID,GATEWAY_AUTH_CLIENT_SECRET_RESOURCEenv:, then Cloud Run env throughdeploy_cloud_run_candidate.sh; not read by the new scriptThe staging simulation service's Cloud Run invoker role is
allUsers, and it authenticates callers in the application, as production does. No IAM change is needed.Testing
tests/unit/test_simulation_entrypoint_environment_script.py(new, 11 tests). The script runs undersubprocesswith a fakecurlfirst onPATH. The tests cover a matching staging and production service, staging calling production, production calling staging, the placeholder response, a malformed revision name, a failed request, an unknown environment,old_gateway_direct, and the wiring in bothpush.ymljobs. Before the script existed, 10 failed; all 11 pass now./healthendpoints:tests/unit/test_cloud_run_deploy_scripts.py,test_ci_complete_gate.pyand the new file: 143 passed.python scripts/run_quality_guards.py: passed, includingci-scriptswith shellcheck 0.11.0.1.ruff formatandruff checkare clean on the new test file.🤖 Generated with Claude Code