From 6d93210aee93175b9abdd382c1acd88487949384 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 08:29:53 +0000 Subject: [PATCH 1/2] docs(approvals): a reject reason is required at every human door The contract docblock, the approval_reject comment, the approvals docs page, the platform checklist and the skill reference stated the reject reason as optional or action-only; they now state the shipped rule. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2 --- .../35772-reject-reason-required-texts.md | 12 ++++++++++++ content/docs/automation/approvals.mdx | 15 ++++++++++----- docs/qa/platform-checklist/areas/approvals.json | 17 ++++++++++++----- .../src/sys-approval-request.object.ts | 4 +++- packages/spec/src/contracts/approval-service.ts | 11 +++++++++++ .../references/state-machines-and-approvals.md | 13 ++++++------- 6 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 .changeset/35772-reject-reason-required-texts.md diff --git a/.changeset/35772-reject-reason-required-texts.md b/.changeset/35772-reject-reason-required-texts.md new file mode 100644 index 00000000000..3efdee08940 --- /dev/null +++ b/.changeset/35772-reject-reason-required-texts.md @@ -0,0 +1,12 @@ +--- +'@objectstack/skills': patch +'@objectstack/spec': patch +'@objectstack/plugin-approvals': patch +--- + +docs(approvals): a reject reason is required at every human door — the contract docblock, the docs, the platform checklist and the skill reference say so + +Clause-②: no +Metadata-protocol: none + +Text only; no behaviour changes. `ApprovalService.decide()` already refuses a reject whose `comment` is missing, blank or not a string with `400 VALIDATION_ERROR` before any write, and an approve keeps its comment optional. The texts that still called the reason optional now state that rule: the `ApprovalDecisionInput.comment` and `IApprovalService.decide` docblocks in `@objectstack/spec` (the type is unchanged: `comment` stays optional in the interface, because an approve may omit it), the `approval_reject` action's source comment in `@objectstack/plugin-approvals`, which said the target route does not judge the reason, and `references/state-machines-and-approvals.md` § Recording a decision in `@objectstack/skills`. The skill reference pays for its new sentence in place: the outputs paragraph's restatement of how a previous approver picks the next node's approvers is replaced by a pointer to the Dynamic approvers example that shows it. diff --git a/content/docs/automation/approvals.mdx b/content/docs/automation/approvals.mdx index a3567115849..43b998a3e0f 100644 --- a/content/docs/automation/approvals.mdx +++ b/content/docs/automation/approvals.mdx @@ -771,7 +771,8 @@ curl -b cookies.txt -X POST \ https://your-app.example.com/api/v1/approvals/requests/req_456/approve \ -H "Content-Type: application/json" \ -d '{ "comment": "Within budget." }' -# POST .../reject for the other direction; body: { actorId?, comment? } +# POST .../reject for the other direction; body: { actorId?, comment } +# a reject's comment is its reason: required, a non-blank string ``` `actorId` defaults to the caller, who takes the first slot in @@ -868,7 +869,7 @@ continuity levers on the same request. All are `POST | Verb | Route | Who | Effect | |:---|:---|:---|:---| -| `approve` / `reject` | `/approve` `/reject` | pending approver | Records the decision (finalizes per `behavior`). Accepts `comment`, `attachments`, and — when the node declares `decisionOutputs` — structured `outputs` handed to the flow as `.` variables. | +| `approve` / `reject` | `/approve` `/reject` | pending approver | Records the decision (finalizes per `behavior`). Accepts `comment` (a reject's reason — required at every human door, see below), `attachments`, and — when the node declares `decisionOutputs` — structured `outputs` handed to the flow as `.` variables. | | `reassign` | `/reassign` | pending approver | Hands one slot to another user (`to`); the request stays pending. | | `revise` (send back) | `/revise` | pending approver | Ends this round as **`returned`**, unlocks the record for rework (ADR-0044). | | `request-info` | `/request-info` | pending approver | Asks the submitter for more info; the request **stays pending**. `comment` required. | @@ -934,10 +935,14 @@ renders and executes them wherever the object is surfaced — the **Approvals inbox** included — so a decision (comment, a file-upload for `attachments`, the reassign user-picker) is collected by the generic action dialog with **no per-action UI code**. New decision capabilities ship as backend metadata, not -hand-written buttons. A reject through `approval_reject` carries its reason: the -action declares its `comment` param required, so the action door, MCP `run_action` and the +hand-written buttons. Every human reject carries its reason: `approval_reject` +declares its `comment` param required, so the action door, MCP `run_action` and the dialog refuse a reject whose `comment` is missing or blank (`400`, the declared -param contract's `required` refusal). +param contract's `required` refusal), and `ApprovalService.decide()`, behind the +`/reject` route and the SDK's `client.approvals.reject`, refuses one the same +way (`400 VALIDATION_ERROR`); the inbox keeps Reject disabled until a reason is typed. The one +exception is the email action link, which still records the fixed text "Via +action link" instead of the approver's reason (tracked in #35722). On the record itself, a record with approval requests grows an **Approvals** tab beside Details and Related, with a request-count badge: the current step, decision diff --git a/docs/qa/platform-checklist/areas/approvals.json b/docs/qa/platform-checklist/areas/approvals.json index 2495133c2bf..d70eeb9e49e 100644 --- a/docs/qa/platform-checklist/areas/approvals.json +++ b/docs/qa/platform-checklist/areas/approvals.json @@ -191,7 +191,7 @@ "title": "M-of-N quorum approves at the threshold; one rejection vetoes", "since": "v16", "status": "active", - "revision": 12, + "revision": 13, "priority": "P1", "surface": "browser", "personas": ["three DISTINCT users each holding one of the approver positions"], @@ -214,7 +214,7 @@ "repeat-actor probe: as the NON-PRIVILEGED approver who already decided (e.g. Ada), approve the same request again — refused 403 FORBIDDEN ('is not a pending approver': her own decision keeps her a reader of the request, and her slot has left the slate) and the tally unchanged. A user holding none of the routed positions, who never acted on the request, is refused too, but with 404 REQUEST_NOT_FOUND, the answer an id naming no request gets: they cannot read the request (no showcase object declares enable.approvalsVisibleToReaders), and packages/plugins/plugin-approvals/src/approval-service.ts#refuseUnreadableRequest answers such a caller before the slate check, so the request's existence never leaks; the tally is unchanged either way. A 403 for that user means they could read the request: record which tier admitted them. ⛔ Never use the platform/tenant admin for this probe — an admin decision is the documented override (#3424) and finalizes by design", "as approver 2, approve — re-read: status=approved, remaining pending task for approver 3 closed", "GET /:id/actions — exactly two approve rows from two distinct actors", - "on a SECOND quorum request: as any single approver, POST /reject — re-read immediately", + "on a SECOND quorum request: as any single approver, POST /reject with a reason in the body ({\"comment\": \"Out of budget\"}; a reject without a non-blank comment is refused 400 VALIDATION_ERROR and decides nothing) — re-read immediately", "screenshot the request page's tally line at each stage alongside the API reads — the inbox's Request cell (or ?request=) opens the served sys_approval_request record page, /apps/APP/sys_approval_request/record/ID (objectui#12484 retired the drawer), whose approvals panel reads 'Approvals — x of 2 · N eligible approvers'; a '(2 of 3)' in the flow's step text is static, not the tally" ], "acceptance": [ @@ -317,6 +317,12 @@ "date": "2026-11-14", "change": "fixtures.knownGaps[1]: the runtime fixture is by design and the 'one seed line retires it' wording is dropped (maintainer ruling 2026-11-14 on #33351, row 135, option B). Seeding Ada into finance or legal would also make her a required approver of the unanimous invoice dual sign-off. Read at base ba35dfd78: flows/index.ts (showcase_invoice_signoff approvers finance + legal, behavior unanimous), approval-service.ts (isApprovalSatisfied, unanimous = every resolved approver approved). No clause changed", "ref": "#33351" + }, + { + "revision": 13, + "date": "2026-11-20", + "change": "steps[7] sends a reason with the veto's POST /reject. A reject now carries its reason at every human door: ApprovalService.decide refuses a reject whose comment is missing, blank or not a string with 400 VALIDATION_ERROR before any write (packages/plugins/plugin-approvals/src/approval-service.ts), so a body-less /reject decides nothing. Read from source at base d9be915f40, not re-run. No clause changed", + "ref": "#35772" } ] }, @@ -1768,7 +1774,7 @@ "title": "Inbox keyboard flow: j/k and arrows move focus, Enter opens the request's page, x selects — and a/r quick-decide through the SAME server transition as the buttons, gated by quick-decidability", "since": "v16", "status": "active", - "revision": 3, + "revision": 4, "priority": "P2", "surface": "browser", "personas": ["dev admin (pending approver on the seeded demo requests — several quick-decidable rows plus the dynamic-approval stage-1 row as the NOT-quick-decidable contrast)"], @@ -1782,7 +1788,7 @@ "steps": [ "boot the showcase on its own port and DB (dogfood §0); sign in as the dev admin; open the inbox via the account app's Approvals entry; confirm the hint bar renders ('Keyboard: j/k move · Enter open · x select · a approve · r reject')", "press j/j/k and ArrowDown/ArrowUp — the focus ring walks the FILTERED list order; press Enter — the focused row's request page opens (/apps/APP/sys_approval_request/record/ID; verify the page's request identity against GET /api/v1/approvals/requests/:id, not the highlight); go Back to the queue", - "focus a quick-decidable row and press r — the shared confirm dialog opens (nothing posted yet); confirm — capture POST /api/v1/approvals/requests/:id/reject and re-read the request + /:id/actions", + "focus a quick-decidable row and press r — the shared confirm dialog opens (nothing posted yet) with Reject disabled until a reason is typed; type a reason, then confirm — capture POST /api/v1/approvals/requests/:id/reject carrying that comment and re-read the request + /:id/actions", "press a on another quick-decidable row — approve dialog → confirm → POST /:id/approve; re-read", "ownership guards: click into the search input and type j/k/a — the list focus does not move and nothing decides; with a confirm dialog open press j/Enter — inert (the list handler yields while a decide dialog or any alertdialog is up)", "gating: focus the dynamic-approval stage-1 row (declared decisionOutputs) and press a and r — NOTHING happens: no dialog, no POST (those decisions need the typed-output dialog on the request's page)", @@ -1834,7 +1840,8 @@ "history": [ { "revision": 1, "date": "2026-08-30", "change": "initial — the inbox's keyboard surface (documented in the page's own header and advertised by its hint bar) had no checklist coverage; the load-bearing halves are that r/a land the same server transition as the buttons and that quick-decidability gates hotkeys off rows whose decisions require typed outputs", "ref": "#sweep-2026-08-30" }, { "revision": 2, "date": "2026-10-20", "change": "steps[0] respelled: 'boot showcase isolated' → 'boot the showcase on its own port and DB'. Round 12's out-of-scope finding (landing record 6287983829 on wave anchor #24579): the phrase 'showcase isolated' named the dogfood §0 own-port boot, and a runner read it as the `isolated` tenancy posture (OS_TENANCY_POSTURE=isolated). The new spelling names that boot by what it is, in RUNNER.md's own words for it (the trap table's counter: own port/DB, skill §0), and names no posture. Read at base e4d604efd3. No clause changed", "ref": "#25003" }, - { "revision": 3, "date": "2026-10-28", "change": "the retired request drawer took two of this item's behaviours with it: the ←/→ drawer-to-drawer walk and the list handler's yield to an open drawer sheet. objectui#12484 deleted the inbox's side sheet (ruling C on objectui#12438); it came into this tree with the ui/ import, PR #25825; Enter, a row click and ?request= now navigate to the request's served record page, /apps/APP/sys_approval_request/record/ID, and the keyboard effect in ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx has no ArrowLeft/ArrowRight branch and yields only to a decide dialog, a focused input and an alertdialog. Dropped: revision 2's steps[2] (the drawer walk), the drawer-sheet guard in steps[5] and acceptance[2], and acceptance[4]'s ←/→ half (its x/space half stays). Rewritten to the request page: title, steps[1], steps[6], acceptance[0], acceptance[3], negative[3] and source[0]. acceptance[0] and [4] changed meaning, so a prior verdict on them does not carry. Read from source at base f2fdac5d, not driven live. Wave anchor #25807, slice C; lead from slice B's report 6457925443", "ref": "#25807" } + { "revision": 3, "date": "2026-10-28", "change": "the retired request drawer took two of this item's behaviours with it: the ←/→ drawer-to-drawer walk and the list handler's yield to an open drawer sheet. objectui#12484 deleted the inbox's side sheet (ruling C on objectui#12438); it came into this tree with the ui/ import, PR #25825; Enter, a row click and ?request= now navigate to the request's served record page, /apps/APP/sys_approval_request/record/ID, and the keyboard effect in ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx has no ArrowLeft/ArrowRight branch and yields only to a decide dialog, a focused input and an alertdialog. Dropped: revision 2's steps[2] (the drawer walk), the drawer-sheet guard in steps[5] and acceptance[2], and acceptance[4]'s ←/→ half (its x/space half stays). Rewritten to the request page: title, steps[1], steps[6], acceptance[0], acceptance[3], negative[3] and source[0]. acceptance[0] and [4] changed meaning, so a prior verdict on them does not carry. Read from source at base f2fdac5d, not driven live. Wave anchor #25807, slice C; lead from slice B's report 6457925443", "ref": "#25807" }, + { "revision": 4, "date": "2026-11-20", "change": "steps[2] types a reason before confirming the r-key reject. The inbox's row Reject confirmation, which the r key opens, keeps Reject disabled until the reason is non-blank, and ApprovalService.decide refuses a reject without one (ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx; packages/plugins/plugin-approvals/src/approval-service.ts). Read from source at base d9be915f40, not re-run. No clause changed", "ref": "#35772" } ] }, { diff --git a/packages/plugins/plugin-approvals/src/sys-approval-request.object.ts b/packages/plugins/plugin-approvals/src/sys-approval-request.object.ts index 8019a9aee5b..2abdb335b86 100644 --- a/packages/plugins/plugin-approvals/src/sys-approval-request.object.ts +++ b/packages/plugins/plugin-approvals/src/sys-approval-request.object.ts @@ -704,7 +704,9 @@ export const SysApprovalRequest = ObjectSchema.create({ // `validateActionParams`), which counts a blank or whitespace-only // string as missing: the action door, MCP `run_action` and the console's // param dialog all refuse a reject without one, before the target route - // is called. The target route itself does not judge the reason. + // is called. The target route judges it again: `ApprovalService.decide()` + // refuses a reject without a non-blank string reason, so a caller that + // skips this action is held to the same rule. params: [ { name: 'comment', label: 'Comment', type: 'textarea', required: true }, { name: 'attachments', label: 'Attachments', type: 'file', multiple: true, required: false }, diff --git a/packages/spec/src/contracts/approval-service.ts b/packages/spec/src/contracts/approval-service.ts index 9b705f01f8b..7600f992270 100644 --- a/packages/spec/src/contracts/approval-service.ts +++ b/packages/spec/src/contracts/approval-service.ts @@ -644,6 +644,12 @@ export interface ApprovalActionRow { export interface ApprovalDecisionInput { decision: 'approve' | 'reject'; actorId: string; + /** + * The decision's comment, recorded on the `sys_approval_action` audit row. + * A REJECT must carry it as a non-blank string — its reason; `decide()` + * refuses a reject whose comment is missing, blank or not a string with + * `400 VALIDATION_ERROR` before any write. An approve keeps it optional. + */ comment?: string; /** * File references (already stored via the storage service) to attach to this @@ -1090,6 +1096,11 @@ export interface IApprovalService { * Record a decision on a node-driven request. Honours the node's * `unanimous` behaviour, finalises the request when satisfied, and resumes * the owning flow run down the matching `approve` / `reject` edge. + * + * A reject carries its reason: one whose `comment` is missing, blank or not + * a string is refused with `400 VALIDATION_ERROR` before anything is read + * or written ({@link ApprovalDecisionInput.comment}). An approve keeps its + * comment optional. */ decide(requestId: string, input: ApprovalDecisionInput, context: ExecutionContext): Promise; diff --git a/skills/objectstack-automation/references/state-machines-and-approvals.md b/skills/objectstack-automation/references/state-machines-and-approvals.md index 825ace0e213..3277c7f9b20 100644 --- a/skills/objectstack-automation/references/state-machines-and-approvals.md +++ b/skills/objectstack-automation/references/state-machines-and-approvals.md @@ -171,9 +171,10 @@ Three pieces author it: ### Recording a decision A decision is recorded through `ApprovalService.decide()` (or the REST routes -`POST /api/v1/approvals/requests/:id/approve` | `/reject`). That finalizes the -`sys_approval_request` and **resumes** the suspended run down the matching -branch — you never resume the flow by hand, and you *cannot*: the +`POST /api/v1/approvals/requests/:id/approve` | `/reject`), a reject always +with a non-blank `comment`, its reason (else `400 VALIDATION_ERROR`). That +finalizes the `sys_approval_request` and **resumes** the suspended run down the +matching branch — you never resume the flow by hand, and you *cannot*: the `approval` node declares `resumeAuthority: 'service'`, so `POST /api/v1/automation/:name/runs/:runId/resume` answers **403** for a run parked on one (including via a `subflow` pause) and changes nothing. @@ -182,10 +183,8 @@ A decision may also carry **structured outputs** (`{ outputs: { … } }` in the decide body) when the node declares the keys in `decisionOutputs` — the author declares keys, approvers only fill values. Accepted outputs resume the run as `.` flow variables, so a LATER node reads them as -`vars..` — this is how "the previous approver picks the next -step's approvers" works without writing to a record field (see Dynamic -approvers below). A decision carrying an undeclared key is rejected; -`decision` / `requestId` are reserved. A declaration marked +`vars..` (Dynamic approvers ② below). A decision carrying an +undeclared key is rejected; `decision` / `requestId` are reserved. A declaration marked `required: true` must carry a non-blank value to **approve** (never to reject) — enforced before any write, with no elevation bypass, so the run cannot resume past the node with the key a later `expression` approver reads From 1b1cc7fc97a963c8bb4fcfa8cc33803c56414fef Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:43:07 +0000 Subject: [PATCH 2/2] docs(approvals): move the skill reference sentence to its own skills card The skills/ edit and its changeset line leave this product-lane PR; the skill reference is carried by a domain:skills card. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2 --- .changeset/35772-reject-reason-required-texts.md | 5 ++--- .../references/state-machines-and-approvals.md | 13 +++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.changeset/35772-reject-reason-required-texts.md b/.changeset/35772-reject-reason-required-texts.md index 3efdee08940..df80a90f0b6 100644 --- a/.changeset/35772-reject-reason-required-texts.md +++ b/.changeset/35772-reject-reason-required-texts.md @@ -1,12 +1,11 @@ --- -'@objectstack/skills': patch '@objectstack/spec': patch '@objectstack/plugin-approvals': patch --- -docs(approvals): a reject reason is required at every human door — the contract docblock, the docs, the platform checklist and the skill reference say so +docs(approvals): a reject reason is required at every human door — the contract docblock, the docs and the platform checklist say so Clause-②: no Metadata-protocol: none -Text only; no behaviour changes. `ApprovalService.decide()` already refuses a reject whose `comment` is missing, blank or not a string with `400 VALIDATION_ERROR` before any write, and an approve keeps its comment optional. The texts that still called the reason optional now state that rule: the `ApprovalDecisionInput.comment` and `IApprovalService.decide` docblocks in `@objectstack/spec` (the type is unchanged: `comment` stays optional in the interface, because an approve may omit it), the `approval_reject` action's source comment in `@objectstack/plugin-approvals`, which said the target route does not judge the reason, and `references/state-machines-and-approvals.md` § Recording a decision in `@objectstack/skills`. The skill reference pays for its new sentence in place: the outputs paragraph's restatement of how a previous approver picks the next node's approvers is replaced by a pointer to the Dynamic approvers example that shows it. +Text only; no behaviour changes. `ApprovalService.decide()` already refuses a reject whose `comment` is missing, blank or not a string with `400 VALIDATION_ERROR` before any write, and an approve keeps its comment optional. The texts that still called the reason optional now state that rule: the `ApprovalDecisionInput.comment` and `IApprovalService.decide` docblocks in `@objectstack/spec` (the type is unchanged: `comment` stays optional in the interface, because an approve may omit it), and the `approval_reject` action's source comment in `@objectstack/plugin-approvals`, which said the target route does not judge the reason. diff --git a/skills/objectstack-automation/references/state-machines-and-approvals.md b/skills/objectstack-automation/references/state-machines-and-approvals.md index 3277c7f9b20..825ace0e213 100644 --- a/skills/objectstack-automation/references/state-machines-and-approvals.md +++ b/skills/objectstack-automation/references/state-machines-and-approvals.md @@ -171,10 +171,9 @@ Three pieces author it: ### Recording a decision A decision is recorded through `ApprovalService.decide()` (or the REST routes -`POST /api/v1/approvals/requests/:id/approve` | `/reject`), a reject always -with a non-blank `comment`, its reason (else `400 VALIDATION_ERROR`). That -finalizes the `sys_approval_request` and **resumes** the suspended run down the -matching branch — you never resume the flow by hand, and you *cannot*: the +`POST /api/v1/approvals/requests/:id/approve` | `/reject`). That finalizes the +`sys_approval_request` and **resumes** the suspended run down the matching +branch — you never resume the flow by hand, and you *cannot*: the `approval` node declares `resumeAuthority: 'service'`, so `POST /api/v1/automation/:name/runs/:runId/resume` answers **403** for a run parked on one (including via a `subflow` pause) and changes nothing. @@ -183,8 +182,10 @@ A decision may also carry **structured outputs** (`{ outputs: { … } }` in the decide body) when the node declares the keys in `decisionOutputs` — the author declares keys, approvers only fill values. Accepted outputs resume the run as `.` flow variables, so a LATER node reads them as -`vars..` (Dynamic approvers ② below). A decision carrying an -undeclared key is rejected; `decision` / `requestId` are reserved. A declaration marked +`vars..` — this is how "the previous approver picks the next +step's approvers" works without writing to a record field (see Dynamic +approvers below). A decision carrying an undeclared key is rejected; +`decision` / `requestId` are reserved. A declaration marked `required: true` must carry a non-blank value to **approve** (never to reject) — enforced before any write, with no elevation bypass, so the run cannot resume past the node with the key a later `expression` approver reads