feat: Add workflow stage 0 - #759
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02825c21f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,12 @@ | |||
| export * from "./const"; | |||
There was a problem hiding this comment.
Add a package export for the workflow barrel
Importing the intended public API as @vitnode/core/api/workflows cannot resolve in the published package: the wildcard export maps that subpath to dist/src/api/workflows.js, while this directory barrel is emitted as dist/src/api/workflows/index.js. Add an explicit ./api/workflows entry to packages/vitnode/package.json or place the barrel at the path targeted by the existing wildcard; otherwise consumers cannot use any of the new workflow SDK.
Useful? React with 👍 / 👎.
| status: outcome.status, | ||
| }) | ||
| .where( | ||
| and(eq(core_queue.id, task.id), eq(core_queue.status, "processing")), |
There was a problem hiding this comment.
Fence stale queue leases before reclaiming them
When a legitimate handler runs longer than 15 minutes, this update can return its task to pending and allow the same tick to claim it again. The original worker still completes using the unfenced ID-only update in processQueueTasks, so it can clear the replacement worker's reservation and mark the task completed or pending while that replacement is still executing. Compare a lease token such as reservedAt or the claimed attempt in both the recovery and completion updates so an expired worker cannot overwrite a newer claim.
Useful? React with 👍 / 👎.
| const isPlainObject = (value: unknown): value is Record<string, unknown> => | ||
| typeof value === "object" && value !== null && !Array.isArray(value); |
There was a problem hiding this comment.
Reject inputs that cannot survive the JSONB round trip
This predicate only excludes scalars and arrays; it accepts parsed values containing non-JSON types. For example, z.object({ runAt: z.date() }) passes here, but PostgreSQL JSONB stores the date as a string, so a later step receives a string even though WorkflowStepContext types runAt as Date; a bigint can instead make persistence fail outright. Validate the entire parsed value as JSON-compatible or explicitly round-trip/re-parse it before accepting the execution.
Useful? React with 👍 / 👎.
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?