# A worker crashes on “Pay now”. Kaabist doesn’t press it again.

Mark the steps that change something (a submit, a payment, an order) as side effects. Kaabist writes each one down just before it runs and again once it has worked. If a server crashes in between, Kaabist never presses the button again on its own: it pauses and asks you to check.

## Mark the step

A side-effect step can be neither retried nor optional, and the linter warns when no checkpoint follows it. That checkpoint is where everything after the submit resumes from.

```
{ "click": "#order-form button[type=submit]",
  "side_effect": true,
  "expect": { "url": "**/orders/*" } },
{ "checkpoint": "order-placed" }
```

## The fence

Before the click, Kaabist writes the step down as about to execute; once its expectation holds, as executed. A server that picks the job up and finds the fence still open does not click. It pauses the job as side_effect_ambiguous and notifies you, so you can check what happened.

## Retries never go back past it

A retry can never restart from a checkpoint earlier than the last side effect that ran. Whatever goes wrong after the order is placed, the order is not placed again.

## And no duplicate jobs either

Send an Idempotency-Key when you create a job. The same key with the same body within 24 hours returns the original job instead of starting a second one.

```
const idempotencyKey = `order-${orderId}`;
const job = await kaab.jobs.create({
  program: "place-order",
  inputs: { sku: "HP-1037", qty: 2 },
  idempotencyKey,
});
```

## Test up to the button

A dry run executes the whole flow and stops before the first side effect, so you can test a checkout without buying anything.

## Questions

### What happens after side_effect_ambiguous?

You, or the teammate you chose, check the site and decide: skip the step if it went through, or abort the job. Kaabist never guesses.

### Does this replace idempotency on my own side?

It complements it. The fence protects the browser step; the Idempotency-Key protects the API call that starts the job.
