From ed85dfce0f2bec7b55939a629d43725f8440a9f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 19:45:08 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix(studio):=20one=20name=20per=20group=20?= =?UTF-8?q?=E2=80=94=20the=20domain=20dictionary=20says=20Platform=20/=20A?= =?UTF-8?q?ccess?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../DirectoryPage.groupNames-37082.test.tsx | 167 ++++++++++++++++++ .../PageShell.narrowHeader-12306.test.tsx | 2 +- .../src/views/metadata-admin/i18n.ts | 15 +- ...DesignSurface.accessSegment-12452.test.tsx | 6 +- .../studio-design/studioMenuGroupLabel.ts | 20 +-- .../studio-design/studioMenuModel.test.ts | 15 +- .../views/studio-design/studioMenuModel.ts | 6 +- ui/packages/i18n/src/namespaces/studio/en.ts | 2 - ui/packages/i18n/src/namespaces/studio/zh.ts | 2 - 9 files changed, 199 insertions(+), 36 deletions(-) create mode 100644 ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.groupNames-37082.test.tsx diff --git a/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.groupNames-37082.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.groupNames-37082.test.tsx new file mode 100644 index 00000000000..a502088e811 --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.groupNames-37082.test.tsx @@ -0,0 +1,167 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37082 — one name per group across Studio. The left menu, the All + * metadata directory's group headings and domain chips, and the domain badge + * on a type or item page (`PageShell`, which Setup's datasource pages draw too) + * name the `system` group Platform / 平台 and the `security` group Access / 访问 + * (objectstack ADR-0084, amended 2026-11-24), in en and in zh-CN. + * + * Pinned over the real directory page and the real header, each word compared + * with the menu's own (`studioMenuGroupLabel`); CONTROL: the `data` group keeps + * Data / 数据, and the retired words System / 系统 and Security / 安全 are drawn + * nowhere. + */ + +import '@testing-library/jest-dom/vitest'; +import * as React from 'react'; +import { describe, it, expect, vi, afterEach } from 'vitest'; +import { render, screen, cleanup, within } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; +import { MetadataAreaHostContext, type MetadataAreaHost } from './metadataAreaHost'; +import type { RichMetadataTypeEntry } from './useMetadata'; + +const PKG = 'com.example.showcase'; + +const entry = (type: string, domain: string): RichMetadataTypeEntry => + ({ type, label: type, domain, allowEnvironmentOverlay: false, allowRuntimeCreate: true }) as RichMetadataTypeEntry; + +const ENTRIES: RichMetadataTypeEntry[] = [ + entry('object', 'data'), + entry('datasource', 'system'), + entry('translation', 'system'), + entry('permission', 'security'), +]; + +const CLIENT = { list: async () => [] }; + +/** The locale the page reads; each case sets it before rendering. */ +let LOCALE = 'en'; + +vi.mock('./useMetadata', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataClient: () => CLIENT, + useMetadataTypes: () => ({ loading: false, error: null, entries: ENTRIES }), + useGlobalDiagnostics: () => ({ + loading: false, + error: null, + summary: { entries: [], total: 0, scannedTypes: 0, scannedItems: 0 }, + byType: {}, + warnByType: {}, + countsByType: {}, + lockedByType: {}, + packagesByType: Object.fromEntries(ENTRIES.map((e) => [e.type, [PKG]])), + allPackages: [PKG], + reload: () => {}, + }), +})); +vi.mock('./i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataLocale: () => LOCALE, +})); +vi.stubGlobal( + 'fetch', + vi.fn(async () => + new Response(JSON.stringify({ success: true, data: { packages: [] } }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ), +); + +import { MetadataDirectoryPage } from './DirectoryPage'; +import { PageShell } from './PageShell'; +import { studioMenuGroupLabel } from '../studio-design/studioMenuGroupLabel'; + +afterEach(() => { + cleanup(); +}); + +const host: MetadataAreaHost = { packageId: PKG, readOnly: false, basePath: `/studio/${PKG}/metadata` }; + +const CASES = [ + { locale: 'en', data: 'Data', platform: 'Platform', access: 'Access', retired: ['System', 'Security'] }, + { locale: 'zh-CN', data: '数据', platform: '平台', access: '访问', retired: ['系统', '安全'] }, +] as const; + +function renderDirectory() { + return render( + + + + + , + ); +} + +function renderShell(type: string, itemName?: string) { + const e = ENTRIES.find((x) => x.type === type); + return render( + + +
+ + , + ); +} + +describe.each(CASES)('one name per group ($locale, objectstack#37082)', (c) => { + it('the menu names the groups Platform and Access', () => { + expect(studioMenuGroupLabel('system', c.locale)).toBe(c.platform); + expect(studioMenuGroupLabel('security', c.locale)).toBe(c.access); + expect(studioMenuGroupLabel('data', c.locale)).toBe(c.data); + }); + + it('the directory\'s group headings use the menu\'s names', async () => { + LOCALE = c.locale; + renderDirectory(); + await screen.findByText('datasource', { selector: 'code' }); + const headings = screen.getAllByRole('heading', { level: 2 }).map((h) => (h.textContent ?? '').trim()); + expect(headings).toEqual( + expect.arrayContaining([ + `${studioMenuGroupLabel('data', c.locale)} (1)`, + `${studioMenuGroupLabel('security', c.locale)} (1)`, + `${studioMenuGroupLabel('system', c.locale)} (2)`, + ]), + ); + expect(headings).toEqual(expect.arrayContaining([`${c.platform} (2)`, `${c.access} (1)`, `${c.data} (1)`])); + for (const word of c.retired) expect(headings.join(' ')).not.toContain(word); + }); + + it('the directory\'s domain chips use the menu\'s names', async () => { + LOCALE = c.locale; + renderDirectory(); + await screen.findByText('datasource', { selector: 'code' }); + expect(screen.getByRole('button', { name: `${studioMenuGroupLabel('system', c.locale)} (2)` })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: `${studioMenuGroupLabel('security', c.locale)} (1)` })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: `${c.platform} (2)` })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: `${c.access} (1)` })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: `${c.data} (1)` })).toBeInTheDocument(); + for (const word of c.retired) { + expect(screen.queryByRole('button', { name: new RegExp(`^${word} \\(`, 'u') })).toBeNull(); + } + }); + + it('a type page\'s badge uses the menu\'s names', () => { + LOCALE = c.locale; + renderShell('datasource'); + const title = document.querySelector('h1')!.parentElement!; + expect(within(title).getByText(studioMenuGroupLabel('system', c.locale))).toBeInTheDocument(); + expect(within(title).getByText(c.platform)).toBeInTheDocument(); + cleanup(); + renderShell('permission'); + expect(within(document.querySelector('h1')!.parentElement!).getByText(c.access)).toBeInTheDocument(); + }); + + it('an item page\'s badge uses the menu\'s names (Setup\'s datasource item page draws this header)', () => { + LOCALE = c.locale; + renderShell('datasource', 'main_db'); + const meta = screen.getByTestId('page-shell-header-meta'); + expect(within(meta).getByText(studioMenuGroupLabel('system', c.locale))).toBeInTheDocument(); + expect(within(meta).getByText(c.platform)).toBeInTheDocument(); + cleanup(); + renderShell('permission', 'sales_rep'); + expect(within(screen.getByTestId('page-shell-header-meta')).getByText(c.access)).toBeInTheDocument(); + for (const word of c.retired) expect(screen.getByTestId('page-shell-header-meta').textContent).not.toContain(word); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/PageShell.narrowHeader-12306.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/PageShell.narrowHeader-12306.test.tsx index 6d138e60c2a..45bc6eaf7b7 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/PageShell.narrowHeader-12306.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/PageShell.narrowHeader-12306.test.tsx @@ -73,7 +73,7 @@ describe('PageShell compact header wraps instead of squeezing the breadcrumb (ob const meta = screen.getByTestId('page-shell-header-meta'); expect(nav.nextElementSibling).toBe(meta); // The chips, the subtitle, the stats and the actions all live in it. - expect(meta).toContainElement(screen.getByText('Security')); + expect(meta).toContainElement(screen.getByText('Access')); expect(meta).toContainElement(screen.getByText('Can be added')); expect(meta).toContainElement(screen.getByText('Permission set')); expect(meta).toContainElement(screen.getByText('Objects granted')); diff --git a/ui/packages/app-shell/src/views/metadata-admin/i18n.ts b/ui/packages/app-shell/src/views/metadata-admin/i18n.ts index 4a06cade625..56974a0e6ce 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/i18n.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/i18n.ts @@ -178,15 +178,22 @@ const TYPE_LABELS_ZH: Record = { picklist: '选项列表', }; +/** + * The group name each registered metadata `domain` is drawn with, everywhere a + * domain is named: the Studio menu, the All metadata directory's headings and + * chips, and the domain badge on a type or item page (Setup's datasource pages + * included). `system` is Platform / 平台 and `security` is Access / 访问, the + * names objectstack ADR-0084 (amended 2026-11-24) gives those two groups. + */ const DOMAIN_LABELS_EN: Record = { data: 'Data', ui: 'UI', automation: 'Automation', ai: 'AI', - system: 'System', + system: 'Platform', platform: 'Platform', identity: 'Identity', - security: 'Security', + security: 'Access', other: 'Other', }; @@ -195,10 +202,10 @@ const DOMAIN_LABELS_ZH: Record = { ui: '界面', automation: '自动化', ai: 'AI', - system: '系统', + system: '平台', platform: '平台', identity: '身份', - security: '安全', + security: '访问', other: '其他', }; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx index eaf13a120fd..ee586e1d63e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx @@ -119,7 +119,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); import { StudioDesignSurface } from './StudioDesignSurface'; -import { t } from '../metadata-admin/i18n'; +import { translateMetadataDomain } from '../metadata-admin/i18n'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; @@ -144,8 +144,8 @@ window.matchMedia = ((query: string) => ({ const key = (type: string, name: string) => `${type}/${name}`; -/** The menu's own name for the `security` group (the shared dictionary keeps "Security"). */ -const ACCESS = t('engine.studio.menu.groupSecurity', 'en'); +/** The `security` group's name, Access (objectstack ADR-0084, amended). */ +const ACCESS = translateMetadataDomain('security', 'en'); const OBJECT_ENTRY = 'studio-menu-entry-type:object'; const PERMISSION_ENTRY = 'studio-menu-entry-type:permission'; diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuGroupLabel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuGroupLabel.ts index 9ccf0577a4d..00077d491ca 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuGroupLabel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuGroupLabel.ts @@ -3,24 +3,16 @@ /** * The name the left menu draws for each of its six groups (objectstack * ADR-0084, amended 2026-11-24; decision 11 of #36890): the registered domain's - * label, except two the amendment renames for the menu, `system` → Platform / - * 平台 and `security` → Access / 访问. + * name in the shared dictionary (`translateMetadataDomain`), which draws + * `system` as Platform / 平台 and `security` as Access / 访问. * - * Menu-only on purpose. The shared dictionary (`translateMetadataDomain`) keeps - * System / 系统 and Security / 安全: it has readers outside the menu, Setup's - * datasource pages among them (`PageShell`'s domain badge), and no other - * Studio heading or chip is renamed by this. + * One dictionary, so the menu, the All metadata directory's headings and chips, + * and a type or item page's domain badge cannot name a group two ways. */ -import { t, translateMetadataDomain } from '../metadata-admin/i18n.js'; +import { translateMetadataDomain } from '../metadata-admin/i18n.js'; import type { StudioMenuGroup } from './studioMenuModel.js'; -const MENU_GROUP_LABEL_KEYS: Partial> = { - system: 'engine.studio.menu.groupSystem', - security: 'engine.studio.menu.groupSecurity', -}; - export function studioMenuGroupLabel(group: StudioMenuGroup, locale: string): string { - const key = MENU_GROUP_LABEL_KEYS[group]; - return key ? t(key, locale) : translateMetadataDomain(group, locale); + return translateMetadataDomain(group, locale); } diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts index 9f19b373fb0..52a7023c6d7 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts @@ -121,16 +121,17 @@ describe('the menu search', () => { }); }); -describe('the group names: the menu\'s own, the shared dictionary unchanged', () => { - it('the menu names `system` Platform / 平台 and `security` Access / 访问; the other four as the dictionary does', () => { +describe('the group names: one dictionary for the menu and the directory (ADR-0084, amended)', () => { + it('the menu names `system` Platform / 平台 and `security` Access / 访问', () => { expect(STUDIO_MENU_GROUPS.map((g) => studioMenuGroupLabel(g, 'en'))).toEqual(['Data', 'UI', 'Automation', 'Platform', 'Access', 'AI']); expect(STUDIO_MENU_GROUPS.map((g) => studioMenuGroupLabel(g, 'zh-CN'))).toEqual(['数据', '界面', '自动化', '平台', '访问', 'AI']); }); - it('the shared dictionary keeps System / 系统 and Security / 安全 (Setup\'s datasource pages read it, `PageShell`\'s badge)', () => { - expect(translateMetadataDomain('system', 'en')).toBe('System'); - expect(translateMetadataDomain('system', 'zh-CN')).toBe('系统'); - expect(translateMetadataDomain('security', 'en')).toBe('Security'); - expect(translateMetadataDomain('security', 'zh-CN')).toBe('安全'); + it('the menu draws each group with the shared dictionary\'s word, in en and zh-CN', () => { + for (const locale of ['en', 'zh-CN']) { + for (const g of STUDIO_MENU_GROUPS) { + expect(studioMenuGroupLabel(g, locale), `${g} in ${locale}`).toBe(translateMetadataDomain(g, locale)); + } + } }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts index 8b56aa389bb..02f1ad82db0 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -10,9 +10,9 @@ * * Six, one per domain the spec registers a metadata type under, in the * amendment's order. A type's group is its served registry `domain`; the - * group's name is the menu's own (`studioMenuGroupLabel`), which draws - * `system` as Platform and `security` as Access (decision 11) while the shared - * dictionary keeps System and Security. + * group's name is the shared domain dictionary's (`studioMenuGroupLabel`), which + * draws `system` as Platform and `security` as Access (decision 11), the same + * names as the directory's headings and chips and a type page's badge. * * ## Entries * diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index 65a4b91d0d4..e966c2e22a8 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -3504,8 +3504,6 @@ const STUDIO_EN: Record = { 'engine.studio.menu.owd': 'Default sharing', 'engine.studio.menu.diagnostics': 'Diagnostics', 'engine.studio.menu.environment': 'Positions and permissions', - 'engine.studio.menu.groupSystem': 'Platform', - 'engine.studio.menu.groupSecurity': 'Access', // objectstack#36502 — the notice on a retired Interfaces link's landing. 'engine.studio.interfacesRetired.sentence': 'Interface edits have moved into the app.', 'engine.studio.interfacesRetired.backToApp': 'Back to the app', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index 94b12e4f705..6edc0610732 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -3095,8 +3095,6 @@ const STUDIO_ZH: Record = { 'engine.studio.menu.owd': '默认共享', 'engine.studio.menu.diagnostics': '诊断', 'engine.studio.menu.environment': '岗位与权限', - 'engine.studio.menu.groupSystem': '平台', - 'engine.studio.menu.groupSecurity': '访问', // objectstack#36502 — 旧「界面」链接落地时的提示。 'engine.studio.interfacesRetired.sentence': '界面的修改已经搬到应用里', 'engine.studio.interfacesRetired.backToApp': '回到应用', From b5fb87598c43a298b4703e7975da4085984d748b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 19:52:36 +0000 Subject: [PATCH 2/2] chore(changeset): studio group names Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .changeset/37082-studio-group-names.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changeset/37082-studio-group-names.md diff --git a/.changeset/37082-studio-group-names.md b/.changeset/37082-studio-group-names.md new file mode 100644 index 00000000000..0dfb8c6b92e --- /dev/null +++ b/.changeset/37082-studio-group-names.md @@ -0,0 +1,15 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +--- + +fix(studio): one name per group: the directory and a type page's badge say Platform / Access, like the menu + +Clause-②: no +Metadata-protocol: none + +ADR-0084 (amended) · part of the Studio redesign follow-ups. + +- **The shared domain dictionary (`translateMetadataDomain`) names the `system` group Platform / 平台 and the `security` group Access / 访问**, the amended ADR-0084's group names. It used to say System / 系统 and Security / 安全 while the Studio left menu said Platform / Access. +- **Every place a group is named now reads that one dictionary:** the Studio left menu (`studioMenuGroupLabel` reads it instead of its own two keys), the All metadata directory's group headings and domain chips, and the domain badge on a type or item page (`PageShell`). Setup's datasource pages draw the same badge, so a datasource reads Platform / 平台 there too, the group ADR-0084 puts it in. +- The menu-only keys `engine.studio.menu.groupSystem` and `engine.studio.menu.groupSecurity` are removed from the `studio` namespace (en and zh); nothing reads them any more.