@pikku/core 0.12.134 → 0.12.135
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/CHANGELOG.md +7 -0
- package/dist/function/compensation-name.d.ts +4 -0
- package/dist/function/compensation-name.js +6 -0
- package/dist/function/function-meta.types.d.ts +2 -0
- package/dist/function/function-runner.js +17 -0
- package/dist/function/functions.types.d.ts +7 -0
- package/dist/testing/service-tests/queued-workflow-harness.d.ts +61 -0
- package/dist/testing/service-tests/queued-workflow-harness.js +151 -0
- package/dist/testing/service-tests/workflow-compensation-queued-tests.d.ts +11 -0
- package/dist/testing/service-tests/workflow-compensation-queued-tests.js +683 -0
- package/dist/testing/service-tests.d.ts +4 -0
- package/dist/testing/service-tests.js +4 -0
- package/dist/utils/hmac.d.ts +0 -33
- package/dist/utils/hmac.js +0 -61
- package/dist/wirings/rpc/rpc-runner.js +21 -1
- package/dist/wirings/trigger/webhook-source.types.d.ts +4 -3
- package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +38 -6
- package/dist/wirings/workflow/graph/graph-node.d.ts +2 -1
- package/dist/wirings/workflow/graph/graph-node.js +2 -1
- package/dist/wirings/workflow/graph/graph-runner.d.ts +1 -1
- package/dist/wirings/workflow/graph/graph-runner.js +104 -67
- package/dist/wirings/workflow/graph/graph-validation.js +2 -2
- package/dist/wirings/workflow/graph/workflow-graph.types.d.ts +20 -1
- package/dist/wirings/workflow/index.d.ts +1 -1
- package/dist/wirings/workflow/pikku-workflow-service.d.ts +13 -0
- package/dist/wirings/workflow/pikku-workflow-service.js +113 -143
- package/dist/wirings/workflow/run-timeline.d.ts +2 -0
- package/dist/wirings/workflow/run-timeline.js +3 -0
- package/dist/wirings/workflow/workflow-child-step.d.ts +17 -0
- package/dist/wirings/workflow/workflow-child-step.js +31 -0
- package/dist/wirings/workflow/workflow-compensation.d.ts +68 -0
- package/dist/wirings/workflow/workflow-compensation.js +282 -0
- package/dist/wirings/workflow/workflow-constants.d.ts +5 -0
- package/dist/wirings/workflow/workflow-constants.js +9 -0
- package/dist/wirings/workflow/workflow-dsl-pass.d.ts +12 -0
- package/dist/wirings/workflow/workflow-dsl-pass.js +75 -0
- package/dist/wirings/workflow/workflow-queue-routing.js +3 -3
- package/dist/wirings/workflow/workflow-run-status.js +13 -1
- package/dist/wirings/workflow/workflow-status-stream.js +2 -0
- package/dist/wirings/workflow/workflow-unwind-plan.d.ts +38 -0
- package/dist/wirings/workflow/workflow-unwind-plan.js +120 -0
- package/dist/wirings/workflow/workflow.types.d.ts +9 -2
- package/knowledge/decisions/internals/workflow-step-compensation-runs-as-its-own-durable-step.md +21 -18
- package/package.json +1 -1
- package/src/public-surface.json +0 -1
package/knowledge/decisions/internals/workflow-step-compensation-runs-as-its-own-durable-step.md
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: decision
|
|
3
|
-
title: A step's compensation
|
|
4
|
-
description: A refund or rollback must not fire twice on replay, so
|
|
3
|
+
title: A step's compensation runs as a durable step of its own, declared on the function
|
|
4
|
+
description: A refund or rollback must not fire twice on replay, so it is recorded as `<step>:compensate`; `onError` is gone
|
|
5
5
|
tags: workflow
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# A step's compensation
|
|
8
|
+
# A step's compensation runs as a durable step of its own, declared on the function
|
|
9
9
|
|
|
10
|
-
`
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
typically a refund or a rollback, and a bare invoke
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
A function declares `compensate` inline on `pikkuFunc`. When a workflow unwinds,
|
|
11
|
+
`driveUnwind` (`workflow-compensation.ts`) runs it as the step
|
|
12
|
+
`<step>:compensate` through the same RPC path as a forward step. Durability is
|
|
13
|
+
the point: a compensation is typically a refund or a rollback, and a bare invoke
|
|
14
|
+
would fire again on every replay. Recorded as a step, a second pass finds it
|
|
15
|
+
`succeeded` and returns the cached result. It uses the forward step's retry
|
|
16
|
+
defaults, and a compensation cannot itself be compensated.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
`runPikkuFunc` and the RPC resolver derive the `<id>:compensate` function from
|
|
19
|
+
the forward config lazily, so nothing extra is registered, and it is never
|
|
20
|
+
exposed. What to undo, and in what order, is decided by the pure `planUnwind`
|
|
21
|
+
from the recorded step rows — never from in-memory state, so a crash mid-unwind
|
|
22
|
+
resumes at the next compensation.
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
`onError` (DSL option and graph node field) was removed. Graph nodes recover
|
|
25
|
+
with `recover`, which takes precedence over compensation.
|
|
26
|
+
|
|
27
|
+
**What this rules out:** invoking the compensation inline "since it's just
|
|
28
|
+
cleanup", compensating a compensation, a second unwind of a settled run, and
|
|
29
|
+
swallowing the original failure because a handler succeeded.
|
package/package.json
CHANGED