Repository navigation
Commit 6e5f909
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8ScBVj68xfGbS6qVYg8VwB1)_
Part of #25922
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:app-shell 设计器私有表里最后一族 `engine.translationPreview.*`(en、zh 各 23
行,含 #26831 加的 `category.hooks`)搬进 `@object-ui/i18n` 的 `studio`
命名空间,文案一字未改;`ENGINE_STRINGS_EN` / `ENGINE_STRINGS_ZH` 现在是空对象,声明保留到 S7。
- 为什么改:执行 #25922 裁决 6431032267(Q2 = A,6431234244 维持),这是 (M) 的 S6b 片,派单
6460180836;之后只剩 S7(Tier H:删表、退役 `check:i18n-designer-parity` 及其 `ci.yml`
步骤)。
- 风险与回滚:与前几片相同,zh 用户首次打开翻译预览时标签先显示英文、zh 分片到达后同一挂载重渲染为中文;回滚即 revert 本 PR。
- 先看:`ui/packages/i18n/src/namespaces/studio/zh.ts` 末尾的 S6b 段,再看
`block-config-i18n.test.ts` 里改成「两张表为空」的断言。
- 两分钟验证:`cd ui && pnpm run check:i18n-designer-parity && pnpm exec
vitest run
packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.studioNamespace-25922.test.ts`,应全绿。
- 需要你做的:无,席位落地。
## What changes
- **Slice S6b of the (M) item.** The last family in `ENGINE_STRINGS_EN`
/ `ENGINE_STRINGS_ZH`
(`ui/packages/app-shell/src/views/metadata-admin/i18n.ts`),
`engine.translationPreview.*`, is appended to `STUDIO_EN` / `STUDIO_ZH`
in `ui/packages/i18n/src/namespaces/studio/{en,zh}.ts` under an S6b
heading comment, text byte-for-byte unchanged, its group comment moving
with it. That is 23 rows in each language, not the 22 the order counted:
#26831 (merged before this branch) added
`engine.translationPreview.category.hooks`, and this PR carries it.
- **The table is now empty.** Both `ENGINE_STRINGS_*` declarations stay,
as the order requires, each holding a two-line comment that says where
the rows live and that slice S7 retires the table. `t()` /
`tOptional()`, `lookupString`, `TYPE_LABELS` / `DOMAIN_LABELS`,
`FLOW_FIELD_ZH` and `check:i18n-designer-parity` are untouched.
- **No runtime change.** `lookupString` asks the empty table first and
the namespace second, so `TranslationPreview.tsx` and its tests read the
same strings with no edit. The preview's locale comes from its host's
`useMetadataLocale()`, which already subscribes to the lazy `zh`
catalogue.
- **One forced test adaptation.**
`previews/__tests__/block-config-i18n.test.ts`, case "reads two
disjoint, non-empty tables out of i18n.ts", floored each table at
non-empty. It now asserts both tables are empty (a key moved back would
shadow the namespace) and keeps its range-disjointness check and its
3,000-key floor over both homes, which is what keeps an empty table from
reading as a parser gone quiet. The case name says "both emptied into
the namespace".
- **Changeset:** `.changeset/25922-studio-i18n-translation-preview.md`,
`@object-ui/i18n` patch.
- ⛔ Untouched: `ui/packages/i18n/src/locales/*.ts`, `ui/.github/**`,
root `ci.yml`, `ui/scripts/check-i18n-designer-table-parity.mjs`.
## Why
Ruling 6431032267 Q2 = A (upheld by 6431234244): the designer table
becomes one lazy `@object-ui/i18n` namespace, moved in slices. This
family was held out of S6 while #26831 was open.
## Tests
- **Pin widened:**
`inspectors/inspectorStrings.studioNamespace-25922.test.ts` gains a
floor of 20 for `engine.translationPreview.` (87 families in all). Every
key in the family must be in `zh` and resolve through `t()` to the
namespace value in `en-US`, `zh-CN` and `de-DE`.
- **Move proof (one-off, not committed):** both homes parsed by AST at
`f708cf22` and at this head. In each language: table 23 → 0, namespace
3,186 → 3,209 (`en`) and 3,240 → 3,263 (`zh`); removed set equals added
set, 0 values differing, 0 keys in both homes, 0 existing namespace rows
dropped or changed.
- **Equivalence (one-off, not committed):** all 23 base rows per
language, read by AST at `f708cf22`, compared with `t()`, `tOptional()`
and `tFormat()` on this branch with `zh` resident, in `en-US`, `en`,
`de-DE`, `fr`, no locale, `zh-CN`, `zh` and `zh-TW`: 552 lookups, 0
differing.
- **Ablations** (`scripts/ablation-replace.mjs`; mutation landed by
anchor count and blob, restored to the `HEAD` blob with `git diff HEAD`
empty):
- A `zh` row `engine.translationPreview.coverage` planted back in
`ENGINE_STRINGS_ZH` with another value: the pin's `t()` case for
`engine.translationPreview.` goes red, and the equivalence check reports
exactly 9 differing lookups (`t` / `tOptional` / `tFormat` × `zh-CN`,
`zh`, `zh-TW`).
- The same row deleted from `studio/zh.ts`: the pin's family case and
`t()` case go red, and the equivalence check reports the same 9.
### The sweep
The `zh` loader in `namespaces/studio/index.ts` was delayed by 4,000 ms
(`ablation-replace.mjs --hold`, restored to the `HEAD` blob). Under the
delay, every app-shell test naming `zh` or a moved key plus the i18n
tests naming `studio` ran (310 files): 3,617 of 3,618 tests passed. The
one red is `i18n/src/__tests__/studio-namespace-lazy.test.tsx`, red by
construction (its `findByText` waits 1 s against a 4 s delay). No racer.
Then each `.test.ts` file that names a moved key or reads the table (6
files: the pin, `block-config-i18n`, `zh-base-term.i18n-13131`, and the
dead-keys, designer-parity and en-drift script tests) ran alone,
delayed: all green.
## Acceptance notes
- **The parity gate on an empty table:** `check:i18n-designer-parity`
exits 0 and reports `ENGINE_STRINGS 3209 en / 3263 zh`, the same totals
as on `f708cf22`, because its extractor reads the table and the
namespace as one table. The AST extractor accepts an empty object
literal; the line-range extractor in `block-config-i18n` and the
`indexOf` reader in `zh-base-term.i18n-13131` both need the closing `};`
on its own line, which is why the empty declarations keep the multi-line
form.
- **Other open PRs:** none known to add a table row after `f708cf22`
(claim 6460205408).
- **Eager bundle:** not re-measured locally, as in S2–S6. CI's `Build &
E2E UI` measures it.
## Verification
At `13e08033`. `origin/main` is 3 commits ahead (#27034, #27031,
#27066); none touches either home, the namespace or an i18n gate, and
`git merge-tree` is clean.
<details><summary>Tests and gates</summary>
- `pnpm --filter @object-ui/i18n --filter @object-ui/app-shell run
type-check`: exit 0. `pnpm --dir ui run type-check:scripts`: exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 34 commands, each exit 0 (captured before
any pipe), including `pnpm --dir ui exec vitest run scripts/` (`Test
Files 176 passed | 2 skipped (178)`). `--ran`: 34 derived, 34 run, 0
NOT-MEASURED.
- ui `check:i18n-designer-parity`, `check:i18n-dead-keys`,
`check:i18n-drift` ("No en value changed in this range."),
`check:i18n-keys`: exit 0. `check:new-line-citations`: exit 0 (0 new).
`node scripts/check-nul-bytes.mjs`: exit 0.
- Focused set at normal speed (pin, the three `TranslationPreview`
readers, `zh-base-term`, `block-config-i18n`, the parity and dead-keys
script tests, `studio-namespace`, equivalence): `Tests 451 passed
(451)`.
- Changed lines: 134 (+78 / −56) over 6 files.
</details>
## Human Minimum
- [x] 1. No `packages/spec` change.
- [x] 2. No new names; the only new file is the changeset.
- [x] 3. No formatter ran; `pnpm lint` is CI's.
- [x] 4. One card slice, one branch off `main`, one pull request.
- [x] 5. Patch changeset with both declaration lines.
- [x] 6. n/a.
- [x] 7. No hand edits to generated or release-owned files.
- [x] 8. English.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbX3S5QrD29Ghii633f)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent f2fdac5 commit 6e5f909
6 files changed
Lines changed: 78 additions & 56 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/views/metadata-admin
- inspectors
- previews/__tests__
- i18n/src/namespaces/studio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 195 | + | |
| 196 | + | |
220 | 197 | | |
221 | 198 | | |
222 | 199 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 200 | + | |
| 201 | + | |
246 | 202 | | |
247 | 203 | | |
248 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
682 | | - | |
683 | | - | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
684 | 685 | | |
685 | | - | |
686 | | - | |
| 686 | + | |
| 687 | + | |
687 | 688 | | |
688 | 689 | | |
689 | 690 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3953 | 3953 | | |
3954 | 3954 | | |
3955 | 3955 | | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
| 3961 | + | |
| 3962 | + | |
| 3963 | + | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
| 3974 | + | |
| 3975 | + | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
3956 | 3983 | | |
3957 | 3984 | | |
3958 | 3985 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3565 | 3565 | | |
3566 | 3566 | | |
3567 | 3567 | | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
| 3571 | + | |
| 3572 | + | |
| 3573 | + | |
| 3574 | + | |
| 3575 | + | |
| 3576 | + | |
| 3577 | + | |
| 3578 | + | |
| 3579 | + | |
| 3580 | + | |
| 3581 | + | |
| 3582 | + | |
| 3583 | + | |
| 3584 | + | |
| 3585 | + | |
| 3586 | + | |
| 3587 | + | |
| 3588 | + | |
| 3589 | + | |
| 3590 | + | |
| 3591 | + | |
| 3592 | + | |
3568 | 3593 | | |
3569 | 3594 | | |
3570 | 3595 | | |
0 commit comments