Repository navigation
fix(platform): return structured error codes from workflow execution mutations (#2013) - #2210
Conversation
Desk review — PR #2210 (fixes #2013)Verdict: NOT READY — CHANGES REQUIRED. Evidence
What's correct (confirmed)
BLOCKING 1 — User-visible regression: error toasts now render a raw JSON blobThe backend half of the #2056 pattern was shipped, but not the client half, and the result is a tangible regression at existing consumer sites. Convex sets The following consumers surface raw
This is the exact UI surface the issue is about ("execution management rejections are opaque Server Errors"), so the user-facing goal isn't delivered — it's arguably worsened (internal JSON leaked to end users). Note Required fix (either approach):
Either way: no consumer of these mutations/actions may display raw BLOCKING 2 — The
|
…ages (#2013) Address PR review on the #2013 backend fix: - BLOCKING 1: the EXECUTION_* / UNAUTHENTICATED ConvexError codes raised by cancelExecution and rerunExecution were surfaced as raw err.message at four consumer sites, leaking the ConvexError JSON blob to users. Add mapExecutionError (mirrors mapTriggerError, keyed via convexErrorCode) and wire it into embedded-run (Re-run/Stop) and the chat cancel handlers, with localized common.executionErrors.* messages (en/de/fr). - BLOCKING 2: add a test covering the UNAUTHENTICATED branch in actions.test.ts. - Non-blocking: assert the status field on EXECUTION_NOT_CANCELABLE, and let the layout error boundary also match the upper-cased UNAUTHENTICATED code form.
Desk review — #2013 (structured error codes for workflow execution management)Verdict: READY TO MERGE. ✅ Reviewed via two rounds (breadth fan-out across correctness / robustness / tests / i18n / boundaries, then independent re-verification of every candidate finding). Branch checked out locally, tests run, CI confirmed green. CIAll checks pass (Analyze, Build platform/convex, Lint, Format, Knip, Opengrep, Migrations, and all 16 Playwright platform shards + docs/web). No red, no pending. Tests (run locally)
What's correct
Non-blocking notes (optional follow-ups, not required to merge)
These are enhancements; none block merge. |
Summary
Workflow execution management mutations/actions threw raw
Error, which Convex redacts to an opaque "Server Error" in production. The workflow builder/debug UI had no way to distinguish a not-found from a wrong-state or unauthenticated rejection. This converts those throws to structuredConvexError({ code }), matching the convention already used inworkflows/triggers/slug_mutations.ts(fixed in #2056).Changes
workflow_executions/mutations.ts(cancelExecution):EXECUTION_NOT_FOUNDEXECUTION_NOT_CANCELABLE(carriesstatus)workflow_executions/actions.ts(startWorkflowFromFile,rerunExecution,getExecutionVariables):UNAUTHENTICATEDEXECUTION_NOT_FOUNDEXECUTION_MISSING_SLUGworkflows/executions/resume_debug_step.ts:EXECUTION_NOT_FOUNDEXECUTION_NOT_RESUMABLE(carriesstatus)EXECUTION_NOT_PAUSEDEXECUTION_MISSING_WORKFLOW_IDworkflows/triggers/slug_mutations.ts(also listed in the issue) already throwsConvexError({ code })— no change needed there.Tests
actions.test.tsandresume_debug_step.test.tsto assert on the structuredcodeinstead of message substrings.workflow_executions/mutations_error_codes.test.ts(end-to-end viaconvexTest) coveringcancelExecution→EXECUTION_NOT_FOUNDandEXECUTION_NOT_CANCELABLE.Verified locally:
vitest(13 passing),oxlint --type-aware(0 errors),tsc --noEmit(clean).Closes #2013