Skip to content

Route API v1 simulations through the Stage 5 entrypoint#3776

Draft
anth-volk wants to merge 4 commits into
masterfrom
stage5-cloud-run-simulation-entrypoint
Draft

Route API v1 simulations through the Stage 5 entrypoint#3776
anth-volk wants to merge 4 commits into
masterfrom
stage5-cloud-run-simulation-entrypoint

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Summary

  • introduce a generic SimulationAPIClient and retain compatibility aliases for the former Modal-specific client;
  • keep the old Modal gateway URL and the new Cloud Run Simulation Entrypoint URL independently configured;
  • select the active simulation entrypoint through validated startup configuration;
  • add no-traffic Cloud Run candidate support and an operator-run, revision-validating rollout/rollback command;
  • ensure GitHub Actions never sets API v1 traffic percentages.

Why

API v1 needs to adopt the separate Stage 5 simulation service boundary without coupling the migration to a one-way cutover. Keeping both targets selectable allows controlled qualification, cross-polling, and immediate rollback while the new Cloud Run entrypoint continues to use the existing Modal gateway underneath.

Impact

The default remains the direct old-gateway path until an operator deliberately deploys and promotes a revision configured for the Cloud Run entrypoint. Existing imports remain available through explicit compatibility aliases.

Root cause

The previous client and deployment configuration assumed that API v1 called the Modal-hosted gateway directly. That made the simulation service boundary inseparable from the Modal hosting implementation and did not provide a guarded, reversible Stage 5 cutover mechanism.

Validation

  • 233 focused client, migration, deployment, contract, and economy tests passed during implementation.
  • changed ASGI gateway-health probe tests passed.
  • the migration contract guard passed.
  • startup validation covers missing, partial, and invalid selected-entrypoint configuration.
  • deployment-script tests confirm traffic percentages remain operator controlled.

Fixes #3775

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.20670% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.71%. Comparing base (e004986) to head (bff2ffc).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
policyengine_api/libs/simulation_entrypoint.py 96.81% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3776      +/-   ##
==========================================
+ Coverage   80.03%   80.71%   +0.67%     
==========================================
  Files          70       74       +4     
  Lines        4342     4422      +80     
  Branches      809      822      +13     
==========================================
+ Hits         3475     3569      +94     
+ Misses        648      623      -25     
- Partials      219      230      +11     

☔ 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.

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.

Route API v1 simulation traffic through the Stage 5 entrypoint

1 participant