Repository navigation
Conversation
Staging deployments tested a tagged candidate and left the staging service's stable traffic on its first revision, Cloud Run's placeholder image. Callers of the staging stable URL, such as the Public API's staging service and the job store's Cloud Tasks and Cloud Scheduler calls, could therefore never reach a tested build. Both staging deploy callers now promote, as production does: the promotion job moves stable traffic to the exact tested revision, runs the stable-URL smoke, release-sentinel and authentication checks, and restores the previous revision if they fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rules registry requires every deployment guard test to belong to a rule. Register sim.deploy.staging-promotes-tested-revision for the new staging promotion test and render the rule views. 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 #853
Summary
simulation-deploy.yml(beta) andstage12-deploy.yml(deploy-stage12-staging) now passpromote_entrypoint: true, as their production jobs already do.simulation-deploy.reusable.yml. Staging now runs the samepromote_entrypointjob as production:/healthrevision header,/ready,/versions, the release-identity fields and/ping.cleanup_entrypoint_revisionsnow also runs for staging. It keeps the promoted revision and the previous one, and deletes the rest. The first promoted run deletes about 67 old tagged staging revisions.prodstill starts only after the wholebetajob, now including promotion, succeeds.promote_entrypoint: true; the old assertion that one caller passedfalseis replaced. Docs andchangelog_entry.yamlupdated.sim.deploy.staging-promotes-tested-revisioninrules/registry.toml, withdocs/generated/rules.mdand theAGENTS.mdrules block re-rendered.Why
See #853. The staging stable URL has served Cloud Run's placeholder
hellorevision since the service was created. Every staging request in the last 5,000 log entries went to a tagged candidate URL. Callers that use the stable URL cannot reach a tested build. Those callers are the Public API's staging service, once it is pointed at staging sim, and the job store's Cloud Tasks and Cloud Scheduler calls.Before merging: one operator step
The stable-URL smoke step parses
/healthas JSON and tolerates only the previous revision's header while traffic settles. The placeholder revision returns HTML. So if the stable URL serves it for even one request after the traffic change, the first promoted run fails. It then restores the placeholder and failsbeta, which blocksprod. Move staging traffic once, before merging, to the newest staging revision that passed its deployment tests. That ispolicyengine-simulation-entry-staging-00069-saj(tags-68), the #712 build that passed run 39309691903's beta deploy and authenticated tests:If a newer staging deployment runs first, use its tested revision instead.
Environment variables and secrets used by the staging promotion
No new variable or secret. The staging promotion and cleanup jobs read only values the
betaenvironment already supplies to its candidate tests:SIMULATION_ENTRYPOINT_GCP_PROJECT_ID,SIMULATION_ENTRYPOINT_GCP_REGIONbetaenvironment variablesenv:inpromote_entrypointandcleanup_entrypoint_revisionsSIMULATION_ENTRYPOINT_GCP_WIF_PROVIDER,SIMULATION_ENTRYPOINT_GCP_DEPLOY_SERVICE_ACCOUNTbetaenvironment secretsgoogle-github-actions/authinputs, viasecrets: inheritsim-entry-gh-deployer(roles/run.admin, enough for traffic updates and revision deletes). The secret's value can't be read, so the mapping is inferred.SIMULATION_ENTRYPOINT_AUTH_ISSUER,SIMULATION_ENTRYPOINT_AUTH_AUDIENCE,SIMULATION_ENTRYPOINT_TEST_AUTH_CLIENT_ID,SIMULATION_ENTRYPOINT_TEST_AUTH_CLIENT_SECRETbetaenvironment secretsenv:for the stable-URL sentinel and authentication checksbeta'sauthenticated_testjobSIMULATION_ENTRYPOINT_ENFORCE_PERMISSIONSbetaenvironment variable (unset, so it deploys0)env:SIMULATION_ENTRYPOINT_CUSTOM_URLbetaenvironment variableenv:beta, so the custom-hostname steps are skippedThe promoted revision carries its own runtime environment and its runtime service account (
sim-entry-beta-runtime), both set when the candidate was deployed. The staging service's ingress isall, and itsroles/run.invokerbinding isallUsers, the same as production. Callers authenticate in the application with Auth0 tokens.Tests
test_staging_deployments_promote_the_tested_entrypoint_revision(both staging callers). It failed before the workflow change (assert False is True, two cases) and passes after.projects/policyengine-simulation-entry:uv run pytest tests/passed (536 tests).python -m unittest discover -s scripts/rules/tests -t .andpython scripts/run_quality_guards.py(shellcheck 0.11.0.1) passed. Formatted withruff format;ruff checkclean on the changed test.Staging tests that follow from this
🤖 Generated with Claude Code