Skip to content

Commit 001c04b

Browse files
fix(spec): the permission-set form's Name help says when the name is filled from the label, and when to type it (#28229)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoSN3dVT8Lzd6qoG8RSVGvMt)_ Fixes #28180 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:新建权限集表单里 API 名称(Name)的提示改为同时说明两种情况:显示名称里有拉丁字母或数字时自动填写,没有时(例如全中文、全日文)请自己输入;中、日、西三种语言的译文同步改。 - 为什么改:Console 只用显示名称里的拉丁字母和数字生成 Name,中文或日文名称生成的是空值;旧提示却说“由显示名称自动生成”,中文和日文用户看到的是一个空的必填框配一句“已自动生成”。 - 风险与回滚:只改提示文字,表单结构、Schema、生成逻辑都不变;回滚即 revert 本 PR。 - 先看:packages/spec/src/security/permission.form.ts(Identity 区 name 行)、packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts(permission.fields.name)、packages/spec/src/security/permission-form-label-first.test.ts。 - 两分钟验证:`pnpm --filter @objectstack/spec exec vitest run src/security/permission-form-label-first.test.ts`,预期 6 个用例全绿;或在中文界面的 Console 新建权限集,Name 下的提示说明全中文名称需手动输入。 - 需要你做的:无,席位落地。 ## What changes The Console's create form fills a new permission set's `name` from the label through `slugify`, which keeps only `[a-z0-9]` after NFKD normalisation (`ui/packages/app-shell/src/views/metadata-admin/createDerive.ts`, wired for `permission` in `anchors.ts` with `untilUserEdits`). A label written all in Chinese or Japanese therefore fills nothing. The `name` help said "Derived from the label when you create the set; snake_case", so a zh-CN or ja-JP admin saw an empty, required Name under a hint that said it had been filled. - `packages/spec/src/security/permission.form.ts`: the `name` help now names both outcomes: "Filled in from the label's Latin letters and digits when you create the set; if the label has none, type it yourself. snake_case". The comment above the rows records why. - `packages/platform-objects/src/apps/translations/*.metadata-forms.generated.ts`: `en` follows the source (regenerated by `node scripts/check-i18n-bundles.mjs --write`, which left the tree unchanged against the committed text); the hand-written zh-CN, ja-JP and es-ES values say the same two cases. Metadata-form leaves carry no source-hash entry, so no hash table moves. - Measured: no other `*.form.ts` `name` help makes the "derived from the label" promise (the other `name` rows say only `snake_case` / unique identifier), so this is the only row. ## Tests - `packages/spec/src/security/permission-form-label-first.test.ts`: the help case now asserts the help says the name comes from the label, says to type it otherwise, and still says `snake_case`; a control asserts the unconditional "derived from the label" wording is gone. ## Acceptance notes - **Out of scope, per triage (6527260428):** a prompt next to Name on the Console create form when the derivation comes back empty, which `createDerive.ts` assumes exists. That is a `ui/` change and its own p3 card; the seat carries it. - The same empty derivation applies to every other type wired with `slugify` in `anchors.ts` (flow, action, dashboard, report, object, page, view, hook, and doc in `default-schemas.ts`). None of their `name` helps promises a fill, so none is misleading; the Console prompt above would cover them all. ## Verification All readings at head `58bba46c` on objectstack-ai/objectstack (merge base `3a2f4c00`). <details><summary>Tests</summary> - `pnpm --filter @objectstack/spec exec vitest run src/security/permission-form-label-first.test.ts`: Test Files 1/1, Tests 6/6. - `pnpm --filter @objectstack/spec typecheck`, `pnpm --filter @objectstack/platform-objects typecheck` and `pnpm --filter @objectstack/platform-objects test` (Test Files 103/103, Tests 1447/1447): lock VERDICT command-exit 0. - Reverse verification: the old help text put back in `permission.form.ts` (on-disk count old=1, new=0), the test reds 1 failed / 6; restored to the HEAD blob (hash match, `git diff HEAD` empty). - `node scripts/check-i18n-bundles.mjs --write`: exit 0, no diff, so the committed `en` text equals the generator's output and the three hand translations survive merge mode. </details> <details><summary>Gates</summary> - Workspace build (`turbo run build`, real declarations, excluding docs and `ui/`): 77/77 tasks, lock VERDICT command-exit 0. - `dispatch-gates --commands` at `58bba46c`: 81 families, each run with stdin from `/dev/null`, exit codes recorded before any pipe. `--ran`: 81 derived, 81 run, 0 NOT MEASURED, 0 unrun, 0 red. - One family first answered exit 3 (prerequisite not met) and was re-run after fetching its pinned control commit into the shallow clone, exit 0: `check-plugin-teardown-shape --self-test`. - `pnpm --filter @objectstack/spec check:generated`: exit 0, every generated artifact up to date. - The full CI farm (`test:repo`, the UI lanes) is CI's. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibzo5N4z5piyjA2oqZm)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 39da1bd commit 001c04b

