Repository navigation
Commit 001c04b
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
- .changeset
- packages
- platform-objects/src/apps/translations
- spec/src/security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
| 2394 | + | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
| 2394 | + | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
| 2394 | + | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
| 2394 | + | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | | - | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
0 commit comments