Skip to content
Merged
23 changes: 23 additions & 0 deletions .changeset/34391-action-answer-table-format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@objectstack/spec': minor
'@object-ui/core': patch
---

feat(spec): an action's answer fields gain a `table` format, so a per-row answer is drawn as rows, not raw JSON

Clause-②: yes (widening) — `format: 'table'` joins the field formats of `resultDialog.fields` and `preflight.fields`, and the field row gains `columns`; the only new refusals fall on the new value and the new key, and every action that parsed before still parses unchanged
Metadata-protocol: added

An action whose server answers a list of rows (adding several people, importing a CSV) can now say how to show it. A field in `resultDialog.fields` (or `preflight.fields`, which shares the row) takes `format: 'table'` with `columns`, one entry per cell: `{ path, label?, format? }`, where `path` is read in one element of the array.

**FROM → TO.** FROM: the answer's list could only be shown as a JSON block (`format: 'json'`). TO: `{ path: 'rows', format: 'table', columns: [{ path: 'email', label: 'Email' }, { path: 'reason', label: 'Reason' }] }` draws one row per element, one cell per column, in `columns` order, with the column `label` (or its `path`) as the header.

Refused at parse, each with a message that names the fix:

- `format: 'table'` without `columns`, or with an empty list. The columns are never guessed from the elements' keys.
- `columns` beside any other `format`, or on a field with no `format` (the dialog-level default is never `table`).
- `table` as a cell `format` (a table does not nest) and as the dialog-level `resultDialog.format` (a default carries no `columns`).

The renderer contract is stated on `resultDialog`. The console's table renderer is still to come: until it lands, a `table` field draws its label alone, and `columns` is marked `[PLANNED — not yet rendered]`.

`@object-ui/core`: the `ResultDialogSpec` / `ResultDialogFieldSpec` `format` members now derive from the contract, as their label members already do, so the console's action renderers keep type-checking against the widened set.
6 changes: 3 additions & 3 deletions content/docs/references/ui/action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
| **title** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
| **description** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
| **acknowledge** | `string \| Record<string, string>` | optional | Acknowledge button label, e.g. "I have saved this" |
| **format** | `Enum<'qrcode' \| 'code-list' \| 'secret' \| 'text' \| 'json'>` | optional | Default format for fields without their own format. Defaults to json when omitted. |
| **fields** | `{ path: string; label?: string \| Record<string, string>; format?: Enum<'qrcode' \| 'code-list' \| 'secret' \| 'text' \| 'json'> }[]` | optional | Which fields from result.data to render. Omit to dump full JSON. |
| **format** | `Enum<'qrcode' \| 'code-list' \| 'secret' \| 'text' \| 'json'>` | optional | Default format for fields without their own format: any field format but `table`, which needs the field's own `columns`. Defaults to json when omitted. |
| **fields** | `{ path: string; label?: string \| Record<string, string>; format?: Enum<'qrcode' \| 'code-list' \| 'secret' \| 'text' \| 'json' \| 'table'>; columns?: object[] }[]` | optional | Which fields from result.data to render. Omit to dump full JSON. A field with `format: 'table'` draws an array of objects as rows, one cell per entry of its `columns`, in order; the columns are never guessed from the elements' keys. |

### Nested Shape: `Action.preflight`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **read** | `{ url: string; method?: 'GET' }` | ✅ | The read request — the same-origin endpoint the preflight reads |
| **path** | `string` | optional | Dotted path selecting the sub-tree of the answer the preflight shows and seeds from, e.g. `data` in a `{ success, data }` envelope; omitted, the whole answer |
| **fields** | `{ path: string; label?: string \| Record<string, string>; format?: Enum<'qrcode' \| 'code-list' \| 'secret' \| 'text' \| 'json'> }[]` | optional | Which values of the selected answer the panel shows, in `resultDialog.fields`' row and format set. Omit to show the selected answer as JSON. |
| **fields** | `{ path: string; label?: string \| Record<string, string>; format?: Enum<'qrcode' \| 'code-list' \| 'secret' \| 'text' \| 'json' \| 'table'>; columns?: object[] }[]` | optional | Which values of the selected answer the panel shows, in `resultDialog.fields`' row and format set — `table` and its `columns` included, drawn by the same renderer contract. Omit to show the selected answer as JSON. |
| **seed** | `{ param: string; path: string }[]` | optional | Answer-to-param seeding: each entry writes the value at `path` in the selected answer into the named param, which the dialog draws read-only and submits as shown. Each param is seeded once. |

### Nested Shape: `Action.ai`
Expand Down
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/` | 223 | 212 | 6 | 0 | 5 |
| `ui/` | 224 | 213 | 6 | 0 | 5 |

## `ui/` — sites

Expand All @@ -32,7 +32,7 @@ classify and is not listed (it becomes reportable the day it grows its first sit
| File | Sites |
|---|---|
| `action-params.zod.ts` | 1 |
| `action.zod.ts` | 12 |
| `action.zod.ts` | 13 |
| `app.zod.ts` | 20 |
| `bulk-action.zod.ts` | 6 |
| `chart.zod.ts` | 8 |
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** | **223** |
| **total** | **224** |

## `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 223**, in 4 file(s).
**5 strip of 224**, 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** | **223** |
| **total** | **5** | **224** |

