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 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.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 theTask that submit
returned in a fact (t.task(target)), and read it with ctx.get(task):
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 ownallow, 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 withallow: [roles] is exposed at its tree path, and one
without allow is internal. Guards refuse acts the roles would
otherwise admit. bijection check lists each exposed path with its grave
acts and guards in bijection.lock.