Repository navigation
Conversation
…service The new script requests /health from the Simulation Entrypoint URL that SIM_ENTRYPOINT selects, reads the Cloud Run revision from the x-policyengine-simulation-revision header, and removes the revision's number and suffix to get the service name. Staging must be served by policyengine-simulation-entry-staging and production by policyengine-simulation-entry; a missing header, a name that is not a Cloud Run revision, a failed request or an unknown environment fails. The shared old gateway reports no environment and is not checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The staging and production model-version alignment jobs now set DEPLOYMENT_ENVIRONMENT and run check_simulation_entrypoint_environment.sh right after checkout, before the bundle compatibility check. Every staging and production deploy job needs these jobs, so a release whose staging SIMULATION_ENTRYPOINT_URL is served by the production Simulation Entrypoint, or the reverse, stops before it deploys. 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 #4003 +/- ##
==========================================
+ Coverage 86.00% 87.86% +1.86%
==========================================
Files 259 259
Lines 15777 16149 +372
Branches 2628 2630 +2
==========================================
+ Hits 13569 14190 +621
+ Misses 1456 1283 -173
+ Partials 752 676 -76 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was successfully 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 #4002
Merge order: merge only after the
stagingsecret points at the staging Simulation EntrypointDo not merge this PR until an operator has done both of these:
/healthwith anx-policyengine-simulation-revision: policyengine-simulation-entry-staging-<number>-<suffix>header.stagingenvironment secretSIMULATION_ENTRYPOINT_URLto that URL, leaving theproductionsecret unchanged.Why: today both environment secrets resolve to
https://simulation.api.policyengine.org, which the production servicepolicyengine-simulation-entryserves. With this check in place, the staging alignment job would reject that URL. Every staging and production deploy job needs the alignment jobs, so every release would fail at its staging step until the secret is changed.Rollback: set the
stagingsecret back tohttps://simulation.api.policyengine.organd revert this PR.Summary
.github/scripts/check_simulation_entrypoint_environment.sh:/healthfrom the Simulation Entrypoint URL thatSIM_ENTRYPOINTselects, using the existingsimulation_entrypoint_env.shhelper.x-policyengine-simulation-revisionresponse header, and takes the service name by removing the revision's five-digit number and three-character suffix.policyengine-simulation-entry-staging, and production bypolicyengine-simulation-entry.DEPLOYMENT_ENVIRONMENT(exit 2).SIM_ENTRYPOINT=old_gateway_direct) reports no environment, so it is not checked.push.yml:ensure-staging-model-version-aligns-with-sim-apiandensure-production-model-version-aligns-with-sim-apinow setDEPLOYMENT_ENVIRONMENTand run the check right after checkout, before the bundle compatibility check.deploy-cloud-run-staginganddeploy-cloud-run-candidateneed these jobs, and read the same environment secret in the same run. A release whose environments are crossed therefore stops before it deploys.docs/migration/cloud-run-operations.mdstates which URL each environment's secret holds and describes the check.changelog.d/simulation-entrypoint-environment-check.added.md.rules/,scripts/rules/, the quality-guard scripts orCODEOWNERS).Environment variables and secrets
Both changed jobs are the release workflow's version-alignment jobs. They run with
environment: stagingorenvironment: production, and only on theUpdate PolicyEngine APIrelease commit.DEPLOYMENT_ENVIRONMENTpush.yml(stagingorproduction)env:SIM_ENTRYPOINTstagingandproductionenvironment variables, currentlycloud_run_simulation_entrypointin bothenv:as${{ vars.SIM_ENTRYPOINT }}(unchanged)SIMULATION_ENTRYPOINT_URLstagingandproductionenvironment secretsenv:as${{ secrets.SIMULATION_ENTRYPOINT_URL }}(unchanged); the deploy jobs pass the same secret to Cloud Run throughdeploy_cloud_run_candidate.shhttps://simulation.api.policyengine.org(production), checked on the running services on 2026-10-20. Thestagingvalue must change before merge (see above).OLD_SIMULATION_GATEWAY_URLSIM_ENTRYPOINT=old_gateway_direct)No secret or variable is added, and nothing is passed to Docker builds or to Cloud Run that was not passed before.
Testing
All runs are local, on this branch, with
uv run --frozenafteruv sync --frozen --extra dev.9d99e5704, script and script tests:pytest tests/unit/test_simulation_entrypoint_environment_script.pygave 11 failed.ruff formatandruff checkon the test file: clean;python scripts/run_quality_guards.py(migration-contracts,rules-registry,ci-scripts): passed;shellcheck --format=gcc .github/scripts/*.sh, the guard's invocation: 0 findings.0ed5c11b2, workflow wiring:KeyError: 'DEPLOYMENT_ENVIRONMENT'.tests/unit/test_cloud_run_deploy_scripts.py,test_deploy_pipeline_scripts.py,test_ci_complete_gate.pyandtest_alembic_workflows.py: 174 passed;https://simulation.api.policyengine.orgfailed, naming production revisionpolicyengine-simulation-entry-00122-low;🤖 Generated with Claude Code