Skip to content
Source
Sign inSign up
TanStack/workflow

fix(runtime): preserve deliveries when workflow versions are missing #25

Opentannerlinsleywants to merge 4 commits intomain fromfactory/revivalopened

Showing 6 changed files with 15 additions and 5 deletions (loading 3).

x
0 of 6 viewed, 6 left
7 additions and 0 deletions.changeset/quiet-signals-wait.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+'@tanstack/workflow-runtime': patch
+---
+​
+Reject signal, approval, and timer deliveries for a run whose workflow version
+is not registered, returning `version-mismatch` and leaving the run paused
+instead of consuming the delivery and stranding the run.
4 additions and 0 deletionsdocs/concepts/replay-and-resume.mdModified
View file
@@ -106,6 +106,10 @@
​
Mismatched version with nothing in `previousVersions` → `RUN_ERRORED { code: 'workflow_version_mismatch' }`.
​
+When the run is driven through `@tanstack/workflow-runtime`, signal, approval, and timer deliveries to such a run are rejected before they are consumed: the result kind is `version-mismatch` and the run stays `paused`, so restoring the missing version lets the same delivery resume it.
+​
+A rejected signal or approval payload is not stored by the runtime. Keep it in a durable inbox or return a retryable HTTP response, such as 503, to a sender that retries. Retry with the same signal ID or approval ID after restoring the missing workflow version. The Cloudflare D1 payment example returns 503 for this case.
+​
## Attach (read-only subscribe)
​
A second subscriber (browser refresh, mobile reconnect) reads current state without driving the run forward:
4 additions and 5 deletionsexamples/deployment-pocs/cloudflare-d1/src/worker.tsModified
View file
@@ -73,12 +73,11 @@
​
if (url.pathname === '/signals/payment' && request.method === 'POST') {
- return json(