@workflow/core 5.0.0-beta.42 → 5.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capabilities.d.ts +4 -4
- package/dist/capabilities.js +5 -5
- package/dist/capture-stack.d.ts +1 -1
- package/dist/capture-stack.js +2 -2
- package/dist/class-serialization.d.ts +8 -8
- package/dist/class-serialization.js +9 -9
- package/dist/classify-error.js +5 -5
- package/dist/context-violation-error.d.ts +5 -5
- package/dist/context-violation-error.d.ts.map +1 -1
- package/dist/context-violation-error.js +5 -5
- package/dist/create-hook.d.ts +10 -6
- package/dist/create-hook.d.ts.map +1 -1
- package/dist/create-hook.js +1 -1
- package/dist/define-hook.js +2 -2
- package/dist/describe-error.d.ts +7 -7
- package/dist/describe-error.js +8 -8
- package/dist/encryption.d.ts +5 -5
- package/dist/encryption.js +7 -7
- package/dist/events-consumer.d.ts +19 -7
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +33 -12
- package/dist/flushable-stream.d.ts +4 -4
- package/dist/flushable-stream.js +12 -12
- package/dist/global.d.ts +1 -1
- package/dist/global.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/log-format.d.ts +2 -2
- package/dist/log-format.js +5 -5
- package/dist/logger.js +4 -4
- package/dist/private.d.ts +39 -64
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +294 -48
- package/dist/replay-payload-cache.d.ts +1 -1
- package/dist/replay-payload-cache.js +4 -4
- package/dist/runtime/compute-instance.d.ts +4 -3
- package/dist/runtime/compute-instance.d.ts.map +1 -1
- package/dist/runtime/compute-instance.js +5 -4
- package/dist/runtime/constants.d.ts +46 -19
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +76 -38
- package/dist/runtime/count-step-started-events.d.ts +7 -7
- package/dist/runtime/count-step-started-events.js +4 -4
- package/dist/runtime/deployment-guard.d.ts +7 -7
- package/dist/runtime/deployment-guard.js +8 -8
- package/dist/runtime/get-port-lazy.d.ts +2 -2
- package/dist/runtime/get-port-lazy.d.ts.map +1 -1
- package/dist/runtime/get-port-lazy.js +37 -30
- package/dist/runtime/get-world-lazy.d.ts +2 -2
- package/dist/runtime/get-world-lazy.js +3 -3
- package/dist/runtime/helpers.d.ts +18 -18
- package/dist/runtime/helpers.js +27 -27
- package/dist/runtime/quickjs-entrypoint.d.ts +23 -10
- package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -1
- package/dist/runtime/quickjs-entrypoint.js +200 -81
- package/dist/runtime/quickjs-runtime.d.ts +31 -15
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +126 -77
- package/dist/runtime/quickjs-serde.d.ts +10 -10
- package/dist/runtime/quickjs-serde.js +20 -20
- package/dist/runtime/replay-budget.d.ts +4 -4
- package/dist/runtime/replay-budget.js +5 -5
- package/dist/runtime/replay-recovery-reporter.d.ts +1 -1
- package/dist/runtime/replay-recovery-reporter.js +2 -2
- package/dist/runtime/resume-hook.d.ts +2 -2
- package/dist/runtime/resume-hook.js +27 -27
- package/dist/runtime/resume-latency.d.ts +25 -25
- package/dist/runtime/resume-latency.d.ts.map +1 -1
- package/dist/runtime/resume-latency.js +4 -4
- package/dist/runtime/run-id-time.d.ts +2 -2
- package/dist/runtime/run-id-time.js +5 -5
- package/dist/runtime/run.d.ts +21 -4
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +154 -35
- package/dist/runtime/runs.d.ts +4 -4
- package/dist/runtime/runs.js +2 -2
- package/dist/runtime/start.d.ts +3 -3
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +27 -23
- package/dist/runtime/step-executor.d.ts +59 -11
- package/dist/runtime/step-executor.d.ts.map +1 -1
- package/dist/runtime/step-executor.js +116 -42
- package/dist/runtime/step-latency.d.ts +20 -14
- package/dist/runtime/step-latency.d.ts.map +1 -1
- package/dist/runtime/step-latency.js +13 -11
- package/dist/runtime/step-ownership.d.ts +6 -6
- package/dist/runtime/step-ownership.js +8 -8
- package/dist/runtime/step-single-flight.d.ts +1 -1
- package/dist/runtime/step-single-flight.d.ts.map +1 -1
- package/dist/runtime/step-single-flight.js +17 -11
- package/dist/runtime/suspension-handler.d.ts +99 -7
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +678 -57
- package/dist/runtime/unserializable-step.d.ts +34 -0
- package/dist/runtime/unserializable-step.d.ts.map +1 -0
- package/dist/runtime/unserializable-step.js +52 -0
- package/dist/runtime/vm-mode.d.ts +1 -1
- package/dist/runtime/vm-mode.js +2 -2
- package/dist/runtime/wait-continuation.d.ts +31 -9
- package/dist/runtime/wait-continuation.d.ts.map +1 -1
- package/dist/runtime/wait-continuation.js +44 -13
- package/dist/runtime/wait-until.d.ts +1 -1
- package/dist/runtime/wait-until.js +2 -2
- package/dist/runtime/world-compatibility.d.ts +20 -9
- package/dist/runtime/world-compatibility.d.ts.map +1 -1
- package/dist/runtime/world-compatibility.js +24 -13
- package/dist/runtime/world-init.d.ts +5 -5
- package/dist/runtime/world-init.js +6 -6
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +13 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +417 -213
- package/dist/sealed-box.d.ts +7 -7
- package/dist/sealed-box.js +15 -15
- package/dist/serialization/client.js +2 -2
- package/dist/serialization/codec-devalue-vm.d.ts +1 -1
- package/dist/serialization/codec-devalue-vm.js +4 -4
- package/dist/serialization/codec-devalue.d.ts +1 -1
- package/dist/serialization/codec-devalue.js +2 -2
- package/dist/serialization/codec.d.ts +4 -4
- package/dist/serialization/codec.js +2 -2
- package/dist/serialization/compression.d.ts +12 -11
- package/dist/serialization/compression.d.ts.map +1 -1
- package/dist/serialization/compression.js +16 -15
- package/dist/serialization/encryption.d.ts +7 -7
- package/dist/serialization/encryption.d.ts.map +1 -1
- package/dist/serialization/encryption.js +8 -8
- package/dist/serialization/errors.js +2 -2
- package/dist/serialization/format.d.ts +6 -6
- package/dist/serialization/format.js +7 -7
- package/dist/serialization/hardened.d.ts +18 -18
- package/dist/serialization/hardened.d.ts.map +1 -1
- package/dist/serialization/hardened.js +41 -32
- package/dist/serialization/index.d.ts +1 -1
- package/dist/serialization/index.js +2 -2
- package/dist/serialization/reducers/class-vm.d.ts +1 -1
- package/dist/serialization/reducers/class-vm.js +2 -2
- package/dist/serialization/reducers/class.js +2 -2
- package/dist/serialization/reducers/common-vm.js +12 -12
- package/dist/serialization/reducers/common.js +12 -12
- package/dist/serialization/reducers/step-function-vm.d.ts +1 -1
- package/dist/serialization/reducers/step-function-vm.js +2 -2
- package/dist/serialization/reducers/step-function.js +2 -2
- package/dist/serialization/step.js +2 -2
- package/dist/serialization/types.d.ts +5 -5
- package/dist/serialization/types.js +2 -2
- package/dist/serialization/workflow-vm.d.ts +1 -1
- package/dist/serialization/workflow-vm.d.ts.map +1 -1
- package/dist/serialization/workflow-vm.js +13 -10
- package/dist/serialization-format.d.ts +11 -11
- package/dist/serialization-format.d.ts.map +1 -1
- package/dist/serialization-format.js +29 -23
- package/dist/serialization.d.ts +20 -12
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +141 -99
- package/dist/set-attributes.js +2 -2
- package/dist/source-map.d.ts +1 -1
- package/dist/source-map.d.ts.map +1 -1
- package/dist/source-map.js +18 -12
- package/dist/step/context-storage.d.ts +5 -5
- package/dist/step/context-storage.js +1 -1
- package/dist/step/writable-stream.d.ts +3 -3
- package/dist/step/writable-stream.js +7 -7
- package/dist/step.js +12 -12
- package/dist/symbols.d.ts +2 -2
- package/dist/symbols.js +3 -3
- package/dist/telemetry/semantic-conventions.d.ts +21 -13
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +21 -15
- package/dist/telemetry.d.ts +9 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +40 -10
- package/dist/test-support/orchestrator-context.d.ts.map +1 -1
- package/dist/test-support/orchestrator-context.js +12 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/dist/vm/index.js +4 -4
- package/dist/vm/script-cache.d.ts.map +1 -1
- package/dist/vm/script-cache.js +23 -17
- package/dist/vm/uint8array-base64.js +1 -1
- package/dist/workflow/abort-controller.d.ts +1 -1
- package/dist/workflow/abort-controller.js +12 -12
- package/dist/workflow/create-hook.js +3 -3
- package/dist/workflow/get-workflow-metadata.js +2 -2
- package/dist/workflow/hook.js +18 -18
- package/dist/workflow/set-attributes.d.ts +1 -1
- package/dist/workflow/set-attributes.js +2 -2
- package/dist/workflow/sleep.js +2 -2
- package/dist/workflow/world-init-stub.d.ts +1 -1
- package/dist/workflow/world-init-stub.js +2 -2
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +36 -14
- package/docs/api-reference/create-hook.mdx +15 -15
- package/docs/api-reference/create-webhook.mdx +15 -15
- package/docs/api-reference/define-hook.mdx +10 -10
- package/docs/api-reference/fatal-error.mdx +2 -2
- package/docs/api-reference/fetch.mdx +7 -7
- package/docs/api-reference/get-step-metadata.mdx +2 -2
- package/docs/api-reference/get-workflow-metadata.mdx +3 -3
- package/docs/api-reference/get-writable.mdx +7 -7
- package/docs/api-reference/index.mdx +1 -1
- package/docs/api-reference/retryable-error.mdx +1 -1
- package/docs/api-reference/set-attributes.mdx +2 -2
- package/docs/api-reference/sleep.mdx +3 -3
- package/docs/foundations/cancellation.mdx +31 -31
- package/docs/foundations/errors-and-retries.mdx +42 -11
- package/docs/foundations/hooks.mdx +37 -37
- package/docs/foundations/idempotency.mdx +9 -9
- package/docs/foundations/serialization.mdx +21 -22
- package/docs/foundations/starting-workflows.mdx +36 -37
- package/docs/foundations/streaming.mdx +68 -39
- package/docs/foundations/versioning.mdx +3 -3
- package/docs/foundations/workflows-and-steps.mdx +9 -9
- package/docs/how-it-works/cancellation.mdx +62 -62
- package/docs/how-it-works/code-transform.mdx +66 -54
- package/docs/how-it-works/encryption.mdx +25 -21
- package/docs/how-it-works/event-sourcing.mdx +84 -28
- package/docs/how-it-works/framework-integrations.mdx +12 -12
- package/docs/how-it-works/understanding-directives.mdx +21 -21
- package/package.json +7 -7
package/dist/private.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface WorkflowOrchestratorContext {
|
|
|
33
33
|
/**
|
|
34
34
|
* Increments when a suspension is accepted and on every retained-session
|
|
35
35
|
* resume. STEP suspension signals capture it when scheduled and no-op if
|
|
36
|
-
* it moved (see step.ts)
|
|
36
|
+
* it moved (see step.ts), which drops same-boundary sibling signals and
|
|
37
37
|
* timers queued at boundary N that would fire after the session resumed
|
|
38
38
|
* into boundary N+1. Sleep/hook/attribute signals are intentionally
|
|
39
39
|
* unguarded: their presence makes the boundary unretainable, so a late
|
|
@@ -53,6 +53,14 @@ export interface WorkflowOrchestratorContext {
|
|
|
53
53
|
* whole run and both replays of a run must draw in the same order.
|
|
54
54
|
*/
|
|
55
55
|
generateUlid: () => string;
|
|
56
|
+
/**
|
|
57
|
+
* Monotone count of correlation-id draws this replay has made. Progress
|
|
58
|
+
* metric for {@link quiesceEarlierCascades}: a macrotask turn in which it
|
|
59
|
+
* does not move (and no hydration is in flight) means every woken branch has
|
|
60
|
+
* run as far as it can without another delivery. Optional so lightweight
|
|
61
|
+
* test contexts degrade to the single-yield behavior.
|
|
62
|
+
*/
|
|
63
|
+
readonly mintCount?: number;
|
|
56
64
|
generateNanoid: () => string;
|
|
57
65
|
/**
|
|
58
66
|
* Sequential promise queue that ensures all event-driven promise resolutions
|
|
@@ -66,12 +74,12 @@ export interface WorkflowOrchestratorContext {
|
|
|
66
74
|
* Counter of in-flight async data delivery operations (step result
|
|
67
75
|
* hydration, hook payload hydration, abort signal hydration). Suspensions
|
|
68
76
|
* must wait for this to reach 0 before firing, to avoid preempting data
|
|
69
|
-
* delivery
|
|
77
|
+
* delivery, e.g. dehydrating a step's arguments while an abort that should
|
|
70
78
|
* be reflected in those arguments is still hydrating its reason.
|
|
71
79
|
*/
|
|
72
80
|
pendingDeliveries: number;
|
|
73
81
|
/**
|
|
74
|
-
* Ordered registry of in-flight "branch-deciding" deliveries
|
|
82
|
+
* Ordered registry of in-flight "branch-deciding" deliveries: the
|
|
75
83
|
* resolutions a workflow typically `Promise.race`s on, or awaits from
|
|
76
84
|
* independent concurrent branches: hook payloads (`hook_received`), wait
|
|
77
85
|
* completions (`wait_completed`), and step results (`step_completed` /
|
|
@@ -84,7 +92,7 @@ export interface WorkflowOrchestratorContext {
|
|
|
84
92
|
* costing extra hops; a `wait_completed` resolves with fewer, and a reused
|
|
85
93
|
* sleep can resolve in an entirely earlier loop iteration; a step result is
|
|
86
94
|
* gated on hydration whose cost varies between replays of the SAME
|
|
87
|
-
* invocation
|
|
95
|
+
* invocation: the first replay pays the full decrypt/decompress/revive,
|
|
88
96
|
* while later replays sharing the invocation's `ReplayPayloadCache`
|
|
89
97
|
* memo-hit small primitive results and resolve in one or two hops. Either
|
|
90
98
|
* way, the resolution that the committed event log ordered first can lose a
|
|
@@ -127,64 +135,19 @@ interface DeliveryBarrierEntry {
|
|
|
127
135
|
* that already had a waiting consumer when it was consumed.
|
|
128
136
|
*
|
|
129
137
|
* False for a BUFFERED hook payload no consumer has claimed yet: it is
|
|
130
|
-
* delivered by `claim()`, i.e. whenever the workflow next reads the hook
|
|
138
|
+
* delivered by `claim()`, i.e. whenever the workflow next reads the hook,
|
|
131
139
|
* which may be causally *after* a later-in-log delivery. `arm()` flips it
|
|
132
140
|
* once a consumer takes the payload.
|
|
133
141
|
*/
|
|
134
142
|
armed: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Retire this entry: resolve `delivered` and remove it from the registry,
|
|
145
|
+
* exactly as `markDelivered` would. Called only by the context's safety-net
|
|
146
|
+
* dispenser ({@link ensureBarrierSafetyNet}), and only on the lowest-index
|
|
147
|
+
* entry at delivery idle. Idempotent.
|
|
148
|
+
*/
|
|
149
|
+
retire: () => void;
|
|
135
150
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Awaits, in strict event-log order, every still-registered delivery that is
|
|
138
|
-
* earlier in the log than `eventIndex` and that a delivery of `kind` defers
|
|
139
|
-
* behind (see {@link DEFER_BEHIND}), so that this resolution is handed to the
|
|
140
|
-
* workflow only after all relevant earlier-in-log deliveries have been. This
|
|
141
|
-
* is what keeps a `Promise.race` — or the ULID a follow-up `useStep` draws on
|
|
142
|
-
* a concurrent branch — deterministic and aligned with the committed event
|
|
143
|
-
* log, independent of microtask-hop counts, hydration time, or race-argument
|
|
144
|
-
* order. When this delivery does have to wait, it also yields a macrotask
|
|
145
|
-
* afterwards so the earlier delivery's consumer can run to its own next
|
|
146
|
-
* suspension point first; see the comment at that `await` for why ordering the
|
|
147
|
-
* `resolve()` calls alone is not enough.
|
|
148
|
-
*
|
|
149
|
-
* What counts as "defers behind" is {@link gatesOn}, shared with
|
|
150
|
-
* {@link computeResolvesOnItsOwn} so the two cannot drift.
|
|
151
|
-
*
|
|
152
|
-
* One asymmetry: a STEP result skips any earlier delivery that is UNARMED,
|
|
153
|
-
* i.e. a buffered hook payload no consumer has claimed. Such a payload is
|
|
154
|
-
* delivered only when the workflow next reads the hook, and reaching that read
|
|
155
|
-
* very commonly requires the step result itself (`await stepX()` before the
|
|
156
|
-
* read). Gating the step on it would stall the workflow until the barrier's
|
|
157
|
-
* idle safety net fires, which then releases every delivery queued behind that
|
|
158
|
-
* payload at once — losing exactly the race this ordering exists to protect.
|
|
159
|
-
* Waits and hooks keep gating on unclaimed payloads: for them, waiting for the
|
|
160
|
-
* claim IS the ordering guarantee (a `wait_completed` must not preempt a
|
|
161
|
-
* payload the log ordered first).
|
|
162
|
-
*
|
|
163
|
-
* The skip is direct, never transitive. A step still gates on an earlier ARMED
|
|
164
|
-
* wait or hook, including one that is itself parked behind an unclaimed
|
|
165
|
-
* payload. Skipping those too would invert log order for the commonest shape
|
|
166
|
-
* there is: a workflow that creates a hook it does not read on this branch,
|
|
167
|
-
* races `step` against `sleep`, and has the log say the sleep won. The step
|
|
168
|
-
* would then overtake the wait, both branches would swap the correlation ids
|
|
169
|
-
* they draw next, and replay would diverge — see
|
|
170
|
-
* `step-delivery-ordering.test.ts`. Waiting instead is safe because the
|
|
171
|
-
* payload's own idle safety net retires it and the whole chain then delivers
|
|
172
|
-
* in log order; {@link hasParkedCommittedDelivery} deliberately reports such a
|
|
173
|
-
* step as not self-resolving so that idle stays reachable.
|
|
174
|
-
*
|
|
175
|
-
* "The whole chain then delivers in log order" rests on the PAYLOAD's safety
|
|
176
|
-
* net observing idle before the net of the wait parked behind it. If the
|
|
177
|
-
* wait's net fired first, the step's gate would open while the wait was still
|
|
178
|
-
* parked on the payload barrier and the inversion above would reappear. Within
|
|
179
|
-
* one drain window that order is structural, and carried by FIFO of the
|
|
180
|
-
* safety-net polls: nets arm via `setTimeout` in log order during synchronous
|
|
181
|
-
* consumption, each polling round re-arms through `promiseQueue.then(...)` in
|
|
182
|
-
* the order the checks ran, and each net that fires flips
|
|
183
|
-
* {@link hasParkedCommittedDelivery} back to true, re-blocking the rest until
|
|
184
|
-
* the released delivery completes. Replay — where divergence manifests —
|
|
185
|
-
* always consumes the log in one window. Do not "optimize" the net scheduling
|
|
186
|
-
* in a way that breaks that per-window FIFO.
|
|
187
|
-
*/
|
|
188
151
|
export declare function awaitEarlierDeliveries(ctx: WorkflowOrchestratorContext, eventIndex: number | undefined, kind: DeliveryKind): Promise<void>;
|
|
189
152
|
/** Handle for a registered branch-deciding delivery barrier. */
|
|
190
153
|
export interface DeliveryBarrier {
|
|
@@ -215,12 +178,12 @@ export interface DeliveryBarrier {
|
|
|
215
178
|
* suspending and never observes it), the barrier auto-resolves at idle.
|
|
216
179
|
*
|
|
217
180
|
* INVARIANT required of every call site: a barrier that is ever `armed` must
|
|
218
|
-
* be paired with a delivery chain that runs unconditionally
|
|
181
|
+
* be paired with a delivery chain that runs unconditionally, attached when
|
|
219
182
|
* the event is consumed (waits, step results, waiting-consumer hook payloads,
|
|
220
183
|
* aborts), or by the `claim()` whose invocation is what arms it (buffered
|
|
221
184
|
* hook payloads). The idle check ({@link scheduleWhenIdle}) refuses to
|
|
222
185
|
* observe idle while an armed, self-resolving barrier is undelivered, and the
|
|
223
|
-
* safety net below is itself idle-gated
|
|
186
|
+
* safety net below is itself idle-gated, so an armed barrier with no
|
|
224
187
|
* unconditional chain would livelock every idle check in the run, including
|
|
225
188
|
* its own retirement.
|
|
226
189
|
*/
|
|
@@ -230,19 +193,19 @@ export declare function registerDeliveryBarrier(ctx: WorkflowOrchestratorContext
|
|
|
230
193
|
/**
|
|
231
194
|
* Whether some registered branch-deciding delivery is going to reach the
|
|
232
195
|
* workflow without any further help (it is armed and not transitively parked
|
|
233
|
-
* behind an unclaimed buffered payload
|
|
196
|
+
* behind an unclaimed buffered payload, see {@link resolvesOnItsOwn}) but
|
|
234
197
|
* has not been handed over yet.
|
|
235
198
|
*
|
|
236
199
|
* This is the delivery state `pendingDeliveries` cannot see. That counter
|
|
237
200
|
* covers the hydration window inside a serial `promiseQueue` slot and is
|
|
238
201
|
* released there, while the delivery's `resolve()` runs later, from a
|
|
239
|
-
* detached continuation behind {@link awaitEarlierDeliveries}
|
|
202
|
+
* detached continuation behind {@link awaitEarlierDeliveries}, including its
|
|
240
203
|
* macrotask yield whenever the delivery had to defer. Replaying a batch of N
|
|
241
204
|
* parallel step results consumed in one drain window leaves N-1 of them
|
|
242
205
|
* parked on that yield with `pendingDeliveries` already at 0. An idle check
|
|
243
206
|
* armed during the same window (a pending `sleep()` arms one on every replay)
|
|
244
207
|
* could then observe "idle" mid-deferral and raise a `WorkflowSuspension`
|
|
245
|
-
* BEFORE the workflow's own continuations ran
|
|
208
|
+
* BEFORE the workflow's own continuations ran: a suspension carrying none of
|
|
246
209
|
* the follow-up work the batch was about to create, which the runtime
|
|
247
210
|
* dutifully schedules as nothing, leaving the run dormant until an unrelated
|
|
248
211
|
* timer fires (vercel/workflow#3183).
|
|
@@ -251,7 +214,7 @@ export declare function registerDeliveryBarrier(ctx: WorkflowOrchestratorContext
|
|
|
251
214
|
* accuracy but for termination: an unclaimed buffered hook payload is retired
|
|
252
215
|
* BY the idle safety net in {@link registerDeliveryBarrier}, so counting it
|
|
253
216
|
* here would gate its own retirement. That reasoning extends to whatever is
|
|
254
|
-
* parked behind such a payload
|
|
217
|
+
* parked behind such a payload (a wait, and a step gating on that wait) for
|
|
255
218
|
* the same reason: the whole chain moves only once the net fires, and it
|
|
256
219
|
* cannot fire while the chain is counted. Self-resolving deliveries always
|
|
257
220
|
* deliver from their own chains (see the INVARIANT on
|
|
@@ -265,7 +228,7 @@ export declare function hasParkedCommittedDelivery(ctx: WorkflowOrchestratorCont
|
|
|
265
228
|
* "In flight" is two distinct windows, each with its own guard:
|
|
266
229
|
* `pendingDeliveries > 0` covers hydration inside the serial queue slots, and
|
|
267
230
|
* {@link hasParkedCommittedDelivery} covers the detached gap between a slot
|
|
268
|
-
* releasing that counter and the delivery's `resolve()` actually running
|
|
231
|
+
* releasing that counter and the delivery's `resolve()` actually running,
|
|
269
232
|
* deliberately outside `pendingDeliveries` (see step.ts), and invisible to it.
|
|
270
233
|
*
|
|
271
234
|
* Anything that decides a replay is over, or that a replay went wrong, has to
|
|
@@ -273,6 +236,18 @@ export declare function hasParkedCommittedDelivery(ctx: WorkflowOrchestratorCont
|
|
|
273
236
|
* what it has and has not done yet says nothing about the run. Two callers
|
|
274
237
|
* read it, for the two such decisions: {@link scheduleWhenIdle} for the
|
|
275
238
|
* suspension, and the events consumer's unconsumed-event check for divergence.
|
|
239
|
+
*
|
|
240
|
+
* A non-empty barrier registry counts as in flight, even when every remaining
|
|
241
|
+
* entry is parked behind an unclaimed buffered payload. Those entries only
|
|
242
|
+
* move when the safety-net dispenser retires them (lowest-first, see
|
|
243
|
+
* {@link ensureBarrierSafetyNet}), and the deliveries they release are real
|
|
244
|
+
* workflow reactions: a suspension raised before they run would be computed
|
|
245
|
+
* from a VM that has not seen them, scheduling none of their follow-up work
|
|
246
|
+
* and leaving the run dormant (the vercel/workflow#3183 shape). The dispenser
|
|
247
|
+
* itself is gated on {@link canRetireAbandonedBarriers}, the weaker predicate
|
|
248
|
+
* without the registry term, precisely so it can do the draining that this
|
|
249
|
+
* predicate waits for; registry size strictly decreases at each retirement,
|
|
250
|
+
* so idle is always reached.
|
|
276
251
|
*/
|
|
277
252
|
export declare function isDeliveryIdle(ctx: WorkflowOrchestratorContext): boolean;
|
|
278
253
|
/**
|
package/dist/private.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../src/private.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,MAAM,YAAY,CACtB,IAAI,SAAS,YAAY,EAAE,GAAG,GAAG,EAAE,EACnC,MAAM,SAAS,YAAY,GAAG,OAAO,GAAG,OAAO,IAC7C,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAsEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,QAGxE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAoBxE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