Skip to content

Commit d070954

Browse files
committed
docs(skills): an approval's decision outputs are enforced at the decision in the automation skill
The decisionOutputs teaching in objectstack-automation's state-machines-and-approvals reference said a typed declaration renders a record picker. It now says what the runtime enforces: type and multiple are judged on approve and reject before any write, a picker kind resolves through the expression approver's resolvers, multiple: true takes a list of distinct values, anything else is 400 VALIDATION_FAILED naming outputs.KEY, and the Console sends a list for a multiple text output. The token ceiling is paid in place by cutting three restatements whose homes stay in the same file. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAkWdcYL2ftVcWZ2scY
1 parent a04e9d7 commit d070954

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

‎skills/objectstack-automation/references/state-machines-and-approvals.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ reject) — enforced before any write, with no elevation bypass, so the run
219219
cannot resume past the node with the key a later `expression` approver reads
220220
still missing.
221221

222+
`type` and `multiple` are enforced there too, on approve and reject alike,
223+
before any write — they are not widget hints. A picker kind must resolve
224+
through the `expression` approver's resolvers in the request's organization:
225+
`user`, `department` and `team` by record id, `position` by a held position's
226+
machine name. `multiple: true` takes a list of distinct values (every kind,
227+
text and bare keys included); without it, one value. Anything else is
228+
`400 VALIDATION_FAILED` naming `outputs.KEY`. The Console sends a list for a
229+
`multiple: true` text output. The `lead_review` node below is the example.
230+
222231
### Reading the lock
223232

224233
A page over a record under approval must not offer an edit the server then
@@ -245,7 +254,7 @@ an id that does not exist gets.
245254
| `manager` | The submitter's manager (`sys_user.manager_id`) |
246255
| `field` | User id read from a record field (`value` = field name). Resolved against the record's **live** state at node entry, so a field written mid-flow routes correctly; a multi-select user field fans out into one approver per user |
247256
| `queue` | Members of ownership queue `value` at node entry; an empty queue adds nobody |
248-
| `expression` | A **CEL expression** resolved at node entry (`value` = the expression) — see **Dynamic approvers** below. Only `current.*` / `trigger.*` / `vars.*` roots are available; the optional `resolveAs: 'user'(default) \| 'department' \| 'position' \| 'team'` re-expands each resolved id through the graph |
257+
| `expression` | A **CEL expression** resolved at node entry (`value` = the expression) — see **Dynamic approvers** below. The optional `resolveAs: 'user'(default) \| 'department' \| 'position' \| 'team'` re-expands each resolved id through the graph |
249258

250259
### Dynamic approvers (`type: 'expression'`)
251260

@@ -307,20 +316,16 @@ export const DynamicApprovalFlow = defineFlow({
307316
config: { objectName: 'expense', triggerType: 'record-after-update', condition: "status == 'submitted'" },
308317
},
309318
{
310-
// Node A declares what a decision may hand to the flow. The TYPED
311-
// declaration renders a multi-select sys_user picker in the decision
312-
// dialog; the lead approves with outputs:
319+
// Node A declares what a decision may hand to the flow; the lead
320+
// approves with outputs:
313321
// POST …/approve { outputs: { next_reviewers: ['u2', 'u3'] } }
314-
// `required: true` is enforced by the runtime on APPROVE (never on
315-
// reject) — node B below has nobody to route to without it.
316322
id: 'lead_review', type: 'approval', label: 'Lead Review',
317323
config: {
318324
approvers: [{ type: 'org_membership_level', value: 'owner' }],
319325
decisionOutputs: [{ key: 'next_reviewers', label: 'Next Reviewers', type: 'user', multiple: true, required: true }],
320326
},
321327
},
322328
{
323-
// Node B resolves them at entry from the lead's decision outputs.
324329
id: 'co_sign', type: 'approval', label: 'Co-sign',
325330
config: {
326331
approvers: [{ type: 'expression', value: 'vars.lead_review.next_reviewers' }],
@@ -362,7 +367,7 @@ Object-hook `ctx` is a different vocabulary — see **objectstack-data**
362367
| `approvalStatusField` | Business-object field to mirror `pending`/`approved`/`rejected`/`recalled` onto (should be readonly) |
363368
| `onEmptyApprovers` | What an EMPTY resolved slate does: `admin_rescue` (default — request opens, only a privileged admin can act via Reassign; never waves through, never kills the run), `fail` (node fails — treat an empty slate as a config bug), `auto_approve` (skip the request, continue down `approve` with `output.autoApproved = true` — opt-in because it silently waves the record through), `fallback` (request opens on the sibling `fallbackApprovers` instead — same shape as `approvers`, required by this policy and refused under any other; a fallback that itself resolves to nobody degrades to `admin_rescue`). Declare it explicitly on any node with an `expression` approver (linted) |
364369
| `excludeSubmitter` | `true` drops the run's submitter (`submitter_id`) from the resolved slate, whatever approver type produced them — segregation of duties; a slate it empties takes the `onEmptyApprovers` route, never a silent pass. `onEmptyApprovers: 'auto_approve'` is **refused** beside it (it would approve exactly the request this exists to stop): use `admin_rescue`, `fail` or `fallback`. Default `false` |
365-
| `decisionOutputs` | Decision outputs a decision may carry (author declares, approvers fill values). Entries are bare keys (free-text input) **or typed declarations** `{ key, label?, type: 'text'\|'user'\|'department'\|'position'\|'team', multiple?, required? }` — a typed entry renders the matching record picker in the decision dialog (`multiple` collects an id array). Accepted outputs resume the run as `<nodeId>.<key>` variables; undeclared keys reject the decision; `decision`/`requestId` reserved |
370+
| `decisionOutputs` | Decision outputs a decision may carry: bare keys (free text) **or typed declarations** `{ key, label?, type: 'text'\|'user'\|'department'\|'position'\|'team', multiple?, required? }`, enforced at the decision — see *Recording a decision* |
366371
| `escalation` | Optional per-node SLA — `{ enabled, timeoutHours, action: reassign\|auto_approve\|auto_reject\|notify, escalateTo?, notifySubmitter }`. `timeoutHours` is **calendar (wall-clock) hours** — nights, weekends and holidays count; the platform ships no business-hours calendar. `escalateTo` is a **position machine name** (expanded to its holders via `sys_user_position`, ADR-0090 D3) or a specific user id — never a membership tier. `reassign` without `escalateTo` degrades to notify (linted) |
367372
| `maxRevisions` | Send-backs per run before auto-reject (ADR-0044) — see *Send-back for revision* above |
368373

0 commit comments

Comments
 (0)