@fluidgrids/workflows 2026.1028.2 → 2026.1030.1
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/README.md +181 -11
- package/dist/{activation-BBh1p82z.d.cts → activation-DqUfpHzk.d.cts} +1 -1
- package/dist/{activation-DnhG7SmF.d.ts → activation-xpx1oWuo.d.ts} +1 -1
- package/dist/{chunk-VRHHBPT6.js → chunk-2D3MYIIF.js} +1212 -128
- package/dist/chunk-3U2NU7YC.cjs +124 -0
- package/dist/{chunk-NEIUQASE.cjs → chunk-4QKB4ARC.cjs} +3 -3
- package/dist/{chunk-GBQ33SIZ.cjs → chunk-54FLQNUM.cjs} +12 -1
- package/dist/chunk-5HIVIV53.js +330 -0
- package/dist/chunk-5MFVJM76.js +1222 -0
- package/dist/{chunk-JD2VQIDZ.cjs → chunk-672KMMBK.cjs} +2 -2
- package/dist/{chunk-C5OLWZ42.js → chunk-6A2FGSUS.js} +22 -14
- package/dist/{chunk-XKJA7KX3.js → chunk-6OLN6BMB.js} +52 -3
- package/dist/{chunk-6FSHT5IL.js → chunk-7EZIANC7.js} +1 -1
- package/dist/{chunk-2J6TF7YI.cjs → chunk-A5SXCA62.cjs} +10 -3
- package/dist/{chunk-BO6OVILK.js → chunk-AC6ZEXVR.js} +10 -4
- package/dist/{chunk-ABFZWYHT.js → chunk-AE5Q6ZAJ.js} +315 -50
- package/dist/chunk-C4F5KJTI.js +293 -0
- package/dist/{chunk-IISBRUWJ.js → chunk-G5H32GIG.js} +1 -1
- package/dist/chunk-GEQDGUGB.cjs +2719 -0
- package/dist/{chunk-XHXIDVEC.js → chunk-HCM7ZC7Q.js} +1 -1
- package/dist/chunk-HMZUGSMU.cjs +1554 -0
- package/dist/{chunk-SAOBPYYJ.cjs → chunk-IQPXHQQQ.cjs} +8 -4
- package/dist/{chunk-P6TA5EZT.cjs → chunk-ISOIA7NV.cjs} +335 -58
- package/dist/chunk-JSC75O5C.cjs +167 -0
- package/dist/chunk-M272AHEX.js +25 -0
- package/dist/{chunk-BD7ZPG53.js → chunk-NWQ5WRLE.js} +10 -2
- package/dist/chunk-ODZ2IAR2.cjs +1247 -0
- package/dist/chunk-Q4MWQNJK.cjs +28 -0
- package/dist/{chunk-HWJZVOG7.js → chunk-SR7TR5KX.js} +6 -2
- package/dist/{chunk-FEW3JBYA.cjs → chunk-TCTE7DX5.cjs} +3 -3
- package/dist/{chunk-623FVQSN.cjs → chunk-TYF56RGB.cjs} +123 -0
- package/dist/chunk-VA4OFR72.cjs +324 -0
- package/dist/chunk-VU5S5A7V.js +150 -0
- package/dist/chunk-YEHR4NNE.js +1522 -0
- package/dist/{chunk-FMSW2HDF.cjs → chunk-ZCGKGDCL.cjs} +23 -15
- package/dist/codegen/index.d.cts +2 -2
- package/dist/codegen/index.d.ts +2 -2
- package/dist/collect-6NIEufHd.d.ts +103 -0
- package/dist/collect-CcTCKqx6.d.cts +103 -0
- package/dist/{file-BOoHZgoQ.d.cts → file-BxYpwjRQ.d.cts} +1007 -21
- package/dist/{file-yuPCFU5b.d.ts → file-CFdPQJI9.d.ts} +1007 -21
- package/dist/history/index.cjs +375 -86
- package/dist/history/index.d.cts +590 -12
- package/dist/history/index.d.ts +590 -12
- package/dist/history/index.js +50 -4
- package/dist/index.cjs +156 -50
- package/dist/index.d.cts +38 -58
- package/dist/index.d.ts +38 -58
- package/dist/index.js +6 -4
- package/dist/interceptors-CNcr2dlk.d.ts +159 -0
- package/dist/interceptors-CqkNZVfI.d.cts +159 -0
- package/dist/ir/index.cjs +362 -38
- package/dist/ir/index.d.cts +282 -7
- package/dist/ir/index.d.ts +282 -7
- package/dist/ir/index.js +329 -23
- package/dist/{lower-BzmUz0sq.d.cts → lower-BtRfIW2A.d.cts} +56 -8
- package/dist/{lower-_-iT4HYs.d.ts → lower-CpsMFOFX.d.ts} +56 -8
- package/dist/{manifest-C8N6HDYl.d.ts → manifest-D-I_twys.d.ts} +1 -1
- package/dist/{manifest-0OLw0i7k.d.cts → manifest-DahBQVM8.d.cts} +1 -1
- package/dist/node-evaluator-DGQDPSPI.cjs +24 -0
- package/dist/node-evaluator-LEEVD7H7.js +14 -0
- package/dist/payload-fields-BVRQn2yH.d.cts +122 -0
- package/dist/payload-fields-oOBWxDiG.d.ts +122 -0
- package/dist/quickjs/index.cjs +28 -27
- package/dist/quickjs/index.d.cts +6 -6
- package/dist/quickjs/index.d.ts +6 -6
- package/dist/quickjs/index.js +10 -9
- package/dist/roundtrip/index.cjs +259 -51
- package/dist/roundtrip/index.d.cts +100 -9
- package/dist/roundtrip/index.d.ts +100 -9
- package/dist/roundtrip/index.js +177 -11
- package/dist/runtime/index.cjs +21 -20
- package/dist/runtime/index.d.cts +184 -15
- package/dist/runtime/index.d.ts +184 -15
- package/dist/runtime/index.js +8 -7
- package/dist/testing/index.cjs +1122 -115
- package/dist/testing/index.d.cts +294 -13
- package/dist/testing/index.d.ts +294 -13
- package/dist/testing/index.js +1086 -84
- package/dist/{types-DV-HX_Gt.d.ts → types-Bv2i4cBX.d.cts} +244 -33
- package/dist/{types-CpBBjaGX.d.cts → types-DGx-b9eq.d.ts} +244 -33
- package/dist/{types-BGoPzgcl.d.ts → types-V7jEEUaL.d.cts} +20 -1
- package/dist/{types-BGoPzgcl.d.cts → types-V7jEEUaL.d.ts} +20 -1
- package/dist/{workflow-Bpr3vnA_.d.ts → workflow-B18OeF7g.d.ts} +2 -2
- package/dist/workflow-BGnv8SS6.d.ts +803 -0
- package/dist/{workflow-FXUkpIBc.d.cts → workflow-BJPFv3cp.d.cts} +2 -2
- package/dist/workflow-DS32Gtws.d.cts +803 -0
- package/fixtures/histories/activity-options-updated.history.json +159 -0
- package/fixtures/histories/activity-paused-unpaused.history.json +160 -0
- package/fixtures/histories/auto-upgrade-patched.history.json +276 -0
- package/fixtures/histories/benign-failure.history.json +146 -0
- package/fixtures/histories/cancel-activity-try-cancel.history.json +150 -0
- package/fixtures/histories/child-cancel-wait-requested.history.json +217 -0
- package/fixtures/histories/child-options-roundtrip.history.json +192 -0
- package/fixtures/histories/codec-opaque.history.json +229 -0
- package/fixtures/histories/continue-as-new-last-result.history.json +86 -0
- package/fixtures/histories/continue-as-new-options.history.json +99 -0
- package/fixtures/histories/continue-as-new-r1-long-task-queue.history.json +78 -0
- package/fixtures/histories/continue-as-new-r1-retry-options.history.json +83 -0
- package/fixtures/histories/dynamic-workflow.history.json +150 -0
- package/fixtures/histories/execution-timeout-chain.history.json +98 -0
- package/fixtures/histories/external-cancel-resolved.history.json +123 -0
- package/fixtures/histories/external-cancel-unknown-target.history.json +127 -0
- package/fixtures/histories/failure-error-types-fails-run.history.json +144 -0
- package/fixtures/histories/handler-drain-warn.history.json +222 -0
- package/fixtures/histories/heartbeat-details-on-retry.history.json +145 -0
- package/fixtures/histories/interceptor-headers.history.json +339 -0
- package/fixtures/histories/local-activity-abandoned-at-completion.history.json +73 -0
- package/fixtures/histories/local-activity-cancelled-in-scope.history.json +118 -0
- package/fixtures/histories/local-activity-completed.history.json +157 -0
- package/fixtures/histories/local-activity-failed.history.json +93 -0
- package/fixtures/histories/local-activity-retry-in-task.history.json +88 -0
- package/fixtures/histories/query-custom.history.json +213 -0
- package/fixtures/histories/query-default-handler.history.json +120 -0
- package/fixtures/histories/reset-forked-reapplied-signals.history.json +239 -0
- package/fixtures/histories/reset-reapplied-update-admitted.history.json +228 -0
- package/fixtures/histories/run-retry-last-failure.history.json +90 -0
- package/fixtures/histories/run-timeout.history.json +159 -0
- package/fixtures/histories/schedule-to-start-timeout.history.json +132 -0
- package/fixtures/histories/search-attributes-upserted.history.json +177 -0
- package/fixtures/histories/start-delay-signal-ends-delay.history.json +155 -0
- package/fixtures/histories/typeerror-task-retry-100.history.json +137 -0
- package/fixtures/histories/update-accepted-completed.history.json +45 -30
- package/fixtures/histories/update-default-handler.history.json +246 -0
- package/fixtures/histories/update-handler-awaits-activity.history.json +196 -0
- package/fixtures/histories/update-not-handled.history.json +138 -0
- package/fixtures/histories/update-rejected-no-event.history.json +190 -0
- package/fixtures/histories/update-with-start-admitted.history.json +150 -0
- package/fixtures/histories/user-activity-cancel.history.json +149 -0
- package/fixtures/histories/user-activity-retry.history.json +143 -0
- package/fixtures/histories/user-activity.history.json +149 -0
- package/package.json +1 -1
- package/schema/bridge-v2.schema.json +1062 -0
- package/schema/history-file.schema.json +538 -83
- package/schema/ir-v2.schema.json +290 -0
- package/schema/payload-fields.json +162 -0
- package/schema/run-event.schema.json +503 -82
- package/schema/workflow-command.schema.json +372 -69
- package/schema/workflow-task.schema.json +924 -171
- package/dist/assemble-BLqQ8lSu.d.cts +0 -39
- package/dist/assemble-DWgaXHd-.d.ts +0 -39
- package/dist/chunk-DHTLALBL.cjs +0 -80
- package/dist/chunk-DJYMDLV5.js +0 -227
- package/dist/chunk-I5LR3D2K.js +0 -869
- package/dist/chunk-M4BBAERY.cjs +0 -1635
- package/dist/chunk-N23SKIG4.js +0 -73
- package/dist/chunk-PZCVF76Q.cjs +0 -868
- package/dist/chunk-QQ6ULXHI.cjs +0 -885
- package/dist/chunk-UK3WM7YZ.cjs +0 -75
- package/dist/chunk-VOKMAAJP.js +0 -848
- package/dist/node-evaluator-4MSDKWOG.cjs +0 -22
- package/dist/node-evaluator-SX4LEYQC.js +0 -12
- package/dist/workflow-C2a05WUJ.d.ts +0 -444
- package/dist/workflow-J-yYixny.d.cts +0 -444
package/README.md
CHANGED
|
@@ -226,15 +226,66 @@ export const refundOrder = workflow(
|
|
|
226
226
|
`ctx.signalRun` / `ctx.signalParent` / `ctx.getRunHandle`, `ctx.sideEffect`,
|
|
227
227
|
`ctx.patched` / `ctx.deprecatePatch`, `ctx.now` / `ctx.random` / `ctx.uuid`,
|
|
228
228
|
`ctx.setCurrentDetails`, cancellation scopes, `ctx.saga()`, and the parity
|
|
229
|
-
commands `ctx.upsertContext` and `ctx.continueAsNew`. User
|
|
230
|
-
activities
|
|
231
|
-
|
|
229
|
+
commands `ctx.upsertContext` and `ctx.continueAsNew`. User functions as
|
|
230
|
+
local activities are not run yet and fail the workflow task with
|
|
231
|
+
`UNSUPPORTED_COMMAND`.
|
|
232
|
+
- Since C-R1 (Phase C, `RUNTIME_RELEASE = 3`; each feature is enabled by the
|
|
233
|
+
service per workspace flag, see "Phase C" below): updates
|
|
234
|
+
(`ctx.handleUpdate(def, fn, { validate })`, `ctx.setDefaultUpdateHandler`),
|
|
235
|
+
custom queries (`ctx.handleQuery`, `ctx.setDefaultQueryHandler`),
|
|
236
|
+
`dynamicWorkflow`, user activities (`declareActivity`, `ctx.activity`),
|
|
237
|
+
`ctx.upsertSearchAttributes`, interceptors (`export const interceptors =
|
|
238
|
+
workflowInterceptors(...)`) with header propagation, and `ctx.sinks`.
|
|
239
|
+
- Since R2 (the runtime release `RUNTIME_RELEASE = 2`):
|
|
240
|
+
`ctx.localActivity(op, { args, retry, startToCloseTimeout, summary })` runs a
|
|
241
|
+
short node call inside the workflow task (at most 30 s; the `ctx.run`
|
|
242
|
+
allow-list applies). The task returns `outcome: 'localActivityRequested'`
|
|
243
|
+
with the calls it waits for; the worker runs them and runs the same task
|
|
244
|
+
again with `localActivityResults`, and the task records one
|
|
245
|
+
`RECORD_LOCAL_ACTIVITY` marker per call. A retryable failure is requested
|
|
246
|
+
again with the next `attempt` and its `backoffMs`; a replay returns the
|
|
247
|
+
recorded outcome and never runs the call again. A local activity the first
|
|
248
|
+
execution dropped (its scope was cancelled in the same activation, or the
|
|
249
|
+
run completed without awaiting it) records nothing and replays the same way;
|
|
250
|
+
one that would have been requested but has no marker is a non-determinism.
|
|
251
|
+
- Run handles take a workflow id: `ctx.getRunHandle({ workflowKey, workflowId,
|
|
252
|
+
firstRunId? })`, `ctx.signalRun(target, …)` and `ctx.cancelRun(target)`.
|
|
253
|
+
- `ctx.onSignal(signal, { unfinishedPolicy: 'ABANDON' }, fn)`; a workflow that
|
|
254
|
+
finishes while a `WARN_AND_ABANDON` handler still runs logs one warning and
|
|
255
|
+
reports `unfinishedHandlers` in the task result (never on replay).
|
|
256
|
+
- `ctx.info.lastResult`, `lastFailure`, `workflowId`, `runAttempt`, `summary`,
|
|
257
|
+
`details`, `context` (the memo), the timeouts, `retry`, `priority` and
|
|
258
|
+
`versioningBehavior` come from `WORKFLOW_STARTED`, so a replay sees what the
|
|
259
|
+
first execution saw; histories written before R2 fall back to the lease.
|
|
260
|
+
- `workflow(name, { versioningBehavior, retry, runTimeout, executionTimeout,
|
|
261
|
+
workflowTaskTimeout })` lowers to `config`; `lower()` writes the runtime
|
|
262
|
+
features a bundle uses to `code.features` (`localActivity`, `externalCancel`,
|
|
263
|
+
`childOptions`, `canOptions`, `autoUpgrade`, `runRetry`, `timeouts`) so the
|
|
264
|
+
service can refuse a push whose features its flags do not enable. The call
|
|
265
|
+
sites are read in every module of the project (helpers and vendored packages
|
|
266
|
+
included), and any use of the name `localActivity` counts. Each function's
|
|
267
|
+
settings are also written to `code.exports.workflows[fn].config`: the
|
|
268
|
+
service resolves run options per `workflowFn` from that table, so a
|
|
269
|
+
same-bundle child that runs on its parent's definition gets its own retry
|
|
270
|
+
and timeouts.
|
|
271
|
+
- The command feature gate (`commandFeatures`, `isWorkflowCommandEnabled(cmd,
|
|
272
|
+
features)`, `isReliefCommand`, `PHASE_B_CORE_FEATURES`,
|
|
273
|
+
`PHASE_B_PARITY_FEATURES`) is the one contract the service and the workers use
|
|
274
|
+
to enable parity commands. Every option the R1 runtime wrote stays in the
|
|
275
|
+
core set (`CORE_CHILD_OPTIONS`, `CORE_CAN_OPTIONS`), so a Phase B workflow
|
|
276
|
+
behaves the same with `fluidgrids.durable-parity` off; only the R2 options
|
|
277
|
+
(child `retry`, `versioningBehavior`, `idReusePolicy`, `idConflictPolicy`,
|
|
278
|
+
and a run-retry `continueAsNew` `retry`) need the flag. A continue-as-new
|
|
279
|
+
`retry` in the R1 activity shape (`retryDelay`, `maxRetries`) is still
|
|
280
|
+
written as R1 wrote it and has no effect; `continueAsNewRetryShape` tells
|
|
281
|
+
the shapes apart, and the service must ignore the legacy one; `rolloutBucket(key)` (FNV-1a 32 over UTF-8, modulo 100) is the rollout hash.
|
|
232
282
|
- Only store and registry nodes and `internal:http`, `internal:datatable`,
|
|
233
283
|
`internal:set` and `internal:code` may run as activities
|
|
234
284
|
(`ACTIVITY_NODE_ALLOWLIST`).
|
|
235
285
|
- An `ApplicationError` (or any failure class, or a class listed in
|
|
236
286
|
`failureErrorTypes`) fails the run; any other throw, a determinism violation
|
|
237
|
-
or a
|
|
287
|
+
or a user local activity fails only the workflow task, which the engine
|
|
288
|
+
retries.
|
|
238
289
|
- A cancellation scope function receives a `ctx` bound to its scope; use it
|
|
239
290
|
inside the function. The outer `ctx` joins the scope only while the function
|
|
240
291
|
runs synchronously (`ctx.nonCancellable(() => ctx.run(...))` works), never
|
|
@@ -284,12 +335,27 @@ await replay(refundOrder, handle.history()); // throws DeterminismViolation on a
|
|
|
284
335
|
```
|
|
285
336
|
|
|
286
337
|
The test environment appends exactly the events the service appends
|
|
287
|
-
(`eventsForCommands`) and retries activities with `computeRetryDelay`.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
`
|
|
338
|
+
(`eventsForCommands`) and retries activities with `computeRetryDelay`. Since R2
|
|
339
|
+
it also runs local activities through `mock` (retried inside the task), start
|
|
340
|
+
delays, run and execution timeouts and run-level retry on the fake clock,
|
|
341
|
+
workflow-id policies (`workflowId`, `idReusePolicy`, `idConflictPolicy`) and
|
|
342
|
+
workflow-id targets, schedule-to-start timeouts while a queue is held
|
|
343
|
+
(`holdActivities`), heartbeat details on retry (`info.heartbeat`,
|
|
344
|
+
`info.heartbeatDetails`), and fails `result()` with `UnfinishedHandlersError`
|
|
345
|
+
when a run finishes while a signal handler still runs
|
|
346
|
+
(`failOnUnfinishedHandlers`, default true). Its documented differences from the
|
|
347
|
+
service: workflow tasks run in this process without the determinism shims (pass
|
|
348
|
+
`taskExecutor` to run them in an isolate), a failed workflow task stops the run
|
|
349
|
+
instead of being retried, activity start-to-close and heartbeat timeouts are not
|
|
350
|
+
timed (a mock may throw a `TimeoutFailure`), local-activity retries do not wait
|
|
351
|
+
for their backoff, the workflow-task timeout is recorded but not enforced, and
|
|
352
|
+
graph children are mocks (`mockChild`).
|
|
353
|
+
|
|
354
|
+
`buildBundle(files, { sourcemap: 'external' })` also returns the bundle's
|
|
355
|
+
source map (`map`) with the same bundle bytes and `buildId`; it travels in the
|
|
356
|
+
source archive (`map`), and `createSourceMapper`, `mapStackTrace` and
|
|
357
|
+
`mapEnhancedStackTrace` turn the bundle positions of `__stack_trace` and
|
|
358
|
+
`__enhanced_stack_trace` into source lines.
|
|
293
359
|
|
|
294
360
|
`simulate(definition, { trigger, mocks, workflows })` walks a tier-1 graph in
|
|
295
361
|
process. It is a reduced form: no expressions are evaluated, a node without a
|
|
@@ -301,7 +367,11 @@ merges are not modelled.
|
|
|
301
367
|
|
|
302
368
|
`fixtures/histories/` holds the recorded histories of spec 10 §3 (timers,
|
|
303
369
|
signals, cancellation, child runs, race, gather, continue-as-new, patched,
|
|
304
|
-
side effects, activities, task failures, activation boundaries,
|
|
370
|
+
side effects, activities, task failures, activation boundaries, the 21 R2
|
|
371
|
+
parity histories (local activities, schedule-to-start, heartbeat details,
|
|
372
|
+
cancellation types, child options, run retry, continue-as-new results and
|
|
373
|
+
options, run and execution timeouts, start delay, external cancels, handler
|
|
374
|
+
drain, auto-upgrade, task failures and failure types), and updates as
|
|
305
375
|
parse-only fixtures), with their workflow sources in `fixtures/histories/src/`
|
|
306
376
|
and the scenarios that recorded them in `fixtures/histories/scenarios.ts`.
|
|
307
377
|
`bun run check:histories` re-records every history, replays it in QuickJS and in
|
|
@@ -310,6 +380,106 @@ completed workflow task to exactly the commands it recorded, then does all of
|
|
|
310
380
|
it again under `TZ=Asia/Kolkata`; `tests/histories.test.ts` adds the in-process
|
|
311
381
|
replay. `--write` re-records.
|
|
312
382
|
|
|
383
|
+
### Phase C (C-R1)
|
|
384
|
+
|
|
385
|
+
Every Phase C capability is written into the bundle's `code.features`
|
|
386
|
+
(`userActivity`, `updates`, `queries`, `searchAttributes`, `dynamic`,
|
|
387
|
+
`interceptors`) and into the command gate (`c.userActivity`, `c.updates`,
|
|
388
|
+
`c.searchAttributes`), so the service refuses it until the workspace's flag is
|
|
389
|
+
on (`CODE_FEATURE_FLAGS`, `PHASE_C_FEATURE_FLAGS`): `fluidgrids.run-control`
|
|
390
|
+
for updates, queries, dynamic workflows and interceptors,
|
|
391
|
+
`fluidgrids.search-attributes` for search attributes and
|
|
392
|
+
`fluidgrids.self-hosted-workers` for user activities. A bundle built before
|
|
393
|
+
C-R1 reports no runtime `capabilities` and the service does not deliver it
|
|
394
|
+
updates or custom queries.
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
import { declareActivity, defineQuery, defineUpdate, workflow } from '@fluidgrids/workflows';
|
|
398
|
+
|
|
399
|
+
const charge = declareActivity<{ amount: number }, { id: string }>('billing.charge', {
|
|
400
|
+
taskQueue: 'payments',
|
|
401
|
+
});
|
|
402
|
+
const setAddress = defineUpdate<{ address: string }, { ok: boolean }>('setAddress');
|
|
403
|
+
const status = defineQuery<{ address: string }>('status');
|
|
404
|
+
|
|
405
|
+
export const order = workflow(
|
|
406
|
+
'order',
|
|
407
|
+
{ updates: [setAddress], queries: [status] },
|
|
408
|
+
async (ctx) => {
|
|
409
|
+
let address = '';
|
|
410
|
+
ctx.handleQuery(status, () => ({ address }));
|
|
411
|
+
ctx.handleUpdate(
|
|
412
|
+
setAddress,
|
|
413
|
+
(args) => {
|
|
414
|
+
address = args.address;
|
|
415
|
+
return { ok: true };
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
validate: (args) => {
|
|
419
|
+
if (!args.address) throw new Error('empty');
|
|
420
|
+
},
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
ctx.upsertSearchAttributes({ stage: 'charging' });
|
|
424
|
+
return ctx.activity(charge, { args: { amount: 10 }, startToCloseTimeout: '30s' });
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
- Updates (05 §6, 11 §2.39): the lease delivers pending updates to a workflow
|
|
430
|
+
task (`request.updates`); the validator runs read-only and a rejection
|
|
431
|
+
writes nothing to history (`REJECT_UPDATE`); acceptance appends
|
|
432
|
+
`UPDATE_ACCEPTED` with the request and the handler's result or failure
|
|
433
|
+
`UPDATE_COMPLETED`. A replay re-delivers accepted updates after the
|
|
434
|
+
activation's inputs without their validators; `UPDATE_ADMITTED`
|
|
435
|
+
(update-with-start, reset) is delivered as an input and validated. An update
|
|
436
|
+
no handler takes by the end of its activation is rejected with
|
|
437
|
+
`UpdateNotHandled`.
|
|
438
|
+
- Queries run after the replay, read-only: a command, a sink call or a
|
|
439
|
+
side effect in a query handler (or an update validator) throws
|
|
440
|
+
`QueryHandlerSideEffect`. A name without a handler is answered with
|
|
441
|
+
`rejected: true`. Queries may also ride on a workflow task
|
|
442
|
+
(`request.queries`, CX8).
|
|
443
|
+
- `dynamicWorkflow(name, (ctx, workflowFn, input) => ...)` serves every
|
|
444
|
+
function name the bundle does not export (`code.exports.workflows["*"]`).
|
|
445
|
+
- `ctx.activity(declaration | name, options)` issues `SCHEDULE_ACTIVITY` of kind
|
|
446
|
+
`user` on the option's task queue, else the declaration's, else the run's;
|
|
447
|
+
`managed` refuses user activities. `implementActivity`, `defineActivity`
|
|
448
|
+
and `dynamicActivity` are for the worker: `lower()` reports
|
|
449
|
+
`durable.activityImplInBundle` when a workflow module pulls one into the
|
|
450
|
+
bundle. `ActivityPausedError` is what an activity throws after a heartbeat
|
|
451
|
+
reports `paused`.
|
|
452
|
+
- Query handlers and update validators are read-only: commands, sinks,
|
|
453
|
+
`ctx.random()`, `ctx.uuid()`, `Math.random()`, new patches and
|
|
454
|
+
`setCurrentDetails` throw `QueryHandlerSideEffect`, because validators do
|
|
455
|
+
not run again on replay.
|
|
456
|
+
- Interceptors (11 §2.10): a bundle's `interceptors` export runs only in a
|
|
457
|
+
task whose request lists `interceptors` in `features` (the workspace has
|
|
458
|
+
`fluidgrids.run-control` on); otherwise the task fails with
|
|
459
|
+
`UNSUPPORTED_COMMAND`. Inbound `execute`, `handleSignal`, `handleQuery`,
|
|
460
|
+
`validateUpdate`, `handleUpdate`; outbound `scheduleActivity`,
|
|
461
|
+
`scheduleLocalActivity`, `startTimer`, `startChild`, `signalRun`,
|
|
462
|
+
`cancelRun`, `sideEffect`, `continueAsNew`, `upsertSearchAttributes`,
|
|
463
|
+
`upsertContext`, `getLogAttributes`. Headers travel on starts, signals,
|
|
464
|
+
updates, activities, children and continue-as-new.
|
|
465
|
+
- `ctx.sinks.<sink>.<fn>(...args)` calls are returned once in the task result
|
|
466
|
+
(`sinkCalls`, at most 256), never on replay; managed runs ignore them.
|
|
467
|
+
- Contracts: `schema/bridge-v2.schema.json` (worker bridge protocol 2,
|
|
468
|
+
`validateBridgeFrame`) and `schema/payload-fields.json` (`PAYLOAD_FIELDS`,
|
|
469
|
+
the encoded payload form `{"$fgp":1, encoding, metadata, data}` and
|
|
470
|
+
`isEncodedPayload`). Failures nest through `cause`, so they are listed
|
|
471
|
+
apart (`FAILURE_FIELDS`, `COMMAND_FAILURE_FIELDS`): the payload of a failure
|
|
472
|
+
is its `details` at every level of the cause chain. Codecs call
|
|
473
|
+
`mapEventPayloads(type, payload, fn)` and `mapCommandPayloads(command, fn)`,
|
|
474
|
+
which apply both lists. The IR gains `internal:signal-run`,
|
|
475
|
+
`internal:set-search-attributes` and the schedule policy and spec fields
|
|
476
|
+
(`checkSchedulePolicy`; `startAt`, `endAt`, `excludeCalendars` in
|
|
477
|
+
`checkScheduleSpec`).
|
|
478
|
+
- Test environment: `update`, `startWithUpdate`, `query`, `reset`,
|
|
479
|
+
`registerActivity` / `mockActivity` with `completeActivityAsync`, search
|
|
480
|
+
attributes and headers at the start, `interceptors`,
|
|
481
|
+
`activityInterceptors` and `sinks`.
|
|
482
|
+
|
|
313
483
|
## Shared fixtures
|
|
314
484
|
|
|
315
485
|
`fixtures/` holds the conformance fixtures shared with the Python SDK: every
|