Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit d2ce342

Browse files
feat(types,core,plugin-grid): retire the structured confirm arm — one confirm spelling (#4314) (#5209)
Maintainer ruling 2026-08-17 (ADR-0049 enforce-or-remove, remove arm): the structured `confirm` object had zero producers, no translation-bundle key, and its `message` OUTRANKED `confirmText` — the only spelling the bundle knows — so a dialog authored that way silently lost localization, while the `@deprecated` note in crud.ts steered authors INTO it. - types: `ActionSchema.confirm` is a `?: never` tombstone (repo convention, see complex.ts DashboardWidgetSchema); the Zod twin refuses any authored value instead of silently stripping it; the backwards `@deprecated` note on `confirmText` is gone. - core: ActionRunner reads only `confirmText`; `ActionDef.confirm` carries the same tombstone. `ConfirmationHandler` signature untouched — the runner now calls it without the options argument (fed only by this arm). - plugin-grid: resolveBulkActions drops the `confirm.message` fallback — spec's action surface carries only `confirmText`, so the branch read a key `objectDef.actions` can never deliver. - docs: enhanced-actions.mdx and schema-reference.md now teach `confirmText` (they were 4 of the surfaces steering authors into the retired spelling). Reopen condition (recorded on #4314): real demand for structured confirm dialogs returns the arm WITH its bundle keys designed in. Claude-Session: https://claude.ai/code/session_01RV6yuVCxymHYE16PL9vQkE Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7d900de commit d2ce342

10 files changed

Lines changed: 163 additions & 107 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
"@object-ui/types": minor
3+
"@object-ui/core": minor
4+
"@object-ui/plugin-grid": minor
5+
---
6+
7+
Retire the structured `confirm` object on actions (objectui#4314, maintainer ruling
8+
2026-08-17, ADR-0049 enforce-or-remove). `confirmText` is now the one confirm
9+
spelling — the only one the translation bundle can address
10+
(`{ns}.objects.{obj}._actions.{name}.confirmText`), matching `@objectstack/spec`'s
11+
action surface.
12+
13+
Breaking semantics (flagged `minor` per this repo's version-alignment policy):
14+
15+
- `@object-ui/types`: `ActionSchema.confirm` is a `?: never` tombstone — authoring
16+
it is now a tsc error, and the Zod twin rejects any authored value at parse time
17+
(it previously accepted the object). The backwards `@deprecated` note that
18+
steered authors from `confirmText` INTO the structured arm is gone.
19+
- `@object-ui/core`: `ActionRunner` no longer reads `confirm.message` (which used
20+
to outrank `confirmText`, untranslated). `ActionDef.confirm` carries the same
21+
`never` tombstone. The `ConfirmationHandler` signature is unchanged, but the
22+
runner now invokes it without the `options` argument.
23+
- `@object-ui/plugin-grid`: `resolveBulkActions` no longer falls back to
24+
`confirm.message` when promoting an object action — spec metadata can never
25+
deliver that key.
26+
27+
Nothing in the repo, the example apps, or the schema catalog authored the
28+
structured form (verified on the issue); a dialog authored that way silently lost
29+
localization. Reopen condition recorded on objectui#4314: real demand returns the
30+
arm WITH bundle keys designed in.

‎content/docs/api/schema-reference.md‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,7 @@ A powerful action definition supporting API calls, confirmations, dialogs, chain
620620
"api": "/api/orders",
621621
"method": "POST",
622622
"data": { "status": "submitted" },
623-
"confirm": {
624-
"title": "Submit Order?",
625-
"message": "This will send the order to the warehouse.",
626-
"confirmText": "Yes, Submit",
627-
"confirmVariant": "default"
628-
},
623+
"confirmText": "This will send the order to the warehouse.",
629624
"successMessage": "Order submitted successfully",
630625
"errorMessage": "Failed to submit order",
631626
"chain": [
@@ -656,7 +651,7 @@ A powerful action definition supporting API calls, confirmations, dialogs, chain
656651
| `api` | `string` | API endpoint for `ajax` actions. |
657652
| `method` | `string` | HTTP method: `"GET"`, `"POST"`, `"PUT"`, `"DELETE"`, `"PATCH"`. |
658653
| `data` | `any` | Request body data. |
659-
| `confirm` | `object` | Confirmation dialog with `title`, `message`, `confirmText`, `cancelText`. |
654+
| `confirmText` | `string` | Confirmation message shown before executing — the one confirm spelling, addressed by the translation bundle. (A structured `confirm` object was retired in objectui#4314.) |
660655
| `dialog` | `object` | Modal dialog with `title`, `content`, `size`, `actions`. |
661656
| `chain` | `ActionSchema[]` | Actions to execute after this action completes. |
662657
| `chainMode` | `"sequential" \| "parallel"` | How chained actions execute. |

‎content/docs/core/enhanced-actions.mdx‎

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,19 @@ const confirmAction: ActionSchema = {
8080
type: 'action',
8181
label: 'Delete Record',
8282
actionType: 'confirm',
83-
confirm: {
84-
title: 'Confirm Deletion',
85-
message: 'Are you sure you want to delete this record?',
86-
confirmText: 'Yes, Delete',
87-
cancelText: 'Cancel',
88-
confirmVariant: 'destructive'
89-
},
83+
confirmText: 'Are you sure you want to delete this record?',
9084
api: '/api/records/123',
9185
method: 'DELETE'
9286
};
9387
```
9488

9589
**Confirm Properties:**
96-
- `title` - Dialog title
97-
- `message` - Confirmation message
98-
- `confirmText` - Confirm button text
99-
- `cancelText` - Cancel button text
100-
- `confirmVariant` - Button style
90+
- `confirmText` - Confirmation message shown in the dialog. This is the one
91+
confirm spelling — it is what the translation bundle addresses
92+
(`{ns}.objects.{obj}._actions.{name}.confirmText`), matching
93+
`@objectstack/spec`'s action surface. A structured `confirm` object
94+
(`{ title, message, ... }`) was retired in objectui#4314: it had no
95+
translation key, so its dialogs could never be localized.
10196

10297
### Dialog Actions
10398

@@ -231,10 +226,7 @@ const conditionalAction: ActionSchema = {
231226
type: 'action',
232227
label: 'Require Manager Approval',
233228
actionType: 'confirm',
234-
confirm: {
235-
title: 'Manager Approval Required',
236-
message: 'Amount exceeds $1000. Manager approval needed.'
237-
}
229+
confirmText: 'Amount exceeds $1000. Manager approval needed.'
238230
},
239231
else: {
240232
type: 'action',
@@ -348,12 +340,7 @@ const complexAction: ActionSchema = {
348340
349341
// Confirm before processing
350342
actionType: 'confirm',
351-
confirm: {
352-
title: 'Confirm Order',
353-
message: 'Process this order for ${data.customerName}?',
354-
confirmText: 'Process Order',
355-
confirmVariant: 'default'
356-
},
343+
confirmText: 'Process this order for ${data.customerName}?',
357344
358345
// Conditional logic
359346
condition: {

‎packages/core/src/actions/ActionRunner.ts‎

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,22 @@ export interface ActionDef {
142142
* it — the two TS2353s the deletion produced repo-wide were both this key.
143143
*/
144144
description?: UIActionSchema['description'];
145-
/** Confirmation text — shows a confirm dialog before executing */
145+
/**
146+
* Confirmation text — shows a confirm dialog before executing. The ONE
147+
* confirm spelling: `@objectstack/spec`'s action surface and the
148+
* TranslationBundle key (`{ns}.objects.{obj}._actions.{name}.confirmText`)
149+
* both stand on it.
150+
*/
146151
confirmText?: string;
147-
/** Structured confirmation (from crud.ts) */
148-
confirm?: { title?: string; message?: string; confirmText?: string; cancelText?: string };
152+
/**
153+
* RETIRED (objectui#4314): the structured confirm object used to sit here
154+
* and its `message` OUTRANKED `confirmText` — untranslated, since no bundle
155+
* key exists for it. `?: never` so constructing an action with it is a tsc
156+
* error rather than a silently-ignored key; the authorable twin
157+
* (`@object-ui/types` `crud.ts`) carries the same tombstone.
158+
* @deprecated Retired — author `confirmText` instead.
159+
*/
160+
confirm?: never;
149161
/**
150162
* Condition predicate — the action executes only while it holds.
151163
*
@@ -967,16 +979,14 @@ export class ActionRunner {
967979
}
968980
}
969981

970-
// Confirmation (structured or simple)
971-
const confirmMessage = action.confirm?.message || action.confirmText;
972-
if (confirmMessage) {
982+
// Confirmation. One spelling: `confirmText` — the only one the
983+
// translation bundle can address (`…._actions.{name}.confirmText`). The
984+
// structured `confirm.message` read that used to OUTRANK it is retired
985+
// (objectui#4314): it had zero producers and no bundle key, so a dialog
986+
// authored that way silently lost localization.
987+
if (action.confirmText) {
973988
const confirmed = await this.confirmHandler(
974-
this.evaluator.evaluate(confirmMessage) as string,
975-
action.confirm ? {
976-
title: action.confirm.title,
977-
confirmText: action.confirm.confirmText,
978-
cancelText: action.confirm.cancelText,
979-
} : undefined,
989+
this.evaluator.evaluate(action.confirmText) as string,
980990
);
981991
if (!confirmed) {
982992
return { success: false, error: 'Action cancelled by user' };

‎packages/core/src/actions/__tests__/ActionRunner.test.ts‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ describe('ActionRunner', () => {
166166
onClick,
167167
});
168168

169-
expect(confirmHandler).toHaveBeenCalledWith('Are you sure?', undefined);
169+
expect(confirmHandler).toHaveBeenCalledWith('Are you sure?');
170170
expect(result.success).toBe(true);
171171
expect(onClick).toHaveBeenCalledOnce();
172172
});
@@ -186,25 +186,25 @@ describe('ActionRunner', () => {
186186
expect(onClick).not.toHaveBeenCalled();
187187
});
188188

189-
it('should support structured confirmation', async () => {
190-
const confirmHandler = vi.fn().mockResolvedValue(true);
189+
it('ignores the retired structured confirm object (objectui#4314)', async () => {
190+
const confirmHandler = vi.fn().mockResolvedValue(false);
191191
runner.setConfirmHandler(confirmHandler);
192192

193-
await runner.execute({
194-
confirm: {
195-
title: 'Delete',
196-
message: 'Delete this item?',
197-
confirmText: 'Yes, delete',
198-
cancelText: 'Cancel',
199-
},
200-
onClick: vi.fn(),
201-
});
193+
const onClick = vi.fn();
194+
// Metadata that still carries the retired arm (e.g. stored before the
195+
// retirement) — cast, because `ActionDef.confirm` is a `never` tombstone
196+
// and the key cannot be AUTHORED in TypeScript at all.
197+
const result = await runner.execute({
198+
confirm: { title: 'Delete', message: 'Delete this item?' },
199+
onClick,
200+
} as unknown as ActionDef);
202201

203-
expect(confirmHandler).toHaveBeenCalledWith('Delete this item?', {
204-
title: 'Delete',
205-
confirmText: 'Yes, delete',
206-
cancelText: 'Cancel',
207-
});
202+
// No confirm gate: the runner reads only `confirmText`. Under the old
203+
// precedence read, the REJECTING handler above would have cancelled the
204+
// action — success here is what pins the read's removal.
205+
expect(confirmHandler).not.toHaveBeenCalled();
206+
expect(result.success).toBe(true);
207+
expect(onClick).toHaveBeenCalledOnce();
208208
});
209209
});
210210

‎packages/plugin-grid/src/__tests__/resolveBulkActions.test.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('resolveBulkActions', () => {
151151
name: 'push_down',
152152
icon: 'send',
153153
variant: 'danger',
154-
confirm: { message: '确认下推?' },
154+
confirmText: '确认下推?',
155155
visible: { dialect: 'cel', source: 'current_user.is_admin' },
156156
};
157157
const { defs } = resolveBulkActions({
@@ -167,6 +167,20 @@ describe('resolveBulkActions', () => {
167167
});
168168
});
169169

170+
// [objectui#4314] The structured `confirm` object is retired. Spec's action
171+
// surface carries only `confirmText`, so `objectDef.actions` can never
172+
// deliver this key — and the fallback read that used to sit in
173+
// `toBulkActionDef` was the last thing keeping the second dialect alive.
174+
it('ignores the retired structured confirm object (objectui#4314)', () => {
175+
const stale = { name: 'push_down', confirm: { message: '确认下推?' } };
176+
const { defs } = resolveBulkActions({
177+
bulkActions: ['push_down'],
178+
objectActions: [stale],
179+
});
180+
181+
expect(defs[0].confirmText).toBeUndefined();
182+
});
183+
170184
// [objectui#3492] The capability gate must travel with the promoted action:
171185
// the bar renders defs, not `ActionDef`s, so a dropped declaration is the
172186
// whole gate — the same action that the row kebab hides from an unentitled

‎packages/plugin-grid/src/resolveBulkActions.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ function toBulkActionDef(action: NamedActionDef, localize?: ActionLabelResolver)
118118
const variant = typeof action.variant === 'string' && BULK_VARIANTS.has(action.variant)
119119
? (action.variant as BulkActionDef['variant'])
120120
: undefined;
121-
const confirmText =
122-
typeof action.confirmText === 'string'
123-
? action.confirmText
124-
: typeof (action.confirm as { message?: unknown } | undefined)?.message === 'string'
125-
? String((action.confirm as { message: string }).message)
126-
: undefined;
121+
// `confirmText` only. The structured `confirm.message` fallback that used to
122+
// sit here is retired (objectui#4314): spec's action surface carries no
123+
// structured confirm, so the branch read a key `objectDef.actions` can never
124+
// deliver — and tolerating it kept a second confirm dialect alive (#0.1).
125+
const confirmText = typeof action.confirmText === 'string' ? action.confirmText : undefined;
127126
// A non-string `I18nLabel` (the `{ en, zh }` map form) is dropped rather than
128127
// forwarded: the bar renders `def.label` as a React child, so an object here
129128
// would take the page down. Falling through to `formatActionLabel(name)`

‎packages/types/src/__tests__/phase2-schemas.test.ts‎

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
AnyComponentSchema,
3030
ListViewSchema,
3131
} from '../zod/index.zod';
32+
import type { ActionSchema as CrudActionSchema } from '../crud';
3233

3334
describe('Phase 2: AppComponentSchema Zod Validation', () => {
3435
it('should validate a complete AppComponentSchema', () => {
@@ -360,13 +361,7 @@ describe('Phase 2: Enhanced ActionSchema Zod Validation', () => {
360361
type: 'action',
361362
label: 'Delete Record',
362363
actionType: 'confirm',
363-
confirm: {
364-
title: 'Confirm Deletion',
365-
message: 'Are you sure you want to delete this record?',
366-
confirmText: 'Delete',
367-
cancelText: 'Cancel',
368-
confirmVariant: 'destructive',
369-
},
364+
confirmText: 'Are you sure you want to delete this record?',
370365
api: '/api/records/123',
371366
method: 'DELETE',
372367
};
@@ -375,6 +370,41 @@ describe('Phase 2: Enhanced ActionSchema Zod Validation', () => {
375370
expect(result.success).toBe(true);
376371
});
377372

373+
it('refuses the retired structured confirm object (objectui#4314)', () => {
374+
const structured = {
375+
type: 'action',
376+
label: 'Delete Record',
377+
actionType: 'confirm',
378+
confirm: { title: 'Confirm Deletion', message: 'Are you sure?' },
379+
};
380+
381+
// Zod half of the `crud.ts` `confirm?: never` tombstone: any authored
382+
// value is a LOUD parse rejection — never a silent strip, which would let
383+
// the author believe the dialog they configured exists. Absent stays
384+
// valid (accept case above).
385+
const result = ActionSchema.safeParse(structured);
386+
expect(result.success).toBe(false);
387+
if (!result.success) {
388+
expect(result.error.issues.map((i) => i.path.join('.'))).toContain('confirm');
389+
}
390+
});
391+
392+
it('carries the retirement to TypeScript authors (confirm is `never`)', () => {
393+
const action: CrudActionSchema = {
394+
type: 'action',
395+
label: 'Delete',
396+
// @ts-expect-error `confirm` is retired (objectui#4314) — its `message`
397+
// outranked `confirmText`, the only spelling the translation bundle
398+
// knows. `?: never` carries the retirement to authors writing
399+
// TypeScript; the Zod refusal above carries it to JSON.
400+
confirm: { message: 'Delete this item?' },
401+
};
402+
// The contract lives in the directive above: per this package's
403+
// `type-check` (tsc -p tsconfig.test.json compiles every test file),
404+
// putting the key back makes the directive unused and fails the build.
405+
expect(action.type).toBe('action');
406+
});
407+
378408
it('should validate dialog action type', () => {
379409
const dialogAction = {
380410
type: 'action',

‎packages/types/src/crud.ts‎

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -131,33 +131,26 @@ export interface ActionSchema extends BaseSchema {
131131
*/
132132
headers?: Record<string, string>;
133133
/**
134-
* Confirmation dialog configuration (for confirm actions)
135-
*/
136-
confirm?: {
137-
/**
138-
* Confirmation title
139-
*/
140-
title?: string;
141-
/**
142-
* Confirmation message
143-
*/
144-
message?: string;
145-
/**
146-
* Confirm button text
147-
*/
148-
confirmText?: string;
149-
/**
150-
* Cancel button text
151-
*/
152-
cancelText?: string;
153-
/**
154-
* Confirm button variant
155-
*/
156-
confirmVariant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost';
157-
};
158-
/**
159-
* Legacy confirmation message (deprecated - use confirm object instead)
160-
* @deprecated Use confirm.message instead
134+
* RETIRED (objectui#4314, maintainer ruling 2026-08-17, ADR-0049
135+
* enforce-or-remove): the structured confirm object
136+
* (`{ title, message, confirmText, cancelText, confirmVariant }`) had zero
137+
* producers, and in `ActionRunner` its `message` OUTRANKED `confirmText` —
138+
* the only spelling the translation bundle knows
139+
* (`{ns}.objects.{obj}._actions.{name}.confirmText`) — so a dialog authored
140+
* this way silently lost localization. `?: never` is this package's
141+
* tombstone convention (see `complex.ts` `DashboardWidgetSchema`): authoring
142+
* the key is a tsc error here and a parse rejection in the Zod twin
143+
* (`zod/crud.zod.ts`); reading it still type-checks (`never | undefined`)
144+
* during migration. Reopen condition, recorded on objectui#4314: real demand
145+
* for structured confirm dialogs — the arm returns WITH its bundle keys
146+
* (`_actions.{name}.confirm.*`) designed in, never before.
147+
* @deprecated Retired — author `confirmText` instead.
148+
*/
149+
confirm?: never;
150+
/**
151+
* Confirmation message — shows a confirm dialog before executing.
152+
* The ONE confirm spelling: `@objectstack/spec`'s action surface and the
153+
* TranslationBundle both stand on `confirmText`.
161154
*/
162155
confirmText?: string;
163156
/**

0 commit comments

Comments
 (0)