Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changeset/34216-bulk-action-result.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@objectstack/spec': minor
---

feat(spec): `BulkActionResultSchema`, the per-row outcome an `execution: 'aggregate'` bulk action handler may resolve with

Clause-②: yes (widening) — a new optional public shape and its three exports (`BulkActionResultSchema`, `BulkActionResult`, `BulkActionResultParsed`) from `@objectstack/spec/ui`; nothing an author writes is accepted or refused differently
Metadata-protocol: added

An aggregate bulk action is ONE dispatch for the whole selection, with every id in `params._selectedIds`. A handler that writes row by row can move some rows and fail on others, and the action contract had no declared way to say which: the grid can only report one outcome for the selection.

`BulkActionResultSchema` (`@objectstack/spec/ui`, beside `BulkActionExecutionSchema`) declares that answer, ahead of its reader:

```ts
{ succeeded: string[]; failed: { id: string; message: string }[] }
```

- **[PLANNED — not enforced].** The console does not read this value yet; its reader is the grid's bulk reader, objectstack#34269. Until that lands, a resolved aggregate call is counted as covering every selected row, so **a handler that cannot cover the whole selection must still reject.**
- It is declared as the handler's whole RESOLVE value, never attached to a rejection: a rejection stays one outcome for the selection, because the `/actions` door carries no structured body on a script or flow handler's throw.
- It is not the data plane's batch answer: here `succeeded` and `failed` are the row lists, not counts, and a failure's reason is `message`.
- Once read, only for an `execution: 'aggregate'` dispatch: a value with neither member keeps the one-outcome report; a value with either member that does not parse is reported as unreadable, never as full success; members beyond the two lists carry no meaning.
- Ids must be dispatched `params._selectedIds`: an id outside the selection is dropped, a duplicate counts once, an id in both lists counts as failed, and a selected id in neither list is reported as not confirmed, never as succeeded.

FROM no declared per-row answer for an aggregate handler TO a declared, exported `BulkActionResultSchema` whose reader is objectstack#34269. Nothing to migrate, and nothing to change in a handler today: until the reader lands, keep rejecting when the whole selection is not covered.
10 changes: 5 additions & 5 deletions content/docs/references/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Protocol reference — every schema by module
navTitle: Protocol Reference
description: Every schema published by @objectstack/spec — 1665 schemas across 14 protocol modules
description: Every schema published by @objectstack/spec — 1666 schemas across 14 protocol modules
---

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
Expand Down Expand Up @@ -33,8 +33,8 @@ counts are sums of the rows they head. Regenerate with
| [Shared Protocol](/docs/references/shared) | 10 | 31 | Primitives used across every protocol — identifiers, HTTP, expressions, error maps, enums. |
| [Studio Protocol](/docs/references/studio) | 3 | 35 | Studio designer metadata — the authoring surfaces for the protocols above. |
| [System Protocol](/docs/references/system) | 40 | 297 | The runtime environment — logging, jobs, cache, metrics, notifications, i18n and compliance. |
| [UI Protocol](/docs/references/ui) | 16 | 176 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. |
| **Total** | **218** | **1665** | 14 protocol modules |
| [UI Protocol](/docs/references/ui) | 16 | 177 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. |
| **Total** | **218** | **1666** | 14 protocol modules |

---

Expand Down Expand Up @@ -385,7 +385,7 @@ The runtime environment — logging, jobs, cache, metrics, notifications, i18n a

## UI Protocol

**Source:** `packages/spec/src/ui/` · **Import:** `@objectstack/spec/ui` · **16 pages, 176 schemas**
**Source:** `packages/spec/src/ui/` · **Import:** `@objectstack/spec/ui` · **16 pages, 177 schemas**

Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer.

Expand All @@ -394,7 +394,7 @@ Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI lay
| [`action.zod.ts`](/docs/references/ui/action) | `Action`, `ActionAi`, `ActionLocation`, `ActionParam`, `ActionType`, `InlineAction` |
| [`action-params.zod.ts`](/docs/references/ui/action-params) | `ActionSession` |
| [`app.zod.ts`](/docs/references/ui/app) | `ActionNavItem`, `App`, `AppBranding`, `AppContextSelector`, `AppLandingEntry`, `ComponentNavItem`, `DashboardNavItem`, `DocNavItem`, `GroupNavItem`, `NavigationArea`, `NavigationContribution`, `NavigationItem`, `ObjectNavItem`, `PageNavItem`, `ReportNavItem`, `UrlNavItem` |
| [`bulk-action.zod.ts`](/docs/references/ui/bulk-action) | `BulkActionDef`, `BulkActionExecution`, `BulkActionOperation`, `BulkActionParam` |
| [`bulk-action.zod.ts`](/docs/references/ui/bulk-action) | `BulkActionDef`, `BulkActionExecution`, `BulkActionOperation`, `BulkActionParam`, `BulkActionResult` |
| [`chart.zod.ts`](/docs/references/ui/chart) | `ChartAggregate`, `ChartAggregateFunction`, `ChartAnnotation`, `ChartAxis`, `ChartConfig`, `ChartDrillDown`, `ChartGroupBy`, `ChartInteraction`, `ChartSeries`, `ChartType` |
| [`component.zod.ts`](/docs/references/ui/component) | `ActionButtonProps`, `ActionGroupProps`, `ActionIconProps`, `ActionMenuProps`, `ElementButtonProps`, `ElementDefinitionListProps`, `ElementFilterProps`, `ElementFormProps`, `ElementImageProps`, `ElementMetadataViewerProps`, `ElementNumberProps`, `ElementRecordPickerProps`, `ElementRepeaterProps`, `ElementTextInputProps`, `ElementTextProps`, `ObjectCalendarProps`, `ObjectFormProps`, `ObjectGanttProps`, `ObjectGridProps`, `ObjectKanbanProps`, `ObjectMapProps`, `ObjectMasterDetailFormProps`, `ObjectMetricProps`, `ObjectTimelineProps`, `ObjectTreeProps`, `PageAccordionProps`, `PageCardProps`, `PageContainerProps`, `PageHeaderProps`, `PageTabsProps`, `RecordActivityProps`, `RecordAlertAction`, `RecordAlertProps`, `RecordChatterProps`, `RecordDetailsProps`, `RecordHighlightsField`, `RecordHighlightsProps`, `RecordHistoryProps`, `RecordLineItemsProps`, `RecordPathProps`, `RecordQuickActionsProps`, `RecordReferenceRailProps`, `RecordRelatedListProps`, `ReferenceRailEntry` |
| [`dashboard.zod.ts`](/docs/references/ui/dashboard) | `Dashboard`, `DashboardHeader`, `DashboardHeaderAction`, `DashboardWidget`, `DashboardWidgetChartConfig`, `DashboardWidgetOptions`, `GlobalFilter`, `GlobalFilterOptionsFrom`, `WidgetActionType`, `WidgetColorVariant` |
Expand Down
25 changes: 23 additions & 2 deletions content/docs/references/ui/bulk-action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ action's own label, params and `visible`.
## TypeScript Usage

