From e9bebf983ffa702f782d5a584ebb67bed3d1338a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:18:47 +0000 Subject: [PATCH 1/9] wip(spec): selection location, selection arm, retire view bulkActions Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK Co-Authored-By: Claude --- .../view-bulk-actions-to-action-selection.ts | 442 ++++++++++++++++++ packages/spec/src/conversions/registry.ts | 5 + .../spec/src/data/object-action-layout.ts | 27 +- .../19.ui__ListView__bulkActions.ts | 11 + .../19.ui__ObjectListView__bulkActions.ts | 11 + ...iew-bulk-actions-declared-on-the-action.ts | 40 ++ .../spec/src/migrations/registry.ts.template | 5 +- .../src/migrations/semantic-relevance.test.ts | 1 + .../retired-key-removal-version.pin.test.ts | 6 + packages/spec/src/ui/action.metadata-form.ts | 2 +- packages/spec/src/ui/action.zod.ts | 20 +- packages/spec/src/ui/bulk-action.zod.ts | 39 +- packages/spec/src/ui/component.zod.ts | 31 +- packages/spec/src/ui/view.zod.ts | 29 +- 14 files changed, 625 insertions(+), 44 deletions(-) create mode 100644 packages/spec/src/conversions/entries/19/view-bulk-actions-to-action-selection.ts create mode 100644 packages/spec/src/migrations/entries/retired-keys/19.ui__ListView__bulkActions.ts create mode 100644 packages/spec/src/migrations/entries/retired-keys/19.ui__ObjectListView__bulkActions.ts create mode 100644 packages/spec/src/migrations/entries/semantic/19.view-bulk-actions-declared-on-the-action.ts diff --git a/packages/spec/src/conversions/entries/19/view-bulk-actions-to-action-selection.ts b/packages/spec/src/conversions/entries/19/view-bulk-actions-to-action-selection.ts new file mode 100644 index 00000000000..72d09ef07dd --- /dev/null +++ b/packages/spec/src/conversions/entries/19/view-bulk-actions-to-action-selection.ts @@ -0,0 +1,442 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +// The `view-bulk-actions-to-action-selection` conversion (`toMajor: 19`; +// objectstack#36496, step 2 of the maintainer's rulings on #36495). A LEAF: it +// imports neither `registry.ts` nor another conversion's module. `registry.ts` +// imports `viewBulkActionsToActionSelection` and lists it in +// `MAJOR_19_CONVERSIONS`. + +import type { ConversionApplication, ConversionContext, MetadataConversion } from '../../types.js'; +import { mapCollection, mapPageComponents, mapViewPayloads } from '../../walk.js'; +import { type Dict, isDict } from '../shared.js'; + +/** + * A selection's actions are declared on the action (protocol 19). + * + * Until 19 a list view's `bulkActions` named the actions its selection bar + * offered once two or more rows were selected. Those actions are the object's, + * so protocol 19 declares them where every other placement is declared: an + * action placed at `selection` is drawn on the selection bar of every grid of + * its object, and the object's `actionLayout.selection` orders the bar. A + * view's own `bulkActionDefs` stay on the view. + * + * ## The rewrite + * + * For each list payload that carries `bulkActions` — a `views[]` container's + * `list` / `listViews.*`, a ViewItem record's `config`, a flattened overlay, + * an object's own `listViews.*`, and a page `list-view` block's `properties`: + * + * - every action the list names gains `'selection'` at the end of its + * `locations` (an action with no `locations`, or headless `[]`, gets + * `['selection']`: it was drawn on the bar and nowhere else, and still is); + * - the key is deleted. + * + * The bar's order was the list's. Where the object's lists, merged in walk + * order, already read in the bar's default order (`order` ascending, unset 0, + * then the object's own actions before the stack's actions bound to it, each + * in declaration order), nothing more is written. Where they do not, the + * object gains `actionLayout.selection`: the first three names pinned, the + * rest in `more` — the first three were the bar's buttons, the rest its 「More」. + * + * Every view of the object then draws the same actions, which is the change + * itself: a view that listed none now draws the ones another view listed. + * + * ## Left as stored, with a TODO (ADR-0087 D3) + * + * The move needs the view, the actions it names and, for the order, the + * object, in one stack. A stored `view` row arrives alone (no actions), so at + * rest every list is a TODO; built artifacts and sources carry the whole stack + * and convert. Every view of an object is left as stored when any of them: + * + * - names an action the stack does not declare on the view's object (another + * package's action, a misspelling), or its object cannot be told; + * - names `delete`, the grid's built-in bulk Delete: it is no action, so no + * location can carry it; + * - lists the same actions in an order another list of the object contradicts; + * - needs `actionLayout.selection` on an object the stack does not declare, or + * on one that already has a `selection` arm. + * + * A list left as stored is refused by the protocol-19 schema until it is + * moved by hand. + * + * ## Where it replays + * + * Retired from the load path, as the other protocol-19 entries are: an author + * writing `bulkActions` meets the tombstone's prescription at parse. Built + * artifacts and `os migrate meta --from 18` replay it. Idempotent by + * construction: it acts only on a `bulkActions` key, which it deletes. + */ + +/** Where one action of the stack sits. */ +interface ActionSite { + readonly action: Dict; + /** `actions[i]` or `objects[j].actions[i]`. */ + readonly path: string; +} + +/** One list payload that carries `bulkActions`. */ +interface ListSite { + readonly path: string; + readonly object: string | undefined; + readonly value: unknown; +} + +const OBJECT_SELECTION_ACTIONS_LIMIT = 3; + +function stringOf(v: unknown): string | undefined { + return typeof v === 'string' && v.length > 0 ? v : undefined; +} + +/** The object a list payload lists: its `data` binding, else its own `object`, else its container's. */ +function payloadObject(payload: Dict, container?: Dict): string | undefined { + const data = payload.data; + if (isDict(data) && data.provider === 'object') { + const bound = stringOf(data.object); + if (bound) return bound; + } + return stringOf(payload.object) ?? (container ? stringOf(container.object) ?? stringOf(container.name) : undefined); +} + +/** Every action of the stack, per object, in the bar's default declaration order. */ +function actionsByObject(stack: Dict): Map { + const out = new Map(); + const add = (object: string, site: ActionSite) => { + const list = out.get(object) ?? []; + list.push(site); + out.set(object, list); + }; + const objects = Array.isArray(stack.objects) ? stack.objects : []; + objects.forEach((obj, oi) => { + if (!isDict(obj)) return; + const object = stringOf(obj.name); + if (!object || !Array.isArray(obj.actions)) return; + obj.actions.forEach((action, ai) => { + if (isDict(action)) add(object, { action, path: `objects[${oi}].actions[${ai}]` }); + }); + }); + const actions = Array.isArray(stack.actions) ? stack.actions : []; + actions.forEach((action, ai) => { + if (!isDict(action)) return; + const object = stringOf(action.objectName); + if (object) add(object, { action, path: `actions[${ai}]` }); + }); + return out; +} + +/** Every list payload that carries `bulkActions`, read only. */ +function collectLists(stack: Dict): ListSite[] { + const sites: ListSite[] = []; + const views = Array.isArray(stack.views) ? stack.views : []; + mapViewPayloads(stack, (payload, kind, path) => { + if (kind !== 'list' || !Object.prototype.hasOwnProperty.call(payload, 'bulkActions')) return payload; + const index = /^views\[(\d+)\]/.exec(path); + const container = index ? views[Number(index[1])] : undefined; + sites.push({ path, object: payloadObject(payload, isDict(container) ? container : undefined), value: payload.bulkActions }); + return payload; + }); + mapCollection(stack, 'objects', (obj, path) => { + if (!isDict(obj.listViews)) return obj; + for (const [name, entry] of Object.entries(obj.listViews)) { + if (isDict(entry) && Object.prototype.hasOwnProperty.call(entry, 'bulkActions')) { + sites.push({ path: `${path}.listViews.${name}`, object: stringOf(obj.name), value: entry.bulkActions }); + } + } + return obj; + }); + mapPageComponents(stack, (component, path) => { + const props = component.properties; + if (component.type === 'list-view' && isDict(props) && Object.prototype.hasOwnProperty.call(props, 'bulkActions')) { + sites.push({ path: `${path}.properties`, object: payloadObject(props), value: props.bulkActions }); + } + return component; + }); + return sites; +} + +/** What the conversion does with one object's lists. */ +interface ObjectPlan { + readonly lists: ListSite[]; + /** The names, merged in walk order. */ + names: string[]; + /** Why every list of the object stays as stored, or `undefined`. */ + todo?: string; + /** The arm to write, or `undefined`. */ + arm?: { pinned: string[]; more?: string[] }; + /** `objects[j]`, when the stack declares the object. */ + objectPath?: string; +} + +function rank(action: Dict): number { + return typeof action.order === 'number' ? action.order : 0; +} + +function planObject( + object: string | undefined, + lists: ListSite[], + sites: readonly ActionSite[], + stack: Dict, +): ObjectPlan { + const plan: ObjectPlan = { lists, names: [] }; + if (!object) { + plan.todo = 'The object this list view lists cannot be told (no `data: { provider: \'object\', object }` ' + + 'and no `object` on the view), so the actions it names cannot be found. Left as stored; add ' + + '`\'selection\'` to the `locations` of each action it names, on its object, and delete the key.'; + return plan; + } + const declared = new Map(); + for (const site of sites) { + const name = stringOf(site.action.name); + if (name && !declared.has(name)) declared.set(name, site); + } + for (const list of lists) { + if (!Array.isArray(list.value)) { + plan.todo = `A \`bulkActions\` of object \`${object}\` is not a list of action names, so there is nothing to ` + + 'move. Left as stored; delete the key, and add `\'selection\'` to the `locations` of each action the ' + + 'selection bar should draw.'; + return plan; + } + const names = [...new Set(list.value.filter((n): n is string => typeof n === 'string' && n.length > 0))]; + if (names.some((n) => n.toLowerCase() === 'delete')) { + plan.todo = `A list view of object \`${object}\` names \`delete\` in \`bulkActions\`: that is the grid's ` + + 'built-in bulk Delete, not an action, so no location carries it. In protocol 19 the bar draws the ' + + 'built-in Delete wherever the object allows a delete. Left as stored; delete the key, and add ' + + '`\'selection\'` to the `locations` of each other action it names.'; + return plan; + } + const missing = names.filter((n) => !declared.has(n)); + if (missing.length > 0) { + plan.todo = `A list view of object \`${object}\` names ${missing.map((n) => `\`${n}\``).join(', ')} in ` + + '`bulkActions`, which this metadata does not declare as an action of that object (it may be another ' + + 'package\'s action, a stored view read alone, or a misspelling). Left as stored; add `\'selection\'` to ' + + 'the `locations` of each action it names, on its object, and delete the key.'; + return plan; + } + for (const name of names) if (!plan.names.includes(name)) plan.names.push(name); + } + // One order for the bar: each list must read in the merged order. + for (const list of lists) { + const names = [...new Set((list.value as unknown[]).filter((n): n is string => typeof n === 'string' && n.length > 0))]; + const merged = plan.names.filter((n) => names.includes(n)); + if (merged.join('\u0000') !== names.join('\u0000')) { + plan.todo = `The list views of object \`${object}\` order their \`bulkActions\` differently, and one selection ` + + 'bar draws one order for every view. Left as stored; add `\'selection\'` to the `locations` of each ' + + 'action they name, write the order you choose as the object\'s `actionLayout.selection`, and delete ' + + 'the key on each view.'; + return plan; + } + } + const byDefault = sites + .map((site, i) => ({ site, i })) + .sort((a, b) => rank(a.site.action) - rank(b.site.action) || a.i - b.i) + .map(({ site }) => stringOf(site.action.name)) + .filter((n): n is string => !!n && plan.names.includes(n)) + .filter((n, i, all) => all.indexOf(n) === i); + if (byDefault.join('\u0000') === plan.names.join('\u0000')) return plan; + + const objects = Array.isArray(stack.objects) ? stack.objects : []; + const oi = objects.findIndex((o) => isDict(o) && o.name === object); + const target = oi >= 0 ? (objects[oi] as Dict) : undefined; + const layout = target?.actionLayout; + if (!target || (isDict(layout) && layout.selection !== undefined)) { + plan.todo = `The selection bar of object \`${object}\` drew its actions in the order its list views name ` + + `them (${plan.names.map((n) => `\`${n}\``).join(', ')}), which is not their default order, and keeping it ` + + `needs the object's \`actionLayout.selection\`, which ${target ? 'it already declares' : 'this metadata does not declare the object to carry'}. ` + + 'Left as stored; add `\'selection\'` to the `locations` of each action they name, write the order as ' + + 'the object\'s `actionLayout.selection`, and delete the key on each view.'; + return plan; + } + const pinned = plan.names.slice(0, OBJECT_SELECTION_ACTIONS_LIMIT); + const more = plan.names.slice(OBJECT_SELECTION_ACTIONS_LIMIT); + plan.arm = more.length > 0 ? { pinned, more } : { pinned }; + plan.objectPath = `objects[${oi}]`; + return plan; +} + +/** The TODO path of one list. */ +function todoAt(list: ListSite): string { + return `${list.path}.bulkActions`; +} + +function convert(stack: Dict, emit: (detail: ConversionApplication) => void, context: ConversionContext | undefined): Dict { + const lists = collectLists(stack); + if (lists.length === 0) return stack; + const sitesByObject = actionsByObject(stack); + + const byObject = new Map(); + for (const list of lists) { + const group = byObject.get(list.object) ?? []; + group.push(list); + byObject.set(list.object, group); + } + + /** The list paths that move, and the action paths that gain `selection`. */ + const moving = new Set(); + const gaining = new Set(); + const arms = new Map(); + for (const [object, group] of byObject) { + const plan = planObject(object, group, object ? sitesByObject.get(object) ?? [] : [], stack); + if (plan.todo) { + for (const list of group) context?.reportTodo?.({ path: todoAt(list), from: JSON.stringify(list.value), reason: plan.todo }); + continue; + } + for (const list of group) moving.add(list.path); + const sites = object ? sitesByObject.get(object) ?? [] : []; + for (const name of plan.names) { + const site = sites.find((s) => s.action.name === name); + if (site) gaining.add(site.path); + } + if (plan.arm && plan.objectPath) arms.set(plan.objectPath, plan.arm); + } + if (moving.size === 0) return stack; + + const strip = (payload: Dict, path: string): Dict => { + if (!moving.has(path)) return payload; + const { bulkActions, ...rest } = payload; + emit({ from: JSON.stringify(bulkActions), to: '(removed)', path: `${path}.bulkActions` }); + return rest; + }; + const gain = (action: Dict, path: string): Dict => { + if (!gaining.has(path)) return action; + const locations = Array.isArray(action.locations) ? action.locations : []; + if (locations.includes('selection')) return action; + const next = [...locations, 'selection']; + emit({ from: action.locations === undefined ? '(omitted)' : JSON.stringify(action.locations), to: JSON.stringify(next), path: `${path}.locations` }); + return { ...action, locations: next }; + }; + + let next = mapViewPayloads(stack, (payload, kind, path) => (kind === 'list' ? strip(payload, path) : payload)); + next = mapCollection(next, 'actions', gain); + next = mapCollection(next, 'objects', (obj, path) => { + let out = mapCollection(obj, 'actions', (action, actionPath) => gain(action, `${path}.${actionPath}`)); + if (isDict(out.listViews)) { + let changed = false; + const rebuilt: Dict = { ...out.listViews }; + for (const [name, entry] of Object.entries(out.listViews)) { + if (!isDict(entry)) continue; + const mapped = strip(entry, `${path}.listViews.${name}`); + if (mapped !== entry) { + rebuilt[name] = mapped; + changed = true; + } + } + if (changed) out = { ...out, listViews: rebuilt }; + } + const arm = arms.get(path); + if (arm) { + emit({ from: '(omitted)', to: JSON.stringify(arm), path: `${path}.actionLayout.selection` }); + out = { ...out, actionLayout: { ...(isDict(out.actionLayout) ? out.actionLayout : {}), selection: arm } }; + } + return out; + }); + return mapPageComponents(next, (component, path) => { + if (component.type !== 'list-view' || !isDict(component.properties)) return component; + const mapped = strip(component.properties, `${path}.properties`); + return mapped === component.properties ? component : { ...component, properties: mapped }; + }); +} + +const viewBulkActionsToActionSelection: MetadataConversion = { + id: 'view-bulk-actions-to-action-selection', + toMajor: 19, + retiredFromLoadPath: true, + retiredAfter: '18.6.0', + surface: 'view.list.bulkActions / view.listViews.*.bulkActions / object.listViews.*.bulkActions / ' + + 'page.component.list-view.bulkActions / action.locations / object.actions[].locations / ' + + 'object.actionLayout.selection', + summary: + "a list view's bulkActions move onto the actions they name: each gains the 'selection' location, the key is " + + "deleted, and where the names were not in the bar's default order the object gains actionLayout.selection " + + '(the first three pinned, the rest in more), so the selection bar draws every action it drew', + apply(stack, emit, context) { + return convert(stack, emit, context); + }, + fixture: { + before: { + objects: [{ + name: 'crm_lead', + label: 'Lead', + actions: [{ name: 'assign_lead', label: 'Assign', type: 'script', locations: ['record'] }], + }], + actions: [ + { name: 'merge_leads', label: 'Merge', objectName: 'crm_lead', type: 'script' }, + { name: 'score_lead', label: 'Score', objectName: 'crm_lead', type: 'script', locations: ['record_row'] }, + { name: 'nurture_lead', label: 'Nurture', objectName: 'crm_lead', type: 'script', locations: [] }, + { name: 'tag_lead', label: 'Tag', objectName: 'crm_lead', type: 'script', locations: ['record'] }, + { name: 'sync_task', label: 'Sync', objectName: 'crm_task', type: 'script', locations: ['record'] }, + ], + views: [ + { + list: { + type: 'grid', + data: { provider: 'object', object: 'crm_lead' }, + columns: ['name'], + // Not the default order (`assign_lead` is the object's own, so first by default). + bulkActions: ['merge_leads', 'assign_lead', 'score_lead', 'nurture_lead'], + }, + listViews: { + hot: { + type: 'grid', + data: { provider: 'object', object: 'crm_lead' }, + columns: ['name'], + bulkActions: ['merge_leads', 'nurture_lead', 'tag_lead'], + bulkActionDefs: [{ name: 'close_all', operation: 'update', patch: { status: 'closed' } }], + }, + }, + }, + { + list: { + type: 'grid', + data: { provider: 'object', object: 'crm_task' }, + columns: ['subject'], + bulkActions: ['sync_task'], + }, + }, + ], + }, + after: { + objects: [{ + name: 'crm_lead', + label: 'Lead', + actions: [{ name: 'assign_lead', label: 'Assign', type: 'script', locations: ['record', 'selection'] }], + actionLayout: { + selection: { pinned: ['merge_leads', 'assign_lead', 'score_lead'], more: ['nurture_lead', 'tag_lead'] }, + }, + }], + actions: [ + { name: 'merge_leads', label: 'Merge', objectName: 'crm_lead', type: 'script', locations: ['selection'] }, + { name: 'score_lead', label: 'Score', objectName: 'crm_lead', type: 'script', locations: ['record_row', 'selection'] }, + { name: 'nurture_lead', label: 'Nurture', objectName: 'crm_lead', type: 'script', locations: ['selection'] }, + { name: 'tag_lead', label: 'Tag', objectName: 'crm_lead', type: 'script', locations: ['record', 'selection'] }, + { name: 'sync_task', label: 'Sync', objectName: 'crm_task', type: 'script', locations: ['record', 'selection'] }, + ], + views: [ + { + list: { + type: 'grid', + data: { provider: 'object', object: 'crm_lead' }, + columns: ['name'], + }, + listViews: { + hot: { + type: 'grid', + data: { provider: 'object', object: 'crm_lead' }, + columns: ['name'], + bulkActionDefs: [{ name: 'close_all', operation: 'update', patch: { status: 'closed' } }], + }, + }, + }, + { + list: { + type: 'grid', + data: { provider: 'object', object: 'crm_task' }, + columns: ['subject'], + }, + }, + ], + }, + // Three lists deleted, six actions gain `selection`, one arm written. + expectedNotices: 10, + }, +}; + +export { viewBulkActionsToActionSelection }; diff --git a/packages/spec/src/conversions/registry.ts b/packages/spec/src/conversions/registry.ts index 7da1e19098e..4dfdacbae24 100644 --- a/packages/spec/src/conversions/registry.ts +++ b/packages/spec/src/conversions/registry.ts @@ -146,6 +146,7 @@ import { knowledgeSourceContentFieldsToContent } from './entries/19/knowledge-so import { knowledgeSourceIdToName } from './entries/19/knowledge-source-id-to-name.js'; import { knowledgeSourceInertKeysRemoved } from './entries/19/knowledge-source-inert-keys-removed.js'; import { permissionViewAllFieldsBesideRecordBypass } from './entries/19/permission-view-all-fields-beside-record-bypass.js'; +import { viewBulkActionsToActionSelection } from './entries/19/view-bulk-actions-to-action-selection.js'; /** * One conversion of an OPEN major, with its place in that major's application @@ -353,6 +354,10 @@ const MAJOR_19_CONVERSIONS: readonly OrderedConversion[] = [ { conversion: knowledgeSourceIdToName, order: 1 }, { conversion: knowledgeSourceInertKeysRemoved, order: 3 }, { conversion: permissionViewAllFieldsBesideRecordBypass, order: 1 }, + // AFTER `actionLocationsActedOn`: it appends `selection` to the locations of + // the actions a view's `bulkActions` names, which that entry never rewrites, + // so the order is for reading, not for the result. + { conversion: viewBulkActionsToActionSelection, order: 5 }, ]; /** diff --git a/packages/spec/src/data/object-action-layout.ts b/packages/spec/src/data/object-action-layout.ts index db190db10ff..65205c02153 100644 --- a/packages/spec/src/data/object-action-layout.ts +++ b/packages/spec/src/data/object-action-layout.ts @@ -25,6 +25,14 @@ import { strictObject } from '../shared/strict-object'; * actions `pinned` names come first, then those `more` names, then the rest * as before. The selection bar's buttons, at most three, are the first of * that order; a row's own inline button does not change. + * - `selection`: the actions that act on many records (placed at + * `selection`), drawn on the selection bar a grid shows once two or more of + * its rows are selected, on every grid view of the object + * (objectstack#36496). `pinned` names the bar's buttons, in order; every + * other action, the built-in Delete and Change Owner included, is in the + * bar's 「More」, the ones `more` names first. Without + * the arm, the bar draws them in their default order, the first three as + * buttons. A view's own `bulkActionDefs` lead the bar, as before. * * An arm is a scope, not a page: one arm arranges one set of actions wherever * that set is drawn. The key only re-arranges, so it sits on the object as a @@ -69,17 +77,18 @@ import { strictObject } from '../shared/strict-object'; export const OBJECT_ACTION_LAYOUT_PINNED_LIMIT = 3; /** The action scopes an object's actions are arranged in. */ -export const OBJECT_ACTION_LAYOUT_SCOPES = ['list', 'record'] as const; +export const OBJECT_ACTION_LAYOUT_SCOPES = ['list', 'record', 'selection'] as const; export type ObjectActionLayoutScope = (typeof OBJECT_ACTION_LAYOUT_SCOPES)[number]; /** * The built-in buttons an arm may name beside the object's actions, per scope. * The list page's import and export are the console's own buttons, not object - * actions; the record scope has none. + * actions; the record and selection scopes have none. */ export const OBJECT_ACTION_LAYOUT_BUILTINS: Readonly> = { list: ['$import', '$export'], record: [], + selection: [], }; /** @@ -134,6 +143,7 @@ function moreEntries(scope: ObjectActionLayoutScope) { const PINNED_NONE: Readonly> = { list: '`[]` pins none: every action goes to 「More」, and the list page still draws its own Import / Export menu.', record: '`[]` pins none: every action goes to 「More」; New, Edit and Delete keep their fixed places.', + selection: '`[]` pins none: every action goes to the selection bar\'s 「More」, Delete included.', }; function layoutArm(scope: ObjectActionLayoutScope) { @@ -194,7 +204,7 @@ export const OBJECT_ACTION_LAYOUT_SCHEMA = strictObject( surface: "this object's `actionLayout`", // Closed from its first release (objectstack#36366). history: 'Closed from its first release: no key here was ever dropped silently.', - aliases: { listPage: 'list', recordPage: 'record', detail: 'record' }, + aliases: { listPage: 'list', recordPage: 'record', detail: 'record', bulk: 'selection', bulkActions: 'selection' }, }, { list: layoutArm('list') @@ -214,11 +224,20 @@ export const OBJECT_ACTION_LAYOUT_SCHEMA = strictObject( "the rest as before). The selection bar's buttons, at most three, are the first of that order; a row's own " + 'inline button does not change. Omit to draw each as before.', ), + selection: layoutArm('selection') + .optional() + .describe( + "The selection scope's arrangement: actions of the object placed at `selection`, as drawn on the " + + 'selection bar a grid shows once two or more rows are selected, on every grid view of the object. ' + + "`pinned` names the bar's buttons, in order; the rest, Delete included, are in the bar's 「More」, the ones `more` names " + + "first. A view's own `bulkActionDefs` lead the bar. Omit to draw them in their default order, the " + + 'first three as buttons.', + ), }, ) .optional() .describe( - "The order of the object's actions and which are buttons, per action scope (`list`, `record`): `pinned` " + + "The order of the object's actions and which are buttons, per action scope (`list`, `record`, `selection`): `pinned` " + '(at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default ' + "order). Omit to keep each surface's own choice (each action's `order`).", ); diff --git a/packages/spec/src/migrations/entries/retired-keys/19.ui__ListView__bulkActions.ts b/packages/spec/src/migrations/entries/retired-keys/19.ui__ListView__bulkActions.ts new file mode 100644 index 00000000000..919fc48b890 --- /dev/null +++ b/packages/spec/src/migrations/entries/retired-keys/19.ui__ListView__bulkActions.ts @@ -0,0 +1,11 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +// #36496 (maintainer rulings on the card: actions are arranged on the object, +// split by list and record; all three kinds are declared by the action, step +// 2). A list view's `bulkActions` named the actions its selection bar drew; +// those actions are the object's, so an action now declares `selection` in +// its `locations` and the object's `actionLayout.selection` orders the bar. +// Tombstoned with `retiredKey()`; `bulkActionDefs` stay on the view. D2: +// `view-bulk-actions-to-action-selection`; D3: +// `view-bulk-actions-declared-on-the-action`. +export const entry = 'ui/ListView:bulkActions'; diff --git a/packages/spec/src/migrations/entries/retired-keys/19.ui__ObjectListView__bulkActions.ts b/packages/spec/src/migrations/entries/retired-keys/19.ui__ObjectListView__bulkActions.ts new file mode 100644 index 00000000000..167f9a3b7f5 --- /dev/null +++ b/packages/spec/src/migrations/entries/retired-keys/19.ui__ObjectListView__bulkActions.ts @@ -0,0 +1,11 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +// #36496 (maintainer rulings on the card: actions are arranged on the object, +// split by list and record; all three kinds are declared by the action, step +// 2). A list view's `bulkActions` named the actions its selection bar drew; +// those actions are the object's, so an action now declares `selection` in +// its `locations` and the object's `actionLayout.selection` orders the bar. +// Tombstoned with `retiredKey()`; `bulkActionDefs` stay on the view. D2: +// `view-bulk-actions-to-action-selection`; D3: +// `view-bulk-actions-declared-on-the-action`. +export const entry = 'ui/ObjectListView:bulkActions'; diff --git a/packages/spec/src/migrations/entries/semantic/19.view-bulk-actions-declared-on-the-action.ts b/packages/spec/src/migrations/entries/semantic/19.view-bulk-actions-declared-on-the-action.ts new file mode 100644 index 00000000000..f0d1ac9a3b1 --- /dev/null +++ b/packages/spec/src/migrations/entries/semantic/19.view-bulk-actions-declared-on-the-action.ts @@ -0,0 +1,40 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { SemanticMigration } from '../../types.js'; + +// #36496 — step 2 of the maintainer's rulings on #36495 (actions are arranged +// on the object, split by list and record; all three kinds are declared by the +// action) — the D3 entry of the move of a list view's `bulkActions` onto the +// actions. The data half is mechanical where one stack holds the views, the +// actions and the object (the D2 conversion +// `view-bulk-actions-to-action-selection`); what it cannot do is a list it +// leaves as stored, and the change every other view of the object sees. +export const entry: SemanticMigration = { + id: 'view-bulk-actions-declared-on-the-action', + surface: 'view.list.bulkActions — retired; `selection` joined `action.locations`, and `selection` joined the ' + + 'scopes of `object.actionLayout`', + replacement: + 'add `\'selection\'` to the `locations` of each action the selection bar should draw: it is drawn on the ' + + 'selection bar of every grid of its object, once two or more rows are selected, and run once per selected ' + + 'record. The object\'s `actionLayout.selection` (`{ pinned, more }`) orders the bar and chooses its buttons. ' + + 'A view\'s own `bulkActionDefs` stay on the view and lead the bar', + reason: + 'The actions a selection offers are the object\'s, not one view\'s. The D2 conversion ' + + '`view-bulk-actions-to-action-selection` adds `selection` to every action a list names, deletes the key, ' + + 'and writes `actionLayout.selection` where the lists were not in the bar\'s default order. Two things are ' + + 'left to the upgrading author. First, every view of the object now draws the same actions: a view that ' + + 'listed none draws the ones another view listed, and a page or record child table that shows the object ' + + 'in a grid draws them too; the built-in bulk Delete is drawn wherever the object allows a delete, beside ' + + 'them. Second, the lists the conversion leaves as stored, each with a TODO: a stored `view` row read ' + + 'alone (its actions are not beside it), a list naming an action the metadata does not declare on the ' + + 'view\'s object or naming `delete`, lists of one object in contradicting orders, and an order that needs ' + + '`actionLayout.selection` on an object the metadata does not carry. A list left as stored is refused by ' + + 'the protocol-19 schema until it is moved by hand', + acceptanceCriteria: + 'No list view, object list view or page `list-view` block declares `bulkActions`; every action a selection ' + + 'bar should draw declares `selection` in its `locations`, and the object\'s `actionLayout.selection` states ' + + 'the order where the default order is not the one wanted. Every TODO the migration reports is moved by ' + + 'hand, and each stored view row that carried a list is saved again without it.', + conversionIds: ['view-bulk-actions-to-action-selection'], + relevantWhen: { kind: 'stack-declares', keys: ['views', 'objects', 'pages'] }, +}; diff --git a/packages/spec/src/migrations/registry.ts.template b/packages/spec/src/migrations/registry.ts.template index f0a97a6d8e1..84edaad8d12 100644 --- a/packages/spec/src/migrations/registry.ts.template +++ b/packages/spec/src/migrations/registry.ts.template @@ -3745,7 +3745,10 @@ const step19: MigrationStep = { + 'with their four keys, so a source indexes the records of one object. ' + 'A form view\'s `modalSize` leaves the shape, on a `form` item too: no form view opens in a dialog ' + 'since the console\'s New and Edit dialogs stopped loading one, so the key is deleted, which changes ' - + 'nothing a reader sees; the React `ObjectForm` block and the `object-form` page block keep their own.', + + 'nothing a reader sees; the React `ObjectForm` block and the `object-form` page block keep their own. ' + + 'A list view\'s `bulkActions` move onto the actions they name: each gains the `selection` location, ' + + 'drawn on the selection bar of every grid of its object, and the object\'s `actionLayout.selection` ' + + 'keeps the bar\'s order where the names were not in the default one.', // Derived, not listed, as step 18's are: every major-19 conversion graduates // into this step in the order `CONVERSIONS_BY_MAJOR[19]` applies them. Add a // conversion there, never here. diff --git a/packages/spec/src/migrations/semantic-relevance.test.ts b/packages/spec/src/migrations/semantic-relevance.test.ts index c41d5a76cd2..ee1ba9f3648 100644 --- a/packages/spec/src/migrations/semantic-relevance.test.ts +++ b/packages/spec/src/migrations/semantic-relevance.test.ts @@ -65,6 +65,7 @@ const EXPECTED_RELEVANCE: Readonly> = { '19:action-locations-page-parts-retired': ['actions', 'objects', 'pages'], '19:agent-model-provider-retired': ['agents'], '19:knowledge-source-publish-refuses-missing-references-and-gated-objects': ['knowledgeSources'], + '19:view-bulk-actions-declared-on-the-action': ['views', 'objects', 'pages'], }; /** The keys the evaluation reads as carriers of other definitions, never as a family. */ diff --git a/packages/spec/src/shared/retired-key-removal-version.pin.test.ts b/packages/spec/src/shared/retired-key-removal-version.pin.test.ts index 7ba9374cfd8..b7faf14ae3c 100644 --- a/packages/spec/src/shared/retired-key-removal-version.pin.test.ts +++ b/packages/spec/src/shared/retired-key-removal-version.pin.test.ts @@ -347,6 +347,12 @@ const JOIN: Readonly> = { 'action-locations-acted-on': (['list_toolbar', 'list_item', 'record_header', 'record_more'] as const).map((word) => refusal(`action.locations ${word}`, () => ActionLocationSchema.safeParse(word)), ), + // objectstack#36496: a list view's `bulkActions`, tombstoned on the list shape + // (and so on every list door built from it). + 'view-bulk-actions-to-action-selection': [ + tombstone(ListViewSchema, 'view.list', 'bulkActions'), + tombstone(ObjectListViewSchema, 'object.listViews.*', 'bulkActions'), + ], // #37856: the `ask_ai` action type (ADR-0160 D7), refused with one // prescription in every slot that takes an action type. 'action-type-ask-ai-removed': [ diff --git a/packages/spec/src/ui/action.metadata-form.ts b/packages/spec/src/ui/action.metadata-form.ts index 330d716e15e..79bf7c9eeca 100644 --- a/packages/spec/src/ui/action.metadata-form.ts +++ b/packages/spec/src/ui/action.metadata-form.ts @@ -245,7 +245,7 @@ export const actionForm = defineMetadataForm({ columns: 2, fields: [ // `bulkEnabled` input removed with the key (#3896 close-out): the - // multi-select toolbar reads the list view's bulkActions, never this. + // selection bar draws the actions placed at `selection`, never this. { field: 'ai', colSpan: 2, helpText: 'AI exposure (opt-in): set ai.exposed=true and write ai.description (≥40 chars) to make this callable by agents.' }, { field: 'recordIdParam', visibleWhen: "data.type == 'api'", colSpan: 1, helpText: 'Body parameter name for record ID' }, { field: 'recordIdField', visibleWhen: "data.type == 'api' && data.recordIdParam", colSpan: 1, helpText: 'Field to use as record ID (default: "id")' }, diff --git a/packages/spec/src/ui/action.zod.ts b/packages/spec/src/ui/action.zod.ts index caa7f27e1f2..363748ecb53 100644 --- a/packages/spec/src/ui/action.zod.ts +++ b/packages/spec/src/ui/action.zod.ts @@ -827,6 +827,12 @@ const PAGE_PART_LOCATIONS_RETIRED: Readonly> = { * and an object with no authored page) does not draw it, so * an action that must reach every surface adds `record_page` * (with `component: 'action:menu'` to sit in the ⋯ menu). + * - `selection` — acts on many records: drawn on the selection bar a grid + * shows once two or more of its rows are selected, on every + * grid view of the object, and run once per selected record + * (objectstack#36496). Until protocol 19 a view's + * `bulkActions` list named these actions; the object's + * `actionLayout.selection` orders the bar. * * Which of an object's record-page actions are buttons and which sit in the * page's ⋯ menu, and in what order, is the object's `actionLayout`; without @@ -858,6 +864,7 @@ export const ACTION_LOCATIONS = [ 'record_row', 'record_related', 'record_section', + 'selection', ] as const; export const ActionLocationSchema = z.enum(ACTION_LOCATIONS, { @@ -1420,7 +1427,7 @@ const actionObject = () => strictObject({ icon: z.string().optional().describe('Icon name'), /** Where does this action appear? */ - locations: z.array(ActionLocationSchema).optional().describe('Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: \'action:menu\'` to sit in the record page\'s ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only.'), + locations: z.array(ActionLocationSchema).optional().describe('Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: \'action:menu\'` to sit in the record page\'s ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. `selection` acts on many records: the selection bar a grid shows once two or more rows are selected, on every grid view of the object, run once per selected record (the object\'s `actionLayout.selection` orders that bar).'), /** * Visual Component Type @@ -1717,12 +1724,13 @@ const actionObject = () => strictObject({ * The **bulk dispatch contract this action's body is written for** (#17319, * maintainer ruling, decision batch #121 item 3, 2026-09-12). * - * A list view can wire the same declared action two ways, and the two hand + * A selection can run the same declared action two ways, and the two hand * the SAME body opposite input: * - * - `bulkActions: ['']` — the bare-string form. The renderer promotes - * the action to a def and dispatches it **once per selected row**; each - * call carries that row's `recordId` and **no** `_selectedIds`. + * - the action placed at `selection` (protocol 19, objectstack#36496; until + * then a view's `bulkActions: ['']`). The renderer promotes the + * action to a def and dispatches it **once per selected row**; each call + * carries that row's `recordId` and **no** `_selectedIds`. * - a `bulkActionDefs` entry with `execution: 'aggregate'` — **one** * dispatch for the whole selection; every id arrives in the builtin * `params._selectedIds` and there is **no** `recordId`. @@ -1767,7 +1775,7 @@ const actionObject = () => strictObject({ * contracts. The key changes no dispatch by itself; it is the declaration * the refusal is measured against. */ - execution: BulkActionExecutionSchema.optional().describe("The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the view's `bulkActions: ['']` bare-string form); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. A list view wiring a declared action under the other contract is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`)."), + execution: BulkActionExecutionSchema.optional().describe("The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the action placed at `selection`); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. An action placed at `selection` that declares 'aggregate', or a list view wiring a declared action under the other contract, is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`)."), /** * User Input Requirements — the **parameter DEFINITION array** rendered as a diff --git a/packages/spec/src/ui/bulk-action.zod.ts b/packages/spec/src/ui/bulk-action.zod.ts index 0733d01ac0a..9bbb9b846f8 100644 --- a/packages/spec/src/ui/bulk-action.zod.ts +++ b/packages/spec/src/ui/bulk-action.zod.ts @@ -47,7 +47,7 @@ import { FieldType } from '../data/field.zod'; // so nothing resolves an `{ en, zh }` map on this path — and the bar renders // `def.label` as a React child, so blessing the map form would trade a parse // error for a blank screen. Localizing means declaring a real action and -// naming it in `bulkActions`: THAT path runs through the i18n resolver +// placing it at `selection`: THAT path runs through the i18n resolver // (`toBulkActionDef`'s `localize`). // - `params[]` is STRICT (commit adabccf5f, maintainer ruling batch #146 item 4, // letter A). It used to be `.passthrough()`, mirroring the @@ -107,9 +107,9 @@ import { FieldType } from '../data/field.zod'; * an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the * action it NAMES once for the whole selection. * - * For the per-record dispatch, name the action in the view's - * `bulkActions: ['']` instead — the bare-string form, promoted with the - * action's own label, params and `visible`. + * For the per-record dispatch, place the action at `selection` instead + * (until protocol 19, a view's `bulkActions: ['']`) — it is promoted + * with the action's own label, params and `visible`. */ /** How the executor mutates the selected records. */ @@ -224,8 +224,8 @@ export type BulkActionResultParsed = z.infer; * ⚠️ The prescription refuses the obvious-sounding remedy for all but seven of * these keys. An AUTHORED def's params reach the dialog as written: nothing on * that path consults the object's field definitions. The bulk surface's - * field-backed route is the PROMOTED def, an action the object declares, named - * in the view's `bulkActions`. Its `{ field }` params are resolved when the + * field-backed route is the PROMOTED def, an action the object declares, placed + * at `selection`. Its `{ field }` params are resolved when the * dialog opens, through the single-record dialog's own resolver (objectui * `29b99490`: plugin-grid's `resolvePromotedBulkParams` calls * `resolveActionParams` from `@object-ui/fields`, then renames the result onto @@ -293,8 +293,8 @@ export const BulkActionParamSchema = lazySchema(() => strictObject( + 'it against the object\'s field definitions. Two ways to fix it. Declare the param ' + 'inline: `name` + `type`, plus `object` (and optionally `labelField`) for a picker. Or ' + 'declare the action on the object with this field-backed param (`{ field }`, plus ' - + '`objectOverride` for another object\'s field) and name it in the view\'s ' - + '`bulkActions: [\'\']`. A promoted action\'s params are resolved through ' + + '`objectOverride` for another object\'s field) and add `\'selection\'` to its ' + + '`locations`. A promoted action\'s params are resolved through ' + 'the single-record dialog\'s resolver when the bulk dialog opens, so the param inherits ' + 'the field\'s type, label, options and picker target. The promoted form runs the action ' + 'once per selected record.', @@ -335,7 +335,7 @@ export const BulkActionParamSchema = lazySchema(() => strictObject( + 'bag and whichever widget read one honoured it; that door is shut, so the value is ' + 'refused rather than silently forwarded. A key declared on the object\'s FIELD reaches ' + 'this dialog only through a PROMOTED action: an action the object declares with a ' - + 'field-backed param (`{ field }`), named in the view\'s `bulkActions`. That route ' + + 'field-backed param (`{ field }`), placed at `selection`. That route ' + 'carries the field\'s `type`, `label`, `options`, `required`, `description` (as the help ' + 'text), `placeholder`, `defaultValue`, `multiple`, `accept` and `maxSize`, plus a ' + 'reference field\'s `reference`, `displayField` and `dependsOn` and its picker settings ' @@ -376,7 +376,7 @@ export const BulkActionParamSchema = lazySchema(() => strictObject( * which declares no `dependsOn` at all: the single-record dialog reaches the * key through the FIELD-BACKED route (`resolveActionParams` resolves the * object's field definitions). The bulk surface has that route for a PROMOTED - * def only, an action the object declares, named in the view's `bulkActions`: + * def only, an action the object declares, placed at `selection`: * since objectui `29b99490` its field-backed params are resolved by the same * resolver when the dialog opens, so a reference-bearing field's `dependsOn` * arrives on the bulk param from the field. An AUTHORED def (this shape) has @@ -483,8 +483,8 @@ const BulkConfirmTextSchema = z.union([ * * Two vocabularies reach that bar and they are not interchangeable: * - * - **`bulkActions: ['']`** — names an action the object declares. - * The renderer promotes it to a def carrying the action's label, icon, + * - **an action placed at `selection`** — an action the object declares + * (until protocol 19, named in a view's `bulkActions`). The renderer promotes it to a def carrying the action's label, icon, * `visible`, confirm text and params, and dispatches it ONCE PER selected * record. This is the right form for "run this action on each of them". * - **`bulkActionDefs: [{...}]`** (this schema) — a def authored in the view. @@ -528,8 +528,9 @@ export const BulkActionDefSchema = lazySchema(() => strictObject( + 'past the action registry — no permission gate, no param contract, no lint. Declare the ' + 'action normally and let this def name it.', bulkEnabled: - '`action.bulkEnabled` was retired in spec 17: the selection bar is driven by the LIST ' - + "VIEW's `bulkActions` / `bulkActionDefs`, which is this array. There is nothing to set.", + '`action.bulkEnabled` was retired in spec 17: an action is on the selection bar when its ' + + "`locations` include `'selection'`, and a view's own defs are its `bulkActionDefs`, which is this " + + 'array. There is nothing to set.', recordIdParam: '`recordIdParam` belongs on the ACTION, not on the def that names it — a per-record bulk ' + "run reuses the action's own declaration, and an `execution: 'aggregate'` run carries " @@ -542,17 +543,17 @@ export const BulkActionDefSchema = lazySchema(() => strictObject( }, { name: SnakeCaseIdentifierSchema.describe('Stable identifier — the audit-log action key, and (for an aggregate def) the name of the object action to dispatch.'), - label: z.string().optional().describe('Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and name it in `bulkActions` to get localization).'), + label: z.string().optional().describe('Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and place it at `selection` to get localization).'), icon: z.string().optional().describe('Lucide icon name (e.g. "user-check", "trash").'), variant: z.enum(['primary', 'secondary', 'danger', 'ghost', 'outline']).optional().describe('Visual treatment of the button.'), operation: BulkActionOperationSchema.describe("What the executor does: 'update'/'delete' are data-plane mass mutations; 'custom' dispatches an object action (see `execution`)."), - execution: BulkActionExecutionSchema.optional().describe("For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is declared as `bulkActions: ['']` instead."), + execution: BulkActionExecutionSchema.optional().describe("For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is the action placed at `selection` instead."), patch: z.record(z.string(), z.unknown()).optional().describe("For `operation: 'update'` — static field values applied to every selected record, merged UNDER the user-supplied params so a fixed value can be declared without exposing it in the dialog."), params: z.array(BulkActionParamSchema).optional().describe('Inputs collected once before the run. Omit to skip the params step and go straight to confirm.'), confirmText: BulkConfirmTextSchema.optional().describe("Confirmation text shown above the affected-record summary — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path | formatter[:arg] }}` over two kinds of root, written bare: `count`, the number of records the run covers, and each of the def's params by `name` (`{{ tier }}`, never `{{ params.tier }}`; `count` wins over a param of that name). A param hole renders that param's DISPLAY value: the chosen option's `label` for an option-bearing param (a multi-value param's labels joined with ', '), the picked record's display name for a `lookup` / user param, and the entered value otherwise, so a number, date or currency value takes a formatter (`{{ amount | currency:EUR }}`, `{{ due | date:long }}`). Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Update tier on {{ count }} account(s) to {{ tier }}?'. A hole over any other root, and a single-brace `{x}` token, are refused by name at `objectstack validate`, `compile` and the publish gate, as are a hole holding logic or an unknown formatter and a blank sentence."), confirmLabel: z.string().optional().describe('Custom Confirm button label (default: "Run").'), visible: EvaluatedExpressionInputSchema.optional().describe('Eligibility predicate (CEL) — a string or a `{dialect, source}` envelope, i.e. `action.visible` without its boolean-literal arm: a per-record predicate has nothing to say as a constant. Evaluated once PER SELECTED RECORD with that record bound: the button is offered when at least one passes, the run covers only those, and the rest are reported as skipped. A record-free predicate (`features.x`, `current_user.y`) therefore behaves as a plain button-level gate. Fail-closed — a predicate that faults excludes the record.'), - requiredPermissions: z.array(z.string()).optional().describe("[ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from `bulkActions: ['']` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks."), + requiredPermissions: z.array(z.string()).optional().describe("[ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from an action placed at `selection` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks."), maxRecords: z.number().int().positive().optional().describe('Selection size above which the run is blocked. Set it on defs whose server work is expensive — an aggregate def carries every selected id in one request.'), batchSize: z.number().int().positive().optional().describe('Records per executor batch (default 200). Data-plane operations only — an aggregate run is a single call by definition.'), }) @@ -570,8 +571,8 @@ export const BulkActionDefSchema = lazySchema(() => strictObject( `Bulk action "${def.name}" declares \`operation: 'custom'\` without ` + `\`execution: 'aggregate'\`, which the renderer treats as a no-op — the button runs, ` + `reports success for every selected record, and does nothing. Pick the form you meant: ` - + `to run the action ONCE PER record, drop this def and name the action in the view's ` - + `\`bulkActions: ['${def.name}']\` (it is promoted with the action's label, params and ` + + `to run the action ONCE PER record, drop this def and add \`'selection'\` to the ` + + `\`locations\` of the action "${def.name}" (it is promoted with the action's label, params and ` + `\`visible\`); to run it ONCE for the whole selection, add \`execution: 'aggregate'\` ` + `(the handler reads \`params._selectedIds\`). For a mass field update or delete, use ` + `\`operation: 'update'\` / \`'delete'\` instead.`, diff --git a/packages/spec/src/ui/component.zod.ts b/packages/spec/src/ui/component.zod.ts index 9691cdfc75b..aa9b86ce593 100644 --- a/packages/spec/src/ui/component.zod.ts +++ b/packages/spec/src/ui/component.zod.ts @@ -5084,6 +5084,13 @@ const GridOperationsSchema = lazySchema(() => strictObject({ * held at `z.unknown()` for a ruling, and takes the list view's own member by * reference since stage 5 — see the member. */ +/** + * [#36496] The `object-grid` block's action-name list (`bulkActions` / + * `batchActions`), the accept set the list view's retired `bulkActions` + * declared, by value. + */ +const OBJECT_GRID_BULK_ACTION_NAMES = () => z.array(z.string()).optional(); + export const ObjectGridPropsSchema = lazySchema(() => strictObject({ surface: 'this `object-grid`', history: objectBlockHistory('object-grid'), @@ -5438,21 +5445,25 @@ export const ObjectGridPropsSchema = lazySchema(() => strictObject({ rowActions: ListViewSchema.shape.rowActions .describe('Per-row action names — `edit` / `delete` select the generic entries, any other name resolves against the object\'s actions; the same list a list view\'s `rowActions` declares'), /** - * [#21464] The list view's own `bulkActions` member, by reference: action - * NAMES, which `resolveBulkActions` folds against the object's actions - * (read points recorded in `liveness/page.json`, row `regions`). An object entry such as - * `{ name }` is the def vocabulary, which belongs on `bulkActionDefs`; the - * fold skipped it in silence. + * [#21464] Action NAMES, which `resolveBulkActions` folds against the + * object's actions (read points recorded in `liveness/page.json`, row + * `regions`). An object entry such as `{ name }` is the def vocabulary, + * which belongs on `bulkActionDefs`; the fold skipped it in silence. + * [#36496] The list view's own `bulkActions` was retired in protocol 19 (an + * action placed at `selection` is drawn on every grid of its object), so + * this member no longer borrows it by reference: the same accept set, + * declared here by value. Whether the block keeps it is its own + * enforce-or-remove decision. */ - bulkActions: ListViewSchema.shape.bulkActions - .describe('Bulk action names shown on selection — the same list a list view\'s `bulkActions` declares; a full def goes on `bulkActionDefs`'), + bulkActions: OBJECT_GRID_BULK_ACTION_NAMES() + .describe('Bulk action names shown on selection; a full def goes on `bulkActionDefs`'), /** * [#21464] The alternate spelling of `bulkActions`, read FIRST * (`batchActions ?? bulkActions`), so it takes `bulkActions`'s def: one capability, one - * accept set. The list view declares only `bulkActions`; this second - * spelling is typed here, not retired — retiring it is its own decision. + * accept set. This second spelling is typed here, not retired — retiring it + * is its own decision. */ - batchActions: ListViewSchema.shape.bulkActions + batchActions: OBJECT_GRID_BULK_ACTION_NAMES() .describe('Alternate spelling of `bulkActions` that the renderer reads FIRST (`batchActions ?? bulkActions`) — the same action-name list. Prefer `bulkActions`'), /** * [#21445] The list view's own bulk-action def, {@link BulkActionDefSchema}, diff --git a/packages/spec/src/ui/view.zod.ts b/packages/spec/src/ui/view.zod.ts index a47d0f80dee..0b3c337d34e 100644 --- a/packages/spec/src/ui/view.zod.ts +++ b/packages/spec/src/ui/view.zod.ts @@ -3277,6 +3277,18 @@ const LIST_VIEW_PAGE_NAME_RETIRED = + 'different surface and is the page mount that has always rendered. ' + 'Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand.'; +/** + * [#36496] Prescription for the retired list-view `bulkActions`. + */ +const LIST_VIEW_BULK_ACTIONS_RETIRED = + '`view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection ' + + 'of records offers are the object\'s, not one view\'s: the selection bar a grid shows once two or more ' + + 'rows are selected draws the same actions on every view of the object. Delete the key, and add ' + + "`'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, " + + "write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` " + + 'stay on the view. ' + + 'Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand.'; + /** * [#17053] Prescription for the retired bare-string `sort` clause on the * list-view `sort` union. @@ -3855,7 +3867,18 @@ const ListViewShapeSchema = lazySchema(() => strictObject({ /** Row & Bulk Actions */ rowActions: z.array(z.string()).optional().describe('Actions available for individual row items'), - bulkActions: z.array(z.string()).optional().describe('Actions available when multiple rows are selected'), + /** + * [#36496] REMOVED in protocol 19 (maintainer rulings on the card: actions + * are arranged on the object, split by list and record; all three kinds are + * declared by the action). A selection's actions are the object's: an + * action placed at `selection` is drawn on the selection bar of every grid + * view of its object, and the object's `actionLayout.selection` orders the + * bar. Tombstoned so the removal is audible in both channels (`tsc` and the + * parse). The conversion `view-bulk-actions-to-action-selection` moves each + * list onto its actions where the stack holds both; `bulkActionDefs`, a + * view's inline defs, stay here. + */ + bulkActions: retiredKey(LIST_VIEW_BULK_ACTIONS_RETIRED), bulkActionDefs: z.array(BulkActionDefSchema).optional().describe( 'Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a ' + "mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for " @@ -3866,8 +3889,8 @@ const ListViewShapeSchema = lazySchema(() => strictObject({ + 'selection; a run that moved some rows and refused others resolves with a `BulkActionResult` ' + '(`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is ' + 'replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` ' - + "on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` " - + 'instead — the bare-string form, promoted with the action\'s own label, params and `visible`; a ' + + "on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` " + + 'instead — it is promoted with the action\'s own label, params and `visible`; a ' + "'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time" + '. Toolbar url/api actions can also interpolate the current selection via ' + '`${ctx.selection.ids}` / `${ctx.selection.count}`.', From 53441840c018973a0917f706a155aafc8c287d60 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:34:30 +0000 Subject: [PATCH 2/9] wip(ui): selection bar reads the object's selection actions Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK Co-Authored-By: Claude --- packages/spec/authorable-surface/ui.json | 4 +- .../spec/dropped-refinements.baseline.json | 20 ++-- .../inspectors/ActionDefaultInspector.tsx | 2 + .../metadata-admin/previews/ActionPreview.tsx | 10 ++ .../src/views/objectViewHeaderToolbar.ts | 19 +-- .../src/views/objectViewListRenderer.tsx | 13 +- .../app-shell/src/views/objectViewTabs.ts | 27 ++--- ui/packages/core/src/actions/ActionRunner.ts | 4 +- ui/packages/i18n/src/namespaces/studio/en.ts | 4 +- ui/packages/i18n/src/namespaces/studio/zh.ts | 4 +- ui/packages/plugin-grid/demo/bulk-actions.tsx | 9 +- ui/packages/plugin-grid/src/ObjectGrid.tsx | 24 +++- .../src/components/SelectionBar.tsx | 41 ++++++- .../plugin-grid/src/hooks/useBulkExecutor.ts | 4 +- ui/packages/plugin-grid/src/index.tsx | 4 +- .../plugin-grid/src/resolveBulkActions.ts | 112 ++++++++++++++---- ui/packages/plugin-list/src/ListView.tsx | 21 ++-- ui/packages/plugin-list/src/index.tsx | 6 - ui/packages/plugin-view/src/ObjectView.tsx | 8 +- ui/packages/types/src/objectql.ts | 26 ++-- 20 files changed, 242 insertions(+), 120 deletions(-) diff --git a/packages/spec/authorable-surface/ui.json b/packages/spec/authorable-surface/ui.json index 07da9ae236f..30b0daf0c68 100644 --- a/packages/spec/authorable-surface/ui.json +++ b/packages/spec/authorable-surface/ui.json @@ -797,7 +797,7 @@ "ui/ListView:appearance", "ui/ListView:aria", "ui/ListView:bulkActionDefs", - "ui/ListView:bulkActions", + "ui/ListView:bulkActions [RETIRED]", "ui/ListView:calendar", "ui/ListView:chart", "ui/ListView:columns", @@ -985,7 +985,7 @@ "ui/ObjectListView:appearance", "ui/ObjectListView:aria", "ui/ObjectListView:bulkActionDefs", - "ui/ObjectListView:bulkActions", + "ui/ObjectListView:bulkActions [RETIRED]", "ui/ObjectListView:calendar", "ui/ObjectListView:chart", "ui/ObjectListView:columns", diff --git a/packages/spec/dropped-refinements.baseline.json b/packages/spec/dropped-refinements.baseline.json index 9f4220e664d..b6b1237591b 100644 --- a/packages/spec/dropped-refinements.baseline.json +++ b/packages/spec/dropped-refinements.baseline.json @@ -195,7 +195,7 @@ "manifest.objectExtensions.element", "manifest.objects.element", "manifest.objects.element.actionLayout.list", - "manifest.objects.element.actionLayout.record", + "manifest.objects.element.actionLayout.record", "manifest.objects.element.actionLayout.selection", "manifest.objects.element.defaultRowScope", "manifest.objects.element.fieldGroups", "manifest.objects.element.fields.out.valueType", @@ -392,7 +392,7 @@ "data.options[1].manifest.objectExtensions.element", "data.options[1].manifest.objects.element", "data.options[1].manifest.objects.element.actionLayout.list", - "data.options[1].manifest.objects.element.actionLayout.record", + "data.options[1].manifest.objects.element.actionLayout.record", "data.options[1].manifest.objects.element.actionLayout.selection", "data.options[1].manifest.objects.element.defaultRowScope", "data.options[1].manifest.objects.element.fieldGroups", "data.options[1].manifest.objects.element.fields.out.valueType", @@ -576,7 +576,7 @@ "options[1].manifest.objectExtensions.element", "options[1].manifest.objects.element", "options[1].manifest.objects.element.actionLayout.list", - "options[1].manifest.objects.element.actionLayout.record", + "options[1].manifest.objects.element.actionLayout.record", "options[1].manifest.objects.element.actionLayout.selection", "options[1].manifest.objects.element.defaultRowScope", "options[1].manifest.objects.element.fieldGroups", "options[1].manifest.objects.element.fields.out.valueType", @@ -684,7 +684,7 @@ "data.packages.element.options[1].manifest.objectExtensions.element", "data.packages.element.options[1].manifest.objects.element", "data.packages.element.options[1].manifest.objects.element.actionLayout.list", - "data.packages.element.options[1].manifest.objects.element.actionLayout.record", + "data.packages.element.options[1].manifest.objects.element.actionLayout.record", "data.packages.element.options[1].manifest.objects.element.actionLayout.selection", "data.packages.element.options[1].manifest.objects.element.defaultRowScope", "data.packages.element.options[1].manifest.objects.element.fieldGroups", "data.packages.element.options[1].manifest.objects.element.fields.out.valueType", @@ -782,7 +782,7 @@ "data.membershipKeys", "data.membershipKeys.valueType", "data.actionLayout.list", - "data.actionLayout.record" + "data.actionLayout.record", "data.actionLayout.selection" ] }, "api/PackageInstallBody": { @@ -1297,7 +1297,7 @@ "membershipKeys", "membershipKeys.valueType", "actionLayout.list", - "actionLayout.record" + "actionLayout.record", "actionLayout.selection" ] }, "data/ObjectExtension": { @@ -1310,7 +1310,7 @@ "fields.out.valueType.relatedListFilter.lazy", "fields.out.valueType.summaryOperations", "actionLayout.list", - "actionLayout.record" + "actionLayout.record", "actionLayout.selection" ] }, "data/OracleConfig": { @@ -1667,7 +1667,7 @@ "operations.element.options[3].object.membershipKeys", "operations.element.options[3].object.membershipKeys.valueType", "operations.element.options[3].object.actionLayout.list", - "operations.element.options[3].object.actionLayout.record" + "operations.element.options[3].object.actionLayout.record", "operations.element.options[3].object.actionLayout.selection" ] }, "system/CreateObjectOperation": { @@ -1702,7 +1702,7 @@ "object.membershipKeys", "object.membershipKeys.valueType", "object.actionLayout.list", - "object.actionLayout.record" + "object.actionLayout.record", "object.actionLayout.selection" ] }, "system/CronSchedule": { @@ -1759,7 +1759,7 @@ "options[3].object.membershipKeys", "options[3].object.membershipKeys.valueType", "options[3].object.actionLayout.list", - "options[3].object.actionLayout.record" + "options[3].object.actionLayout.record", "options[3].object.actionLayout.selection" ] }, "system/ObjectStorageConfig": { diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ActionDefaultInspector.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ActionDefaultInspector.tsx index f3d48dee150..e38171b52f6 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ActionDefaultInspector.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ActionDefaultInspector.tsx @@ -316,6 +316,8 @@ const LOCATION_LABELS: Record = { record_section: 'engine.inspector.action.location.record_section', record_related: 'engine.inspector.action.location.record_related', list: 'engine.inspector.action.location.list', + // objectstack#36496 — acts on many records: the selection bar of every grid. + selection: 'engine.inspector.action.location.selection', }; const LOCATIONS: Array<{ value: ActionLocation; labelKey: string }> = ( diff --git a/ui/packages/app-shell/src/views/metadata-admin/previews/ActionPreview.tsx b/ui/packages/app-shell/src/views/metadata-admin/previews/ActionPreview.tsx index 407ce3270d4..bdd8991e3b2 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/previews/ActionPreview.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/previews/ActionPreview.tsx @@ -934,6 +934,16 @@ function PlacementPreview({ locations, folded, label, icon, variant, iconOnly, l )} + {/* objectstack#36496 — the selection bar a grid shows once two or more + rows are selected, on every grid of the object. */} + {locations.includes('selection') && ( + +
+ {tFormat('engine.actionPreview.placement.selected', locale, { n: 2 })} +
{btn}
+
+ + )} {/* No `global_nav` frame. The location was retired from the spec's `ACTION_LOCATIONS` in @objectstack/spec 17.0.0-rc.6 (objectstack#6888, maintainer ruling 2026-08-09 direction 2) because no running-app diff --git a/ui/packages/app-shell/src/views/objectViewHeaderToolbar.ts b/ui/packages/app-shell/src/views/objectViewHeaderToolbar.ts index 091357cae96..8c0fed25132 100644 --- a/ui/packages/app-shell/src/views/objectViewHeaderToolbar.ts +++ b/ui/packages/app-shell/src/views/objectViewHeaderToolbar.ts @@ -25,8 +25,8 @@ export function useObjectViewHeaderToolbar({ }) { // objectui#12462 (ruling A-narrow) — the header does not draw a duplicate of // the selection bar. The bar is the list toolbar in its selection mode: a - // `list` action the ACTIVE view wires to it (`bulkActions`, or a - // `bulkActionDefs` entry) is still drawn at its declared placement, on the + // `list` action on it (placed at `selection` too, objectstack#36496, or + // named by an ACTIVE view's `bulkActionDefs` entry) is still drawn at its declared placement, on the // rows it acts on, so the header's permanent copy is the duplicate. Only a // RECORD-SCOPED action leaves (`isRecordScopedAction`: it also mounts on // rows or records). Launched from the header it runs on exactly one ticked @@ -34,19 +34,20 @@ export function useObjectViewHeaderToolbar({ // its header entry, because it can run with nothing selected and the bar // cannot. Nothing else moves: the bar reads the same view keys itself. // - // The names are the ones `ObjectGrid` folds into its bar from the keys this - // page relays to it (see `renderListView`): every non-empty `bulkActions` - // name except `delete`, which the grid routes to its built-in bulk delete - // rather than to an object action, and the `name` of every `bulkActionDefs` - // entry the grid can render. Keyed on a string of the names, not on + // The bar's actions are the object's placed at `selection` (read off each + // action here) and the `name` of every `bulkActionDefs` entry of the active + // view the grid can render. Keyed on a string of the names, not on // `activeView`, which is a fresh object on every render while a draft is // open (AGENTS.md #10). const bulkWiredNamesKey = bulkWiredActionNamesKey(activeView); const headerToolbarActions = useMemo(() => { const wired = new Set(JSON.parse(bulkWiredNamesKey) as string[]); - if (wired.size === 0) return localizedToolbarActions; return localizedToolbarActions.filter( - (a: any) => !(typeof a?.name === 'string' && wired.has(a.name) && isRecordScopedAction(a)), + (a: any) => !( + typeof a?.name === 'string' + && (wired.has(a.name) || actionRendersAt(a, 'selection')) + && isRecordScopedAction(a) + ), ); }, [localizedToolbarActions, bulkWiredNamesKey]); diff --git a/ui/packages/app-shell/src/views/objectViewListRenderer.tsx b/ui/packages/app-shell/src/views/objectViewListRenderer.tsx index 52f8673d60b..7d1574fa970 100644 --- a/ui/packages/app-shell/src/views/objectViewListRenderer.tsx +++ b/ui/packages/app-shell/src/views/objectViewListRenderer.tsx @@ -943,15 +943,12 @@ export function useObjectViewListRenderer({ .map((a: any) => localizeActionTexts(objectDef.name, a)) : []), /** - * Selection-bar actions. Unlike `rowActionDefs` above, these are - * NOT resolved here: `ObjectGrid` is the single convergence point - * of all three list callers (this view, plugin-view's ObjectView - * and plugin-list's ListView), so it resolves each `bulkActions` - * name against `objectDef.actions` and promotes it into the def - * list itself (`resolveBulkActions`, objectui#3002). What we pass - * through is the view author's own declaration. + * Selection-bar defs. The bar's actions are the object's placed at + * `selection` (objectstack#36496), which `ObjectGrid`, the single + * convergence point of all three list callers, reads off the + * object itself (`selectionBarActions`). What we pass through is + * the view author's own inline defs. */ - bulkActions: viewDef.bulkActions ?? listSchema.bulkActions, bulkActionDefs: (viewDef as any).bulkActionDefs ?? (listSchema as any).bulkActionDefs, sharing: viewDef.sharing ?? listSchema.sharing, // objectui#13089 — the Add button `ListView` draws from diff --git a/ui/packages/app-shell/src/views/objectViewTabs.ts b/ui/packages/app-shell/src/views/objectViewTabs.ts index 8d6b83ba30a..bb96da25882 100644 --- a/ui/packages/app-shell/src/views/objectViewTabs.ts +++ b/ui/packages/app-shell/src/views/objectViewTabs.ts @@ -80,27 +80,18 @@ export function defaultListColumnsFromObject( } /** - * The action names a list view wires to its selection bar, as `ObjectGrid` - * folds them from the two keys this page relays to it (`resolveBulkActions` in - * `@object-ui/plugin-grid`), sorted and JSON-encoded so a memo keys on a - * primitive (objectui#12462). - * - * - `bulkActions`: every non-empty name except `delete` (any case). The grid - * sends `delete` to its built-in bulk delete, never to an object action of - * that name, so the bar does not carry such an action. - * - `bulkActionDefs`: the `name` of every entry the grid can render, which is - * an object with a non-empty string `name` (`isUsableBulkActionDef`). - * - * The legacy `batchActions` spelling is not read: this page never relays it. + * The action names a list view wires to its selection bar itself, as + * `ObjectGrid` folds them from the key this page relays to it + * (`resolveBulkActions` in `@object-ui/plugin-grid`), sorted and JSON-encoded + * so a memo keys on a primitive (objectui#12462): the `name` of every + * `bulkActionDefs` entry the grid can render, which is an object with a + * non-empty string `name` (`isUsableBulkActionDef`). The object's actions + * placed at `selection` are the bar's on every view (objectstack#36496); the + * header reads them off each action. */ export function bulkWiredActionNamesKey(view: unknown): string { - const { bulkActions, bulkActionDefs } = (view ?? {}) as { bulkActions?: unknown; bulkActionDefs?: unknown }; + const { bulkActionDefs } = (view ?? {}) as { bulkActionDefs?: unknown }; const names = new Set(); - if (Array.isArray(bulkActions)) { - for (const name of bulkActions) { - if (typeof name === 'string' && name !== '' && name.toLowerCase() !== 'delete') names.add(name); - } - } if (Array.isArray(bulkActionDefs)) { for (const def of bulkActionDefs) { const name = def && typeof def === 'object' ? (def as { name?: unknown }).name : undefined; diff --git a/ui/packages/core/src/actions/ActionRunner.ts b/ui/packages/core/src/actions/ActionRunner.ts index 5c9e9ab0170..2dd5e29d3fa 100644 --- a/ui/packages/core/src/actions/ActionRunner.ts +++ b/ui/packages/core/src/actions/ActionRunner.ts @@ -555,8 +555,8 @@ export interface ActionDef { // the schema one major on, which left nothing to mirror. A HOST still passes // either one explicitly through `ActionEngine.registerAction(action, // { shortcut, bulkEnabled })`; neither is sourced from authored metadata, - // and a bulk action is declared in the list view's `bulkActions` / - // `bulkActionDefs`. + // and a bulk action is declared on the action (`locations` include + // `'selection'`) or in a view's `bulkActionDefs`. } /** diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index fdd127b22c9..5bf2bd50cac 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -1103,6 +1103,7 @@ const STUDIO_EN: Record = { 'engine.inspector.action.location.record_related': 'Record · related list', 'engine.inspector.action.location.list': 'List toolbar', 'engine.inspector.action.location.record_row': 'List · row', + 'engine.inspector.action.location.selection': 'List · selected rows', 'engine.inspector.action.target.url.label': 'URL', 'engine.inspector.action.target.url.placeholder': 'https://… or /path?x=${param.x}', 'engine.inspector.action.target.url.hint': 'Supports ${param.x} and ${ctx.x} interpolation.', @@ -1174,7 +1175,7 @@ const STUDIO_EN: Record = { 'engine.inspector.action.addInput': 'Add input', 'engine.inspector.action.placement': 'Placement', 'engine.inspector.action.placementHint': 'Where this action surfaces in the UI.', - 'engine.inspector.action.noPlacement': 'No placement selected — this action will not appear on any record or list surface. Tick a placement above, or place it from a view’s bulk actions.', + 'engine.inspector.action.noPlacement': 'No placement selected — this action will not appear on any record or list surface. Tick a placement above.', 'engine.inspector.action.capabilityGate': 'Capability-gated on {capabilities} — every placement ticked above hides this action from anyone who does not hold {whom}. Not greyed out and not an error: the button is simply absent, and the server refuses the invocation with a 403 either way.', 'engine.inspector.action.capabilityGateAll': 'all of them', 'engine.inspector.action.capabilityGateOne': 'it', @@ -3102,6 +3103,7 @@ const STUDIO_EN: Record = { 'engine.actionPreview.placement.row': 'Row {n}', 'engine.actionPreview.placement.section': 'Section', 'engine.actionPreview.placement.sectionBody': '…section content…', + 'engine.actionPreview.placement.selected': '{n} selected', 'engine.actionPreview.placement.more': 'More', 'engine.actionPreview.api.paramsOne': '+ {count} user-supplied param collected at runtime', 'engine.actionPreview.api.paramsOther': '+ {count} user-supplied params collected at runtime', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index 797a94b4075..52606b9164f 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -958,6 +958,7 @@ const STUDIO_ZH: Record = { 'engine.inspector.action.location.record_related': '记录 · 关联列表', 'engine.inspector.action.location.list': '列表工具栏', 'engine.inspector.action.location.record_row': '列表 · 行', + 'engine.inspector.action.location.selection': '列表 · 选中的行', 'engine.inspector.action.target.url.label': 'URL 地址', 'engine.inspector.action.target.url.placeholder': 'https://… 或 /path?x=${param.x}', 'engine.inspector.action.target.url.hint': '支持 ${param.x} 与 ${ctx.x} 插值。', @@ -1029,7 +1030,7 @@ const STUDIO_ZH: Record = { 'engine.inspector.action.addInput': '添加输入项', 'engine.inspector.action.placement': '放置位置', 'engine.inspector.action.placementHint': '此动作在界面中出现的位置。', - 'engine.inspector.action.noPlacement': '未选择放置位置 —— 此动作不会出现在任何记录或列表界面上。请在上方勾选一个放置位置,或通过视图的批量动作放置它。', + 'engine.inspector.action.noPlacement': '未选择放置位置 —— 此动作不会出现在任何记录或列表界面上。请在上方勾选一个放置位置。', 'engine.inspector.action.capabilityGate': '受权限 {capabilities} 控制 —— 对于不具备{whom}的任何人,上方勾选的每个放置位置都会隐藏此动作。这不是置灰,也不是错误:按钮只是不出现,而且无论如何服务器都会以 403 拒绝调用。', 'engine.inspector.action.capabilityGateAll': '全部这些权限', 'engine.inspector.action.capabilityGateOne': '该权限', @@ -2780,6 +2781,7 @@ const STUDIO_ZH: Record = { 'engine.actionPreview.placement.row': '第 {n} 行', 'engine.actionPreview.placement.section': '分区', 'engine.actionPreview.placement.sectionBody': '…分区内容…', + 'engine.actionPreview.placement.selected': '已选 {n} 条', 'engine.actionPreview.placement.more': '更多', 'engine.actionPreview.api.paramsOne': '+ {count} 个由用户在运行时提供的参数', 'engine.actionPreview.api.paramsOther': '+ {count} 个由用户在运行时提供的参数', diff --git a/ui/packages/plugin-grid/demo/bulk-actions.tsx b/ui/packages/plugin-grid/demo/bulk-actions.tsx index 8ab3b7a7737..cf517eab8fd 100644 --- a/ui/packages/plugin-grid/demo/bulk-actions.tsx +++ b/ui/packages/plugin-grid/demo/bulk-actions.tsx @@ -12,8 +12,9 @@ * * What it exercises: * 1. `bulk_mark_done` and `bulk_recalc_estimate` are declared on the object - * and NAMED in the view's `bulkActions` — the only way to declare a bulk - * action (spec 17 retired `action.bulkEnabled` as a tombstone). Both + * and NAMED in the grid block's own `bulkActions` (an object's actions + * placed at `selection` reach every grid of the object the same way, + * objectstack#36496). Both * names used to dispatch as `{ type: '' }` and never run; the * buttons also carried none of the def's label / icon / params. * 2. `not_declared` names no action the object declares, so the bar draws @@ -62,7 +63,7 @@ const ROWS = [ ]; /** - * Also carries `locations: ['record_row']`, so naming it in the view's + * Also carries `locations: ['record_row']`, so naming it in the block's * `bulkActions` makes the same action a row entry AND a bulk entry. */ const MARK_DONE = { @@ -287,7 +288,7 @@ function Demo() {

Select rows → the bar shows Mark Done and Recalculate Estimate (names - from the view's bulkActions, promoted to their declared object + from the grid's bulkActions, promoted to their declared object actions), Export Zip (an execution: 'aggregate' def — ONE dispatch carrying every selected id, #3139). The view also names{' '} not_declared, which the object does not declare: no button, and one diff --git a/ui/packages/plugin-grid/src/ObjectGrid.tsx b/ui/packages/plugin-grid/src/ObjectGrid.tsx index 5a9fe632c80..528ffe61984 100644 --- a/ui/packages/plugin-grid/src/ObjectGrid.tsx +++ b/ui/packages/plugin-grid/src/ObjectGrid.tsx @@ -93,7 +93,7 @@ import { useRecordCrudVerdicts } from './hooks/useRecordCrudVerdicts'; import { useRowApprovalLocks } from './hooks/useRowApprovalLocks'; import { resolveLegacyRowActions } from './resolveLegacyRowActions'; import { rankRowActionDefs } from './rowActionArrangement'; -import { resolveBulkActions, resolvePromotedBulkParams } from './resolveBulkActions'; +import { resolveBulkActions, resolvePromotedBulkParams, selectionBarActions } from './resolveBulkActions'; import { useUndeclaredActionNamesWarning } from './undeclaredActionNames'; import { partitionBulkRows } from './bulkEligibility'; import { RowActionMenu, formatActionLabel } from './components/RowActionMenu'; @@ -1852,7 +1852,17 @@ export const ObjectGrid: React.FC = ({ const explicitBulkActions = objectCanDelete ? declaredBulkActions : declaredBulkActions?.filter((a: unknown) => String(a).toLowerCase() !== 'delete'); - // `bulkActions` carries a bare action NAME, which the runner cannot execute + // [objectstack#36496] The object's actions placed at `selection` are the + // bar's own, on every grid of the object, in the order its + // `actionLayout.selection` gives (`selectionBarActions`). Keyed on the arm's + // content and the served actions, so an unchanged object hands the bar the + // same list. + const selectionArmKey = JSON.stringify((objectSchema as any)?.actionLayout?.selection ?? null); + const selectionBarOrder = React.useMemo( + () => selectionBarActions((objectSchema as any)?.actions, JSON.parse(selectionArmKey)), + [(objectSchema as any)?.actions, selectionArmKey], + ); + // A block's `bulkActions` carries a bare action NAME, which the runner cannot execute // on its own — resolve each against `objectDef.actions` so it dispatches as a // real def. See `resolveBulkActions` (objectui#3002). A name the object does // not declare gets no button (spec: a bare name "names an action the object @@ -1864,6 +1874,7 @@ export const ObjectGrid: React.FC = ({ (a: unknown) => String(a).toLowerCase() !== 'delete', ); const { defs: resolvedBulkDefs, undeclared: undeclaredBulkActions } = resolveBulkActions({ + selectionActions: selectionBarOrder.actions, bulkActions: legacyBulkNames, bulkActionDefs: Array.isArray(schema.bulkActionDefs) ? schema.bulkActionDefs : [], objectActions: (objectSchema as any)?.actions, @@ -1890,10 +1901,16 @@ export const ObjectGrid: React.FC = ({ (a: unknown) => String(a).toLowerCase() === 'delete', ); const changeOwnerDrawn = !!onBulkChangeOwner && bulkChangeOwnerOffered !== false; + // [objectstack#36496] The implicit Delete answers to what THIS grid + // declares (a block's own list, its authored defs), never to the object's + // selection actions: those are drawn on every grid of the object, and the + // built-in Delete keeps its place beside them wherever the object allows a + // delete, as the record arm keeps New, Edit and Delete in theirs. + const authoredBulkDefCount = Array.isArray(schema.bulkActionDefs) ? schema.bulkActionDefs.length : 0; const effectiveBulkActions: string[] = [ ...(explicitBulkActions && explicitBulkActions.length > 0 ? keptDeleteAction - : canDelete && onBulkDelete && bulkActionDefs.length === 0 + : canDelete && onBulkDelete && authoredBulkDefCount === 0 ? ['delete'] : []), // objectstack#35403 — the built-in bulk Change Owner, offered wherever its @@ -3702,6 +3719,7 @@ export const ObjectGrid: React.FC = ({ singleRowMenu={listPageGrid && selectedRows.length === 1 ? rowActionMenuProps(selectedRows[0]) : undefined} actions={effectiveBulkActions ?? []} actionDefs={bulkActionDefs} + pinned={selectionBarOrder.pinned} objectFields={objectSchema?.fields} onAction={dispatchBulkAction} onActionDef={dispatchBulkActionDef} diff --git a/ui/packages/plugin-grid/src/components/SelectionBar.tsx b/ui/packages/plugin-grid/src/components/SelectionBar.tsx index 991554a510d..8c30f35e800 100644 --- a/ui/packages/plugin-grid/src/components/SelectionBar.tsx +++ b/ui/packages/plugin-grid/src/components/SelectionBar.tsx @@ -82,6 +82,28 @@ export function planExposedEntries( return { exposed, rest: all.filter((entry) => !shown.has(entry.key)) }; } +/** + * [objectstack#36496] The bar's buttons when the object's + * `actionLayout.selection` names them: the offered entries whose def `pinned` + * names, in pin order, capped by `fit`; everything else, the built-in Delete + * and Change Owner included, stays behind More in the bar's order. A pinned + * name the selection does not offer (hidden by its `visible` or its + * permissions) leaves its button out, and no other entry takes its place. + */ +export function planPinnedEntries( + all: E[], + pinned: readonly string[], + fit: number, +): { exposed: E[]; rest: E[] } { + const chosen = pinned + .map((name) => all.find((entry) => entry.def?.name === name)) + .filter((entry): entry is E => !!entry) + .filter((entry, i, list) => list.indexOf(entry) === i); + const exposed = chosen.slice(0, Math.max(0, fit)); + const shown = new Set(exposed.map((entry) => entry.key)); + return { exposed, rest: all.filter((entry) => !shown.has(entry.key)) }; +} + /** The row menu plan of the entries left behind More. */ function restPlan(plan: RowActionMenuPlan, rest: SingleRecordEntry[]): RowActionMenuPlan { const custom = rest.flatMap((entry) => (entry.kind === 'def' ? [entry.def] : [])); @@ -224,17 +246,22 @@ const BulkActions: React.FC<{ selectedRows: any[]; actions: string[]; actionDefs?: BulkActionDef[]; + pinned?: readonly string[]; objectFields?: unknown; onAction?: (action: string, selectedRows: any[]) => void; onActionDef?: (def: BulkActionDef, selectedRows: any[]) => void; fit: number; onCount: (n: number) => void; -}> = ({ selectedRows, actions, actionDefs, objectFields, onAction, onActionDef, fit, onCount }) => { +}> = ({ selectedRows, actions, actionDefs, pinned, objectFields, onAction, onActionDef, fit, onCount }) => { const { t } = useObjectTranslation(); const items = useBulkActionItems({ selectedRows, actions, actionDefs, objectFields }); const ordered: OrderedBulkItem[] = orderSelectionMenuItems(items); - const { exposed, rest } = planExposedEntries(ordered, (entry) => !entry.destructive, SELECTION_EXPOSED_ACTIONS, fit); - const chosenCount = Math.min(ordered.length, SELECTION_EXPOSED_ACTIONS); + const { exposed, rest } = pinned + ? planPinnedEntries(ordered, pinned, fit) + : planExposedEntries(ordered, (entry) => !entry.destructive, SELECTION_EXPOSED_ACTIONS, fit); + const chosenCount = pinned + ? planPinnedEntries(ordered, pinned, SELECTION_EXPOSED_ACTIONS).exposed.length + : Math.min(ordered.length, SELECTION_EXPOSED_ACTIONS); React.useLayoutEffect(() => onCount(chosenCount), [chosenCount, onCount]); if (ordered.length === 0) return null; return ( @@ -344,6 +371,12 @@ export interface BulkActionBarProps { actions: string[]; /** Rich action definitions — authored inline or derived from the object. */ actionDefs?: BulkActionDef[]; + /** + * [objectstack#36496] The object's `actionLayout.selection.pinned`: the + * names of the bar's buttons, in order, for two or more selected records. + * Absent, the bar draws the first three of its order as buttons. + */ + pinned?: readonly string[]; /** * The object's field definitions (`objectSchema.fields`). Passed to each * def's per-record `visible` so a relation field is bound as the FOREIGN KEY @@ -402,6 +435,7 @@ export const BulkActionBar: React.FC = ({ selectedRows, actions, actionDefs, + pinned, objectFields, onAction, onActionDef, @@ -510,6 +544,7 @@ export const BulkActionBar: React.FC = ({ selectedRows={selectedRows} actions={actions} actionDefs={actionDefs} + pinned={pinned} objectFields={objectFields} onAction={onAction} onActionDef={onActionDef} diff --git a/ui/packages/plugin-grid/src/hooks/useBulkExecutor.ts b/ui/packages/plugin-grid/src/hooks/useBulkExecutor.ts index f93a53de61e..2db399f963a 100644 --- a/ui/packages/plugin-grid/src/hooks/useBulkExecutor.ts +++ b/ui/packages/plugin-grid/src/hooks/useBulkExecutor.ts @@ -251,8 +251,8 @@ export interface BulkExecutorOptions { }; /** * Per-record dispatcher for a PROMOTED bulk action — one declared object - * action (named in the view's `bulkActions` and resolved against - * `objectDef.actions`) applied to N selected records (objectui#3002). + * action (placed at `selection`, or named in a block's `bulkActions` and + * resolved against `objectDef.actions`) applied to N selected records (objectui#3002). * * Such a def carries `operation: 'custom'` plus `def.actionDef`; the data * source has no idea what the action does, so the grid injects this to run it diff --git a/ui/packages/plugin-grid/src/index.tsx b/ui/packages/plugin-grid/src/index.tsx index 352f20ba10b..09ee9dac709 100644 --- a/ui/packages/plugin-grid/src/index.tsx +++ b/ui/packages/plugin-grid/src/index.tsx @@ -48,7 +48,7 @@ export type { ListScrollState } from './objectGridInfiniteLoad'; // other surface that draws a selection bar of its own: plugin-list's ListView // over a non-grid view (objectstack#30394, objectstack#30535). One rule, one copy. export { useBulkActionItems, CHANGE_OWNER_BULK_ACTION } from './components/BulkActionBar'; -export { resolveBulkActions } from './resolveBulkActions'; +export { resolveBulkActions, selectionBarActions } from './resolveBulkActions'; export { useUndeclaredActionNamesWarning } from './undeclaredActionNames'; export { useCellClipboard } from './useCellClipboard'; export { useGradientColor } from './useGradientColor'; @@ -76,7 +76,7 @@ export type { GroupRowProps } from './GroupRow'; export type { RowActionMenuProps } from './components/RowActionMenu'; export type { BulkActionBarProps } from './components/SelectionBar'; export type { BulkActionItems, LegacyBulkActionItem } from './components/BulkActionBar'; -export type { ActionLabelResolver, NamedActionDef } from './resolveBulkActions'; +export type { ActionLabelResolver, NamedActionDef, SelectionBarActions } from './resolveBulkActions'; export type { UndeclaredActionNameKey, UndeclaredActionNamesAddress, diff --git a/ui/packages/plugin-grid/src/resolveBulkActions.ts b/ui/packages/plugin-grid/src/resolveBulkActions.ts index c5e91d4dcc6..a47fedf5c2c 100644 --- a/ui/packages/plugin-grid/src/resolveBulkActions.ts +++ b/ui/packages/plugin-grid/src/resolveBulkActions.ts @@ -7,8 +7,8 @@ */ /** - * Resolve a list view's `bulkActions: string[]` against the object's declared - * actions, folding each resolvable name into the rich `BulkActionDef` list the + * Fold the object's actions placed at `selection`, and an `object-grid` + * block's `bulkActions: string[]`, into the rich `BulkActionDef` list the * selection bar renders. * * This is the selection-scoped twin of {@link resolveLegacyRowActions} @@ -19,21 +19,19 @@ * * ## Where a bulk action is declared * - * **In the VIEW's `bulkActions`, naming an action the object declares.** That - * is the whole vocabulary. `ActionSchema.bulkEnabled` looked like an - * object-level alternative and this module briefly derived from it, but spec - * 17.0.0 retired the key (objectstack-ai/objectstack#3896 close-out / framework#4054) — it is now a - * `retiredKey()` tombstone, so authoring it is a HARD parse rejection whose - * own prescription is: *"the multi-select toolbar is driven by the LIST VIEW's - * `bulkActions` / `bulkActionDefs`, never by this flag … declare the action in - * the view's `bulkActions` instead."* Do not reintroduce a `bulkEnabled` read - * here: `defineStack` refuses to compile a config that sets it, so the branch - * can never run. + * **On the action, with the `selection` location** (protocol 19, + * objectstack#36496). An action whose `locations` include `'selection'` is + * drawn on the selection bar of every grid of its object, and the object's + * `actionLayout.selection` orders the bar ({@link selectionBarActions}). Until + * protocol 19 a list view's `bulkActions` named these actions; that key is + * retired, and an `object-grid` block's own `bulkActions` / `batchActions` + * are still folded here, after the object's. `ActionSchema.bulkEnabled` was + * retired in spec 17 (objectstack-ai/objectstack#3896 close-out); do not + * reintroduce a read of it. * - * `locations` stays orthogonal — it places an action's SINGLE-record entry - * (toolbar / row kebab / record header). One action can be both: declared - * `locations: ['record_row']` AND named in `bulkActions`, it runs on one row - * from the kebab and on N rows from the selection bar. + * One action can be on several surfaces: declared + * `locations: ['record', 'selection']`, it runs on one row from the kebab and + * on N rows from the selection bar. * * ## Two vocabularies reach the selection bar * @@ -42,10 +40,11 @@ * `execution: 'aggregate'` and no inline `actionDef` resolves its `name` * against `objectDef.actions` and gets the matched action attached (see * below). They own their names and win every collision either way. - * 2. `bulkActions: string[]` — bare action names, resolved against - * `objectDef.actions` and PROMOTED to that def, so they carry the action's + * 2. the object's actions placed at `selection`, and an `object-grid` + * block's `bulkActions: string[]` (bare action names, resolved against + * `objectDef.actions`) — each PROMOTED to a def, so they carry the action's * label, icon, `visible` predicate, `requiredPermissions` gate, confirm text - * and params instead of a bare humanized name. The bare-string form always promotes to the + * and params instead of a bare humanized name. A promoted action always takes the * per-record dispatch — it has nowhere to carry an `execution` flag, so * aggregate mode (objectui#3139) requires the authored-def form above. * @@ -77,8 +76,8 @@ * * ## A name the object does not declare draws nothing * - * `bulkActions: ['']` "names an action the object declares" - * (`packages/spec/src/ui/bulk-action.zod.ts`), and lint `action-name-undefined` + * An `object-grid` block's `bulkActions: ['']` names an action + * the object declares, and lint `action-name-undefined` * (ADR-0049) refuses any other name at authoring. The selection bar holds the * same line at render: a name with no match in `objectDef.actions` gets no * button. That covers a misspelling and an action a disabled package withholds @@ -92,6 +91,7 @@ */ import type { BulkActionDef, BulkActionParam } from '@object-ui/types'; +import { actionRendersAt, readActionLayoutArm } from '@object-ui/types'; import type { ActionParamDef } from '@object-ui/core'; // The ONE action-param resolver, shared with app-shell's single-record dialog // (objectui#12105). ⛔ Never re-implement any of its field lookup here. @@ -342,8 +342,8 @@ function describeMember(member: unknown): string { } if (typeof member !== 'object') { const rewrite = typeof member === 'string' && member.length > 0 - ? ` Write \`{ name: '${member}', operation: 'custom' }\` here, or move the bare name to ` - + '`bulkActions`, which resolves it against the object\'s declared actions and promotes the match.' + ? ` Write \`{ name: '${member}', operation: 'custom' }\` here, or add \`'selection'\` to the ` + + '`locations` of the action of that name, which puts it on the selection bar of every grid of its object.' : ''; return `the entry is a ${typeof member} (${quote(member)}), not a def object — this key's ` + `members are full \`BulkActionDef\` objects, used as authored.${rewrite}`; @@ -403,9 +403,61 @@ export function describeUnusableBulkActionDefs( + 'bar uses it as the button\'s React key AND as the source of its label.'; } +/** The selection bar's order and buttons, from the object's `actionLayout.selection`. */ +export interface SelectionBarActions { + /** The object's actions placed at `selection`, in the bar's order. */ + readonly actions: readonly NamedActionDef[]; + /** + * The arm's `pinned` names: the bar's buttons, in order. `undefined` when the + * object sets no `selection` arm: the bar then draws the first three of its + * order as buttons. + */ + readonly pinned?: readonly string[]; +} + +/** + * The object's actions placed at `selection` (objectstack#36496), in the + * selection bar's order: the ones `actionLayout.selection.pinned` names, in + * that order, then the ones its `more` names, in that order, then the rest in + * their default order — `order` ascending (unset 0), then as served. The first + * action of a name wins; an unnamed one is not drawn. A name the arm gives + * that no action placed at `selection` carries draws nothing. + */ +export function selectionBarActions( + objectActions: readonly NamedActionDef[] | null | undefined, + layoutArm: unknown, +): SelectionBarActions { + const seen = new Set(); + const placed = (Array.isArray(objectActions) ? objectActions : []).filter((action) => { + const name = typeof action?.name === 'string' ? action.name : ''; + if (!name || seen.has(name)) return false; + if (!actionRendersAt(action as { locations?: readonly string[] }, 'selection')) return false; + seen.add(name); + return true; + }); + const rankOf = (a: NamedActionDef) => (typeof a.order === 'number' ? a.order : 0); + const byDefault = placed + .map((action, i) => ({ action, i })) + .sort((a, b) => rankOf(a.action) - rankOf(b.action) || a.i - b.i) + .map(({ action }) => action); + const arm = readActionLayoutArm(layoutArm); + if (!arm) return { actions: byDefault }; + const named = [...arm.pinned, ...(arm.more ?? [])]; + const lead = named + .filter((name, i) => named.indexOf(name) === i) + .map((name) => byDefault.find((a) => a.name === name)) + .filter((a): a is NamedActionDef => !!a); + return { actions: [...lead, ...byDefault.filter((a) => !lead.includes(a))], pinned: arm.pinned }; +} + export function resolveBulkActions(opts: { /** - * The view's `bulkActions` names, already stripped of the canonical + * The object's actions placed at `selection`, in the bar's order + * ({@link selectionBarActions}). Promoted ahead of `bulkActions`. + */ + selectionActions?: readonly NamedActionDef[] | null; + /** + * An `object-grid` block's `bulkActions` names, already stripped of the canonical * `'delete'` entry (it routes to the grid's `onBulkDelete`, not the runner — * same carve-out the row fold makes for `'edit'` / `'delete'`). */ @@ -422,7 +474,8 @@ export function resolveBulkActions(opts: { localizeLabel?: ActionLabelResolver; }): { /** - * Authored defs, then the promoted names in `bulkActions` order. Returned by + * Authored defs, then the object's selection actions in the bar's order, + * then the promoted names in `bulkActions` order. Returned by * REFERENCE when nothing was promoted, so a view with no names to fold keeps * its identity across renders. */ @@ -451,6 +504,7 @@ export function resolveBulkActions(opts: { : authoredMembers.filter(isUsableBulkActionDef); const names = Array.isArray(opts.bulkActions) ? opts.bulkActions : []; const objectActions = Array.isArray(opts.objectActions) ? opts.objectActions : []; + const selectionActions = Array.isArray(opts.selectionActions) ? opts.selectionActions : []; // [#3139] An authored def opting into the aggregate dispatch usually just // NAMES a declared object action (`{ name, operation: 'custom', execution: @@ -487,6 +541,14 @@ export function resolveBulkActions(opts: { const promoted: BulkActionDef[] = []; const undeclared: string[] = []; + // [objectstack#36496] The object's own selection actions first, in the bar's + // order. An authored def of the same name has claimed it and wins. + for (const action of selectionActions) { + const name = typeof action?.name === 'string' ? action.name : ''; + if (!name || claimed.has(name)) continue; + claimed.add(name); + promoted.push(toBulkActionDef(action, opts.localizeLabel)); + } for (const name of names) { if (typeof name !== 'string' || name === '') continue; // Already surfaced (an authored def of the same name, or an earlier pass diff --git a/ui/packages/plugin-list/src/ListView.tsx b/ui/packages/plugin-list/src/ListView.tsx index f3b0ce00c0d..e2facdc96aa 100644 --- a/ui/packages/plugin-list/src/ListView.tsx +++ b/ui/packages/plugin-list/src/ListView.tsx @@ -80,7 +80,7 @@ import { BOOLEAN_VALUE_TYPES, canonicalAstOperator, isAggregateCompatibleWithFie import { SystemFieldName } from '@objectstack/spec/system'; import { usePermissions } from '@object-ui/permissions'; import { RecordDetailPanel } from '@object-ui/plugin-detail'; -import { resolveBulkActions, useBulkActionItems, useUndeclaredActionNamesWarning, readListScrollState } from '@object-ui/plugin-grid'; +import { resolveBulkActions, selectionBarActions, useBulkActionItems, useUndeclaredActionNamesWarning, readListScrollState } from '@object-ui/plugin-grid'; /** * The `case 'map'` branch below builds an `object-map` schema by flattening @@ -3420,10 +3420,8 @@ export const ListView = React.forwardRef(({ // [objectstack#3720] Bulk-action gate for the NON-grid views (kanban / calendar / // gallery / …), whose bulk bar this component renders itself — the grid path - // delegates to ObjectGrid, which gates its own. A declared `bulkActions` - // entry is a WIRING declaration, not a permission grant, so the built-in - // `delete` is dropped unless the object's resolved delete affordance allows - // it: the ADR-0103 bucket lock ∧ `userActions.delete` ∧ the server's + // delegates to ObjectGrid, which gates its own. The built-in `delete` is + // dropped unless the object's resolved delete affordance allows it: the ADR-0103 bucket lock ∧ `userActions.delete` ∧ the server's // effective API operation set (objectstack#3391). Custom action ids pass through // untouched — they route through the action runner with their own gates. // [#4096] ∧ the CURRENT PRINCIPAL's `allowDelete` — the three layers above @@ -3437,12 +3435,18 @@ export const ListView = React.forwardRef(({ () => resolveAffordance('listBulkDelete', { objectSchema: objectDef as SchemaLike, objectName: schema.objectName, perms: affordancePerms }), [objectDef, schema.objectName, affordancePerms], ); + // [objectstack#36496] The bar's actions are the object's actions placed at + // `selection`, in the order its `actionLayout.selection` gives — the grid's + // own set and order (`selectionBarActions`); a list view no longer lists them. const permittedBulkActions = React.useMemo(() => { - const declared = schema.bulkActions; - if (!declared || declared.length === 0) return declared; + const declared = selectionBarActions( + objectDef?.actions as Parameters[0], + (objectDef as { actionLayout?: { selection?: unknown } } | null | undefined)?.actionLayout?.selection, + ).actions.map((action) => String(action.name)); + if (declared.length === 0) return declared; if (bulkDeleteVerdict.allowed) return declared; return declared.filter((a: unknown) => String(a).toLowerCase() !== 'delete'); - }, [schema.bulkActions, bulkDeleteVerdict]); + }, [objectDef, bulkDeleteVerdict]); /** * [objectstack#30394] What the non-grid bar DRAWS out of `permittedBulkActions`: @@ -5612,7 +5616,6 @@ export const ListView = React.forwardRef(({ * the declared `bulkActionDefs` below as that pin's control. */ ...(hostRowActionDefsOf(schema) ? { rowActionDefs: hostRowActionDefsOf(schema) } : {}), - ...(schema.bulkActions ? { batchActions: schema.bulkActions } : {}), ...(schema.bulkActionDefs ? { bulkActionDefs: schema.bulkActionDefs } : {}), // ⛔ No `options.grid` spread (objectui#6152 round 14). A grid has no // per-kind block: the spec refuses the whole `options` bag (#25923; diff --git a/ui/packages/plugin-list/src/index.tsx b/ui/packages/plugin-list/src/index.tsx index 739360e4b52..beb40dc1b53 100644 --- a/ui/packages/plugin-list/src/index.tsx +++ b/ui/packages/plugin-list/src/index.tsx @@ -328,12 +328,6 @@ const LIST_VIEW_INPUTS: ComponentInput[] = [ of: 'string', description: 'Names of the actions offered on each row\'s menu.', }, - { - name: 'bulkActions', - type: 'array', - of: 'string', - description: 'Names of the actions offered once rows are selected. Needs a multi-row `selection`.', - }, { name: 'bulkActionDefs', type: 'array', diff --git a/ui/packages/plugin-view/src/ObjectView.tsx b/ui/packages/plugin-view/src/ObjectView.tsx index 8a4dc718ea3..5c4a9680b4f 100644 --- a/ui/packages/plugin-view/src/ObjectView.tsx +++ b/ui/packages/plugin-view/src/ObjectView.tsx @@ -2797,7 +2797,9 @@ export const ObjectView: React.FC = ({ // reference (objectui#10946), so the relay type-checks as written. conditionalFormatting: currentNamedViewConfig?.conditionalFormatting ?? tableRelay.conditionalFormatting, rowActions: currentNamedViewConfig?.rowActions ?? tableRelay.rowActions, - bulkActions: currentNamedViewConfig?.bulkActions ?? tableRelay.bulkActions, + // [objectstack#36496] The `table` slot's own (an `object-grid` key); a + // named view no longer lists bulk actions — the object's `selection` ones are the grid's. + bulkActions: tableRelay.bulkActions, // Same as `conditionalFormatting`: the protocol's `visible` expression // wire may carry `ast` alongside (or, on the installed spec, instead of) // `source`, and `BulkActionDef.visible` reads that slot by reference @@ -3234,7 +3236,9 @@ export const ObjectView: React.FC = ({ appearance: currentNamedViewConfig?.appearance ?? activeView?.appearance, rowActions: currentNamedViewConfig?.rowActions ?? activeView?.rowActions ?? (schema as any).rowActions, rowActionDefs: (activeView as any)?.rowActionDefs ?? (schema as any).rowActionDefs, - bulkActions: currentNamedViewConfig?.bulkActions ?? activeView?.bulkActions ?? (schema as any).bulkActions, + // [objectstack#36496] A view no longer lists bulk actions: the grid draws the + // object's `selection` ones. The host's own composition key still relays. + bulkActions: (schema as any).bulkActions, bulkActionDefs: currentNamedViewConfig?.bulkActionDefs ?? activeView?.bulkActionDefs, sharing: currentNamedViewConfig?.sharing ?? activeView?.sharing ?? (schema as any).sharing, addRecord: currentNamedViewConfig?.addRecord ?? activeView?.addRecord ?? (schema as any).addRecord, diff --git a/ui/packages/types/src/objectql.ts b/ui/packages/types/src/objectql.ts index 71ee1e39383..65a1390ea51 100644 --- a/ui/packages/types/src/objectql.ts +++ b/ui/packages/types/src/objectql.ts @@ -647,13 +647,12 @@ type SpecNamedViewBulkActionDef = NonNullable< * a def derived from an object action ({@link BulkActionDef.actionDef}), * dispatches that action once per record through the action runner. * - * Two sources feed the bar (folded by `resolveBulkActions` in plugin-grid): - * defs authored inline in the view JSON, and the view's `bulkActions: string[]` - * names — each resolved against `objectDef.actions` and promoted to that def - * when it matches one. Naming the action in the view is the only way to declare - * a bulk action: spec 17 retired `action.bulkEnabled` as a tombstone and - * prescribes exactly this. Names that match nothing still render as by-name - * buttons, since a consumer may have registered a runner handler under one. + * Sources feed the bar (folded by `resolveBulkActions` in plugin-grid): defs + * authored inline in the view JSON, the object's actions placed at + * `selection` (objectstack#36496; ordered by the object's + * `actionLayout.selection`), and an `object-grid` block's `bulkActions: + * string[]` names — each action promoted to a def. A name that matches no + * declared action draws nothing. */ export interface BulkActionDef { /** Stable identifier — also used as the action key in audit logs. */ @@ -762,9 +761,9 @@ export interface BulkActionDef { */ execution?: 'perRecord' | 'aggregate'; /** - * Source object `ActionDef` when this entry was PROMOTED from a - * `bulkActions: ['']` entry resolved against `objectDef.actions` - * (objectui#3002) — or attached by `resolveBulkActions` when an authored def + * Source object `ActionDef` when this entry was PROMOTED from an action + * placed at `selection`, or from a block's `bulkActions: ['']` entry + * resolved against `objectDef.actions` (objectui#3002) — or attached by `resolveBulkActions` when an authored def * with `execution: 'aggregate'` names a declared object action (#3139). * * Presence of this key changes what `operation: 'custom'` means: instead of @@ -1311,9 +1310,10 @@ export interface ObjectGridSchema extends BaseSchema { batchActions?: string[]; /** - * Bulk action identifiers (action names from ActionSchema). - * Aligned with @objectstack/spec ListViewSchema.bulkActions — the - * canonical key; `batchActions` is the legacy ObjectUI alias. + * Bulk action identifiers (action names from ActionSchema): the + * `object-grid` block's own list, folded after the object's actions placed + * at `selection` (objectstack#36496; a list view no longer carries one). + * `batchActions` is the legacy ObjectUI alias. */ bulkActions?: string[]; From 28595970c355726c3752b3680d4885d484842dcc Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:54:03 +0000 Subject: [PATCH 3/9] wip: lint, examples, ledgers, tests and changeset for the selection location Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- .changeset/36496-selection-bulk-actions.md | 26 +++++ examples/app-showcase/src/ui/actions/index.ts | 12 +- .../src/ui/actions/predicate-matrix.action.ts | 37 ++++--- .../src/ui/views/field-zoo.view.ts | 38 ++----- .../app-showcase/src/ui/views/task.view.ts | 11 +- .../src/reference-integrity-suite.test.ts | 2 +- packages/lint/src/rule-explanations.ts | 24 ++-- .../lint/src/runtime-gate.view-writes.test.ts | 3 +- packages/lint/src/showcase-shape.fixtures.ts | 1 - .../validate-action-dispatch-contract.test.ts | 103 ++++++++++-------- .../src/validate-action-dispatch-contract.ts | 41 +++++-- .../src/validate-action-locations.test.ts | 14 +-- .../lint/src/validate-action-locations.ts | 20 ++-- .../src/validate-action-name-refs.test.ts | 52 +++++---- .../lint/src/validate-action-name-refs.ts | 33 +++--- .../lint/src/validate-list-view-field-refs.ts | 2 +- .../src/validate-object-action-layout.test.ts | 16 +++ .../lint/src/validate-object-action-layout.ts | 18 ++- .../en.metadata-forms.generated.ts | 4 + .../es-ES.metadata-forms.generated.ts | 4 + .../es-ES.source-hashes.generated.ts | 2 + .../ja-JP.metadata-forms.generated.ts | 4 + .../ja-JP.source-hashes.generated.ts | 2 + .../zh-CN.metadata-forms.generated.ts | 4 + .../zh-CN.source-hashes.generated.ts | 2 + .../spec/dropped-refinements.baseline.json | 2 +- packages/spec/liveness/action.json | 4 +- packages/spec/liveness/object.json | 29 ++++- packages/spec/liveness/state-counts/object.md | 2 +- packages/spec/liveness/state-counts/view.md | 2 +- packages/spec/liveness/view.json | 5 +- .../src/data/object-action-layout.test.ts | 2 +- .../spec/src/data/object.metadata-form.ts | 3 +- .../src/migrations/semantic-relevance.test.ts | 6 +- packages/spec/src/ui/action.test.ts | 3 +- packages/spec/src/ui/bulk-action.test.ts | 12 +- ...nent-list-family-typed-members.pin.test.ts | 9 +- packages/spec/src/ui/component.zod.ts | 18 +-- .../registry-inputs-spec-parity.test.ts | 4 - ...nterfaceListPage.relayCensus-11572.test.ts | 6 +- ...ew.bulkWiredHeaderDuplicate-12462.test.tsx | 39 ++++--- .../src/renderers/relatedListActions.ts | 2 +- ui/packages/plugin-list/src/ListView.tsx | 41 +++---- .../ListView.bulkDeleteVisibleWhen.test.tsx | 7 +- .../ListView.crossPageSelectAll.test.tsx | 1 - ...istView.nonGridBulkDeclared-30394.test.tsx | 99 +++++++---------- .../ListView.nonGridBulkGate-30535.test.tsx | 27 ++--- .../__tests__/ListView.permissions.test.tsx | 11 +- .../src/__tests__/ListView.test.tsx | 1 - .../ListViewBlock.specInputs-13047.test.tsx | 5 - ui/packages/plugin-view/src/ObjectView.tsx | 5 +- ui/packages/types/src/objectql.ts | 10 +- 52 files changed, 453 insertions(+), 377 deletions(-) create mode 100644 .changeset/36496-selection-bulk-actions.md diff --git a/.changeset/36496-selection-bulk-actions.md b/.changeset/36496-selection-bulk-actions.md new file mode 100644 index 00000000000..50f4e6884d7 --- /dev/null +++ b/.changeset/36496-selection-bulk-actions.md @@ -0,0 +1,26 @@ +--- +'@objectstack/spec': minor +'@objectstack/lint': minor +'@objectstack/platform-objects': patch +'@object-ui/types': minor +'@object-ui/plugin-grid': minor +'@object-ui/plugin-list': minor +'@object-ui/plugin-view': patch +'@object-ui/i18n': patch +--- + +feat(spec)!: actions that act on many records are placed at `selection`; the object's `actionLayout.selection` orders the selection bar, and a list view's `bulkActions` is retired + +Clause-②: yes (narrowing) +Metadata-protocol: narrowed + + + +**BREAKING** for metadata that lists bulk actions on a list view: + +- **`view.list.bulkActions` / `object.listViews.*.bulkActions` is refused at parse** (and authoring it is a `tsc` error). FROM `list: { bulkActions: ['mark_done', 'recalc'] }` TO `locations: [..., 'selection']` on the actions `mark_done` and `recalc`; when the order the lists gave is not the default (by `order`, then declaration order), also `actionLayout: { selection: { pinned: [...], more: [...] } }` on the object. Fix: run `os migrate meta --from 18` to list the edits; `--write` applies the ones it can prove (strip the key, add `'selection'`, write the arm), and hands back as a TODO an object whose lists name `delete`, disagree on order, or need an arm on an object the stack does not declare. +- **Multi-select now shows the same actions on every grid view of an object**: every action placed at `selection`, in the arm's order, with a view's own `bulkActionDefs` first (an authored def claims its name). A view that listed none of them now draws them too. The built-in Delete keeps its place wherever the object allows a delete; `actionLayout.selection.pinned: []` moves it, and every other action, into the bar's 「More」. +- **`@object-ui/types` `ListViewSchema.bulkActions` is `never`**, and the `list-view` block's `bulkActions` input is removed. The `object-grid` block's own `bulkActions` / `batchActions` props are unchanged. +- **`action-dispatch-contract-mismatch`** now judges an action placed at `selection` (one dispatch per selected record) against its declared `execution`; an action placed at `selection` that declares `execution: 'aggregate'` is refused, with the fix "move it from `selection` to an aggregate `bulkActionDefs` entry". + +The retirement kit: the tombstone's prescription (parse and `tsc`), the protocol-19 conversion `view-bulk-actions-to-action-selection`, the `RETIRED_KEYS_BY_MAJOR` entries `ui/ListView:bulkActions` and `ui/ObjectListView:bulkActions`, and the semantic entry `view-bulk-actions-declared-on-the-action`. A stored `view` row arrives without its object's actions, so the conversion leaves it as stored and reports a TODO; sources and package artifacts that carry the actions beside the views are rewritten. diff --git a/examples/app-showcase/src/ui/actions/index.ts b/examples/app-showcase/src/ui/actions/index.ts index 5f75f191a1e..709a74b0df5 100644 --- a/examples/app-showcase/src/ui/actions/index.ts +++ b/examples/app-showcase/src/ui/actions/index.ts @@ -92,7 +92,8 @@ export const MarkDoneAction = defineAction({ visible: 'has(record.done) && record.done != true', // No `record_section`: the Task Detail header already draws it, and its // quick-actions bar carries only what the header does not (one action row). - locations: ['record'], + // `selection`: the selection bar of every task grid (objectstack#36496). + locations: ['record', 'selection'], refreshAfter: true, }); @@ -197,8 +198,9 @@ export const RecalcEstimateAction = defineAction({ // takes the standard page, which draws no `record_section` action — the // ⋯ overflow is where the action is found there. The authored header lists // its action ids and leaves this one out, so the full page still draws it - // once, in the bar. - locations: ['record_section', 'record_page'], component: 'action:menu', + // once, in the bar. `selection`: the selection bar of every task grid + // (objectstack#36496), one POST per selected record. + locations: ['record_section', 'record_page', 'selection'], component: 'action:menu', // The endpoint is record-scoped and rejects a body without an id. On a // record surface the page supplies it; invoked from a LIST ROW (see the // `legacy_row_actions` view) nothing else can, so name the body key the @@ -212,7 +214,7 @@ export const RecalcEstimateAction = defineAction({ * (objectui#3139). Since #17319 the ACTION declares the contract its body is * written for (`execution: 'aggregate'`, below) and the VIEW performs the * dispatch through a `bulkActionDefs` entry naming it with the same key and - * value (see `task.view.ts` → `bulk_actions`); a bare-string wiring of it is + * value (see `task.view.ts` → `bulk_actions`); a `selection` placement of it is * now refused at authoring time instead of quietly recalculating one row. The * renderer then dispatches it ONCE for the whole selection, with every * selected id in `params._selectedIds` — the recalc endpoint's flow runs the @@ -250,7 +252,7 @@ export const RecalcSelectionAction = defineAction({ // #17319 — ONE dispatch for the whole selection, every id in // `params._selectedIds`. The view's `bulkActionDefs` entry still performs // the dispatch; this declares what the body was written to receive, so a - // bare-string `bulkActions` wiring of it is refused rather than silently + // `selection` placement of it is refused rather than silently // recalculating one row out of ten. execution: 'aggregate', // This toast shows only at the single-record placement below: the selection diff --git a/examples/app-showcase/src/ui/actions/predicate-matrix.action.ts b/examples/app-showcase/src/ui/actions/predicate-matrix.action.ts index 746a4debd12..76658fba0ab 100644 --- a/examples/app-showcase/src/ui/actions/predicate-matrix.action.ts +++ b/examples/app-showcase/src/ui/actions/predicate-matrix.action.ts @@ -23,7 +23,7 @@ * | list toolbar | above the list — no record in scope | * | row kebab (`record_row`) | the `⋮` menu on each row | * | record header (`record` / `record_page`) | the detail page | - * | selection bar | after ticking rows, from the view's `bulkActions` | + * | selection bar (`selection`) | after ticking rows, on every grid of the object | * * They have drifted before, in both directions: the selection bar ignored * `requiredPermissions` entirely, so an action the row kebab hid from an @@ -96,7 +96,7 @@ * all evaluate on the record header and in its `⋯` overflow. Where the same * action is also declared elsewhere it agrees: the row `⋮` menu matches the * header on both specimens, and so does the selection bar for the six - * specimens the view names in `bulkActions`. `record` / `record_page` + * specimens placed at `selection`. `record` / `record_page` * hand the predicate to `evalRowPredicate` WHOLE, so the * `{ dialect: 'cel' }` envelope `defineAction` normalizes to is routed to * the canonical engine rather than flattened onto a dialect guess. @@ -153,6 +153,13 @@ const echo = { */ const RECORD_SURFACES = ['record'] as const; +/** + * The record surfaces plus the selection bar (`selection`, objectstack#36496): + * the ten gates compared across all four surfaces, drawn on the bar of every + * grid of the object once rows are ticked. + */ +const SELECTION_SURFACES = [...RECORD_SURFACES, 'selection'] as const; + // ─────────────────────────────────────────────────────────────────────────── // 1 — Surface parity: ONE predicate over a relation field, on every surface // ─────────────────────────────────────────────────────────────────────────── @@ -171,8 +178,8 @@ const RECORD_SURFACES = ['record'] as const; * COLUMNS, so `gated_columns` (which shows `f_lookup` and not `f_lookups`) * expands exactly one side of this comparison while the default list expands * neither. Same records, same predicate, and before objectui#3501 two different - * answers. Declared on all three record surfaces and named in both views' - * `bulkActions`, so a disagreement shows up as a button in one place and not + * answers. Declared on all three record surfaces and placed at `selection`, + * so a disagreement shows up as a button in one place and not * another. * * Neither field is a column on the default list, which also puts the `$select` @@ -190,7 +197,7 @@ export const ZooRelationGateAction = defineAction({ visible: 'has(record.f_lookup) && has(record.f_lookups) && record.f_lookups != null' + ' && record.f_lookups.size() > 0 && record.f_lookup == record.f_lookups[0]', - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -219,7 +226,7 @@ export const ZooOwnerGateAction = defineAction({ body: echo, successMessage: 'You own this specimen.', visible: 'has(record.owner_id) && record.owner_id == os.user.id', - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -240,7 +247,7 @@ export const ZooUserIdentityGateAction = defineAction({ body: echo, successMessage: 'You are the assigned user on this specimen.', visible: 'has(record.f_user) && record.f_user == os.user.id', - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -259,7 +266,7 @@ export const ZooUserIdentityGateAction = defineAction({ * | row `⋮` menu (`record`) | OFFERED | absent | * * ⚠️ The selection bar is deliberately NOT a row of that table: this action is - * not named in either view's `bulkActions` (`field-zoo.view.ts`), so it never + * not placed at `selection`, so it never * reaches that surface at all — an absence of DECLARATION, which would read as * an absence of dialect support if tabulated beside the other two. The * three-surface agreement is pinned instead by the neighbours that ARE declared @@ -333,7 +340,7 @@ export const ZooVisibleStringAction = defineAction({ type: 'script', body: echo, visible: 'has(record.f_boolean) && record.f_boolean == true', - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -346,7 +353,7 @@ export const ZooVisibleTaggedAction = defineAction({ type: 'script', body: echo, visible: P`has(record.f_boolean) && record.f_boolean == true`, - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -359,7 +366,7 @@ export const ZooVisibleEnvelopeAction = defineAction({ type: 'script', body: echo, visible: { dialect: 'cel', source: 'has(record.f_boolean) && record.f_boolean == true' }, - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -397,7 +404,7 @@ export const ZooPermHeldAction = defineAction({ type: 'script', body: echo, requiredPermissions: ['showcase.export_data'], - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -416,7 +423,7 @@ export const ZooPermMissingAction = defineAction({ type: 'script', body: echo, requiredPermissions: ['showcase.restricted_ops'], - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -433,7 +440,7 @@ export const ZooPermAndAction = defineAction({ type: 'script', body: echo, requiredPermissions: ['showcase.export_data', 'showcase.restricted_ops'], - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); @@ -451,7 +458,7 @@ export const ZooPermEmptyAction = defineAction({ type: 'script', body: echo, requiredPermissions: [], - locations: [...RECORD_SURFACES], + locations: [...SELECTION_SURFACES], refreshAfter: false, }); diff --git a/examples/app-showcase/src/ui/views/field-zoo.view.ts b/examples/app-showcase/src/ui/views/field-zoo.view.ts index 645955d179d..acaf757d2cb 100644 --- a/examples/app-showcase/src/ui/views/field-zoo.view.ts +++ b/examples/app-showcase/src/ui/views/field-zoo.view.ts @@ -65,9 +65,11 @@ export const FieldZooViews = defineView({ }, ], - /** - * The selection-bar half of the matrix. Each name resolves against the - * object's declared actions and is promoted into a selection-bar button + /* + * The selection-bar half of the matrix: the ten gate actions are placed at + * `selection` (`predicate-matrix.action.ts`), so this view and every other + * grid of the object draw them once rows are ticked (objectstack#36496). + * Each is promoted into a selection-bar button * carrying that action's label, icon, `visible` AND `requiredPermissions` — * the last of which the bar used to drop on the floor (objectui#3492), so * an action hidden in the row kebab reappeared here the moment a row was @@ -95,18 +97,6 @@ export const FieldZooViews = defineView({ * • `showcase_zoo_perm_empty` — always present; an empty declaration * passes. */ - bulkActions: [ - 'showcase_zoo_relation_gate', - 'showcase_zoo_owner_gate', - 'showcase_zoo_user_gate', - 'showcase_zoo_visible_string', - 'showcase_zoo_visible_tagged', - 'showcase_zoo_visible_envelope', - 'showcase_zoo_perm_held', - 'showcase_zoo_perm_missing', - 'showcase_zoo_perm_and', - 'showcase_zoo_perm_empty', - ], }, listViews: { @@ -131,18 +121,6 @@ export const FieldZooViews = defineView({ { field: 'f_boolean' }, { field: 'f_rating' }, ], - bulkActions: [ - 'showcase_zoo_relation_gate', - 'showcase_zoo_owner_gate', - 'showcase_zoo_user_gate', - 'showcase_zoo_visible_string', - 'showcase_zoo_visible_tagged', - 'showcase_zoo_visible_envelope', - 'showcase_zoo_perm_held', - 'showcase_zoo_perm_missing', - 'showcase_zoo_perm_and', - 'showcase_zoo_perm_empty', - ], }, /** @@ -152,9 +130,9 @@ export const FieldZooViews = defineView({ * specimens it acts on Full and reports Minimal as skipped, rather than * quietly including it. * - * #17319 — `showcase_zoo_visible_string` is wired BOTH ways in this file: as a - * bare string in the two `bulkActions` lists above (per-record) and here as an - * aggregate def. That is deliberate and it stays UNDECLARED: its body + * #17319 — `showcase_zoo_visible_string` is wired BOTH ways: placed at + * `selection` (per-record, on every grid of the object) and here as an + * aggregate def, which claims its name on this view's bar. That is deliberate and it stays UNDECLARED: its body * (`predicate-matrix.action.ts`) reads `ctx.recordId` AND `input._selectedIds` * and copes with either, which is the one honest reason to omit `action.execution`. * ⛔ Declaring either contract on it would make the OTHER wiring a lint error diff --git a/examples/app-showcase/src/ui/views/task.view.ts b/examples/app-showcase/src/ui/views/task.view.ts index 9690d9bad2f..f87b554bf20 100644 --- a/examples/app-showcase/src/ui/views/task.view.ts +++ b/examples/app-showcase/src/ui/views/task.view.ts @@ -152,10 +152,10 @@ export const TaskViews = defineView({ // ── Bulk actions — one declared action over the SELECTED records ────── // The selection-bar twin of `legacy_row_actions` above, and — unlike that - // fixture — the CANONICAL authoring form, not a legacy one. `bulkActions` - // is the only way to declare a bulk action: `action.bulkEnabled` was - // retired in spec 17 (#3896 close-out) precisely because nothing ever - // consumed it, and its tombstone prescribes this key instead. + // fixture — the CANONICAL authoring form, not a legacy one. An action + // placed at `selection` is a per-record bulk action (objectstack#36496; + // until protocol 19 a view's `bulkActions` list named it), drawn on the + // selection bar of EVERY grid view of the object, this one included. // // Complements `project.view.ts`'s `bulkActionDefs`, which is the OTHER // bulk vocabulary: inline defs that mass-EDIT records through the data @@ -180,7 +180,7 @@ export const TaskViews = defineView({ // dispatch shape; results are all-or-nothing, no per-row retry. // // None declares `list`: a bulk action is not a toolbar action, - // it needs a selection. Naming it here is the whole declaration. + // it needs a selection. `selection` in its `locations` is the whole declaration. bulk_actions: { label: 'Bulk Actions', type: 'grid', @@ -192,7 +192,6 @@ export const TaskViews = defineView({ { field: 'progress' }, { field: 'done' }, ], - bulkActions: ['showcase_mark_done', 'showcase_recalc_estimate'], bulkActionDefs: [ { name: 'showcase_recalc_selection', operation: 'custom', execution: 'aggregate' }, ], diff --git a/packages/lint/src/reference-integrity-suite.test.ts b/packages/lint/src/reference-integrity-suite.test.ts index 8ea57a88785..1f9660673a7 100644 --- a/packages/lint/src/reference-integrity-suite.test.ts +++ b/packages/lint/src/reference-integrity-suite.test.ts @@ -219,7 +219,7 @@ describe('reference-integrity suite — every member actually runs', () => { name: 'all_leads', data: { provider: 'object', object: 'crm_lead' }, // validateActionNameRefs: no such action. - bulkActions: ['mass_update'], + rowActions: ['mass_update'], }, // validateTranslatableSections (#5417): a form section authored with a // `label` and no `name`. `_sections` is keyed by name, so this heading diff --git a/packages/lint/src/rule-explanations.ts b/packages/lint/src/rule-explanations.ts index 2584f6eff71..9f6427de083 100644 --- a/packages/lint/src/rule-explanations.ts +++ b/packages/lint/src/rule-explanations.ts @@ -3355,8 +3355,8 @@ const ACTION_DISPATCH_CONTRACT_MISMATCH_EXPLANATION: RuleExplanation = { rule: 'action-dispatch-contract-mismatch', covers: 'how the two bulk wirings call an action', paragraphs: [ - 'A list view can wire one declared action two ways, and they hand the same body OPPOSITE input. ' + - '`bulkActions: [\'NAME\']`, the bare-string form, is `execution: \'perRecord\'`: the renderer ' + + 'A selection can run one declared action two ways, and they hand the same body OPPOSITE input. ' + + 'The action placed at `selection` is `execution: \'perRecord\'`: the renderer ' + 'promotes the action to a def and dispatches it ONCE PER selected row, each call carrying that ' + 'row\'s `recordId` and no `_selectedIds`. A `bulkActionDefs` entry with ' + '`execution: \'aggregate\'` dispatches ONCE for the whole selection, with every selected id in ' + @@ -3368,11 +3368,11 @@ const ACTION_DISPATCH_CONTRACT_MISMATCH_EXPLANATION: RuleExplanation = { 'reads like a selection bug rather than a wiring one.', 'Nothing refuses it at runtime: `recordId` and `_selectedIds` are both builtin action params ' + '(ADR-0104), so the strict params gate admits either bag, and no single parse sees both ends — ' + - 'the wiring lives on the view, the declaration on the action. The verdict names both contracts ' + + 'an aggregate def lives on the view, the declaration on the action. The verdict names both contracts ' + 'because the fix is a choice between them.', 'To fix it, pick the contract the body is actually written for and make both ends say it: change the ' + - 'action\'s `execution` to the wiring\'s when the body was written for the wiring, or rewire the view ' + - 'to the declaration when it was written for the declaration. If the two wirings are both wanted, ' + + 'action\'s `execution` to the wiring\'s when the body was written for the wiring, or rewire it ' + + '(the `selection` location or the view\'s def) to the declaration when it was written for the declaration. If the two wirings are both wanted, ' + 'they are two actions: one call and N calls have different side effects, which is why the platform ' + 'will not silently unify them.', 'Not reported: an action that declares no `execution` (undeclared is not defaulted to either ' + @@ -5773,7 +5773,7 @@ const ACTION_NAME_UNDEFINED_EXPLANATION: RuleExplanation = { paragraphs: [ // The surfaces are held to the rule by its test, each fired. 'These surfaces bind an action by NAME rather than by its `locations`, each through a plain ' + - 'string the schema cannot check: a list view\'s `rowActions`, `bulkActions` and each ' + + 'string the schema cannot check: a list view\'s `rowActions` and each ' + '`bulkActionDefs` entry with `execution: \'aggregate\'` (on a view\'s default `list`, each ' + '`listViews` entry, and an object\'s own `listViews`); a `record:quick_actions` component\'s ' + '`actionNames`; a `record:alert` call-to-action (`action.actionName`); a `page:header`\'s ' + @@ -5789,8 +5789,8 @@ const ACTION_NAME_UNDEFINED_EXPLANATION: RuleExplanation = { 'To fix a miss, define the action — a `stack.actions` entry or an entry of the object\'s `actions` — ' + 'placed where the surface looks for it, or remove the reference. A `page:header` draws only actions ' + 'placed at `record` or `record_page`, so a header action needs one of the two in its ' + - '`locations`; the selection bar and an alert\'s call-to-action place an action by name, with no ' + - '`locations` entry.', + '`locations`; an aggregate `bulkActionDefs` entry and an alert\'s call-to-action place an action ' + + 'by name, with no `locations` entry.', // The drawn locations are held to the rule by its test, over every location. 'A `record:related_list` is the exception, and resolves the way its renderer does: against the ' + 'RELATED object\'s own actions (written on it, or a `stack.actions` entry bound to it by ' + @@ -6512,10 +6512,10 @@ const ACTION_NO_PLACEMENT_EXPLANATION: RuleExplanation = { 'declaration that renders nothing.', // Held equal to `ACTION_LOCATIONS` (`@objectstack/spec/ui`) by the rule's test. 'The locations an action can declare: `list`, `record`, `record_page`, `record_row`, ' + - '`record_related`, `record_section`. A list view places an action by NAME instead: naming it in ' + - '`bulkActions` or `bulkActionDefs` puts it on the selection bar, which the view drives, never ' + - '`locations` (an action that only makes sense over a selection has no single-record location). ' + - 'A name in `rowActions` counts as placement too.', + '`record_related`, `record_section`, `selection`. `selection` is the selection bar a grid shows ' + + 'once rows are selected (an action that only makes sense over a selection has no single-record ' + + 'location). A list view can also place an action by NAME: an aggregate `bulkActionDefs` entry or ' + + 'a name in `rowActions` counts as placement.', '`locations: []` is the documented headless shape and is never reported: the action stays callable ' + 'over REST, MCP and AI and keeps its capability gate, params contract and audit trail while ' + 'claiming no UI surface. ADR-0110 D3 refuses an undeclared handler, so a headless declaration is ' + diff --git a/packages/lint/src/runtime-gate.view-writes.test.ts b/packages/lint/src/runtime-gate.view-writes.test.ts index 1a1f536b6be..094936135e6 100644 --- a/packages/lint/src/runtime-gate.view-writes.test.ts +++ b/packages/lint/src/runtime-gate.view-writes.test.ts @@ -195,7 +195,7 @@ describe('a flattened list overlay at the runtime publish gate (#9313)', () => { // (measured by ablation — crossing it left this test green). The // behavioural discriminator is the CONTAINER control below; the // declaration itself is pinned by the member-surface test. - const result = gate(overlay({ rowActions: ['close_case'], bulkActions: ['mass_close'] })); + const result = gate(overlay({ rowActions: ['close_case', 'mass_close'] })); expect(result.errors, JSON.stringify(result.errors)).toEqual([]); // The suite RAN — the zero above is a dispatch decision, not a dead gate. expect(result.rulesRun).toContain('validateReferenceIntegrity'); @@ -216,7 +216,6 @@ describe('a flattened list overlay at the runtime publish gate (#9313)', () => { data: { provider: 'object', object: 'crm_case' }, columns: ['name', 'status'], rowActions: ['stack_level_close_case'], - bulkActions: ['stack_level_mass_close'], }, }; const result = gate(container); diff --git a/packages/lint/src/showcase-shape.fixtures.ts b/packages/lint/src/showcase-shape.fixtures.ts index 3751a315520..4fa831a57e9 100644 --- a/packages/lint/src/showcase-shape.fixtures.ts +++ b/packages/lint/src/showcase-shape.fixtures.ts @@ -173,7 +173,6 @@ export const SnapshotTaskViews = defineView({ { field: 'progress' }, { field: 'done' }, ], - bulkActions: ['showcase_mark_done', 'showcase_recalc_estimate'], bulkActionDefs: [ { name: 'showcase_recalc_selection', operation: 'custom', execution: 'aggregate' }, ], diff --git a/packages/lint/src/validate-action-dispatch-contract.test.ts b/packages/lint/src/validate-action-dispatch-contract.test.ts index e01c90d9478..6e904e4a3a0 100644 --- a/packages/lint/src/validate-action-dispatch-contract.test.ts +++ b/packages/lint/src/validate-action-dispatch-contract.test.ts @@ -41,16 +41,16 @@ const stack = (actions: Record[], list: Record const PER_RECORD = { name: 'recalc_estimate', label: 'Recalc', type: 'api', execution: 'perRecord' }; const AGGREGATE = { name: 'recalc_selection', label: 'Recalc all', type: 'api', execution: 'aggregate' }; const UNDECLARED = { name: 'mark_done', label: 'Mark done', type: 'script' }; +/** The per-row wiring since protocol 19 (objectstack#36496): the action placed at `selection`. */ +const placed = (action: Record) => ({ ...action, locations: ['selection'] }); describe('validateActionDispatchContract — the refusal (both directions)', () => { - it('refuses an `aggregate`-declared action wired as a bare string', () => { - const findings = validateActionDispatchContract( - stack([AGGREGATE], { bulkActions: ['recalc_selection'] }), - ); + it('refuses an `aggregate`-declared action placed at `selection`', () => { + const findings = validateActionDispatchContract(stack([placed(AGGREGATE)], {})); expect(findings).toHaveLength(1); expect(findings[0]!.severity).toBe('error'); expect(findings[0]!.rule).toBe(ACTION_DISPATCH_CONTRACT_MISMATCH); - expect(findings[0]!.path).toBe('views[0].list.bulkActions[0]'); + expect(findings[0]!.path).toBe('actions[0].locations[0]'); }); it('refuses a `perRecord`-declared action wired through an aggregate def', () => { @@ -64,12 +64,13 @@ describe('validateActionDispatchContract — the refusal (both directions)', () expect(findings[0]!.path).toBe('views[0].list.bulkActionDefs[0]'); }); - // The ruling's own words for item 2: the refusal names the action, the view - // and BOTH contracts. Asserted as four independent substrings rather than one + // The ruling's own words for item 2: the refusal names the action, where it + // is wired (the view, or the action's own `selection` placement) and BOTH + // contracts. Asserted as four independent substrings rather than one // golden string, so re-wording the prose does not silently drop a name. it('names the action, the view and BOTH contracts, in both directions', () => { for (const [findings, declared, wired] of [ - [validateActionDispatchContract(stack([AGGREGATE], { bulkActions: ['recalc_selection'] })), 'aggregate', 'perRecord'], + [validateActionDispatchContract(stack([placed(AGGREGATE)], {})), 'aggregate', 'perRecord'], [ validateActionDispatchContract( stack([PER_RECORD], { @@ -83,7 +84,7 @@ describe('validateActionDispatchContract — the refusal (both directions)', () const f = findings[0]!; const action = declared === 'aggregate' ? 'recalc_selection' : 'recalc_estimate'; expect(f.message).toContain(`"${action}"`); // the action - expect(f.where).toContain('view "task"'); // the view + expect(f.where).toContain(declared === 'aggregate' ? 'locations · selection' : 'view "task"'); // the wiring expect(f.message).toContain(`execution: '${declared}'`); // the declared contract expect(f.message).toContain(`execution: '${wired}'`); // the wired contract // …and what each one actually delivers, so the reader does not have to @@ -94,17 +95,15 @@ describe('validateActionDispatchContract — the refusal (both directions)', () }); it('offers both ends of the fix, never only one', () => { - const f = validateActionDispatchContract(stack([AGGREGATE], { bulkActions: ['recalc_selection'] }))[0]!; + const f = validateActionDispatchContract(stack([placed(AGGREGATE)], {}))[0]!; expect(f.hint).toContain("execution: 'perRecord'"); // change the declaration expect(f.hint).toContain('bulkActionDefs'); // or change the wiring }); }); describe('validateActionDispatchContract — the cost direction (must stay clean)', () => { - it('accepts a `perRecord`-declared action wired as a bare string', () => { - expect( - validateActionDispatchContract(stack([PER_RECORD], { bulkActions: ['recalc_estimate'] })), - ).toEqual([]); + it('accepts a `perRecord`-declared action placed at `selection`', () => { + expect(validateActionDispatchContract(stack([placed(PER_RECORD)], {}))).toEqual([]); }); it('accepts an `aggregate`-declared action wired through an aggregate def', () => { @@ -120,8 +119,7 @@ describe('validateActionDispatchContract — the cost direction (must stay clean it('accepts the showcase shape: both actions, both wirings, in ONE list view', () => { expect( validateActionDispatchContract( - stack([PER_RECORD, AGGREGATE, UNDECLARED], { - bulkActions: ['mark_done', 'recalc_estimate'], + stack([placed(PER_RECORD), AGGREGATE, placed(UNDECLARED)], { bulkActionDefs: [{ name: 'recalc_selection', operation: 'custom', execution: 'aggregate' }], }), ), @@ -135,8 +133,7 @@ describe('validateActionDispatchContract — the cost direction (must stay clean it('says nothing about an UNDECLARED action, even wired both ways', () => { expect( validateActionDispatchContract( - stack([UNDECLARED], { - bulkActions: ['mark_done'], + stack([placed(UNDECLARED)], { bulkActionDefs: [{ name: 'mark_done', operation: 'custom', execution: 'aggregate' }], }), ), @@ -170,15 +167,14 @@ describe('validateActionDispatchContract — the cost direction (must stay clean it("stays silent when two declarations of one name disagree — that is not the view's defect", () => { const findings = validateActionDispatchContract({ objects: [{ name: 'task', actions: [{ name: 'recalc', type: 'api', execution: 'aggregate' }] }], - actions: [{ name: 'recalc', type: 'api', execution: 'perRecord' }], - views: [{ name: 'task', object: 'task', list: { bulkActions: ['recalc'] } }], + actions: [{ name: 'recalc', type: 'api', execution: 'perRecord', locations: ['selection'] }], }); expect(findings).toEqual([]); }); it('returns nothing at all for a stack that declares no contract anywhere', () => { expect( - validateActionDispatchContract(stack([UNDECLARED], { bulkActions: ['mark_done'] })), + validateActionDispatchContract(stack([placed(UNDECLARED)], {})), ).toEqual([]); expect(validateActionDispatchContract({})).toEqual([]); }); @@ -188,20 +184,31 @@ describe('validateActionDispatchContract — every list tier', () => { it('judges `listViews.` on a view', () => { const findings = validateActionDispatchContract({ objects: [{ name: 'task' }], - actions: [AGGREGATE], + actions: [PER_RECORD], views: [ { name: 'task', object: 'task', - listViews: { bulk: { bulkActions: ['recalc_selection'] } }, + listViews: { + bulk: { bulkActionDefs: [{ name: 'recalc_estimate', operation: 'custom', execution: 'aggregate' }] }, + }, }, ], }); expect(findings).toHaveLength(1); - expect(findings[0]!.path).toBe('views[0].listViews.bulk.bulkActions[0]'); + expect(findings[0]!.path).toBe('views[0].listViews.bulk.bulkActionDefs[0]'); expect(findings[0]!.where).toContain('listViews.bulk'); }); + it("judges an OBJECT-embedded action placed at `selection`", () => { + const findings = validateActionDispatchContract({ + objects: [{ name: 'task', actions: [{ name: 'noop', type: 'script' }, placed(AGGREGATE)] }], + }); + expect(findings).toHaveLength(1); + expect(findings[0]!.path).toBe('objects[0].actions[1].locations[0]'); + expect(findings[0]!.where).toContain('object "task"'); + }); + it("judges an OBJECT's own `listViews` — the tier an object-embedded action is wired from", () => { const findings = validateActionDispatchContract({ objects: [ @@ -238,12 +245,12 @@ describe('validateActionDispatchContract — every list tier', () => { describe('validateActionDispatchContract — absence counts as disagreement (the disarm)', () => { type Findings = ReturnType; - const RECALC_AGGREGATE = { name: 'recalc', type: 'api', execution: 'aggregate' }; + const RECALC_PER_RECORD = { name: 'recalc', type: 'api', execution: 'perRecord' }; const RECALC_UNDECLARED = { name: 'recalc', type: 'api' }; /** - * One view on `task`, wiring `recalc` as a bare string (the per-record - * contract). `invoice` is an object the view never resolves through. + * One view on `task`, wiring `recalc` through an aggregate def. `invoice` + * is an object the view never resolves through. */ const disarmStack = (at: { global?: Record[]; @@ -255,46 +262,52 @@ describe('validateActionDispatchContract — absence counts as disagreement (the { name: 'invoice', actions: at.invoice ?? [] }, ], actions: at.global ?? [], - views: [{ name: 'task', object: 'task', list: { bulkActions: ['recalc'] } }], + views: [ + { + name: 'task', + object: 'task', + list: { bulkActionDefs: [{ name: 'recalc', operation: 'custom', execution: 'aggregate' }] }, + }, + ], }); const expectOneMismatch = (findings: Findings) => { expect(findings).toHaveLength(1); expect(findings[0]!.rule).toBe(ACTION_DISPATCH_CONTRACT_MISMATCH); - expect(findings[0]!.path).toBe('views[0].list.bulkActions[0]'); + expect(findings[0]!.path).toBe('views[0].list.bulkActionDefs[0]'); }; - it('CONTROL: a global `recalc` declared `aggregate`, wired as a bare string, is refused', () => { - expectOneMismatch(validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE] }))); + it('CONTROL: a global `recalc` declared `perRecord`, wired through an aggregate def, is refused', () => { + expectOneMismatch(validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD] }))); }); it('CONTROL: a same-named sibling that DECLARES the same contract leaves the finding standing', () => { expectOneMismatch( - validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE], task: [RECALC_AGGREGATE] })), + validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD], task: [RECALC_PER_RECORD] })), ); expectOneMismatch( - validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE], invoice: [RECALC_AGGREGATE] })), + validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD], invoice: [RECALC_PER_RECORD] })), ); }); it("an undeclared sibling embedded in the view's own object disarms the name", () => { - expectOneMismatch(validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE] }))); + expectOneMismatch(validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD] }))); expect( - validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE], task: [RECALC_UNDECLARED] })), + validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD], task: [RECALC_UNDECLARED] })), ).toEqual([]); }); it('an undeclared sibling on an UNRELATED object disarms the name too — declarations are not scoped by the view', () => { - expectOneMismatch(validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE] }))); + expectOneMismatch(validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD] }))); expect( - validateActionDispatchContract(disarmStack({ global: [RECALC_AGGREGATE], invoice: [RECALC_UNDECLARED] })), + validateActionDispatchContract(disarmStack({ global: [RECALC_PER_RECORD], invoice: [RECALC_UNDECLARED] })), ).toEqual([]); }); it('an undeclared GLOBAL sibling disarms an object-embedded declaration', () => { - expectOneMismatch(validateActionDispatchContract(disarmStack({ task: [RECALC_AGGREGATE] }))); + expectOneMismatch(validateActionDispatchContract(disarmStack({ task: [RECALC_PER_RECORD] }))); expect( - validateActionDispatchContract(disarmStack({ task: [RECALC_AGGREGATE], global: [RECALC_UNDECLARED] })), + validateActionDispatchContract(disarmStack({ task: [RECALC_PER_RECORD], global: [RECALC_UNDECLARED] })), ).toEqual([]); }); }); @@ -311,9 +324,7 @@ describe('[#22161] one-line verdicts — action-dispatch-contract-mismatch', () }); it('reads as one sentence in both directions', () => { - const [toPerRow] = validateActionDispatchContract( - stack([AGGREGATE], { bulkActions: ['recalc_selection'] }), - ); + const [toPerRow] = validateActionDispatchContract(stack([placed(AGGREGATE)], {})); expect(toPerRow!.message).toBe( 'action "recalc_selection" declares execution: \'aggregate\', wired as execution: \'perRecord\' ' + '(one call per row: `recordId`, no `_selectedIds`), so its body takes its single-record branch', @@ -364,9 +375,9 @@ describe('[#22161] one-line fixes — action-dispatch-contract-mismatch', () => }); it('names both ends of the fix in both directions', () => { - const [toPerRow] = validateActionDispatchContract(stack([AGGREGATE], { bulkActions: ['recalc_selection'] })); + const [toPerRow] = validateActionDispatchContract(stack([placed(AGGREGATE)], {})); expect(toPerRow!.hint).toBe( - "Declare `execution: 'perRecord'` on the action, or rewire it as " + + "Declare `execution: 'perRecord'` on the action, or move it from `selection` to " + "`bulkActionDefs: [{ name: 'recalc_selection', operation: 'custom', execution: 'aggregate' }]`", ); const [toAggregate] = validateActionDispatchContract( @@ -375,8 +386,8 @@ describe('[#22161] one-line fixes — action-dispatch-contract-mismatch', () => }), ); expect(toAggregate!.hint).toBe( - "Declare `execution: 'aggregate'` on the action, or drop the def and name it in the view's " + - "`bulkActions: ['recalc_estimate']`", + "Declare `execution: 'aggregate'` on the action, or drop the def and add `'selection'` to the " + + "action's `locations`", ); }); diff --git a/packages/lint/src/validate-action-dispatch-contract.ts b/packages/lint/src/validate-action-dispatch-contract.ts index 92e1df23919..3dc1dbd01be 100644 --- a/packages/lint/src/validate-action-dispatch-contract.ts +++ b/packages/lint/src/validate-action-dispatch-contract.ts @@ -11,7 +11,8 @@ * A list view can wire the same declared action two ways, and the two deliver * OPPOSITE input to the same body: * - * - `bulkActions: ['']` — the bare-string form. The renderer promotes + * - the action placed at `selection` (protocol 19, objectstack#36496; until + * then a view's bare-string `bulkActions: ['']`). The renderer promotes * the action to a def and dispatches it **once per selected row**: each call * carries that row's `recordId` and **no** `_selectedIds`. * - a `bulkActionDefs` entry with `execution: 'aggregate'` — **one** dispatch @@ -75,9 +76,9 @@ export interface ActionDispatchContractFinding { severity: ActionDispatchContractSeverity; /** Diagnostic rule id. */ rule: string; - /** Human-readable location, e.g. `view "crm_lead" · list "all" · bulkActions`. */ + /** Human-readable location, e.g. `action "mark_done" · locations · selection`. */ where: string; - /** Config path, e.g. `views[0].list.bulkActions[1]`. */ + /** Config path, e.g. `actions[0].locations[2]` or `views[0].list.bulkActionDefs[1]`. */ path: string; /** What is wrong. */ message: string; @@ -204,8 +205,8 @@ export function validateActionDispatchContract(stack: AnyRec): ActionDispatchCon // contract the body is written for) and why two wanted wirings are two // actions are `os explain action-dispatch-contract-mismatch`. const rewire = wired === 'perRecord' - ? `rewire it as \`bulkActionDefs: [{ name: '${name}', operation: 'custom', execution: 'aggregate' }]\`` - : `drop the def and name it in the view's \`bulkActions: ['${name}']\``; + ? `move it from \`selection\` to \`bulkActionDefs: [{ name: '${name}', operation: 'custom', execution: 'aggregate' }]\`` + : `drop the def and add \`'selection'\` to the action's \`locations\``; findings.push({ severity: 'error', @@ -238,13 +239,6 @@ export function validateActionDispatchContract(stack: AnyRec): ActionDispatchCon const list = container as AnyRec; const viewLabel = `${owner} · ${label}`; - const bare = Array.isArray(list.bulkActions) ? list.bulkActions : []; - for (let ai = 0; ai < bare.length; ai++) { - const name = strName(bare[ai]); - if (!name) continue; - check(name, 'perRecord', `${viewLabel} · bulkActions`, `${path}.bulkActions[${ai}]`); - } - // Only an `execution: 'aggregate'` def NAMES an action (#4457): an // `update`/`delete` def is a data-plane mass mutation whose `name` is a // button id, and a hand-inlined `actionDef` carries its own dispatcher and @@ -267,6 +261,29 @@ export function validateActionDispatchContract(stack: AnyRec): ActionDispatchCon } }; + // ── Actions placed at `selection`: the per-row wiring, declared on the action ── + // Protocol 19 (objectstack#36496) moved the bare-string wiring off the view: + // a selection runs every action placed at `selection` once per selected row. + const checkPlaced = (action: unknown, owner: string, path: string) => { + if (!action || typeof action !== 'object') return; + const a = action as AnyRec; + const name = strName(a.name); + if (!name || !Array.isArray(a.locations)) return; + const li = a.locations.indexOf('selection'); + if (li < 0) return; + check(name, 'perRecord', `${owner}action "${name}" · locations · selection`, `${path}.locations[${li}]`); + }; + const stackActions = recordsOf(stack.actions); + for (let i = 0; i < stackActions.length; i++) checkPlaced(stackActions[i], '', `actions[${i}]`); + const objectsWithActions = recordsOf(stack.objects); + for (let oi = 0; oi < objectsWithActions.length; oi++) { + const obj = objectsWithActions[oi]; + if (!obj || typeof obj !== 'object') continue; + const embedded = recordsOf(obj.actions); + const owner = `object "${strName(obj.name) ?? `#${oi}`}" · `; + for (let i = 0; i < embedded.length; i++) checkPlaced(embedded[i], owner, `objects[${oi}].actions[${i}]`); + } + // ── List views: `list` + each `listViews.`, on views AND on objects ── const views = recordsOf(stack.views); for (let vi = 0; vi < views.length; vi++) { diff --git a/packages/lint/src/validate-action-locations.test.ts b/packages/lint/src/validate-action-locations.test.ts index 82c67b92765..7c5b59c78b3 100644 --- a/packages/lint/src/validate-action-locations.test.ts +++ b/packages/lint/src/validate-action-locations.test.ts @@ -96,14 +96,6 @@ describe('validateActionLocations', () => { }); describe('— a view that places the action by NAME exempts it', () => { - it('exempts an action named in a list view’s bulkActions', () => { - const findings = validateActionLocations({ - ...unplaced(), - views: [{ name: 'crm_lead', list: { bulkActions: ['crm_convert_lead'] } }], - }); - expect(findings).toEqual([]); - }); - it('exempts an action named in a bulkActionDefs entry (incl. aggregate defs)', () => { // objectui#3139: an aggregate bulk action has no single-record location // by construction — the view naming it IS the placement. @@ -134,7 +126,7 @@ describe('validateActionLocations', () => { it('exempts via a named listViews entry, not just the default list', () => { const findings = validateActionLocations({ ...unplaced(), - views: [{ name: 'crm_lead', listViews: { hot: { bulkActions: ['crm_convert_lead'] } } }], + views: [{ name: 'crm_lead', listViews: { hot: { rowActions: ['crm_convert_lead'] } } }], }); expect(findings).toEqual([]); }); @@ -144,7 +136,7 @@ describe('validateActionLocations', () => { objects: [ { name: 'crm_lead', - listViews: { all: { bulkActions: ['crm_convert_lead'] } }, + listViews: { all: { rowActions: ['crm_convert_lead'] } }, }, ], actions: [{ name: 'crm_convert_lead', label: 'Convert', type: 'script' }], @@ -158,7 +150,7 @@ describe('validateActionLocations', () => { { name: 'named_one', type: 'script' }, { name: 'orphan_one', type: 'script' }, ], - views: [{ name: 'crm_lead', list: { bulkActions: ['named_one'] } }], + views: [{ name: 'crm_lead', list: { rowActions: ['named_one'] } }], }); expect(findings.map((f) => f.where)).toEqual(['action "orphan_one"']); }); diff --git a/packages/lint/src/validate-action-locations.ts b/packages/lint/src/validate-action-locations.ts index affb27189fd..b4eccf4200b 100644 --- a/packages/lint/src/validate-action-locations.ts +++ b/packages/lint/src/validate-action-locations.ts @@ -4,7 +4,7 @@ * [ADR-0078 Phase 3 — Tier-A `action-locations`] An action nobody placed. * * `locations` is an action's placement declaration. An action that omits it — - * and that no view names in `bulkActions` / `bulkActionDefs` / `rowActions` — + * and that no view names in `bulkActionDefs` / `rowActions` — * has no surface at all: it parses, it publishes, Setup lists it, and no user * can ever click it. ADR-0078 names this shape in its opening paragraph ("a * `summary` with no `summaryOperations`; **an `action` with no `locations`**; @@ -30,11 +30,11 @@ * who never said anything at all (key absent). * * **Actions a view places by NAME.** Naming an action in a list view's - * `bulkActions` or `bulkActionDefs` IS its placement — the selection bar is - * driven by the view, never by `locations` (that is what the retired - * `action.bulkEnabled` tombstone prescribes, and what objectui#3139's - * aggregate bulk mode relies on: an action that only makes sense over a - * selection has no single-record location by construction). `rowActions` is + * `bulkActionDefs` IS its placement — an aggregate def is driven by the view, + * never by `locations` (what objectui#3139's aggregate bulk mode relies on). + * The per-row selection bar is a location since protocol 19 + * (objectstack#36496): `selection`, which retired the view's `bulkActions` + * list. `rowActions` is * exempted on the same zero-false-positive posture (ADR-0072 D1): it is the * same field pair on the same container, and an author who named an action * there has stated an intent — a name that resolves to nothing is already @@ -94,9 +94,7 @@ function collectNamePlacedActions(stack: AnyRec): Set { const harvest = (container: unknown): void => { if (!container || typeof container !== 'object') return; const list = container as AnyRec; - for (const key of ['rowActions', 'bulkActions'] as const) { - for (const n of strList(list[key])) placed.add(n); - } + for (const n of strList(list.rowActions)) placed.add(n); // A `bulkActionDefs` entry is a loose record; its `name` is the action it // dispatches. Inline field-patch defs (`operation: 'update'`) carry a name // that matches no action — harmless here, since an unmatched name simply @@ -156,8 +154,8 @@ export function validateActionLocations(stack: AnyRec): ActionLocationsFinding[] // vocabulary, name placement and the headless shape are // `os explain action-no-placement`. hint: - 'Declare where it renders, e.g. `locations: [\'record_page\']`, place it from a list view\'s ' + - '`bulkActions`, or write `locations: []` if it is headless (REST / MCP / AI only)', + 'Declare where it renders, e.g. `locations: [\'record_page\']` or `[\'selection\']`, ' + + 'or write `locations: []` if it is headless (REST / MCP / AI only)', }); }; diff --git a/packages/lint/src/validate-action-name-refs.test.ts b/packages/lint/src/validate-action-name-refs.test.ts index 3583f293ab2..c5797c35e81 100644 --- a/packages/lint/src/validate-action-name-refs.test.ts +++ b/packages/lint/src/validate-action-name-refs.test.ts @@ -26,15 +26,15 @@ const withActions = () => ({ actions: [{ name: 'crm_convert_lead', label: 'Convert', type: 'script' }], }); -describe('validateActionNameRefs — list view bulk/row actions', () => { - // The literal HotCRM instance: three bulk actions, none of them defined. - it('errors on every undefined bulkAction', () => { +describe('validateActionNameRefs — list view row actions', () => { + // The HotCRM shape (its retired `bulkActions` list), on the surviving key. + it('errors on every undefined rowAction', () => { const findings = validateActionNameRefs({ ...withActions(), views: [ { name: 'crm_lead', - list: { bulkActions: ['mass_update', 'mass_delete', 'assign_owner'] }, + list: { rowActions: ['mass_update', 'mass_delete', 'assign_owner'] }, }, ], }); @@ -42,9 +42,9 @@ describe('validateActionNameRefs — list view bulk/row actions', () => { expect(findings.every((f) => f.severity === 'error')).toBe(true); expect(findings.every((f) => f.rule === ACTION_NAME_UNDEFINED)).toBe(true); expect(findings.map((f) => f.path)).toEqual([ - 'views[0].list.bulkActions[0]', - 'views[0].list.bulkActions[1]', - 'views[0].list.bulkActions[2]', + 'views[0].list.rowActions[0]', + 'views[0].list.rowActions[1]', + 'views[0].list.rowActions[2]', ]); expect(findings[0].message).toContain('does nothing when clicked'); }); @@ -69,7 +69,7 @@ describe('validateActionNameRefs — list view bulk/row actions', () => { ], actions: [{ name: 'crm_convert_lead', label: 'Convert', type: 'script' }], views: [ - { name: 'crm_lead', list: { rowActions: ['crm_convert_lead'], bulkActions: ['crm_mark_hot'] } }, + { name: 'crm_lead', list: { rowActions: ['crm_convert_lead', 'crm_mark_hot'] } }, ], }; expect(validateActionNameRefs(stack)).toEqual([]); @@ -82,20 +82,20 @@ describe('validateActionNameRefs — list view bulk/row actions', () => { { name: 'crm_lead', listViews: { - all: { bulkActions: ['crm_convert_lead'] }, - hot: { bulkActions: ['ghost_action'] }, + all: { rowActions: ['crm_convert_lead'] }, + hot: { rowActions: ['ghost_action'] }, }, }, ], }); expect(findings).toHaveLength(1); - expect(findings[0].path).toBe('views[0].listViews.hot.bulkActions[0]'); + expect(findings[0].path).toBe('views[0].listViews.hot.rowActions[0]'); }); it('offers a did-you-mean for a near-miss', () => { const findings = validateActionNameRefs({ ...withActions(), - views: [{ name: 'crm_lead', list: { bulkActions: ['crm_convert_leads'] } }], + views: [{ name: 'crm_lead', list: { rowActions: ['crm_convert_leads'] } }], }); expect(findings).toHaveLength(1); expect(findings[0].message).toContain('Did you mean "crm_convert_lead"?'); @@ -110,7 +110,7 @@ describe('validateActionNameRefs — list view bulk/row actions', () => { const findings = validateActionNameRefs({ objects: [{ name: 'crm_lead', fields: { name: { type: 'text' } } }], actions: [{ name: 'archive_completed_deals', label: 'Archive', type: 'script' }], - views: [{ name: 'crm_lead', list: { bulkActions: ['archive'] } }], + views: [{ name: 'crm_lead', list: { rowActions: ['archive'] } }], }); expect(findings).toHaveLength(1); expect(findings[0].message).toContain('Did you mean "archive_completed_deals"?'); @@ -525,7 +525,7 @@ describe('validateActionNameRefs — bulkActionDefs (#4457)', () => { // `resolveBulkActions` resolves an aggregate def's `name` against the // object's actions to get the dispatcher it calls once for the selection. // No match → no dispatcher → the dialog opens and the run reports "has no - // dispatcher wired". Same dead affordance as a bulkActions name. + // dispatcher wired". Same dead affordance as a dead row-action name. const findings = validateActionNameRefs({ ...withActions(), views: [ @@ -591,13 +591,18 @@ describe('validateActionNameRefs — bulkActionDefs (#4457)', () => { expect(findings).toEqual([]); }); - it('tells the author no `locations` entry is needed for a selection-bar action', () => { - // The selection bar is the ONE surface that does not filter on - // `locations` — the generic "with the location this surface needs" hint - // would send an author to add a placement that changes nothing. + it('tells the author no `locations` entry is needed for an aggregate def', () => { + // An aggregate `bulkActionDefs` entry places its action by name — the + // generic "with the location this surface needs" hint would send an author + // to add a placement that changes nothing. const findings = validateActionNameRefs({ ...withActions(), - views: [{ name: 'crm_lead', list: { bulkActions: ['mass_update'] } }], + views: [ + { + name: 'crm_lead', + list: { bulkActionDefs: [{ name: 'mass_update', operation: 'custom', execution: 'aggregate' }] }, + }, + ], }); expect(findings[0].hint).toContain('the selection bar places it by name'); expect(findings[0].hint).not.toContain('the location this surface needs'); @@ -641,7 +646,7 @@ describe('validateActionNameRefs — object-embedded list views (#4457)', () => { name: 'crm_lead', actions: [{ name: 'crm_score', type: 'script' }], - listViews: { all: { bulkActions: ['crm_score'] } }, + listViews: { all: { rowActions: ['crm_score'] } }, }, ], }); @@ -697,10 +702,10 @@ describe('[#22161] one-line verdicts — action-name-undefined', () => { it('reads as one sentence per arm', () => { const findings = validateActionNameRefs({ ...relatedListStack(['crm_merge', 'crm_lgo_call', 'crm_score', 'crm_pin']), - views: [{ name: 'crm_contact', list: { type: 'grid', bulkActions: ['mass_delete'] } }], + views: [{ name: 'crm_contact', list: { type: 'grid', rowActions: ['mass_delete'] } }], }); expect(findings.map((f) => f.message)).toEqual([ - 'Bulk-action menu names action "mass_delete", which no action in this stack defines, so the button does ' + 'Row-action menu names action "mass_delete", which no action in this stack defines, so the button does ' + 'nothing when clicked.', 'Related-list actions names action "crm_merge", not an action of related object "crm_contact" (defined ' + 'only on object "crm_account"), so the list draws no button for it.', @@ -741,7 +746,7 @@ describe('[#22161] one-line verdicts — action-name-undefined', () => { expect(entry, 'no `os explain action-name-undefined` entry').toBeDefined(); const text = entry!.paragraphs.join('\n'); for (const fact of [ - '`rowActions`, `bulkActions`', + '`rowActions`', '`execution: \'aggregate\'`', '`record:quick_actions`', '`record:alert`', @@ -788,7 +793,6 @@ describe('[#22161] one-line verdicts — action-name-undefined', () => { // The coverage control first: every surface fired, and all three // related-list arms (defined elsewhere, defined nowhere, placed nowhere). for (const surface of [ - 'Bulk-action menu', 'Row-action menu', 'Aggregate bulk action', 'Quick-actions bar', diff --git a/packages/lint/src/validate-action-name-refs.ts b/packages/lint/src/validate-action-name-refs.ts index 19effce2dec..cfaf2f1b919 100644 --- a/packages/lint/src/validate-action-name-refs.ts +++ b/packages/lint/src/validate-action-name-refs.ts @@ -10,8 +10,7 @@ * `z.array(z.string())` / `z.string()`, so a name that matches no defined action * parses and ships: * - * - list views — `rowActions[]` / `bulkActions[]`, plus each - * `bulkActionDefs[]` entry that is a reference rather than a button id + * - list views — `rowActions[]`, plus each `bulkActionDefs[]` entry that is a reference rather than a button id * (`execution: 'aggregate'` — see the walk). Across all three tiers: the * default `list` container, each `listViews.` entry, and an OBJECT's * own `listViews.` (added in #4457; an object has no top-level `list`, @@ -38,9 +37,10 @@ * - app navigation deep-link auto-run — `{ type: 'object', runAction }` * (#4848 — the declared form of the `?runAction=` URL contract) * - * The HotCRM audit shipped `bulkActions: ['mass_update', 'mass_delete', - * 'assign_owner']` with none of the three defined anywhere: the toolbar renders - * the buttons, selecting rows enables them, and clicking does nothing. + * The HotCRM audit shipped a view `bulkActions: ['mass_update', 'mass_delete', + * 'assign_owner']` list (retired in protocol 19, objectstack#36496: the action + * is placed at `selection` instead) with none of the three defined anywhere: + * the toolbar rendered the buttons, and clicking did nothing. * * This is the same failure `validate-dashboard-action-refs` catches for * dashboard header/widget buttons (`DASHBOARD_ACTION_TARGET_UNDEFINED`), so it @@ -83,9 +83,9 @@ export interface ActionNameRefFinding { severity: ActionNameRefSeverity; /** Diagnostic rule id. */ rule: string; - /** Human-readable location, e.g. `view "crm_lead" · list "all" · bulkActions`. */ + /** Human-readable location, e.g. `view "crm_lead" · list "all" · rowActions`. */ where: string; - /** Config path, e.g. `views[0].list.bulkActions[1]`. */ + /** Config path, e.g. `views[0].list.rowActions[1]`. */ path: string; /** What is wrong. */ message: string; @@ -140,6 +140,9 @@ const RELATED_LIST_DRAWS: Readonly> = { record_row: 'a row-menu item', record_related: 'a row-menu item', record_section: null, + // A selection of related rows is the grid's own selection bar, not this + // block's `actions` (objectstack#36496). + selection: null, }; /** The locations a related list draws, in the spec's own order. */ @@ -292,17 +295,11 @@ export function validateActionNameRefs(stack: AnyRec): ActionNameRefFinding[] { ) => { if (!container || typeof container !== 'object') return; const list = container as AnyRec; - for (const key of ['rowActions', 'bulkActions'] as const) { - const names = strList(list[key]); - for (let ai = 0; ai < names.length; ai++) { - check( - names[ai], - `${owner} · ${label} · ${key}`, - `${path}.${key}[${ai}]`, - key === 'bulkActions' ? 'Bulk-action menu' : 'Row-action menu', - key === 'bulkActions' ? SELECTION_BAR_PLACEMENT : undefined, - ); - } + // `bulkActions` is retired (protocol 19, objectstack#36496): parse refuses + // it, and a selection draws the actions placed at `selection`, by object. + const names = strList(list.rowActions); + for (let ai = 0; ai < names.length; ai++) { + check(names[ai], `${owner} · ${label} · rowActions`, `${path}.rowActions[${ai}]`, 'Row-action menu'); } // `bulkActionDefs` — only SOME entries are name references (#4457). diff --git a/packages/lint/src/validate-list-view-field-refs.ts b/packages/lint/src/validate-list-view-field-refs.ts index d21d3822944..fdba6abfeb5 100644 --- a/packages/lint/src/validate-list-view-field-refs.ts +++ b/packages/lint/src/validate-list-view-field-refs.ts @@ -198,7 +198,7 @@ * - **`chart`** (`dataset` / `dimensions` / `values`) — those are ADR-0021 * dataset, dimension and measure NAMES, not fields on the bound object; * `validateChartBindings` and `validateDatasetReferences` own that axis. - * - **`rowActions` / `bulkActions` / `columns[].action`** — action names, + * - **`rowActions` / `columns[].action`** — action names, * owned by `validateActionNameRefs`. * - **`conditionalFormatting[].condition`** — a CEL predicate, owned by the * expression rules. diff --git a/packages/lint/src/validate-object-action-layout.test.ts b/packages/lint/src/validate-object-action-layout.test.ts index 4181f810a5a..172afd93a2f 100644 --- a/packages/lint/src/validate-object-action-layout.test.ts +++ b/packages/lint/src/validate-object-action-layout.test.ts @@ -64,6 +64,22 @@ describe('validateObjectActionLayout (objectstack#36366)', () => { ]); }); + it('judges the `selection` arm against `selection` placement (objectstack#36496)', () => { + const selectionStack = { + objects: [{ ...LEAD, actions: [...LEAD.actions, { name: 'mark_hot', label: 'Mark hot', locations: ['selection'] }] }], + }; + const withArm = (selection: unknown) => ({ + objects: [{ ...selectionStack.objects[0], actionLayout: { selection } }], + }); + expect(rules(withArm({ pinned: ['mark_hot'] }))).toEqual([]); + const [finding] = validateObjectActionLayout(withArm({ pinned: ['mark_hot'], more: ['mass_assign'] })); + expect(finding).toMatchObject({ rule: OBJECT_ACTION_LAYOUT_NOT_PLACED, path: 'objects[0].actionLayout.selection.more[0]' }); + expect(finding.message).toBe( + '"crm_lead" names "mass_assign" for the selection bar\'s 「More」 menu, and that action is not placed in the ' + + 'selection scope (locations \'selection\'), so it draws nothing there', + ); + }); + it('refuses an unknown name in `more` too, naming the 「More」 menu', () => { const [finding] = validateObjectActionLayout(stack({}, { record: { pinned: [], more: ['gone_action'] } })); expect(finding).toMatchObject({ rule: OBJECT_ACTION_LAYOUT_UNKNOWN, path: 'objects[0].actionLayout.record.more[0]' }); diff --git a/packages/lint/src/validate-object-action-layout.ts b/packages/lint/src/validate-object-action-layout.ts index 29c3b660b04..4a65c767f44 100644 --- a/packages/lint/src/validate-object-action-layout.ts +++ b/packages/lint/src/validate-object-action-layout.ts @@ -6,7 +6,7 @@ import { recordsOf } from './object-graph.js'; * An object's action layout (`actionLayout`, objectstack#36366) naming an * action its scope cannot draw. * - * `actionLayout.list` / `.record` arrange one action scope each: `pinned` + * `actionLayout.list` / `.record` / `.selection` arrange one action scope each: `pinned` * names, in order, the actions drawn as buttons, `more` the order of the * 「More」 menu. The schema refuses the SHAPE at every door (more than three * pinned, an entry twice, a malformed entry, a `$` built-in the scope does not @@ -19,7 +19,8 @@ import { recordsOf } from './object-graph.js'; * object (its own `actions`, or a stack action whose `objectName` is it); * - `object-action-layout-not-placed`: the action is declared but not placed * in that scope: `list` for the `list` arm, `record` or `record_page` - * for the `record` arm (the record header draws both). A + * for the `record` arm (the record header draws both), `selection` for the + * `selection` arm (the selection bar, objectstack#36496). A * record action named in the `list` arm, or the reverse, is this. * * Both object positions are judged: an object's own `actionLayout`, and an @@ -58,9 +59,16 @@ export interface ObjectActionLayoutFinding { type AnyRec = Record; /** The locations an arm's actions are placed at: the page's header draws an action placed at one of them. */ -const ARM_LOCATIONS: Readonly> = { +const ARM_LOCATIONS: Readonly> = { list: ['list'], record: ['record', 'record_page'], + selection: ['selection'], +}; + +const ARM_SCOPE: Readonly> = { + list: 'list toolbar', + record: 'record header', + selection: 'selection bar', }; function strName(v: unknown): string | undefined { @@ -99,11 +107,11 @@ export function validateObjectActionLayout(stack: AnyRec): ObjectActionLayoutFin const judge = (layout: unknown, objectName: string, object: AnyRec, at: string, where: string): void => { if (!layout || typeof layout !== 'object' || Array.isArray(layout)) return; const actions = actionsOf(stack, object, objectName); - for (const arm of ['list', 'record'] as const) { + for (const arm of ['list', 'record', 'selection'] as const) { const value = (layout as AnyRec)[arm]; if (!value || typeof value !== 'object' || Array.isArray(value)) continue; const locations = ARM_LOCATIONS[arm]; - const scope = arm === 'list' ? 'list toolbar' : 'record header'; + const scope = ARM_SCOPE[arm]; for (const part of ['pinned', 'more'] as const) { const names = (value as AnyRec)[part]; if (!Array.isArray(names)) continue; diff --git a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts index 6b2ba24ed42..891deb7ce20 100644 --- a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const enMetadataForms: NonNullable = { label: "Record", helpText: "The record header (record page, side preview, phone bar), as {\"pinned\": [...], \"more\": [...]}: action names placed in the record header or its More menu. At most 3 pinned. os validate refuses a name that is no action of this object or is not placed on the record page; such a name draws nothing." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "Edit Mode", helpText: "Edit-interaction intent for records of this object. Absent, the renderer picks its own default. Cross-renderer intent, not styling.", diff --git a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts index 9a2b081c5b8..57e449422b5 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const esESMetadataForms: NonNullable = label: "Registro", helpText: "El encabezado del registro (página del registro, vista previa lateral, barra inferior del teléfono), como {\"pinned\": [...], \"more\": [...]}: nombres de acciones colocadas en el encabezado del registro o en su menú Más. Como máximo 3 fijadas. os validate rechaza un nombre que no es una acción de este objeto o que no está en la página del registro; ese nombre no dibuja nada." }, + "actionLayout.selection": { + label: "Selección", + helpText: "La barra de selección que muestra una cuadrícula cuando se seleccionan dos o más filas, en todas las vistas de cuadrícula de este objeto, como {\"pinned\": [...], \"more\": [...]}: nombres de acciones colocadas en selection. Como máximo 3 fijadas; [] no fija ninguna, así que todas las acciones, Eliminar incluida, van a «Más» de la barra. Las definiciones de acciones masivas propias de una vista van primero. os validate rechaza un nombre que no es una acción de este objeto o que no está colocado en selection; ese nombre no se muestra." + }, editMode: { label: "Modo de edición", helpText: "Intención de interacción al editar registros de este objeto. Si se omite, el renderizador elige su propio valor predeterminado. Es una intención entre renderizadores, no un estilo.", diff --git a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts index 7824b427eaa..717faabdd2f 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts @@ -18,6 +18,8 @@ */ export const esESGeneratedSourceHashes: Readonly> = { + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "objects.sys_email.fields.cc_addresses.label": "02946d952cf15623", "objects.sys_email.fields.error.label": "786fed84bd8d5a32", "objects.sys_email.fields.message_id.label": "14cd089a4062f4b1", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts index e25daa66cc5..5cbd4bfc5eb 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const jaJPMetadataForms: NonNullable = label: "レコード", helpText: "レコードヘッダー(レコードページ、サイドプレビュー、スマートフォンの下部バー)。{\"pinned\": [...], \"more\": [...]} の形で書きます:レコードヘッダーまたはその「その他」メニューに配置されたアクション名。固定は最大 3 個。os validate は、このオブジェクトのアクションでない名前やレコードページに配置されていない名前を拒否します。そのような名前は何も表示しません。" }, + "actionLayout.selection": { + label: "選択", + helpText: "グリッドで 2 行以上を選択したときに表示される選択バー(このオブジェクトのすべてのグリッドビューに表示)。{\"pinned\": [...], \"more\": [...]} の形で、selection に配置したアクション名を書きます。固定は最大 3 件。[] は何も固定せず、削除を含むすべてのアクションがバーの「その他」に入ります。ビュー独自の一括アクション定義が先頭に並びます。os validate は、このオブジェクトのアクションでない名前や selection に配置されていない名前を拒否します。そのような名前は表示されません。" + }, editMode: { label: "編集の開き方", helpText: "このオブジェクトのレコードを編集するときの操作意図。未設定ならレンダラー側の既定に従います。スタイルではなく、レンダラー横断の意図表明です。", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts index 601a8fc4340..736f15a6bd6 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts @@ -18,6 +18,8 @@ */ export const jaJPGeneratedSourceHashes: Readonly> = { + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "objects.sys_email.fields.bcc_addresses.label": "8674899b7b6d5126", "objects.sys_email.fields.cc_addresses.label": "02946d952cf15623", "objects.sys_email.fields.message_id.label": "14cd089a4062f4b1", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts index 406711b3d84..0b97449f857 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const zhCNMetadataForms: NonNullable = label: "记录", helpText: "记录页头(记录页、侧边预览、手机底栏),写作 {\"pinned\": [...], \"more\": [...]}:放在记录页头或其「更多」菜单中的动作名称。最多固定 3 个。os validate 会拒绝不是本对象动作、或未放在记录页上的名称;这样的名称什么也不显示。" }, + "actionLayout.selection": { + label: "选中项", + helpText: "网格选中两行或以上时显示的选中栏(本对象的每个网格视图都显示),写作 {\"pinned\": [...], \"more\": [...]}:放在 selection 的动作名。最多固定 3 个;[] 不固定任何动作,所有动作(包括删除)都进入选中栏的「更多」。视图自己的批量动作定义排在最前。os validate 会拒绝不是本对象动作、或未放在 selection 的名称;这样的名称不会显示。" + }, editMode: { label: "编辑方式", helpText: "该对象记录的编辑交互意图。留空则由渲染端自行选择默认方式。这是跨渲染端的意图声明,不是样式。", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts index e2e667bb54c..de5e2a83ec7 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts @@ -18,6 +18,8 @@ */ export const zhCNGeneratedSourceHashes: Readonly> = { + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "objects.sys_email.fields.message_id.label": "14cd089a4062f4b1", "objects.sys_email_template.fields.id.label": "00b0385c9c152888", "objects.sys_exchange_rate.fields.id.label": "00b0385c9c152888", diff --git a/packages/spec/dropped-refinements.baseline.json b/packages/spec/dropped-refinements.baseline.json index b6b1237591b..cb2941cec7d 100644 --- a/packages/spec/dropped-refinements.baseline.json +++ b/packages/spec/dropped-refinements.baseline.json @@ -3,7 +3,7 @@ "measured": { "zod": "4.4.3", "publishedSchemasWithDroppedRefinements": 281, - "droppedRefinementSites": 1239, + "droppedRefinementSites": 1249, "refinementSitesThatDidProject": 728, "refinementSitesWithNoJsonFormToCompare": 0 }, diff --git a/packages/spec/liveness/action.json b/packages/spec/liveness/action.json index 494f94c0ce0..37f52723b10 100644 --- a/packages/spec/liveness/action.json +++ b/packages/spec/liveness/action.json @@ -43,9 +43,9 @@ }, "locations": { "status": "live", - "verifiedAt": "2026-08-10", + "verifiedAt": "2026-11-29", "evidence": "objectui `actionRendersAt` (ui/packages/types/src/ui-action.ts) is the ONE placement predicate since objectui#3142 — `Array.isArray(declared) && declared.includes(location)` — consumed by action-bar.tsx and the record surfaces; `locations: []` therefore renders nowhere, which is the documented headless shape.", - "note": "The KEY is live; its VALUE SET was audited per-member in #6888 and `global_nav` was retired (no product surface read it — the console ⌘K palette composes its groups from nav items/objects/dashboards/pages/reports/recents/record search and reads no action metadata; the only renderer of the value was the Studio designer's mock preview frame). An enum-VALUE retirement leaves this row untouched in status: the key is still walked, still authorable and still enforced — see the conversion `action-global-nav-location-removed`." + "note": "The KEY is live; its VALUE SET was audited per-member in #6888 and `global_nav` was retired (no product surface read it — the console ⌘K palette composes its groups from nav items/objects/dashboards/pages/reports/recents/record search and reads no action metadata; the only renderer of the value was the Studio designer's mock preview frame). An enum-VALUE retirement leaves this row untouched in status: the key is still walked, still authorable and still enforced — see the conversion `action-global-nav-location-removed`. 2026-11-29 (objectstack#36496): the value `selection` was ADDED — the selection bar a grid shows once rows are selected, on every grid view of the object; read by ui/packages/plugin-grid/src/resolveBulkActions.ts#selectionBarActions through `actionRendersAt(action, 'selection')`. It replaced the view's retired `bulkActions` list." }, "component": { "status": "live", diff --git a/packages/spec/liveness/object.json b/packages/spec/liveness/object.json index efe379ab252..3547a1a71bb 100644 --- a/packages/spec/liveness/object.json +++ b/packages/spec/liveness/object.json @@ -32,10 +32,10 @@ }, "actionLayout": { "status": "live", - "verifiedAt": "2026-11-26", + "verifiedAt": "2026-11-29", "evidenceScope": "in-repo", - "evidence": "ui/packages/types/src/ui-action.ts#arrangedHeaderActions (the header reader: an arm's `pinned` actions become the header's buttons in pin order, the ones `more` names lead the overflow in that order, every other placed action follows in its default order); ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (the grid reads `actionLayout.record` and ranks its row actions with `rankRowActionDefs`); ui/packages/plugin-grid/src/components/RowActionMenu.tsx#planRowActionMenu (a row's ⋮ menu, its right-click menu and the list page selection bar's one-record actions list the ranked actions first with `orderRowMenuActions`, `pinned` then `more`, then the rest as before; the row's inline button is unchanged); ui/packages/plugin-grid/src/components/SelectionBar.tsx#planExposedEntries (the selection bar draws the first three of that order as buttons); ui/packages/app-shell/src/views/RecordDetailView.tsx#RecordDetailView (the record header reads `actionLayout.record`, staged arrangement included; the side preview and the phone's bottom bar draw the same header); ui/packages/components/src/renderers/layout/containers.tsx#PageHeaderActions (an authored `page:header` with `placedActions: true` reads the same arm); ui/packages/app-shell/src/views/objectViewPageHeader.tsx#PinnedListHeaderActions (the list header reads `actionLayout.list`, `$import` and `$export` among the actions); packages/objectql/src/registry-custom-arrangement.ts#applyCustomArrangement (only the base's paired `.custom` extension writes it, applied last, each arm it writes replaced whole; any other package's is refused at publish, os validate, os build and install); ui/packages/app-shell/src/layout/DesignModeHeaderPins.tsx#DesignModeHeaderPins (the design mode writes it)", - "note": "objectstack#36366: the order of the object's actions and which are buttons, per action scope (`list`, `record`): `pinned` is at most three buttons in order, `more` orders the 「More」 menu, and an action named in neither follows at the end of 「More」 in its default order. Absent (or an arm absent): the scope draws as before. An installed object is arranged through its customization package's `object_extension`.", + "evidence": "ui/packages/types/src/ui-action.ts#arrangedHeaderActions (the header reader: an arm's `pinned` actions become the header's buttons in pin order, the ones `more` names lead the overflow in that order, every other placed action follows in its default order); ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (the grid reads `actionLayout.record` and ranks its row actions with `rankRowActionDefs`); ui/packages/plugin-grid/src/components/RowActionMenu.tsx#planRowActionMenu (a row's ⋮ menu, its right-click menu and the list page selection bar's one-record actions list the ranked actions first with `orderRowMenuActions`, `pinned` then `more`, then the rest as before; the row's inline button is unchanged); ui/packages/plugin-grid/src/components/SelectionBar.tsx#planExposedEntries (the selection bar draws the first three of that order as buttons); ui/packages/app-shell/src/views/RecordDetailView.tsx#RecordDetailView (the record header reads `actionLayout.record`, staged arrangement included; the side preview and the phone's bottom bar draw the same header); ui/packages/components/src/renderers/layout/containers.tsx#PageHeaderActions (an authored `page:header` with `placedActions: true` reads the same arm); ui/packages/app-shell/src/views/objectViewPageHeader.tsx#PinnedListHeaderActions (the list header reads `actionLayout.list`, `$import` and `$export` among the actions); packages/objectql/src/registry-custom-arrangement.ts#applyCustomArrangement (only the base's paired `.custom` extension writes it, applied last, each arm it writes replaced whole; any other package's is refused at publish, os validate, os build and install); ui/packages/app-shell/src/layout/DesignModeHeaderPins.tsx#DesignModeHeaderPins (the design mode writes it); ui/packages/plugin-grid/src/resolveBulkActions.ts#selectionBarActions (the grid reads `actionLayout.selection`: the actions placed at `selection`, the arm's names first, `pinned` then `more`, then the rest in their default order); ui/packages/plugin-grid/src/components/SelectionBar.tsx#planPinnedEntries (the selection bar draws the arm's `pinned` actions as its buttons, everything else in its 「More」)", + "note": "objectstack#36366: the order of the object's actions and which are buttons, per action scope (`list`, `record`, `selection`): `pinned` is at most three buttons in order, `more` orders the 「More」 menu, and an action named in neither follows at the end of 「More」 in its default order. Absent (or an arm absent): the scope draws as before. An installed object is arranged through its customization package's `object_extension`. objectstack#36496: the `selection` scope orders the selection bar a grid shows once two or more rows are selected, on every grid view of the object.", "children": { "list": { "status": "live", @@ -82,6 +82,29 @@ "note": "objectstack#36366: the order of the record header's ⋯ menu." } } + }, + "selection": { + "status": "live", + "verifiedAt": "2026-11-29", + "evidenceScope": "in-repo", + "evidence": "ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (the grid reads `actionLayout.selection` and passes the ordered actions and `pinned` to the bar); ui/packages/plugin-grid/src/resolveBulkActions.ts#selectionBarActions (the actions placed at `selection`, the arm's names first); ui/packages/plugin-grid/src/components/SelectionBar.tsx#planPinnedEntries (the bar draws the pinned actions as buttons)", + "note": "objectstack#36496: the selection scope, drawn on the selection bar of every grid view of the object. A view's own `bulkActionDefs` lead the bar.", + "children": { + "pinned": { + "status": "live", + "verifiedAt": "2026-11-29", + "evidenceScope": "in-repo", + "evidence": "ui/packages/plugin-grid/src/components/SelectionBar.tsx#planPinnedEntries (a pinned action is a bar button, in pin order; `[]` pins none, Delete included); ui/packages/plugin-grid/src/resolveBulkActions.ts#selectionBarActions (pinned names lead the bar's order)", + "note": "objectstack#36496: the selection bar's buttons, at most three, in order." + }, + "more": { + "status": "live", + "verifiedAt": "2026-11-29", + "evidenceScope": "in-repo", + "evidence": "ui/packages/plugin-grid/src/resolveBulkActions.ts#selectionBarActions (the actions `more` names follow the pinned ones in that order, unnamed ones after); ui/packages/plugin-grid/src/components/SelectionBar.tsx#planPinnedEntries (draws every unpinned action in the bar's 「More」)", + "note": "objectstack#36496: the order of the selection bar's 「More」 menu." + } + } } } }, diff --git a/packages/spec/liveness/state-counts/object.md b/packages/spec/liveness/state-counts/object.md index a51975c0ba9..f6d7b7c89f6 100644 --- a/packages/spec/liveness/state-counts/object.md +++ b/packages/spec/liveness/state-counts/object.md @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them. | Type | live | exp | elsewhere | dead | planned | classified | |---|---|---|---|---|---|---| -| `object` | 95 | 0 | 0 | 1 | 1 | 97 | +| `object` | 97 | 0 | 0 | 1 | 1 | 99 | diff --git a/packages/spec/liveness/state-counts/view.md b/packages/spec/liveness/state-counts/view.md index 993277b0a68..f13052fddda 100644 --- a/packages/spec/liveness/state-counts/view.md +++ b/packages/spec/liveness/state-counts/view.md @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them. | Type | live | exp | elsewhere | dead | planned | classified | |---|---|---|---|---|---|---| -| `view` | 75 | 0 | 0 | 11 | 0 | 86 | +| `view` | 74 | 0 | 0 | 12 | 0 | 86 | diff --git a/packages/spec/liveness/view.json b/packages/spec/liveness/view.json index 5614356052e..52ad1580820 100644 --- a/packages/spec/liveness/view.json +++ b/packages/spec/liveness/view.json @@ -211,8 +211,9 @@ "note": "objectui: ObjectGrid.tsx (audit L15)." }, "bulkActions": { - "status": "live", - "note": "objectui: live only via ListView.tsx:1318 remapping to ObjectGrid's real 'batchActions' key — a direct object-grid caller using bulkActions silently no-ops (audit L23 drift; normalize at one boundary per audit rec 3)." + "status": "dead", + "verifiedAt": "2026-11-29", + "note": "REMOVED 2026-11-29 (objectstack#36496, ADR-0085) — tombstoned at the schema (retiredKey carries the prescription; authoring it is a tsc error and a parse error at ListViewSchema and ObjectListViewSchema) and moved onto the actions by the protocol-19 view-bulk-actions-to-action-selection conversion, which adds `'selection'` to the `locations` of each action a list named and writes the object's `actionLayout.selection` when the lists' order is not the default. The entry stays because retiredKey keeps the key in the walked shape (the rls.priority precedent); to offer an action over a selection of records, place it at `selection` (every grid view of the object draws it), and order the bar with `actionLayout.selection`. A view's own `bulkActionDefs` stay on the view. The object-grid component's `bulkActions` / `batchActions` props are a different surface and are not retired here." }, "bulkActionDefs": { "status": "live", diff --git a/packages/spec/src/data/object-action-layout.test.ts b/packages/spec/src/data/object-action-layout.test.ts index 24a5bc30283..e6a14b9b71d 100644 --- a/packages/spec/src/data/object-action-layout.test.ts +++ b/packages/spec/src/data/object-action-layout.test.ts @@ -91,7 +91,7 @@ describe('actionLayout (objectstack#36366)', () => { }); it('refuses a built-in the scope does not have, naming the ones it has', () => { - expect(OBJECT_ACTION_LAYOUT_BUILTINS).toEqual({ list: ['$import', '$export'], record: [] }); + expect(OBJECT_ACTION_LAYOUT_BUILTINS).toEqual({ list: ['$import', '$export'], record: [], selection: [] }); expect(refusal({ list: { pinned: ['$print'] } })).toEqual([ "actionLayout.list.pinned.0: `$print` is not a built-in of the list scope: the list scope's built-ins are `$import`, `$export`.", ]); diff --git a/packages/spec/src/data/object.metadata-form.ts b/packages/spec/src/data/object.metadata-form.ts index 950350f6892..6dc0b14424b 100644 --- a/packages/spec/src/data/object.metadata-form.ts +++ b/packages/spec/src/data/object.metadata-form.ts @@ -768,7 +768,7 @@ export const objectForm = defineMetadataForm({ { field: 'transfer', label: 'Change Owner', widget: 'json', helpText: 'The Change Owner action, single and bulk: on offers it, off hides it. Unset: on, except off on a controlled_by_parent detail. Offered only on an object whose records have a reassignable owner (ownership user or unset, no managedBy, not a sys_ object, owner_id not readonly and, on an external object, declared or mapped); turning it on anywhere else is refused. It gates the action only, not a plain edit of owner_id. A stored {enabled, visibleWhen, disabledWhen} object is edited key by key; write one in source to gate the action on each record.' }, ], }, - // [#36366] The action layout per scope. Each arm is an object of two + // [#36366, #36496] The action layout per scope. Each arm is an object of two // name lists (`pinned`, `more`), edited as JSON; the design mode edits // it on the page. { @@ -778,6 +778,7 @@ export const objectForm = defineMetadataForm({ fields: [ { field: 'list', label: 'List', widget: 'json', helpText: 'The list page toolbar, as {"pinned": [...], "more": [...]}: action names placed on the list toolbar; $import / $export only in pinned. At most 3 pinned. Not pinned, the page still draws its own Import / Export menu. os validate refuses a name that is no action of this object or is not placed on the list toolbar; such a name draws nothing.' }, { field: 'record', label: 'Record', widget: 'json', helpText: 'The record header (record page, side preview, phone bar), as {"pinned": [...], "more": [...]}: action names placed in the record header or its More menu. At most 3 pinned. os validate refuses a name that is no action of this object or is not placed on the record page; such a name draws nothing.' }, + { field: 'selection', label: 'Selection', widget: 'json', helpText: 'The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {"pinned": [...], "more": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar\'s More. A view\'s own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing.' }, ], }, { field: 'editMode', type: 'select', helpText: "Edit-interaction intent for records of this object. Absent, the renderer picks its own default. Cross-renderer intent, not styling.", options: [ diff --git a/packages/spec/src/migrations/semantic-relevance.test.ts b/packages/spec/src/migrations/semantic-relevance.test.ts index ee1ba9f3648..6384d8fb055 100644 --- a/packages/spec/src/migrations/semantic-relevance.test.ts +++ b/packages/spec/src/migrations/semantic-relevance.test.ts @@ -88,12 +88,12 @@ describe('which entries carry a relevance question (ENUMERATION)', () => { expect(actual).toEqual(EXPECTED_RELEVANCE); }); - it('is 30 entries: 5 of protocol 17, 22 of protocol 18 and 3 of protocol 19', () => { + it('is 31 entries: 5 of protocol 17, 22 of protocol 18 and 4 of protocol 19', () => { const keys = Object.keys(EXPECTED_RELEVANCE); - expect(keys).toHaveLength(30); + expect(keys).toHaveLength(31); expect(keys.filter((k) => k.startsWith('17:'))).toHaveLength(5); expect(keys.filter((k) => k.startsWith('18:'))).toHaveLength(22); - expect(keys.filter((k) => k.startsWith('19:'))).toHaveLength(3); + expect(keys.filter((k) => k.startsWith('19:'))).toHaveLength(4); }); it('the table names only registered entries (anti-vacuity for the comparison above)', () => { diff --git a/packages/spec/src/ui/action.test.ts b/packages/spec/src/ui/action.test.ts index b5650b9808b..fc3653478f1 100644 --- a/packages/spec/src/ui/action.test.ts +++ b/packages/spec/src/ui/action.test.ts @@ -1509,6 +1509,7 @@ describe('ACTION_LOCATIONS — canonical source of truth', () => { 'record_row', 'record_related', 'record_section', + 'selection', ]); }); @@ -1557,7 +1558,7 @@ describe('ACTION_LOCATIONS — canonical source of truth', () => { // Anti-vacuity: the constant we just probed is the real one and still // carries the surviving members, so `not.toContain` cannot pass by // resolving an empty list. - expect(ACTION_LOCATIONS).toHaveLength(6); + expect(ACTION_LOCATIONS).toHaveLength(7); expect([...ACTION_LOCATIONS]).toContain('record_section'); }); diff --git a/packages/spec/src/ui/bulk-action.test.ts b/packages/spec/src/ui/bulk-action.test.ts index 089aa84d07f..748657891cb 100644 --- a/packages/spec/src/ui/bulk-action.test.ts +++ b/packages/spec/src/ui/bulk-action.test.ts @@ -77,11 +77,11 @@ describe('BulkActionDefSchema — the def shape is typed, not `z.any()`', () => expect(issues).toContain('FieldSchema'); // ⛔ The prescription must NOT send this author to the field: a key // declared there reaches the bulk dialog only through a PROMOTED action - // (`bulkActions`), and of this family only `accept` / `maxSize` and the + // (placed at `selection`), and of this family only `accept` / `maxSize` and the // five lookup picker settings (`allowCreate` among them since #36919) make that trip. They are named by subject, // so the rejection says which route and which keys rather than implying // `min` would follow. - expect(issues).toContain('`bulkActions`'); + expect(issues).toContain('placed at `selection`'); expect(issues).toContain('`accept` / `maxSize`'); }); @@ -183,7 +183,7 @@ describe('BulkActionDefSchema — the def shape is typed, not `z.any()`', () => const issues = reject({ name: 'generate_qr_zip', operation: 'custom' }); expect(issues.join('\n')).toContain('treats as a no-op'); // Both legal forms are named, so the fix does not need the source. - expect(issues.join('\n')).toContain("`bulkActions: ['generate_qr_zip']`"); + expect(issues.join('\n')).toContain("add `'selection'` to the `locations` of the action \"generate_qr_zip\""); expect(issues.join('\n')).toContain("`execution: 'aggregate'`"); }); @@ -423,10 +423,10 @@ describe('BulkActionDefSchema — the def shape is typed, not `z.any()`', () => // Not a rename: `field` has no spelling on an authored bulk param. expect(issues).not.toContain('`field` →'); // Both remedies, each named by its subject: the inline param's picker - // target, and the view key that promotes a declared action whose - // field-backed param IS resolved against the object's fields. + // target, and the `selection` placement that promotes a declared action + // whose field-backed param IS resolved against the object's fields. expect(issues).toContain('`object`'); - expect(issues).toContain('`bulkActions'); + expect(issues).toContain("add `'selection'` to its `locations`"); }); it('sends a param-level `visible` to the DEF, where the predicate is really read', () => { diff --git a/packages/spec/src/ui/component-list-family-typed-members.pin.test.ts b/packages/spec/src/ui/component-list-family-typed-members.pin.test.ts index 03782a36784..a32c30bf326 100644 --- a/packages/spec/src/ui/component-list-family-typed-members.pin.test.ts +++ b/packages/spec/src/ui/component-list-family-typed-members.pin.test.ts @@ -245,15 +245,18 @@ describe('§3 the members hold the list view\'s own defs, and the measured vocab expect(grid().columns.unwrap()._zod.def).toBe(listView().columns._zod.def); }); - it('object-grid selection, rowActions and bulkActions are the list view\'s own members — the same defs', () => { + it('object-grid selection and rowActions are the list view\'s own members — the same defs', () => { expect(grid().selection.unwrap()._zod.def).toBe(SelectionConfigSchema._zod.def); expect(grid().selection.unwrap()._zod.def).toBe(listView().selection.unwrap()._zod.def); expect(grid().rowActions.unwrap()._zod.def).toBe(listView().rowActions.unwrap()._zod.def); - expect(grid().bulkActions.unwrap()._zod.def).toBe(listView().bulkActions.unwrap()._zod.def); }); + // [#36496] The list view's `bulkActions` is a tombstone since protocol 19; + // the block keeps its own action-name list, by value. it('object-grid batchActions holds bulkActions\'s def — one capability, one accept set', () => { - expect(grid().batchActions.unwrap()._zod.def).toBe(listView().bulkActions.unwrap()._zod.def); + expect(grid().batchActions.unwrap()._zod.def).toBe(grid().bulkActions.unwrap()._zod.def); + expect(grid().bulkActions.unwrap()._zod.def.type).toBe('array'); + expect(listView().bulkActions.unwrap()._zod.def.type).toBe('never'); }); it('object-calendar calendar is the list view\'s own calendar member — CalendarConfigSchema', () => { diff --git a/packages/spec/src/ui/component.zod.ts b/packages/spec/src/ui/component.zod.ts index aa9b86ce593..400c0b3c14b 100644 --- a/packages/spec/src/ui/component.zod.ts +++ b/packages/spec/src/ui/component.zod.ts @@ -5023,6 +5023,13 @@ const GridOperationsSchema = lazySchema(() => strictObject({ export: z.boolean().optional().describe('`false` hides the export menu that `exportOptions` enables'), })); +/** + * [#36496] The `object-grid` block's action-name list (`bulkActions` / + * `batchActions`), the accept set the list view's retired `bulkActions` + * declared, by value. One instance, so both spellings hold one def. + */ +const ObjectGridBulkActionNamesSchema = z.array(z.string()); + /** * `object-grid` (objectui's `ObjectGrid`; read points recorded in * `liveness/page.json`, row `regions`). Read points per key: `objectName` @@ -5084,13 +5091,6 @@ const GridOperationsSchema = lazySchema(() => strictObject({ * held at `z.unknown()` for a ruling, and takes the list view's own member by * reference since stage 5 — see the member. */ -/** - * [#36496] The `object-grid` block's action-name list (`bulkActions` / - * `batchActions`), the accept set the list view's retired `bulkActions` - * declared, by value. - */ -const OBJECT_GRID_BULK_ACTION_NAMES = () => z.array(z.string()).optional(); - export const ObjectGridPropsSchema = lazySchema(() => strictObject({ surface: 'this `object-grid`', history: objectBlockHistory('object-grid'), @@ -5455,7 +5455,7 @@ export const ObjectGridPropsSchema = lazySchema(() => strictObject({ * declared here by value. Whether the block keeps it is its own * enforce-or-remove decision. */ - bulkActions: OBJECT_GRID_BULK_ACTION_NAMES() + bulkActions: ObjectGridBulkActionNamesSchema.optional() .describe('Bulk action names shown on selection; a full def goes on `bulkActionDefs`'), /** * [#21464] The alternate spelling of `bulkActions`, read FIRST @@ -5463,7 +5463,7 @@ export const ObjectGridPropsSchema = lazySchema(() => strictObject({ * accept set. This second spelling is typed here, not retired — retiring it * is its own decision. */ - batchActions: OBJECT_GRID_BULK_ACTION_NAMES() + batchActions: ObjectGridBulkActionNamesSchema.optional() .describe('Alternate spelling of `bulkActions` that the renderer reads FIRST (`batchActions ?? bulkActions`) — the same action-name list. Prefer `bulkActions`'), /** * [#21445] The list view's own bulk-action def, {@link BulkActionDefSchema}, diff --git a/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts b/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts index 452d2dd0a86..ab520fcac94 100644 --- a/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts +++ b/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts @@ -2956,10 +2956,6 @@ const MEMBER_PINS: Record = { file: LIST_VIEW_PIN_FILE, pins: 'Members are the spec\'s `BulkActionDef` objects (`of: \'object\'`, the contract\'s single member kind): a definition list reaches the `object-grid` node `ListView` builds unchanged, member for member, and an absent key puts none there. The grid\'s own execution of a definition is `object-grid.bulkActionDefs`\'s pin (objectui#13047).', }, - 'list-view.bulkActions': { - file: LIST_VIEW_PIN_FILE, - pins: 'Members are action NAMES (`of: \'string\'`): the list reaches the `object-grid` node `ListView` builds as its `batchActions`, in order, and an absent key puts none there. The bar the grid draws from them is `object-grid.bulkActions`\'s pin (objectui#13047).', - }, 'list-view.calendar': { file: LIST_VIEW_PIN_FILE, pins: 'The calendar block\'s binding members `startDateField`, `endDateField` and `titleField`, each reaching the `object-calendar` node `ListView` builds under its own name; with no block, a `type: \'calendar\'` node hands the calendar no start date (objectui#13047).', diff --git a/ui/packages/app-shell/src/views/InterfaceListPage.relayCensus-11572.test.ts b/ui/packages/app-shell/src/views/InterfaceListPage.relayCensus-11572.test.ts index 44481258990..d7a9aec40f1 100644 --- a/ui/packages/app-shell/src/views/InterfaceListPage.relayCensus-11572.test.ts +++ b/ui/packages/app-shell/src/views/InterfaceListPage.relayCensus-11572.test.ts @@ -525,8 +525,10 @@ const NOT_RELAYED: Record = { rowHeight: { kind: 'not-inherited', reason: "Row density. Whether users may change density is the page's `userActions.rowHeight`; the starting density is not part of the spec's columns/filter/sort inheritance, and the page config has no density key." }, selection: { kind: 'not-inherited', reason: "Row selection mode, which exists to feed bulk actions. Actions on this surface are the page's `buttons`, so there is no bulk affordance for a selection to drive." }, rowActions: { kind: 'not-inherited', reason: "Per-row action names. Actions on this surface are the page config's `buttons`, object actions the page author chose (ADR-0047); the view's action set is the object page's." }, - bulkActions: { kind: 'not-inherited', reason: "Selection-bar action names. Actions on this surface are the page config's `buttons`; the view's bulk actions are the object page's." }, - bulkActionDefs: { kind: 'not-inherited', reason: "Selection-bar action definitions, the resolved twin of `bulkActions`. Not taken here for the same reason: the page's actions are its `buttons`." }, + // `bulkActions` was answered here (`not-inherited`) until objectstack#36496: + // the spec retires it (an action placed at `selection` is drawn on every grid + // of its object) and `ListView` reads it no longer, so it left the population. + bulkActionDefs: { kind: 'not-inherited', reason: "Selection-bar action definitions. Actions on this surface are the page config's `buttons`; the view's bulk actions are the object page's." }, sharing: { kind: 'not-inherited', reason: "The stored view record's own visibility, shown as a badge. The audience of THIS page is the page's; a badge describing the referenced view's sharing would mislabel it." }, // ── Keys a stored view row cannot carry ───────────────────────────────── diff --git a/ui/packages/app-shell/src/views/ObjectView.bulkWiredHeaderDuplicate-12462.test.tsx b/ui/packages/app-shell/src/views/ObjectView.bulkWiredHeaderDuplicate-12462.test.tsx index 7fac058dd6b..7e5bc7ecfaf 100644 --- a/ui/packages/app-shell/src/views/ObjectView.bulkWiredHeaderDuplicate-12462.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.bulkWiredHeaderDuplicate-12462.test.tsx @@ -12,18 +12,20 @@ * selection bar AND that is record-scoped. * * Measured on HotCRM's Leads list: `create_campaign` ("Add to Campaign", - * `locations: ['list', 'record_row']`) is wired by the `all_leads` - * view's `bulkActions`, so the selection bar already carried it with rows + * `locations: ['list', 'record_row']`) was wired by the `all_leads` + * view's `bulkActions` (since objectstack#36496: placed at `selection`, on + * every grid of the object), so the selection bar already carried it with rows * ticked while the header also drew it at every selection. The selection bar is * the list toolbar in its selection mode, so the action stays at its declared * placement there; what leaves is the header's permanent copy, and with it the * `?runAction=` deep-link arming, which arms only what the header draws. * * The real chain throughout: the real `ObjectView`, the real `ObjectGrid` and - * its selection actions (fed by `resolveBulkActions` from the view's own keys; + * its selection actions (fed by `resolveBulkActions` from the object's + * `selection` actions and the view's own defs; * on the list page they are drawn into the page bar, objectstack#35554), * the real `action:bar`. Every case is a differential on the view's wiring or - * the action's placement, with the same object and the same rows. + * the action's placement, with the same rows. */ import * as React from 'react'; @@ -107,8 +109,9 @@ const REFRESH_SCORES = { }; const LIST_VIEWS = { - // HotCRM's wiring: the default Leads view names the action in `bulkActions`. - all_leads: { name: 'all_leads', label: 'All Leads', type: 'grid', columns: ['name'], bulkActions: ['create_campaign'] }, + // HotCRM's wiring, moved onto the action: mounted with `create_campaign` + // placed at `selection` (objectstack#36496). + all_leads: { name: 'all_leads', label: 'All Leads', type: 'grid', columns: ['name'] }, // The same action, wired through an authored `bulkActionDefs` entry instead. campaign_defs: { name: 'campaign_defs', @@ -119,8 +122,8 @@ const LIST_VIEWS = { }, // CONTROL: a view that does not wire it (HotCRM's `my_leads`). my_leads: { name: 'my_leads', label: 'My Leads', type: 'grid', columns: ['name'], selection: { type: 'multiple' } }, - // CONTROL: an OBJECT-LEVEL action wired as bulk. - scoring: { name: 'scoring', label: 'Scoring', type: 'grid', columns: ['name'], bulkActions: ['refresh_scores'] }, + // CONTROL: an OBJECT-LEVEL action placed at `selection` (mounted so). + scoring: { name: 'scoring', label: 'Scoring', type: 'grid', columns: ['name'] }, }; const LEADS = [ @@ -129,7 +132,8 @@ const LEADS = [ { id: 'lead_3', name: 'Linus' }, ]; -const OBJECTS = [ +/** The Leads object, with the named actions also placed at `selection`. */ +const objectsWith = (placedAtSelection: readonly string[] = []) => [ { name: 'crm_lead', label: 'Lead', @@ -138,7 +142,9 @@ const OBJECTS = [ id: { type: 'text', label: 'Id' }, name: { type: 'text', label: 'Name' }, }, - actions: [CREATE_CAMPAIGN, REFRESH_SCORES], + actions: [CREATE_CAMPAIGN, REFRESH_SCORES].map((action) => + placedAtSelection.includes(action.name) ? { ...action, locations: [...action.locations, 'selection'] } : action, + ), listViews: LIST_VIEWS, }, ]; @@ -150,7 +156,8 @@ afterEach(() => { window.history.replaceState(null, '', '/'); }); -function mountLeads(viewName: keyof typeof LIST_VIEWS) { +function mountLeads(viewName: keyof typeof LIST_VIEWS, placedAtSelection: readonly string[] = []) { + const OBJECTS = objectsWith(placedAtSelection); vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ data: [] }), { status: 200, headers: { 'content-type': 'application/json' } }))); const i18n = createI18n({ defaultLanguage: 'en', detectBrowserLanguage: false }); @@ -223,8 +230,8 @@ async function tickRows(n: number): Promise { const addToCampaignIn = (el: HTMLElement) => within(el).queryByRole('button', { name: /Add to Campaign/ }); describe('objectui#12462 — a bulk-wired, record-scoped list action leaves the header for the selection bar', () => { - it('the view wires it in `bulkActions`: the plain action stays in the header, Add to Campaign is only in the bar', async () => { - mountLeads('all_leads'); + it('the action is placed at `selection`: the plain action stays in the header, Add to Campaign is only in the bar', async () => { + mountLeads('all_leads', ['create_campaign']); const header = await headerWithToolbar(); await rowBoxes(); @@ -253,7 +260,7 @@ describe('objectui#12462 — a bulk-wired, record-scoped list action leaves the expect((await selectionBar()).names).toContain('create_campaign'); }); - it('CONTROL — a view that does not wire it keeps the header button, and its bar does not carry it', async () => { + it('CONTROL — an object that does not place it keeps the header button, and its bar does not carry it', async () => { mountLeads('my_leads'); const header = await headerWithToolbar(); expect(addToCampaignIn(header)).not.toBeNull(); @@ -264,7 +271,7 @@ describe('objectui#12462 — a bulk-wired, record-scoped list action leaves the }); it('CONTROL — an object-level action wired as bulk keeps its header button (and is in the bar too)', async () => { - mountLeads('scoring'); + mountLeads('scoring', ['refresh_scores']); const header = await headerWithToolbar(); // The record-scoped action is not wired by this view, so it stays as well. expect(addToCampaignIn(header)).not.toBeNull(); @@ -290,7 +297,7 @@ describe('objectui#12462 — the deep link arms only what the header draws', () it('on the view that wires it as bulk, the link is not armed: nothing runs and the link stays in the URL', async () => { linkTo('all_leads'); - mountLeads('all_leads'); + mountLeads('all_leads', ['create_campaign']); // The header has drawn its toolbar and the grid its rows, so an armed link // would have run by now. `hidden: true`: an open param dialog takes the // page out of the accessibility tree, and this wait must not be what fails. diff --git a/ui/packages/plugin-detail/src/renderers/relatedListActions.ts b/ui/packages/plugin-detail/src/renderers/relatedListActions.ts index ef4ad8c0d92..4223b6cfb54 100644 --- a/ui/packages/plugin-detail/src/renderers/relatedListActions.ts +++ b/ui/packages/plugin-detail/src/renderers/relatedListActions.ts @@ -33,7 +33,7 @@ * ever renders inside a parent record, which is the scope `record_related` * names (objectstack-ai/objectstack#20937, triage `5919625056`: row * placement, inside a record only). Naming an action here does not bypass - * location filtering (only a list view's selection bar is placed by + * location filtering (only a view's aggregate `bulkActionDefs` entry is placed by * naming), so an id whose action declares none of the three is REFUSED * rather than drawn somewhere or dropped. * - ORDER is the author's, within each surface. diff --git a/ui/packages/plugin-list/src/ListView.tsx b/ui/packages/plugin-list/src/ListView.tsx index e2facdc96aa..72fb55c4b63 100644 --- a/ui/packages/plugin-list/src/ListView.tsx +++ b/ui/packages/plugin-list/src/ListView.tsx @@ -80,7 +80,7 @@ import { BOOLEAN_VALUE_TYPES, canonicalAstOperator, isAggregateCompatibleWithFie import { SystemFieldName } from '@objectstack/spec/system'; import { usePermissions } from '@object-ui/permissions'; import { RecordDetailPanel } from '@object-ui/plugin-detail'; -import { resolveBulkActions, selectionBarActions, useBulkActionItems, useUndeclaredActionNamesWarning, readListScrollState } from '@object-ui/plugin-grid'; +import { resolveBulkActions, selectionBarActions, useBulkActionItems, readListScrollState } from '@object-ui/plugin-grid'; /** * The `case 'map'` branch below builds an `object-map` schema by flattening @@ -3436,16 +3436,17 @@ export const ListView = React.forwardRef(({ [objectDef, schema.objectName, affordancePerms], ); // [objectstack#36496] The bar's actions are the object's actions placed at - // `selection`, in the order its `actionLayout.selection` gives — the grid's - // own set and order (`selectionBarActions`); a list view no longer lists them. + // `selection`, in the order its `actionLayout.selection` gives, then the + // built-in Delete where the object allows it — the grid's own set and order + // (`selectionBarActions`); a list view no longer lists them. const permittedBulkActions = React.useMemo(() => { const declared = selectionBarActions( objectDef?.actions as Parameters[0], (objectDef as { actionLayout?: { selection?: unknown } } | null | undefined)?.actionLayout?.selection, - ).actions.map((action) => String(action.name)); - if (declared.length === 0) return declared; - if (bulkDeleteVerdict.allowed) return declared; - return declared.filter((a: unknown) => String(a).toLowerCase() !== 'delete'); + ).actions + .map((action) => String(action.name)) + .filter((name) => name.toLowerCase() !== 'delete'); + return bulkDeleteVerdict.allowed ? [...declared, 'delete'] : declared; }, [objectDef, bulkDeleteVerdict]); /** @@ -3457,11 +3458,9 @@ export const ListView = React.forwardRef(({ * labelled from that declaration (through the app's i18n bundle, as the grid * labels it). The canonical `delete` keeps its own path: it is not an object * action but the built-in bulk delete, gated above by `bulkDeleteVerdict`, - * so it is held out of the fold exactly as the grid holds it out. Any other - * name draws nothing; `undeclared` exists only for the development warning - * below. Before this fold every member drew a button, so a name the object - * never declared, an action a disabled package withholds included, showed a - * button that only toasted "not executable" when pressed. + * so it is held out of the fold exactly as the grid holds it out. Since + * objectstack#36496 every name comes from the object's own actions placed at + * `selection`, so none can be undeclared and no warning is owed. * * [objectstack#30535] A declared action then passes the grid bar's OWN gate, * `useBulkActionItems`, before it draws: its `requiredPermissions` (ADR-0066 @@ -3481,7 +3480,7 @@ export const ListView = React.forwardRef(({ seen.add(key); return true; }); - const { defs, undeclared } = resolveBulkActions({ + const { defs } = resolveBulkActions({ bulkActions: names.filter((a) => a.toLowerCase() !== 'delete'), objectActions: objectDef?.actions, localizeLabel: (actionName, fallback) => @@ -3489,7 +3488,7 @@ export const ListView = React.forwardRef(({ ? resolveActionLabel(schema.objectName, actionName, fallback) : fallback, }); - return { names, defs, undeclared }; + return { names, defs }; }, [permittedBulkActions, objectDef, schema.objectName, resolveActionLabel]); const nonGridBulkItems = useBulkActionItems({ selectedRows, @@ -3503,20 +3502,8 @@ export const ListView = React.forwardRef(({ const drawn = nonGridBulkFold.names .filter((a) => a.toLowerCase() === 'delete' || labels.has(a)) .map((name) => ({ name, label: labels.get(name) })); - return { drawn, undeclared: nonGridBulkFold.undeclared }; + return { drawn }; }, [nonGridBulkFold, nonGridBulkItems]); - // The grid says its own (ObjectGrid warns for the names it leaves undrawn), - // so this one speaks only while a non-grid view is on screen, and only once - // the object's schema read has settled. A list with an object but no schema - // in hand (no `getObjectSchema`, or the read failed) reports the names as - // unread, never as undeclared: the grid's own reading. - useUndeclaredActionNamesWarning({ - key: 'bulkActions', - names: nonGridBulkBar.undeclared, - ready: objectDefLoaded && currentView !== 'grid', - basis: schema.objectName && objectDef == null ? 'unread' : 'declared', - address: { component: 'ListView', blockType: currentView, objectName: schema.objectName, label: schema.label }, - }); /** * [objectui#4420] The PER-RECORD half of the same key, for the same bar. diff --git a/ui/packages/plugin-list/src/__tests__/ListView.bulkDeleteVisibleWhen.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.bulkDeleteVisibleWhen.test.tsx index b890187cf43..e5b9f60b4bd 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.bulkDeleteVisibleWhen.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.bulkDeleteVisibleWhen.test.tsx @@ -63,7 +63,6 @@ const schema: ListViewSchema = { objectName: OBJECT, viewType: 'gallery', fields: ['name', 'status'], - bulkActions: ['delete', 'archive'] as any, }; function makeDataSource(userActionsDelete?: unknown) { @@ -80,9 +79,9 @@ function makeDataSource(userActionsDelete?: unknown) { name: { type: 'text' }, status: { type: 'text' }, }, - // `archive` is declared: the non-grid bar draws a bare `bulkActions` - // name only when the object declares it (objectstack#30394). - actions: [{ name: 'archive', label: 'Archive' }], + // `archive` is placed at `selection`: the non-grid bar draws the + // object's selection actions, then Delete (objectstack#36496). + actions: [{ name: 'archive', label: 'Archive', locations: ['selection'] }], ...(userActionsDelete === undefined ? {} : { userActions: { delete: userActionsDelete } }), }), }; diff --git a/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx index 453cd8a4f86..5414e374ce1 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx @@ -305,7 +305,6 @@ describe('ListView-hosted grid — the escalation fans out with the HOST\'s real schema={listSchema({ filter: [{ field: 'status', operator: 'equals', value: 'active' }], sort: [{ field: 'name', order: 'asc' }], - bulkActions: ['delete'], })} dataSource={ds} onBulkDelete={onBulkDelete} diff --git a/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkDeclared-30394.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkDeclared-30394.test.tsx index c4d3d8d1d59..69ef9159ebe 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkDeclared-30394.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkDeclared-30394.test.tsx @@ -7,14 +7,14 @@ */ /** - * objectstack#30394 — the NON-grid selection bar (kanban / calendar / gallery - * / …), which ListView draws itself, follows the grid's rule (objectstack#30169, - * ruling C): a bare `bulkActions` name draws a button only when the object - * declares an action of that name, labelled from that declaration; the - * built-in `delete` keeps its own path; any other name draws nothing and, in - * development, is named once in a console warning, the grid's own warning. + * objectstack#30394, objectstack#36496 — the NON-grid selection bar (kanban / + * calendar / gallery / …), which ListView draws itself, draws what every grid + * of the object draws: the object's actions placed at `selection`, labelled + * from their declaration, in the order the object's `actionLayout.selection` + * gives, then the built-in Delete where the object allows it. An action not + * placed at `selection` draws nothing. The view lists nothing. * - * The grid's half is pinned in plugin-grid's `objectBulkActionDispatch.test.tsx`; + * The grid's half is pinned in plugin-grid's `resolveBulkActions.test.ts`; * this file pins the same rule on the bar ListView renders for every other view. */ @@ -28,7 +28,10 @@ import { ListView } from '../ListView'; const ROWS = [{ id: 'l1', name: 'Lead One' }, { id: 'l2', name: 'Lead Two' }]; -function makeDataSource(objectName: string, opts: { actions?: unknown[]; noSchema?: boolean } = {}) { +function makeDataSource( + objectName: string, + opts: { actions?: unknown[]; actionLayout?: unknown; noSchema?: boolean } = {}, +) { const ds: Record = { find: vi.fn().mockResolvedValue(ROWS.map(r => ({ ...r }))), findOne: vi.fn(), @@ -41,6 +44,7 @@ function makeDataSource(objectName: string, opts: { actions?: unknown[]; noSchem name: objectName, fields: { id: { type: 'text' }, name: { type: 'text' } }, ...(opts.actions ? { actions: opts.actions } : {}), + ...(opts.actionLayout ? { actionLayout: opts.actionLayout } : {}), }); } return ds; @@ -61,14 +65,13 @@ function registerSelectingGallery() { }); } -function renderGallery(objectName: string, bulkActions: string[], ds: Record) { +function renderGallery(objectName: string, ds: Record) { const onBulkAction = vi.fn(); const schema: ListViewSchema = { type: 'list-view', objectName, viewType: 'gallery', fields: ['name'], - bulkActions, }; render( @@ -78,85 +81,65 @@ function renderGallery(objectName: string, bulkActions: string[], ds: Record String(c[0])) - .filter((m: string) => m.startsWith('[ObjectUI] ListView bulkActions:')); -} +const barOrder = () => + Array.from(screen.getByTestId('bulk-actions-bar').querySelectorAll('[data-testid^="bulk-action-"]')) + .map(el => el.getAttribute('data-testid')); -describe('ListView non-grid bulk bar draws only actions the object declares (objectstack#30394)', () => { +describe('ListView non-grid bulk bar draws the object\'s selection actions (objectstack#36496)', () => { let prevGallery: ReturnType; - let warn: { mock: { calls: unknown[][] }; mockRestore: () => void }; beforeEach(() => { prevGallery = ComponentRegistry.get('object-gallery'); registerSelectingGallery(); - warn = vi.spyOn(console, 'warn').mockImplementation(() => {}); }); afterEach(() => { cleanup(); - warn.mockRestore(); if (prevGallery) ComponentRegistry.register('object-gallery', prevGallery); else ComponentRegistry.unregister('object-gallery'); }); - it('draws the declared name with its declared label, keeps delete, and drops the undeclared name', async () => { - const ds = makeDataSource('lead_a', { actions: [{ name: 'qualify_lead', label: 'Qualify' }] }); - const { onBulkAction } = renderGallery('lead_a', ['qualify_lead', 'create_campaign', 'delete'], ds); + it('draws each action placed at `selection` with its declared label, then Delete, and skips one placed elsewhere', async () => { + const ds = makeDataSource('lead_a', { + actions: [ + { name: 'qualify_lead', label: 'Qualify', locations: ['selection'] }, + { name: 'create_campaign', label: 'Campaign', locations: ['record'] }, + ], + }); + const { onBulkAction } = renderGallery('lead_a', ds); await waitFor(() => expect(screen.getByTestId('bulk-actions-bar')).toBeInTheDocument()); const qualify = await screen.findByTestId('bulk-action-qualify_lead'); // The declaration's label, not the title-cased name (`Qualify Lead`). expect(qualify).toHaveTextContent('Qualify'); expect(qualify).not.toHaveTextContent('Qualify Lead'); - expect(screen.getByTestId('bulk-action-delete')).toBeInTheDocument(); expect(screen.queryByTestId('bulk-action-create_campaign')).toBeNull(); + expect(barOrder()).toEqual(['bulk-action-qualify_lead', 'bulk-action-delete']); - // Authored order, delete where the author put it. - const order = Array.from(screen.getByTestId('bulk-actions-bar').querySelectorAll('[data-testid^="bulk-action-"]')) - .map(el => el.getAttribute('data-testid')); - expect(order).toEqual(['bulk-action-qualify_lead', 'bulk-action-delete']); - - // The declared name still dispatches through the host by its name. + // The action dispatches through the host by its name. fireEvent.click(qualify); expect(onBulkAction).toHaveBeenCalledWith('qualify_lead', ROWS); - - await waitFor(() => expect(listViewWarnings(warn)).toHaveLength(1)); - const [message] = listViewWarnings(warn); - expect(message).toContain("gallery (objectName: 'lead_a')"); - expect(message).toContain("1 name matches no action the object declares"); - expect(message).toContain("'create_campaign'"); - expect(message).not.toContain('qualify_lead'); }); - it('draws no bar at all when no name is declared and there is no delete', async () => { - const ds = makeDataSource('lead_b', { actions: [{ name: 'qualify_lead', label: 'Qualify' }] }); - renderGallery('lead_b', ['create_campaign', 'send_blast'], ds); + it('orders the bar by the object\'s `actionLayout.selection`', async () => { + const ds = makeDataSource('lead_b', { + actions: [ + { name: 'qualify_lead', label: 'Qualify', locations: ['selection'] }, + { name: 'send_blast', label: 'Blast', locations: ['selection'] }, + ], + actionLayout: { selection: { pinned: ['send_blast'] } }, + }); + renderGallery('lead_b', ds); - await screen.findByTestId('gallery-stub'); - await waitFor(() => expect(listViewWarnings(warn)).toHaveLength(1)); - expect(screen.queryByTestId('bulk-actions-bar')).toBeNull(); - expect(listViewWarnings(warn)[0]).toContain("2 names match no action the object declares"); + await screen.findByTestId('bulk-action-send_blast'); + expect(barOrder()).toEqual(['bulk-action-send_blast', 'bulk-action-qualify_lead', 'bulk-action-delete']); }); - it('says the actions are unknown, not undeclared, when the data source cannot read the schema', async () => { + it('draws only Delete when the schema cannot be read', async () => { const ds = makeDataSource('lead_c', { noSchema: true }); - renderGallery('lead_c', ['qualify_lead', 'delete'], ds); + renderGallery('lead_c', ds); await waitFor(() => expect(screen.getByTestId('bulk-actions-bar')).toBeInTheDocument()); - expect(screen.queryByTestId('bulk-action-qualify_lead')).toBeNull(); - expect(screen.getByTestId('bulk-action-delete')).toBeInTheDocument(); - await waitFor(() => expect(listViewWarnings(warn)).toHaveLength(1)); - expect(listViewWarnings(warn)[0]).toContain("gallery (objectName: 'lead_c') — the object's schema could not be read"); - }); - - it('says nothing while every name is declared', async () => { - const ds = makeDataSource('lead_d', { actions: [{ name: 'qualify_lead', label: 'Qualify' }] }); - renderGallery('lead_d', ['qualify_lead'], ds); - - await screen.findByTestId('bulk-action-qualify_lead'); - expect(listViewWarnings(warn)).toEqual([]); + expect(barOrder()).toEqual(['bulk-action-delete']); }); }); diff --git a/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkGate-30535.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkGate-30535.test.tsx index 5c4cef86a21..734d6573479 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkGate-30535.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.nonGridBulkGate-30535.test.tsx @@ -15,7 +15,10 @@ * drawn (ADR-0066 D4; unknown capabilities fail open, as on the grid); * - `visible` is evaluated once per selected record, and the action is drawn * when at least one selected record passes; - * - a name repeated in `bulkActions` draws one button. + * - a name declared twice draws one button. + * + * Since objectstack#36496 the bar's actions are the object's actions placed at + * `selection`; the view lists nothing. * * The grid's half is pinned in plugin-grid's `bulkActionCapabilityGate.test.tsx` * and `bulk-action-visible.test.tsx`; this file pins the same gate on the bar @@ -60,7 +63,6 @@ function registerSelectingGallery(rows: Row[]) { function renderGallery( objectName: string, - bulkActions: string[], ds: ReturnType, user?: unknown, ) { @@ -69,7 +71,6 @@ function renderGallery( objectName, viewType: 'gallery', fields: ['name'], - bulkActions, }; const tree = ( @@ -83,9 +84,9 @@ const OPEN: Row = { id: 'l1', name: 'Lead One', status: 'open' }; const CLOSED: Row = { id: 'l2', name: 'Lead Two', status: 'closed' }; const ACTIONS = [ - { name: 'tag_lead', label: 'Tag' }, - { name: 'push_down', label: 'Push Down', requiredPermissions: ['plan.push'] }, - { name: 'reopen', label: 'Reopen', visible: "record.status == 'closed'" }, + { name: 'tag_lead', label: 'Tag', locations: ['selection'] }, + { name: 'push_down', label: 'Push Down', requiredPermissions: ['plan.push'], locations: ['selection'] }, + { name: 'reopen', label: 'Reopen', visible: "record.status == 'closed'", locations: ['selection'] }, ]; describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#30535)', () => { @@ -106,7 +107,7 @@ describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#3053 it('does not draw an action whose requiredPermissions the caller lacks', async () => { registerSelectingGallery([OPEN]); const ds = makeDataSource('lead_g1', [OPEN], ACTIONS); - renderGallery('lead_g1', ['tag_lead', 'push_down'], ds, { id: 'u1', systemPermissions: ['setup.access'] }); + renderGallery('lead_g1', ds, { id: 'u1', systemPermissions: ['setup.access'] }); await screen.findByTestId('bulk-action-tag_lead'); expect(screen.queryByTestId('bulk-action-push_down')).toBeNull(); @@ -115,7 +116,7 @@ describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#3053 it('draws it when the caller holds every declared capability', async () => { registerSelectingGallery([OPEN]); const ds = makeDataSource('lead_g2', [OPEN], ACTIONS); - renderGallery('lead_g2', ['tag_lead', 'push_down'], ds, { id: 'u1', systemPermissions: ['plan.push'] }); + renderGallery('lead_g2', ds, { id: 'u1', systemPermissions: ['plan.push'] }); expect(await screen.findByTestId('bulk-action-push_down')).toHaveTextContent('Push Down'); }); @@ -123,7 +124,7 @@ describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#3053 it('draws it when the caller capabilities are unknown (fail open, as the grid)', async () => { registerSelectingGallery([OPEN]); const ds = makeDataSource('lead_g3', [OPEN], ACTIONS); - renderGallery('lead_g3', ['push_down'], ds); + renderGallery('lead_g3', ds); expect(await screen.findByTestId('bulk-action-push_down')).toBeInTheDocument(); }); @@ -131,7 +132,7 @@ describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#3053 it('evaluates visible per selected record: no passing record, no button', async () => { registerSelectingGallery([OPEN]); const ds = makeDataSource('lead_v1', [OPEN], ACTIONS); - renderGallery('lead_v1', ['tag_lead', 'reopen'], ds); + renderGallery('lead_v1', ds); await screen.findByTestId('bulk-action-tag_lead'); expect(screen.queryByTestId('bulk-action-reopen')).toBeNull(); @@ -140,7 +141,7 @@ describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#3053 it('evaluates visible per selected record: one passing record draws the button', async () => { registerSelectingGallery([OPEN, CLOSED]); const ds = makeDataSource('lead_v2', [OPEN, CLOSED], ACTIONS); - renderGallery('lead_v2', ['tag_lead', 'reopen'], ds); + renderGallery('lead_v2', ds); expect(await screen.findByTestId('bulk-action-reopen')).toHaveTextContent('Reopen'); }); @@ -148,8 +149,8 @@ describe('ListView non-grid bulk bar applies the grid bar gate (objectstack#3053 it('draws a repeated name once, with no duplicate React key', async () => { registerSelectingGallery([OPEN]); const error = vi.spyOn(console, 'error').mockImplementation(() => {}); - const ds = makeDataSource('lead_d1', [OPEN], ACTIONS); - renderGallery('lead_d1', ['tag_lead', 'tag_lead', 'delete', 'delete'], ds); + const ds = makeDataSource('lead_d1', [OPEN], [...ACTIONS, { name: 'tag_lead', label: 'Tag again', locations: ['selection'] }]); + renderGallery('lead_d1', ds); await screen.findByTestId('bulk-action-tag_lead'); await waitFor(() => expect(screen.getAllByTestId('bulk-action-tag_lead')).toHaveLength(1)); diff --git a/ui/packages/plugin-list/src/__tests__/ListView.permissions.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.permissions.test.tsx index 466e92ba43f..83985d293ec 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.permissions.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.permissions.test.tsx @@ -179,7 +179,6 @@ const galleryBulkSchema: ListViewSchema = { objectName: 'account', viewType: 'gallery', fields: ['name', 'industry'], - bulkActions: ['delete', 'archive'] as any, }; /** @@ -199,17 +198,17 @@ function registerSelectingGallery() { } /** - * The gallery's data source also serves the object, which declares `archive`: - * the non-grid bar draws a bare `bulkActions` name only when the object - * declares it (objectstack#30394), so without the declaration the - * non-delete control below would have nothing to draw. + * The gallery's data source also serves the object, which places `archive` + * at `selection`: the non-grid bar draws the object's selection actions, then + * Delete (objectstack#36496), so without the placement the non-delete control + * below would have nothing to draw. */ const galleryDataSource = { ...mockDataSource, getObjectSchema: vi.fn().mockResolvedValue({ name: 'account', fields: { name: { type: 'text' }, industry: { type: 'text' } }, - actions: [{ name: 'archive', label: 'Archive' }], + actions: [{ name: 'archive', label: 'Archive', locations: ['selection'] }], }), }; diff --git a/ui/packages/plugin-list/src/__tests__/ListView.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.test.tsx index ded3ca9fe44..5582099ac3f 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.test.tsx @@ -2468,7 +2468,6 @@ describe('ListView', () => { objectName: 'contacts', viewType: 'grid', fields: ['name', 'email'], - bulkActions: ['delete', 'archive'] as any, }; renderWithProvider(); diff --git a/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx b/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx index d0d98f7a7fa..b8aa672af76 100644 --- a/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx @@ -569,11 +569,6 @@ describe('objectui#13047 — the grid keys, handed to the `object-grid` node `Li expect((await gridFor({ rowActions: ['complete_task', 'reassign'] })).rowActions).toEqual(['complete_task', 'reassign']); }); - it('`bulkActions`: the action names reach the grid as its batch actions', async () => { - expect((await controlGrid()).batchActions).toBeUndefined(); - expect((await gridFor({ bulkActions: ['complete_task'] })).batchActions).toEqual(['complete_task']); - }); - it('`bulkActionDefs`: the definitions reach the grid unchanged', async () => { expect((await controlGrid()).bulkActionDefs).toBeUndefined(); const defs = [{ name: 'mark_doing', label: 'Mark doing', operation: 'update', patch: { stage: 'doing' } }]; diff --git a/ui/packages/plugin-view/src/ObjectView.tsx b/ui/packages/plugin-view/src/ObjectView.tsx index 5c4a9680b4f..44fb15b741b 100644 --- a/ui/packages/plugin-view/src/ObjectView.tsx +++ b/ui/packages/plugin-view/src/ObjectView.tsx @@ -3236,9 +3236,8 @@ export const ObjectView: React.FC = ({ appearance: currentNamedViewConfig?.appearance ?? activeView?.appearance, rowActions: currentNamedViewConfig?.rowActions ?? activeView?.rowActions ?? (schema as any).rowActions, rowActionDefs: (activeView as any)?.rowActionDefs ?? (schema as any).rowActionDefs, - // [objectstack#36496] A view no longer lists bulk actions: the grid draws the - // object's `selection` ones. The host's own composition key still relays. - bulkActions: (schema as any).bulkActions, + // [objectstack#36496] No `bulkActions`: a list view no longer lists + // them, and the grid draws the object's `selection` actions. bulkActionDefs: currentNamedViewConfig?.bulkActionDefs ?? activeView?.bulkActionDefs, sharing: currentNamedViewConfig?.sharing ?? activeView?.sharing ?? (schema as any).sharing, addRecord: currentNamedViewConfig?.addRecord ?? activeView?.addRecord ?? (schema as any).addRecord, diff --git a/ui/packages/types/src/objectql.ts b/ui/packages/types/src/objectql.ts index 65a1390ea51..56a81191be3 100644 --- a/ui/packages/types/src/objectql.ts +++ b/ui/packages/types/src/objectql.ts @@ -3066,8 +3066,14 @@ export interface NamedListView { /** Row action identifiers */ rowActions?: string[]; - /** Bulk action identifiers */ - bulkActions?: string[]; + /** + * @deprecated RETIRED in protocol 19 (objectstack#36496) — a list view no + * longer lists the actions a selection offers: an action placed at + * `selection` is drawn on the selection bar of every grid view of its + * object, in the order the object's `actionLayout.selection` gives. The spec + * refuses the key at parse; `os migrate meta --from 18` moves a stored list. + */ + bulkActions?: never; /** Rich bulk action definitions — see BulkActionDef. */ bulkActionDefs?: BulkActionDef[]; From a78a7003df4c77674df4cd14f9ca5f2ee331db58 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 06:44:07 +0000 Subject: [PATCH 4/9] wip: docs, plugin-view and plugin-list tests, selection-bar unit tests, i18n bundles Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- .../docs/deployment/validating-metadata.mdx | 4 +- content/docs/references/data/object.mdx | 14 ++--- content/docs/references/ui/action.mdx | 5 +- content/docs/references/ui/bulk-action.mdx | 12 ++--- content/docs/references/ui/component.mdx | 20 +++---- content/docs/references/ui/view.mdx | 36 ++++++------- content/docs/ui/actions.mdx | 52 +++++++++++-------- content/docs/ui/views.mdx | 37 +++++++------ packages/spec/docs/references/api/metadata.md | 2 +- .../docs/references/api/protocol.part-2.md | 8 +-- .../docs/references/kernel/metadata-plugin.md | 4 +- .../spec/docs/references/system/migration.md | 2 +- .../references/system/migration.part-2.md | 2 +- packages/spec/src/system/translation.zod.ts | 5 +- .../src/__tests__/BulkActionBar.test.tsx | 20 +++++++ .../src/__tests__/resolveBulkActions.test.ts | 49 ++++++++++++++++- ui/packages/plugin-view/src/ObjectView.tsx | 7 ++- ...ctView.namedViewProtocolKeys-8980.test.tsx | 2 +- ...ew.routeTwoNamedGridMembers-10885.test.tsx | 3 +- .../__tests__/objectViewHostSurface.test.tsx | 2 +- 20 files changed, 187 insertions(+), 99 deletions(-) diff --git a/content/docs/deployment/validating-metadata.mdx b/content/docs/deployment/validating-metadata.mdx index 71244eff42d..2055850c3fa 100644 --- a/content/docs/deployment/validating-metadata.mdx +++ b/content/docs/deployment/validating-metadata.mdx @@ -123,14 +123,14 @@ no declared page, **fails** validation; a `url` path whose The same gate covers the reference sites that are plain strings in the schema: an action param's record-picker target, a dashboard filter's options source, a navigation capability gate, and every surface that binds an action **by name** -(`bulkActions` / `rowActions`, a page's `record:quick_actions`, a nav action item). +(`rowActions`, an aggregate `bulkActionDefs` entry, a page's `record:quick_actions`, a nav action item). ```ts // ✗ the platform user object is `sys_user` — `user` resolves to nothing → error { name: 'owner', type: 'lookup', reference: 'user' } // ✗ no action named `mass_update` is defined anywhere → error -defineView({ /* … */ bulkActions: ['mass_update', 'mass_delete'] }) +defineView({ /* … */ list: { rowActions: ['mass_update', 'mass_delete'] } }) // ⚠ platform-shaped, but no known package registers it → warning { id: 'nav_approvals', type: 'object', objectName: 'sys_approval_process', diff --git a/content/docs/references/data/object.mdx b/content/docs/references/data/object.mdx index 13c27fe5b97..46a44bfe9c6 100644 --- a/content/docs/references/data/object.mdx +++ b/content/docs/references/data/object.mdx @@ -151,7 +151,7 @@ const result = ApiMethod.parse(data); | **description** | `string` | optional | Developer documentation / description | | **icon** | `string` | optional | Icon name (Lucide/Material) for UI representation | | **color** | `Enum<'gray' \| 'blue' \| 'teal' \| 'green' \| 'amber' \| 'orange' \| 'red' \| 'pink' \| 'purple'>` | optional | Object colour, one name from the fixed palette (gray, blue, teal, green, amber, orange, red, pink, purple). The console draws the object's icon as a white glyph on a rounded square of this colour, so one object looks the same wherever its icon appears. No free colour values. Omit to draw the neutral `gray`. | -| **actionLayout** | `{ list?: object; record?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | +| **actionLayout** | `{ list?: object; record?: object; selection?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`, `selection`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | | **isSystem** | `boolean` | optional (default: `false`) | Is system object (protected from deletion; defaults its org-wide sharing to public when no sharingModel is set — plugin-sharing) | | **managedBy** | `Enum<'platform' \| 'config' \| 'system-data' \| 'engine-owned' \| 'append-only' \| 'synced' \| 'better-auth'>` | optional | Lifecycle bucket — platform (user CRUD) \| config (admin authored) \| system-data (platform-defined schema, admin/user-writable data) \| engine-owned (engine owns the lifecycle, no user writes) \| append-only (audit) \| synced (rows copied by a pull from a connector or federated source; read-only to members, and userActions cannot open a write) \| better-auth (identity). UI clients honour the resolved affordance matrix. | | **ownership** | `Enum<'user' \| 'business_unit' \| 'org' \| 'none'>` | optional | Record-ownership model: user (default — injects reassignable owner_id plus owning_business_unit_id) \| business_unit (unit-owned: owning_business_unit_id only, no owner_id) \| org \| none (no per-record owner, neither anchor). Distinct from the package own/extend contribution kind. | @@ -205,6 +205,7 @@ const result = ApiMethod.parse(data); | :--- | :--- | :--- | :--- | | **list** | `{ pinned: string[]; more?: string[] }` | optional | The list scope's arrangement: actions of the object placed at `list`, as drawn on the list page toolbar, and `$import` / `$export` as pinned buttons (not pinned, they stay in the page's own Import / Export menu). Omit to draw it as before. | | **record** | `{ pinned: string[]; more?: string[] }` | optional | The record scope's arrangement: actions of the object placed at `record` or `record_page`, as drawn in the record header (record page, side preview, a phone's bottom bar). The same order leads the actions a grid row already offers, adding none: the row's ⋮ menu, its right-click menu and, on a list page, the selection bar's actions for one selected record (`pinned` names first, then `more` names, then the rest as before). The selection bar's buttons, at most three, are the first of that order; a row's own inline button does not change. Omit to draw each as before. | +| **selection** | `{ pinned: string[]; more?: string[] }` | optional | The selection scope's arrangement: actions of the object placed at `selection`, as drawn on the selection bar a grid shows once two or more rows are selected, on every grid view of the object. `pinned` names the bar's buttons, in order; the rest, Delete included, are in the bar's 「More」, the ones `more` names first. A view's own `bulkActionDefs` lead the bar. Omit to draw them in their default order, the first three as buttons. | ### Nested Shape: `Object.userActions` @@ -442,8 +443,8 @@ const result = ApiMethod.parse(data); | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -522,7 +523,7 @@ const result = ApiMethod.parse(data); | **description** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string \| Record` | optional | Explanatory line shown under the title in the action's param dialog. Carries the confirm question for an action that collects params (one dialog, not two). Not the LLM-facing `ai.description`. It is a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over `record`, the record the action runs against (the clicked row on a list, else the page's record); the values the dialog collects are not bound, since the line shows before they exist. Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Choose the new role for `{{ record.name }}`.'. A hole over any other root, a `${…}` or single-brace `{x}` token (each named with its `{{ }}` spelling), a hole holding logic or an unknown formatter, and a blank sentence are named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. An inline locale map (`{ en, "zh-CN" }`) is accepted too, each value such a sentence. | | **objectName** | `string` | optional | Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack(). | | **icon** | `string` | optional | Icon name | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: 'action:menu'` to sit in the record page's ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| …>[]` | optional | Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: 'action:menu'` to sit in the record page's ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. `selection` acts on many records: the selection bar a grid shows once two or more rows are selected, on every grid view of the object, run once per selected record (the object's `actionLayout.selection` orders that bar). | | **component** | `Enum<'action:button' \| 'action:icon' \| 'action:menu' \| 'action:group'>` | optional | Visual component override | | **type** | `Enum<'script' \| 'url' \| 'modal' \| 'flow' \| 'api' \| 'form'>` | optional (default: `"script"`) | Action functionality type — the dispatch route. The declarative single-record field write is not a type: it is `operation: 'update'` + `patch` on the default `script` route. | | **target** | `string` | optional | URL, Script Name, Flow ID, or API Endpoint. Supports $`{param.X}` and $`{ctx.X}` interpolation. For type:'url': an http:// or https:// URL, a mailto: address, or an in-app path starting with / or ./ (a console route; a record is /apps/APP/OBJECT/record/ID, APP being the app's route segment — see onSuccess.navigate) — every other scheme and a protocol-relative //host are refused. | @@ -532,7 +533,7 @@ const result = ApiMethod.parse(data); | **texts** | `Record` | optional | Texts the action's js body writes into records, keyed by the snake_case key it asks for with ctx.text(KEY, params): `{ message, params? }`. ctx.text answers the sentence in the organization's language (the Localization setting when somebody set it, else the app's i18n.defaultLocale), translated through objects.``._actions.``.texts.``.message (globalActions.``.texts.``.message for an object-less action) with the declared message as the fallback, its holes filled from params. A key not declared here is refused — at save when the body asks for it literally, otherwise at run time. Only a type: 'script' action with a js body declares one | | **operation** | `Enum<'update'>` | optional | The declarative single-record field write, mirroring a list view's `bulkActionDefs`: `'update'` applies `patch` (merged under the collected `params`) to the current record on the data plane AS THE CALLER — never system-elevated — so the caller's permissions, the object's hooks and its validations fire as for a user edit. `type` stays at its default `'script'` (the platform action route the write is performed on); `target`/`body`/`method`/`bodyExtra` are refused beside it. `'delete'` and `'custom'` have no row-level form. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values written to the current record, merged UNDER the user-supplied `params` so a fixed value can be declared without exposing it in the dialog. Written on the data plane as the caller: object permissions, hooks and validations fire as for a user edit. Refused on an action without `operation: 'update'` (it would be silently dropped). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the view's `bulkActions: ['']` bare-string form); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. A list view wiring a declared action under the other contract is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the action placed at `selection`); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. An action placed at `selection` that declares 'aggregate', or a list view wiring a declared action under the other contract, is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). | | **params** | `{ name?: string; field?: string; objectOverride?: string; label?: string \| Record; … }[]` | optional | Input parameters required from user — an ActionParam[] DEFINITION array, never a payload map (a static request body goes in `bodyExtra`). A param name (its `name`, or the `field` a field-backed param reads) may repeat only for per-gate variants of ONE input (declarations that differ in `visible` / `requiresFeature`, e.g. one optional and one required); the params check treats the name as `required` only when EVERY declaration of it requires it, and judges its value by the FIRST declaration's shape (`type`, `multiple`, `options`), so keep that shape identical across them. | | **submitText** | `string \| Record` | optional | Label of the submit button in the action's param dialog, the verb the button performs (e.g. "Send", "Log Call"), in place of the default "Confirm" — the default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.submitText` (`globalActions.ACTION.submitText` for an object-less action). Only on an action with a non-empty `params`: without one no param dialog opens, so it is refused. Not `confirmText`, which is the message of a param-less action's confirm dialog. A blank label is refused. | | **cancelText** | `string \| Record` | optional | Label of the dismiss button on the dialog the action opens before it runs — the confirm dialog of a param-less action that declares `confirmText`, or the param dialog of an action with a non-empty `params` — in place of the default "Cancel". Name what dismissing keeps where the action's own verb is "Cancel …" or "Close …" (e.g. "Keep invitation" beside "Cancel Invitation"). The default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.cancelText` (`globalActions.ACTION.cancelText` for an object-less action). Only on an action that opens one of those dialogs: with neither `confirmText` nor a non-empty `params` no dialog opens, so it is refused. The dismiss twin of `submitText`, as on `object-form`. A blank label is refused. | @@ -628,7 +629,7 @@ const result = ApiMethod.parse(data); | **label** | `string` | optional | Override label for the extended object | | **pluralLabel** | `string` | optional | Override plural label for the extended object | | **description** | `string` | optional | Override description for the extended object | -| **actionLayout** | `{ list?: object; record?: object }` | optional | The arrangement of the extended object's actions, per scope (`list`, `record`), in the object's own shape. Written only by the object extension of the paired `.custom` package of the App the object belongs to (ADR-0146 D10). An extension in a package that is not a `.custom` package is refused at publish, by `os validate` / `os build` and at install, and the registry merge skips it with a warning; an action that package brings is placed by its own `locations` and `order`. A `.custom` package that is not this object's pair is not applied. Each arm written replaces the arm the object serves for that scope, whole, after every other layer; an arm not written stays as the object gives it, and removing the key, or uninstalling or disabling the package, restores it. | +| **actionLayout** | `{ list?: object; record?: object; selection?: object }` | optional | The arrangement of the extended object's actions, per scope (`list`, `record`), in the object's own shape. Written only by the object extension of the paired `.custom` package of the App the object belongs to (ADR-0146 D10). An extension in a package that is not a `.custom` package is refused at publish, by `os validate` / `os build` and at install, and the registry merge skips it with a warning; an action that package brings is placed by its own `locations` and `order`. A `.custom` package that is not this object's pair is not applied. Each arm written replaces the arm the object serves for that scope, whole, after every other layer; an arm not written stays as the object gives it, and removing the key, or uninstalling or disabling the package, restores it. | | **validations** | `any[]` | optional | Additional validation rules to merge into the target object | | **indexes** | `{ name?: string; fields: string[]; unique?: false \| 'global' \| 'organization' }[]` | optional | Additional indexes to merge into the target object | | **place** | `({ field: string; group: string; after?: string; before?: string } \| { list: string; after?: string; before?: string; label?: string; … } \| { group: object; after?: string; before?: string })[]` | optional | Where the fields, groups and child lists this extension brings go on the extended object. Each entry is one of: `{ field, group, after \| before }` — a field of this extension's own `fields`, into a field group (the extended object's, or one this extension adds), right after or before a member of that group; `{ group: { key, label, … }, after \| before }` — a field group of this extension's own (its `fields` may name only fields this extension adds, its `relatedList` only a child list of this package), right after or before a group of the extended object; `{ list, after \| before, label?, columns? }` — a child list of this package (a child object of the same package that points at the extended object, or object.field), right after or before a tab of the extended object (a relatedLists entry name, a built-in tab included), with that tab's own title and columns (each column a field of the child, judged as a relatedLists entry's columns are). Write `after` or `before`, or neither for the end. An anchor may be an item another placement brings, whatever order the two are written or registered in. An anchor nobody has puts the item at the end of its group, of the groups, or of the tabs (before the approvals and activity-stream tabs); a group that does not exist puts the field among the ungrouped fields. Nothing is dropped. Several items at one anchor follow ascending `priority`, then package name, so every build gives the same order. Placement arranges what the extended object declares: list placements apply when it declares `relatedLists`, group and field placements when it declares `fieldGroups`. Where it declares none, its automatic arrangement stays as it is and the item still shows there: the list in the automatic tab order, with this entry's `label` and `columns` not applied either (write them on the child's own lookup field as `relatedListTitle` / `relatedListColumns`, which apply on every parent), and the field among the fields in declaration order, its `after` / `before` not applied. The boot log names each placement that did not apply, with the object and the package; `os validate` names it too when the extended object is in the same stack. A child list another package brings shows even when the extended object's `relatedLists` does not name it: placed, at its place; unplaced, at the end of the tabs. An extension places only its own items: a field outside its own `fields` is refused here; a field the extended object declares (an owner field this extension redeclares for its display is still the owner's), a group key the extended object declares, and a list (or a group's `relatedList`) that is not a child object of its package are refused at `defineStack` where the objects are known; the merge skips each of them too, with a warning naming whose item it is. A group key another package's extension already adds is not refused: the merge adds it once and names the second. Applied once, by the registry merge, so the record page, the forms and Studio show one arrangement; uninstalling the package removes its items and leaves the extended object's own order as it was. Example: `place: [{ field: 'tax_id', group: 'basic', after: 'industry' }, { list: 'contract', after: 'opportunity', columns: ['name', 'amount'] }]`. | @@ -746,6 +747,7 @@ const result = ApiMethod.parse(data); | :--- | :--- | :--- | :--- | | **list** | `{ pinned: string[]; more?: string[] }` | optional | The list scope's arrangement: actions of the object placed at `list`, as drawn on the list page toolbar, and `$import` / `$export` as pinned buttons (not pinned, they stay in the page's own Import / Export menu). Omit to draw it as before. | | **record** | `{ pinned: string[]; more?: string[] }` | optional | The record scope's arrangement: actions of the object placed at `record` or `record_page`, as drawn in the record header (record page, side preview, a phone's bottom bar). The same order leads the actions a grid row already offers, adding none: the row's ⋮ menu, its right-click menu and, on a list page, the selection bar's actions for one selected record (`pinned` names first, then `more` names, then the rest as before). The selection bar's buttons, at most three, are the first of that order; a row's own inline button does not change. Omit to draw each as before. | +| **selection** | `{ pinned: string[]; more?: string[] }` | optional | The selection scope's arrangement: actions of the object placed at `selection`, as drawn on the selection bar a grid shows once two or more rows are selected, on every grid view of the object. `pinned` names the bar's buttons, in order; the rest, Delete included, are in the bar's 「More」, the ones `more` names first. A view's own `bulkActionDefs` lead the bar. Omit to draw them in their default order, the first three as buttons. | ### Nested Shape: `ObjectExtension.indexes[number]` diff --git a/content/docs/references/ui/action.mdx b/content/docs/references/ui/action.mdx index 7213e69513f..6d3baaff00c 100644 --- a/content/docs/references/ui/action.mdx +++ b/content/docs/references/ui/action.mdx @@ -48,7 +48,7 @@ const result = ActionSchema.parse(data); | **description** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string \| Record` | optional | Explanatory line shown under the title in the action's param dialog. Carries the confirm question for an action that collects params (one dialog, not two). Not the LLM-facing `ai.description`. It is a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over `record`, the record the action runs against (the clicked row on a list, else the page's record); the values the dialog collects are not bound, since the line shows before they exist. Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Choose the new role for `{{ record.name }}`.'. A hole over any other root, a `${…}` or single-brace `{x}` token (each named with its `{{ }}` spelling), a hole holding logic or an unknown formatter, and a blank sentence are named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. An inline locale map (`{ en, "zh-CN" }`) is accepted too, each value such a sentence. | | **objectName** | `string` | optional | Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack(). | | **icon** | `string` | optional | Icon name | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: 'action:menu'` to sit in the record page's ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section' \| 'selection'>[]` | optional | Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: 'action:menu'` to sit in the record page's ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. `selection` acts on many records: the selection bar a grid shows once two or more rows are selected, on every grid view of the object, run once per selected record (the object's `actionLayout.selection` orders that bar). | | **component** | `Enum<'action:button' \| 'action:icon' \| 'action:menu' \| 'action:group'>` | optional | Visual component override | | **type** | `Enum<'script' \| 'url' \| 'modal' \| 'flow' \| 'api' \| 'form'>` | optional (default: `"script"`) | Action functionality type — the dispatch route. The declarative single-record field write is not a type: it is `operation: 'update'` + `patch` on the default `script` route. | | **target** | `string` | optional | URL, Script Name, Flow ID, or API Endpoint. Supports $`{param.X}` and $`{ctx.X}` interpolation. For type:'url': an http:// or https:// URL, a mailto: address, or an in-app path starting with / or ./ (a console route; a record is /apps/APP/OBJECT/record/ID, APP being the app's route segment — see onSuccess.navigate) — every other scheme and a protocol-relative //host are refused. | @@ -58,7 +58,7 @@ const result = ActionSchema.parse(data); | **texts** | `Record` | optional | Texts the action's js body writes into records, keyed by the snake_case key it asks for with ctx.text(KEY, params): `{ message, params? }`. ctx.text answers the sentence in the organization's language (the Localization setting when somebody set it, else the app's i18n.defaultLocale), translated through objects.``._actions.``.texts.``.message (globalActions.``.texts.``.message for an object-less action) with the declared message as the fallback, its holes filled from params. A key not declared here is refused — at save when the body asks for it literally, otherwise at run time. Only a type: 'script' action with a js body declares one | | **operation** | `Enum<'update'>` | optional | The declarative single-record field write, mirroring a list view's `bulkActionDefs`: `'update'` applies `patch` (merged under the collected `params`) to the current record on the data plane AS THE CALLER — never system-elevated — so the caller's permissions, the object's hooks and its validations fire as for a user edit. `type` stays at its default `'script'` (the platform action route the write is performed on); `target`/`body`/`method`/`bodyExtra` are refused beside it. `'delete'` and `'custom'` have no row-level form. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values written to the current record, merged UNDER the user-supplied `params` so a fixed value can be declared without exposing it in the dialog. Written on the data plane as the caller: object permissions, hooks and validations fire as for a user edit. Refused on an action without `operation: 'update'` (it would be silently dropped). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the view's `bulkActions: ['']` bare-string form); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. A list view wiring a declared action under the other contract is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the action placed at `selection`); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. An action placed at `selection` that declares 'aggregate', or a list view wiring a declared action under the other contract, is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). | | **params** | `{ name?: string; field?: string; objectOverride?: string; label?: string \| Record; … }[]` | optional | Input parameters required from user — an ActionParam[] DEFINITION array, never a payload map (a static request body goes in `bodyExtra`). A param name (its `name`, or the `field` a field-backed param reads) may repeat only for per-gate variants of ONE input (declarations that differ in `visible` / `requiresFeature`, e.g. one optional and one required); the params check treats the name as `required` only when EVERY declaration of it requires it, and judges its value by the FIRST declaration's shape (`type`, `multiple`, `options`), so keep that shape identical across them. | | **submitText** | `string \| Record` | optional | Label of the submit button in the action's param dialog, the verb the button performs (e.g. "Send", "Log Call"), in place of the default "Confirm" — the default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.submitText` (`globalActions.ACTION.submitText` for an object-less action). Only on an action with a non-empty `params`: without one no param dialog opens, so it is refused. Not `confirmText`, which is the message of a param-less action's confirm dialog. A blank label is refused. | | **cancelText** | `string \| Record` | optional | Label of the dismiss button on the dialog the action opens before it runs — the confirm dialog of a param-less action that declares `confirmText`, or the param dialog of an action with a non-empty `params` — in place of the default "Cancel". Name what dismissing keeps where the action's own verb is "Cancel …" or "Close …" (e.g. "Keep invitation" beside "Cancel Invitation"). The default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.cancelText` (`globalActions.ACTION.cancelText` for an object-less action). Only on an action that opens one of those dialogs: with neither `confirmText` nor a non-empty `params` no dialog opens, so it is refused. The dismiss twin of `submitText`, as on `object-form`. A blank label is refused. | @@ -266,6 +266,7 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities * `record_row` * `record_related` * `record_section` +* `selection` --- diff --git a/content/docs/references/ui/bulk-action.mdx b/content/docs/references/ui/bulk-action.mdx index 4c857d76386..b88853451b3 100644 --- a/content/docs/references/ui/bulk-action.mdx +++ b/content/docs/references/ui/bulk-action.mdx @@ -14,9 +14,9 @@ action expresses (`operation: 'update'` with a patch, or `'delete'`), or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection. -For the per-record dispatch, name the action in the view's -`bulkActions: ['']` instead — the bare-string form, promoted with the -action's own label, params and `visible`. +For the per-record dispatch, place the action at `selection` instead +(until protocol 19, a view's `bulkActions: ['']`) — it is promoted +with the action's own label, params and `visible`. **Source:** `packages/spec/src/ui/bulk-action.zod.ts` @@ -41,17 +41,17 @@ const result = BulkActionDefSchema.parse(data); | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | | **name** | `string` | ✅ | Stable identifier — the audit-log action key, and (for an aggregate def) the name of the object action to dispatch. | -| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and name it in `bulkActions` to get localization). | +| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and place it at `selection` to get localization). | | **icon** | `string` | optional | Lucide icon name (e.g. "user-check", "trash"). | | **variant** | `Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>` | optional | Visual treatment of the button. | | **operation** | `Enum<'update' \| 'delete' \| 'custom'>` | ✅ | What the executor does: 'update'/'delete' are data-plane mass mutations; 'custom' dispatches an object action (see `execution`). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is declared as `bulkActions: ['']` instead. | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is the action placed at `selection` instead. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values applied to every selected record, merged UNDER the user-supplied params so a fixed value can be declared without exposing it in the dialog. | | **params** | `{ name: string; label?: string; help?: string; type: Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>; … }[]` | optional | Inputs collected once before the run. Omit to skip the params step and go straight to confirm. | | **confirmText** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Confirmation text shown above the affected-record summary — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over two kinds of root, written bare: `count`, the number of records the run covers, and each of the def's params by `name` (`{{ tier }}`, never `{{ params.tier }}`; `count` wins over a param of that name). A param hole renders that param's DISPLAY value: the chosen option's `label` for an option-bearing param (a multi-value param's labels joined with ', '), the picked record's display name for a `lookup` / user param, and the entered value otherwise, so a number, date or currency value takes a formatter (`{{ amount \| currency:EUR }}`, `{{ due \| date:long }}`). Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Update tier on `{{ count }}` account(s) to `{{ tier }}`?'. A hole over any other root, and a single-brace `{x}` token, are refused by name at `objectstack validate`, `compile` and the publish gate, as are a hole holding logic or an unknown formatter and a blank sentence. | | **confirmLabel** | `string` | optional | Custom Confirm button label (default: "Run"). | | **visible** | `string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source: string; ast?: any; meta?: object }` | optional | Eligibility predicate (CEL) — a string or a `{dialect, source}` envelope, i.e. `action.visible` without its boolean-literal arm: a per-record predicate has nothing to say as a constant. Evaluated once PER SELECTED RECORD with that record bound: the button is offered when at least one passes, the run covers only those, and the rest are reported as skipped. A record-free predicate (`features.x`, `current_user.y`) therefore behaves as a plain button-level gate. Fail-closed — a predicate that faults excludes the record. | -| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from `bulkActions: ['']` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | +| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from an action placed at `selection` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | | **maxRecords** | `integer` | optional | Selection size above which the run is blocked. Set it on defs whose server work is expensive — an aggregate def carries every selected id in one request. | | **batchSize** | `integer` | optional | Records per executor batch (default 200). Data-plane operations only — an aggregate run is a single call by definition. | diff --git a/content/docs/references/ui/component.mdx b/content/docs/references/ui/component.mdx index b8801c7f38b..283e27267c9 100644 --- a/content/docs/references/ui/component.mdx +++ b/content/docs/references/ui/component.mdx @@ -51,7 +51,7 @@ const result = ActionButtonPropsSchema.parse(data); | **refreshAfter** | `boolean` | optional | Refresh the surrounding data after the action runs | | **undoable** | `boolean` | optional | Offer an Undo affordance after an update action | | **recordIdField** | `string` | optional | Row field whose value identifies the record the action acts on | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Action locations, forwarded to the runner — the console uses them to tell a record-scoped action from an object-level one | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section' \| 'selection'>[]` | optional | Action locations, forwarded to the runner — the console uses them to tell a record-scoped action from an object-level one | | **toast** | `any` | optional | Toast behaviour, forwarded to the runner | | **resultDialog** | `any` | optional | One-shot result dialog for a value the response shows exactly once, forwarded to the runner | | **onSuccess** | `{ navigate: string; openIn?: Enum<'self' \| 'newTab'> }` | optional | Post-success navigation, forwarded to the runner: `ActionSchema`'s own `{ navigate, openIn }` block. Taken beside an `api`, `script` or `flow` executor (for `flow`, only a run that completes: a run that pauses at a screen or ends refused performs no navigation), or a handler a host registers under another name; refused beside the built-ins `url`, `navigation`, `modal` and `form`, on a row that names no executor, and beside `operation: 'update'`, whose write the runner performs before any executor. `navigate` is an http:// or https:// URL, a mailto: address, an in-app path starting with / or ./, or a template that opens with ${, judged after interpolation — every other scheme and a protocol-relative //host are refused; `openIn` is `self` (default) or `newTab` | @@ -75,7 +75,7 @@ const result = ActionButtonPropsSchema.parse(data); | :--- | :--- | :--- | :--- | | **actions** | `{ name?: string; label?: string; icon?: string; type?: string; … }[]` | optional | The actions in this group, in order — each an action object the group draws and runs itself (`name`, `label`, `icon`, `type`, `target`, `visible`, `disabled`, `size`, …); a member's executor is its `type` | | **display** | `Enum<'inline' \| 'dropdown'>` | optional | Display mode: `inline` renders every action as a button row; `dropdown` renders one trigger button and lists the actions in its menu (renderer default: `inline`) | -| **location** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>` | optional | Render only the members whose `locations` include this location. Omit to render every member | +| **location** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section' \| 'selection'>` | optional | Render only the members whose `locations` include this location. Omit to render every member | | **label** | `string` | optional | Dropdown trigger text (renderer default: `Actions`). Inline mode renders no group label. A literal string — localize through the translation bundle entry for this component id | | **icon** | `string` | optional | Lucide icon name on the dropdown trigger. Inline mode renders no group icon | | **variant** | `Enum<'default' \| 'danger' \| 'outline' \| 'secondary' \| 'ghost' \| 'link'>` | optional | Button variant for the dropdown trigger and for every inline member that sets none — the Button primitive's vocabulary with its destructive arm spelled `danger`, the action runner's word (renderer default: `outline`) | @@ -107,7 +107,7 @@ const result = ActionButtonPropsSchema.parse(data); | **successMessage** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Toast shown when the action succeeds — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over `result`, the payload the action's handler answered (`{{ result.email }}`; for an `api` or `script` action the server response), and `record`, the record the action ran against. Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Invitation sent to `{{ result.email }}`'. A hole over any other root, a `${…}` or single-brace `{x}` token (each named with its `{{ }}` spelling), a hole holding logic or an unknown formatter, and a blank sentence are named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. | | **errorMessage** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Toast shown when the action fails, in place of the raw error — a `template` slot (ADR-0032) that binds no root: a bare string is shorthand for `{ dialect: 'template', source }`, and the text is shown as written, so a `{{ }}` hole, a `${…}` or a `{x}` token in it is literal text. Each of those, and a blank sentence, is named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. | | **refreshAfter** | `boolean` | optional | Refresh the surrounding data after the action runs | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Action locations, forwarded to the runner — an `action:group` with a `location` draws only the members that list it, and the console uses them to tell a record-scoped action from an object-level one | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| …>[]` | optional | Action locations, forwarded to the runner — an `action:group` with a `location` draws only the members that list it, and the console uses them to tell a record-scoped action from an object-level one | | **toast** | `any` | optional | Toast behaviour, forwarded to the runner | | **resultDialog** | `any` | optional | One-shot result dialog for a value the response shows exactly once, forwarded to the runner | | **onSuccess** | `{ navigate: string; openIn?: Enum<'self' \| 'newTab'> }` | optional | Post-success navigation, forwarded to the runner: `ActionSchema`'s own `{ navigate, openIn }` block. Taken beside an `api`, `script` or `flow` executor (for `flow`, only a run that completes: a run that pauses at a screen or ends refused performs no navigation), or a handler a host registers under another name; refused beside the built-ins `url`, `navigation`, `modal` and `form`, on a row that names no executor, and beside `operation: 'update'`, whose write the runner performs before any executor. `navigate` is an http:// or https:// URL, a mailto: address, an in-app path starting with / or ./, or a template that opens with ${, judged after interpolation — every other scheme and a protocol-relative //host are refused; `openIn` is `self` (default) or `newTab` | @@ -143,7 +143,7 @@ const result = ActionButtonPropsSchema.parse(data); | **successMessage** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Toast shown when the action succeeds — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over `result`, the payload the action's handler answered (`{{ result.email }}`; for an `api` or `script` action the server response), and `record`, the record the action ran against. Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Invitation sent to `{{ result.email }}`'. A hole over any other root, a `${…}` or single-brace `{x}` token (each named with its `{{ }}` spelling), a hole holding logic or an unknown formatter, and a blank sentence are named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. | | **errorMessage** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Toast shown when the action fails, in place of the raw error — a `template` slot (ADR-0032) that binds no root: a bare string is shorthand for `{ dialect: 'template', source }`, and the text is shown as written, so a `{{ }}` hole, a `${…}` or a `{x}` token in it is literal text. Each of those, and a blank sentence, is named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. | | **refreshAfter** | `boolean` | optional | Refresh the surrounding data after the action runs | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Action locations, forwarded to the runner — the console uses them to tell a record-scoped action from an object-level one | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section' \| 'selection'>[]` | optional | Action locations, forwarded to the runner — the console uses them to tell a record-scoped action from an object-level one | | **toast** | `any` | optional | Toast behaviour, forwarded to the runner | | **resultDialog** | `any` | optional | One-shot result dialog for a value the response shows exactly once, forwarded to the runner | | **onSuccess** | `{ navigate: string; openIn?: Enum<'self' \| 'newTab'> }` | optional | Post-success navigation, forwarded to the runner: `ActionSchema`'s own `{ navigate, openIn }` block. Taken beside an `api`, `script` or `flow` executor (for `flow`, only a run that completes: a run that pauses at a screen or ends refused performs no navigation), or a handler a host registers under another name; refused beside the built-ins `url`, `navigation`, `modal` and `form`, on a row that names no executor, and beside `operation: 'update'`, whose write the runner performs before any executor. `navigate` is an http:// or https:// URL, a mailto: address, an in-app path starting with / or ./, or a template that opens with ${, judged after interpolation — every other scheme and a protocol-relative //host are refused; `openIn` is `self` (default) or `newTab` | @@ -197,7 +197,7 @@ const result = ActionButtonPropsSchema.parse(data); | **successMessage** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Toast shown when the action succeeds — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over `result`, the payload the action's handler answered (`{{ result.email }}`; for an `api` or `script` action the server response), and `record`, the record the action ran against. Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Invitation sent to `{{ result.email }}`'. A hole over any other root, a `${…}` or single-brace `{x}` token (each named with its `{{ }}` spelling), a hole holding logic or an unknown formatter, and a blank sentence are named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. | | **errorMessage** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Toast shown when the action fails, in place of the raw error — a `template` slot (ADR-0032) that binds no root: a bare string is shorthand for `{ dialect: 'template', source }`, and the text is shown as written, so a `{{ }}` hole, a `${…}` or a `{x}` token in it is literal text. Each of those, and a blank sentence, is named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. | | **refreshAfter** | `boolean` | optional | Refresh the surrounding data after the action runs | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Action locations, forwarded to the runner — an `action:group` with a `location` draws only the members that list it, and the console uses them to tell a record-scoped action from an object-level one | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| …>[]` | optional | Action locations, forwarded to the runner — an `action:group` with a `location` draws only the members that list it, and the console uses them to tell a record-scoped action from an object-level one | | **toast** | `any` | optional | Toast behaviour, forwarded to the runner | | **resultDialog** | `any` | optional | One-shot result dialog for a value the response shows exactly once, forwarded to the runner | | **onSuccess** | `{ navigate: string; openIn?: Enum<'self' \| 'newTab'> }` | optional | Post-success navigation, forwarded to the runner: `ActionSchema`'s own `{ navigate, openIn }` block. Taken beside an `api`, `script` or `flow` executor (for `flow`, only a run that completes: a run that pauses at a screen or ends refused performs no navigation), or a handler a host registers under another name; refused beside the built-ins `url`, `navigation`, `modal` and `form`, on a row that names no executor, and beside `operation: 'update'`, whose write the runner performs before any executor. `navigate` is an http:// or https:// URL, a mailto: address, an in-app path starting with / or ./, or a template that opens with ${, judged after interpolation — every other scheme and a protocol-relative //host are refused; `openIn` is `self` (default) or `newTab` | @@ -842,7 +842,7 @@ Sort field and direction pair | **selection** | `{ type?: Enum<'none' \| 'single' \| 'multiple'> }` | optional | Selection config `{ type }` — `none`, `single` or `multiple`, the same block a list view's `selection` declares | | **selectable** | `boolean \| Enum<'single' \| 'multiple'>` | optional | Legacy selection shorthand, read only when `selection` is absent — `true` (multiple), `false` (off), `'single'` or `'multiple'`. Prefer `selection` | | **rowActions** | `string[]` | optional | Per-row action names — `edit` / `delete` select the generic entries, any other name resolves against the object's actions; the same list a list view's `rowActions` declares | -| **bulkActions** | `string[]` | optional | Bulk action names shown on selection — the same list a list view's `bulkActions` declares; a full def goes on `bulkActionDefs` | +| **bulkActions** | `string[]` | optional | Bulk action names shown on selection; a full def goes on `bulkActionDefs` | | **batchActions** | `string[]` | optional | Alternate spelling of `bulkActions` that the renderer reads FIRST (`batchActions ?? bulkActions`) — the same action-name list. Prefer `bulkActions` | | **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Inline bulk-action definitions (full defs, not names) — the same `BulkActionDef` entries a list view's `bulkActionDefs` declares | | **navigation** | `{ mode?: Enum<'drawer' \| 'page' \| 'new_window' \| 'none'>; preventNavigation?: boolean; openNewTab?: boolean; size?: Enum<'auto' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'>; … }` | optional | Row-click navigation config — the same block `ListViewSchema.navigation` declares (`{ mode, size, openNewTab, preventNavigation }`) | @@ -952,17 +952,17 @@ Sort field and direction pair | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | | **name** | `string` | ✅ | Stable identifier — the audit-log action key, and (for an aggregate def) the name of the object action to dispatch. | -| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and name it in `bulkActions` to get localization). | +| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and place it at `selection` to get localization). | | **icon** | `string` | optional | Lucide icon name (e.g. "user-check", "trash"). | | **variant** | `Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>` | optional | Visual treatment of the button. | | **operation** | `Enum<'update' \| 'delete' \| 'custom'>` | ✅ | What the executor does: 'update'/'delete' are data-plane mass mutations; 'custom' dispatches an object action (see `execution`). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is declared as `bulkActions: ['']` instead. | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is the action placed at `selection` instead. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values applied to every selected record, merged UNDER the user-supplied params so a fixed value can be declared without exposing it in the dialog. | | **params** | `{ name: string; label?: string; help?: string; type: Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>; … }[]` | optional | Inputs collected once before the run. Omit to skip the params step and go straight to confirm. | | **confirmText** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Confirmation text shown above the affected-record summary — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over two kinds of root, written bare: `count`, the number of records the run covers, and each of the def's params by `name` (`{{ tier }}`, never `{{ params.tier }}`; `count` wins over a param of that name). A param hole renders that param's DISPLAY value: the chosen option's `label` for an option-bearing param (a multi-value param's labels joined with ', '), the picked record's display name for a `lookup` / user param, and the entered value otherwise, so a number, date or currency value takes a formatter (`{{ amount \| currency:EUR }}`, `{{ due \| date:long }}`). Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Update tier on `{{ count }}` account(s) to `{{ tier }}`?'. A hole over any other root, and a single-brace `{x}` token, are refused by name at `objectstack validate`, `compile` and the publish gate, as are a hole holding logic or an unknown formatter and a blank sentence. | | **confirmLabel** | `string` | optional | Custom Confirm button label (default: "Run"). | | **visible** | `string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source: string; ast?: any; meta?: object }` | optional | Eligibility predicate (CEL) — a string or a `{dialect, source}` envelope, i.e. `action.visible` without its boolean-literal arm: a per-record predicate has nothing to say as a constant. Evaluated once PER SELECTED RECORD with that record bound: the button is offered when at least one passes, the run covers only those, and the rest are reported as skipped. A record-free predicate (`features.x`, `current_user.y`) therefore behaves as a plain button-level gate. Fail-closed — a predicate that faults excludes the record. | -| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from `bulkActions: ['']` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | +| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from an action placed at `selection` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | | **maxRecords** | `integer` | optional | Selection size above which the run is blocked. Set it on defs whose server work is expensive — an aggregate def carries every selected id in one request. | | **batchSize** | `integer` | optional | Records per executor batch (default 200). Data-plane operations only — an aggregate run is a single call by definition. | @@ -1996,7 +1996,7 @@ Sort field and direction pair | :--- | :--- | :--- | :--- | | **actionNames** | `string[]` | optional | Names of actions declared on this object (`actions[]`), in display order. The engine still location-filters named actions. Measured: when omitted (and the host supplies nothing) the bar resolves NO actions and renders its empty placeholder — it does not fall back to "every action at this location", whatever the registration's input list claims. | | **requiredPermissions** | `string[]` | optional | [ADR-0066] Capabilities the user must ALL hold — names that permission sets grant through `systemPermissions`, not object actions: `read` or `update` here is an ordinary capability name, not the object's read or edit permission. When the client has resolved the user's capabilities and any of these is missing, this block does not render its content; wherever it would otherwise render, an insufficient-permissions notice takes its place. Presentation only: it authorises nothing, and the data API still serves the same data to the same user. A client that cannot resolve the user's capabilities (no permission provider, or one that does not report `systemPermissions`) renders this block as if they were held — it fails open. | -| **location** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>` | optional | Which declared action location this bar renders (renderer default: `record_page`). At `record_page` it draws the record page's actions that are not folded into its ⋯ menu (`component: 'action:menu'`); an action placed at `record` is drawn at `record_page` and at `record_row`. | +| **location** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section' \| 'selection'>` | optional | Which declared action location this bar renders (renderer default: `record_page`). At `record_page` it draws the record page's actions that are not folded into its ⋯ menu (`component: 'action:menu'`); an action placed at `record` is drawn at `record_page` and at `record_row`. | | **align** | `Enum<'start' \| 'center' \| 'end'>` | optional | Horizontal alignment of the button row (renderer default: `end`). | | **inline** | `boolean` | optional | Render in the flow instead of pulling up into the record-header band. The page header sets this itself when it hosts the bar in its own action slot. | | **variant** | `Enum<'default' \| 'destructive' \| 'outline' \| 'secondary' \| 'ghost' \| 'link'>` | optional | Button variant for every action — the Button primitive's own vocabulary; a per-action `variant` on the resolved def wins (renderer default: `default`). | diff --git a/content/docs/references/ui/view.mdx b/content/docs/references/ui/view.mdx index fc91e505279..b73d745209d 100644 --- a/content/docs/references/ui/view.mdx +++ b/content/docs/references/ui/view.mdx @@ -1077,8 +1077,8 @@ Map view configuration | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -1328,17 +1328,17 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | | **name** | `string` | ✅ | Stable identifier — the audit-log action key, and (for an aggregate def) the name of the object action to dispatch. | -| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and name it in `bulkActions` to get localization). | +| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and place it at `selection` to get localization). | | **icon** | `string` | optional | Lucide icon name (e.g. "user-check", "trash"). | | **variant** | `Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>` | optional | Visual treatment of the button. | | **operation** | `Enum<'update' \| 'delete' \| 'custom'>` | ✅ | What the executor does: 'update'/'delete' are data-plane mass mutations; 'custom' dispatches an object action (see `execution`). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is declared as `bulkActions: ['']` instead. | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is the action placed at `selection` instead. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values applied to every selected record, merged UNDER the user-supplied params so a fixed value can be declared without exposing it in the dialog. | | **params** | `{ name: string; label?: string; help?: string; type: Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>; … }[]` | optional | Inputs collected once before the run. Omit to skip the params step and go straight to confirm. | | **confirmText** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Confirmation text shown above the affected-record summary — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over two kinds of root, written bare: `count`, the number of records the run covers, and each of the def's params by `name` (`{{ tier }}`, never `{{ params.tier }}`; `count` wins over a param of that name). A param hole renders that param's DISPLAY value: the chosen option's `label` for an option-bearing param (a multi-value param's labels joined with ', '), the picked record's display name for a `lookup` / user param, and the entered value otherwise, so a number, date or currency value takes a formatter (`{{ amount \| currency:EUR }}`, `{{ due \| date:long }}`). Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Update tier on `{{ count }}` account(s) to `{{ tier }}`?'. A hole over any other root, and a single-brace `{x}` token, are refused by name at `objectstack validate`, `compile` and the publish gate, as are a hole holding logic or an unknown formatter and a blank sentence. | | **confirmLabel** | `string` | optional | Custom Confirm button label (default: "Run"). | | **visible** | `string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source: string; ast?: any; meta?: object }` | optional | Eligibility predicate (CEL) — a string or a `{dialect, source}` envelope, i.e. `action.visible` without its boolean-literal arm: a per-record predicate has nothing to say as a constant. Evaluated once PER SELECTED RECORD with that record bound: the button is offered when at least one passes, the run covers only those, and the rest are reported as skipped. A record-free predicate (`features.x`, `current_user.y`) therefore behaves as a plain button-level gate. Fail-closed — a predicate that faults excludes the record. | -| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from `bulkActions: ['']` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | +| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from an action placed at `selection` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | | **maxRecords** | `integer` | optional | Selection size above which the run is blocked. Set it on defs whose server work is expensive — an aggregate def carries every selected id in one request. | | **batchSize** | `integer` | optional | Records per executor batch (default 200). Data-plane operations only — an aggregate run is a single call by definition. | @@ -1555,8 +1555,8 @@ One column of a metadata type list | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -1797,17 +1797,17 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | | **name** | `string` | ✅ | Stable identifier — the audit-log action key, and (for an aggregate def) the name of the object action to dispatch. | -| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and name it in `bulkActions` to get localization). | +| **label** | `string` | optional | Button + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and place it at `selection` to get localization). | | **icon** | `string` | optional | Lucide icon name (e.g. "user-check", "trash"). | | **variant** | `Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>` | optional | Visual treatment of the button. | | **operation** | `Enum<'update' \| 'delete' \| 'custom'>` | ✅ | What the executor does: 'update'/'delete' are data-plane mass mutations; 'custom' dispatches an object action (see `execution`). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is declared as `bulkActions: ['']` instead. | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | For `operation: 'custom'` — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in `params._selectedIds`. Required on a custom def: the per-record form is the action placed at `selection` instead. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values applied to every selected record, merged UNDER the user-supplied params so a fixed value can be declared without exposing it in the dialog. | | **params** | `{ name: string; label?: string; help?: string; type: Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>; … }[]` | optional | Inputs collected once before the run. Omit to skip the params step and go straight to confirm. | | **confirmText** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string` | optional | Confirmation text shown above the affected-record summary — a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over two kinds of root, written bare: `count`, the number of records the run covers, and each of the def's params by `name` (`{{ tier }}`, never `{{ params.tier }}`; `count` wins over a param of that name). A param hole renders that param's DISPLAY value: the chosen option's `label` for an option-bearing param (a multi-value param's labels joined with ', '), the picked record's display name for a `lookup` / user param, and the entered value otherwise, so a number, date or currency value takes a formatter (`{{ amount \| currency:EUR }}`, `{{ due \| date:long }}`). Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Update tier on `{{ count }}` account(s) to `{{ tier }}`?'. A hole over any other root, and a single-brace `{x}` token, are refused by name at `objectstack validate`, `compile` and the publish gate, as are a hole holding logic or an unknown formatter and a blank sentence. | | **confirmLabel** | `string` | optional | Custom Confirm button label (default: "Run"). | | **visible** | `string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source: string; ast?: any; meta?: object }` | optional | Eligibility predicate (CEL) — a string or a `{dialect, source}` envelope, i.e. `action.visible` without its boolean-literal arm: a per-record predicate has nothing to say as a constant. Evaluated once PER SELECTED RECORD with that record bound: the button is offered when at least one passes, the run covers only those, and the rest are reported as skipped. A record-free predicate (`features.x`, `current_user.y`) therefore behaves as a plain button-level gate. Fail-closed — a predicate that faults excludes the record. | -| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from `bulkActions: ['']` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | +| **requiredPermissions** | `string[]` | optional | [ADR-0066 D4] Capability gate on the button, `action.requiredPermissions` semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the `update`/`delete` data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from an action placed at `selection` (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks. | | **maxRecords** | `integer` | optional | Selection size above which the run is blocked. Set it on defs whose server work is expensive — an aggregate def carries every selected id in one request. | | **batchSize** | `integer` | optional | Records per executor batch (default 200). Data-plane operations only — an aggregate run is a single call by definition. | @@ -2163,8 +2163,8 @@ Tab configuration for multi-tab view interface | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -2243,8 +2243,8 @@ Tab configuration for multi-tab view interface | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -2541,8 +2541,8 @@ This schema accepts one of the following structures: | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -2730,8 +2730,8 @@ This schema accepts one of the following structures: | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | diff --git a/content/docs/ui/actions.mdx b/content/docs/ui/actions.mdx index 6a26b45af1e..d77ba799d8d 100644 --- a/content/docs/ui/actions.mdx +++ b/content/docs/ui/actions.mdx @@ -25,8 +25,8 @@ The types you'll actually use: Prefer `confirmText`/`params` over the two action properties that are **not wired**: `shortcut` (nothing dispatches keydown events to actions) and -`bulkEnabled` (the multi-select toolbar reads the list view's `bulkActions`, -not this flag). The +`bulkEnabled` (the multi-select toolbar draws the actions placed at +`selection`, not this flag). The [liveness ledger](https://github.com/objectstack-ai/objectstack/blob/main/packages/spec/liveness/action.json) carries the per-property status of everything the action schema accepts. @@ -375,6 +375,7 @@ appears on every surface that word covers: | `record_row` | One record, in a list | Per-row menu in list views | | `record_related` | One record, in its parent | Each row of a related list inside a parent record — there only, never on the object's own list views (unlike `record_row`). Declared, not yet placed: the console does not draw it on those rows yet | | `record_section` | One record | Named action bars on record pages | +| `selection` | Many records | The selection bar a grid shows once two or more rows are selected, on every grid view of the object; run once per selected record | `record_related` takes the "One record" cell too. To keep a record page action out of the header's buttons and put it straight into the header's 「More」 (`⋯`) menu, set @@ -404,6 +405,8 @@ ObjectSchema.create({ list: { pinned: ['mass_assign', '$export'], more: ['send_digest'] }, // the record scope: actions placed at record or record_page record: { pinned: ['mark_won', 'mark_lost'], more: ['clone', 'share'] }, + // the selection scope: actions placed at selection, on the selection bar + selection: { pinned: ['mass_assign'], more: ['send_digest'] }, }, }); ``` @@ -426,6 +429,12 @@ ObjectSchema.create({ own Import / Export menu, as without the key (also with `pinned: []`), so `more` names actions only. The record scope has no built-ins: New, Edit and Delete keep their places. +- The `selection` arm orders the selection bar every grid of the object shows once two + or more rows are selected. A view's own `bulkActionDefs` come first; then the arm's + actions, `pinned` as buttons; then the rest, the built-in Delete included, in the + bar's 「More」. `pinned: []` pins none, so every action, Delete included, goes to + 「More」. Without the arm the bar draws its actions by `order` and draws the first + three as buttons, as before. - Leave an arm out (or `actionLayout` out) and that scope draws as before. - The schema refuses more than three pinned, a name given twice, a malformed name, a built-in the scope does not have and a built-in in `more`. `os validate`, `os build` and `os lint` also @@ -443,15 +452,14 @@ ObjectSchema.create({ Surfaces can also reference actions **by name**: ```typescript -// List views — row and bulk menus. These are LIST-VIEW keys, so they nest -// under `list` (or a `listViews` entry) — never at the container top level: -// `ViewSchema` is a strict object and rejects them there. +// List views — the row menu. A LIST-VIEW key, so it nests under `list` (or a +// `listViews` entry) — never at the container top level: `ViewSchema` is a +// strict object and rejects it there. defineView({ // ... list: { // ... rowActions: ['complete_task'], - bulkActions: ['showcase_bulk_reassign'], }, }); @@ -472,23 +480,23 @@ Naming an action in a **widget** does not bypass location filtering — the engine still requires the action to declare the matching location (that's why `MarkDoneAction` above includes `record_section`). -The **selection bar is the exception**, and the only one: an action named in a -list view's `bulkActions` or `bulkActionDefs` is placed by that declaration, -not by `locations`. That is what the retired `action.bulkEnabled` tombstone -prescribes ("the multi-select toolbar is driven by the LIST VIEW's -`bulkActions` / `bulkActionDefs`"), and it is what lets an aggregate bulk -action — one that acts on a whole selection and has no single-record home by -construction — exist at all. +A list view's **aggregate def is the exception**, and the only one: an action +named in a `bulkActionDefs` entry with `execution: 'aggregate'` is placed on +that view's selection bar by the def, not by `locations`. That is what lets an +aggregate bulk action — one that acts on a whole selection and has no +single-record home by construction — exist at all. A per-record bulk action is +placed at `selection` like any other location (protocol 19 retired the view's +`bulkActions` list; `os migrate meta --from 18` moves it). ## Declare the bulk dispatch contract -A list view can wire the same action two ways, and the two hand your body +A selection can run the same action two ways, and the two hand your body **opposite** input: | wiring | dispatches | the body receives | | --- | --- | --- | -| `bulkActions: ['']` | once **per selected row** | that row's `recordId`, no `_selectedIds` | +| `locations: [..., 'selection']` on the action | once **per selected row** | that row's `recordId`, no `_selectedIds` | | `bulkActionDefs: [{ name: '', operation: 'custom', execution: 'aggregate' }]` | **once** for the whole selection | `params._selectedIds: string[]`, no `recordId` | Say which one you wrote the body for, with the same key and the same two values @@ -503,10 +511,12 @@ defineAction({ }); ``` -`os validate` / `os lint` / `os build` then refuse a list view that wires it the -other way (`action-dispatch-contract-mismatch`), naming the action, the view and -both contracts. Without the declaration both mismatches fail **silently, in -opposite directions**: an aggregate body wired bare-string reads `_selectedIds` +`os validate` / `os lint` / `os build` then refuse the other wiring +(`action-dispatch-contract-mismatch`): an action placed at `selection` that +declares `'aggregate'`, or a view's aggregate def naming one that declares +`'perRecord'`, naming the action, where it is wired and both contracts. Without +the declaration both mismatches fail **silently, in opposite directions**: an +aggregate body run per row reads `_selectedIds` as `undefined`, takes its single-record branch and reports success for one row out of ten; a per-record body wired aggregate finds no `recordId` and throws its own "nothing selected", which reads like a selection bug. Nothing else can catch @@ -1015,7 +1025,7 @@ envelope, with `resume_run`'s `{ ok, action, objectName, recordId, result }` as | Symptom | Cause → fix | |:---|:---| -| Button doesn't appear | `locations` doesn't include the surface (empty `locations` is right for a selection-only action that a list view's `bulkActions` places); or the `visible` CEL throws (e.g. a bare, unprefixed field name) and fail-closed hides it; or the user fails `requiredPermissions`, which hides the button at every location with no greyed-out control and no message | +| Button doesn't appear | `locations` doesn't include the surface (a selection-only action declares `locations: ['selection']`); or the `visible` CEL throws (e.g. a bare, unprefixed field name) and fail-closed hides it; or the user fails `requiredPermissions`, which hides the button at every location with no greyed-out control and no message | | Click → `Action 'x' … not found` | `target`-style script with no registered handler — add the `registerAction` call in `onEnable` (Path B above) | | REST → 400 naming the action's `type` | The type has no server dispatch (`url`/`modal`/`form`/`api`) — open its `target` in the client, or call that endpoint directly | | Appears in UI, missing from `list_actions` (MCP) | `ai.exposed` not `true`, `ai.description` under 40 characters, or the type isn't headless-callable | @@ -1024,6 +1034,6 @@ envelope, with `resume_run`'s `{ ok, action, objectName, recordId, result }` as ## Related - [Actions as Tools](/docs/ai/actions-as-tools) — the AI exposure model in depth -- [Views](/docs/ui/views) — `rowActions` / `bulkActions` binding +- [Views](/docs/ui/views) — `rowActions` / `bulkActionDefs` binding - [Action protocol](/docs/protocol/objectui/actions) — the full spec narrative - [Action schema reference](/docs/references/ui/action) — every property, generated from the spec diff --git a/content/docs/ui/views.mdx b/content/docs/ui/views.mdx index df36d1b6655..6cebd5d67e5 100644 --- a/content/docs/ui/views.mdx +++ b/content/docs/ui/views.mdx @@ -111,7 +111,6 @@ A List View controls how a collection of records is presented. It supports multi | `selection` | `object` | optional | Row selection mode | | `navigation` | `object` | optional | Row click navigation | | `rowActions` | `array` | optional | Per-row action buttons, by action name — see [Actions](/docs/ui/actions) | -| `bulkActions` | `array` | optional | Bulk selection actions, by action name — see [Actions](/docs/ui/actions) | | `bulkActionDefs` | `array` | optional | Rich bulk action definitions — mass edits, and the aggregate single-call mode (below) | | `inlineEdit` | `boolean` | optional | Enable inline editing | | `exportOptions` | `object` | optional | Export menu configuration: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. `formats` accepts `csv`, `xlsx`, `json` (default `['csv', 'json']`). `'pdf'` is not an export format: to let users print a list as shown, set the view's `allowPrinting`; a printable document (an invoice, a delivery order) is a page that declares `print` — see the [page reference](/docs/references/ui/page). A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse | @@ -239,14 +238,18 @@ columns: [ ### Bulk Actions Over a Selection -Two keys drive the multi-select toolbar. `bulkActions` names actions the object -already declares, and each selected record is dispatched **once** — the action -runs N times for N rows. `bulkActionDefs` carries richer entries: a mass edit -through the data API (`operation: 'update'` + a patch), or the **aggregate** -mode, where the action is called **once for the whole selection**. +Two things drive the multi-select toolbar. An action placed at `selection` +(`locations: [..., 'selection']`) is drawn on the selection bar of **every** grid +view of its object, in the order the object's `actionLayout.selection` gives, +and each selected record is dispatched **once** — the action runs N times for N +rows. A view's own `bulkActionDefs` carry richer entries, first on that view's +bar: a mass edit through the data API (`operation: 'update'` + a patch), or the +**aggregate** mode, where the action is called **once for the whole selection**. +Protocol 19 retired the view's `bulkActions` list; `os migrate meta --from 18` +moves it onto the actions. ```typescript -bulkActions: ['mark_done'], // one dispatch per selected record +// on the action: locations: ['record', 'selection'] — one dispatch per selected record bulkActionDefs: [ // Mass edit — one bulk write, no action involved. { name: 'archive', operation: 'update', patch: { archived: true } }, @@ -290,9 +293,9 @@ A per-record run reports each record on its own: the result dialog lists every failed record with its refusal's `userMessage` when the handler threw one, else the error's message, and the error CSV keeps each failure's whole message. -**Pick the right key for the dispatch you mean.** Per-record is -`bulkActions: ['']` — the bare-string form, which has nowhere to carry a -flag and is promoted with the action's own label, params and `visible`. +**Pick the right form for the dispatch you mean.** Per-record is the action +placed at `selection`, which is promoted with the action's own label, params +and `visible`. Aggregate is the def form, which is where `execution` lives. A def that says `operation: 'custom'` without `execution: 'aggregate'` is rejected at parse time: the renderer has no action attached to such a def, so it used to render a @@ -303,14 +306,14 @@ action declares the contract its body was written for with the same key and the same two values the def uses — `execution: 'perRecord' | 'aggregate'` (see [Actions](/docs/ui/actions#declare-the-bulk-dispatch-contract)). Wiring a declared action the other way is refused by `os validate` / `os lint` / -`os build` with `action-dispatch-contract-mismatch`, naming the action, the -view and both contracts: +`os build` with `action-dispatch-contract-mismatch`, naming the action, where +it is wired and both contracts: ```typescript -// actions: { name: 'export_zip', type: 'api', execution: 'aggregate', … } - -bulkActions: ['export_zip'], // ⛔ refused — the bare string is the per-record - // contract; this body reads `_selectedIds` +// actions: { name: 'export_zip', type: 'api', execution: 'aggregate', +// locations: ['selection'] } // ⛔ refused — `selection` is the +// // per-record contract; this body +// // reads `_selectedIds` bulkActionDefs: [ { name: 'export_zip', operation: 'custom', execution: 'aggregate' }, // ✅ ] @@ -324,7 +327,7 @@ written to serve both. `requiredPermissions: string[]` with `action.requiredPermissions` semantics — absent/empty always passes, several entries AND, unknown caller capabilities fail open (the server stays the authority). A def promoted from -`bulkActions: ['']` (or an aggregate def naming a declared action) +an action placed at `selection` (or an aggregate def naming a declared action) inherits the action's own declaration instead, so this key matters chiefly for the `update`/`delete` data-plane forms, which dispatch no action and have nothing to inherit from. On those defs the gate governs **visibility only** — diff --git a/packages/spec/docs/references/api/metadata.md b/packages/spec/docs/references/api/metadata.md index 56b8224d1d0..0fd1064a53d 100644 --- a/packages/spec/docs/references/api/metadata.md +++ b/packages/spec/docs/references/api/metadata.md @@ -936,7 +936,7 @@ Metadata query with filtering, sorting, and pagination | **description** | `string` | optional | Developer documentation / description | | **icon** | `string` | optional | Icon name (Lucide/Material) for UI representation | | **color** | `Enum<'gray' \| 'blue' \| 'teal' \| 'green' \| 'amber' \| 'orange' \| 'red' \| 'pink' \| 'purple'>` | optional | Object colour, one name from the fixed palette (gray, blue, teal, green, amber, orange, red, pink, purple). The console draws the object's icon as a white glyph on a rounded square of this colour, so one object looks the same wherever its icon appears. No free colour values. Omit to draw the neutral `gray`. | -| **actionLayout** | `{ list?: object; record?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | +| **actionLayout** | `{ list?: object; record?: object; selection?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`, `selection`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | | **isSystem** | `boolean` | optional (default: `false`) | Is system object (protected from deletion; defaults its org-wide sharing to public when no sharingModel is set — plugin-sharing) | | **managedBy** | `Enum<'platform' \| 'config' \| 'system-data' \| 'engine-owned' \| 'append-only' \| …>` | optional | Lifecycle bucket — platform (user CRUD) \| config (admin authored) \| system-data (platform-defined schema, admin/user-writable data) \| engine-owned (engine owns the lifecycle, no user writes) \| append-only (audit) \| synced (rows copied by a pull from a connector or federated source; read-only to members, and userActions cannot open a write) \| better-auth (identity). UI clients honour the resolved affordance matrix. | | **ownership** | `Enum<'user' \| 'business_unit' \| 'org' \| 'none'>` | optional | Record-ownership model: user (default — injects reassignable owner_id plus owning_business_unit_id) \| business_unit (unit-owned: owning_business_unit_id only, no owner_id) \| org \| none (no per-record owner, neither anchor). Distinct from the package own/extend contribution kind. | diff --git a/packages/spec/docs/references/api/protocol.part-2.md b/packages/spec/docs/references/api/protocol.part-2.md index ce52911e8b6..9d3faa065fe 100644 --- a/packages/spec/docs/references/api/protocol.part-2.md +++ b/packages/spec/docs/references/api/protocol.part-2.md @@ -468,8 +468,8 @@ The published metadata item body, opaque by ruling (1C). Shape is the item's own | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | @@ -548,8 +548,8 @@ The published metadata item body, opaque by ruling (1C). Shape is the item's own | **hiddenFields** | `string[]` | optional | Fields to hide in this specific view — the SUBTRACTION of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: each name listed here is removed from the `columns` projection before `fieldOrder` orders the remainder. A name `columns` never projected subtracts nothing. | | **fieldOrder** | `string[]` | optional | Explicit field display order for this view — the ORDERING of the per-view field composition `columns` x `hiddenFields` x `fieldOrder`: it sorts what survives `columns` minus `hiddenFields` and never adds a field. A surviving column absent from `fieldOrder` sorts LAST, after every listed one, keeping its `columns`-relative order; a name listed here that did not survive orders nothing. | | **rowActions** | `string[]` | optional | Actions available for individual row items | -| **bulkActions** | `string[]` | optional | Actions available when multiple rows are selected | -| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch use `bulkActions: ['']` instead — the bare-string form, promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | +| **bulkActions** | `never` | optional | [REMOVED] `view.list.bulkActions` was removed in @objectstack/spec 19.0.0 (ADR-0085) — the actions a selection of records offers are the object's, not one view's: the selection bar a grid shows once two or more rows are selected draws the same actions on every view of the object. Delete the key, and add `'selection'` to the `locations` of each action it named; to order the bar, or to choose its buttons, write the object's `actionLayout.selection` (`{ pinned, more }`). A view's own `bulkActionDefs` stay on the view. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | +| **bulkActionDefs** | `{ name: string; label?: string; icon?: string; variant?: Enum<'primary' \| 'secondary' \| 'danger' \| 'ghost' \| 'outline'>; … }[]` | optional | Rich bulk action definitions (schema-driven, executed via BulkActionDialog). Use a def for a mass data-plane mutation ('update' with a `patch` / 'delete') that no action expresses, or for an `operation: 'custom'` + `execution: 'aggregate'` entry that dispatches the action it NAMES once for the whole selection — the renderer injects `params._selectedIds: string[]` (read that on the server, not `recordId`) so a single call can produce one aggregate artifact (zip of QR codes, merged PDF, batch print). A rejection is one outcome for the whole selection; a run that moved some rows and refused others resolves with a `BulkActionResult` (`{ succeeded, failed }`), a non-empty `failed` being a legal success answer. Per-row retry is replaced by re-running the action. `batchSize` does not apply (the call is never chunked); set `maxRecords` on defs whose server work is expensive. For the PER-RECORD dispatch place the action at `selection` instead — it is promoted with the action's own label, params and `visible`; a 'custom' def without `execution: 'aggregate'` has no dispatcher and is refused at parse time. Toolbar url/api actions can also interpolate the current selection via `${ctx.selection.ids}` / `${ctx.selection.count}`. | | **conditionalFormatting** | `{ condition: string \| object; style: Record }[]` | optional | Conditional formatting rules for list rows | | **inlineEdit** | `boolean` | optional | Allow inline editing of records directly in the list view | | **exportOptions** | `Enum<'csv' \| 'xlsx' \| 'json'>[] \| { formats?: Enum<'csv' \| 'xlsx' \| 'json'>[]; maxRecords?: integer; includeHeaders?: boolean; fileNamePrefix?: string; … }` | optional | Export configuration for the list toolbar export menu: `{ formats?, maxRecords?, includeHeaders?, fileNamePrefix?, streaming? }`. A bare format array is the legacy spelling and lifts to `{ formats: [...] }` at parse. | diff --git a/packages/spec/docs/references/kernel/metadata-plugin.md b/packages/spec/docs/references/kernel/metadata-plugin.md index ae233552815..dfedb31c35d 100644 --- a/packages/spec/docs/references/kernel/metadata-plugin.md +++ b/packages/spec/docs/references/kernel/metadata-plugin.md @@ -325,7 +325,7 @@ const result = MetadataBulkResultSchema.parse(data); | **description** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object } \| string \| Record` | optional | Explanatory line shown under the title in the action's param dialog. Carries the confirm question for an action that collects params (one dialog, not two). Not the LLM-facing `ai.description`. It is a `template` slot (ADR-0032): a bare string is shorthand for `{ dialect: 'template', source }`, and text with no hole is shown as written. Holes are `{{ path }}` or `{{ path \| formatter[:arg] }}` over `record`, the record the action runs against (the clicked row on a list, else the page's record); the values the dialog collects are not bound, since the line shows before they exist. Formatters come from the template engine's whitelist (`TEMPLATE_FORMATTERS`, `@objectstack/formula`); a hole holds no logic (no CEL, no arithmetic). Example: 'Choose the new role for `{{ record.name }}`.'. A hole over any other root, a `${…}` or single-brace `{x}` token (each named with its `{{ }}` spelling), a hole holding logic or an unknown formatter, and a blank sentence are named and refused at `objectstack validate`, `compile` and the publish gate; the text still parses, so a stored one loads until its next save. An inline locale map (`{ en, "zh-CN" }`) is accepted too, each value such a sentence. | | **objectName** | `string` | optional | Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack(). | | **icon** | `string` | optional | Icon name | -| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| 'record_section'>[]` | optional | Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: 'action:menu'` to sit in the record page's ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. | +| **locations** | `Enum<'list' \| 'record' \| 'record_page' \| 'record_row' \| 'record_related' \| …>[]` | optional | Locations where this action is visible. `record_section` is drawn only by an authored record page block that renders it; the standard record page (on a phone, in the side preview, and for an object with no authored page) does not draw it, so an action that must reach every surface adds `record_page` as well, with `component: 'action:menu'` to sit in the record page's ⋯ menu rather than be a header button. `list` acts on no record (the list page toolbar); `record` acts on one record, on the record page and on each list row; `record_page` and `record_row` are one of those two only. `selection` acts on many records: the selection bar a grid shows once two or more rows are selected, on every grid view of the object, run once per selected record (the object's `actionLayout.selection` orders that bar). | | **component** | `Enum<'action:button' \| 'action:icon' \| 'action:menu' \| 'action:group'>` | optional | Visual component override | | **type** | `Enum<'script' \| 'url' \| 'modal' \| 'flow' \| 'api' \| 'form'>` | optional (default: `"script"`) | Action functionality type — the dispatch route. The declarative single-record field write is not a type: it is `operation: 'update'` + `patch` on the default `script` route. | | **target** | `string` | optional | URL, Script Name, Flow ID, or API Endpoint. Supports $`{param.X}` and $`{ctx.X}` interpolation. For type:'url': an http:// or https:// URL, a mailto: address, or an in-app path starting with / or ./ (a console route; a record is /apps/APP/OBJECT/record/ID, APP being the app's route segment — see onSuccess.navigate) — every other scheme and a protocol-relative //host are refused. | @@ -335,7 +335,7 @@ const result = MetadataBulkResultSchema.parse(data); | **texts** | `Record` | optional | Texts the action's js body writes into records, keyed by the snake_case key it asks for with ctx.text(KEY, params): `{ message, params? }`. ctx.text answers the sentence in the organization's language (the Localization setting when somebody set it, else the app's i18n.defaultLocale), translated through objects.``._actions.``.texts.``.message (globalActions.``.texts.``.message for an object-less action) with the declared message as the fallback, its holes filled from params. A key not declared here is refused — at save when the body asks for it literally, otherwise at run time. Only a type: 'script' action with a js body declares one | | **operation** | `Enum<'update'>` | optional | The declarative single-record field write, mirroring a list view's `bulkActionDefs`: `'update'` applies `patch` (merged under the collected `params`) to the current record on the data plane AS THE CALLER — never system-elevated — so the caller's permissions, the object's hooks and its validations fire as for a user edit. `type` stays at its default `'script'` (the platform action route the write is performed on); `target`/`body`/`method`/`bodyExtra` are refused beside it. `'delete'` and `'custom'` have no row-level form. | | **patch** | `Record` | optional | For `operation: 'update'` — static field values written to the current record, merged UNDER the user-supplied `params` so a fixed value can be declared without exposing it in the dialog. Written on the data plane as the caller: object permissions, hooks and validations fire as for a user edit. Refused on an action without `operation: 'update'` (it would be silently dropped). | -| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the view's `bulkActions: ['']` bare-string form); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. A list view wiring a declared action under the other contract is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). | +| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the action placed at `selection`); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. An action placed at `selection` that declares 'aggregate', or a list view wiring a declared action under the other contract, is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). | | **params** | `{ name?: string; field?: string; objectOverride?: string; label?: string \| Record; … }[]` | optional | Input parameters required from user — an ActionParam[] DEFINITION array, never a payload map (a static request body goes in `bodyExtra`). A param name (its `name`, or the `field` a field-backed param reads) may repeat only for per-gate variants of ONE input (declarations that differ in `visible` / `requiresFeature`, e.g. one optional and one required); the params check treats the name as `required` only when EVERY declaration of it requires it, and judges its value by the FIRST declaration's shape (`type`, `multiple`, `options`), so keep that shape identical across them. | | **submitText** | `string \| Record` | optional | Label of the submit button in the action's param dialog, the verb the button performs (e.g. "Send", "Log Call"), in place of the default "Confirm" — the default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.submitText` (`globalActions.ACTION.submitText` for an object-less action). Only on an action with a non-empty `params`: without one no param dialog opens, so it is refused. Not `confirmText`, which is the message of a param-less action's confirm dialog. A blank label is refused. | | **cancelText** | `string \| Record` | optional | Label of the dismiss button on the dialog the action opens before it runs — the confirm dialog of a param-less action that declares `confirmText`, or the param dialog of an action with a non-empty `params` — in place of the default "Cancel". Name what dismissing keeps where the action's own verb is "Cancel …" or "Close …" (e.g. "Keep invitation" beside "Cancel Invitation"). The default-language string, or an inline locale map; translated at `objects.OBJECT._actions.ACTION.cancelText` (`globalActions.ACTION.cancelText` for an object-less action). Only on an action that opens one of those dialogs: with neither `confirmText` nor a non-empty `params` no dialog opens, so it is refused. The dismiss twin of `submitText`, as on `object-form`. A blank label is refused. | diff --git a/packages/spec/docs/references/system/migration.md b/packages/spec/docs/references/system/migration.md index 56298b61be3..d2a7532e55a 100644 --- a/packages/spec/docs/references/system/migration.md +++ b/packages/spec/docs/references/system/migration.md @@ -335,7 +335,7 @@ Create a new object | **description** | `string` | optional | Developer documentation / description | | **icon** | `string` | optional | Icon name (Lucide/Material) for UI representation | | **color** | `Enum<'gray' \| 'blue' \| 'teal' \| 'green' \| 'amber' \| 'orange' \| 'red' \| 'pink' \| 'purple'>` | optional | Object colour, one name from the fixed palette (gray, blue, teal, green, amber, orange, red, pink, purple). The console draws the object's icon as a white glyph on a rounded square of this colour, so one object looks the same wherever its icon appears. No free colour values. Omit to draw the neutral `gray`. | -| **actionLayout** | `{ list?: object; record?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | +| **actionLayout** | `{ list?: object; record?: object; selection?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`, `selection`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | | **isSystem** | `boolean` | optional (default: `false`) | Is system object (protected from deletion; defaults its org-wide sharing to public when no sharingModel is set — plugin-sharing) | | **managedBy** | `Enum<'platform' \| 'config' \| 'system-data' \| 'engine-owned' \| 'append-only' \| …>` | optional | Lifecycle bucket — platform (user CRUD) \| config (admin authored) \| system-data (platform-defined schema, admin/user-writable data) \| engine-owned (engine owns the lifecycle, no user writes) \| append-only (audit) \| synced (rows copied by a pull from a connector or federated source; read-only to members, and userActions cannot open a write) \| better-auth (identity). UI clients honour the resolved affordance matrix. | | **ownership** | `Enum<'user' \| 'business_unit' \| 'org' \| 'none'>` | optional | Record-ownership model: user (default — injects reassignable owner_id plus owning_business_unit_id) \| business_unit (unit-owned: owning_business_unit_id only, no owner_id) \| org \| none (no per-record owner, neither anchor). Distinct from the package own/extend contribution kind. | diff --git a/packages/spec/docs/references/system/migration.part-2.md b/packages/spec/docs/references/system/migration.part-2.md index 04f2782ebe9..98f2a50aae7 100644 --- a/packages/spec/docs/references/system/migration.part-2.md +++ b/packages/spec/docs/references/system/migration.part-2.md @@ -179,7 +179,7 @@ Create a new object | **description** | `string` | optional | Developer documentation / description | | **icon** | `string` | optional | Icon name (Lucide/Material) for UI representation | | **color** | `Enum<'gray' \| 'blue' \| 'teal' \| 'green' \| 'amber' \| 'orange' \| 'red' \| 'pink' \| 'purple'>` | optional | Object colour, one name from the fixed palette (gray, blue, teal, green, amber, orange, red, pink, purple). The console draws the object's icon as a white glyph on a rounded square of this colour, so one object looks the same wherever its icon appears. No free colour values. Omit to draw the neutral `gray`. | -| **actionLayout** | `{ list?: object; record?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | +| **actionLayout** | `{ list?: object; record?: object; selection?: object }` | optional | The order of the object's actions and which are buttons, per action scope (`list`, `record`, `selection`): `pinned` (at most 3 buttons, in order) and `more` (the 「More」 menu order; unnamed actions follow in their default order). Omit to keep each surface's own choice (each action's `order`). | | **isSystem** | `boolean` | optional (default: `false`) | Is system object (protected from deletion; defaults its org-wide sharing to public when no sharingModel is set — plugin-sharing) | | **managedBy** | `Enum<'platform' \| 'config' \| 'system-data' \| 'engine-owned' \| 'append-only' \| …>` | optional | Lifecycle bucket — platform (user CRUD) \| config (admin authored) \| system-data (platform-defined schema, admin/user-writable data) \| engine-owned (engine owns the lifecycle, no user writes) \| append-only (audit) \| synced (rows copied by a pull from a connector or federated source; read-only to members, and userActions cannot open a write) \| better-auth (identity). UI clients honour the resolved affordance matrix. | | **ownership** | `Enum<'user' \| 'business_unit' \| 'org' \| 'none'>` | optional | Record-ownership model: user (default — injects reassignable owner_id plus owning_business_unit_id) \| business_unit (unit-owned: owning_business_unit_id only, no owner_id) \| org \| none (no per-record owner, neither anchor). Distinct from the package own/extend contribution kind. | diff --git a/packages/spec/src/system/translation.zod.ts b/packages/spec/src/system/translation.zod.ts index 0b4455fae8e..25f058d9b43 100644 --- a/packages/spec/src/system/translation.zod.ts +++ b/packages/spec/src/system/translation.zod.ts @@ -714,8 +714,9 @@ export const ObjectTranslationDataSchema = lazySchema(() => strictObject({ * an authored def is "left as-authored"), so the source-locale string was * the only string there was. * - * **Why this and not the `bulkActions: ['']` promotion.** Naming a - * declared action instead DOES localize — that path runs through + * **Why this and not the `selection` promotion.** Placing a declared + * action at `selection` (until protocol 19, a view's `bulkActions` list) + * DOES localize — that path runs through * `translateAction` — but it is not the same capability: it dispatches the * action once per selected record, where a def is one data-plane * `updateMany`/`deleteMany` (or one `execution: 'aggregate'` call). Telling diff --git a/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx b/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx index 0275f5b8f0e..2921bc9e861 100644 --- a/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx +++ b/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx @@ -22,6 +22,7 @@ import { BulkActionBar, SELECTION_EXPOSED_ACTIONS, planExposedEntries, + planPinnedEntries, singleRecordEntries, } from '../components/SelectionBar'; import type { RowActionMenuPlan } from '../components/RowActionMenu'; @@ -47,6 +48,25 @@ const exposedNames = () => .map((b) => b.getAttribute('data-testid')) .filter((id) => id !== 'bulk-selection-clear' && id !== 'selection-actions-more'); +// objectstack#36496 — `actionLayout.selection.pinned` names the bar's buttons. +describe('planPinnedEntries', () => { + const entries = (...names: string[]) => names.map((name) => ({ key: `k_${name}`, def: { name } })); + + it('exposes the pinned entries in pin order and leaves every other one, Delete included, in menu order', () => { + const all = [...entries('a', 'b', 'c'), { key: 'delete' }]; + const { exposed, rest } = planPinnedEntries(all, ['c', 'a'], 3); + expect(exposed.map((e) => e.key)).toEqual(['k_c', 'k_a']); + expect(rest.map((e) => e.key)).toEqual(['k_b', 'delete']); + }); + + it('`[]` pins none, a pin that names no entry draws nothing, and the fit trims from the end', () => { + const all = entries('a', 'b'); + expect(planPinnedEntries(all, [], 3)).toEqual({ exposed: [], rest: all }); + expect(planPinnedEntries(all, ['ghost', 'b'], 3).exposed.map((e) => e.key)).toEqual(['k_b']); + expect(planPinnedEntries(all, ['a', 'b'], 1).exposed.map((e) => e.key)).toEqual(['k_a']); + }); +}); + describe('planExposedEntries', () => { const entries = (...keys: string[]) => keys.map((key) => ({ key, destructive: key.startsWith('delete') })); const notDestructive = (e: { destructive: boolean }) => !e.destructive; diff --git a/ui/packages/plugin-grid/src/__tests__/resolveBulkActions.test.ts b/ui/packages/plugin-grid/src/__tests__/resolveBulkActions.test.ts index 4797bb65d69..811aa090287 100644 --- a/ui/packages/plugin-grid/src/__tests__/resolveBulkActions.test.ts +++ b/ui/packages/plugin-grid/src/__tests__/resolveBulkActions.test.ts @@ -7,7 +7,7 @@ */ import { describe, it, expect } from 'vitest'; -import { resolveBulkActions, resolvePromotedBulkParams, PROMOTED_BULK_BATCH_SIZE } from '../resolveBulkActions'; +import { resolveBulkActions, resolvePromotedBulkParams, selectionBarActions, PROMOTED_BULK_BATCH_SIZE } from '../resolveBulkActions'; import type { BulkActionDef } from '@object-ui/types'; const PUSH_DOWN = { @@ -367,3 +367,50 @@ describe('resolveBulkActions', () => { }); }); }); + +// objectstack#36496 — the object's actions placed at `selection` are the +// selection bar's, on every grid of the object, in `actionLayout.selection`'s +// order; an authored def still claims its name first. +describe('selectionBarActions (objectstack#36496)', () => { + const at = (name: string, extra: Record = {}) => ({ name, label: name, type: 'script', locations: ['selection'], ...extra }); + + it('takes only actions placed at `selection`, by `order` then as served, the first of a name', () => { + const { actions, pinned } = selectionBarActions( + [ + at('b', { order: 2 }), + { name: 'rec', label: 'rec', type: 'script', locations: ['record'] }, + at('a', { order: 1 }), + at('c'), + at('a', { label: 'shadow' }), + ], + undefined, + ); + expect(actions.map((a) => a.name)).toEqual(['c', 'a', 'b']); + expect(pinned).toBeUndefined(); + }); + + it('leads with the arm, `pinned` then `more`, and hands the pins on; a name it does not place draws nothing', () => { + const { actions, pinned } = selectionBarActions( + [at('a'), at('b'), at('c'), at('d')], + { pinned: ['c', 'ghost'], more: ['b'] }, + ); + expect(actions.map((a) => a.name)).toEqual(['c', 'b', 'a', 'd']); + expect(pinned).toEqual(['c', 'ghost']); + }); + + it('resolveBulkActions promotes them after authored defs and before a block\'s names', () => { + const selection = [at('push_down'), at('archive')]; + const { defs } = resolveBulkActions({ + selectionActions: selection, + bulkActions: ['block_only'], + bulkActionDefs: [AUTHORED], + objectActions: [...selection, { name: 'block_only', label: 'Block', type: 'script' }], + }); + // `archive` is the authored def's name: the def keeps it, the action does not draw twice. + expect(defs.map((d) => [d.name, d.operation])).toEqual([ + ['archive', 'update'], + ['push_down', 'custom'], + ['block_only', 'custom'], + ]); + }); +}); diff --git a/ui/packages/plugin-view/src/ObjectView.tsx b/ui/packages/plugin-view/src/ObjectView.tsx index 44fb15b741b..e6515c83ebe 100644 --- a/ui/packages/plugin-view/src/ObjectView.tsx +++ b/ui/packages/plugin-view/src/ObjectView.tsx @@ -3236,8 +3236,11 @@ export const ObjectView: React.FC = ({ appearance: currentNamedViewConfig?.appearance ?? activeView?.appearance, rowActions: currentNamedViewConfig?.rowActions ?? activeView?.rowActions ?? (schema as any).rowActions, rowActionDefs: (activeView as any)?.rowActionDefs ?? (schema as any).rowActionDefs, - // [objectstack#36496] No `bulkActions`: a list view no longer lists - // them, and the grid draws the object's `selection` actions. + // [objectstack#36496] A named view no longer lists bulk actions (the + // grid draws the object's `selection` actions), so only the host's + // composition key is relayed. `ListView` no longer reads it; dropping + // it from the objectui#5097 exemption is a new ruling, not this card's. + bulkActions: (schema as any).bulkActions, bulkActionDefs: currentNamedViewConfig?.bulkActionDefs ?? activeView?.bulkActionDefs, sharing: currentNamedViewConfig?.sharing ?? activeView?.sharing ?? (schema as any).sharing, addRecord: currentNamedViewConfig?.addRecord ?? activeView?.addRecord ?? (schema as any).addRecord, diff --git a/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx b/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx index cbaee478ac2..19f175b05aa 100644 --- a/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx +++ b/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx @@ -455,7 +455,7 @@ const FAMILIES: Record> = { addRecord: { named: { enabled: true, position: 'bottom' }, host: { enabled: false }, node: { enabled: true, position: 'top' } }, inlineEdit: { named: true, host: false, node: true }, rowActions: { named: ['archive'], host: ['host_row'], node: ['node_row'] }, - bulkActions: { named: ['delete'], host: ['host_bulk'], node: ['node_bulk'] }, + // `bulkActions` left with objectstack#36496: the spec retires it on a view. bulkActionDefs: { named: [{ name: 'close_all', label: 'Close all', operation: 'update', patch: { stage: 'closed' } }], host: [{ name: 'host_def', label: 'Host', operation: 'delete' }], diff --git a/ui/packages/plugin-view/src/__tests__/ObjectView.routeTwoNamedGridMembers-10885.test.tsx b/ui/packages/plugin-view/src/__tests__/ObjectView.routeTwoNamedGridMembers-10885.test.tsx index 301a2586ace..80c4403773d 100644 --- a/ui/packages/plugin-view/src/__tests__/ObjectView.routeTwoNamedGridMembers-10885.test.tsx +++ b/ui/packages/plugin-view/src/__tests__/ObjectView.routeTwoNamedGridMembers-10885.test.tsx @@ -107,7 +107,8 @@ const MEMBERS: Record = { table: [{ condition: "stage == 'open'", style: { backgroundColor: '#e0f2fe' } }], }, rowActions: { named: ['archive'], table: ['node_row'] }, - bulkActions: { named: ['delete'], table: ['node_bulk'] }, + // `bulkActions` left with objectstack#36496: the spec retires it on a view; + // the `table` slot's own (an `object-grid` key) still relays. bulkActionDefs: { named: [{ name: 'close_all', label: 'Close all', operation: 'update', patch: { stage: 'closed' } }], table: [{ name: 'node_def', label: 'Node', operation: 'delete' }], diff --git a/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx b/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx index 76f58dd2a30..e9a6d3e51ee 100644 --- a/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx +++ b/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx @@ -301,7 +301,7 @@ const namedViewReadsIn = (slice: string): string[] => * bucket ①. */ const FENCE_NAMED_VIEW_READS = [ - 'addRecord', 'allowPrinting', 'appearance', 'aria', 'bulkActionDefs', 'bulkActions', 'columns', + 'addRecord', 'allowPrinting', 'appearance', 'aria', 'bulkActionDefs', 'columns', 'compactToolbar', 'conditionalFormatting', 'data', 'description', 'emptyState', 'exportOptions', 'fieldOrder', 'grouping', 'hiddenFields', 'inlineEdit', 'label', 'navigation', 'pagination', 'resizable', 'rowActions', 'rowColor', 'rowHeight', 'searchableFields', 'selection', From 2f92df00de659d794d95ae55d52f6ec21494ec04 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 07:13:51 +0000 Subject: [PATCH 5/9] test(ui): census and host-surface pins read bulkActions as a protocol-19 tombstone Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- ...bulkActionDefsUnusableMember-8730.test.tsx | 2 +- .../__tests__/bulkActionMembers-8071.test.tsx | 2 +- .../ListView.crossPageSelectAll.test.tsx | 3 ++ ...ctView.namedViewProtocolKeys-8980.test.tsx | 9 ++-- .../__tests__/objectViewHostSurface.test.tsx | 11 +++- .../object-view-unmirrored-keys-7779.test.ts | 50 ++++++++++++------- 6 files changed, 53 insertions(+), 24 deletions(-) diff --git a/ui/packages/plugin-grid/src/__tests__/bulkActionDefsUnusableMember-8730.test.tsx b/ui/packages/plugin-grid/src/__tests__/bulkActionDefsUnusableMember-8730.test.tsx index 0ea434e14f0..277c9332b74 100644 --- a/ui/packages/plugin-grid/src/__tests__/bulkActionDefsUnusableMember-8730.test.tsx +++ b/ui/packages/plugin-grid/src/__tests__/bulkActionDefsUnusableMember-8730.test.tsx @@ -275,7 +275,7 @@ describe('object-grid `bulkActionDefs`: an unusable member is skipped (objectui# expect(lines[0]).toContain("'approve'"); // WHAT TO DO: the other vocabulary is named, since that is where a bare // action name belongs. - expect(lines[0]).toContain('bulkActions'); + expect(lines[0]).toContain("`'selection'`"); fired.mockRestore(); // No-fire leg, on a fresh render of a clean list. diff --git a/ui/packages/plugin-grid/src/__tests__/bulkActionMembers-8071.test.tsx b/ui/packages/plugin-grid/src/__tests__/bulkActionMembers-8071.test.tsx index c9832f9e1d4..63c47e193b7 100644 --- a/ui/packages/plugin-grid/src/__tests__/bulkActionMembers-8071.test.tsx +++ b/ui/packages/plugin-grid/src/__tests__/bulkActionMembers-8071.test.tsx @@ -310,7 +310,7 @@ describe('object-grid `bulkActionDefs` members are FULL DEFS (objectui#8071)', ( expect(lines).toHaveLength(1); expect(lines[0]).toContain('bulkActionDefs[0]'); expect(lines[0]).toContain("'approve'"); - expect(lines[0]).toContain('bulkActions'); + expect(lines[0]).toContain("`'selection'`"); // WHERE: the block is addressed, so the author knows which grid to open. expect(lines[0]).toContain("objectName: 'os_invoice'"); } finally { diff --git a/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx index 5414e374ce1..95975b34f6f 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx @@ -307,6 +307,9 @@ describe('ListView-hosted grid — the escalation fans out with the HOST\'s real sort: [{ field: 'name', order: 'asc' }], })} dataSource={ds} + // objectstack#36496: a list view no longer lists `delete`; the + // grid's own bulk Delete is drawn where the grid can delete. + onDelete={vi.fn()} onBulkDelete={onBulkDelete} /> diff --git a/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx b/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx index 19f175b05aa..ea5e94c3ac7 100644 --- a/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx +++ b/ui/packages/plugin-view/src/__tests__/ObjectView.namedViewProtocolKeys-8980.test.tsx @@ -551,12 +551,15 @@ describe('objectui#10758 — the host delegation reads bucket ① off the named it('the families cover bucket ① exactly once, and every member is a protocol member of a named view', () => { // 23 is the ruling's figure (objectui#7924, comment 5690906005); 22 since // objectui#13118 retired `filterableFields`, which the spec retires and no - // source relays (its own row below). The types census re-derives the + // source relays (its own row below); 21 since objectstack#36496 retired + // `bulkActions` (protocol 19 places those actions at `selection`, so a + // named view carries no list to read). The types census re-derives the // partition on every run, so this is the fixture's coverage, not a second // census. - expect(BUCKET_ONE).toHaveLength(22); - expect(new Set(BUCKET_ONE).size).toBe(22); + expect(BUCKET_ONE).toHaveLength(21); + expect(new Set(BUCKET_ONE).size).toBe(21); expect(BUCKET_ONE).not.toContain('filterableFields'); + expect(BUCKET_ONE).not.toContain('bulkActions'); const protocol = Object.keys(SpecObjectListViewSchema.shape); expect(BUCKET_ONE.filter((m) => !protocol.includes(m))).toEqual([]); // Control on the same query: a key the protocol does NOT declare on a diff --git a/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx b/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx index e9a6d3e51ee..d1b3544320e 100644 --- a/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx +++ b/ui/packages/plugin-view/src/__tests__/objectViewHostSurface.test.tsx @@ -318,6 +318,13 @@ const PROTOCOL_RUNGS_READ_UPSTREAM = ['filter', 'sort', 'type']; describe('the fence reads the named view first for every protocol member it relays (objectui#10758)', () => { const protocol = Object.keys(SpecObjectListViewSchema.shape); + // A RETIRED protocol member (its slot is a `[REMOVED]` tombstone) cannot be + // carried by a named view — the protocol refuses it there — so its rung has no + // named view to read first. `bulkActions` (objectstack#36496) is the one the + // fence still relays, off the host node, for the objectui#5097 exemption. + const retired = protocol.filter((k) => ((SpecObjectListViewSchema.shape as Record)[k]?.description ?? '') + .startsWith('[REMOVED]')); + const liveProtocol = protocol.filter((k) => !retired.includes(k)); it('the named-view reads inside the fence are exactly the pinned set — by name', () => { expect(namedViewReadsIn(regionSlice())).toEqual(FENCE_NAMED_VIEW_READS); @@ -325,7 +332,9 @@ describe('the fence reads the named view first for every protocol member it rela it('every rung for a protocol member reads the named view, except the three read upstream', () => { const rungs = namedViewRungs(); - const protocolRungs = Object.keys(rungs).filter((k) => protocol.includes(k)).sort(); + expect(retired).toContain('bulkActions'); + expect(rungs.bulkActions, 'the retired `bulkActions` rung reads the named view').toBe(false); + const protocolRungs = Object.keys(rungs).filter((k) => liveProtocol.includes(k)).sort(); const skipping = protocolRungs.filter((k) => !rungs[k]); expect( skipping, diff --git a/ui/packages/types/src/__tests__/object-view-unmirrored-keys-7779.test.ts b/ui/packages/types/src/__tests__/object-view-unmirrored-keys-7779.test.ts index 44cb8bb6625..0fcae8dd376 100644 --- a/ui/packages/types/src/__tests__/object-view-unmirrored-keys-7779.test.ts +++ b/ui/packages/types/src/__tests__/object-view-unmirrored-keys-7779.test.ts @@ -243,7 +243,7 @@ const CONTROL_KEY = 'viewSwitcherPosition'; * was the undeclared cast. */ const NAMED_VIEW_READS = [ - 'addRecord', 'allowPrinting', 'appearance', 'aria', 'bulkActionDefs', 'bulkActions', + 'addRecord', 'allowPrinting', 'appearance', 'aria', 'bulkActionDefs', 'calendar', 'chart', 'columns', 'compactToolbar', 'conditionalFormatting', 'data', 'description', 'emptyState', 'exportOptions', 'fieldOrder', 'filter', 'gallery', 'gantt', 'grouping', 'hiddenFields', 'inlineEdit', 'kanban', 'label', 'map', @@ -280,7 +280,7 @@ const NAMED_LIST_VIEW_DECLARED = [ * which is what closed {@link NAMED_VIEW_READ_UNDECLARED}. */ const NAMED_VIEW_READ_DECLARED = [ - 'addRecord', 'allowPrinting', 'appearance', 'aria', 'bulkActionDefs', 'bulkActions', + 'addRecord', 'allowPrinting', 'appearance', 'aria', 'bulkActionDefs', 'calendar', 'chart', 'columns', 'compactToolbar', 'conditionalFormatting', 'data', 'description', 'emptyState', 'exportOptions', 'fieldOrder', 'filter', 'gallery', 'gantt', 'grouping', 'hiddenFields', 'inlineEdit', 'kanban', 'label', 'map', @@ -329,7 +329,7 @@ const NAMED_VIEW_READ_UNDECLARED = [] as const; * `pageName` configures. */ const NAMED_LIST_VIEW_UNREAD = [ - 'addDeleteRecordsInline', 'addRecordViaForm', 'allowExport', 'clickIntoRecordDetails', + 'addDeleteRecordsInline', 'addRecordViaForm', 'allowExport', 'bulkActions', 'clickIntoRecordDetails', 'collapseAllByDefault', 'color', 'densityMode', 'fieldTextColor', 'filterableFields', 'options', 'pageName', 'prefixField', 'requiredPermissions', 'showColor', 'showDensity', 'showDescription', 'showFilters', 'showGroup', 'showHideFields', 'showSearch', 'showSort', 'tabs', 'wrapHeaders', @@ -404,7 +404,7 @@ const PROTOCOL_LIST_VIEW_KEYS = [ * not declaring a key the protocol refuses is agreement, not a gap. Derived by * the tombstone's own marker, not listed by hand. */ -const PROTOCOL_RETIRED_KEYS = ['filterableFields', 'pageName', 'tabs'] as const; +const PROTOCOL_RETIRED_KEYS = ['bulkActions', 'filterableFields', 'pageName', 'tabs'] as const; /** * The five objectstack#7176 retirements after their tombstones aged out @@ -484,7 +484,7 @@ const BUCKET_PROTOCOL_DECLARED_UNREAD = [] as const; * member, below; the census above asserts the same from the other side. */ const BUCKET_ONE_READ_SINCE_10758 = [ - 'addRecord', 'allowPrinting', 'aria', 'bulkActionDefs', 'bulkActions', 'compactToolbar', + 'addRecord', 'allowPrinting', 'aria', 'bulkActionDefs', 'compactToolbar', 'conditionalFormatting', 'description', 'emptyState', 'exportOptions', 'hiddenFields', 'inlineEdit', 'navigation', 'pagination', 'resizable', 'rowActions', 'rowHeight', 'searchableFields', 'selection', 'sharing', 'showRecordCount', 'userFilters', @@ -497,6 +497,15 @@ const BUCKET_ONE_READ_SINCE_10758 = [ */ const BUCKET_ONE_UNREAD_SINCE_13118 = ['filterableFields'] as const; +/** + * The bucket-① member read no longer since objectstack#36496: `bulkActions`. + * Protocol 19 retired the list view's list of bulk actions (an action placed at + * `selection` is drawn on every grid view's selection bar), ListView stopped + * reading it, and objectui's face carries the `?: never` tombstone in the same + * change, so it went straight to the protocol-retired bucket. + */ +const BUCKET_ONE_UNREAD_SINCE_36496 = ['bulkActions'] as const; + /** * BUCKET ② — the eight legacy `show*` SPELLINGS: declared by objectui alone, * each with a canonical protocol twin the runtime already folds onto. The @@ -621,10 +630,11 @@ const NAMED_LIST_VIEW_TOMBSTONES = [ * had tombstoned it on objectui's face ahead of the pin, and the installed * protocol now retires it too (objectstack#24640). */ -const BUCKET_PROTOCOL_RETIRED_TOMBSTONED = ['filterableFields', 'pageName', 'tabs'] as const; +const BUCKET_PROTOCOL_RETIRED_TOMBSTONED = ['bulkActions', 'filterableFields', 'pageName', 'tabs'] as const; /** The marker each protocol-retired member's `?: never` docblock carries: the card that tombstoned it here. */ const PROTOCOL_RETIRED_TOMBSTONE_DOC: Readonly> = { + bulkActions: 'RETIRED in protocol 19 (objectstack#36496)', filterableFields: 'RETIRED (objectui#13118)', pageName: 'RETIRED (objectui#11073)', tabs: 'RETIRED (objectui#11073)', @@ -1624,8 +1634,10 @@ describe('objectui#7924 — the per-member liveness census on `NamedListView`, r it('the renderer reads exactly forty-two names off a named view — every one of them declared', () => { const d = deriveNamedViewReads(); expect(d.reads).toEqual([...NAMED_VIEW_READS]); - // 43 until objectui#13118 stopped reading the spec-retired `filterableFields`. - expect(d.reads).toHaveLength(43); + // 43 until objectui#13118 stopped reading the spec-retired `filterableFields` + // (43 again once objectstack#34382 added `timesheet`); 42 since + // objectstack#36496 stopped reading the protocol-19-retired `bulkActions`. + expect(d.reads).toHaveLength(42); // ⭐ THE INSTRUMENTS NOW DISAGREE BY ONE NAME, and the difference is pinned // rather than smoothed over. The AST finds STRICTLY more than the // `currentNamedViewConfig?.KEY` regex it replaced — that was already true @@ -1644,15 +1656,16 @@ describe('objectui#7924 — the per-member liveness census on `NamedListView`, r expect(d.readSites.name.length, '`name` is read at exactly one site: the tab strip\'s display fallback').toBe(1); }); - it('the census partitions the declaration exactly: 42 read + 23 unread = 65, disjoint and exhaustive (43 + 22 until objectui#13118)', () => { + it('the census partitions the declaration exactly: 42 read + 24 unread = 66, disjoint and exhaustive (43 + 23 until objectstack#36496, 43 + 22 until objectui#13118)', () => { const declared = new Set(namedListViewMembers().names); const reads = new Set(deriveNamedViewReads().reads); const read = [...declared].filter((m) => reads.has(m)).sort(); const unread = [...declared].filter((m) => !reads.has(m)).sort(); expect(read).toEqual([...NAMED_VIEW_READ_DECLARED]); expect(unread).toEqual([...NAMED_LIST_VIEW_UNREAD]); - expect(read).toHaveLength(43); - expect(unread).toHaveLength(23); + // 43 + 23 until objectstack#36496 moved `bulkActions` to the unread side. + expect(read).toHaveLength(42); + expect(unread).toHaveLength(24); expect(read.length + unread.length).toBe(declared.size); expect(read.filter((m) => unread.includes(m))).toEqual([]); }); @@ -1934,7 +1947,7 @@ describe('objectui#7924 — the unread members, in the FOUR buckets the ruling w } }); - it('the 23 unread members partition SIX ways — 0 + 8 + 11 + 3 + 1 + 0 since objectui#13261 (0 + 8 + 11 + 2 + 1 + 1 since objectui#13118, 0 + 8 + 11 + 2 + 1 before it, 0 + 8 + 11 + 2 before objectui#12341, 23 + 8 + 11 + 2 before objectui#10758) — disjoint and exhaustive', () => { + it('the 24 unread members partition SIX ways — 0 + 8 + 11 + 4 + 1 + 0 since objectstack#36496 (0 + 8 + 11 + 3 + 1 + 0 since objectui#13261, 0 + 8 + 11 + 2 + 1 + 1 since objectui#13118, 0 + 8 + 11 + 2 + 1 before it, 0 + 8 + 11 + 2 before objectui#12341, 23 + 8 + 11 + 2 before objectui#10758) — disjoint and exhaustive', () => { const unread = new Set(NAMED_LIST_VIEW_UNREAD as readonly string[]); const protocolKeys = new Set(protocolListViewKeys()); const retiredTombstoned = new Set(BUCKET_PROTOCOL_RETIRED_TOMBSTONED); @@ -1960,7 +1973,7 @@ describe('objectui#7924 — the unread members, in the FOUR buckets the ruling w expect(protocolDeclared).toHaveLength(0); expect(legacy).toHaveLength(8); expect(inventedOnly).toHaveLength(11); - expect(BUCKET_PROTOCOL_RETIRED_TOMBSTONED).toHaveLength(3); + expect(BUCKET_PROTOCOL_RETIRED_TOMBSTONED).toHaveLength(4); expect(BUCKET_SERVER_ENFORCED_UNREAD).toHaveLength(1); expect(BUCKET_SPEC_RETIRED_AHEAD_OF_PIN).toHaveLength(0); // Exhaustive and disjoint against the census's own unread set: a member that @@ -1970,8 +1983,8 @@ describe('objectui#7924 — the unread members, in the FOUR buckets the ruling w ...protocolDeclared, ...legacy, ...inventedOnly, ...BUCKET_PROTOCOL_RETIRED_TOMBSTONED, ...BUCKET_SERVER_ENFORCED_UNREAD, ...BUCKET_SPEC_RETIRED_AHEAD_OF_PIN, ]; - expect(union).toHaveLength(23); - expect(new Set(union).size).toBe(23); + expect(union).toHaveLength(24); + expect(new Set(union).size).toBe(24); expect([...union].sort()).toEqual([...unread].sort()); }); @@ -2018,7 +2031,7 @@ describe('objectui#7924 — the unread members, in the FOUR buckets the ruling w expect(NAMED_LIST_VIEW_UNREAD as readonly string[]).not.toContain(member); }); - it.each(BUCKET_ONE_UNREAD_SINCE_13118)('INVERTED (objectui#13118) — `%s` was a bucket-① member read off a named view since objectui#10758, and is read off none now: the spec retires it', (member) => { + it.each([...BUCKET_ONE_UNREAD_SINCE_13118, ...BUCKET_ONE_UNREAD_SINCE_36496])('INVERTED (objectui#13118) — `%s` was a bucket-① member read off a named view since objectui#10758, and is read off none now: the spec retires it', (member) => { expect(namedListViewMembers().names).toContain(member); expect(namedListViewMembers().tombstones).toContain(member); expect(protocolListViewKeys()).toContain(member); @@ -2190,8 +2203,9 @@ describe('objectui#7924 — the retirement: seventeen `?: never` tombstones, obj && !(RETIRED_BY_13118 as readonly string[]).includes(t) && !(RETIRED_BY_25923 as readonly string[]).includes(t)); // 20 until objectui#13118 tombstoned `filterableFields`; 21 until - // objectstack#25923 tombstoned `options`. - expect(allTombstones).toHaveLength(22); + // objectstack#25923 tombstoned `options`; 22 until objectstack#36496 + // tombstoned `bulkActions` (a protocol-retired member, filtered above). + expect(allTombstones).toHaveLength(23); for (const m of RETIRED_BY_13118) expect(allTombstones).toContain(m); for (const m of RETIRED_BY_25923) expect(allTombstones).toContain(m); expect(BUCKET_LOCAL_ONLY_HELD).toHaveLength(0); From 43575e0c0f214c9dfb2d9d2e80bb1af6deba1891 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 07:49:28 +0000 Subject: [PATCH 6/9] fix(app-shell): the header pins panel arranges the two header arms and keeps the selection arm as held Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- .../__tests__/designModeHeaderPinsSave-36366.test.ts | 11 +++++++++++ .../app-shell/src/layout/designModeHeaderPinsModel.ts | 8 +++++++- .../src/views/ObjectView.relayRungCensus-7559.test.ts | 1 + .../inspectorStrings.hookAction.i18n-10586.test.tsx | 4 +++- .../types/src/__tests__/p1-spec-alignment.test.ts | 11 ++++++++--- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ui/packages/app-shell/src/layout/__tests__/designModeHeaderPinsSave-36366.test.ts b/ui/packages/app-shell/src/layout/__tests__/designModeHeaderPinsSave-36366.test.ts index af49833ea44..f280227b2df 100644 --- a/ui/packages/app-shell/src/layout/__tests__/designModeHeaderPinsSave-36366.test.ts +++ b/ui/packages/app-shell/src/layout/__tests__/designModeHeaderPinsSave-36366.test.ts @@ -165,6 +165,17 @@ describe('saving the header pins (objectstack#36366)', () => { }); }); + it('objectstack#36496: the held `selection` arm (the multi-select bar, no header) survives a header save as held', async () => { + const extension = { extend: 'crm_lead', actionLayout: { selection: { pinned: ['mass_assign'], more: [] } } }; + const { d, calls } = doors({ writable: false, extension }); + await saveObjectPins(input({ record: { pinned: ['convert'] } }), TEXTS, d); + const save = calls.find((c) => c[0] === 'save'); + expect(save?.[3]).toEqual({ + extend: 'crm_lead', + actionLayout: { selection: { pinned: ['mass_assign'], more: [] }, record: { pinned: ['convert'] } }, + }); + }); + it('S3: a staged value that arranges as the object is served writes nothing', async () => { const served = { ...SERVED, actionLayout: { record: { pinned: ['log_call'] } } }; const { d, calls } = doors({ writable: true }); diff --git a/ui/packages/app-shell/src/layout/designModeHeaderPinsModel.ts b/ui/packages/app-shell/src/layout/designModeHeaderPinsModel.ts index 90b201665f0..51535947ccf 100644 --- a/ui/packages/app-shell/src/layout/designModeHeaderPinsModel.ts +++ b/ui/packages/app-shell/src/layout/designModeHeaderPinsModel.ts @@ -24,7 +24,13 @@ import { } from '@objectstack/spec/data'; import { actionRendersAt, readActionLayoutArm, type ActionLayoutArm } from '@object-ui/types'; -export type PinPage = ObjectActionLayoutScope; +/** + * The scopes this panel arranges: the two HEADERS. The object's third arm, + * `selection` (objectstack#36496), orders the multi-select bar, which is no + * header; the panel leaves it as held, and a save keeps it (`actionLayoutValue` + * writes only the changed header scopes over the held value). + */ +export type PinPage = Exclude; /** One scope's arrangement: the buttons, then the 「More」 menu's order. */ export type PinArm = ActionLayoutArm; diff --git a/ui/packages/app-shell/src/views/ObjectView.relayRungCensus-7559.test.ts b/ui/packages/app-shell/src/views/ObjectView.relayRungCensus-7559.test.ts index c86794230cd..dea4144936a 100644 --- a/ui/packages/app-shell/src/views/ObjectView.relayRungCensus-7559.test.ts +++ b/ui/packages/app-shell/src/views/ObjectView.relayRungCensus-7559.test.ts @@ -476,6 +476,7 @@ const ABSENCES: Record = { performance: { kind: 'unread', reason: 'Retired at spec 17.0.0 with no reader in either repo; declared only as the console\'s own refusal since the 18.2 age-out (objectstack#25767).' }, requiredPermissions: { kind: 'unread', reason: 'The ADR-0066 audience gate `@objectstack/spec` 18 adds to a list view (objectui#12030). The SERVER enforces it before the view is served: a user who lacks the capabilities is never listed the view and is refused it by name, so nothing on the ListView path has a value to consume.' }, filterableFields: { kind: 'unread', reason: 'Retired by objectstack#24640 (maintainer ruling C, pulled into 18.0): no per-view Filter-panel whitelist replaces it. objectui#13118 removed its one reader, the whitelist branch of `ListView`\'s Filter-panel field list, and this relay\'s rung with it. Present only as the spec import that carries its tombstone from the pin bump that takes the retirement.' }, + bulkActions: { kind: 'unread', reason: "Retired by objectstack#36496 (protocol 19): an action that acts on many records is placed at `selection` and drawn on every grid view's selection bar in the order the object's `actionLayout.selection` gives, so a view carries no list. `ListView` reads it no longer and this relay's `bulkActions` rung went with it; the spec and `ListViewSchema` carry the tombstone. A view's own `bulkActionDefs` stay relayed." }, options: { kind: 'unread', reason: "Retired by objectstack#25923: the list view's `options` bag is the spec list overlay's tombstone, taken by reference, so every door refuses it by name. A stored bag is folded onto the top-level blocks by the server before the row is served, and objectstack#25923 removed every `ListView` read of it along with this relay's `options` rung." }, pageName: { kind: 'unread', reason: 'Page-context key with no reader on the list path.' }, tabs: { kind: 'unread', reason: "Spec view-tab list. ListView has no reader — the object page's view switcher is the page title's (`objectViewTitleSwitcher`), driven by `buildViewTabs`, and the `tabs` readers in the tree belong to `plugin-detail`'s DetailView." }, diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.hookAction.i18n-10586.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.hookAction.i18n-10586.test.tsx index 9a2accf25f4..9fa15e03155 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.hookAction.i18n-10586.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.hookAction.i18n-10586.test.tsx @@ -386,7 +386,9 @@ const ACTION_EN = [ // Placement 'Placement', 'Where this action surfaces in the UI.', - 'No placement selected — this action will not appear on any record or list surface. Tick a placement above, or place it from a view’s bulk actions.', + // objectstack#36496: "or place it from a view's bulk actions" dropped — a view + // no longer lists bulk actions; `selection` is one of the placements above. + 'No placement selected — this action will not appear on any record or list surface. Tick a placement above.', 'Capability-gated on a.b — every placement ticked above hides this action from anyone who does not hold it. Not greyed out and not an error: the button is simply absent, and the server refuses the invocation with a 403 either way. This session does not hold a.b, so the button is hidden from you too — grant it through a permission set to see it in the app.', 'This session does not hold a.b, so the button is hidden from you too — grant it through a permission set to see it in the app.', 'Capability-gated on a.b + c.d — every placement ticked above hides this action from anyone who does not hold all of them. Not greyed out and not an error: the button is simply absent, and the server refuses the invocation with a 403 either way.', diff --git a/ui/packages/types/src/__tests__/p1-spec-alignment.test.ts b/ui/packages/types/src/__tests__/p1-spec-alignment.test.ts index 66210873713..f68677e7a9e 100644 --- a/ui/packages/types/src/__tests__/p1-spec-alignment.test.ts +++ b/ui/packages/types/src/__tests__/p1-spec-alignment.test.ts @@ -44,15 +44,20 @@ import type { // P1.1 ListView Spec Alignment // ============================================================================ describe('P1.1 ListView Spec Alignment', () => { - it('should accept rowActions and bulkActions as string arrays', () => { + it('should accept rowActions as a string array, and refuse the retired bulkActions (objectstack#36496)', () => { const schema: ListViewSchema = { type: 'list-view', objectName: 'Account', rowActions: ['edit', 'delete', 'clone'], - bulkActions: ['delete', 'assign', 'export'], }; expect(schema.rowActions).toHaveLength(3); - expect(schema.bulkActions).toHaveLength(3); + const retired: ListViewSchema = { + type: 'list-view', + objectName: 'Account', + // @ts-expect-error — RETIRED in protocol 19: the actions are placed at `selection` + bulkActions: ['delete'], + }; + expect(retired.type).toBe('list-view'); }); it('should accept spec-canonical bulkActions on ObjectGridSchema (#1763)', () => { From 40c7e8598afbf55a78fc95e111efd84c29109dd0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 07:53:24 +0000 Subject: [PATCH 7/9] chore: regenerate the SDUI manifest, its reference pages and the metadata-form bundles after the main merge Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- content/docs/ui/components/action.mdx | 2 +- content/docs/ui/components/index.mdx | 2 +- content/docs/ui/components/plugins.mdx | 1 - content/docs/ui/components/record.mdx | 2 +- .../apps/translations/ar.metadata-forms.generated.ts | 4 ++++ .../apps/translations/ar.source-hashes.generated.ts | 2 ++ .../apps/translations/de.metadata-forms.generated.ts | 4 ++++ .../apps/translations/de.source-hashes.generated.ts | 2 ++ .../translations/es-ES.source-hashes.generated.ts | 2 -- .../apps/translations/fr.metadata-forms.generated.ts | 4 ++++ .../apps/translations/fr.source-hashes.generated.ts | 2 ++ .../translations/ja-JP.source-hashes.generated.ts | 2 -- .../apps/translations/ko.metadata-forms.generated.ts | 4 ++++ .../apps/translations/ko.source-hashes.generated.ts | 2 ++ .../translations/pt-BR.metadata-forms.generated.ts | 4 ++++ .../translations/pt-BR.source-hashes.generated.ts | 2 ++ .../apps/translations/ru.metadata-forms.generated.ts | 4 ++++ .../apps/translations/ru.source-hashes.generated.ts | 2 ++ .../translations/zh-CN.source-hashes.generated.ts | 2 -- .../translations/zh-Hant.metadata-forms.generated.ts | 4 ++++ .../translations/zh-Hant.source-hashes.generated.ts | 2 ++ scripts/sdui-manifest.record.json | 6 +++--- sdui.manifest.json | 12 ++++-------- 23 files changed, 52 insertions(+), 21 deletions(-) diff --git a/content/docs/ui/components/action.mdx b/content/docs/ui/components/action.mdx index 6c7f4b7ae9d..3de3f154d36 100644 --- a/content/docs/ui/components/action.mdx +++ b/content/docs/ui/components/action.mdx @@ -59,7 +59,7 @@ Namespace `action`. | `icon` | `string` | | — | | `actions` | `array` of `object` | | The actions in this group, in order. Each member is an action object the group draws and runs itself (`name`, `label`, `icon`, `type`, `target`, `locations`, `visible`, `disabled`, …); a member's executor is its own `type` | | `display` | `enum`: `inline`, `dropdown` | | — | -| `location` | `enum`: `list`, `record`, `record_page`, `record_row`, `record_related`, `record_section` | | Render only the members whose `locations` include this location. Omit to render every member | +| `location` | `enum`: `list`, `record`, `record_page`, `record_row`, `record_related`, `record_section`, `selection` | | Render only the members whose `locations` include this location. Omit to render every member | | `variant` | `enum`: `default`, `secondary`, `outline`, `ghost` | | — | | `size` | `enum`: `default`, `sm`, `lg`, `icon` | | Button size for the dropdown trigger and for every inline member that sets none | | `visible` | `boolean` \| `string` \| `object` | | Visibility predicate for the whole group: `true`/`false`, a bare CEL expression, or the `{ dialect: 'cel', source }` envelope, evaluated against the row the host binds. Omit for always-visible | diff --git a/content/docs/ui/components/index.mdx b/content/docs/ui/components/index.mdx index b739e5fce7b..5a574f1ddf3 100644 --- a/content/docs/ui/components/index.mdx +++ b/content/docs/ui/components/index.mdx @@ -87,7 +87,7 @@ regenerates from the renderer registry. Regenerate it with | [`ins`](/docs/ui/components/html#ins) | `ui` | 2 | [HTML Elements](/docs/ui/components/html) | | [`label`](/docs/ui/components/html#label) | `ui` | 2 | [HTML Elements](/docs/ui/components/html) | | [`li`](/docs/ui/components/html#li) | `ui` | 2 | [HTML Elements](/docs/ui/components/html) | -| [`list-view`](/docs/ui/components/plugins#list-view) | `plugin-list` | 42 | [Plugin Blocks](/docs/ui/components/plugins) | +| [`list-view`](/docs/ui/components/plugins#list-view) | `plugin-list` | 41 | [Plugin Blocks](/docs/ui/components/plugins) | | [`main`](/docs/ui/components/html#main) | `ui` | 2 | [HTML Elements](/docs/ui/components/html) | | [`mark`](/docs/ui/components/html#mark) | `ui` | 2 | [HTML Elements](/docs/ui/components/html) | | [`markdown`](/docs/ui/components/plugins#markdown) | `plugin-markdown` | 2 | [Plugin Blocks](/docs/ui/components/plugins) | diff --git a/content/docs/ui/components/plugins.mdx b/content/docs/ui/components/plugins.mdx index 94460edb9bd..3cb72d2f448 100644 --- a/content/docs/ui/components/plugins.mdx +++ b/content/docs/ui/components/plugins.mdx @@ -308,7 +308,6 @@ Namespace `plugin-list`. | `conditionalFormatting` | `array` of `object` | | Row style rules, each `{ condition, style }`: a CEL `condition` over the row's `record.*` and a CSS `style` map. The first rule that matches styles the row. | | `inlineEdit` | `boolean` | | Open the grid in inline-edit mode, for users who may update the object. | | `rowActions` | `array` of `string` | | Names of the actions offered on each row's menu. | -| `bulkActions` | `array` of `string` | | Names of the actions offered once rows are selected. Needs a multi-row `selection`. | | `bulkActionDefs` | `array` of `object` | | Full bulk-action definitions, the spec's `BulkActionDef`: a mass update (`operation: "update"` with a `patch`) or delete, or a named action run once for the whole selection. | | `kanban` | `object` | | The board, the spec's kanban block: `{ groupByField, columns, titleField, summarizeField }`. `groupByField` is the lane field and `columns` the fields on each card. | | `calendar` | `object` | | The calendar, `{ startDateField, endDateField, titleField, colorField, allDayField, initialDate }`; `initialDate` is where it opens: `first_record`, `next_record` or a date-macro token such as `{next_month_start}`, today when omitted. | diff --git a/content/docs/ui/components/record.mdx b/content/docs/ui/components/record.mdx index cb3e240a1d9..6ec9026a9bd 100644 --- a/content/docs/ui/components/record.mdx +++ b/content/docs/ui/components/record.mdx @@ -142,7 +142,7 @@ Namespace `record`. | :--- | :--- | :--- | :--- | | `actionNames` | `array` of `string` | | Action names to expose, in order — resolved from the actions declared on the object. With no names (and no host-supplied actions) nothing is looked up: the bar renders its empty placeholder on a design / preview surface and nothing at runtime | | `requiredPermissions` | `array` of `string` | | [ADR-0066] Capabilities the user must ALL hold — names that permission sets grant through `systemPermissions`, not object actions: `read` or `update` here is an ordinary capability name, not the object's read or edit permission. When the client has resolved the user's capabilities and any of these is missing, this block does not render its content; wherever it would otherwise render, an insufficient-permissions notice takes its place. Presentation only: it authorises nothing, and the data API still serves the same data to the same user. A client that cannot resolve the user's capabilities (no permission provider, or one that does not report `systemPermissions`) renders this block as if they were held — it fails open. | -| `location` | `enum`: `list`, `record`, `record_page`, `record_row`, `record_related`, `record_section` | | Which declared action location this bar renders | +| `location` | `enum`: `list`, `record`, `record_page`, `record_row`, `record_related`, `record_section`, `selection` | | Which declared action location this bar renders | | `align` | `enum`: `start`, `center`, `end` | | — | | `inline` | `boolean` | | Render in the flow instead of folding into the record header | | `variant` | `string` | | Passed to the Button primitive; a per-action variant overrides it | diff --git a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts index 7f75b36eefb..9d989a0998b 100644 --- a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const arMetadataForms: NonNullable = { label: "السجل", helpText: "رأس السجل (صفحة السجل، والمعاينة الجانبية، والشريط السفلي في الهاتف)، بالصيغة {\"pinned\": [...], \"more\": [...]}: أسماء الإجراءات الموضوعة في رأس السجل أو في قائمة «المزيد» الخاصة به. 3 مثبتة على الأكثر. يرفض os validate الاسم الذي ليس إجراءً لهذا الكائن أو غير الموضوع في صفحة السجل؛ ومثل هذا الاسم لا يرسم شيئًا." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "وضع التحرير", helpText: "نية تفاعل التحرير لسجلات هذا الكائن. عند الغياب، يختار العارض إعداده الافتراضي. نية عابرة للعارضات، وليست تنسيقًا.", diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts index 1bced799c77..bab62a07d2b 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts @@ -90,6 +90,8 @@ export const arGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", diff --git a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts index c9182fceb96..feb93a79582 100644 --- a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const deMetadataForms: NonNullable = { label: "Datensatz", helpText: "Die Datensatzkopfzeile (Datensatzseite, Seitenvorschau, Leiste unten auf dem Telefon), als {\"pinned\": [...], \"more\": [...]}: Namen von Aktionen in der Datensatzkopfzeile oder ihrem Menü „Mehr“. Höchstens 3 angeheftet. os validate lehnt einen Namen ab, der keine Aktion dieses Objekts ist oder nicht auf der Datensatzseite platziert ist; ein solcher Name zeichnet nichts." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "Bearbeitungsmodus", helpText: "Absicht der Bearbeitungsinteraktion für Datensätze dieses Objekts. Fehlt sie, wählt der Renderer seinen eigenen Standard. Rendererübergreifende Absicht, keine Gestaltung.", diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts index 35b8e9d2293..4243b57951c 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts @@ -126,6 +126,8 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.mapping.fields.name.label": "5274417ff1ccaf01", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.object.fields.enable.feeds.label": "669c64671f632139", "metadataForms.object.fields.lifecycle.storage.shards.label": "739988affb36b2e0", "metadataForms.object.fields.name.label": "5274417ff1ccaf01", diff --git a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts index 717faabdd2f..7824b427eaa 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts @@ -18,8 +18,6 @@ */ export const esESGeneratedSourceHashes: Readonly> = { - "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", - "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "objects.sys_email.fields.cc_addresses.label": "02946d952cf15623", "objects.sys_email.fields.error.label": "786fed84bd8d5a32", "objects.sys_email.fields.message_id.label": "14cd089a4062f4b1", diff --git a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts index bd5845ad4af..ee6a52f9dd7 100644 --- a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const frMetadataForms: NonNullable = { label: "Enregistrement", helpText: "L’en-tête de l’enregistrement (page de l’enregistrement, aperçu latéral, barre du bas sur téléphone), sous la forme {\"pinned\": [...], \"more\": [...]} : noms d’actions placées dans l’en-tête de l’enregistrement ou son menu Plus. Au plus 3 épinglées. os validate refuse un nom qui n’est pas une action de cet objet ou qui n’est pas placé sur la page de l’enregistrement ; un tel nom n’affiche rien." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "Mode de modification", helpText: "Intention d’interaction de modification pour les enregistrements de cet objet. En l’absence de valeur, le moteur de rendu choisit sa propre valeur par défaut. Intention commune à tous les moteurs de rendu, et non un style.", diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts index af51a64f0b8..25a1038381c 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts @@ -147,6 +147,8 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", "metadataForms.mapping.fields.mode.label": "74dde5013435abdc", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.object.fields.description.label": "779a4342c8eb6707", "metadataForms.object.fields.fields.description.label": "779a4342c8eb6707", "metadataForms.object.fields.fields.expression.label": "cd1b52ad1588075e", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts index 736f15a6bd6..601a8fc4340 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts @@ -18,8 +18,6 @@ */ export const jaJPGeneratedSourceHashes: Readonly> = { - "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", - "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "objects.sys_email.fields.bcc_addresses.label": "8674899b7b6d5126", "objects.sys_email.fields.cc_addresses.label": "02946d952cf15623", "objects.sys_email.fields.message_id.label": "14cd089a4062f4b1", diff --git a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts index 69e0936fcc0..63df80934ae 100644 --- a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const koMetadataForms: NonNullable = { label: "레코드", helpText: "레코드 헤더(레코드 페이지, 측면 미리보기, 휴대폰 하단 바), {\"pinned\": [...], \"more\": [...]} 형식: 레코드 헤더나 그 「더 보기」 메뉴에 배치된 작업 이름. 고정은 최대 3개. os validate는 이 객체의 작업이 아니거나 레코드 페이지에 배치되지 않은 이름을 거부하며, 그런 이름은 아무것도 표시하지 않습니다." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "편집 모드", helpText: "이 객체 레코드의 편집 상호 작용 의도입니다. 없으면 렌더러가 자체 기본값을 고릅니다. 스타일이 아니라 렌더러 간 공통 의도입니다.", diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts index bcca80a75c0..0edc24143cc 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts @@ -90,6 +90,8 @@ export const koGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", diff --git a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts index dfca7b34b03..f63ae26910f 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const ptBRMetadataForms: NonNullable = label: "Registro", helpText: "O cabeçalho do registro (página do registro, pré-visualização lateral, barra inferior do celular), como {\"pinned\": [...], \"more\": [...]}: nomes de ações colocadas no cabeçalho do registro ou no seu menu Mais. No máximo 3 fixadas. O os validate recusa um nome que não é uma ação deste objeto ou que não está na página do registro; esse nome não desenha nada." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "Modo de edição", helpText: "Intenção de interação de edição para os registros deste objeto. Ausente, o renderizador escolhe seu próprio padrão. Intenção entre renderizadores, não estilo.", diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts index 07292e81d0f..2a5a8c75a6e 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts @@ -102,6 +102,8 @@ export const ptBRGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.object.fields.enable.feeds.label": "669c64671f632139", "metadataForms.object.fields.lifecycle.storage.shards.label": "739988affb36b2e0", "metadataForms.page.sections.layout.label": "7f508ea1bb2c3a6b", diff --git a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts index 545c5158f16..c04a7da9554 100644 --- a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const ruMetadataForms: NonNullable = { label: "Запись", helpText: "Заголовок записи (страница записи, боковой просмотр, нижняя панель на телефоне), в виде {\"pinned\": [...], \"more\": [...]}: имена действий в заголовке записи или его меню «Ещё». Не более 3 закреплённых. os validate отклоняет имя, которое не является действием этого объекта или не размещено на странице записи; такое имя ничего не показывает." }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "Режим редактирования", helpText: "Намерение по взаимодействию при редактировании записей этого объекта. Если отсутствует, отрисовщик выбирает своё значение по умолчанию. Намерение для всех отрисовщиков, а не оформление.", diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts index 5c50c2a2711..7437033fef6 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts @@ -90,6 +90,8 @@ export const ruGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts index de5e2a83ec7..e2e667bb54c 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts @@ -18,8 +18,6 @@ */ export const zhCNGeneratedSourceHashes: Readonly> = { - "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", - "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "objects.sys_email.fields.message_id.label": "14cd089a4062f4b1", "objects.sys_email_template.fields.id.label": "00b0385c9c152888", "objects.sys_exchange_rate.fields.id.label": "00b0385c9c152888", diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts index 3ce8c1442ec..f62e0db325d 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts @@ -608,6 +608,10 @@ export const zhHantMetadataForms: NonNullable label: "記錄", helpText: "記錄頁頭(記錄頁、側邊預覽、手機底欄),寫作 {\"pinned\": [...], \"more\": [...]}:放在記錄頁頭或其「更多」選單中的動作名稱。最多固定 3 個。os validate 會拒絕不是本物件動作、或未放在記錄頁上的名稱;這樣的名稱什麼也不顯示。" }, + "actionLayout.selection": { + label: "Selection", + helpText: "The selection bar a grid shows once two or more rows are selected, on every grid view of this object, as {\"pinned\": [...], \"more\": [...]}: action names placed at selection. At most 3 pinned; [] pins none, so every action, Delete included, goes to the bar's More. A view's own bulk action defs lead the bar. os validate refuses a name that is no action of this object or is not placed at selection; such a name draws nothing." + }, editMode: { label: "編輯方式", helpText: "該物件記錄的編輯互動意圖。留空則由呈現端自行選擇預設方式。這是跨呈現端的意圖宣告,不是樣式。", diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts index 24b354e83db..d53ddcc2955 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts @@ -88,6 +88,8 @@ export const zhHantGeneratedSourceHashes: Readonly> = { "metadataForms.knowledge_source.sections.records.label": "9e5814dbd123f1c1", "metadataForms.knowledge_source.sections.refresh.description": "79311cb3f9e55b89", "metadataForms.knowledge_source.sections.refresh.label": "1b63ae2e002930a6", + "metadataForms.object.fields.actionLayout.selection.helpText": "3647854e40367b07", + "metadataForms.object.fields.actionLayout.selection.label": "68d28c84b59e72b3", "metadataForms.report.fields.dateRange.allowCustomRange.helpText": "eb95a6b1536e22fd", "metadataForms.report.fields.dateRange.allowCustomRange.label": "a1fb0e1cf5fe5d8e", "metadataForms.report.fields.dateRange.defaultRange.helpText": "03ccdb24491c9b5f", diff --git a/scripts/sdui-manifest.record.json b/scripts/sdui-manifest.record.json index 2219b1d8872..79a6ad116a2 100644 --- a/scripts/sdui-manifest.record.json +++ b/scripts/sdui-manifest.record.json @@ -13,11 +13,11 @@ ], "source": "built-tree", "generator": "scripts/gen-sdui-manifest-node.mjs", - "generatedAt": "2026-11-27", - "sha256": "35af7307b195e14956e951fd116d04bf9546aab7ffca1bb40ee7b1ed7a8571ee", + "generatedAt": "2026-11-29", + "sha256": "27d0de797ebb0e46733d403007b66a11f1bac17388dd67660a2f793f8de9e297", "components": 106, "inTree": { "modulesRoot": "ui/apps/console", - "objectuiWorkspaceVersion": "19.0.0-next.0" + "objectuiWorkspaceVersion": "19.0.0-next.2" } } diff --git a/sdui.manifest.json b/sdui.manifest.json index ad3fa38746c..0ce48a4afa6 100644 --- a/sdui.manifest.json +++ b/sdui.manifest.json @@ -386,12 +386,6 @@ "of": "string", "description": "Names of the actions offered on each row's menu." }, - { - "name": "bulkActions", - "type": "array", - "of": "string", - "description": "Names of the actions offered once rows are selected. Needs a multi-row `selection`." - }, { "name": "bulkActionDefs", "type": "array", @@ -2052,7 +2046,8 @@ "record_page", "record_row", "record_related", - "record_section" + "record_section", + "selection" ], "description": "Which declared action location this bar renders" }, @@ -2713,7 +2708,8 @@ "record_page", "record_row", "record_related", - "record_section" + "record_section", + "selection" ], "description": "Render only the members whose `locations` include this location. Omit to render every member" }, From fb3430877f973d39c0a76eeffe6f5876416138f4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 08:50:35 +0000 Subject: [PATCH 8/9] docs(qa): the action-location matrix gains its selection leg (ACTION_LOCATIONS has seven words) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- docs/qa/platform-checklist/areas/records-forms.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/qa/platform-checklist/areas/records-forms.json b/docs/qa/platform-checklist/areas/records-forms.json index 7d7bab56c92..21b02e6b095 100644 --- a/docs/qa/platform-checklist/areas/records-forms.json +++ b/docs/qa/platform-checklist/areas/records-forms.json @@ -2222,10 +2222,10 @@ }, { "id": "records-forms.action-location-matrix", - "title": "Action buttons surface at exactly their declared locations — list, record (page and row), record_page (button or ⋯), record_row, record_related, record_section — and each dispatches for real", + "title": "Action buttons surface at exactly their declared locations — list, record (page and row), record_page (button or ⋯), record_row, record_related, record_section, selection — and each dispatches for real", "since": "v15", "status": "active", - "revision": 19, + "revision": 20, "priority": "P1", "surface": "browser", "personas": [ @@ -2254,6 +2254,7 @@ "record_row — showcase_quick_view / showcase_reopen_task / showcase_bulk_reassign in the row menu, and on no record page", "record_related — showcase_log_time on each row of the related-list section inside a record (the Tasks related list on a showcase_project record), and on no row of the showcase_task list view", "record_section — showcase_recalc_estimate in the Task Detail quick-actions bar (record:quick_actions resolves through the location filter)", + "selection — showcase_mark_done and showcase_recalc_estimate on the multi-select bar of every showcase_task grid view once two rows are selected (objectstack#36496: the actions are placed at selection; no view lists them), and in no list toolbar or row menu by that placement", "empty-locations semantics probe — an action with NO locations key renders on NO surface, and `locations: []` likewise (objectui#3142 collapsed the renderers onto one membership predicate, `actionRendersAt`; placement is a declaration, which is why recalc_selection has to name record_page)" ], "steps": [ @@ -2428,12 +2429,18 @@ "date": "2026-11-29", "change": "Re-derived for protocol 19's location words (#36495; ACTION_LOCATIONS in packages/spec/src/ui/action.zod.ts), read off the showcase fleet as it now declares them and off objectui's placement predicate (ui/packages/types/src/ui-action.ts actionRendersAt: record answers both record_page and record_row; a folded action is component 'action:menu'). The variants matrix is the six new words: list (bulk_reassign), record (mark_done, on the row menu and the title bar), record_page (log_time and archive_task as buttons; open_docs and recalc_selection folded under ⋯), record_row (quick_view, reopen_task, bulk_reassign), record_related and record_section unchanged. The title, fixtures.requires[0], knownGaps[1], the probe variant and acceptance[0], [1], [2], [4] say the same. Corrections the re-read found: showcase_recalc_estimate declares a folded record_page beside record_section (the authored header's id list leaves it out, so the desktop page draws it in the bar only); archive_task joins the fleet list; showcase_task declares no actionLayout. Until 19 the words were list_toolbar, list_item, record_header and record_more. No clause's assertion changed beyond the vocabulary", "ref": "#38046" + }, + { + "revision": 20, + "date": "2026-11-29", + "change": "ACTION_LOCATIONS gains its seventh word, selection (#36496): an action placed there is drawn on the multi-select bar of every grid view of its object, in the order the object's actionLayout.selection gives, and a list view's bulkActions is retired. The variants matrix adds the selection leg (showcase_mark_done and showcase_recalc_estimate, which the showcase now places at selection instead of listing them on the task bulk_actions view), the title names it, and enumSource.expect is 7. No other clause changed; the selection leg is not yet browser-run", + "ref": "#36496" } ], "enumSource": { "file": "packages/spec/src/ui/action.zod.ts", "export": "ACTION_LOCATIONS", - "expect": 6 + "expect": 7 } }, { From 6fee5a08a9ae2f18077d52a3ac86cdf66e404de6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 09:05:49 +0000 Subject: [PATCH 9/9] test(platform-objects): the metadata-form census counts the actionLayout.selection row Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK --- .../object-collapsed-sections-echo-decisions.test.ts | 8 ++++++-- .../object-lifecycle-panel-echo-decisions.test.ts | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/platform-objects/src/apps/translations/object-collapsed-sections-echo-decisions.test.ts b/packages/platform-objects/src/apps/translations/object-collapsed-sections-echo-decisions.test.ts index 234b7bd2f8e..f0239f65653 100644 --- a/packages/platform-objects/src/apps/translations/object-collapsed-sections-echo-decisions.test.ts +++ b/packages/platform-objects/src/apps/translations/object-collapsed-sections-echo-decisions.test.ts @@ -970,10 +970,14 @@ describe('#19403 round 8 — the population, DERIVED from the form and a shape', // 127 since #37402 gave `advanced` the object's whole-record hand lock // (`uiReadonlyWhen`) — a label and a help text, two leaves, all translated // leaves authored in every locale by that card. `advanced` reads 112 → 114. - expect(PANEL_LEAVES.length).toBe(127); + // 129 since #36496 gave the `actionLayout` composite its third row, + // `selection` (the multi-select bar's order) — a label and a help text, + // translated in zh-CN, ja-JP and es-ES by that card. `advanced` reads + // 114 → 116. + expect(PANEL_LEAVES.length).toBe(129); expect(PANEL_LEAVES.every((l) => l.prop === 'label' || l.prop === 'helpText')).toBe(true); expect(PANEL_LEAVES.filter((l) => l.section === 'capabilities').length).toBe(13); - expect(PANEL_LEAVES.filter((l) => l.section === 'advanced').length).toBe(114); + expect(PANEL_LEAVES.filter((l) => l.section === 'advanced').length).toBe(116); }); it('⭐ DARK, OUTWARD — the open sections are excluded, and `fields.placeholder` is the one that proves it', () => { diff --git a/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts b/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts index 4be5a90cb63..6dcb5cdf044 100644 --- a/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts +++ b/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts @@ -1354,8 +1354,9 @@ describe('#19403 round 10 — the verdicts, on the live bundles', () => { // whole-record hand lock), authored in every locale. // 866 since #37309: the `knowledge_source` form (ADR-0161 K4 clause 2) // — twenty of its section and row labels, authored in all three - // locales. - expect(translated.length, `${locale} positive control`).toBe(866); + // locales. 867 since #36496: the object form's `actionLayout.selection` + // row (the multi-select bar's order), authored in all three locales. + expect(translated.length, `${locale} positive control`).toBe(867); } // ⭐ DARK — the blindness, executable. On a synthetic two-locale catalog the // all-three predicate returns 0 while the per-locale one returns 1, so the