refactor: replace HTTP status code checks with semantic error types#1342
refactor: replace HTTP status code checks with semantic error types#1342pranaygp wants to merge 1 commit intopgp/run-failed-schema-vailidation-errorfrom
Conversation
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests▲ Vercel Production (22 failed)astro (2 failed):
example (2 failed):
express (2 failed):
fastify (2 failed):
hono (2 failed):
nextjs-turbopack (2 failed):
nextjs-webpack (2 failed):
nitro (2 failed):
nuxt (2 failed):
sveltekit (2 failed):
vite (2 failed):
🐘 Local Postgres (1 failed)nitro-stable (1 failed):
🌍 Community Worlds (56 failed)mongodb (3 failed):
redis (2 failed):
turso (51 failed):
Details by Category❌ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
❌ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8480225 to
6655edc
Compare
1563db7 to
2841381
Compare
🦋 Changeset detectedLatest commit: 90bd273 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🦋 Changeset detectedLatest commit: 2841381 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
6655edc to
e7068bf
Compare
…runtime Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2841381 to
90bd273
Compare

Summary
Replaces the pattern of catching
WorkflowAPIErrorwith HTTP status codes (409,410,429) in the runtime with semantic error types that each world implementation throws directly. This removes the coupling between the runtime and HTTP transport semantics.Stacked on #1340 → #1339
Problem
The runtime had ~18 places doing this:
This is wrong because:
world-vercelimplementation detail leaking into the runtimeworld-localandworld-postgreshad to fake HTTP status codes (new WorkflowAPIError('...', { status: 409 })) to matchSolution
New semantic error types (
@workflow/errors)EntityConflictErrorstatus === 409RunExpiredErrorstatus === 410ThrottleErrorstatus === 429retryAfterAll follow the existing
HookNotFoundError/WorkflowRunNotFoundErrorpattern with.is()static method.World implementations updated
makeRequest()maps HTTP 409 →EntityConflictError, 410 →RunExpiredError, 429 →ThrottleErrorat the throw siteWorkflowAPIError({ status: 409 })→EntityConflictError, etc.Runtime updated
All ~18 catch sites now use semantic checks:
Files touched:
runtime.ts,step-handler.ts,suspension-handler.ts,helpers.ts,runs.tsWorkflowAPIErrorretained as catch-allWorkflowAPIErrorremains for genuinely unexpected HTTP errors. The runtime no longer inspects.statuson it.Test plan
helpers.test.ts,step-handler.test.ts,runs.test.ts🤖 Generated with Claude Code