Repository navigation
Commit c0716ed
feat(spec, platform-objects): Studio action form rows for texts and refusals (#35636)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu19ctjaTjyM4gmWfgBPNRmc)_
Fixes #35096
Fixes #34823
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:在 Studio
里编辑脚本类操作时,表单在正文下面多了两行「拒绝目录」和「文本」,可以直接增删改操作抛出的拒绝提示和操作写进记录的句子,十一种界面语言都有说明。
- 为什么做:操作按调用方语言拒绝、按组织语言写句子的能力已经上线,但界面里写不了,只能改元数据或源码(替在 Studio
里编辑操作的管理员补上这两行,照钩子表单的做法)。
- 出错会怎样:最坏是这两行的说明或某种语言的译文措辞不准;操作运行不受影响,可以直接撤回。
- 要你做什么:无。
## What changes
**Studio action form, `texts` (#35096).** `action.form.ts` gains a
`texts` row in the Behavior section, right after the script `body`:
`type: 'record'`, `widget: 'key-only-record'`, entry fields `message`
(textarea, required) and `params` (tags). Those are the two keys of the
served entry (`ActionTextSchema = declaredTextEntrySchema('action')`, `{
message, params? }`), the same factory as the hook's, so this is the
hook form's `texts` row (PR #35510) with the help text worded for an
action's body. The `action` / `texts` omit row is deleted from
`metadata-form-zod-reconciliation.test.ts`.
**Studio action form, `refusals` (#34823).** A `refusals` row sits
between `body` and `texts`: the hook form's `refusals` row, entry fields
`message` (textarea, required), `status` (number), `reasons` (key-only
record of `{ message }`) and `params` (tags). Those are the four keys of
`ActionRefusalSchema = declaredRefusalEntrySchema('action')`, the hook
entry's factory, so the action entry does have `params`. The `action` /
`refusals` omit row is deleted.
**Where and why.** Both rows sit in Behavior, directly under `body`,
because they are read by the `js` body's code (`throw { code }`,
`ctx.text(key)`) and the retired omit rows describe them as declared
"beside the body". Both carry `visibleWhen: "data.type == 'script'"`,
the `body` row's gate: the parse refuses both keys on any other action
type, and the help text names the expression-body refusal (the form's
predicates do not read into `body.language`). The key-only face is
generic and `refusals` already exercises the same entry controls on the
hook form, so no renderer change.
**Packs.** `en` regenerated by `node scripts/check-i18n-bundles.mjs
--write`; the ten translated locales hand-written. The five refusal
entry fields have en sources byte-identical to the hook's, so each
locale reuses its own hook translation. The two top rows and the `texts`
entries are adapted from the hook wording (action, body, `script`). The
`*.source-hashes.generated.ts` echo entries match the hook rows'
(de/pt-BR `Status`, fr `Message`).
Read first, by risk:
1. `packages/spec/src/ui/action.form.ts`: the two rows and their gate.
2. One translated pack, e.g.
`packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts`,
the nine new entries under `action.fields`.
3. `packages/spec/src/system/metadata-form-declared-rows.pin.test.ts`:
the new pin.
## Tests
- New top-level describe in `metadata-form-declared-rows.pin.test.ts`
(the shared declared-rows harness): each row is offered once, as
`record` + `key-only-record`; its entry controls are exactly
`message:textarea!`, `params:tags` (texts) and `message:textarea!`,
`status:number`, `reasons:record:key-only-record`, `params:tags`
(refusals, with `reasons` holding `message:textarea!`); the entry field
names equal `Object.keys(ActionTextSchema.shape)` /
`Object.keys(ActionRefusalSchema.shape)`; the gate equals `body`'s; the
order is `body`, `refusals`, `texts`. Controls: the same probe reads the
hook rows (lit) and a key no form offers (dark).
- `metadata-form-zod-reconciliation.test.ts` passes with both omit rows
gone.
- Count pins in `packages/platform-objects/src/apps/translations/`:
action enumerated unwalked children 7 to 14
(`action-body-panel-echo-decisions.test.ts`, with the new parents
`refusals`, `refusals.reasons`, `texts`), translated row labels 744 to
753 (`object-lifecycle-panel-echo-decisions.test.ts`).
<details><summary>Readings (head 52a32ad)</summary>
- `pnpm --filter @objectstack/spec test`: Test Files 857 passed (857);
Tests 27399 passed, 1 todo (27400).
- `pnpm --filter @objectstack/platform-objects test`: Test Files 124
passed (124); Tests 2061 passed (2061).
- `pnpm --filter @objectstack/spec typecheck && pnpm --filter
@objectstack/platform-objects typecheck` (after the build, under the
verify lock): VERDICT command-exit 0 (`check:test-typecheck: OK`, spec
240 ledgered errors held, platform-objects 3).
- `pnpm --filter @objectstack/spec check:generated`: exit 0, all 14
artifacts up to date.
- `pnpm check:i18n`: exit 0, all bundles in sync. `pnpm
check:i18n-coverage`: exit 0, none new. `node
scripts/check-cli-command-ids.mjs`: exit 0.
- Check Changeset logic: `check-empty-changeset.mjs`,
`check-adr-0087-registration.mjs` exit 0; `check-changeset-no-major.mjs
--event` (this body) exit 0, level axis `no` / `none` at `patch`.
- `node scripts/pm/dispatch-gates.mjs --commands`: 87 families; `--ran`:
85 run with exit 0, 2 NOT MEASURED (exit 3):
`check-plugin-teardown-shape.mjs --self-test` (its fixture commit is
outside this shallow clone) and `check:dual-build-cjs-loads` (needs a
full workspace build; CI runs it).
- `node scripts/pm/overlap-check.mjs --branch=HEAD`: main merges
cleanly; #35583 conflicts in one count pin (see Acceptance notes).
</details>
## Acceptance notes
- Clause-② and kind, measured: `pnpm --filter @objectstack/spec
check:generated` reports all 14 artifacts up to date after the change
(the `authorable-surface` / `api-surface` shards do not move: a form row
is not a schema member), and `check-changeset-no-major.mjs --event` on
this body passes the level axis with `Metadata-protocol: none` /
`patch`. The claim's `no` / `none` stands.
- Overlap: `overlap-check.mjs --branch=HEAD` reports a textual conflict
with open #35583 in `object-lifecycle-panel-echo-decisions.test.ts`
(both PRs move the same count pin); main merges cleanly, and #35581
merges cleanly. Whichever lands second re-reads the count.
- Two commits per card (form + pin, then packs + count pins), in card
order; the branch takes no force push, so the WIP split stays.
## Verification
Two minutes: `pnpm --filter @objectstack/spec exec vitest run
src/system/metadata-form-declared-rows.pin.test.ts
src/system/metadata-form-zod-reconciliation.test.ts`. Expected: both
files pass, and `git grep -n "type: 'action'" -A3
packages/spec/src/system/metadata-form-zod-reconciliation.test.ts | grep
-E "key: '(texts|refusals)'"` prints nothing.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgX6mQpVU8yUysiRAFC)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent d96c878 commit c0716ed
21 files changed
Lines changed: 575 additions & 30 deletions
File tree
- .changeset
- packages
- lint/src
- platform-objects/src/apps/translations
- spec/src
- system
- ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
702 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
703 | 706 | | |
704 | 707 | | |
705 | 708 | | |
| |||
827 | 830 | | |
828 | 831 | | |
829 | 832 | | |
830 | | - | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
831 | 837 | | |
832 | 838 | | |
833 | 839 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
665 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
666 | 674 | | |
667 | 675 | | |
668 | 676 | | |
| |||
728 | 736 | | |
729 | 737 | | |
730 | 738 | | |
731 | | - | |
732 | | - | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
733 | 743 | | |
734 | 744 | | |
735 | 745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
1900 | 1936 | | |
1901 | 1937 | | |
1902 | 1938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
1900 | 1936 | | |
1901 | 1937 | | |
1902 | 1938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
1900 | 1936 | | |
1901 | 1937 | | |
1902 | 1938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
1900 | 1936 | | |
1901 | 1937 | | |
1902 | 1938 | | |
| |||
0 commit comments