7 files changed

Lines changed: 29 additions & 8 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
fix(spec): the permission-set form's Name help says when the name is filled from the label, and when to type it
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
The Console's create form fills a new permission set's Name from the Label's Latin letters and digits only, so a label written all in Chinese or Japanese fills nothing. The Name help used to say the name is derived from the label in every case, so a zh-CN or ja-JP administrator saw an empty, required Name under a hint that said it had been filled. The help now names both outcomes: filled from the label's Latin letters and digits, otherwise typed by the administrator, in snake_case. The zh-CN, ja-JP and es-ES translations follow. No schema, accepted value or create behaviour changes.

‎packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
23912391
},
23922392
name: {
23932393
label: "Name",
2394-
helpText: "Derived from the label when you create the set; snake_case"
2394+
helpText: "Filled in from the label's Latin letters and digits when you create the set; if the label has none, type it yourself. snake_case"
23952395
},
23962396
description: {
23972397
label: "Description",

‎packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
23912391
},
23922392
name: {
23932393
label: "Nombre",
2394-
helpText: "Se deriva de la etiqueta al crear el conjunto; snake_case"
2394+
helpText: "Se rellena con las letras latinas y los dígitos de la etiqueta al crear el conjunto; si la etiqueta no tiene ninguno, escríbelo. snake_case"
23952395
},
23962396
description: {
23972397
label: "Descripción",

‎packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ export const jaJPMetadataForms: NonNullable<TranslationData['metadataForms']> =
23912391
},
23922392
name: {
23932393
label: "名前",
2394-
helpText: "作成時に表示名から自動生成されます。snake_case"
2394+
helpText: "作成時に表示名の英数字から自動入力されます。表示名に英数字がない場合(日本語のみなど)は手動で入力してください。snake_case"
23952395
},
23962396
description: {
23972397
label: "説明",

‎packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ export const zhCNMetadataForms: NonNullable<TranslationData['metadataForms']> =
23912391
},
23922392
name: {
23932393
label: "名称",
2394-
helpText: "创建权限集时由显示名称自动生成;snake_case"
2394+
helpText: "创建权限集时由显示名称中的拉丁字母和数字自动填写;显示名称不含这些字符时(如全为中文)请自行输入。snake_case"
23952395
},
23962396
description: {
23972397
label: "描述",

‎packages/spec/src/security/permission-form-label-first.test.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ describe('permission-set form — Label first and required, Name after it', () =
4949
expect(row('description')?.required).toBeUndefined();
5050
});
5151

52-
it("the name's help says it comes from the label", () => {
53-
expect(row('name')?.helpText).toMatch(/derived from the label/i);
54-
expect(row('name')?.helpText).toMatch(/snake_case/);
52+
// The create form fills `name` from the label's Latin letters and digits
53+
// only, so a label written all in Chinese or Japanese fills nothing. The help
54+
// names both outcomes rather than promising a fill those labels never get.
55+
it("the name's help says when it comes from the label, and when to type it", () => {
56+
const help = row('name')?.helpText ?? '';
57+
expect(help).toMatch(/from the label/i);
58+
expect(help).toMatch(/type it/i);
59+
expect(help).toMatch(/snake_case/);
60+
// CONTROL: the unconditional promise is gone.
61+
expect(help).not.toMatch(/derived from the label/i);
5562
});
5663

5764
it('moves no accept set: the schema still parses a set with no label', () => {

‎packages/spec/src/security/permission.form.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ export const permissionForm = defineForm({
3434
// Console's create form fills `name` from the label until `name` is
3535
// edited. `required` on a row is a form-layout flag: `PermissionSetSchema`
3636
// still accepts a set with no label, so no API accept set moves.
37+
// The fill keeps only the label's Latin letters and digits, so a label
38+
// written all in Chinese or Japanese fills nothing: the `name` help says
39+
// both outcomes, or a zh-CN / ja-JP admin reads "filled" over an empty field.
3740
{ field: 'label', required: true, colSpan: 1, helpText: 'Display label for admins' },
38-
{ field: 'name', required: true, colSpan: 1, helpText: 'Derived from the label when you create the set; snake_case' },
41+
{ field: 'name', required: true, colSpan: 1, helpText: "Filled in from the label's Latin letters and digits when you create the set; if the label has none, type it yourself. snake_case" },
3942
// #19331 — four declared keys had no control, so the only door to any of
4043
// them was the Source tab's free-text JSON. `description` is persisted on
4144
// sys_permission_set and shown in Setup; of the other three, `packageId`

0 commit comments

Comments
 (0)