Skip to content

Commit 94e29cd

Browse files
feat(ui): five Studio pillars, the data source pages and the field types move into the studio i18n namespace (#25922 slice S4) (#26900)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8PeP4DzppH3b1kDPCjihHVx)_ Part of #25922 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:Studio 设计器表里 `engine.studio` 的 access、if、data、auto、settings 五个支柱,加上数据源三族(`engine.datasource` / `externalDatasource` / `datasourcePreview`)和字段类型三族(`engine.fieldType` / `fieldTypeDesc` / `fieldCategory`),共 en、zh 各 549 键,从 app-shell 私有表搬进 `@object-ui/i18n` 的 `studio` 命名空间,文案一字未改,调用点不动。 - 为什么改:执行 #25922 裁决 6431032267(Q2 = A,6431234244 维持),这是 (M) 的第 4 片(S4),派单 6450441124;`engine.studio.rules` 按席位改单留给 S5。 - 风险与回滚:与前几片相同,zh 用户首次打开这些页面时标签先显示英文、zh 分片到达后同一挂载重渲染为中文;回滚即 revert 本 PR。 - 先看:`ui/packages/i18n/src/namespaces/studio/en.ts` 末尾的 S4 段,再看钉测试新增的 11 个家族下限。 - 两分钟验证:`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 S4 of the (M) item.** These rows leave `ENGINE_STRINGS_EN` / `ENGINE_STRINGS_ZH` in `ui/packages/app-shell/src/views/metadata-admin/i18n.ts` and are appended to `STUDIO_EN` / `STUDIO_ZH` in `ui/packages/i18n/src/namespaces/studio/{en,zh}.ts`, text byte-for-byte unchanged: | family | keys per language | |---|---| | `engine.studio.access.*` | 130 | | `engine.studio.if.*` | 58 | | `engine.studio.data.*` | 50 | | `engine.studio.auto.*` | 46 | | `engine.studio.settings.*` | 40 | | `engine.datasource.*` | 58 | | `engine.externalDatasource.*` | 50 | | `engine.datasourcePreview.*` | 10 | | `engine.fieldType.*` | 49 | | `engine.fieldTypeDesc.*` | 49 | | `engine.fieldCategory.*` | 9 | | **total** | **549** (same set in `en` and `zh`; none zh-only) | The five pillars are the seat's amended scope. `engine.studio.rules.*` is deferred to S5, because #26731 adds a `rules` row. The "about 500 key lines of other `engine.*`" are the data source pages and the field types: 225 keys per language, 450 key lines. I picked them because, when I read the open PRs' patches to both homes, no open PR touched these families. The open PRs that do touch those two files (#26804, #26827, #26819, #26831) hold only `engine.studio.{inspector,held,refusal}`, `engine.inspector.*` and `engine.translationPreview.*`. Stopping at 450 also keeps the PR under the 3,000-line threshold. - Same AST pass as S2 and S3; a heading comment marks the S4 section in each catalogue. - **No runtime change.** `lookupString` already asks the table first and the namespace second, so `t` / `tFormat` / `tOptional` and every call site are untouched. No new source file, so the console chunk groups need no change. - **Readers.** Every non-test reader of the moved families is in app-shell under `views/metadata-admin/` or `views/studio-design/`, so all are Studio surfaces. None calls `t()` at module scope: `flowPresets.ts` and `field-types.ts` hold keys, not strings. Dynamic keys (`engine.fieldType.${…}`, `engine.fieldTypeDesc.${…}`, `engine.fieldCategory.${…}`) all go through `t()`. No stop-and-report. - **Changeset:** `.changeset/25922-studio-i18n-pillars-datasources.md`, `@object-ui/i18n` patch. - ⛔ Untouched: `ui/packages/i18n/src/locales/*.ts`, `ui/.github/**`, root `ci.yml`, `engine.studio.{rules,inspector,held,refusal}`, `engine.inspector.*`, `engine.translationPreview.*`. ## Why Ruling 6431032267 Q2 = A (upheld by 6431234244): the designer table becomes one lazy `@object-ui/i18n` namespace, moved in slices. ## Tests - **Pin widened:** `inspectors/inspectorStrings.studioNamespace-25922.test.ts` gains a floor for each of the eleven S4 families. For each family, `t()` must answer every key with the namespace value in `en-US`, `zh-CN` and `de-DE`. - **Forced edits: zh preloads.** Each of these suites reads a moved S4 zh row synchronously, so it now makes `zh` resident with a top-level `await loadStudioCatalogue('zh')`. No assertion changed: - Seven dom suites: `datasource/DatasourceResourcePage.locale-13460`, `previews/adminPreviews.i18n-10862-s2`, `previews/externalDatasourcePanel.i18n-10862-s3`, `previews/federationTabs.i18n-10862-s4`, `studio-design/ObjectFormDesigner.typeName-13148`, `studio-design/StudioDesignSurface.emptyPackage`, `studio-design/StudioDesignSurface.railLabels`. - One unit suite: `metadata-admin/studioAutomationCopy.plainLanguage-11659.test.ts`. It runs in the `unit` project (`isolate: false`), so it passed in the full run only because an earlier file had already loaded `zh`. Run alone, it failed. - **Forced edits: tests that leaned on the table.** - `studio-design/AddFieldPopover.studioNamespace-25922.test.tsx` (slice 1) used `engine.studio.data.addField` as "a key still in the app-shell table". That key moved, so the test now uses `engine.studio.cancel`, which the same popover renders and which stays in the table. - `previews/__tests__/block-config-i18n.test.ts` floored the app-shell table at 1,500 keys. The table now holds 1,152, so the 3,000-key floor applies to both homes together, and the table only has to be non-empty. ### The sweep, and the S3 leftovers Every app-shell test that names zh was run with `namespaces/studio/index.ts`'s `zh` loader delayed 4000 ms, using `scripts/ablation-replace.mjs` and restored byte-identical. That is 403 files (the S3 list plus every other app-shell test naming zh). Each of the 52 unit-project files was also run alone under the delay. - With this branch applied, 1 file goes red: `i18n/src/__tests__/studio-namespace-lazy.test.tsx`. It fails by construction, because its `findByText` waits 1 s and the delay is 4 s. - Measured on `main` without the S4 move, 3 files go red under the delay: `PackageFormDialog.validationTiming`, `ResourceEditPage.discardDraftLabel-12690` and `ResourceEditPage.environmentOverlay-12141`. All three are S3 rows. The S3 sweep had no delay, so these racers passed locally. The seat routed their preloads to #26855 and #26839, so this PR leaves them alone. Until those land, they can show red here. ## Acceptance notes - **Every moved key resolves identically before and after.** This is a one-off measurement and is not committed: - The 549 + 549 base values were read by AST from the table at `e9e344a9`. - They were compared with `t()` and `tOptional()` on this branch after `zh` is resident: `en-US`, `en`, `de-DE` and `fr` against the base `en` value, and `zh-CN`, `zh` and `zh-TW` against the base `zh` value. - Result: 3,843 lookups, 0 differing. - **Ablations** (mutation landed by anchor count and blob, then restored byte-identical to `HEAD`): - With the `?? studioString(key, locale)` arm removed from `lookupString`, 23 tests go red: the pin's `t()` case for all 21 families, its zh-only case, and the equivalence check. The equivalence check reports 3,843 of 3,843 lookups differing. - With one moved zh row altered (`engine.datasource.title`), the equivalence check reports exactly 3 differing lookups (`zh-CN`, `zh`, `zh-TW`). The pin stays green, as designed. - **Eager bundle:** not re-measured locally, as in S2 and S3. CI's `Build & E2E UI` measures it. ## Verification All at the tree of `7c7bbb87`. <details><summary>Tests and gates</summary> - The 11 changed test files at normal speed: `Test Files 11 passed (11)`, `Tests 211 passed (211)`. - `pnpm --filter @object-ui/i18n --filter @object-ui/app-shell run type-check`: VERDICT command-exit 0. - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 34 commands, and each exited 0, including `pnpm --dir ui exec vitest run scripts/` (`Test Files 178 passed | 2 skipped (180)`). `--ran` shows 34 derived, 34 run and 0 NOT-MEASURED. These gates ran with two more test files in the diff than `7c7bbb87` has: the S3-leftover preloads, which I later handed to #26839. Re-deriving on the final diff gives the same 34 commands. - ui `check:i18n-designer-parity`, `check:i18n-dead-keys`, `check:i18n-drift` (0 `en` values changed) and `check:i18n-keys`: all exit 0. `check:new-line-citations`: exit 0. `node scripts/check-nul-bytes.mjs`: exit 0. - Changed lines: 2,597 (+1,341 / −1,256) over 15 files, under the 3,000-line threshold. </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_01JQwxbX9LnJhjTQPJEmoBYi)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 942ffb2 commit 94e29cd

15 files changed

Lines changed: 1341 additions & 1256 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/i18n': patch
3+
---
4+
5+
feat(i18n): five Studio pillars, the data source pages and the field types move into the `studio` namespace
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Fourth slice of the move ruled on objectstack#25922** (6431032267, Q2 = A; kept by 6431234244). The keys under `engine.studio.access.*`, `engine.studio.if.*`, `engine.studio.data.*`, `engine.studio.auto.*` and `engine.studio.settings.*`, the data source pages' `engine.datasource.*`, `engine.externalDatasource.*` and `engine.datasourcePreview.*`, and the field types' `engine.fieldType.*`, `engine.fieldTypeDesc.*` and `engine.fieldCategory.*` (549 keys in both `en` and `zh`) now live in `@object-ui/i18n/namespaces/studio` instead of `@object-ui/app-shell`'s private table, text unchanged. Studio reads the same strings; a Chinese viewer sees these labels in English for the moment the `zh` catalogue takes to load, as with the earlier slices. No export changes.

‎ui/packages/app-shell/src/views/metadata-admin/datasource/DatasourceResourcePage.locale-13460.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
3737
import { t } from '../i18n';
3838
import { DatasourceResourcePage } from './DatasourceResourcePage';
3939

40+
// The designer rows this suite reads in zh live in `@object-ui/i18n`'s `studio`
41+
// namespace, whose `zh` catalogue is fetched on demand (objectstack#25922).
42+
// Resident before any case, so the zh rows below read synchronously.
43+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
44+
await loadStudioCatalogue('zh');
45+
4046
afterEach(cleanup);
4147

4248
const DRIVER = { id: 'sqlite', label: 'SQLite', configSchema: { properties: {} } };

‎ui/packages/app-shell/src/views/metadata-admin/i18n.ts‎

Lines changed: 0 additions & 1247 deletions
Large diffs are not rendered by default.

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.studioNamespace-25922.test.ts‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
22

33
/**
4-
* objectstack#25922 slices S2 and S3 — the designer rows that moved into
5-
* `@object-ui/i18n`'s `studio` namespace (every `engine.inspector.*` row, and
6-
* `engine.packages.*`, `engine.form.*`, `engine.edit.*`), and app-shell's `t()`
7-
* / `tOptional()` still answer every one of them the way they did when the rows
4+
* objectstack#25922 slices S2 to S4 — the designer rows that moved into
5+
* `@object-ui/i18n`'s `studio` namespace (every `engine.inspector.*` row;
6+
* `engine.packages.*`, `engine.form.*`, `engine.edit.*`; five `engine.studio.*`
7+
* pillars, the data source pages and the field types), and app-shell's `t()` /
8+
* `tOptional()` still answer every one of them the way they did when the rows
89
* sat in its own table.
910
*
1011
* What would break it:
@@ -41,6 +42,18 @@ const FAMILY_FLOOR: Readonly<Record<string, number>> = Object.freeze({
4142
'engine.packages.': 120,
4243
'engine.form.': 90,
4344
'engine.edit.': 90,
45+
// S4 — five Studio pillars, the data source pages, the field types
46+
'engine.studio.access.': 120,
47+
'engine.studio.if.': 50,
48+
'engine.studio.data.': 45,
49+
'engine.studio.auto.': 40,
50+
'engine.studio.settings.': 35,
51+
'engine.datasource.': 50,
52+
'engine.externalDatasource.': 45,
53+
'engine.datasourcePreview.': 10,
54+
'engine.fieldType.': 45,
55+
'engine.fieldTypeDesc.': 45,
56+
'engine.fieldCategory.': 9,
4457
});
4558

4659
/**

‎ui/packages/app-shell/src/views/metadata-admin/previews/__tests__/block-config-i18n.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,12 @@ describe('a retired key leaves BOTH locale tables (objectui#8368)', () => {
678678
// FEWER keys — which would make every assertion below vacuously green over
679679
// an empty corpus. Ranges first: overlapping ones would mean the `};`
680680
// scan ran past a table and both sets became the same set.
681+
// The table drains slice by slice into the namespace (objectstack#25922),
682+
// so its floor is "non-empty"; the 3,000-key floor is held over both homes
683+
// together, below.
681684
expect(EN_TABLE.to).toBeLessThan(ZH_TABLE.from);
682-
expect(EN_TABLE.keys.length).toBeGreaterThan(1500);
683-
expect(ZH_TABLE.keys.length).toBeGreaterThan(1500);
685+
expect(EN_TABLE.keys.length).toBeGreaterThan(0);
686+
expect(ZH_TABLE.keys.length).toBeGreaterThan(0);
684687
// No duplicates: a key declared twice would be a silent overwrite, and the
685688
// set arithmetic below would hide it.
686689
expect(EN_TABLE.keys.length).toBe(new Set(EN_TABLE.keys).size);
@@ -691,6 +694,8 @@ describe('a retired key leaves BOTH locale tables (objectui#8368)', () => {
691694
expect(ZH_HOME.keys.length).toBeGreaterThan(150);
692695
expect(EN_KEYS.keys.length).toBe(new Set(EN_KEYS.keys).size);
693696
expect(ZH_KEYS.keys.length).toBe(new Set(ZH_KEYS.keys).size);
697+
expect(EN_KEYS.keys.length).toBeGreaterThan(3000);
698+
expect(ZH_KEYS.keys.length).toBeGreaterThan(3000);
694699
});
695700

696701
it('the extractor really sees the keys the derivation implies', () => {

‎ui/packages/app-shell/src/views/metadata-admin/previews/adminPreviews.i18n-10862-s2.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ import { PermissionPreview } from './PermissionPreview';
4444
import { PositionPreview } from './PositionPreview';
4545
import { TranslationPreview } from './TranslationPreview';
4646

47+
// The designer rows this suite reads in zh live in `@object-ui/i18n`'s `studio`
48+
// namespace, whose `zh` catalogue is fetched on demand (objectstack#25922).
49+
// Resident before any case, so the zh rows below read synchronously.
50+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
51+
await loadStudioCatalogue('zh');
52+
4753
afterEach(cleanup);
4854

4955
type Lang = 'en' | 'zh';

‎ui/packages/app-shell/src/views/metadata-admin/previews/externalDatasourcePanel.i18n-10862-s3.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ vi.mock('../external/api', async (importOriginal) => {
5151
import { t, tFormat } from '../i18n';
5252
import { DatasourcePreview } from './DatasourcePreview';
5353

54+
// The designer rows this suite reads in zh live in `@object-ui/i18n`'s `studio`
55+
// namespace, whose `zh` catalogue is fetched on demand (objectstack#25922).
56+
// Resident before any case, so the zh rows below read synchronously.
57+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
58+
await loadStudioCatalogue('zh');
59+
5460
afterEach(() => {
5561
cleanup();
5662
state.refresh = 'ok';

‎ui/packages/app-shell/src/views/metadata-admin/previews/federationTabs.i18n-10862-s4.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ vi.mock('../external/api', async (importOriginal) => {
7373
import { t, tFormat } from '../i18n';
7474
import { DatasourcePreview } from './DatasourcePreview';
7575

76+
// The designer rows this suite reads in zh live in `@object-ui/i18n`'s `studio`
77+
// namespace, whose `zh` catalogue is fetched on demand (objectstack#25922).
78+
// Resident before any case, so the zh rows below read synchronously.
79+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
80+
await loadStudioCatalogue('zh');
81+
7682
afterEach(() => {
7783
cleanup();
7884
state.tables = [];

‎ui/packages/app-shell/src/views/metadata-admin/studioAutomationCopy.plainLanguage-11659.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
import { describe, expect, it } from 'vitest';
2020
import { t } from './i18n';
2121

22+
// `engine.studio.auto.*` lives in `@object-ui/i18n`'s `studio` namespace, whose
23+
// `zh` catalogue is fetched on demand (objectstack#25922). Resident before any
24+
// case: this file runs in the `unit` project, whose shared module graph would
25+
// otherwise let it pass only when another file had loaded `zh` first.
26+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
27+
await loadStudioCatalogue('zh');
28+
2229
/** The automation pillar's chrome: every `engine.studio.auto.*` row it renders as prose. */
2330
const PILLAR_ROWS = [
2431
'engine.studio.auto.heading',

‎ui/packages/app-shell/src/views/studio-design/AddFieldPopover.studioNamespace-25922.test.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*
77
* The Data pillar's "Add field" popover mixes both homes on one screen: its
88
* field labels (`designer.field.label` / `.apiName` / `.type`) moved into the
9-
* namespace, its title and buttons (`engine.studio.*`) are still in the
10-
* app-shell table. It takes its locale from `useMetadataLocale()`, the hook
9+
* namespace, its Cancel button (`engine.studio.cancel`) is still in the
10+
* app-shell table (its title and Create button followed in slice S4). It takes its locale from `useMetadataLocale()`, the hook
1111
* every designer component uses, so this is the path a real screen takes:
1212
*
1313
* - zh: the namespace's `zh` catalogue is NOT resident when the screen first
@@ -40,7 +40,7 @@ afterEach(cleanup);
4040
/** Keys this screen renders from the namespace. */
4141
const MOVED = ['designer.field.label', 'designer.field.type'] as const;
4242
/** A key this screen renders from the app-shell table. */
43-
const TABLE = 'engine.studio.data.addField';
43+
const TABLE = 'engine.studio.cancel';
4444

4545
function Screen({ lang }: { lang: string }) {
4646
return (

0 commit comments

Comments
 (0)