Skip to content

Commit 0f8b970

Browse files
committed
docs(skills): objectstack-automation teaches the record-anchored approval lock read, with an eval prompt
One short section, "Reading the lock", in references/state-machines-and-approvals.md: when a record page reads the lock (a reader not on the approval is served no request row), the route GET /api/v1/approvals/records/:object/:recordId/lock answering { success: true, data: { locked } }, the SDK call client.approvals.getRecordLock(object, recordId), `locked` alone with request content behind `approvalsVisibleToReaders`, and an unreadable record answered with the same 404 as a missing one. Two restatements of the Send-back section are cut to pointers (the `maxRevisions` config row, the Branching bullet). evals/flows-triggers-approvals.json gains prompt 10, which expects the lock read rather than a request-row lookup for a non-participant. scripts/check-skills-token-ratchet.mjs: the two touched rows follow their measurement (5587 -> 5730, 2141 -> 2427) under the maintainer's ruling quoted in each row comment. Claude-Session: https://claude.ai/code/session_01JQwxbZpLcVkA9KV78eHZYr Co-authored-by: Claude <noreply@anthropic.com>
1 parent cc0d77b commit 0f8b970

3 files changed

Lines changed: 50 additions & 6 deletions

File tree

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,18 @@ export const CEILINGS = new Map([
790790
// ceiling moves +318, pinned AT the measurement. Same maintainer ruling as
791791
// the SKILL.md row above (2026-10-27, verbatim and untranslated):
792792
// 「A:先削重复,余额按实测提高」.
793-
['skills/objectstack-automation/evals/flows-triggers-approvals.json', 2141],
793+
// 2141 -> 2427 (card #26362): one eval prompt for the record-anchored
794+
// approval lock read — a record page that offers an edit to a member who is
795+
// not on the approval, whose save the lock hook then refuses; the ideal
796+
// answer reads the lock (`client.approvals.getRecordLock`) rather than a
797+
// request row the non-participant is never served, written so it never
798+
// spells either `must_not_contain` string. Paid down first: the file's nine
799+
// fixtures share no sentence, nothing to cut (0 bytes). 8561 -> 9705 bytes
800+
// (+1144) -> ceil(9705 / 4) = 2427; headroom was 3 bytes, 0 tokens, so the
801+
// ceiling moves +286, pinned AT the measurement. Same maintainer ruling as
802+
// the SKILL.md row above (2026-10-27, verbatim and untranslated):
803+
// 「A:先削重复,余额按实测提高」.
804+
['skills/objectstack-automation/evals/flows-triggers-approvals.json', 2427],
794805
// 894 -> 1095 (#26179): one regression case for the field permission `when`
795806
// (the contract prompt: lock the legal terms for finance from approval on,
796807
// legal keeps the edit) — expected: `when` on the finance set's entries with
@@ -871,7 +882,18 @@ export const CEILINGS = new Map([
871882
// bullets and were deleted (~73 tokens). Landed 5555 -> 5587: +32 net, 14
872883
// absorbed by headroom, ceiling +18. Same maintainer ruling as the SKILL.md
873884
// row above (2026-10-27, verbatim and untranslated): 「A:先削重复,余额按实测提高」.
874-
['skills/objectstack-automation/references/state-machines-and-approvals.md', 5587],
885+
// 5587 -> 5730 (card #26362): one short section, "Reading the lock" — the
886+
// record-anchored approval lock read every reader may ask (the route, the
887+
// SDK call, `locked` alone with request content behind
888+
// `approvalsVisibleToReaders`, an unreadable record answered as a missing
889+
// one), +782 bytes. Paid down first, two genuine restatements of the
890+
// Send-back section cut to pointers: the config table's `maxRevisions` row
891+
// (-76 bytes) and the Branching section's send-back bullet (-134 bytes).
892+
// 22346 -> 22918 bytes (+572 net) -> ceil(22918 / 4) = 5730; headroom was 2
893+
// bytes, 0 tokens, so the ceiling moves +143, pinned AT the measurement.
894+
// Same maintainer ruling as the SKILL.md row above (2026-10-27, verbatim and
895+
// untranslated): 「A:先削重复,余额按实测提高」.
896+
['skills/objectstack-automation/references/state-machines-and-approvals.md', 5730],
875897
// 1779 -> 1769 (#26297): RE-LOCK at the landed count after a net cut — two
876898
// stale `{ type: 'lookup', reference: 'user' }` fields (an object that does
877899
// not exist) became `type: 'user'`; -10 tokens, the row follows the

‎skills/objectstack-automation/evals/flows-triggers-approvals.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@
9090
"must_contain": ["record_link", "reference", "defaultValue", "outputVariable", "dialect: 'cel'"],
9191
"must_not_contain": ["type: 'record'", "]("]
9292
}
93+
},
94+
{
95+
"id": 10,
96+
"prompt": "The `expense` record page shows an Edit button to every member who can read the record. While an expense is under approval, members who are not on the approval still get the button and their save is refused with `409 RECORD_LOCKED`. Make the page know the record is locked before it offers the edit.",
97+
"expected_output": "Read the lock itself: `client.approvals.getRecordLock('expense', recordId)` (`GET /api/v1/approvals/records/expense/:recordId/lock`) answers `{ locked }` to anyone who can read the record, participant or not — the same judgement the lock hook applies to the write — so the page hides or disables Edit while `locked` is `true`. Not the request row: a non-participant is served none, and request content stays behind the object's `approvalsVisibleToReaders`, which is not switched on for this. A record the caller cannot read answers `404 RECORD_NOT_FOUND`, the same as a missing one.",
98+
"files": [],
99+
"assertions": {
100+
"must_contain": ["getRecordLock", "locked"],
101+
"must_not_contain": ["lock_record", "approvalsVisibleToReaders: true"]
102+
}
93103
}
94104
]
95105
}

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ 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+
### Reading the lock
223+
224+
A page over a record under approval must not offer an edit the server then
225+
refuses with `409 RECORD_LOCKED`. The request row tells only a participant,
226+
or any reader once the object declares `enable.approvalsVisibleToReaders`;
227+
everyone else is served no row. Ask the lock itself —
228+
`GET /api/v1/approvals/records/:object/:recordId/lock`, in the SDK
229+
`client.approvals.getRecordLock(object, recordId)` — answered to anyone who
230+
can read the record as `{ success: true, data: { locked } }`: `locked` and
231+
nothing else (request, approvers and history stay behind that switch), the
232+
same judgement the lock hook applies to an edit. The record is read as the
233+
caller: one they cannot read answers `404 RECORD_NOT_FOUND`, the same body
234+
an id that does not exist gets.
235+
222236
### Approver Types
223237