```typescript
import { BulkActionDefSchema, BulkActionExecutionSchema, BulkActionOperationSchema, BulkActionParamSchema } from '@objectstack/spec/ui';
import type { BulkActionDef, BulkActionExecution, BulkActionOperation, BulkActionParam } from '@objectstack/spec/ui';
import { BulkActionDefSchema, BulkActionExecutionSchema, BulkActionOperationSchema, BulkActionParamSchema, BulkActionResultSchema } from '@objectstack/spec/ui';
import type { BulkActionDef, BulkActionExecution, BulkActionOperation, BulkActionParam, BulkActionResult } from '@objectstack/spec/ui';

// Validate data
const result = BulkActionDefSchema.parse(data);
Expand Down Expand Up @@ -177,3 +177,24 @@ const result = BulkActionDefSchema.parse(data);

---

## BulkActionResult

[PLANNED — not enforced] The per-row outcome an `execution: 'aggregate'` bulk action handler MAY resolve with: `{ succeeded: [ids], failed: [{ id, message }] }` as its whole resolve value, never attached to a rejection (a rejection stays one outcome for the selection). The console does not read it yet, so until its reader lands a handler that cannot cover the whole selection must still reject: a resolved aggregate call is counted as covering every selected row. Not the data plane's batch answer: here `succeeded` and `failed` are row lists, not counts. Once read: a value with neither member keeps the one-outcome report; a value with either member that does not parse is reported as unreadable, never as full success; members beyond the two lists carry no meaning. Ids must be dispatched `params._selectedIds`: an id outside the selection is dropped, a duplicate counts once, an id in both lists counts as failed, and a selected id in neither list is reported as not confirmed, never as succeeded.

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **succeeded** | `string[]` | ✅ | Ids of the selected rows the handler wrote. Each must be one of the dispatched `params._selectedIds`. The planned reader will drop an id outside the selection, count a duplicate once, and count an id that is also in `failed` as failed. |
| **failed** | `({ id: string; message: string } & Record<string, any>)[]` | ✅ | One entry per selected row the handler did not write, each with its own reason (`message`, not `error`). The planned reader will drop an id outside `params._selectedIds` and count a duplicate once. |

### Nested Shape: `BulkActionResult.failed[number]`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **id** | `string` | ✅ | Id of a selected row the handler did not write: one of the dispatched `params._selectedIds`. |
| **message** | `string` | ✅ | Why this row was not written, as the person running the action should read it. |


---

10 changes: 5 additions & 5 deletions docs/audits/2026-07-unknown-key-strictness-ledger.counts/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `strict` column is the one the campaign schedules against; it counts both th

| Dir | Sites | strict | passthrough | catchall | strip |
|---|---|---|---|---|---|
| `ui/` | 221 | 212 | 4 | 0 | 5 |
| `ui/` | 223 | 212 | 6 | 0 | 5 |

## `ui/` — sites

Expand All @@ -34,7 +34,7 @@ classify and is not listed (it becomes reportable the day it grows its first sit
| `action-params.zod.ts` | 1 |
| `action.zod.ts` | 12 |
| `app.zod.ts` | 20 |
| `bulk-action.zod.ts` | 4 |
| `bulk-action.zod.ts` | 6 |
| `chart.zod.ts` | 8 |
| `component.zod.ts` | 81 |
| `dashboard.zod.ts` | 11 |
Expand All @@ -46,23 +46,23 @@ classify and is not listed (it becomes reportable the day it grows its first sit
| `sharing.zod.ts` | 1 |
| `view.zod.ts` | 59 |
| `widget.zod.ts` | 1 |
| **total** | **221** |
| **total** | **223** |

## `ui/` — open

Per file, how many of its sites still silently discard unknown keys. The `Class`
column that decides the bucket split is hand-written in the ledger; the arithmetic
over it is here.

**5 strip of 221**, in 4 file(s).
**5 strip of 223**, in 4 file(s).

| File | Strip | Sites |
|---|---|---|
| `action-params.zod.ts` | 1 | 1 |
| `app.zod.ts` | 1 | 20 |
| `view.zod.ts` | 2 | 59 |
| `widget.zod.ts` | 1 | 1 |
| **total** | **5** | **221** |
| **total** | **5** | **223** |

| Bucket | Sites |
|---|---|
Expand Down
Loading
Loading