Repository navigation
Commit bed8306
feat(console): an action's param dialog names its own submit verb (
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoHqHVEAxMpoiSQcTy1f7dFE)_
Fixes #28158
Refs #27944
Clause-②: yes (widening: `@object-ui/types` `UIActionSchema` and
`@object-ui/core` `ActionDef` gain the optional member `submitText`,
typed by derivation from the spec's `ActionSchema`; `@object-ui/i18n`
`useObjectLabel()` gains the resolver `actionSubmitText`; no key, route
or error code is added)
Metadata-protocol: none
## 维护者速读
- 改了什么:动作的参数对话框(例如 HotCRM 的「发送邮件」「记录通话」「记录会议」)的提交按钮,现在显示动作自己声明的
`submitText`(如「发送」「记录通话」),没声明时仍是「确认」,上传文件时仍是「上传中…」。翻译包里的
`_actions.ACTION.submitText` 优先,其次是作者写的多语言文本(按当前语言取),最后是作者写的字符串。Studio
的动作表单也能填这个键了,`os i18n extract` 会为带参数的动作生成它的翻译位。
- 为什么改:`submitText` 已在 #28188 写进 spec,但控制台一直画「确认」,作者写的按钮文字没人显示。
- 风险与回滚:只改按钮文字,提交逻辑不变;没写 `submitText` 的动作完全不变。回滚即 revert 本 PR。
- 先看:`ui/packages/app-shell/src/hooks/useConsoleActionRuntime.tsx` 与
`ui/packages/app-shell/src/views/RecordDetailView.tsx` 的
`paramCollectionHandler`(新增的 `submitText`
解析);`ui/packages/app-shell/src/views/ActionParamDialog.tsx`
提交按钮那一行;`packages/spec/liveness/action.json` 的 `submitText` 行。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/ActionParamDialog.submitText-28158.test.tsx
packages/app-shell/src/hooks/__tests__/useConsoleActionRuntime.submitText-28158.test.tsx
packages/app-shell/src/views/RecordDetailView.paramSubmitText-28158.test.tsx
packages/i18n/src/__tests__/useObjectLabel-actionSubmitText-28158.test.tsx`,预期
4 个文件、20 个测试全绿。
- 需要你做的:无,席位落地。
## What changes
**The dialog** (`ActionParamDialog.tsx`). `ParamDialogState` gains
`submitText?: string`, the already-resolved label. The submit button
draws it, falls back to `actionDialog.confirm` when it is absent or
empty, and still says `actionDialog.uploading` while a file param
uploads.
**Both param-collection handlers**
(`useConsoleActionRuntime.tsx#paramCollectionHandler`,
`RecordDetailView.tsx#paramCollectionHandler`) resolve it the way they
resolve `description`: `actionSubmitText(keyObject, action.name,
pickLocalized(action.submitText, language))`. So the bundle's
`objects.OBJECT._actions.ACTION.submitText`
(`globalActions.ACTION.submitText` for an object-less action) comes
first, then the authored inline locale map collapsed to the active
language, then the authored string.
**The resolver** (`@object-ui/i18n`
`useObjectLabel().actionSubmitText`), the sibling of
`actionDescription`, on the same `actionSuffixes` node rule (a bound
action never reads `globalActions`). Its member-count pin in
`useObjectLabel-identity-5564.test.tsx` goes from 28 to 29.
**Types.** `UIActionSchema.submitText?: SpecAction['submitText']` and
`ActionDef.submitText?: SpecActionInput['submitText']`, both derived.
`ACTION_DEF_KEYS` lists it, and the `SPEC_ACTION_KEYS` comment no longer
calls it inventory-only.
**The four action renderers** (`action:button`, `action:icon`,
`action:group`, `action:menu`) forward `submitText` to the runner.
`check:action-forward-parity` (ui) reds without this once the handlers
read the key: the key would be dropped one hop before the dialog.
`action-forward-precedence.test.tsx` lists it beside `description`.
**Spec rows.** `liveness/action.json` `submitText` flips `planned` →
`live` with these read points, and drops `authorWarn` / `authorHint` in
the same edit; `state-counts/action.md` regenerates. The `action` /
`submitText` omit row leaves `metadata-form-zod-reconciliation.test.ts`,
and `action.form.ts` gains a plain `submitText` row ("Submit button
label"), not gated on `params`, because the parse refuses the key beside
an empty `params` by name. The `platform-objects` metadata-forms bundles
regenerate (`node scripts/check-i18n-bundles.mjs --write`); the zh-CN /
ja-JP / es-ES values are hand-translated. The prose clause "(declared
ahead of its console reader: no renderer shows it yet)" leaves
`ActionSchema.submitText`'s `.describe()`, and "no renderer shows it
yet" leaves the translation slot's; `content/docs/references/**`
regenerates (`check:generated --fix`). The seat ruled that trim into
this PR. Nothing else in the schema changes.
**`os i18n extract`** (`packages/cli/src/utils/i18n-extract.ts`,
`pushActionSubmitText`). It scaffolds `submitText` under an action's
translation root only for an action with a non-empty `params`, the
population `translateAction` overlays it onto. It is
optional-not-derived like `description`, and there is no slot for a
paramless action.
**Changeset** `.changeset/28158-action-param-dialog-submit-text.md`, all
`patch` (`Metadata-protocol: none`).
## Tests
- `ActionParamDialog.submitText-28158.test.tsx` (5): the verb is drawn,
the fallback is Confirm (also for `''`), the verb button submits, and
Uploading wins while a file uploads.
- `useConsoleActionRuntime.submitText-28158.test.tsx` (5) and
`RecordDetailView.paramSubmitText-28158.test.tsx` (5), one per reader:
the authored string, the bundle winning, an inline map collapsed to the
active language before it is offered as the fallback, the key object
asked (global for an object-less action, the page object when the action
declares none), and nothing handed over when nothing resolves.
- `useObjectLabel-actionSubmitText-28158.test.tsx` (5): the object node,
the global node, no global read for a bound action (with a control), the
miss answers.
- `RecordDetailView.paramRuntimeParity-6431.test.tsx`: `submitText`
joins `DIALOG_READS`, and the two runtimes write the same value.
- `packages/cli/test/i18n-extract-action-submit-text.test.ts` (7):
top-level, global and inline actions; the seed-less slot; no slot
without params; bundle seed and coverage gating; one fixture through
`ActionSchema` → extract → `ObjectTranslationDataSchema`.
- Sibling pins that mock `useObjectLabel` partially gain an
`actionSubmitText` passthrough (`overrideNotice`, `paramDialogTitle`,
`paramRefusal-13161`, `oneToastPerRefusal-13340`, `flowRowGuard-13397`).
## Acceptance notes
- The order's file surface did not name `ui/packages/i18n` (the
resolver) or `ui/packages/components/src/renderers/action/*` (the
forward lines). Both are mechanical consequences of the read point, and
the seat accepted both before this PR opened; the claim will be amended
with them.
- A third `ActionParamDialog` consumer,
`metadata-admin/MetadataTypeActions.tsx` (metadata-type actions in
Setup), passes neither `description` nor `submitText`, so its button
still says Confirm. The card names the two business-action handlers
only. Noted, not filed.
- `submitText` is not interpolated: it is a button verb, and no `${…}`
hole is read in it, unlike `description`.
## Verification
Readings at head `5f1a6b33` (after merging `origin/main` at `3ba52069`),
unless a line says otherwise.
<details><summary>Derived gates — 112 derived, 112 run, all exit
0</summary>
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 112 families against this diff; each
ran with stdin closed and its exit code recorded before any pipe. The
record is `ui-seat-1/r2026-10-30/out/28158-gates-ran-5f1a6b33.list` in
the project files.
- `dispatch-gates.mjs --ran`: 112 run, 0 NOT-MEASURED, 0 UNRUN.
- On the pre-merge head `ef504b2c` the same sweep had one exit 3,
`check-plugin-teardown-shape.mjs --self-test` (the pinned fixture commit
is absent from a shallow clone); after `git fetch origin 621a487…
--depth=1` it exits 0, and on `5f1a6b33` all 112 exit 0.
- Run after a full workspace build with declarations (`env -u
OS_SKIP_DTS pnpm exec turbo run build --filter='!@objectstack/docs'`,
116/116 tasks).
- Also: `node scripts/check-sdui-manifest.mjs` exit 0 (derived); ui
`check:action-forward-parity` exit 0 (it reds before the four forward
lines: 4 surfaces "does not forward 1 key the runtime reads:
`submitText`"); ui `check:new-line-citations` 0 new, exit 0.
</details>
<details><summary>Tests</summary>
- ui, on `5f1a6b33`: `pnpm --dir ui exec vitest run` over the four new
files, `app-shell/src/hooks/__tests__/`, the two
`RecordDetailView.param*` pins, `i18n/`, `core/src/actions/`,
`components/src/renderers/action/`, `types/` → 649 files, 13888 passed,
13 skipped.
- ui, on `ef504b2c`: `ActionParamDialog*`, `RecordDetailView*`,
`DeclaredActionsBar*` → 110 files, 819 passed.
- ui type-check: `@object-ui/app-shell`, `components`, `core`, `i18n`,
`types` → exit 0 each.
- spec: `pnpm --filter @objectstack/spec exec vitest run src/ui/
src/system/metadata-form-zod-reconciliation.test.ts
src/system/translation.test.ts` → 170 files, 6236 passed.
- cli: `typecheck` exit 0; `vitest run --project unit test/i18n-extract`
→ 10 files, 87 passed.
- Ablation (cli, `scripts/ablation-replace.mjs`): replacing the `params`
guard in `pushActionSubmitText` (anchor 1 → 0) reds "emits NO slot for
an action without params" (1 failed | 6 passed); restored by the tool,
blob == HEAD, `git diff HEAD` empty.
- `pnpm --filter @objectstack/spec check:liveness` exit 0 after
`gen:liveness-counts` (the `action` shard: one row planned → live).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibzPbVCsG2npDkDqikd)_
---------
Co-authored-by: Claude <noreply@anthropic.com>submitText drawn in place of Confirm) (#28392)1 parent ac09e7b commit bed8306
41 files changed
Lines changed: 924 additions & 44 deletions
File tree
- .changeset
- content/docs/references
- data
- kernel
- system
- ui
- packages
- cli
- src/utils
- test
- platform-objects/src/apps/translations
- spec
- liveness
- state-counts
- src
- system
- ui
- ui/packages
- app-shell/src
- hooks
- __tests__
- views
- components/src/renderers/action
- __tests__
- core/src/actions
- i18n/src
- __tests__
- types/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
| 493 | + | |
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
648 | | - | |
| 648 | + | |
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
854 | | - | |
| 854 | + | |
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| |||
0 commit comments