Skip to content

Commit 7ed0116

Browse files
committed
docs(skills): the actions rule teaches a bulk action placed at selection
A list view's `bulkActions` list was retired in protocol 19: an action that acts on many records declares `'selection'` in its own `locations`, and the object's `actionLayout.selection` orders the selection bar. The actions rule, the i18n key map and two eval cases still taught or graded the retired key. Neither priced file grows: each new clause is paid for inside its file. Claude-Session: https://claude.ai/code/session_01WGufzfcCk7a8bQdgyaxzu7 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 197e3ff commit 7ed0116

4 files changed

Lines changed: 46 additions & 19 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the objectstack-ui actions rule teaches a bulk action placed at `selection`, in place of a list view's retired `bulkActions` list
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Protocol 19 retired a list view's `bulkActions` list: an action that acts on many records declares `'selection'` in its own `locations`, and the object's `actionLayout.selection` orders the selection bar. The published skills still taught the retired key, which parse and `tsc` refuse. Text only: no schema, rule or runtime behaviour changes here.
11+
12+
`skills/objectstack-ui/rules/actions.md`:
13+
14+
- The location table gains the `selection` row: many records, one run per ticked row, on the selection bar of every grid view of the object. The line under the table that names what replaced each retired word now also names a view's `bulkActions` (`selection`).
15+
- The `actionLayout` paragraph names the third arm: `selection` takes the actions placed at `selection`, with the same `pinned` / `more` parts as the other two.
16+
- The opening paragraph's `action-no-placement` sentence lists the two ways a view still places an action by name, `rowActions` and `bulkActionDefs`.
17+
- The bulk bullet says an action that writes each selected row is placed at `selection`, declares `execution: 'perRecord'` and writes the row it is handed. The aggregate form, a view's `bulkActionDefs` entry with `execution: 'aggregate'`, reads as before.
18+
- The checked `crm_create_campaign` example declares `locations: ['selection']`. Without it the example taught an action no surface draws.
19+
20+
`skills/objectstack-i18n/SKILL.md`: the key map's `_views.{view}` row spells its bulk group `bulkActions.{bulkActionDefs_name}`. The translation group keeps its name; it is keyed by the `name` of a view's `bulkActionDefs` entry and was never the retired view key. An action placed at `selection` is translated under `_actions`, like any other action.
21+
22+
Neither file grows. In the actions rule the new text is paid for inside the file: the retired key's two mentions, one clause of the bulk bullet that its next clause repeated ("only ids the caller can read", before "one the caller cannot read refuses the whole call"), the bullet's pointer to the example (the example now declares its placement itself), and the location table's column padding. In the i18n entry the flow-step bullet no longer glosses `approvals` as "(approval)" and `screens` as "(screen)".
23+
24+
The two `objectstack-ui` eval cases that graded an answer on the retired key (a bulk "Add to campaign" action, and an aggregate body moved to the per-record form) now require `'selection'` and refuse a `bulkActions: [` list.

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ bundles; delete it and the shipped value returns.
7777
objects.{object}: label, pluralLabel, description
7878
fields.{field}: label, help, placeholder, options.{value}, inlineTitle, relatedListTitle
7979
_views.{view}: label, description, title, emptyState.{title,message},
80-
submitBehavior.{title,message}, bulkActions.{def}
80+
submitBehavior.{title,message}, bulkActions.{bulkActionDefs_name}
8181
_actions.{action}: label, description, confirmText, submitText, cancelText,
8282
successMessage, disabledReason, params.{param}(.options.{value}),
8383
outcomeMessages.{outcome}, resultDialog.{title,description,acknowledge},
@@ -118,8 +118,8 @@ messages: flat dotted ids ('common.save'); dashboards, metadataForms, settingsCo
118118
(`reports.showcase_task_overview.blocks.open_block.label`); a `books` group by its stable
119119
`key`, never its position (`books.crm_manual.groups.getting_started.label`); its pages
120120
localize through `doc.translations`.
121-
- A flow step is keyed under `approvals` (approval), `screens` (screen) or `nodes` (any
122-
other). `os i18n check` asks for a technical step (`script`, `http`, `connector_action`,
121+
- A flow step is keyed under `approvals`, `screens` or `nodes` (any other kind).
122+
`os i18n check` asks for a technical step (`script`, `http`, `connector_action`,
123123
`assignment`, `boundary_event`, `*_record`) only where a decision's branch leads to it.
124124

125125
## Traps

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
{
2525
"id": 3,
2626
"prompt": "Add a Convert action on `lead` — only for qualified, not-yet-converted leads, from the record header and each list row, launching the `crm_lead_conversion` flow — and a bulk 'Add to campaign' that asks which campaign, for the selected rows.",
27-
"expected_output": "Two `defineAction` items. Convert: `type: 'flow'`, `target: 'crm_lead_conversion'`, `locations: ['record']`, `visible: P`record.status == \"qualified\" && record.is_converted == false`` (bare CEL, never brace-wrapped), `confirmText`, `successMessage`, `refreshAfter: true`. Bulk: `type: 'script'`, `execution: 'perRecord'`, wired by the lead list view's `bulkActions: ['<name>']`, a field-backed `params: [{ field: 'campaign_id', objectOverride: 'campaign', required: true }]`, and a `body` that runs once per ticked row and reads that row's id as `ctx.recordId`.",
27+
"expected_output": "Two `defineAction` items. Convert: `type: 'flow'`, `target: 'crm_lead_conversion'`, `locations: ['record']`, `visible: P`record.status == \"qualified\" && record.is_converted == false`` (bare CEL, never brace-wrapped), `confirmText`, `successMessage`, `refreshAfter: true`. Bulk: `type: 'script'`, `execution: 'perRecord'`, placed at `selection` (`locations: ['selection']`, so no list view names it), a field-backed `params: [{ field: 'campaign_id', objectOverride: 'campaign', required: true }]`, and a `body` that runs once per ticked row and reads that row's id as `ctx.recordId`.",
2828
"files": [],
2929
"assertions": {
30-
"must_contain": ["defineAction", "locations", "'record'", "bulkActions", "visible", "successMessage", "ctx.recordId"],
31-
"must_not_contain": ["{record.", "input.selectedIds"]
30+
"must_contain": ["defineAction", "locations", "'record'", "'selection'", "visible", "successMessage", "ctx.recordId"],
31+
"must_not_contain": ["{record.", "input.selectedIds", "bulkActions: ["]
3232
}
3333
},
3434
{
@@ -224,11 +224,11 @@
224224
{
225225
"id": 23,
226226
"prompt": "Our `archive_tasks` script action is wired as a `bulkActionDefs` entry with `execution: 'aggregate'`. Its body loops over the selected ids and updates each task, but some tasks are locked and their update throws, so the whole run is reported as failed even though most rows were archived. Make the result dialog say which rows were archived and why each of the others was not.",
227-
"expected_output": "`archive_tasks` moves to the per-record form, the form for a body that writes each selected row: the action declares `execution: 'perRecord'`, the list view names it in `bulkActions: ['archive_tasks']` in place of the `bulkActionDefs` aggregate entry, and the body updates only the row it is handed (`ctx.recordId` / `ctx.record`), with no loop over `input._selectedIds`. Each ticked task is then its own run: a locked task's throw fails that row alone and the result dialog lists it with its message, while every other row is archived and counted. Not a `try` / `catch` loop in the aggregate body that returns per-row lists or counts of what it wrote and what refused, not `execution: 'perRecord'` added while the `bulkActionDefs` aggregate entry stays, not a `resultDialog`, and not a rethrow carrying the rows (a rejection's body is dropped).",
227+
"expected_output": "`archive_tasks` moves to the per-record form, the form for a body that writes each selected row: the action declares `execution: 'perRecord'` and is placed at `selection` (`'selection'` in its `locations`), the view's `bulkActionDefs` aggregate entry is removed, and the body updates only the row it is handed (`ctx.recordId` / `ctx.record`), with no loop over `input._selectedIds`. Each ticked task is then its own run: a locked task's throw fails that row alone and the result dialog lists it with its message, while every other row is archived and counted. Not a `try` / `catch` loop in the aggregate body that returns per-row lists or counts of what it wrote and what refused, not `execution: 'perRecord'` added while the `bulkActionDefs` aggregate entry stays, not a `resultDialog`, and not a rethrow carrying the rows (a rejection's body is dropped).",
228228
"files": [],
229229
"assertions": {
230-
"must_contain": ["perRecord", "bulkActions: [", "ctx.record"],
231-
"must_not_contain": ["succeeded:", "{ succeeded", "{ failed"]
230+
"must_contain": ["perRecord", "'selection'", "ctx.record"],
231+
"must_not_contain": ["succeeded:", "{ succeeded", "{ failed", "bulkActions: ["]
232232
}
233233
},
234234
{

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Register them under `defineStack({ actions: [...] })`; the six types:
77
folds the action into that object's surfaces: `locations` without it
88
is refused at validate and publish (`action-no-object-binding`; set it, or
99
`locations: []` if headless). With neither `locations` nor a view naming it in
10-
`rowActions` / `bulkActions` / `bulkActionDefs` it renders nowhere (`action-no-placement`). A body
10+
`rowActions` / `bulkActionDefs` it renders nowhere (`action-no-placement`). A body
1111
that returns or assigns values writes nothing
1212
(`action-record-write-discarded`): it calls `ctx.api.object(...).update(...)`
1313
in `language: 'js'` (an `expression` body has no I/O) with
@@ -16,16 +16,17 @@ in `language: 'js'` (an `expression` body has no I/O) with
1616

1717
## Where Actions Appear (`locations`)
1818

19-
| Value | Acts on, and where |
20-
|:-----------------|:--------|
21-
| `list` | No record: the list page toolbar; one ticked row is its `recordId`, several are refused (no `_selectedIds`) |
22-
| `record` | One record, the default: the record page and each list row |
23-
| `record_page` | The record page only; `component: 'action:menu'` puts it in the ⋯ menu |
24-
| `record_row` | Each list row only |
19+
| Value | Acts on, and where |
20+
|:--|:--|
21+
| `list` | No record: the list page toolbar; one ticked row is its `recordId`, several are refused (no `_selectedIds`) |
22+
| `record` | One record, the default: the record page and each list row |
23+
| `record_page` | The record page only; `component: 'action:menu'` puts it in the ⋯ menu |
24+
| `record_row` | Each list row only |
2525
| `record_related` | Related-list section in a record |
2626
| `record_section` | Body section/tab of a record |
27+
| `selection` | Many records, once per ticked row: every grid view's selection bar |
2728

28-
Until protocol 19: `list_toolbar` (now `list`), `list_item` (`record_row`), `record_header` / `record_more` (`record_page`).
29+
Until protocol 19: `list_toolbar` (now `list`), `list_item` (`record_row`), `record_header` / `record_more` (`record_page`), a view's `bulkActions` (`selection`).
2930

3031
## Button Order (`actionLayout`)
3132

@@ -35,7 +36,8 @@ The object's `actionLayout` arranges one scope per arm:
3536
goes to the ⋯ menu, those `more` names first. `record` takes `record` /
3637
`record_page` actions wherever that header draws (record page, side preview,
3738
phone bar, a row's ⋮ menu order); `list` takes `list` actions and may
38-
pin `$import` / `$export` (pinned only). `os validate` refuses a name the arm's
39+
pin `$import` / `$export` (pinned only); `selection` takes `selection`
40+
actions. `os validate` refuses a name the arm's
3941
scope does not place, on the object or an extension of one the same stack
4042
defines. On an installed object only its paired `.custom` package's extension
4143
writes it (as `fieldGroups`, objectstack-data), each arm whole, not judged
@@ -55,7 +57,7 @@ there: a wrong name draws nothing.
5557
- 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`.
5658
- 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.
5759
- `undoable: true` — an **Undo** in the success toast (and `Ctrl+Z`). Snapshot: runtime on `operation: 'update'`, console on `type: 'api'`; else refused.
58-
- A list view's `bulkActions: ['<name>']` runs it 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.
60+
- An action that writes each selected row is placed at `selection`: declare `execution: 'perRecord'` and write the row it is handed (`ctx.record`, `ctx.recordId`); 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; 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.
5961

6062
<!-- os:check -->
6163
```typescript
@@ -112,6 +114,7 @@ export const AddToCampaignAction = defineAction({
112114
name: 'crm_create_campaign',
113115
label: 'Add to Campaign',
114116
objectName: 'lead',
117+
locations: ['selection'],
115118
type: 'script',
116119
execution: 'perRecord',
117120
params: [{ field: 'campaign_id', objectOverride: 'campaign', required: true }],

0 commit comments

Comments
 (0)