Skip to content

Wait for prod Cloud Run candidate readiness before smoke tests#3732

Merged
anth-volk merged 1 commit into
masterfrom
fix/prod-candidate-health-wait
Jul 6, 2026
Merged

Wait for prod Cloud Run candidate readiness before smoke tests#3732
anth-volk merged 1 commit into
masterfrom
fix/prod-candidate-health-wait

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Fixes #3731

Summary

The Stage 1 observation deploy (run 28811205668) failed at Run Cloud Run candidate smoke tests with httpx.ReadTimeout. Correlated revision logs show the mechanism: the gunicorn early-bind entrypoint (#3720) makes gcloud run deploy return the moment the port binds (18:07:13), while the app import completes ~2.7 minutes later (18:09:55, Application startup complete) — and the prod job fired its smoke tests in between (~18:08:50). The step order relied on the old uvicorn boot behavior where port-bound implied app-ready.

No traffic was affected: the failure precedes the promote step, and App Engine production promoted successfully in the same run. The staging job already had the correct pattern (health wait before test traffic), which is why it passed.

Change

One step in push.yml's deploy-cloud-run-candidate job: Wait for Cloud Run candidate healthhealth_check.sh polling the candidate tag URL's /readiness-check (900s budget, 15s request timeout, 5s interval) — inserted between URL resolution and the smoke tests. The prod job is now symmetric with staging: deploy → resolve → wait until app-ready → smoke test → promote → existing post-promote service-URL health check.

Verification

  • tests/unit/test_cloud_run_deploy_scripts.py: 30/30, including the workflow-structure invariant that promote follows the smoke tests.
  • actionlint: no new findings vs master.
  • Expected timing: the wait absorbs the ~160s import (same as the staging leg's 2.8-min health wait in the last run); no change to total chain duration beyond that.

After merge

This PR's push cycle becomes the Stage 1 exit-gate observation run — third attempt, with both post-merge discoveries (tag length, smoke-test race) fixed.


🤖 Generated with Claude Code

The gunicorn early-bind entrypoint decouples revision readiness (port
bound) from app readiness (country-package import finished, ~160s), so
gcloud run deploy now returns while the app is still booting. The prod
candidate job ran its smoke tests immediately after deploy and hit the
importing instance, failing with read timeouts; the staging job was
unaffected because it already gates test traffic on health_check.sh.
Add the same readiness wait against the candidate tag URL before the
smoke tests.

Fixes #3731

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.82%. Comparing base (4908878) to head (74c146f).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3732   +/-   ##
=======================================
  Coverage   79.82%   79.82%           
=======================================
  Files          70       70           
  Lines        4336     4336           
  Branches      808      808           
=======================================
  Hits         3461     3461           
  Misses        655      655           
  Partials      220      220           

☔ 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 July 6, 2026 18:45
@anth-volk anth-volk merged commit 30c2bd4 into master Jul 6, 2026
10 checks passed
@anth-volk anth-volk deleted the fix/prod-candidate-health-wait branch July 6, 2026 18:45
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.

Prod Cloud Run candidate smoke tests race the app import (no health wait before tests)

1 participant