ci: harden PR preview readiness gate#71
Conversation
Add an unauthenticated GET /healthz returning 200 to every deployed preview worker (api, upload, content, apex; web already had one) and rewrite the preview readiness step to poll /healthz on each, requiring 3 consecutive 200s before proceeding. Only an exact 200 counts as healthy; 404 (route not yet propagated) and 530 (Cloudflare error 1042) are treated as transient and retried within the budget. Skip per-PR deploys for docs-only changes via paths-ignore. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR implements health check endpoints across the deployed workers and refactors the PR preview workflow readiness gate. A Sequence DiagramsequenceDiagram
participant Workflow as PR Preview Workflow
participant ApexWorker as Apex Worker
participant APIWorker as API Worker
participant ContentWorker as Content Worker
participant UploadWorker as Upload Worker
Workflow->>ApexWorker: GET /healthz
ApexWorker-->>Workflow: 200 ok
Workflow->>APIWorker: GET /healthz (1)
APIWorker-->>Workflow: 200 ok
Workflow->>APIWorker: GET /healthz (2)
APIWorker-->>Workflow: 200 ok
Workflow->>APIWorker: GET /healthz (3)
APIWorker-->>Workflow: 200 ok
Workflow->>ContentWorker: GET /healthz
ContentWorker-->>Workflow: 200 ok
Workflow->>UploadWorker: GET /healthz (1)
UploadWorker-->>Workflow: 404 Not Ready
Workflow->>UploadWorker: GET /healthz (2)
UploadWorker-->>Workflow: 200 ok
Workflow->>UploadWorker: GET /healthz (3)
UploadWorker-->>Workflow: 200 ok
Workflow->>Workflow: All workers healthy — proceed
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-71.isaac-a46.workers.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-preview.yml:
- Around line 134-157: The error message in wait_for_healthz() uses MAX_ATTEMPTS
* SLEEP_SECONDS but omits the curl per-request timeout; update the timeout
calculation used in the final echo to include the curl --max-time value (5s) so
it reflects MAX_ATTEMPTS * (SLEEP_SECONDS + CURL_TIMEOUT). Add a local variable
(e.g., CURL_TIMEOUT=5) near the top of wait_for_healthz or reuse the literal 5,
compute total_wait=$((MAX_ATTEMPTS * (SLEEP_SECONDS + CURL_TIMEOUT))) and use
that variable in the "::error::" echo and return path so the reported seconds
match the actual maximum wait.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 548ff1dc-5319-4001-8eda-6aae889a858d
📒 Files selected for processing (10)
.github/workflows/pr-preview.ymlapps/apex/src/index.test.tsapps/apex/src/routes.tsapps/api/src/index.test.tsapps/api/src/index.tsapps/content/src/index.test.tsapps/content/src/index.tsapps/upload/src/index.test.tsapps/upload/src/index.tsdocs/ops/status/phase-backlog.md
Include curl --max-time in the worst-case wait shown in the gate's timeout error so the reported seconds match actual behavior. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-71.isaac-a46.workers.dev |
|
agent-paste PR preview resources were cleaned up. The pr-preview-${context.issue.number} environment is left in place; remove it from the GitHub UI if desired. |
Summary
Changes
GET /healthzreturning200 ok(no cookies, no DB) to every deployed preview worker:api,upload,content(Hono, registered before auth/contract routes) andapex(routeApex).webalready had one./healthzin each worker'snonContractRoutePathsguardrail and add a healthz test per worker./healthzon every deployed worker and require 3 consecutive 200s before proceeding. Only an exact200counts as healthy;404(route not yet propagated) and530(Cloudflare error 1042) are treated as transient and retried within the budget (45 attempts x 2s).paths-ignore(docs/**,**/*.md,.claude/**) so documentation-only PRs skip the per-PR preview deploy.docs/ops/status/phase-backlog.md.Risk
main, so the docs-only skip cannot block merges.curl --fail"): the gate uses an explicit[ status = 200 ]check instead, which is strictly stricter than--fail(rejects all non-200, not just >=400) and lets us capture/log real status codes cleanly. Behavior is fail-closed.Test plan
pnpm verify(72 Turbo tasks) green locally.Validatepasses on the PR./healthzgate and goes green.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
/healthzhealth-check endpoints across services returning HTTP 200 with plain-text "ok".Chores
Documentation