Repository navigation
Commit 17acfbb
feat(core,app-shell,plugin-view,i18n): the delete confirmation names the record and confirms with a destructive Delete (objectui#11695) (#11744)
Fixes #11695
Clause-②: yes
Session: `https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8`
(os-dev seat `domain:ui#3`, PM loop round 1).
## What changes
A record delete confirmation now names what it deletes and confirms with
a destructive "Delete" button:
- **One record:** the title names the object label and the record's
display name. en: `Delete Product "QA Widget 0"?`. zh: `删除Product“QA
Widget 0”?`.
- **A selection:** the title counts it: `Delete 3 Product records?` (zh
`删除 3 条 Product 记录?`).
- **Confirm button:** it reads "Delete" (zh 删除) and is painted with
`buttonVariants({ variant: 'destructive' })`.
- **Body:** unchanged. It is the plain delete question, the batch
question, or ADR-0094's reset question for a package-owned permission
set.
Every delete dialog takes this copy from one builder,
`recordDelete.confirmCopy(deps, target)` in `@object-ui/core`. It sits
beside the existing `confirmText`, which is now its one-record body. The
name comes from `getRecordDisplayName`, the ADR-0079 resolver the record
page already uses for its title. Each host passes its object definition,
so a declared `nameField` wins.
| Surface | Producer | What it does now |
|---|---|---|
| Console object list, row Delete and bulk Delete (the card's repro) |
`@object-ui/app-shell` `useObjectActions`, called by app-shell
`ObjectView` | `deleteRecord` and the new `deleteRecords` ask
`onConfirm` with the copy and `destructive: true`, then run the delete
through the runner with no `confirmText` |
| Record page Delete | `@object-ui/app-shell` `RecordDetailView`, the
`sys_delete` header action | Same copy, read from the readable row (a
denied name field reads as absent). A package-owned permission set now
gets the reset question here too |
| Registered `object-view` grid Delete | `@object-ui/plugin-view`
`ObjectView`, `deleteConfirmDialog` | Same copy, with the confirm button
painted destructive |
| The console's confirm dialog | `@object-ui/app-shell`
`ActionConfirmDialog` | Paints its confirm button destructive when
`options.destructive` is set. Its options type is now the published
`ConfirmationHandler` options, not a copy |
The `ConfirmationHandler` options in `@object-ui/core` gain
`destructive?: boolean`. Every other confirmation keeps "Confirm Action"
/ "Continue" in the primary style. The `actionConfirm.*` text is
unchanged.
`packages/components/src/ui/alert-dialog.tsx` is not touched (No-Touch
zone, AGENTS.md #7). The destructive style is a className override at
each call site. objectui#8978's `actionVariant` uses the same approach
in the `alert-dialog` renderer.
## Premise check on origin/main `0cfe772`, hypothesis by hypothesis
1. plugin-view's `deleteConfirmDialog` used `actionConfirm.title` /
`actionConfirm.confirm`, with `recordDelete.confirmText` as the body.
**Held.**
2. `actionConfirm.title` / `.confirm` are shared. **Held.**
`ActionConfirmDialog` falls back to them for every action-runner
confirmation. Their text is unchanged; the delete has its own keys.
3. **The detail page's producer** is `RecordDetailView` in
`packages/app-shell`, not `packages/plugin-detail`. Its `sys_delete`
action asked `detail.deleteConfirmation` through the page's confirm
handler with one argument.
- **The card's repro path (console list, row menu, Delete) never reaches
plugin-view.** The console list's `onDelete` calls
`useObjectActions.deleteRecord`, which handed the action runner a
`confirmText`.
- The runner calls the confirm handler with one argument. So the console
dialog could only ever show its generic title and "Continue".
- Both producers are changed here. The record page falls under the
claim's "the dev locates it" clause. The console list's producer adds
three app-shell files: `useObjectActions.ts`, `ActionConfirmDialog.tsx`
and `ObjectView.tsx`.
4. The title resolver exists: `getRecordDisplayName`
(`@object-ui/core`). **Reused**, no new resolver.
5. objectui#11728 (`objectPluralLabel`) was still open when this was
built (REST read before implementation: `merged: false`). So the batch
title uses the singular label with a count family that mirrors
`objectActions.bulkDeleteSuccess` (`Delete 3 Product records?`). That is
the same shape as the toast that follows. It has merged since (main
`6be0f7a`). The Acceptance notes explain why this PR still keeps the
count-agreeing noun.
objectui#8978: the card body says it "added the destructive confirm
button to `alert-dialog`", and the triage says there is "no destructive
variant". Both are partly right:
- It added `actionVariant` to the `alert-dialog` **renderer**
(`packages/components/src/renderers/overlay/alert-dialog.tsx`), as a
className override.
- The `ui/alert-dialog.tsx` **primitive** still bakes in
`buttonVariants()` with no variant.
## Keys
- **New in all ten packs**, under `objectActions`:
- `deleteConfirmTitle` (`{{label}}`, `{{name}}`);
- the `bulkDeleteConfirmTitle` count family (`{{count}}`, `{{label}}`).
Each pack's slots mirror its own `bulkDeleteSuccess` family: es/fr/pt
`_many`, ru `_few`/`_many`, ar all six;
- `deleteConfirmButton`.
- **Unchanged:** no existing value changed and no key was removed.
- **plugin-view:** its English map for hosts without a translation
provider gains the new rows. It drops `actionConfirm.title` /
`.confirm`, which that host no longer asks for.
- **de quote census:** `de-quote-pairing-3876.test.ts` moves from 70 to
71 for the title's one matched „…“ pair.
The console list now passes its translated object label to
`useObjectActions` (`objectLabel(objectDef)`, the label its header
shows), so the delete toasts use that label too. With no translation
bundle it is `objectDef.label`, as before.
## Tests and gates
The package suites ran at `c8f5c14`. The final HEAD `c3110be` differs
from it only by a type annotation in one test file. The changed test
files and the app-shell type-check were re-run at `c3110be`.
| Check | HEAD | Result |
|---|---|---|
| `pnpm exec vitest run packages/app-shell/ --shard=N/4`, N = 1..4 |
`c8f5c14` | 259 + 259 + 259 + 259 files: 2435 (+1 skipped), 2309 (+8
skipped), 3021, 2440 tests passed; 0 failed |
| `pnpm exec vitest run packages/core/ packages/i18n/
packages/plugin-view/` | `c8f5c14` | 342 files, 5833 passed, 40 skipped,
0 failed |
| the six changed test files | `c3110be` | 6 files, 56 tests passed |
| `pnpm --filter @object-ui/core type-check` / `@object-ui/i18n` |
`c8f5c14` | exit 0 / exit 0 |
| `pnpm --filter @object-ui/plugin-view type-check` after `pnpm
--workspace-concurrency=2 --filter '@object-ui/plugin-view^...' build` |
`c8f5c14` | exit 0 |
| `pnpm --filter @object-ui/app-shell type-check` after building its
closure | `c3110be` | exit 0, both `tsc --noEmit` and `tsc -p
tsconfig.test.json`. Its `--listFiles` includes the three changed
app-shell tests |
| `pnpm exec eslint` over the 23 changed TS files | `c3110be` | 0
errors; 0 findings on added lines |
| `check:control-bytes`, `check:test-path-roots`,
`check:changeset-claims`, `check:pending-changeset-literals`,
`check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys`,
`check:i18n-designer-parity`, `check:new-line-citations`,
`scripts/check-changeset-presence.mjs` | `c3110be` | all exit 0 |
| `check:readme-exports` | `c3110be` | **NOT MEASURED.** The gate
refuses because 94 documented self-imports point into packages that are
not built. This diff adds exports and edits no README |
**Console compile: narrowed, not run.**
- `apps/console` resolves `@object-ui/*` through built `dist`; its
tsconfig has no `paths`.
- Its source names none of the changed symbols. A search for
`useObjectActions|ActionConfirmDialog|ConfirmDialogState|ConfirmationHandler|recordDelete`
in `apps/console/src` finds one hit, in a comment.
- The control search for `from '@object-ui/app-shell'` does find the
console's real imports.
- So the console reads only app-shell's emitted declarations, and that
source passes the type-check above.
## Reverse verification (ablation)
Every leg ran through objectstack's `scripts/ablation-replace.mjs` in
WRAP mode, which checks three things:
- the anchor must hit;
- the file's blob must change;
- the restore is proven by the blob matching HEAD and an empty `git diff
HEAD`.
The expected direction for every leg was red.
| Leg | Mutation (anchor hit once, blob changed) | Result |
|---|---|---|
| 1, destructive paint | `ActionConfirmDialog`: the
`options.destructive` className replaced by `className={undefined}` | 6
failed, 4 passed. Red: the console list's row and batch in en and zh,
and the record page in en and zh, all on `bg-destructive`. The
primary-style controls stayed green |
| 2, delete label | `recordDelete.confirmCopy`: `deleteConfirmButton`
replaced by `actionConfirm.confirm` | 16 failed, 22 passed, across core
(copy mismatch), the console list, the record page and plugin-view (no
"Delete" button found) |
| 3, name field | `useObjectActions.deleteRecord`: `objectDef` dropped
from the copy's deps | 2 failed, 4 passed. The row title read `Delete
Product "SKU-1"?` (a record key) instead of the declared `nameField`
value |
| type-level | `RecordDetailView`: `destructive: true` misspelled
`destructiv` | `tsc --noEmit` reports TS2561 on that key against the
rebuilt `ConfirmationHandler` options |
## Acceptance notes
- **Plural label.** objectui#11728 landed after this was built, but the
batch title deliberately keeps "N {{label}} records" rather than "N
{{pluralLabel}}".
- With "records", count agreement lives in a pack noun that each
language inflects (ru записи/записей, ar six forms).
- A metadata plural label has one form per object, so it cannot agree
with a count.
- It is the same pattern as the toast that follows.
- Changing to "Delete 3 Products?" would only change pack values, not
code.
- **Bulk body.** The batch dialog's body is still
`console.objectView.bulkDeleteConfirm` ("Delete N selected records? This
cannot be undone."), so the title and the body both ask. The claim
limited locale edits to new delete keys, so no existing value was
changed.
- **Ask before `execute`.** `useObjectActions` now asks before
`execute`, so the hook's `loading` is false while the dialog is open. No
code in the repo reads that hook's `loading` or `error`. A cancel still
returns the runner's former `{ success: false, error: 'Action cancelled
by user' }`.
- **Nameless rows.** A row with no resolvable name shows the resolver's
English `Record #id` fallback, the same one every other surface shows.
- **Same class, not touched.** Recorded only, no card filed, carrier:
none:
- `plugin-detail` `DetailView` still deletes through the native
`window.confirm`, with the authorable `deleteConfirmation` or the
generic `detail.deleteConfirmation`. That is the drawer and panel detail
used by gantt rows and similar.
- app-shell's "delete saved view" confirm says "Delete" but uses the
primary style.
- After a package-owned permission set is reset, the record page's
delete still toasts "Record deleted". The list's shared
`recordDelete.run` toasts the reset. Not measured through a public entry
point.
- **plugin-view's label** is still the raw `objectSchema.label`, the one
its form titles and toasts already use.
- **Merge with current main** (`ded4494`) is textually clean (`git
merge-tree`). main's de pack quote count is unchanged since the base, so
the census pin does not collide.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2c876f0 commit 17acfbb
25 files changed
Lines changed: 761 additions & 87 deletions
File tree
- .changeset
- content/docs/guide
- packages
- app-shell/src
- hooks
- __tests__
- views
- core/src/actions
- __tests__
- i18n/src
- __tests__
- locales
- plugin-view/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
Lines changed: 179 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
Lines changed: 75 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
0 commit comments