| Bucket | Sites |
|---|---|
Expand Down
32 changes: 28 additions & 4 deletions packages/spec/dropped-refinements.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"measured": {
"zod": "4.4.3",
"publishedSchemasWithDroppedRefinements": 266,
"droppedRefinementSites": 1090,
"droppedRefinementSites": 1114,
"refinementSitesThatDidProject": 728,
"refinementSitesWithNoJsonFormToCompare": 0
},
Expand Down Expand Up @@ -105,6 +105,8 @@
"manifest.actions.element.in.ai.outputSchema",
"manifest.actions.element.in.onSuccess",
"manifest.actions.element.in.params.element.in",
"manifest.actions.element.in.preflight.fields.element",
"manifest.actions.element.in.resultDialog.fields.element",
"manifest.agents.element.memory",
"manifest.agents.element.structuredOutput.schema",
"manifest.analyticsCubes.element.measures.valueType",
Expand Down Expand Up @@ -287,6 +289,8 @@
"data.options[1].manifest.actions.element.in.ai.outputSchema",
"data.options[1].manifest.actions.element.in.onSuccess",
"data.options[1].manifest.actions.element.in.params.element.in",
"data.options[1].manifest.actions.element.in.preflight.fields.element",
"data.options[1].manifest.actions.element.in.resultDialog.fields.element",
"data.options[1].manifest.agents.element.memory",
"data.options[1].manifest.agents.element.structuredOutput.schema",
"data.options[1].manifest.analyticsCubes.element.measures.valueType",
Expand Down Expand Up @@ -437,6 +441,8 @@
"options[1].manifest.actions.element.in.ai.outputSchema",
"options[1].manifest.actions.element.in.onSuccess",
"options[1].manifest.actions.element.in.params.element.in",
"options[1].manifest.actions.element.in.preflight.fields.element",
"options[1].manifest.actions.element.in.resultDialog.fields.element",
"options[1].manifest.agents.element.memory",
"options[1].manifest.agents.element.structuredOutput.schema",
"options[1].manifest.analyticsCubes.element.measures.valueType",
Expand Down Expand Up @@ -526,6 +532,8 @@
"data.packages.element.options[1].manifest.actions.element.in.ai.outputSchema",
"data.packages.element.options[1].manifest.actions.element.in.onSuccess",
"data.packages.element.options[1].manifest.actions.element.in.params.element.in",
"data.packages.element.options[1].manifest.actions.element.in.preflight.fields.element",
"data.packages.element.options[1].manifest.actions.element.in.resultDialog.fields.element",
"data.packages.element.options[1].manifest.agents.element.memory",
"data.packages.element.options[1].manifest.agents.element.structuredOutput.schema",
"data.packages.element.options[1].manifest.analyticsCubes.element.measures.valueType",
Expand Down Expand Up @@ -612,7 +620,9 @@
"data.actions.element.in",
"data.actions.element.in.ai.outputSchema",
"data.actions.element.in.onSuccess",
"data.actions.element.in.params.element.in"
"data.actions.element.in.params.element.in",
"data.actions.element.in.preflight.fields.element",
"data.actions.element.in.resultDialog.fields.element"
]
},
"api/ObjectDefinitionResponse": {
Expand All @@ -622,6 +632,8 @@
"data.actions.element.in.ai.outputSchema",
"data.actions.element.in.onSuccess",
"data.actions.element.in.params.element.in",
"data.actions.element.in.preflight.fields.element",
"data.actions.element.in.resultDialog.fields.element",
"data.defaultRowScope",
"data.fieldGroups",
"data.fields.out.valueType",
Expand Down Expand Up @@ -1125,6 +1137,8 @@
"actions.element.in.ai.outputSchema",
"actions.element.in.onSuccess",
"actions.element.in.params.element.in",
"actions.element.in.preflight.fields.element",
"actions.element.in.resultDialog.fields.element",
"defaultRowScope",
"fieldGroups",
"fields.out.valueType",
Expand Down Expand Up @@ -1364,7 +1378,9 @@
"actions.element.in",
"actions.element.in.ai.outputSchema",
"actions.element.in.onSuccess",
"actions.element.in.params.element.in"
"actions.element.in.params.element.in",
"actions.element.in.preflight.fields.element",
"actions.element.in.resultDialog.fields.element"
]
},
"kernel/OpsDomainModule": {
Expand Down Expand Up @@ -1488,6 +1504,8 @@
"operations.element.options[3].object.actions.element.in.ai.outputSchema",
"operations.element.options[3].object.actions.element.in.onSuccess",
"operations.element.options[3].object.actions.element.in.params.element.in",
"operations.element.options[3].object.actions.element.in.preflight.fields.element",
"operations.element.options[3].object.actions.element.in.resultDialog.fields.element",
"operations.element.options[3].object.defaultRowScope",
"operations.element.options[3].object.fieldGroups",
"operations.element.options[3].object.fields.out.valueType",
Expand All @@ -1512,6 +1530,8 @@
"object.actions.element.in.ai.outputSchema",
"object.actions.element.in.onSuccess",
"object.actions.element.in.params.element.in",
"object.actions.element.in.preflight.fields.element",
"object.actions.element.in.resultDialog.fields.element",
"object.defaultRowScope",
"object.fieldGroups",
"object.fields.out.valueType",
Expand Down Expand Up @@ -1568,6 +1588,8 @@
"options[3].object.actions.element.in.ai.outputSchema",
"options[3].object.actions.element.in.onSuccess",
"options[3].object.actions.element.in.params.element.in",
"options[3].object.actions.element.in.preflight.fields.element",
"options[3].object.actions.element.in.resultDialog.fields.element",
"options[3].object.defaultRowScope",
"options[3].object.fieldGroups",
"options[3].object.fields.out.valueType",
Expand Down Expand Up @@ -1703,7 +1725,9 @@
"in",
"in.ai.outputSchema",
"in.onSuccess",
"in.params.element.in"
"in.params.element.in",
"in.preflight.fields.element",
"in.resultDialog.fields.element"
]
},
"ui/ActionAi": {
Expand Down
24 changes: 23 additions & 1 deletion packages/spec/liveness/action.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
},
"resultDialog": {
"status": "live",
"note": "objectui one-shot result reveal {title,description,acknowledge,format,fields}."
"note": "objectui one-shot result reveal {title,description,acknowledge,format,fields}. `fields[].format: 'table'` and its `columns` (#34391) are PLANNED until the console reader #33187 lands (see `preflight.fields.columns`, the same row): the spec refuses the contradictions at parse, and the console draws a `table` row's label alone today."
},
"preflight": {
"status": "live",
Expand Down Expand Up @@ -325,6 +325,28 @@
"status": "live",
"verifiedAt": "2026-11-09",
"note": "Live with its container `preflight.fields`: the row's display format, from resultDialog's format set."
},
"columns": {
"status": "planned",
"verifiedAt": "2026-11-16",
"note": "PLANNED (spec card #34391; reader #33187, maintainer ruling A 6915677641). The cells of a `format: 'table'` row, `[{ path, label?, format? }]`, from the row builder `resultDialog.fields` shares (packages/spec/src/ui/action.zod.ts#actionAnswerFieldRow). Enforced at parse today: required by `table`, refused beside any other format (#refuseTableColumnContradictions), and a cell takes the field formats minus `table`. NOT yet drawn: the console's `ResultField` (ui/packages/app-shell/src/views/ActionResultDialog.tsx) has no `table` branch, so until #33187 lands a `table` row draws its label alone. Re-grade `live` in the PR that lands that renderer.",
"children": {
"path": {
"status": "planned",
"verifiedAt": "2026-11-16",
"note": "Planned with its container `preflight.fields.columns`: the dot path, in ONE element of the array, of the value a cell draws; a path that resolves to nothing draws an empty cell, and an element that is not an object draws as compact JSON text in its row's first cell."
},
"label": {
"status": "planned",
"verifiedAt": "2026-11-16",
"note": "Planned with its container `preflight.fields.columns`: the column header; omitted, the header is the column's `path`."
},
"format": {
"status": "planned",
"verifiedAt": "2026-11-16",
"note": "Planned with its container `preflight.fields.columns`: the cell format, the field formats minus `table` (refused at parse: a table does not nest); omitted, `text`. A value that does not fit the cell's format, whatever it is, draws as compact JSON text, and a missing value draws an empty cell (the `table` bullet of the `resultDialog` renderer contract)."
}
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/liveness/state-counts/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them.

| Type | live | exp | elsewhere | dead | planned | classified |
|---|---|---|---|---|---|---|
| `action` | 79 | 0 | 0 | 1 | 2 | 82 |
| `action` | 79 | 0 | 0 | 1 | 5 | 85 |
4 changes: 3 additions & 1 deletion packages/spec/scripts/strictness-ledger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ describe('site counting reads the AST, not the source text', () => {
// not counted.)
// (9 → 12 at #31840, which ADDED the `preflight`, `preflight.read` and
// `preflight.seed` strictObject sites.)
expect(countSites(at('ui/action.zod.ts'))).toBe(12);
// (12 → 13 at #34391, which ADDED the `table` column row's strictObject
// site, `ActionAnswerTableColumnSchema`.)
expect(countSites(at('ui/action.zod.ts'))).toBe(13);
});

it('counts a call the source wraps across lines (`z\\n .object({`)', () => {
Expand Down
Loading
Loading