Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
6 changes: 6 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @temporal-contract/client

## 8.0.0-beta.8

### Patch Changes

- @temporal-contract/contract@8.0.0-beta.8

## 8.0.0-beta.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@temporal-contract/client",
"version": "8.0.0-beta.7",
"version": "8.0.0-beta.8",
"description": "Client utilities with unthrown Result/AsyncResult for consuming temporal-contract workflows",
"keywords": [
"client",
Expand Down
2 changes: 2 additions & 0 deletions packages/contract/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @temporal-contract/contract

## 8.0.0-beta.8

## 8.0.0-beta.7

## 8.0.0-beta.6
Expand Down
2 changes: 1 addition & 1 deletion packages/contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@temporal-contract/contract",
"version": "8.0.0-beta.7",
"version": "8.0.0-beta.8",
"description": "Contract builder for temporal-contract",
"keywords": [
"contract",
Expand Down
9 changes: 9 additions & 0 deletions packages/testing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @temporal-contract/testing

## 8.0.0-beta.8

### Patch Changes

- Updated dependencies [274e340]
- @temporal-contract/worker@8.0.0-beta.8
- @temporal-contract/client@8.0.0-beta.8
- @temporal-contract/contract@8.0.0-beta.8

## 8.0.0-beta.7

### Major Changes
Expand Down
8 changes: 4 additions & 4 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@temporal-contract/testing",
"version": "8.0.0-beta.7",
"version": "8.0.0-beta.8",
"description": "Temporal testing utilities",
"keywords": [
"contract",
Expand Down Expand Up @@ -88,9 +88,9 @@
"zod": "catalog:"
},
"peerDependencies": {
"@temporal-contract/client": "^8.0.0-beta.7",
"@temporal-contract/contract": "^8.0.0-beta.7",
"@temporal-contract/worker": "^8.0.0-beta.7",
"@temporal-contract/client": "^8.0.0-beta.8",
"@temporal-contract/contract": "^8.0.0-beta.8",
"@temporal-contract/worker": "^8.0.0-beta.8",
"@temporalio/client": "^1.16.0",
"@temporalio/testing": "^1.16.0",
"@temporalio/worker": "^1.16.0",
Expand Down
59 changes: 59 additions & 0 deletions packages/worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# @temporal-contract/worker

## 8.0.0-beta.8

### Minor Changes

- 274e340: `context.saga()`: steps with compensating undos, unwound LIFO — with the
machinery failures exempt by default.

`declareWorkflow` handed a workflow `context.activities` and `context.errors`
and nothing for the walk-back, so every saga wrote its own. The LIFO machinery
is now `@unthrown/saga`'s. What this adds is the decision that belongs to
Temporal rather than to a `Result` combinator: **which failures compensate.**

```ts
const fulfilled = await context
.saga()
.step(
() => context.activities.reserveStock(order),
(reservation) => context.activities.releaseStock({ id: reservation.id }),
)
.step(
() => context.activities.chargeCard(order),
(charge) => context.activities.refund({ id: charge.id }),
)
.step(() => context.activities.ship(order))
.run();
```

The undos run on a **declared contract error** — a permanent domain answer,
where what the step did before saying no is knowable. They do **not** run on an
`ActivityError`, a `ChildWorkflowError` or a defect: a step that failed
unmodelled left state nobody can see, and un-deciding what you cannot see is a
second bug. That failure propagates untouched, so `propagateActivityFailure`
still re-raises Temporal's original failure — which deletes the per-step

```ts
.with(P.tag(ACTIVITY_ERROR_TAG), P.tag(ACTIVITY_CANCELLED_ERROR_TAG), (error) => ErrAsync(error))
```

arm that had to be repeated, was easy to omit, and was invisible when omitted.

Cancellation is the one case a caller may opt back in to, with
`saga({ compensateOnCancellation: true })`. Every undo runs inside a
non-cancellable scope: a cancelled scope schedules no activity at all, so
without one that opt-in could never compensate for the failure it exists for.
A compensation that itself fails
becomes a defect carrying its own failure, which outranks the failure that
triggered the unwind — a refund that never happened is worse news than the order
that could not ship — and the remaining undos still run first.

`workflowSaga` is the same function, exported from
`@temporal-contract/worker/workflow` for a workflow that composes its steps in a
helper.

Closes #413.

### Patch Changes

- @temporal-contract/contract@8.0.0-beta.8

## 8.0.0-beta.7

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@temporal-contract/worker",
"version": "8.0.0-beta.7",
"version": "8.0.0-beta.8",
"description": "Worker utilities with unthrown Result/AsyncResult for implementing temporal-contract workflows and activities",
"keywords": [
"contract",
Expand Down
Loading