Repository navigation
Commit 7945a3b
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg4yKv6mvrKDXRuYdcBwp9hK)_
domain:ui#3 · os-bill · session_01Utp6CbPN5UYMnBaNJPJWfG
Fixes #29902
Clause-②: yes (widening) — two new count families in the public
`@object-ui/i18n` packs: `preview.changes.typeCount.hook`,
`preview.changes.typeCount.translation`.
Metadata-protocol: none
## 维护者速读
- 改了什么:Studio 发布面板(待发布变更)的汇总行和分组标题,现在把一批钩子、翻译显示成「3 hooks」「钩子 3」「翻译
2」,不再是原始类型码「3 hook」「hook 3」。
- 为什么改:钩子在对象的 Hooks 标签页、翻译在「全部元数据」表单编辑器里由 Studio
自己创作,作者每次发布都看到未翻译、未变复数的类型码,中文界面里还夹着英文。
- 风险与回滚:只加两行计数文案和 10 个语言包的新键,其他类型和未知类型的显示不变;回滚即 revert 本 PR。
-
先看:`ui/packages/app-shell/src/preview/DraftChangesPanel.tsx`(`TYPE_COUNT`
末尾两行)、`ui/packages/i18n/src/locales/zh.ts`(`typeCount.hook` /
`typeCount.translation`)。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/app-shell/src/preview/__tests__/DraftChangesPanel.groupHeading-13221.test.tsx`,预期全绿,其中含「3
hooks」「钩子 3」「翻译 2」三条新断言。
- 需要你做的:无,席位落地。
## What changes
- `TYPE_COUNT` in `DraftChangesPanel.tsx` gains a `hook` and a
`translation` row, so the summary line and the per-type group heading
read the pack's count family instead of the raw `{{n}} {{type}}`
fallback. The fallback stays for types with no row (objectui#13147 note
above the table).
- Every one of the ten packs under `ui/packages/i18n/src/locales/` gains
both families, with each CLDR slot its language selects (`es`/`fr`/`pt`
`_many`, `ru` `_few`/`_many`, `ar` `_zero`/`_two`/`_few`/`_many`),
mirroring the `dataset` rows. zh-CN reads 「钩子 N」 (the platform nav's own
word for hooks, `nav_hooks`) and 「翻译 N」.
- One changeset: `@object-ui/app-shell` and `@object-ui/i18n`, patch.
### Which types get a row: the enumeration
The publish door batches every draft the package holds, whatever its
type (`publishPackageDrafts` in
`packages/metadata-protocol/src/protocol.ts` reads `repo.listDrafts({
packageId })`, no type filter). A draft can exist only for a type the
registry lets a runtime create or overlay: `allowRuntimeCreate` or
`supportsOverlay` true in `DEFAULT_METADATA_TYPE_REGISTRY`
(`packages/spec/src/kernel/metadata-plugin.zod.ts`). Those types, and
who in Studio authors them:
| Type | Studio authors it? | Row before |
|---|---|---|
| object, view, page, dashboard, report, app, flow, permission, action,
email_template, object_extension, dataset | yes (pillars, object panels,
nav, bundle editor) | yes |
| **hook** | yes: `studio-design/ObjectHooksPanel.tsx` saves `hook`
drafts | **no, added** |
| **translation** | yes: `studio-design/StudioBundleItemEditor.tsx`,
listed in `AREA_FORM_EDITOR_TYPES` (`metadataArea.ts`) | **no, added** |
| seed, mapping, external_catalog, doc, book, position, tool, skill | no
Studio editor of its own (only the generic metadata pages) | no,
unchanged (raw fallback) |
`picklist`, named on the card, has both flags false: no draft of it can
exist, so the publish door never batches one and no row is added.
(`agent` keeps its existing row.)
## Acceptance notes
- File surface deviation, agreed with the seat before the edit: the
claim named the en and zh-CN packs; all ten packs are touched because
`ui/packages/i18n/src/__tests__/all-locales-key-parity.test.ts` requires
every pack to define every `en` key (and the per-language plural slots).
The `dataset` row set the same precedent.
## Verification
Head `cf373b6e` (after merging `origin/main` once; the merge touched
none of the changed files).
<details><summary>Targeted tests (6 files, 79 tests)</summary>
`cd ui && pnpm exec vitest run` on
`DraftChangesPanel.summaryPlural-13147.test.tsx`,
`DraftChangesPanel.groupHeading-13221.test.tsx`, and the i18n
`all-locales-key-parity`, `en-zh-key-parity`, `count-families-11445`,
`plural-categories-11432` tests: `Test Files 6 passed (6)`, `Tests 79
passed (79)`.
</details>
<details><summary>Ablation (one, on the tested behaviour)</summary>
`node scripts/ablation-replace.mjs` deleted the `hook:` row (anchor 1 →
0, blob 4b7c507 → 9cc8f165): `Tests 3 failed | 11 passed (14)`, the
three hook assertions red. Restored: blob back to 4b7c507, `git diff
HEAD` empty.
</details>
<details><summary>Type-check</summary>
`pnpm exec turbo run type-check --filter=@object-ui/app-shell
--filter=@object-ui/i18n --concurrency=2` under the verify lock: `Tasks:
69 successful, 69 total` (app-shell runs `tsc --noEmit` and `tsc -p
tsconfig.test.json`).
</details>
<details><summary>Derived gates (35)</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 35 families; all 35 ran and exited
0, including `node scripts/check-sdui-manifest.mjs`, `pnpm
check:type-check-debt` and `pnpm --dir ui exec vitest run scripts/` (170
files passed). `--ran` reconciliation: 35 derived, 35 run, 0
NOT-MEASURED, 0 UNRUN. Repo-wide families are CI's.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZ2YeJynYaMx8rfBzM)_
Co-authored-by: Claude <noreply@anthropic.com>
1 parent dc138a5 commit 7945a3b
14 files changed
Lines changed: 144 additions & 0 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/preview
- __tests__
- i18n/src/locales
| 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 | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
873 | 878 | | |
874 | 879 | | |
875 | 880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5083 | 5083 | | |
5084 | 5084 | | |
5085 | 5085 | | |
| 5086 | + | |
| 5087 | + | |
| 5088 | + | |
| 5089 | + | |
| 5090 | + | |
| 5091 | + | |
| 5092 | + | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
5086 | 5100 | | |
5087 | 5101 | | |
5088 | 5102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4614 | 4614 | | |
4615 | 4615 | | |
4616 | 4616 | | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
4617 | 4623 | | |
4618 | 4624 | | |
4619 | 4625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4080 | 4080 | | |
4081 | 4081 | | |
4082 | 4082 | | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
4083 | 4089 | | |
4084 | 4090 | | |
4085 | 4091 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4732 | 4732 | | |
4733 | 4733 | | |
4734 | 4734 | | |
| 4735 | + | |
| 4736 | + | |
| 4737 | + | |
| 4738 | + | |
| 4739 | + | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
4735 | 4743 | | |
4736 | 4744 | | |
4737 | 4745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4728 | 4728 | | |
4729 | 4729 | | |
4730 | 4730 | | |
| 4731 | + | |
| 4732 | + | |
| 4733 | + | |
| 4734 | + | |
| 4735 | + | |
| 4736 | + | |
| 4737 | + | |
| 4738 | + | |
4731 | 4739 | | |
4732 | 4740 | | |
4733 | 4741 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4616 | 4616 | | |
4617 | 4617 | | |
4618 | 4618 | | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
4619 | 4625 | | |
4620 | 4626 | | |
4621 | 4627 | | |
| |||
0 commit comments