Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-world-zod-44-compat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@workflow/world': patch
---

Fix compatibility with Zod 4.4.x in `WorkflowRunSchema` by marking `output`, `error`, and `completedAt` as `.optional()` on non-final / cancelled / completed / failed run states.
14 changes: 7 additions & 7 deletions packages/world/src/runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,28 @@ export const WorkflowRunSchema = z.discriminatedUnion('status', [
// Non-final states
WorkflowRunBaseSchema.extend({
status: z.enum(['pending', 'running']),
output: z.undefined(),
error: z.undefined(),
completedAt: z.undefined(),
output: z.undefined().optional(),
error: z.undefined().optional(),
completedAt: z.undefined().optional(),
}),
// Cancelled state
WorkflowRunBaseSchema.extend({
status: z.literal('cancelled'),
output: z.undefined(),
error: z.undefined(),
output: z.undefined().optional(),
error: z.undefined().optional(),
completedAt: z.coerce.date(),
}),
// Completed state - output can be v1 or v2 format
WorkflowRunBaseSchema.extend({
status: z.literal('completed'),
output: SerializedDataSchema,
error: z.undefined(),
error: z.undefined().optional(),
completedAt: z.coerce.date(),
}),
// Failed state
WorkflowRunBaseSchema.extend({
status: z.literal('failed'),
output: z.undefined(),
output: z.undefined().optional(),
error: StructuredErrorSchema,
completedAt: z.coerce.date(),
}),
Expand Down
Loading