Skip to content

Commit f588898

Browse files
docs(skills): objectstack-ui says where os validate judges actionLayout names (#37122)
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr Refs #37057 (item 1) Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感;装了界面技能包的 AI 助手读到的「按钮顺序」一节,现在说清了校验命令只检查本应用自己定义的对象上的按钮名。 - 为什么做:原句让助手以为给已安装对象写的定制扩展里写错按钮名也会被校验拦下,实际不会,只是按钮不显示。 - 出错会怎样:只改了一句说明文字、几行示例和一处注释,写错了最多是助手读到不准确的说明;撤回这一个改动即可恢复。 - 要你做什么:无。 ## What changes `skills/objectstack-ui/rules/actions.md`, section "Button Order (`actionLayout`)". Before: > `os validate` refuses a name the arm's scope does not place. On an installed object only its paired `.custom` package's extension writes it (as `fieldGroups`, objectstack-data), each arm whole. After: > `os validate` refuses a name the arm's scope does not place, on the object or an extension of one the same stack defines. On an installed object only its paired `.custom` package's extension writes it (as `fieldGroups`, objectstack-data), each arm whole, not judged there: a wrong name draws nothing. What the code does, read at `b49a264a10`: - `validateObjectActionLayout` (`packages/lint/src/validate-object-action-layout.ts`, docblock): "Both object positions are judged: an object's own `actionLayout`, and an `objectExtensions` entry's, against the object it extends. An extension of an object this stack does not define is not judged". Its pin is the test "judges an extension against the object it extends, and skips one whose object the stack does not define". - `arrangedHeaderActions` (`ui/packages/types/src/ui-action.ts`, docblock): "A name naming none of `actions` ... is skipped: it draws nothing, and no other action takes a pinned one's place." Paid for in the same file, no ceiling raised and `scripts/check-skills-token-ratchet.mjs` not edited. Four cuts that repeat what the file already shows are removed (107 bytes): - Add to Campaign `icon` (the Convert Lead block shows the key); - Add to Campaign `successMessage` (the Convert Lead and Reassign Lead blocks show it, and the `successMessage` / `errorMessage` bullet describes it); - Add to Campaign `refreshAfter: true` (the Convert Lead and Add Line blocks show it; this body inserts a `campaign_member` rather than writing the current record); - the gloss "(the handler's answer)" after `result` on the copy-holes bullet (the `resultDialog` bullet above it says the dialog shows the server answer). The Convert Lead block keeps its `successMessage`, byte-identical to `main`: eval case 3 of `skills/objectstack-ui/evals/views-apps-actions-pages.json` expects it (contract review S1, record 7144254679). A grep of `skills/objectstack-ui/evals/**` finds no `must_contain` token whose teaching the four cuts remove. Item 2 of the card (`skills/objectstack-data/SKILL.md`) is not in this PR: that file conflicts with open PR #36158, so the card is released with item 2 behind it after this lands. Changeset: `@objectstack/skills` patch. ### skills readings (lines, then tokens as `check-skills-token-ratchet` counts them) | Reading | Before (`b49a264a10`) | After (`e799ec7699`) | |:--|:--|:--| | `rules/actions.md`, whole file | 268 lines · 15519 bytes · 3880 tokens (ceiling 3880, headroom 0) | 267 lines · 15519 bytes · 3880 tokens (ceiling 3880, headroom 0) | | all `skills/*/SKILL.md` summed | 4937 lines | 4937 lines | | whole shipped bundle | 23066 lines · 296366 tokens | 23065 lines · 296366 tokens | Net lines in `skills/**`: -1 (5 added, 6 removed), inside the +2 budget. ## Tests No code changed, so no test changed and nothing was ablated. The 47-command `dispatch-gates --commands` sweep was taken at `fa749f9d3b` (43 exit 0; four dist-reading gates NOT MEASURED locally, exit 3, CI runs them). Rerun at `e799ec7699`, each exit 0: `node scripts/check-skills-token-ratchet.mjs` ("skills/objectstack-ui/rules/actions.md is 3880 tokens (ceiling 3880; headroom 0)"), `check:skill-examples` ("350 prose examples type-check across 3 surface(s)"), `check:doc-formula-expressions`, `check:skill-links`, `check:skill-identifier-liveness`, `check:doc-authoring`, `check:nul-bytes`; `overlap-check`: "VERDICT clean exit 0". ## Acceptance notes - "draws nothing" is the run-time reader's own wording. The design mode's Save checks names before it writes (the lint rule's docblock), so the unjudged path is a hand-written extension. - Contract review nit N1 ("not judged there" has a loose subject) is left as is: the file has no bytes to spare and both readings are true. ## Verification Read first: 1. `skills/objectstack-ui/rules/actions.md`, the hunk at line 37: the risk is the new sentence claiming more or less than the rule does. 2. The Add to Campaign example hunk and the copy-holes bullet: check that each removed piece is still shown elsewhere in the file. Two-minute check: `node scripts/check-skills-token-ratchet.mjs`, and expect the `rules/actions.md` line to read 3880 tokens against ceiling 3880, exit 0. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fa7d94b commit f588898

2 files changed

Lines changed: 15 additions & 6 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): objectstack-ui says where `os validate` judges `actionLayout` names
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-ui's `rules/actions.md`, "Button Order (`actionLayout`)": the sentence "`os validate` refuses a name the arm's scope does not place" now says where that holds: on the object, or on an extension of an object the same stack defines. The next sentence, on the paired `.custom` package's extension of an installed object, now says those names are not judged there and that a wrong name draws nothing. The rule itself is unchanged; the text said more than the rule does. Three Add to Campaign example lines that repeated a key another example in the file already shows (`icon`, `successMessage`, `refreshAfter`) and the gloss "(the handler's answer)" on the copy-holes bullet, which the `resultDialog` bullet above it already says, were removed to pay for the new words.

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ goes to the ⋯ menu, those `more` names first. `record` takes `record_header` /
3535
`record_more` actions wherever that header draws (record page, side preview,
3636
phone bar, a row's ⋮ menu order); `list` takes `list_toolbar` actions and may
3737
pin `$import` / `$export` (pinned only). `os validate` refuses a name the arm's
38-
scope does not place. On an installed object only its paired `.custom` package's
39-
extension writes it (as `fieldGroups`, objectstack-data), each arm whole.
38+
scope does not place, on the object or an extension of one the same stack
39+
defines. On an installed object only its paired `.custom` package's extension
40+
writes it (as `fieldGroups`, objectstack-data), each arm whole, not judged
41+
there: a wrong name draws nothing.
4042

4143
## Visibility, Disable & Feedback
4244

@@ -49,7 +51,7 @@ extension writes it (as `fieldGroups`, objectstack-data), each arm whole.
4951
- `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.
5052
- `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.
5153
- `successMessage` / `errorMessage` — toast copy; without `successMessage` the UI shows a generic "Action completed".
52-
- Copy holes are `{{ }}`: `confirmText`, `description` and a param's `helpText` read `record`; `successMessage` and each `outcomeMessages` entry (`resent: 'Invitation resent to {{ result.email }}'`) read `result` (the handler's answer) and `record`; `errorMessage` takes none. A `bulkActionDefs` entry's `confirmText` reads `{{ count }}` and its params by bare name (`{{ tier }}`). In all of them `${record.name}`, `{name}`, logic in a hole and a blank sentence fail `os validate`.
54+
- Copy holes are `{{ }}`: `confirmText`, `description` and a param's `helpText` read `record`; `successMessage` and each `outcomeMessages` entry (`resent: 'Invitation resent to {{ result.email }}'`) read `result` and `record`; `errorMessage` takes none. A `bulkActionDefs` entry's `confirmText` reads `{{ count }}` and its params by bare name (`{{ tier }}`). In all of them `${record.name}`, `{name}`, logic in a hole and a blank sentence fail `os validate`.
5355
- A param's `helpText`, like `description`, is a sentence or an inline locale map (`{ en: 'Why {{ record.name }} is paused', 'zh-CN': '暂停原因' }`); the map is how a page button's inline `action` (no bundle reaches it) writes its hint per locale.
5456
- `undoable: true` — an **Undo** in the success toast (and `Ctrl+Z`). Snapshot: runtime on `operation: 'update'`, console on `type: 'api'`; else refused.
5557
- A list view's `bulkActions: ['<name>']` runs the action once per ticked row. A body that writes each selected row takes that form: declare `execution: 'perRecord'` and write the row it is handed (`ctx.record`, `ctx.recordId`; `crm_create_campaign` below); a row whose run throws is listed with its message. A `bulkActionDefs` entry `{ name, operation: 'custom', execution: 'aggregate' }` runs it once for the selection. A script body or a flow receives the ids under the built-in key `params._selectedIds` (`input._selectedIds`), at most 5000 and only ids the caller can read: one the caller cannot read refuses the whole call (`404 RECORD_NOT_FOUND`) before it starts. A throw is one outcome for the selection; a return value's top-level `succeeded` or `failed` is read as a `BulkActionResult` (`@objectstack/spec/ui`), and in any other form (counts, one list) reported as unreadable.
@@ -109,7 +111,6 @@ export const AddToCampaignAction = defineAction({
109111
name: 'crm_create_campaign',
110112
label: 'Add to Campaign',
111113
objectName: 'lead',
112-
icon: 'send',
113114
type: 'script',
114115
execution: 'perRecord',
115116
params: [
@@ -125,8 +126,6 @@ export const AddToCampaignAction = defineAction({
125126
capabilities: ['api.write'],
126127
timeoutMs: 10000,
127128
},
128-
successMessage: 'Leads added to campaign!',
129-
refreshAfter: true,
130129
});
131130
```
132131

0 commit comments

Comments
 (0)