Skip to content

Commit a10987a

Browse files
feat(studio): the object Settings tab speaks business language, keys as small print, developer options last (#36540)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9GNMYnbm5cgRkMqUGpXobrR)_ Fixes #36512 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用 Studio 改对象的人,在对象的「设置」页签上会看到:标题改成了业务说法,页面上不再出现 ADR 编号;设置项旁边用灰色小字标出键名,可以选中复制;内部名称、默认谁能访问、额外需要的权限移到页面最下面的「开发者选项」,默认展开。 - 属于「Studio 的保存方式和用词」专题,是其中「设置页说业务话」这一张卡,解决管理员看不懂设置页的问题。 - 改的只是文字和摆放位置,每个设置的含义和保存的内容都没有变;如果有措辞不妥,只影响显示,可以直接撤回。 - 无。 ## What changes The object Settings tab in Studio is now in two parts, and its wording is written for people who do not know the platform's internals. - **Business settings first.** Basics (label, plural label, icon and colour, description), who can see which records, how records are shown (record name field, stage field, highlight fields, record page tabs), and features. - **"Developer options" last.** Expanded, with no switch. It holds the internal name (read-only once the object exists), who can open the object by default (`access.default`) and the extra permissions it requires (`requiredPermissions`). Both parts are the one object inspector, mounted twice through a new optional `split` prop on `MetadataDefaultInspectorProps`. Without `split`, every other host of that inspector draws the whole panel, as before, with no key small print. - **Keys as small print.** Each setting's title has lost its parenthesised key (`(nameField)`, `(enable.*)`, …). The key it writes is drawn beside the title as small grey monospace text, and one click selects all of it. The key sits outside the control's `label`, so selecting it neither opens a picker nor flips a switch, and each control's accessible name is its title alone. Pickers are now named through `label htmlFor`. - **No ADR numbers or rule codes.** `ADR-0085`, `ADR-0056/0090`, `ADR-0090 D1`, `security-owd-unset` and `(master-detail)` are gone from the tab's strings, in both `en` and `zh`. The studio namespace ships only those two catalogues (`STUDIO_LANGUAGE_CODES`); every other language falls back to `en`, so there is no other language file to sync. - Saved content and what each setting means are unchanged. The other tabs (Validations, Hooks, Actions, API) are untouched. ### The three rewrites (card item 4) | Row | Before (en / zh) | After (en / zh) | |---|---|---| | Internal name: title | Name / 名称 | Internal name / 内部名称 | | Internal name: hint | snake_case unique identifier (cannot change after create) / snake_case 唯一标识符(创建后不可修改) | The name code and the API use: lowercase letters, digits and underscores only. It cannot be changed once the object is created. / 代码和接口里使用的名称,只能用小写字母、数字和下划线;对象建好后不能修改。 | | Default access: title | Exposure posture / 暴露姿态 | Who can open it by default / 默认谁能访问 | | Default access: options | Public — covered by wildcard grants (default) · Private — needs an explicit grant / 公开 — 被通配授权覆盖(默认) · 私有 — 需要显式授权 | Standard — anyone with access to all objects (default) · Restricted — only people granted this object by name / 标准 —— 能访问全部对象的人都能访问(默认) · 受限 —— 只有被单独授权访问本对象的人 | | Default access: hints | Covered by a permission set's "*" wildcard grant — the platform default for business objects. · Not covered by "*" wildcard grants: only an explicit grant on this object (or View/Modify All Records) reaches it. … | Anyone whose permission set grants access to all objects can open this one — the usual choice for business objects. · A permission set that grants all objects does not include this one: only a permission set that names this object (or one that can view or modify all records) reaches it. … | | Extra permissions: title | Required capabilities / 必需能力 | Extra permissions required / 额外需要的权限 | | Extra permissions: hint | AND-gate: callers must hold every listed capability IN ADDITION to their CRUD grants. Comma-separated capability names (e.g. manage_platform_settings). A name no permission set grants fails closed at runtime. / AND 门:调用者除 CRUD 授权外,还必须持有列出的每个能力。… | On top of their permission to view, create, edit or delete this object, a user must hold every permission listed here. Enter permission names separated by commas, such as manage_billing. A name no permission set grants turns everyone away. / 除了对象本身的查看、新建、编辑、删除权限,用户还必须具备这里列出的每一项权限才能使用这个对象。填写权限名,多个用逗号分隔,如 manage_billing。没有任何权限集授予的权限名会让所有人都被拒绝。 | | Access section hint | Exposure posture and capability requirements. Enforced server-side by the security engine. / 暴露姿态与能力要求,由安全引擎在服务端强制。 | Who can open this object by default, and which extra permissions they need. Enforced on the server. / 谁默认能访问这个对象,以及还需要哪些额外权限;由服务端强制执行。 | ### Other section titles and hints | Before (en / zh) | After (en / zh) | |---|---| | Semantic roles — Applied consistently across forms, lists and detail pages (ADR-0085) / 语义角色 — 跨表单 / 列表 / 详情统一生效(ADR-0085) | How records are shown — Forms, lists and record pages all show records this way / 记录的显示方式 — 表单、列表和记录页都按这里的设置显示记录 | | Who can see which records — Baseline record visibility applied before positions and sharing rules (ADR-0056/0090) | … — The starting point for who sees records; positions and sharing rules can open access further / 记录可见范围的起点;岗位和共享规则在此基础上再放宽 | | Sharing model (sharingModel) — … / 共享模型(sharingModel)—— … | Sharing — who can see and edit records someone else owns / 共享方式 —— 谁能查看和编辑别人负责的记录 | | Not set — publishing this object is REFUSED (security-owd-unset). The runtime does fall back to "Only the owner can see" (ADR-0090 D1), … | Not set — publishing this object is refused. Left unset, it behaves as "Only the owner can see", but this has to be a deliberate choice, not a blank. … | | Record visibility is inherited from the parent (master) record through its master-detail relationship. / …通过主从(master-detail)关系继承自父级(主)记录。 | Who can see a record follows the parent record it belongs to, through its master-detail relationship. / 谁能看到这条记录,跟随它所属的主记录(经主从关系)。 | | Record name field (nameField), Lifecycle field (stageField), Highlight fields (highlightFields), Record page tabs (relatedLists) | Record name field, Stage field, Highlight fields, Record page tabs (key as small print) | | Capabilities (enable.*) — Record-page features — every switch here is enforced by the runtime | Features — Turn record-page features on or off for this object; every switch really takes effect / 功能开关 — 为本对象打开或关闭记录页上的功能;每个开关都会真正生效 | | Field change history (trackHistory), Attachments (files), Comments & feed (feeds), Activity timeline (activities), Global search (searchable), Cloning (clone) | the same without the key; Cloning becomes "Duplicate records" / 复制记录, matching the record page's Duplicate / 复制 action | | (new) | Developer options / 开发者选项 — The name code and the API use, and who can open this object / 代码和接口使用的内部名称,以及谁能访问这个对象 | "tenant" in the sharing descriptions now reads "organization" / 组织. "Not declared" now reads "Not set" / 未设置. ### Keys changed (studio namespace, `en.ts` and `zh.ts`) - `engine.studio.settings.`: `semanticRoles`, `semanticHint`, `nameField`, `stageField`, `highlightFields`, `undeclared`, `relatedLists`, `relatedListsUndeclared`, `sharingHint`, `sharingModel`, `sharingDescUnset`, `sharingDescPrivate`, `sharingDescPublicRead`, `sharingDescPublicReadWrite`, `sharingDescControlledByParent`, `capabilities`, `capabilitiesHint`, `capTrackHistory`, `capFiles`, `capFeeds`, `capActivities`, `capSearchable`, `capSearchableDesc`, `capClone`, `capCloneDesc`; added `developer`, `developerHint`. - `designer.object.`: `name`, `nameHint`, `section.accessHint`, `posture`, `posture.public`, `posture.private`, `posture.publicHint`, `posture.privateHint`, `reqPerms`, `reqPerms.hint`. The object inspector draws these wherever it is mounted, so the Studio create-object and bundle-item editors read the new wording too. ### Everything the tab draws (card item 5) - **The tab's own catalogue** (`engine.studio.settings.*`, including HighlightFieldsEditor and RelatedListsEditor: add pickers, unlisted/undeclared notes, the preview, badges and column editor): cleaned as above. The two sub-editors needed no code change. Their only same-class text was `undeclared` and `relatedListsUndeclared` ("Not declared"), now "Not set". - **The object inspector** (`designer.object.*`): cleaned as above. - **Runtime-assembled, kept on purpose:** picker options drawn as `Label (field_name)` and related-list add options as `Label (entry)`, and the mono names on highlight and related-list rows. These are field and relationship VALUES that tell same-labelled entries apart, not titles. - **Runtime-assembled, out of this PR:** the spec's controlled_by_parent refusal (see Acceptance notes). ## Tests - New pin `ObjectSettingsPanel.businessWording-36512.test.tsx` (14 cases; the real object inspector is registered). - The en and zh catalogues carry no ADR number, rule code, "snake_case", "AND-gate", "wildcard" or parenthesised key in the tab's keys (floor: 60 keys). - The rendered tab shows no ADR text in en-US or zh-CN. - All 19 keys are drawn as select-all mono small print, outside any label. - Each picker, switch and the internal-name input is named by its title alone. - A click on a key writes nothing. - Developer options is the last section, has no disclosure control, and holds the read-only name, posture and required permissions. The business rows are not in it, and each row is drawn once. - A posture pick writes the same patch as before. - Without `split`, the inspector draws the whole panel and no key small print. - Updated pins: - `ObjectSettingsPanel.test.tsx`: the unset-sharing warning now asserts the rule code is absent; it used to assert it was present. - `ObjectDefaultInspector.test.tsx` and `ObjectDefaultInspector.sharedSelect-11865.test.tsx`: the new label and option text. The latter also gained the collection-time CEL imports `check:test-source-alias` asks of an edited pin. - Ablations, each run once after committing, mutation and restore checked on disk with `scripts/ablation-replace.mjs` (restore: blob equals HEAD, `git diff HEAD` empty): - Key moved inside the capability title label: 2 of 9 cases red. - Developer mount given `part: 'business'`: 5 of 14 cases red. <details><summary>Readings (head e735eb1, origin/main 316f757)</summary> - `pnpm --dir ui exec vitest run --maxWorkers=2` over ObjectSettingsPanel*, ObjectPanels*, DataPillar*, StudioDesignSurface*, the metadata-admin inspectors and the i18n studio-namespace suite, then `type-check` of `@object-ui/app-shell` and `@object-ui/i18n`, at add42cd: Test Files 421 passed (421), Tests 4494 passed, 1 skipped; lock VERDICT command-exit 0. Rerun at e735eb1 for the two pins it touched: 2 files, 25 tests passed. - Clause-② measured on the build declaration closure: `@object-ui/app-shell` `dist/index.d.ts` exports nothing from `default-inspector-registry` (the only mention among entry-exported modules is a doc comment in `preview-registry.d.ts`), so the new `split` prop is not on the published face. The studio catalogues are declared as a string-to-string record in `dist/namespaces/studio/en.d.ts`, so the two added keys move no type. - eslint on the touched files: 0 errors; 1 warning, which was already on main (`no-explicit-any` in the inspector's spec feature-detect). </details> ## Acceptance notes - The `controlled_by_parent` refusal from the spec still cites `ADR-0055 §1` in this one state: sharing set to "Follows its parent record" on an object with no usable master-detail field. The tab shows the save door's words verbatim, by design (objectui#12326), and the text lives in `packages/spec`. carrier: #36526 - A host that registers its own object default inspector, one that does not read `split`, would have its whole panel drawn on both mounts of this tab. No such registration exists in this repository. The built-in one is the only object inspector here. - Screenshots: before and after, full page, en and zh, on the showcase `showcase_account` object, which is read-only there as a code-installed package. They are at `/mnt/project-files/objectstack-seat2/36512-shots/` (`36512-settings-{before,after}-{en,zh-CN}.png`). A page-text scan counted 2 "ADR" hits before and 0 after, in both languages. ## Verification **Read first** (by risk): 1. `ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectDefaultInspector.tsx` — the split: `KeyedTextField` and `RowTitle` must draw exactly what they drew before when no key is passed. 2. `ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx` — the second mount and the `SettingKey` placement outside labels. 3. `ui/packages/i18n/src/namespaces/studio/zh.ts` — the Chinese wording. **Two-minute check:** `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectSettingsPanel.businessWording-36512.test.tsx` should report 14 passed. Or open any object's Settings tab in Studio: "Developer options" is the last section, and every title has its key in small grey text beside it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmQD4KwKe5BckFpeiuB --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 96b7975 commit a10987a

10 files changed

Lines changed: 626 additions & 181 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(studio): the object Settings tab speaks business language, shows each setting's key as small print, and puts the developer options last
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
Studio's object Settings tab is now in two parts. The business settings come first: label, plural label, icon and colour, description, who can see which records, the record name field, the stage field, the highlight fields, the record page tabs and the features. A "Developer options" section comes last, expanded and with no switch. It holds the internal name (read-only once the object exists), who can open the object by default, and the extra permissions it requires.
12+
13+
Titles and descriptions no longer show ADR numbers, internal rule codes or key names in parentheses. The metadata key each setting writes (`nameField`, `sharingModel`, `enable.clone`, `access.default`, `requiredPermissions`, …) is shown as small monospace text beside the setting's title. One click selects the whole key for copying. The key sits outside the control's label, so selecting it neither opens a picker nor flips a switch.
14+
15+
Three descriptions are rewritten so that someone who does not know the platform's internals can follow them: the internal name, the default access ("Standard — anyone with access to all objects" / "Restricted — only people granted this object by name") and the extra required permissions. The English and Chinese texts are both updated; every other language falls back to English for these strings, as before.
16+
17+
What each setting means and what it saves are unchanged.
18+
19+
For hosts of the object default inspector: `MetadataDefaultInspectorProps` gains an optional `split` (`{ part: 'business' | 'developer'; renderKey? }`). Only the object inspector reads it. Without it the inspector draws its whole panel, as before. The reworded object-inspector strings also show wherever that inspector is mounted.

‎ui/packages/app-shell/src/views/metadata-admin/default-inspector-registry.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* `getMetadataDefaultInspector` reads the registry as it is at the moment of the
2121
* call, for non-render code.
2222
*/
23-
import type { ComponentType } from 'react';
23+
import type { ComponentType, ReactNode } from 'react';
2424
import type { SupportedLocale } from './i18n.js';
2525
import { createObservableTypeRegistry, type MetadataSelection } from './preview-registry.js';
2626
import type { SchemaFormIssue } from './SchemaForm.js';
@@ -90,6 +90,16 @@ export interface MetadataDefaultInspectorProps {
9090
* segment-wise prefix of it (objectstack#27865).
9191
*/
9292
onInlineIssueFieldsChange?: (prefixes: ReadonlySet<string>) => void;
93+
/**
94+
* Draw one half of the panel, for a host that lays the two halves out apart
95+
* (objectstack#36512: the object Settings tab puts the rows a developer
96+
* reads — internal name, access — in a section of their own, below the
97+
* business rows). `renderKey` draws, beside a row's title, the metadata key
98+
* that row writes. Omitted: the whole panel, as every other host gets it.
99+
* Only an inspector that splits reads it (today: `object`); one that does
100+
* not draws its whole panel on each mount.
101+
*/
102+
split?: { part: 'business' | 'developer'; renderKey?: (key: string) => ReactNode };
93103
}
94104

95105
export type MetadataDefaultInspector = ComponentType<MetadataDefaultInspectorProps>;

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectDefaultInspector.sharedSelect-11865.test.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,20 @@
3434
*/
3535

3636
import '@testing-library/jest-dom/vitest';
37+
// The inspector reaches the console's dynamic `@objectstack/formula` and
38+
// `@objectstack/lint` imports (CEL authoring); their first load is paid here,
39+
// at collection, never inside a case's clock (`check:test-source-alias`).
40+
import '@objectstack/formula';
41+
import '@objectstack/lint';
3742
import { afterEach, describe, expect, it } from 'vitest';
3843
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
3944

4045
import { ObjectDefaultInspector } from './ObjectDefaultInspector';
4146

4247
afterEach(() => cleanup());
4348

44-
const PUBLIC = 'Public — covered by wildcard grants (default)';
45-
const PRIVATE = 'Private — needs an explicit grant';
49+
const PUBLIC = 'Standard — anyone with access to all objects (default)';
50+
const PRIVATE = 'Restricted — only people granted this object by name';
4651

4752
/** A patch as text, with a key that holds `undefined` named rather than dropped. */
4853
const asText = (patch: unknown) => JSON.stringify(patch, (_k, v) => (v === undefined ? '(undefined)' : v));

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectDefaultInspector.test.tsx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('ObjectDefaultInspector — name editability', () => {
100100
readOnly={false}
101101
/>,
102102
);
103-
expect(labelledInput('Name')).toBeDisabled();
103+
expect(labelledInput('Internal name')).toBeDisabled();
104104
});
105105

106106
it('allows editing the name in create mode (empty host name)', () => {
@@ -114,7 +114,7 @@ describe('ObjectDefaultInspector — name editability', () => {
114114
readOnly={false}
115115
/>,
116116
);
117-
const nameInput = labelledInput('Name');
117+
const nameInput = labelledInput('Internal name');
118118
expect(nameInput).not.toBeDisabled();
119119
fireEvent.change(nameInput, { target: { value: 'My Thing' } });
120120
expect(onPatch).toHaveBeenCalledWith({ name: 'my_thing' });
@@ -148,7 +148,7 @@ describe('ObjectDefaultInspector — create-mode name derivation', () => {
148148

149149
onPatch.mockClear();
150150
// Once the user edits name, label changes no longer overwrite it.
151-
fireEvent.change(labelledInput('Name'), { target: { value: 'so' } });
151+
fireEvent.change(labelledInput('Internal name'), { target: { value: 'so' } });
152152
expect(onPatch).toHaveBeenCalledWith({ name: 'so' });
153153
onPatch.mockClear();
154154
fireEvent.change(labelledInput('Label'), { target: { value: 'Sales Orders' } });
@@ -203,7 +203,7 @@ describe('ObjectDefaultInspector — access section (ADR-0066 D2/D3/④/⑤)', (
203203
/>,
204204
);
205205
expect(screen.getByText('Access')).toBeInTheDocument();
206-
expect(screen.getByTestId('object-access-posture').textContent).toBe('Public — covered by wildcard grants (default)');
206+
expect(screen.getByTestId('object-access-posture').textContent).toBe('Standard — anyone with access to all objects (default)');
207207
});
208208

209209
it('patches access.default=private and clears it back to the spec default', () => {
@@ -217,7 +217,7 @@ describe('ObjectDefaultInspector — access section (ADR-0066 D2/D3/④/⑤)', (
217217
readOnly={false}
218218
/>,
219219
);
220-
pickPosture('Private');
220+
pickPosture('Restricted');
221221
expect(onPatch).toHaveBeenCalledWith({ access: { default: 'private' } });
222222

223223
rerender(
@@ -229,10 +229,10 @@ describe('ObjectDefaultInspector — access section (ADR-0066 D2/D3/④/⑤)', (
229229
readOnly={false}
230230
/>,
231231
);
232-
expect(screen.getByTestId('object-access-posture').textContent).toBe('Private — needs an explicit grant');
232+
expect(screen.getByTestId('object-access-posture').textContent).toBe('Restricted — only people granted this object by name');
233233
// The private hint warns that a grant must exist before publishing.
234234
expect(screen.getByText(/Make sure some permission set grants/i)).toBeInTheDocument();
235-
pickPosture('Public');
235+
pickPosture('Standard');
236236
// public = spec default → the key is cleared, not written out.
237237
expect(onPatch).toHaveBeenCalledWith({ access: undefined });
238238
});
@@ -313,9 +313,9 @@ describe('ObjectDefaultInspector — a Chinese label derives the name by pinyin
313313
}
314314
render(<Host />);
315315
fireEvent.change(labelledInput('Label'), { target: { value: '维修中心' } });
316-
expect(labelledInput('Name').value).toBe('weixiu_zhongxin');
317-
fireEvent.change(labelledInput('Name'), { target: { value: 'repair_center' } });
316+
expect(labelledInput('Internal name').value).toBe('weixiu_zhongxin');
317+
fireEvent.change(labelledInput('Internal name'), { target: { value: 'repair_center' } });
318318
fireEvent.change(labelledInput('Label'), { target: { value: '维修中心二' } });
319-
expect(labelledInput('Name').value).toBe('repair_center');
319+
expect(labelledInput('Internal name').value).toBe('repair_center');
320320
});
321321
});

0 commit comments

Comments
 (0)