You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 97f9f1f
Browse filesBrowse the repository at this point in the historyBrowse files
`recalled`). The platform does not evaluate those predicates ahead, and on a
1464
+
record where one holds it takes away a write the mirror needs. Keep callers
1465
+
off a mirror field with `readonly`, which the mirror passes.
1466
+
1467
+
The field's other rules and hooks cannot be read ahead, and they meet every
1468
+
write of the mirror. A `state_machine` rule on the field owes the mirror its
1469
+
other moves as well: from `pending` to each outcome, and out of `pending` and
1470
+
`returned` when a request is abandoned. Where the object closes on the field at
1471
+
`approved` or `rejected`, a write of the mirror that a rule or a hook refuses is
1472
+
not swallowed:
1473
+
1474
+
-**The `pending` of an approval's first request.** The approval does not open.
1475
+
The request just written is voided as `cancelled`, its timeline carries the
1476
+
refusal, no lock is taken, and the run fails at that step with the refusal's
1477
+
own message. The record keeps the value it held.
1478
+
-**Any other write.** The field keeps the value it holds, and the refusal is
1479
+
reported three ways: an `error` line in the server log, a line with no actor on
1480
+
the request's timeline that carries the refusal's message, and a notice to the
1481
+
organization's administrators, who can change the rule.
1482
+
1483
+
### What the flow owes
1484
+
1485
+
-**One mirror field for every step.** Every approval step that can act on a
1486
+
record of the object names the same mirror field as the concerned step. A
1487
+
step that names another field, or none, refuses the approval, whether it comes
1488
+
ahead of the concerned step or after it. A step in a `map` body counts as one
1489
+
that can act on the parent's record, unless the node writes its items out and
1490
+
every one of them is a record.
1491
+
-**No pause between two steps.***Between two steps* means after a step is
1492
+
decided, either way, and before the next step opens. The next step can be the
1493
+
same step opened again, so in a `map` or a `loop` body that holds a step, a
1494
+
node after the body's last step stands between two steps too. No node that can
1495
+
pause the run of itself may stand there, in a flow that runs as the user or in
1496
+
one that runs as system: a `wait` or a `screen` there would hold the document
1497
+
in approval with nobody asked to decide. The platform reads this off the node
1498
+
type's descriptor (`supportsPause`), and reads a `subflow` or a `map` through
1499
+
the body it calls. The revise window of a returned request (`approval_revise`)
1500
+
is not such a pause.
1501
+
-**A node type without a descriptor.** A node whose type publishes no
1502
+
descriptor counts as one that can pause, and so does a node whose type the
1503
+
platform cannot read: such a node between two approval steps refuses the
1504
+
approval. The structural types `start` and `end` have no executor and never
1505
+
pause, so the `end` of a `map` body or of a `subflow` body refuses nothing.
1506
+
-**No `map` of approvals on the parent's record.** Where a concerned step can
1507
+
act on the parent's record, the approval holds no `map` with an approval step
1508
+
in its body, at any depth, unless the node writes its items out and none of
1509
+
them is a record. An item that is a record has its request filed on the item,
1510
+
and the parent's run waits on it as it would on a pause. A parent run that
1511
+
carries no record, such as a batch sign-off that hands a `map` its items, is
1512
+
not refused on this ground.
1513
+
-**Readable whole.** Every flow a `subflow` or a `map` names is one the
1514
+
platform can read. An approval it cannot read whole cannot be judged, and is
1515
+
refused.
1516
+
1517
+
One more ground is the host's, not the author's. An approval any step of which
1518
+
can act on an object that declares `closedStates`, concerned or not, opens only
1519
+
on a host that runs the approvals plugin's sweeps, which needs a `job` service.
1520
+
The sweeps are what release a record held by a dead run, below.
1521
+
1522
+
### An approval that does not mirror onto the closing field
1523
+
1524
+
An approval none of whose steps mirrors onto a field the object closes on is
1525
+
asked none of the field and flow conditions, only the host's. It moves nothing on
1526
+
the closing field, so it does not open a closed document: a record that is closed
1527
+
stays closed through it, on the value its last writer left, and every caller's
1528
+
edit of it is refused, in the revise window after a send-back as well. Such an
1529
+
approval is not a way out of the closed state. Where a closed document should
1530
+
not be sent for approval at all, gate the flow's start on the state.
1531
+
1532
+
### Each item under a `map` is an approval of its own record
1533
+
1534
+
Under a `map` whose items are records, each item's request is filed on that
1535
+
item, on the object the node names for its items, and what follows is judged for
1536
+
that record alone:
1537
+
1538
+
- the item object's closed values and mirror field are judged, with the rest of
1539
+
the approval, at the approval's first request;
1540
+
- the submitter is told an item's outcome without waiting for the items after it;
1541
+
- when an item's request is abandoned, only the requests on that item's record
1542
+
count, never another item's (below).
1543
+
1544
+
### What a refused opening is for the person who submitted
1545
+
1546
+
When the check refuses, the approval does not open: no request is written,
1547
+
nothing is mirrored, no lock is taken, and nobody is asked to decide. The
1548
+
approval node fails the run with a `VALIDATION_FAILED` error, and that failed run
1549
+
is what the person who submitted sees. Its message names the record whose
1550
+
approval was not started, and then, for each gap, the flow, the step, the object,
1551
+
the field and what is missing. Its lead says that the object closes on its
1552
+
approval field only where a gap concerns that field; where the only gaps are the
1553
+
host's or a flow that could not be read, the lead says instead that the approval
1554
+
can act on an object that declares `closedStates`. The message is in the run's
1555
+
locale where the plugin carries it, and in English otherwise. The record keeps the
1556
+
value it held, and the server log carries a warning that names the gaps.
1557
+
1558
+
Nothing in the message is the submitter's to fix: every gap is the app's
1559
+
configuration or the host's. Whoever maintains the app fixes the field, the flow
1560
+
or the host, and the submitter then submits again.
1561
+
1562
+
### What an abandoned approval leaves
1563
+
1564
+
Three writers abandon a request: its submitter's recall, of a pending request or
1565
+
of a returned one in its revise window; an administrator's override of a pending
1566
+
request, the override arm of the same recall; and the sweep that releases a
1567
+
record held by a dead run. Each records `recalled` on the request. Where the
1568
+
object closes on the mirror field at any value, one of its own or a status, an
1569
+
abandoned request never writes a closed value of that field:
1570
+
1571
+
1.**A closed value the approval did not write is left alone.** Where the field
1572
+
holds a closed value that no request of this approval on this record had as
1573
+
its status, another writer put it there, and the mirror writes nothing. A
1574
+
request of the same approval on another record, another item of a `map`, does
1575
+
not count.
1576
+
2.**Otherwise `recalled`**, where the field declares it, or declares no options,
1577
+
and the object does not close on it.
1578
+
3.**Otherwise the first usable value in this order:** the value the field held
1579
+
at submit, the field's declared default, empty. A closed value is passed over
1580
+
at each step, and so is a value the field does not declare. On a required
1581
+
field an empty value at submit is passed over for the default.
1582
+
1583
+
So listing `recalled` among the field's closed values closes nothing through the
1584
+
mirror: a withdrawn approval leaves the record open. A record that was closed
1585
+
when it was submitted, and that the approval opened, is left open on the value a
1586
+
never-submitted record carries, its default or empty. To close a withdrawn
1587
+
document, use an action or a flow of the app's own. To show a withdrawn approval
1588
+
on the record, declare `recalled` among the field's options and do not close on
1589
+
it.
1590
+
1591
+
Where the platform cannot tell whether the approval wrote the closed value the
1592
+
field holds, because the abandoned request, or one opened on the record since the
1593
+
approval's run started, does not record the run it belongs to, it goes down the
1594
+
order. The server log says when the mirror withholds a declared `recalled` (a
1595
+
warning) and when it passes over a closed value or leaves one alone. On a
1596
+
required field that is not `readonly`, with no default the mirror can use, the
1597
+
write of empty is refused: the field keeps the value it holds, and the refusal is
1598
+
logged, and reported as above where the object closes on the field at `approved`
1599
+
or `rejected`.
1600
+
1413
1601
## Why
1414
1602
1415
1603
Separating *who configures* from *who approves* from *as whom it runs* is the same capability/assignment/requirement decoupling as the rest of authorization (ADR-0066). The `runAs` default of `user` means an approval flow can't silently grant the submitter cross-tenant or cross-owner reach — elevation is opt-in and auditable. That is the safe-by-default posture: the common case respects RLS; the elevated case is explicit.
@@ -1427,6 +1615,6 @@ Separating *who configures* from *who approves* from *as whom it runs* is the sa
- Decision records: **ADR-0049** (`runAs`), **ADR-0066** (unified authorization), **ADR-0044** (send-back and resubmission), **ADR-0162** (closed states and the approvals on them).
1431
1619
- Guide: [Hooks](/docs/automation/hooks) and [Flows](/docs/automation/flows); [Who can see data / automation / interface](/docs/permissions/access-recipes).
0 commit comments