224238
| `type` | Resolves to |
@@ -350,7 +364,7 @@ Object-hook `ctx` is a different vocabulary — see **objectstack-data**
350364
| `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` |
351365
| `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 |
352366
| `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) |
353-
| `maxRevisions` | ADR-0044 — max **send-backs-for-revision** per run before auto-reject. Default `3`; `0` disables send-back. Only meaningful when the node has a `revise` out-edge |
367+
| `maxRevisions` | Send-backs per run before auto-reject (ADR-0044) — see *Send-back for revision* above |
354368

355369
### Branching, side-effects & rejection
356370

@@ -362,9 +376,7 @@ These are wired on the **graph**, not in node config:
362376
`http`, a `notify` node, …) to the `approve` / `reject` out-edge.
363377
- **Roll back on reject** — route the `reject` edge as a **back-edge** to an
364378
earlier node so the submitter can revise (the old `back_to_previous`).
365-
- **Send back for revision (ADR-0044)** — distinct from a plain reject: a
366-
`revise` out-edge into an **`approval_revise`** window, closed by a
367-
`type: 'back'` resubmit edge. See *Send-back for revision* above.
379+
- **Send back for revision (ADR-0044)** — see *Send-back for revision* above.
368380
- **Hard reject** — route the `reject` edge to an `end` node (the old
369381
`reject_process`).
370382

0 commit comments

Comments
 (0)