Skip to content

Commit 978bb2b

Browse files
committed
Merge the closing outcome on an approval that is over into the closed-state trunk (ADR-0162 item 8)
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5phEgfPTCgvPqh4ER2
2 parents d313098 + a9a90f3 commit 978bb2b

20 files changed

Lines changed: 1467 additions & 73 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/plugin-approvals': patch
3+
---
4+
5+
feat(approvals): on a field its object closes on, an approval's decision is written when the approval is over (ADR-0162 Execution item 8, the outcome)
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
Widened: `sys_approval_request` gains the engine-written, read-only datetime column `unjudged_since` (the mark) and an index on it; the `getRun` member of the automation surface the plugin declares (`ApprovalResumeSurface`) now also types the step log the engine already returns; the plugin's message catalog gains `approvalAbandonedTitle` and `approvalAbandonedBody` in all 11 locale packs, sent on the topic `approval.abandoned`.
11+
12+
What changes, only for an approval the check stamped when it opened (one with a step that can act on an object that declares `closedStates`):
13+
14+
- **The decision is held back.** Where the object closes on the step's mirror field at `approved` or `rejected`, neither decision is written onto the record when it is made. The request records it as before, and the field keeps `pending`. Every other status (`pending` as a request opens, `returned` at a send-back, what a recall leaves) is written as before.
15+
- **The mark.** Every decision on a request of such an approval sets `unjudged_since` in the update that records it, also where nothing is held back. It is cleared when the approval is judged, and when the approval's next request opens on the record. A recall, an administrator's override and the dead-run sweep clear it on the approval's earlier requests.
16+
- **The door judges the approval.** After a decision (by a person or the SLA clock), a send-back (and its auto-rejection), a resubmission, a recall and the continuation of a restored run, the plugin reads the run that carries the record and the approval's requests on it. Finished (the run completed, stopped after the last step, or is parked at a pause no step can follow): it writes the latest request's decision, as the person who decided it. In progress (a request is open, or the run is parked at a pause a step can follow): nothing. Ended between two steps (the run stopped on a node a step could still follow, a failure the flow routed at the top level ended it, or a later step could not open, whatever the flow did with that): the approval is abandoned. Cannot tell (the run is being advanced or cannot be read): nothing, and the mark stays.
17+
- **An abandoned approval.** The latest request is marked abandoned, the field is put back by item 7's order (never a closed value, and nothing where another approval's request is open on the record on the same field), a timeline line with no actor says why and what the record was put back to, and the submitter is told on `approval.abandoned` instead of `approval.approved` or `approval.rejected`. The decisions already made stay on their requests.
18+
- **A restored run is refused.** `continueRestoredRun` refuses a request of an abandoned approval with `INVALID_STATE` and tells the operator to cancel the restored run.
19+
20+
Unchanged: an object that declares no `closedStates`; an approval that opened before its object declared the key, or whose requests could not be placed. An approval on an object that declares the key on another field than the approval's holds nothing back: its decisions are written at once, as before, and the door only clears the mark.

‎docs/audits/2026-08-tenant-audit-write-call-sites.counts/plugins/plugin-approvals.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ a row or a number here — fix the code, or the census, and regenerate.
1414

1515
| Measure | Value |
1616
|---|---:|
17-
| Write call sites | 45 |
18-
| Object name statically decidable | 43 |
17+
| Write call sites | 49 |
18+
| Object name statically decidable | 47 |
1919
| Object name chosen at run time | 2 |
20-
| Object name spelled inline | 41 |
20+
| Object name spelled inline | 45 |
2121
| Object name spelled through a `const` | 2 |
2222
| Object name is an `object: string` parameter | 1 |
2323
| Object name is some other run-time expression | 1 |
24-
| Against a tenancy-enabled object | 43 |
24+
| Against a tenancy-enabled object | 47 |
2525
| Against an object declaring tenancy off | 0 |
26-
| Threading a tenant context | 45 |
26+
| Threading a tenant context | 49 |
2727
| Provably carrying none (options read, no context key) | 0 |
2828
| …and decidably tenancy-enabled | 0 |
2929
| Options argument unreadable | 0 |
3030
| …and decidably tenancy-enabled | 0 |
31-
| Threading a decidably elevated (`isSystem`) context | 43 |
31+
| Threading a decidably elevated (`isSystem`) context | 47 |
3232
| Threading a decidably non-elevated context | 0 |
3333
| Threading a context of undecidable elevation | 2 |
34-
| Receiver carried a readable engine type | 45 |
34+
| Receiver carried a readable engine type | 49 |
3535
| Receiver erased, placed by the object NAME | 0 |
3636
| Receiver erased, placed by an `object: string` PARAMETER | 0 |
3737
| Receiver erased, placed by an `UNTYPED_RECEIVERS` row | 0 |
@@ -50,11 +50,11 @@ a row or a number here — fix the code, or the census, and regenerate.
5050
| `packages/plugins/plugin-approvals/src/action-slot-backfill.ts` | `update` | `sys_approval_action` | enabled | elevated | 2 |
5151
| `packages/plugins/plugin-approvals/src/approval-activity-feed.ts` | `insert` | `sys_activity` | enabled | elevated | 1 |
5252
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `update` | `object` | undecidable | context, elevation undecidable | 1 |
53-
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `insert` | `sys_approval_action` | enabled | elevated | 19 |
53+
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `insert` | `sys_approval_action` | enabled | elevated | 20 |
5454
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `delete` | `sys_approval_approver` | enabled | elevated | 2 |
5555
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `insert` | `sys_approval_approver` | enabled | elevated | 2 |
5656
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `insert` | `sys_approval_request` | enabled | elevated | 1 |
57-
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `update` | `sys_approval_request` | enabled | elevated | 11 |
57+
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `update` | `sys_approval_request` | enabled | elevated | 14 |
5858
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `insert` | `sys_approval_token` | enabled | elevated | 1 |
5959
| `packages/plugins/plugin-approvals/src/approval-service.ts` | `update` | `sys_approval_token` | enabled | elevated | 1 |
6060
| `packages/plugins/plugin-approvals/src/backfill-platform-row-organizations.ts` | `update` | `objectPlan.object` | undecidable | context, elevation undecidable | 1 |

0 commit comments

Comments
 (0)