From 7ed0116ce7af147e69840fc214960dea88b99680 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 09:27:54 +0000 Subject: [PATCH] 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 --- .../38552-skills-bulk-actions-selection.md | 24 +++++++++++++++++++ skills/objectstack-i18n/SKILL.md | 6 ++--- .../evals/views-apps-actions-pages.json | 12 +++++----- skills/objectstack-ui/rules/actions.md | 23 ++++++++++-------- 4 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 .changeset/38552-skills-bulk-actions-selection.md diff --git a/.changeset/38552-skills-bulk-actions-selection.md b/.changeset/38552-skills-bulk-actions-selection.md new file mode 100644 index 00000000000..d932983bfa3 --- /dev/null +++ b/.changeset/38552-skills-bulk-actions-selection.md @@ -0,0 +1,24 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): the objectstack-ui actions rule teaches a bulk action placed at `selection`, in place of a list view's retired `bulkActions` list + +Clause-②: no +Metadata-protocol: none + +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. + +`skills/objectstack-ui/rules/actions.md`: + +- 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`). +- The `actionLayout` paragraph names the third arm: `selection` takes the actions placed at `selection`, with the same `pinned` / `more` parts as the other two. +- The opening paragraph's `action-no-placement` sentence lists the two ways a view still places an action by name, `rowActions` and `bulkActionDefs`. +- 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. +- The checked `crm_create_campaign` example declares `locations: ['selection']`. Without it the example taught an action no surface draws. + +`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. + +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)". + +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. diff --git a/skills/objectstack-i18n/SKILL.md b/skills/objectstack-i18n/SKILL.md index d960c04cf56..38e7795c013 100644 --- a/skills/objectstack-i18n/SKILL.md +++ b/skills/objectstack-i18n/SKILL.md @@ -77,7 +77,7 @@ bundles; delete it and the shipped value returns. objects.{object}: label, pluralLabel, description fields.{field}: label, help, placeholder, options.{value}, inlineTitle, relatedListTitle _views.{view}: label, description, title, emptyState.{title,message}, - submitBehavior.{title,message}, bulkActions.{def} + submitBehavior.{title,message}, bulkActions.{bulkActionDefs_name} _actions.{action}: label, description, confirmText, submitText, cancelText, successMessage, disabledReason, params.{param}(.options.{value}), outcomeMessages.{outcome}, resultDialog.{title,description,acknowledge}, @@ -118,8 +118,8 @@ messages: flat dotted ids ('common.save'); dashboards, metadataForms, settingsCo (`reports.showcase_task_overview.blocks.open_block.label`); a `books` group by its stable `key`, never its position (`books.crm_manual.groups.getting_started.label`); its pages localize through `doc.translations`. -- A flow step is keyed under `approvals` (approval), `screens` (screen) or `nodes` (any - other). `os i18n check` asks for a technical step (`script`, `http`, `connector_action`, +- A flow step is keyed under `approvals`, `screens` or `nodes` (any other kind). + `os i18n check` asks for a technical step (`script`, `http`, `connector_action`, `assignment`, `boundary_event`, `*_record`) only where a decision's branch leads to it. ## Traps diff --git a/skills/objectstack-ui/evals/views-apps-actions-pages.json b/skills/objectstack-ui/evals/views-apps-actions-pages.json index 8e22b42557f..83b44c35770 100644 --- a/skills/objectstack-ui/evals/views-apps-actions-pages.json +++ b/skills/objectstack-ui/evals/views-apps-actions-pages.json @@ -24,11 +24,11 @@ { "id": 3, "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.", - "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: ['']`, 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`.", + "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`.", "files": [], "assertions": { - "must_contain": ["defineAction", "locations", "'record'", "bulkActions", "visible", "successMessage", "ctx.recordId"], - "must_not_contain": ["{record.", "input.selectedIds"] + "must_contain": ["defineAction", "locations", "'record'", "'selection'", "visible", "successMessage", "ctx.recordId"], + "must_not_contain": ["{record.", "input.selectedIds", "bulkActions: ["] } }, { @@ -224,11 +224,11 @@ { "id": 23, "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.", - "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).", + "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).", "files": [], "assertions": { - "must_contain": ["perRecord", "bulkActions: [", "ctx.record"], - "must_not_contain": ["succeeded:", "{ succeeded", "{ failed"] + "must_contain": ["perRecord", "'selection'", "ctx.record"], + "must_not_contain": ["succeeded:", "{ succeeded", "{ failed", "bulkActions: ["] } }, { diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index 6af00cebe8e..a3dc51ffd91 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -7,7 +7,7 @@ Register them under `defineStack({ actions: [...] })`; the six types: folds the action into that object's surfaces: `locations` without it is refused at validate and publish (`action-no-object-binding`; set it, or `locations: []` if headless). With neither `locations` nor a view naming it in -`rowActions` / `bulkActions` / `bulkActionDefs` it renders nowhere (`action-no-placement`). A body +`rowActions` / `bulkActionDefs` it renders nowhere (`action-no-placement`). A body that returns or assigns values writes nothing (`action-record-write-discarded`): it calls `ctx.api.object(...).update(...)` 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 ## Where Actions Appear (`locations`) -| Value | Acts on, and where | -|:-----------------|:--------| -| `list` | No record: the list page toolbar; one ticked row is its `recordId`, several are refused (no `_selectedIds`) | -| `record` | One record, the default: the record page and each list row | -| `record_page` | The record page only; `component: 'action:menu'` puts it in the ⋯ menu | -| `record_row` | Each list row only | +| Value | Acts on, and where | +|:--|:--| +| `list` | No record: the list page toolbar; one ticked row is its `recordId`, several are refused (no `_selectedIds`) | +| `record` | One record, the default: the record page and each list row | +| `record_page` | The record page only; `component: 'action:menu'` puts it in the ⋯ menu | +| `record_row` | Each list row only | | `record_related` | Related-list section in a record | | `record_section` | Body section/tab of a record | +| `selection` | Many records, once per ticked row: every grid view's selection bar | -Until protocol 19: `list_toolbar` (now `list`), `list_item` (`record_row`), `record_header` / `record_more` (`record_page`). +Until protocol 19: `list_toolbar` (now `list`), `list_item` (`record_row`), `record_header` / `record_more` (`record_page`), a view's `bulkActions` (`selection`). ## Button Order (`actionLayout`) @@ -35,7 +36,8 @@ The object's `actionLayout` arranges one scope per arm: goes to the ⋯ menu, those `more` names first. `record` takes `record` / `record_page` actions wherever that header draws (record page, side preview, phone bar, a row's ⋮ menu order); `list` takes `list` actions and may -pin `$import` / `$export` (pinned only). `os validate` refuses a name the arm's +pin `$import` / `$export` (pinned only); `selection` takes `selection` +actions. `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 @@ -55,7 +57,7 @@ there: a wrong name draws nothing. - 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`. - 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. - `undoable: true` — an **Undo** in the success toast (and `Ctrl+Z`). Snapshot: runtime on `operation: 'update'`, console on `type: 'api'`; else refused. -- A list view's `bulkActions: ['']` 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. +- 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. ```typescript @@ -112,6 +114,7 @@ export const AddToCampaignAction = defineAction({ name: 'crm_create_campaign', label: 'Add to Campaign', objectName: 'lead', + locations: ['selection'], type: 'script', execution: 'perRecord', params: [{ field: 'campaign_id', objectOverride: 'campaign', required: true }],