diff --git a/.changeset/34839-approvals-viewer-block-descriptions.md b/.changeset/34839-approvals-viewer-block-descriptions.md new file mode 100644 index 00000000000..34a608ff3c4 --- /dev/null +++ b/.changeset/34839-approvals-viewer-block-descriptions.md @@ -0,0 +1,13 @@ +--- +'@objectstack/skills': patch +'@objectstack/platform-objects': patch +--- + +docs(skills): the automation skill says who an `admin_rescue` request opens on + +Clause-②: no +Metadata-protocol: none + +objectstack-automation's `references/state-machines-and-approvals.md` no longer says that under `onEmptyApprovers: 'admin_rescue'` "only a privileged admin can act via Reassign". The row now says what the runtime does: the request opens on the organization's administrators. Nothing else in the row changes. + +No runtime change. In-code descriptions (one of them a comment that ships in `@objectstack/platform-objects`' build output) of the approval request's served `viewer` block now name its four leaves (`can_act`, `is_submitter`, `can_override`, `can_override_approve`) and say that Approve reads `can_override_approve` while Reject, Reassign and Recall read `can_override`. diff --git a/docs/qa/platform-checklist/areas/approvals.json b/docs/qa/platform-checklist/areas/approvals.json index 6dcc549e415..b85709aa85d 100644 --- a/docs/qa/platform-checklist/areas/approvals.json +++ b/docs/qa/platform-checklist/areas/approvals.json @@ -325,7 +325,7 @@ "title": "Inbox actions are metadata-driven and gated by the viewer's relationship", "since": "v16", "status": "active", - "revision": 9, + "revision": 10, "priority": "P1", "surface": "browser", "personas": ["an approver who is NOT the submitter and NOT an override actor (no platform-admin or tenant-admin standing), so record.viewer.can_override is false on the request", "the dev admin: the submitter of the invoice request (the own-request case) and an OVERRIDE actor (a platform admin — record.viewer.can_override is true on any PENDING request), for the override half of clause 2"], @@ -341,8 +341,8 @@ "boot the showcase on its own port and DB (dogfood §0); sign in as the dev admin for the own-request case and the override half, and as the non-override approver (personas) for the other-submitter case", "other-submitter case, as the NON-override approver: reach the inbox the way a user does — the Approvals entry in the account app's Inbox group (/_console/apps/com.objectstack.account/component/approvals/inbox), NOT the bare /system/approvals deep link (#7234) — open the other-submitter request from the My Pending tab (待我审批 on zh-CN) by its Request cell, which opens the served sys_approval_request record page (objectui#12484 retired the drawer; the Record cell opens the subject record instead, whose page renders the decision bar too — approvals.record-page-decisions — so name the cell you clicked); screenshot, then read the rendered action set from the request page's DOM. Then open the SAME pending request as the dev admin and read its action set too (the override half)", "own-request case: open the invoice request from the Submitted by me tab (我发起的 on zh-CN) by its Request cell; screenshot, then read its action set", - "GET /api/v1/approvals/requests/:id for both requests, as each viewer, and record the server-computed viewer flags (can_act, is_submitter, can_override) and status", - "cross-check each rendered action against the declared metadata actions on sys_approval_request (visibility expressions gate on record.viewer.can_act / record.viewer.is_submitter / record.status)", + "GET /api/v1/approvals/requests/:id for both requests, as each viewer, and record the server-computed viewer flags (can_act, is_submitter, can_override, can_override_approve) and status", + "cross-check each rendered action against the declared metadata actions on sys_approval_request (visibility expressions gate on record.viewer.can_act / record.viewer.is_submitter / record.viewer.can_override / record.viewer.can_override_approve / record.status)", "spot-check an approver action: approve EXP-DEMO from its request page; capture the POST and re-read the request", "spot-check a submitter action: send a reminder on the invoice request; capture the action-door POST /api/v1/actions/sys_approval_request/approval_remind (forwarded to /api/v1/approvals/requests/:id/remind)", "GET /:id/actions on both requests and record the appended timeline rows" @@ -363,7 +363,7 @@ { "clause": "the rendered gating mirrors the server's viewer flags, which are computed on the request read — not a client heuristic", "oracle": "api", - "verify": "for both requests and every viewer, the API's viewer flags (can_act / is_submitter / can_override) predict exactly which action groups rendered; declared visibility expressions on sys_approval_request gate on those flags plus status", + "verify": "for both requests and every viewer, the API's viewer flags (can_act / is_submitter / can_override / can_override_approve) predict exactly which action groups rendered; declared visibility expressions on sys_approval_request gate on those flags plus status. The override arm of Approve reads can_override_approve; the override arm of Reject, Reassign and Recall reads can_override", "evidence": "request reads + the rendered sets" }, { @@ -413,6 +413,12 @@ "date": "2026-11-14", "change": "acceptance[1].verify, acceptance[3].verify and steps[6] re-pointed (stale spec, card #33332; QA runs #33048 comment 6846028996, #33088 comment 6850413952, #33093 comment 6850899929). acceptance[1]: 'Override Recall' is drawn only for a viewer with can_act false and can_override true (approvalOverride.ts isOverrideOnlyViewer); on stock EXP-2001 also routes the admin's manager group, so the admin sees plain 'Recall' until that slot is spent or reassigned, which the verify now says, as fixtures.requires[2] already did for EXP-DEMO. acceptance[3] and steps[6]: a declared type: 'api' click posts the action door /api/v1/actions/sys_approval_request/approval_, which forwards to the approvals route (apiActionDoor.ts, objectstack#27611), so the network literal is the action-door URL. No clause changed. Read from source at base fca5f89c", "ref": "#33332" + }, + { + "revision": 10, + "date": "2026-11-18", + "change": "steps[3], steps[4] and acceptance[2].verify name the four leaves of the served viewer block. They named three, or two. ApprovalService.attachViewers also serves can_override_approve, which is can_override minus an approval of the viewer's own request, and sys-approval-request.object.ts reads it in Approve's override arm, where Reject, Reassign and Recall read can_override. No clause changed. Read from source at base 367e324eeb, not re-run", + "ref": "#34839" } ] }, @@ -421,7 +427,7 @@ "title": "A submitter who is not an approver sees no approver buttons", "since": "v16", "status": "active", - "revision": 7, + "revision": 8, "priority": "P1", "surface": "browser", "personas": ["submitter holding NO approver position on their own pending request"], @@ -447,7 +453,7 @@ { "clause": "the request page's decision panel omits every approver lever for the submitter while still rendering the submitter-side ones (Send reminder / Recall)", "oracle": "screenshot", - "verify": "decision-panel screenshot as the submitter on her own pending request: no Approve, Reject, Reassign, Send back or Request info (each is visible only on record.viewer.can_act, Approve / Reject / Reassign also on record.viewer.can_override), and Send reminder plus Recall present (approval_remind is visible on a pending request whose record.viewer.is_submitter is true; approval_recall on a pending or returned one). The panel draws sys_approval_request's own declared actions at record_section by those visible predicates (packages/plugins/plugin-approvals/src/sys-approval-request.object.ts)", + "verify": "decision-panel screenshot as the submitter on her own pending request: no Approve, Reject, Reassign, Send back or Request info (each is visible only on record.viewer.can_act; Reject / Reassign also on record.viewer.can_override, and Approve also on record.viewer.can_override_approve), and Send reminder plus Recall present (approval_remind is visible on a pending request whose record.viewer.is_submitter is true; approval_recall on a pending or returned one). The panel draws sys_approval_request's own declared actions at record_section by those visible predicates (packages/plugins/plugin-approvals/src/sys-approval-request.object.ts)", "evidence": "decision-panel screenshot" }, { @@ -485,7 +491,8 @@ { "revision": 4, "date": "2026-08-11", "change": "knownGaps records the better-auth issuer=local:credential provisioning detail — with it, Mei's sign-in is provisionable at runtime and this item's standing fixture blocker becomes payable instead of permanent", "ref": "#7530" }, { "revision": 5, "date": "2026-08-18", "change": "UNBLOCKED. The showcase provisions Mei's better-auth credential account at boot, so the submitter persona this item is built around is a real, stock login and `blocked(fixture)` is removed. knownGaps rewritten as closed-by-fixture rather than deleted, and the one gap that is NOT closed (stock requests route to the admin, so the persona choice is still load-bearing) is restated so it does not get read as closed by association", "ref": "#9308" }, { "revision": 6, "date": "2026-09-19", "change": "same re-anchoring as the sibling items: the retired plugin-auth backfill citation is replaced by the retirement's migration entry in packages/spec, the reason is kept, and the two falsified clauses are withdrawn — the showcase no longer derives the issuer from the dev admin's row, and the dogfood test no longer pins an issuer (it pins the account under the key sign-in resolves on and asserts nothing still writes the retired field)", "ref": "#17453" }, - { "revision": 7, "date": "2026-10-28", "change": "steps[2] and acceptance[0] read the request page, not the retired request drawer. The inbox opens a request by navigating to its served record page, /apps/APP/sys_approval_request/record/ID (ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx requestPagePath); objectui#12484 deleted the inbox's side sheet (ruling C on objectui#12438); it came into this tree with the ui/ import, PR #25825. That page's decision panel (record:approval_decision, packages/plugins/plugin-approvals/src/sys-approval-request.page.ts) draws sys_approval_request's declared actions by their visible predicates over record.viewer (sys-approval-request.object.ts), so the clause now names the levers by their declared labels: Send reminder and Recall for the submitter, none of the five approver levers. The assertion is unchanged: no approver lever, the submitter's two present. Read from source at base f2fdac5d, not driven live. Wave anchor #25807, slice C; lead from slice B's report 6457925443", "ref": "#25807" } + { "revision": 7, "date": "2026-10-28", "change": "steps[2] and acceptance[0] read the request page, not the retired request drawer. The inbox opens a request by navigating to its served record page, /apps/APP/sys_approval_request/record/ID (ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx requestPagePath); objectui#12484 deleted the inbox's side sheet (ruling C on objectui#12438); it came into this tree with the ui/ import, PR #25825. That page's decision panel (record:approval_decision, packages/plugins/plugin-approvals/src/sys-approval-request.page.ts) draws sys_approval_request's declared actions by their visible predicates over record.viewer (sys-approval-request.object.ts), so the clause now names the levers by their declared labels: Send reminder and Recall for the submitter, none of the five approver levers. The assertion is unchanged: no approver lever, the submitter's two present. Read from source at base f2fdac5d, not driven live. Wave anchor #25807, slice C; lead from slice B's report 6457925443", "ref": "#25807" }, + { "revision": 8, "date": "2026-11-18", "change": "acceptance[0].verify said Approve / Reject / Reassign are also visible on record.viewer.can_override. Approve's override arm reads record.viewer.can_override_approve (can_override minus an approval of the viewer's own request); Reject and Reassign keep reading can_override (sys-approval-request.object.ts). No clause changed. Read from source at base 367e324eeb, not re-run", "ref": "#34839" } ] }, { @@ -995,7 +1002,7 @@ "title": "Approve/Reject render on the record page from sys_approval_request's declared actions; Reject fires after ONE dialog; a locking approval hides inline edit", "since": "v16", "status": "active", - "revision": 8, + "revision": 9, "priority": "P2", "surface": "browser", "personas": ["dev admin (holds the showcase_manager position, so showcase_budget_approval's manager_review routes to them — a pending approver standing on the record page)"], @@ -1016,7 +1023,7 @@ "approve path: PATCH another project's budget to e.g. 200000; on its record page click Approve → one dialog (titled Approve, described 'Approve this request? Your approval is recorded, and the request moves on once this step has the approvals it requires.', optional Comment and Attachments) → Confirm → POST /api/v1/actions/sys_approval_request/approval_approve (forwarded to /api/v1/approvals/requests/:id/approve, as step 6) → re-read (status=approved; at or under 500000, needs_exec ends the run at approved)", "lock contrast: PATCH a third project's budget above 500000 (e.g. 600000) and approve its manager_review from the record page as in step 7 — needs_exec routes the run to exec_review (position 'showcase_exec', the admin again; lockRecord:true), a NEW pending request whose row reads lock_record: true; once the page re-reads (the decision's refresh, or a reload), screenshot — the header's Edit button stays RENDERED but DISABLED (disabled, not hidden, so the user sees the affordance is off: RecordDetailView.tsx, framework#3794), the inline-edit pencils are gone (approvalLocked, from resolveApprovalLock over recordLockedByApproval of the pending request → InlineEditProvider canEdit false), and the approval band reads 'Locked for approval' (amber, a lock icon; detail.lockedByApproval)", "both-sides gate, closed side: open the step-8 project's record page (its exec_review is pending) as a member who can READ the project but is not on the slate, did not submit and holds no override — e.g. a contributor-bound member (the search:qa-contributor-bound-member recipe; RUNNER.md's self-registration entry says how to mint one). Capture the member's own GET /api/v1/approvals/requests?object=showcase_project&recordId=:id: it serves no row for this record (the approvals door serves a request to its participants and the override actor, and the record-reader tier is off: no showcase object declares enable.approvalsVisibleToReaders), so the page draws no declared decision action at all. Then forge the decision: as the member, POST /api/v1/approvals/requests/:id/approve with the id from the admin's read → 404, code REQUEST_NOT_FOUND, the answer an id naming no request gets (the member cannot read the request, and every door that acts on one answers such a caller as if it did not exist), and the request re-reads still pending. 403 FORBIDDEN ('is not a pending approver') is the answer to a caller who CAN read the request and holds no slot, which this member is not. ⛔ Not the dev admin: the admin holds the override (step 10), so the admin cannot prove the gate's closed side", - "override contrast (the admin off the slate): on a pending manager_review (PATCH a fourth project to e.g. 200000; fixtures.requires[0] says which projects take that budget), Reassign the step to another user through the bar's New approver picker — e.g. the seeded Ada Auditor (demo) persona (examples/app-showcase/src/security/demo-personas.ts); click the person's NAME text in the option row, since the row also carries a mailto link and a copy button that a centre click can land on instead of selecting — so the request waits on that user and the admin holds no slot. Re-read the row (viewer.can_act false, viewer.can_override true) and screenshot the bar. The record page FOLDS the override levers for an override-only viewer (RecordDetailView.tsx passes foldOverrides; DeclaredActionsBar.tsx, objectstack#25877). The bar shows a 'Pending · Waiting on …' status line naming the approver the override would bypass, Reply as a plain button (the admin holds it as the submitter), and ONE amber menu trigger, a shield plus an overflow glyph, data-testid declared-actions-override-menu, labelled 'Admin override'. Open that menu and screenshot it. It lists 'Override Approve', 'Override Reject' and 'Override Reassign' (data-override-decision='true'), and Recall under its plain label: the admin holds Recall as the submitter, so it carries no override framing, yet it folds with the rest because its declared visible gate ORs in can_override. Send back and Request info are gone (their predicate reads can_act alone). That is the override arm of the same declared predicates, not the gate failing" + "override contrast (the admin off the slate): on a pending manager_review (PATCH a fourth project to e.g. 200000; fixtures.requires[0] says which projects take that budget), Reassign the step to another user through the bar's New approver picker — e.g. the seeded Ada Auditor (demo) persona (examples/app-showcase/src/security/demo-personas.ts); click the person's NAME text in the option row, since the row also carries a mailto link and a copy button that a centre click can land on instead of selecting — so the request waits on that user and the admin holds no slot. Re-read the row (viewer.can_act false, viewer.can_override true, viewer.can_override_approve false: the admin submitted this request, and the override never approves its actor's own request) and screenshot the bar. The record page FOLDS the override levers for an override-only viewer (RecordDetailView.tsx passes foldOverrides; DeclaredActionsBar.tsx, objectstack#25877). The bar shows a 'Pending · Waiting on …' status line naming the approver the override would bypass, Reply as a plain button (the admin holds it as the submitter), and ONE amber menu trigger, a shield plus an overflow glyph, data-testid declared-actions-override-menu, labelled 'Admin override'. Open that menu and screenshot it. It lists 'Override Reject' and 'Override Reassign' (data-override-decision='true'), and Recall under its plain label: the admin holds Recall as the submitter, so it carries no override framing, yet it folds with the rest because its declared visible gate ORs in can_override. Approve is absent: its override arm reads can_override_approve, which is false here. Send back and Request info are gone (their predicate reads can_act alone). That is the override arm of the same declared predicates, not the gate failing" ], "acceptance": [ { @@ -1046,7 +1053,7 @@ { "clause": "the decision actions are gated by the SERVER's viewer block, not by a client check: a viewer who is not a pending approver, not the submitter and holds no override is offered no decision action, and the server refuses the decision a forged request makes: a non-participant who cannot read the request gets 404 REQUEST_NOT_FOUND (its existence never leaks) and a reader who holds no slot gets 403 FORBIDDEN, the request staying pending either way; an organization administrator off the slate is offered the OVERRIDE framing of the levers the override arm admits, which is a different control, not this gate failing", "oracle": "api", - "verify": "as the member (step 9): the member's GET /api/v1/approvals/requests?object=showcase_project&recordId=:id serves no row for the record; after a screenshot confirms the page rendered, its DOM holds no declared-action-* button; a forged POST /api/v1/approvals/requests/:id/approve answers 404 with code REQUEST_NOT_FOUND (packages/plugins/plugin-approvals/src/approval-service.ts#refuseUnreadableRequest, asked before the slate), and the request re-reads pending. A 403 FORBIDDEN here means the member could read the request: record which tier admitted them, since no showcase object declares enable.approvalsVisibleToReaders. As the admin off the slate (step 10): the row's viewer block reads can_act false and can_override true, and the bar folds the override levers into the 'Admin override' menu (declared-actions-override-menu). Opened, the menu lists Override Approve, Override Reject and Override Reassign (data-override-decision='true') and a plain Recall, while Reply stays an inline button and Send back and Request info are absent. Record it separately", + "verify": "as the member (step 9): the member's GET /api/v1/approvals/requests?object=showcase_project&recordId=:id serves no row for the record; after a screenshot confirms the page rendered, its DOM holds no declared-action-* button; a forged POST /api/v1/approvals/requests/:id/approve answers 404 with code REQUEST_NOT_FOUND (packages/plugins/plugin-approvals/src/approval-service.ts#refuseUnreadableRequest, asked before the slate), and the request re-reads pending. A 403 FORBIDDEN here means the member could read the request: record which tier admitted them, since no showcase object declares enable.approvalsVisibleToReaders. As the admin off the slate (step 10): the row's viewer block reads can_act false, can_override true and can_override_approve false (the admin submitted the request), and the bar folds the override levers into the 'Admin override' menu (declared-actions-override-menu). Opened, the menu lists Override Reject and Override Reassign (data-override-decision='true') and a plain Recall, and no Approve, while Reply stays an inline button and Send back and Request info are absent. Record it separately", "evidence": "the member's approvals read + the record-page screenshot and its declared-action DOM list + the forged POST's 404 body; the admin's off-slate row read + the bar and the opened override menu screenshots" } ], @@ -1061,7 +1068,7 @@ "objectui packages/app-shell/src/views/DeclaredActionsBar.tsx (blob f27b4ab0efff): each declared action's visible predicate evaluated fail-closed against the row's viewer block, the declared variant mapped (primary → filled, danger → destructive), the override framing (isOverrideDecision in utils/approvalOverride.ts: 'Override' plus the label, amber outline, data-override-decision) and the data-testid declared-action- plus the action name; + hooks/useRecordApprovals.ts (blob b65a91f4a9a4): the record's read, GET /api/v1/approvals/requests?object=…&recordId=… then GET …/requests/:id, with no client-side canDecide; + hooks/useConsoleActionRuntime.tsx: the param dialog takes its title from the action's label and its description from the declared description", "objectui packages/app-shell/src/views/RecordDetailView.approvalDeclaredActions.test.tsx (objectui#3055, blob 9519ae70f743 at the console pin cf153eb2e535: the record page runs sys_approval_request's declared decision actions, and 'folds a declared decision output into the nested `outputs` body' asserts that a decision's comment and declared outputs reach the POST to the request) + packages/plugins/plugin-approvals/src/sys-approval-request.object.test.ts ('the confirm question rides `description`, not `confirmText`, so one decision opens one dialog (#7278)'). Between them they hold what the deleted RecordDetailView.approvalDecisionActions.test.tsx pinned, the decision params and one dialog per decision; objectui 99782f961 deleted that file before both console pins", "examples/app-showcase/src/automation/flows/index.ts#BudgetApprovalFlow (BudgetApprovalFlow — manager_review lockRecord:false / exec_review lockRecord:true on showcase_project)", - "packages/plugins/plugin-approvals/src/sys-approval-request.object.ts#approval_reject (the declared actions: approval_approve 'primary' and approval_reject 'danger', each with optional comment and attachments params and its confirm question as description, never confirmText, #7278; approval_reassign, approval_send_back, approval_request_info, approval_remind, approval_recall, approval_resubmit and approval_comment; all at record_section, every visible predicate over record.viewer, the attachedOnRead block) + packages/plugins/plugin-approvals/src/approval-service.ts#attachViewers (can_act: pending and the caller takes a slot; is_submitter; can_override: pending and isOverrideActor)", + "packages/plugins/plugin-approvals/src/sys-approval-request.object.ts#approval_reject (the declared actions: approval_approve 'primary' and approval_reject 'danger', each with optional comment and attachments params and its confirm question as description, never confirmText, #7278; approval_reassign, approval_send_back, approval_request_info, approval_remind, approval_recall, approval_resubmit and approval_comment; all at record_section, every visible predicate over record.viewer, the attachedOnRead block) + packages/plugins/plugin-approvals/src/approval-service.ts#attachViewers (can_act: pending and the caller takes a slot; is_submitter; can_override: pending and isOverrideActor; can_override_approve: can_override and the viewer did not submit the request)", "packages/plugins/plugin-approvals/src/request-read-gate.ts (header: the approvals door serves a request to its participants and the override actor, and to a record reader only where the object declares enable.approvalsVisibleToReaders, which no showcase object does) + packages/plugins/plugin-approvals/src/approval-service.ts#refuseUnreadableRequest (every door that acts on a request, decide included, answers a caller who may not READ it REQUEST_NOT_FOUND, exactly as a missing id, answered 404 by packages/rest/src/approvals-routes.ts) + packages/plugins/plugin-approvals/src/approval-service.ts#decide (a reader who takes no slot and holds no override: FORBIDDEN, answered 403)" ], "history": [ @@ -1072,7 +1079,8 @@ { "revision": 5, "date": "2026-10-31", "change": "Two findings of QA run #27441. First, steps[9] and acceptance[4]: for the override-only admin, who is also the submitter, the record page folds the override levers into one 'Admin override' menu (data-testid declared-actions-override-menu; RecordDetailView.tsx foldOverrides, DeclaredActionsBar.tsx, objectstack#25877). The menu holds Override Approve, Override Reject, Override Reassign and a plain Recall. The bar keeps the status line and Reply. The items said the three Override buttons rendered in the bar. Second, steps[3], steps[7] and acceptance[3]: under a locking approval the header Edit stays rendered but disabled (framework#3794) while the inline pencils are hidden, and the band text is named: 'Locked for approval' locked, 'In approval · editable' not locked (DetailView.tsx). The items said the affordances were absent. acceptance[3] is stronger, not weaker: a hidden Edit now fails it. Read from source at base 22ce3d13. Wave anchor #27377, wave-3 accuracy slice S5 (#28339); findings parked in anchor comment 6490438726", "ref": "#27441" }, { "revision": 6, "date": "2026-11-14", "change": "acceptance[4] (clause, verify, evidence), steps[8] and source[5] re-pointed: the forged decision of a member who cannot read the request answers 404 REQUEST_NOT_FOUND, not 403 FORBIDDEN (stale spec, QA run #33058 acceptance[4], card #33060). ApprovalService.refuseUnreadableRequest (packages/plugins/plugin-approvals/src/approval-service.ts) answers a caller who may not READ a request exactly as a missing id, before any slate check, so the request's existence never leaks; FORBIDDEN is for a reader who holds no slot. The step's contributor-bound member reads the project but not its request (the approvals door serves participants and the override actor, and no showcase object declares enable.approvalsVisibleToReaders), so QA read 404 on /approve, /reject and the action door with the request still pending. The rest of the clause held and is unchanged: no row for the member, no decision button, and the admin's override folding. negative[2] is unchanged: a viewer whose row carries a viewer block can read the request, so its forged POST is the 403 case. Read at base e540baf8", "ref": "#33060" }, { "revision": 7, "date": "2026-11-14", "change": "steps[2], [5], [6], [9], fixtures.requires[0], acceptance[1].verify and acceptance[2] (clause, verify) re-pointed (stale spec, card #33332; QA runs #33058 comment 6846283471, #33093 comment 6850899929, #33094 comment 6852480973). The bar's decision posts the action door /api/v1/actions/sys_approval_request/approval_reject or approval_approve with recordId = the request id and the comment under params.comment, which forwards to the approvals route (apiActionDoor.ts, objectstack#27611); the item named the approvals route as the wire. On first load the approvals arrive in POST /api/v1/data/showcase_project/:id/page (seedRecordApprovals, objectstack#27627), and the GET by object and recordId fires only on the refresh. The budget PATCHes must pass the project's 120% spend rule, which refuses 200000 on the seeded Data Platform project. acceptance[2]'s clause names the action door where it named the approvals route; what it requires (one POST for the request's id, the new status, the comment on the action row) is unchanged. Read from source at base fca5f89c", "ref": "#33332" }, - { "revision": 8, "date": "2026-11-15", "change": "steps[9] says to click the name text in the New approver option row, which also carries a mailto link and a copy button (QA run #33853, comment 6894307378; ledger 6896511848 of #33761 row 68). No clause changed. Read at base bc6b7ffd", "ref": "#34016" } + { "revision": 8, "date": "2026-11-15", "change": "steps[9] says to click the name text in the New approver option row, which also carries a mailto link and a copy button (QA run #33853, comment 6894307378; ledger 6896511848 of #33761 row 68). No clause changed. Read at base bc6b7ffd", "ref": "#34016" }, + { "revision": 9, "date": "2026-11-18", "change": "steps[9], acceptance[4].verify and source[4] re-pointed to the four-leaf viewer block. The admin of this item submitted the request, so off the slate the row reads can_override true and can_override_approve false: ApprovalService.attachViewers serves can_override_approve as can_override minus an approval of the viewer's own request, and approval_approve's override arm reads that leaf (sys-approval-request.object.ts), so the folded menu lists Override Reject, Override Reassign and the plain Recall, and no Approve. The text listed Override Approve too. No clause changed. Read from source at base 367e324eeb, not re-run in a browser", "ref": "#34839" } ] }, { diff --git a/packages/platform-objects/src/apps/account.app.ts b/packages/platform-objects/src/apps/account.app.ts index 39d3765318c..db436862ff3 100644 --- a/packages/platform-objects/src/apps/account.app.ts +++ b/packages/platform-objects/src/apps/account.app.ts @@ -110,14 +110,17 @@ export const ACCOUNT_APP: App = { { // #7234 — the DESTINATION is the Approvals Inbox component, not the // raw `sys_approval_request` grid. The engine-owned table has no - // decision actions for an end user: all eight are gated on - // `record.viewer.can_act || record.viewer.can_override`, and the - // `viewer` block is attached ONLY on the approvals REST path - // (`approval-service.ts`, `attachViewers()`), never on the generic - // data API. So the object route could only ever render a read-only - // list of rows an approver cannot act on. The inbox component calls - // the approvals REST path and therefore carries the decision - // actions, business vocabulary, node progress and drawer. + // decision actions for an end user: every one is gated on a leaf + // of the served `record.viewer` block (`can_act`, `is_submitter`, + // `can_override`, `can_override_approve`; the override arm reads + // `can_override_approve` on Approve and `can_override` on Reject, + // Reassign and Recall), and the `viewer` block is attached ONLY on + // the approvals REST path (`approval-service.ts`, + // `attachViewers()`), never on the generic data API. So the object + // route could only ever render a read-only list of rows an approver + // cannot act on. The inbox component calls the approvals REST path + // and therefore carries the decision actions, business vocabulary, + // node progress and drawer. // // The ref is the component-registry KEY, never a console path — that // indirection is the whole contract (objectui#2763; the key is diff --git a/packages/plugins/plugin-approvals/src/approval-override-audit.test.ts b/packages/plugins/plugin-approvals/src/approval-override-audit.test.ts index 2dd00d5df96..306b719ed6a 100644 --- a/packages/plugins/plugin-approvals/src/approval-override-audit.test.ts +++ b/packages/plugins/plugin-approvals/src/approval-override-audit.test.ts @@ -322,7 +322,10 @@ describe('the override never approves its actor\'s own request', () => { // A store whose collation folds letter case (MySQL's default) resolves a // differently-cased email to the submitter's account, and the decision door // admits a named email in any case: the comparison must not be narrower. - const find = engine.find.bind(engine); + // The double is rebuilt before every case; the original `find` is put back + // here as well, so the case does not lean on that to stay contained. + const original = engine.find; + const find = original.bind(engine); engine.find = async (object: string, options?: any) => { const email = options?.where?.email; if (object === 'sys_user' && typeof email === 'string') { @@ -330,14 +333,18 @@ describe('the override never approves its actor\'s own request', () => { } return find(object, options); }; - const own = await open(ADMIN); - await expect(svc.reassign(own.id, { actorId: 'root', to: 'ROOT@Example.COM' }, ADMIN)) - .rejects.toThrow(/^VALIDATION_FAILED: cannot reassign to 'ROOT@Example.COM' — it names the request's submitter/); - const members = await open(SUBMITTER); - await expect(svc.reassign(members.id, { actorId: 'root2', to: 'U1@EXAMPLE.com' }, OTHER_ADMIN)) - .rejects.toThrow(/^VALIDATION_FAILED: cannot reassign to 'U1@EXAMPLE.com' — it names the request's submitter/); - expect((await svc.getRequest(own.id, SYS))!.pending_approvers).toEqual(['u9']); - expect((await svc.getRequest(members.id, SYS))!.pending_approvers).toEqual(['u9']); + try { + const own = await open(ADMIN); + await expect(svc.reassign(own.id, { actorId: 'root', to: 'ROOT@Example.COM' }, ADMIN)) + .rejects.toThrow(/^VALIDATION_FAILED: cannot reassign to 'ROOT@Example.COM' — it names the request's submitter/); + const members = await open(SUBMITTER); + await expect(svc.reassign(members.id, { actorId: 'root2', to: 'U1@EXAMPLE.com' }, OTHER_ADMIN)) + .rejects.toThrow(/^VALIDATION_FAILED: cannot reassign to 'U1@EXAMPLE.com' — it names the request's submitter/); + expect((await svc.getRequest(own.id, SYS))!.pending_approvers).toEqual(['u9']); + expect((await svc.getRequest(members.id, SYS))!.pending_approvers).toEqual(['u9']); + } finally { + engine.find = original; + } }); it('CONTROL: an administrator who did not submit the request still approves it through the override, audited', async () => { diff --git a/packages/spec/src/data/object.zod.ts b/packages/spec/src/data/object.zod.ts index 702e5191a7c..110122cbe81 100644 --- a/packages/spec/src/data/object.zod.ts +++ b/packages/spec/src/data/object.zod.ts @@ -2880,11 +2880,14 @@ const ATTACHED_ON_READ_NAME = /^[a-z_][a-z0-9_]*$/; * attaches to the rows it serves, computed per caller on read and never stored. * * The worked case is plugin-approvals: `ApprovalService.attachViewers` sets - * `viewer: { can_act, is_submitter, can_override }` on every `sys_approval_request` - * row it reads, from the CALLER's identity, and the object's own action - * predicates gate on `record.viewer.can_act`. Before this key nothing could - * declare such a block in a shape the build validator reads, so those - * predicates were refused as naming an undeclared field. + * `viewer: { can_act, is_submitter, can_override, can_override_approve }` on + * every `sys_approval_request` row it reads, from the CALLER's identity, and + * the object's own action predicates gate on those leaves: `can_act` for an + * approver's actions, `is_submitter` for the submitter's, and an override arm + * that reads `can_override_approve` on Approve and `can_override` on Reject, + * Reassign and Recall. Before this key nothing could declare such a block in + * a shape the build validator reads, so those predicates were refused as + * naming an undeclared field. * * ## Shape — a strict record of strict records * diff --git a/skills/objectstack-automation/references/state-machines-and-approvals.md b/skills/objectstack-automation/references/state-machines-and-approvals.md index 75fd9b065c3..c20afabc2b9 100644 --- a/skills/objectstack-automation/references/state-machines-and-approvals.md +++ b/skills/objectstack-automation/references/state-machines-and-approvals.md @@ -372,7 +372,7 @@ Object-hook `ctx` is a different vocabulary — see **objectstack-data** | `minApprovals` | Approvals required — total for `quorum`, per group for `per_group`. Omitted ⇒ ALL resolvable approvers under `quorum`, `1` per group; clamped at runtime so a misconfiguration can never deadlock | | `lockRecord` | Lock the triggering record from edits while pending. Default `true` | | `approvalStatusField` | Business-object field to mirror `pending`/`approved`/`rejected`/`returned`/`recalled` onto (should be readonly) | -| `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) | +| `onEmptyApprovers` | What an EMPTY resolved slate does: `admin_rescue` (default — request opens on the organization's administrators; 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) | | `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` | | `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* | | `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) | diff --git a/ui/packages/app-shell/src/utils/approvalOverride.ts b/ui/packages/app-shell/src/utils/approvalOverride.ts index 37ac56dd8b2..334679e2c78 100644 --- a/ui/packages/app-shell/src/utils/approvalOverride.ts +++ b/ui/packages/app-shell/src/utils/approvalOverride.ts @@ -34,8 +34,13 @@ * * So {@link actionAdmittedByOverride} reads the action's OWN declared `visible` * gate — the very predicate that admitted the button — and asks whether it ORs - * in `can_override`. The three core levers do - * (`… record.viewer.can_act == true || … record.viewer.can_override == true`); + * in an override leaf. The served viewer block carries two: `can_override`, + * which Reject, Reassign and Recall read + * (`… record.viewer.can_act == true || … record.viewer.can_override == true`), + * and `can_override_approve`, which Approve reads in the same position. That + * second leaf is `can_override` minus an approval of the viewer's own request, + * so the server never serves it `true` beside a `false` `can_override`. The + * test is a substring match on `can_override`, which both leaf names carry; * `approval_remind` / `approval_resubmit` gate on `is_submitter` alone and * never match. * @@ -56,7 +61,11 @@ * `=== false` / `=== true` rather than truthiness. */ -/** The viewer capability block `getRequest` / `listRequests` attach (framework#3310). */ +/** + * The viewer capability block `getRequest` / `listRequests` attach + * (framework#3310). The served block has a fourth leaf, `can_override_approve`; + * this module reads it only through the Approve action's declared predicate. + */ interface ViewerBlockLike { can_act?: unknown; is_submitter?: unknown; @@ -102,9 +111,10 @@ function predicateSource(predicate: unknown): string { } /** - * Does this declared action's own `visible` gate OR in `can_override`? + * Does this declared action's own `visible` gate OR in an override leaf — + * `can_override`, or Approve's `can_override_approve`? * - * True for exactly the actions the override flag can admit. Combined with + * True for exactly the actions the override can admit. Combined with * {@link isOverrideOnlyViewer} — where `can_act` is `false` — the flag is then * the ONLY term that can have made the button visible, so the button the viewer * is looking at is an override.