> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Operations and automation

> Business changes that reach other systems, wait for people or run in durable steps.

A business change is a mutation. It runs as one transaction under one
label: its writes and the tasks it submits commit together, or not at all.
When the change needs work outside the transaction (a payment, an email,
an approval, a later step), the mutation submits a task to a
[target](https://docs.bijection.com/functions/effects.md), and a continuation receives the task's
result in a transaction of its own.

| Task | Guide |
| - | - |
| Ask another system to do something | [External effects](https://docs.bijection.com/operations/external-effects.md) |
| Ask people to approve a change | [Review](https://docs.bijection.com/operations/review.md) |
| Recover a command whose reply was lost | [Reconciliation](https://docs.bijection.com/operations/reconciliation.md) |
| Run several durable steps in order | [Processes](https://docs.bijection.com/operations/processes.md) |
| Wait for a deadline, lease work or bound concurrency | [Durable waits](https://docs.bijection.com/operations/durable-waits.md) |
| Publish facts other code follows | [Events](https://docs.bijection.com/operations/events.md) |
| Let editors map occurrences to actions | [Automations](https://docs.bijection.com/operations/automations.md) |
| Apply a bounded group, or a large one in chunks | [Bulk operations](https://docs.bijection.com/operations/bulk.md) |

## What happens when a client calls one

**1. Trial (optional)**

`client.trial(api<typeof App>().orders.refund, args)` runs the mutation in a
discarded world and answers `{ result, writes, tasks, validUntil }`. Nothing
commits and no task is performed. To keep a staged change for review,
stage it in a [branch](https://docs.bijection.com/branches) instead.

**2. Commit**

`client.mutate(api<typeof App>().orders.refund, args, { once })` runs the
mutation. Its writes and its submitted tasks commit together. A
committed result carries its `version`.

**3. Perform**

After the commit, each task's performer carries it out: an HTTP
receiver, a person holding a role, or another mutation.

**4. Result**

Each task settles once, with a `Result`. The continuation named by
`then` receives it. `Unknown` means the work may have happened: the
task is never performed a second time, and the app reconciles it.

> [!NOTE]
>
> A committed mutation proves that its own writes and intents committed.
> It is not evidence that another system did anything. Read the task's
> result for that.

## Follow a task

A task is the point of its own state. Keep the `Task` that `submit`
returned in a fact (`t.task(target)`), and read it with `ctx.get(task)`:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const state = await ctx.get(fact.task);
const result = state.state === "settled" ? state.result : null;
```

The lifecycle states are `pending`, `blocked` and `settled`. A task is
`blocked` when the submitter's grants recorded at submit lapsed before claim. A frame below
the task's run label sees `withheld`.

Expose a query over the app's own fact to let clients watch progress, and
watch it with `client.watch` or `useWatch`. `sys.tasks` holds every task
fact, read with the ordinary verbs:
`ctx.list(sys.tasks.where({ target, state: "pending" }).first(50))`.

## Reverse a committed change

A reversal is another mutation, with its own `allow`, arguments and
checks. Read the current state and the original task's result before
acting. If reversing needs another system, submit a new task with its own
`once`; never reuse the original one.

## Who may call it

A mutation with `allow: [roles]` is exposed at its tree path, and one
without `allow` is internal. [Guards](https://docs.bijection.com/access) refuse acts the roles would
otherwise admit. `bijection check` lists each exposed path with its grave
acts and guards in `bijection.lock`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.