fix(api): retry failed deployment cleanup#300
Conversation
|
All contributors on this pull request have signed the CLA. |
|
I have read the CLA Document and I hereby sign the CLA |
Yevanchen
left a comment
There was a problem hiding this comment.
Verified the reorder is safe for retries: all five Cloudflare delete operations are 404-idempotent (deletePagesDomain/deletePagesProject/deleteWorkerScript swallow 404; worker domain/route use find-then-delete), so a partially-cleaned deployment converges to success on retry instead of getting stuck. deleteAppDeployment is the single writer of appDeployments.deletedAt and the single GraphQL entry point, and the web deploy surface already handles mutation errors, so the new APP_DEPLOYMENT_CLEANUP_FAILED (502, matching existing badGateway precedent) lands in an existing error path. Test covers fail -> retry -> success including run/deletedAt states. LGTM.
Summary
Why
The previous ordering could hide a deployment in D1 while a Pages project, Worker, route, or custom domain remained externally reachable. A subsequent delete did not retry provider cleanup, leaving a potential security and billing orphan.
Verification
just test-file apps/api/tests/app-deployment-service.test.ts(19 passing);just check(939 passing tests, plus format, docs, lint, type, and GraphQL checks).deleted_atremains unset, the active run is failed, and a later successful retry finalizes deletion.Impact
APP_DEPLOYMENT_CLEANUP_FAILED(HTTP 502) rather than reporting success.Review