Skip to content

Stage 3: deploy FastAPI shell as Cloud Run candidate#3649

Merged
anth-volk merged 22 commits into
masterfrom
migration-pr3-cloud-run-candidate
Jun 4, 2026
Merged

Stage 3: deploy FastAPI shell as Cloud Run candidate#3649
anth-volk merged 22 commits into
masterfrom
migration-pr3-cloud-run-candidate

Conversation

@anth-volk
Copy link
Copy Markdown
Collaborator

Fixes #3648

Summary

  • Add a Cloud Run ASGI runtime for policyengine_api.asgi:app.
  • Add Cloud Run deployment helpers, Docker runtime, tagged candidate URL resolution, and traffic promotion scripts.
  • Wire staging and production CI so App Engine and Cloud Run deploy on separate tracks, with deployed-service tests before Cloud Run promotion.
  • Connect the Cloud Run candidate to the existing production Cloud SQL instance while keeping tests read-only or mocked.
  • Add a dedicated Cloud Run runtime service account path and document required IAM.
  • Add public Cloud Run health probes and migration request logging for FastAPI-native health routes.
  • Keep App Engine/custom API URL traffic unchanged in this PR.

Validation

  • FLASK_DEBUG=1 .venv/bin/python -m pytest tests/unit/test_cloud_run_deploy_scripts.py -q
  • FLASK_DEBUG=1 .venv/bin/python -m pytest tests/unit/test_asgi_factory.py::test_public_simulation_gateway_health_probe_checks_gateway -q
  • FLASK_DEBUG=1 .venv/bin/python -m pytest tests/unit/test_asgi_factory.py::test_public_simulation_gateway_health_probe_reports_failure -q
  • ruff check policyengine_api/asgi_factory.py tests/unit/test_asgi_factory.py tests/unit/test_cloud_run_deploy_scripts.py
  • bash -n .github/scripts/deploy_cloud_run_candidate.sh
  • git diff --check

Notes

The Cloud Run service URL becomes live after candidate validation, but this does not migrate the public App Engine/custom API URL. The existing untracked markdowns/ folder is not part of this PR.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.98%. Comparing base (d36050d) to head (cf629b5).
⚠️ Report is 26 commits behind head on master.

Files with missing lines Patch % Lines
policyengine_api/asgi_factory.py 92.00% 2 Missing ⚠️
policyengine_api/migration_logging.py 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3649      +/-   ##
==========================================
+ Coverage   78.89%   78.98%   +0.09%     
==========================================
  Files          72       72              
  Lines        4241     4269      +28     
  Branches      787      790       +3     
==========================================
+ Hits         3346     3372      +26     
- Misses        691      693       +2     
  Partials      204      204              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anth-volk anth-volk marked this pull request as ready for review June 4, 2026 21:46
@anth-volk anth-volk merged commit ce2c1db into master Jun 4, 2026
9 checks passed
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.

Stage 3: deploy FastAPI ASGI shell as Cloud Run candidate

1 participant