Repository navigation
Commit 8500ee7
feat(list): confirm a state-machine move before a list cell saves it; the drawer says when the record changed (#35972)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuKUos5dktPsiz4z1ihWMgNS)_
repo:objectstack#1 · os-sales · session_01L6bhgVhAK4uNYvjNY3H7XU
Fixes #35685
(slice S3, the last of three: the state-machine confirm and the drawer
sync. S1 #35864 and S2 #35898 are merged. Retiring `onBatchSave` stays
with #35827.)
Clause-②: yes (widening) — `GridCellSelection` in
`@object-ui/components` takes an optional `confirmCommit(row, columnKey,
value)` member; nothing removed or renamed
Metadata-protocol: none
Skills-docs: `content/docs/frontend/plugins/plugin-grid.mdx` — the "On
an object's list page" section gains two bullets (a state-machine field
asks first; the record drawer follows a list save and keeps a draft). No
skill under `skills/` teaches the list's save, so nothing there moves.
Follow-up: #35928 (the confirm names the automation that would run; the
ruling asked for a card, not this slice)
Flow: dev-thread rule (maintainer 2026-11-20 09:22:50Z): the card thread
builds itself; L1 by L1-a, the declaration L2 by the seat on the green
head.
## 维护者速读
- 列表页里改「状态」这类受状态机规则管的字段时,选好新值后会先弹出确认框:「更改状态?状态从 已暂停 改为
进行中,保存后可能触发相关自动化。」点「取消」什么都不保存,格子保持原值;点「确认更改」才保存。粘贴到这种格子也一样会先问。其他字段不弹框,照旧改完即存。
- 属于「列表行内编辑重做」专题,是逐格自动保存这张卡的最后一片;合并后 #35685 关闭。确认框里列出具体会触发哪些自动化,按裁定另开了卡
#35928。
-
记录抽屉开着时,列表里改了同一条记录,抽屉会跟着刷新显示新值;如果抽屉里正有没保存的修改,修改原样保留,并提示「此记录已在别处被修改……保存时以你的修改为准」,点保存不会报冲突,写在最新版本上。
- 无。
## What changes
**A state-machine move asks first** (`@object-ui/plugin-grid`,
`ObjectGrid`; only a grid with `cellSelection`, i.e. every grid
`ListView` draws).
- A field is a state-machine field when an active `state_machine`
validation rule of the object names it and its `events` cover `update`
(the spec default `['insert','update']` when absent). Severity does not
matter: a move along the machine is what related automation listens for,
blocking or not. Which moves are legal stays the server's call.
(`objectGridStateConfirm.ts`)
- A new value committed into such a cell (picked in its editor, or
pasted) opens an in-app confirm: title `Change {{field}}?`, body
`{{field}} changes from {{from}} to {{to}}. Saving may trigger related
automation.` (ruling 7039615827), buttons Cancel / Change. The values
are shown as their option labels as the host translates them, the stored
code when no option declares it, and the grid's `Empty` word for no
value.
- Cancel writes nothing: nothing is staged, nothing is sent, the cell
keeps what it showed. Change saves the value as any S1 commit is saved
(one guarded update). Focus goes back to the selected cell either way. A
second ask while one is open answers the first one No; unmounting the
grid answers No.
- A commit that changes nothing, and any cell the host does not ask
about, is written at once, as before.
**The generic seam** (`@object-ui/components`):
`GridCellSelection.confirmCommit` is asked at the table's commit point,
before a value that changes what the cell shows is staged or saved, for
the editor's commit (`saveEdit`) and for `commitCellValue` (paste,
toggle). A promise holds the write until it settles: `true` writes,
`false` or a rejection writes nothing; `null` / `undefined` means no
question. Only an autosaving select-first table asks; a table outside a
provider is byte-for-byte what it was. `exitEdit`'s snapshot revert is
factored out as `revertEditSession` so the held commit closes the editor
the way Esc does.
**The record drawer follows a list save** (`@object-ui/plugin-detail`,
`InlineEditSaveBar`). The drawer already re-reads the record when the
list saves it (the data-invalidation bus from S1), so the new value
shows. What is new: while an inline edit session is open and the record
is read again at another version, the save bar says so
(`detail.inlineEditRecordChanged`, a `role="status"` note). The draft
stays as typed and Save writes it with `If-Match` the version now read,
as before (the drawer's draft wins, as the brief asked); only the note
is new.
Strings: `grid.stateChange.{title,description,confirm,cancel}` and
`detail.inlineEditRecordChanged` in all eleven locale packs (zh-Hant
regenerated by `gen:zh-hant`), with English fallbacks in
`objectGridTranslations.ts` and `useDetailTranslation.ts`,
byte-identical to `en`.
## Acceptance notes
- The card's parts this slice owns, as the seat's S3 brief words them:
(1) a new state picked in a list cell for a state-machine field is
confirmed first, Cancel saves nothing; (2) the drawer follows a list
save, and when it holds unsaved edits the drawer wins and says so. Both
measured in the browser below.
- Reading I chose: the confirm does not list the flows that would run;
the ruling's words are "may trigger related automation", and naming the
flows is #35928.
- Reading I chose: at 375 px the list draws cards, not table cells, so
there is no list cell to commit into and no confirm there. The phone
list's own edit path is not this card.
- Platform checklist: no clause moves. `ux-conventions.write-feedback`
variants[1] edits a Priority cell (no state machine), and its steps[4]
already says the grid editor offers only legal moves.
## Tests
-
`ui/packages/components/src/__tests__/data-table-autosave-35685.test.tsx`,
new block "a commit the host asks to confirm first": No writes nothing,
the editor closes, focus returns to the cell; Yes gives exactly one
update of that cell; a paste is asked as an editor commit is; an
unchanged commit and a cell the host does not ask about are not held.
-
`ui/packages/plugin-grid/src/__tests__/ObjectGrid.autosave-35685.test.tsx`,
new block: the dialog names the field and both labels and says
automation may run, Cancel sends nothing; Change sends one guarded
update; a field with no machine, and an inactive machine, is not asked;
a machine bound to `insert` alone is not asked; a warning-severity
machine is asked (round 1).
- `ui/packages/plugin-detail/src/__tests__/InlineEditSaveBar.test.tsx`,
new block: the note appears when the record is read again at another
version during the session, the draft is kept and Save sends `ifMatch`
the new version; no note while the version is the one the edit began on,
nor in the next session.
Ablation (committed first, mutated through
`scripts/ablation-replace.mjs`, restored to the HEAD blob with `git diff
HEAD` empty):
- `commitConfirmationOf` returns `null` unconditionally → 6 failed / 27
passed across the two confirm files; restored → green.
- the save bar's note never rendered → 2 failed / 9 passed in
`InlineEditSaveBar.test.tsx`; restored → green.
- round 1: `isStateMachineField` returns `true` instead of reading
`events` → "a machine bound to insert alone" fails (1 failed / 17
passed); it refuses a `severity: 'warning'` rule → "an advisory
(warning-severity) machine still asks" fails (1 / 17); each restored →
18/18.
Migrated or voided: none.
## Review round 1 (head `c904bd92`, after `1ef49fae`)
- L2 7055688534 F2 should-fix: two cases added to the `ObjectGrid` block
(insert-only machine not asked; warning-severity machine asked), so the
`events.includes('update')` branch and the ignored severity are both
measured; ablated as above. F3 nit: the `confirmCommit` JSDoc now says
only a table wired with `onRowSave` asks, and one on `onBatchSave` alone
never does. F4 nit left, as the seat ruled.
- L2 F1 should-fix, traced in the browser (log `f1-trace.log` beside the
other evidence; every `fetch` to the object wrapped to print its call
stack): with the list alone, a confirmed list cell save sends exactly
one request, the `PATCH`, and no read. With the record drawer open on
the same row, the `PATCH` is followed by three requests, all for that
one record: `GET
/api/v1/data/showcase_project?populate=…&top=1&filter=["id","=","<the
record id>"]` (the adapter's `findOne` with `$expand`, `readOne` →
`rawFindWithPopulate`, which reads one record through the collection
route), `POST …/<id>/page` and `GET …/<id>/field-access`. That is the
drawer re-reading its own record, which is the drawer sync this slice
delivers; it is not S2's related-grid re-read (7042779557) and not a
reload of the list's other rows. S1's acceptance holds; nothing to file.
- Local on `c904bd92`: `ObjectGrid.autosave-35685` 18/18; eslint on the
two changed files 0 errors; `check:nul-bytes` exit 0; overlap-check
VERDICT clean.
## Verification
<details><summary>Local runs</summary>
- `vitest` from `ui/`, one package at a time under `os-verify-lock.sh`
on head `44ec496a` (before the main merge): `plugin-grid` 294 files /
2562 tests passed; `plugin-detail` 393 / 3601 passed (1 file skipped);
`components` 493 / 4747 passed (1 file skipped); `plugin-list` 182 /
1971 passed; `i18n` 104 / 1956 passed with one red, the zh-Hant
generated-catalogue pin, fixed by running `gen:zh-hant` and re-run green
(11/11).
- After merging main (`1ef49fae`; conflicts only in the locale packs and
`useDetailTranslation.ts`, all adjacent additions, both sides kept,
zh-Hant regenerated): `app-shell` whole package 2356 files: the first
run read a stale `@objectstack/spec` dist (83 files red on exports main
had just added, e.g. `readFieldGroupMembership`); after rebuilding
`@objectstack/spec` those 83 files re-ran 83/83 passed (627 tests). The
confirm and drawer tests plus `i18n` and every `data-table` /
`ObjectGrid` / `InlineEditSaveBar` test file re-ran on the merged head:
184 files / 2496 tests passed.
- `type-check` (`tsc --noEmit`) for `@object-ui/components`,
`@object-ui/plugin-grid`, `@object-ui/plugin-detail`, `@object-ui/i18n`:
clean on the merged head (after rebuilding the packages' dependency
dists). `eslint` on every changed source and test file: 0 errors.
- `node scripts/pm/dispatch-gates.mjs --commands`: 73 families, each run
with its exit captured before any pipe. 71 ran on `8620e49e` (before the
zh-Hant regeneration and the main merge, which touch no gate input
beyond the locale packs) and 2 on the merged head
(`check:type-check-debt` under the verify lock, `vitest run scripts/`
under `ui/` with one worker), all exit 0. `--ran` on the merged head: 73
derived, 73 run, 0 NOT-MEASURED, 0 UNRUN.
- `node scripts/pm/overlap-check.mjs`: VERDICT clean (main and #35968,
#35918, #35910 merge cleanly).
- Changed lines about 640 vs the 3000 threshold: under.
</details>
<details><summary>Browser</summary>
`examples/app-showcase` (`objectstack dev --fresh --seed-admin`, own
port and temp DB) with the `ui/apps/console` Vite dev server over it,
headless Chromium, zh-CN, light and dark, desktop 1600×1000 and 375×812.
Project list, `status` (governed by `project_status_flow`):
- Pick 「进行中」 for a 「已暂停」 project: the confirm reads 「更改状态? 状态从 已暂停 改为
进行中,保存后可能触发相关自动化。」; 0 writes while it is open.
- Cancel: 0 writes, the cell still reads 「已暂停」, focus is back on the
cell.
- Again, Change: one `PATCH {"status":"active"}` with `If-Match`; the
cell reads 「进行中」.
- Dark theme: the same, the dialog in dark tokens.
- 375 px: the list draws cards; no table cells, no confirm (see
Acceptance notes).
- Drawer open on the record, list cell saved: the drawer re-reads and
shows the new status.
- Drawer with an unsaved owner draft, list cell saved: the draft is
kept, the note shows, the drawer's status follows the list; drawer Save
sends `PATCH {"owner":…}` with the latest `If-Match`, no 409.
- Not measured: Safari / WebKit (no WebKit build in the container).
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (eslint on the changed
files: 0 errors)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request. (The branch is the platform-assigned
`claude/project-thread-f8vhdm`, named in the claim.)
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. (the 维护者速读 block and
the maintainer's quotes are Chinese by the maintainer's standing rule)
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgVhAK4uNYvjNY3H7XU
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgVhAK4uNYvjNY3H7XU -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent e72f2aa commit 8500ee7
23 files changed
Lines changed: 644 additions & 16 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui/packages
- components/src
- __tests__
- context
- renderers/complex
- i18n/src/locales
- plugin-detail/src
- __tests__
- plugin-grid/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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
430 | 442 | | |
431 | 443 | | |
432 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
310 | 313 | | |
311 | 314 | | |
312 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2049 | 2049 | | |
2050 | 2050 | | |
2051 | 2051 | | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
2052 | 2056 | | |
2053 | 2057 | | |
2054 | 2058 | | |
| |||
2817 | 2821 | | |
2818 | 2822 | | |
2819 | 2823 | | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
2820 | 2838 | | |
2821 | 2839 | | |
2822 | 2840 | | |
| |||
2844 | 2862 | | |
2845 | 2863 | | |
2846 | 2864 | | |
| 2865 | + | |
2847 | 2866 | | |
2848 | 2867 | | |
2849 | 2868 | | |
| |||
2874 | 2893 | | |
2875 | 2894 | | |
2876 | 2895 | | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
2877 | 2950 | | |
2878 | 2951 | | |
2879 | 2952 | | |
| |||
2884 | 2957 | | |
2885 | 2958 | | |
2886 | 2959 | | |
2887 | | - | |
2888 | | - | |
2889 | | - | |
2890 | | - | |
2891 | | - | |
2892 | | - | |
2893 | | - | |
2894 | | - | |
2895 | | - | |
2896 | | - | |
2897 | | - | |
2898 | | - | |
2899 | | - | |
2900 | | - | |
| 2960 | + | |
| 2961 | + | |
2901 | 2962 | | |
2902 | 2963 | | |
2903 | 2964 | | |
| |||
3533 | 3594 | | |
3534 | 3595 | | |
3535 | 3596 | | |
3536 | | - | |
| 3597 | + | |
3537 | 3598 | | |
3538 | 3599 | | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
3539 | 3606 | | |
3540 | 3607 | | |
3541 | 3608 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
564 | 570 | | |
565 | 571 | | |
566 | 572 | | |
| |||
1646 | 1652 | | |
1647 | 1653 | | |
1648 | 1654 | | |
| 1655 | + | |
1649 | 1656 | | |
1650 | 1657 | | |
1651 | 1658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
534 | 540 | | |
535 | 541 | | |
536 | 542 | | |
| |||
1472 | 1478 | | |
1473 | 1479 | | |
1474 | 1480 | | |
| 1481 | + | |
1475 | 1482 | | |
1476 | 1483 | | |
1477 | 1484 | | |
| |||
0 commit comments