Repository navigation
Commit 7e5ac28
`lifecycle-hooks.ts` carried two admin bypasses, both reading
`ctx.session.roles`: the approval **record lock** (`bindApprovalLockHook`) and
the `sys_approval_delegation` write guard (`bindDelegationWriteGuard`). Both are
removed.
Neither ever ran. `session.roles` has no producer anywhere in the platform —
ObjectQL's `buildSession()` builds its session field by field and never writes
it — so both branches were dead on every real engine path: the record lock has
always applied to admins, and delegation has always been self-managed. The spec
declares `roles` on the HookContext session, two consumers read it, nothing
fills it: declared != enforced.
They were also a second privilege dialect. Privilege here is judged by the
ADR-0095 vocabulary (`permissions` / `positions` / derived posture) — ADR-0090 D3
bans the `role` spelling outright — and the sibling `ApprovalService.isOverrideActor`
already does exactly that. Per the maintainer's ruling both sites are DELETED
rather than rewired to the correct predicate:
- Record lock: the sanctioned admin rescue path already exists (#3424 — recall /
reject / reassign, gated by `isOverrideActor`, audited via `via_override`).
Finalising the request is what releases the lock, so a record is never edited
under a live approval.
- Delegation: evidence-first, and the evidence says coverage exists. A delegation
is consulted only at slate-resolution time (`applyOooDelegation` inside
`resolveApproverSpec`), so forging one for an already-unavailable approver
never moved their pending work; `reassign` / `recall` / reject do, and are
gated by `isOverrideActor`. "Delegation is self-managed" is now the final
semantic.
Tests: `admin-exemption-retired.test.ts` turns that evidence into executable
assertions and adds a source-level pin — no non-test source in this package may
name a `roles` identifier or compare against the string 'admin'. The existing
"allows an admin override" tests become "does NOT exempt ..." pins over both the
retired dialect and every live ADR-0095 admin shape, on the by-id and predicate
paths.
The spec-side retirement of `session.roles` (now with zero consumers) is a
separate protocol change under ADR-0049 enforce-or-remove — not in this PR.
Claude-Session: https://claude.ai/code/session_01NrmBxj8rK2uGCnh9aipjwX
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 79822b5 commit 7e5ac28
4 files changed
Lines changed: 624 additions & 23 deletions
File tree
- .changeset
- packages/plugins/plugin-approvals/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments