Skip to content

Commit 35d0ff2

Browse files
os-zhuangclaude
andcommitted
docs(approvals): drop duplicated role warning, generalize approver literal (#3113 lint fix)
`lint.yml` has been red on main since #3113: the reserved-word ratchet (ADR-0090 D3) caught content/docs/automation/approvals.mdx growing 5 → 9 occurrences of "role". Every open PR inherits the failure. The four new occurrences are NOT a fifth legitimate boundary needing a baseline bump — three of them are a near-verbatim duplicate of the callout 80 lines earlier, and the fourth is an over-narrow API description: - The lifecycle Steps repeated the "type: 'role' is not a position" warning that "3. The approval node" already carries (and carries better — it names the `approval-role-not-membership-tier` lint rule). Kept the fact the lifecycle section actually needs (an unresolved approver list parks the run forever) and cross-referenced the authoritative warning instead. - `approverId` was documented as accepting `role:<r>`. The runtime falls back to a generic `` `${a.type}:${a.value}` `` literal for EVERY approver type (approval-service.ts expandApprovers), and the REST layer only splits on commas — it never validates the prefix. `<type>:<value>` is the accurate contract; `role:<r>` described one arbitrary instance of it. Net: same information, one authoritative home, no accuracy lost, and the baseline stays at 5 rather than freezing 4 avoidable occurrences. Deliberately NOT rewording the surviving 5: `role` there is the better-auth org-membership tier (`sys_member.role`), which is D3's single documented exception. It is live, not deprecated — spec `ApproverType` still enumerates 'role' alongside 'position' (approval.zod.ts, asserted in approval.test.ts) and `expandRoleUsers` resolves it against `sys_member.role`. Renaming a third-party identifier we do not own would make the docs wrong. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3a8ce9d commit 35d0ff2

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

content/docs/automation/approvals.mdx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,11 @@ record is **locked** against edits while pending (`lockRecord`, default `true`),
130130
and the flow run parks until a decision arrives.
131131

132132
Only `approvers` is required on the node; everything else has a default
133-
(`behavior: 'first_response'`, `lockRecord: true`, `maxRevisions: 3`).
134-
135-
<Callout type="warn">
136-
**`type: 'role'` is not a position.** In an approver entry, `role` means the
137-
better-auth membership tier (`owner` / `admin` / `member`). Naming a business
138-
role like `sales_manager` there matches nobody and the request silently has no
139-
approvers — use `{ type: 'position', value: 'sales_manager' }`.
140-
</Callout>
133+
(`behavior: 'first_response'`, `lockRecord: true`, `maxRevisions: 3`). An
134+
approver entry that resolves to nobody is not an error: the request opens with
135+
an empty `pending_approvers` and nothing can move it, so the run parks forever.
136+
The approver-type trap that causes this is covered under
137+
**3. The approval node** above.
141138

142139
### The approver finds it in their queue
143140

@@ -150,8 +147,10 @@ curl -b cookies.txt \
150147
"https://your-app.example.com/api/v1/approvals/requests?status=pending&approverId=usr_123"
151148
```
152149

153-
`approverId` accepts a user id, an email, or `role:<r>` — and takes several
154-
values (comma-separated or repeated) to cover a person's identities in one call.
150+
`approverId` accepts a user id, an email, or a `<type>:<value>` approver literal
151+
(`position:finance_manager` — the form an entry falls back to when it resolves
152+
to no users) — and takes several values (comma-separated or repeated) to cover
153+
a person's identities in one call.
155154
Other filters: `status`, `object`, `recordId`, `submitterId`, `q`, `limit`,
156155
`offset`.
157156

0 commit comments

Comments
 (0)