Skip to content

Commit 468672a

Browse files
docs(skills): actions teach ai.requiresConfirmation beside confirmText; permission sets teach the owner-only delete floor (#37769)
<!-- claude-projects-attribution: {"github_login":"hotlong"} --> _Requested by **Jack** · [project thread](https://claude.ai/code/project/chan_01EF41AQooqveF2DGD8nqPzS?thread=cmsg_01EF41AQooqveF2DGD8nqPzSUuFiSNNxgHbrBe6r4uDVrg)_ Fixes #37762 Clause-②: no (published prose only; teaches the confirmation flag and the delete floor already on main) Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:智能体照技能搭建时,AI 可调用的删除类动作会打开 `ai.requiresConfirmation`(以前只写 `confirmText`,那只是点击弹窗文案,不拦 AI 调用);给私有对象授删除权时会知道默认只能删自己创建的记录,要删全组织的记录需加 `writeScope: 'org'` 或 Modify All。 - 为什么做:objectstack-ai/cloud#5080 逐项拆分里,这两条技能缺口在 9 次 door 搭建中丢了 5 分(中位数各 1 分)。 - 出错会怎样:只改技能文字和两条 eval,不动产品。两个文件原本 token 余量为 0,各删了一处重复说法,剩余按实测抬高天花板(+10、+48)。 - 要你做什么:这是受管的技能文件,需要按受管路径审批后合并。 ## What changes - `skills/objectstack-ui/rules/actions.md`, `confirmText` bullet (card step 1, line 49 on `8b9b9d23` as the card says): `confirmText` gates no AI call; an `ai.exposed` action also sets `ai.requiresConfirmation: true`. - `skills/objectstack-data/rules/security.md`, Three axes (card step 2; `allowDelete` is taught here, not in a SKILL.md): `allowDelete` removes only rows the caller created (`owner_only_deletes`). On a `private` object owning the row, `writeScope: 'org'` or `modifyAllRecords` widens it, an `edit` share never; elsewhere only an authored `delete` row policy does. - Evals: `objectstack-ui` views-apps-actions-pages #26 (AI-exposed delete action), `objectstack-data` hooks-security-seeds-datasources #38 (SDR with `readScope: 'org'` + `allowDelete` gets 403 on an admin-imported contact). The ui evals README line names the new case. - `scripts/check-skills-token-ratchet.mjs`: two rows raised by the measured remainder, each with its arithmetic comment. - `.changeset/37762-…md`: `@objectstack/skills` patch. ## Premise check and deviations - Card premises re-measured on `origin/main` `8b9b9d23`: the `confirmText` sentence and the absence of any `requiresConfirmation` / owner-only delete line in both skills still hold. - Deviation from the card's wording of rule 2, read off the code: the floor is `created_by == current_user.id` (`plugin-security/src/platform-ownership-policies.ts`), not "rows the user owns", and it lifts where `SharingService.checkDelete` answers `allow` (owning the row, write depth `org`, or `modifyAllRecords`, on an owner-scoped object). So `writeScope: 'org'` alone widens it; no extra row policy is needed. On a public object the sharing verdict abstains and only an authored `delete` row policy widens it, Modify All included. This matches the scorer's reading in `packages/qa/scenarios/src/score/scenario-tags.ts` (`deleteFloorReading`). - Line budget: `skills/**` prose +2 lines net (card cap +4); eval JSON +24 lines. ## Token ratchet raise Standing maintainer ruling 2026-10-27, verbatim and untranslated: 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). Paid down first in the same file: | file | added | cut (restatement) | bytes | tokens | ceiling | |---|---|---|---|---|---| | `skills/objectstack-ui/rules/actions.md` | 84 B | 43 B: intro's "A parameterized bulk mutation is `script`." (the bulk bullet and `crm_create_campaign` show it) | 15518 → 15559 | 3890 | 3880 → 3890 (+10) | | `skills/objectstack-data/rules/security.md` | 248 B | 59 B: the "Prefer `member_default`" bullet's `owner_only_deletes` (now taught above), "the built-in", "for the common cases" | 17168 → 17357 | 4340 | 4292 → 4340 (+48) | ## Local checks (on `b613af38`) - `node scripts/check-skills-token-ratchet.mjs --self-test` :: 104 cases pass; gate :: exit 0 (61 authored files within ceilings) - `pnpm check:skill-identifier-liveness` :: exit 0 (565 citations) - `pnpm check:skill-links` :: exit 0 (272 links, 140 fragments) - `pnpm check:skill-frame-sync`, `check:skill-frame-freshness`, `check:skill-top-level-keys` :: exit 0 - `pnpm check:empty-changeset`, `check:changeset-fixed` :: exit 0 - NOT-MEASURED `pnpm check:adr-0087-registration` :: exit 3, no `node_modules` in this checkout (patch changeset, no ADR-0087 marker needed) - Both eval JSON files parse; no SKILL.md or code block changed, so `check:skill-docs` / `check:skill-examples` are untouched. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q4EjjNM2fYmcPyh5YXpnjJ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2473824 commit 468672a

7 files changed

Lines changed: 59 additions & 9 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): actions teach `ai.requiresConfirmation` beside `confirmText`, and permission sets teach the owner-only delete floor
6+
7+
Clause-②: no (published prose only; teaches the confirmation flag and the delete floor already on main)
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-ui/rules/actions.md` (`confirmText` bullet) says `confirmText` gates no AI call: an `ai.exposed` action that is destructive or irreversible also sets `ai.requiresConfirmation: true`. `skills/objectstack-data/rules/security.md` (Three axes) says `allowDelete` removes only rows the caller created (the platform's `owner_only_deletes` floor); on a `private` object owning the row, `writeScope: 'org'` or `modifyAllRecords` widens it, an `edit` share never does, and elsewhere only an authored `delete` row policy does. One eval case per rule (`objectstack-ui` views-apps-actions-pages #26, `objectstack-data` hooks-security-seeds-datasources #38). Both files sat at zero token headroom: one restatement per file is cut and the ceilings move by the measured remainder (+10, +48).

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,16 @@ export const CEILINGS = new Map([
13801380
// 16272 bytes (4068 tokens, headroom 0); the LANDED file is 17168 bytes ->
13811381
// 4292 tokens, ceiling +224, pinned AT the measurement, zero headroom.
13821382
// ceil($(wc -c < skills/objectstack-data/rules/security.md) / 4) == ceil(17168 / 4)
1383-
['skills/objectstack-data/rules/security.md', 4292],
1383+
// 4292 -> 4340 (objectstack#37762, from cloud#5080 item F): the Three axes list gains
1384+
// that `allowDelete` removes only rows the caller created (`owner_only_deletes`) and what
1385+
// widens it on a `private` object, which no line taught (two door builds lost the check).
1386+
// Same standing ruling, tap A, verbatim and untranslated: 「A:先削重复,余额按实测提高」
1387+
// (record 6513306068). PAID DOWN FIRST, 59 bytes: the "Prefer `member_default`" bullet's
1388+
// `owner_only_deletes` (now taught above), "the built-in" and "for the common cases".
1389+
// The bullet adds 248 bytes, the cut removes 59: 17168 -> 17357 bytes -> 4340 tokens,
1390+
// headroom 0 before, ceiling +48, the measured remainder only, pinned AT the measurement.
1391+
// ceil($(wc -c < skills/objectstack-data/rules/security.md) / 4) == ceil(17357 / 4)
1392+
['skills/objectstack-data/rules/security.md', 4340],
13841393
// 3024 -> 3109 (2026-08-31 app-repo-principles raise, see the block above).
13851394
// Severity Levels listed the three values and left the CHOICE unstated: a
13861395
// block rests on a judgement a person made, so a machine-inferred signal — a
@@ -1579,7 +1588,16 @@ export const CEILINGS = new Map([
15791588
// before, ceiling +169, the measured remainder only, pinned AT the measurement. Same ruling
15801589
// (2026-10-27, tap A): 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B).
15811590
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(15519 / 4)
1582-
['skills/objectstack-ui/rules/actions.md', 3880],
1591+
// 3880 -> 3890 (objectstack#37762, from cloud#5080 item D): the `confirmText` bullet says it
1592+
// gates no AI call and an `ai.exposed` action also sets `ai.requiresConfirmation: true` (three
1593+
// door builds set `confirmText` alone and lost the confirm-gated check). PAID DOWN FIRST by 43
1594+
// bytes of restatement: the intro's "A parameterized bulk mutation is `script`." (the bulk
1595+
// bullet and the `crm_create_campaign` example show it). The text adds 84 bytes, the cut
1596+
// removes 43: 15518 -> 15559 bytes -> 3890 tokens, headroom 0 before, ceiling +10, the
1597+
// measured remainder only. Same ruling (2026-10-27, tap A): 「A:先削重复,余额按实测提高」
1598+
// (ruling record 6513306068, letter B).
1599+
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(15559 / 4)
1600+
['skills/objectstack-ui/rules/actions.md', 3890],
15831601
// 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top,
15841602
// anchors to the file's existing headings, nothing else changed. +162 tokens,
15851603
// zero headroom to absorb any of it, ceiling +162. Maintainer ruling

‎skills/objectstack-data/evals/hooks-security-seeds-datasources.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@
376376
"must_contain": ["requiredPermissions", "maskingRule", "systemPermissions"],
377377
"must_not_contain": ["'employee.salary': { readable: false"]
378378
}
379+
},
380+
{
381+
"id": 38,
382+
"prompt": "`crm_contact` is a `private` object. Our `crm_sdr` permission set already reads every contact (`readScope: 'org'`) and grants `allowDelete`, yet an SDR deleting a contact an admin imported gets a 403. SDRs must be able to delete any contact in the organization. Fix the set.",
383+
"expected_output": "`allowDelete` alone deletes only rows the caller created: every member carries the platform's `owner_only_deletes` floor (`created_by == current_user.id`), and `readScope: 'org'` widens reads, never deletes. On a `private` object the floor lifts where the sharing service allows the delete: owning the row, a write depth of `org`, or Modify All. So the grant becomes `crm_contact: { allowRead: true, allowDelete: true, readScope: 'org', writeScope: 'org' }` (or `modifyAllRecords: true` when the set should also bypass sharing everywhere on the object). An `edit` share or a sharing rule does not help: sharing widens rows, never the delete verb.",
384+
"files": [],
385+
"assertions": {
386+
"must_contain": ["writeScope: 'org'", "owner_only_deletes", "allowDelete: true"],
387+
"must_not_contain": []
388+
}
379389
}
380390
]
381391
}

‎skills/objectstack-data/rules/security.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export const salesUser = definePermissionSet({
2626
`viewAllRecords` / `modifyAllRecords` (super-user, bypass sharing) widen
2727
which records the caller reaches; from v19 they open no field (use
2828
`viewAllFields`). Fields: § Field visibility.
29+
- `allowDelete` removes only rows the caller created (`owner_only_deletes`). On a `private`
30+
object owning the row, `writeScope: 'org'` or `modifyAllRecords` widens it, an `edit`
31+
share never; elsewhere only an authored `delete` row policy does.
2932
- **`isDefault: true` = the `everyone` baseline (ADR-0090 D5).** A published package
3033
declares **exactly one**, anchor-safe: `describeAnchorForbiddenBits(set, 'everyone')`
3134
(`@objectstack/spec/security`) returns `null`, else lint
@@ -117,9 +120,8 @@ traversal or subqueries — those are a compile error (ADR-0055), never silently
117120
| `current_user.queues` | the ownership queues the caller sits in (ADR-0142 D3) |
118121
| `current_user.KEY` | the set an object's `membershipKeys.KEY` declares |
119122

120-
- Prefer the built-in `member_default` owner scoping (`owner_only_writes` /
121-
`owner_only_deletes`) and the object's `sharingModel` (ADR-0056 D1) over
122-
hand-written policies for the common cases.
123+
- Prefer `member_default` owner scoping (`owner_only_writes`) and the object's
124+
`sharingModel` (ADR-0056 D1) over hand-written policies.
123125

124126
## Membership keys — a `current_user.KEY` set the roster object declares
125127

‎skills/objectstack-ui/evals/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ view / page / dashboard / report metadata.
2727
docs, the New and Edit form built from the object (field groups,
2828
`showOnCreate`, line items), a named form's section `columns`, a view added
2929
beside the list (and the empty board over a field added with it), a write
30-
button whose body writes, the view kind the request names.
30+
button whose body writes, the view kind the request names, an AI-exposed
31+
delete gated by `ai.requiresConfirmation`, not `confirmText`.
3132
- `triggers.json` — trigger cases: requests that should load this skill
3233
(`should_trigger: true`) and near misses that should not (`false`), graded
3334
on whether the skill was loaded, never on the answer.

‎skills/objectstack-ui/evals/views-apps-actions-pages.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,16 @@
250250
"must_contain": ["formViews", "group: 'contact_info', columns: 2", "type: 'form'", "fieldGroups"],
251251
"must_not_contain": ["modalSize:", "formViews.default"]
252252
}
253+
},
254+
{
255+
"id": 26,
256+
"prompt": "Add a 'Delete Task' button on the `project_task` record page that deletes the task. Our in-app assistant must be able to run it too, but only after the user agrees, since a deleted task's time entries go with it.",
257+
"expected_output": "One registered `defineAction` on `objectName: 'project_task'` with a placement (`locations: ['record_header']`), a body that deletes the current record (a `type: 'script'` `js` body calling `ctx.api.object('project_task').delete(...)` on `ctx.recordId`, with `capabilities: ['api.write']`), `confirmText` for the person clicking, and `ai: { exposed: true, description: '…', requiresConfirmation: true }`. `confirmText` is the click dialog's copy only and gates no AI call, so the assistant's run is held for the user's approval by `ai.requiresConfirmation: true`, not by `confirmText` or by a sentence in `ai.description` asking the model to confirm first.",
258+
"files": [],
259+
"assertions": {
260+
"must_contain": ["requiresConfirmation: true", "exposed: true", "confirmText", "project_task"],
261+
"must_not_contain": ["requireConfirmation:", "confirm: true"]
262+
}
253263
}
254264
]
255265
}

‎skills/objectstack-ui/rules/actions.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Actions are user-triggered operations on an object or a view.
44
Register them under `defineStack({ actions: [...] })`; the six types:
5-
[Action Types](../SKILL.md#action-types). A parameterized bulk mutation is
6-
`script`.
5+
[Action Types](../SKILL.md#action-types).
76

87
**A record button needs a placement and a body that writes.** `objectName`
98
folds the action into that object's surfaces: `locations` without it
@@ -46,7 +45,7 @@ there: a wrong name draws nothing.
4645
- `disabled` — `boolean` **or** a CEL predicate; when true it **shows but greys out**. A bare field ref in either (`done` for `record.done`) fails `os validate`.
4746
- `disabledReason` — an I18nLabel (a sentence or an inline locale map) a greyed action shows as its hover title and accessible description. Display-only: never a predicate or a gate (the hook or permission still refuses). Omit it to keep the console's default "Not available for this record"; a blank one is refused, and `disabledMessage` / `disabledTooltip` / `disabledHint` / `disabledText` are refused naming this key. The reason goes here, not in `description`.
4847
- `pressed` — a CEL predicate over the same scope as `visible` that marks the action as already done by this reader: while TRUE the record header draws it pressed (`aria-pressed`). Display-only, never a gate; a boolean literal is refused (a constant is a style, not a reader's state), and `active` / `activeWhen` / `pressedWhen` are refused naming this key. A per-reader fact (the reader's vote) is a block the object declares under `attachedOnRead`, filled per caller by a service or `afterFind` hook, read as `has(record.viewer) && record.viewer.vote == 'helpful'`.
49-
- `confirmText` — set for any destructive or irreversible operation; the confirm dialog of a param-less action. A registered action is refused it beside a non-empty `params` (put the question on `description`); a view's `bulkActionDefs` entry pairs the two by its own contract.
48+
- `confirmText` — set for any destructive or irreversible operation; the confirm dialog of a param-less action. It gates no AI call: an `ai.exposed` one also sets `ai.requiresConfirmation: true`. A registered action is refused it beside a non-empty `params` (put the question on `description`); a view's `bulkActionDefs` entry pairs the two by its own contract.
5049
- `submitText` — the verb on the param dialog's submit button ("Send", "Log Call") in place of "Confirm": an I18nLabel, refused blank and refused without a non-empty `params` (no dialog opens); `submitLabel` / `confirmLabel` are refused naming this key.
5150
- `preflight` — a read the param dialog shows above the params before submit: `{ read: { url }, path?, fields?, seed? }` sends one `GET` (no other `method`, no body or credentials) to a same-origin API path (one leading `/`) whose only holes are `${param.NAME}` (a declared param; re-read when it changes), `${ctx.recordId}` and `${ctx.record.FIELD}`. `path` selects the answer's sub-tree (`data`); `fields` rows are `resultDialog.fields`' (omitted: JSON). Each `seed: [{ param, path }]` entry fills a declared param, drawn read-only and submitted as shown: seeded once, no `defaultValue` / `defaultFromRow` / `carryOver`, read by no hole; mark it `required` so Confirm waits for the answer. Refused without a non-empty `params` and beside `execution: 'aggregate'`. UX, not authorization: the endpoint still checks a seeded value.
5251
- `resultDialog` — a one-shot dialog that shows the server answer in place of the success toast (so no `successMessage`; `outcomeMessages` is refused beside it): `{ title?, description?, acknowledge?, format?, fields? }`. `fields: [{ path, label?, format? }]`, `path` a dot path into `result.data` (omitted: the whole answer as JSON); `format` is one of `qrcode`, `code-list`, `secret`, `text`, `json`, or `table` with `columns: [{ path, label?, format? }]` (one row per element of the array at `path`, one cell per column; required with `table` and refused beside any other format). The dialog-level `format` (default `json`) and a cell's (default `text`) take every format but `table`. A `text` or `code-list` cell draws the value with no copy control; a `secret` or `qrcode` cell keeps its own.

0 commit comments

Comments
 (0)