Repository navigation
Commit 07bdecd
feat(plugin-security): translate the built-in permission sets' labels (#26145)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XB1tL9mxxeTxkG8bGaGBugq)_
Fixes #26094
Clause-②: no
Metadata-protocol: none
## What changes
Setup → Permission Sets showed the nine built-in permission sets with
English labels under zh-CN (and ja-JP, es-ES), next to each app's
translated sets and, since #26090, next to their own translated
descriptions. Each built-in set's label is now translated through
`permissions.NAME.label`, in the same hand-authored group as the
descriptions
(`packages/plugins/plugin-security/src/translations/permission-sets.ts`).
`translatePermissionSet` already overlays that key on `GET
/meta/permission`, so no wiring changed.
| Set | en | zh-CN | ja-JP | es-ES |
| --- | --- | --- | --- | --- |
| `admin_full_access` | Administrator — Full Access | 管理员 — 完全访问 | 管理者 —
フルアクセス | Administrador — Acceso total |
| `organization_admin` | Organization Administrator | 组织管理员 | 組織管理者 |
Administrador de organización |
| `organization_admin_no_bypass` | Organization Administrator (no record
bypass) | 组织管理员(不绕过记录权限) | 組織管理者(レコード権限のバイパスなし) | Administrador de
organización (sin omitir permisos de registro) |
| `member_default` | Member — Standard Access | 成员 — 标准访问 | メンバー —
標準アクセス | Miembro — Acceso estándar |
| `viewer_readonly` | Viewer — Read-Only | 查看者 — 只读 | 閲覧者 — 読み取り専用 |
Lector — Solo lectura |
| `external_default` | External Member — Own Records | 外部成员 — 仅本人记录 |
外部メンバー — 自分のレコードのみ | Miembro externo — Solo sus registros |
| `mcp_agent_data_read` | MCP Agent — Read Only | MCP AI 助手 — 只读 | MCP
AI アシスタント — 読み取り専用 | Asistente de IA MCP — Solo lectura |
| `mcp_agent_data_write` | MCP Agent — Read & Write | MCP AI 助手 — 读写 |
MCP AI アシスタント — 読み書き | Asistente de IA MCP — Lectura y escritura |
| `mcp_agent_restricted` | MCP Agent — No Data Access | MCP AI 助手 —
无数据权限 | MCP AI アシスタント — データ権限なし | Asistente de IA MCP — Sin acceso a
datos |
Each label keeps the English label's noun-phrase shape (the same " — "
split) and reuses the terms its description in #26090 chose (for example
"AI 助手" / "AI アシスタント" / "Asistente de IA" for the MCP agent sets,
"无数据权限" / "データ権限なし" / "sin acceso a datos" for the restricted one), so a
label and its description agree on one row. No set's grants, name,
English label or description changed.
**Files:** `translations/permission-sets.ts` (27 label entries and the
header comment), `objects/permission-set-descriptions.test.ts` (the pin
now covers labels and the served overlay), one `patch` changeset.
## Evidence
Live read on `pnpm dev:crm -- --fresh` built from head `57b2effa`,
signed in as the seeded admin: `GET
/api/v1/meta/permission?scope=environment` with `Accept-Language: zh-CN`
serves all nine built-in sets with the zh-CN label and zh-CN
description, beside the app's own `CRM 销售用户` and `访客(公开表单)`:
- `admin_full_access` · 管理员 — 完全访问 · 平台运维人员:可读取和修改所有组织中的每条记录…
- `viewer_readonly` · 查看者 — 只读 · 只读用户:在共享允许的范围内查看所有对象的记录…
- `mcp_agent_restricted` · MCP AI 助手 — 无数据权限 · 用户在无数据权限下连接的 AI 助手…
With `Accept-Language: en` the same read serves the English labels
unchanged. The CRM example declares only `en` and `zh-CN` (`GET
/api/v1/i18n/locales`), so ja-JP was read on `pnpm dev:todo -- --fresh`
(it declares ja-JP): all nine ja-JP labels were served. No example
declares es-ES, so es-ES is pinned at unit level only, through the same
resolver the REST boundary calls. I did not build the console here, so
there is no browser screenshot; the REST read is the list the page
renders.
## Tests (head `57b2effa`)
- `pnpm --filter @objectstack/plugin-security test`: Test Files 224
passed (224), Tests 4798 passed, 45 skipped. `pnpm --filter
@objectstack/plugin-security typecheck`: exit 0.
- `permission-set-descriptions.test.ts` (99 tests): per translated
locale, every built-in set carries a label (trimmed, at most 80
characters, no line break, no closing full stop, no code span or set id,
the same " — " split as the English label, not an English copy), no two
sets share a label, and `translateMetadataDocument('permission', set,
SecurityTranslations, { locale })` serves exactly the set with that
locale's label and description. The old assertion that the group carries
no label is gone.
- Ablation on the committed tree (`scripts/ablation-replace.mjs`, anchor
hit 1 → 0, restored to the HEAD blob `97aad9a1`): deleting the zh-CN
`viewer_readonly` label failed 2 tests ("carries a translated label" and
"is served in this locale").
## Gates
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 69 families on `57b2effa`; all 69
ran with exit 0. `--ran` reconciliation: 69 derived, 69 run, 0
NOT-MEASURED. Three first exited 3 on a missing prerequisite and were
re-run: `check-plugin-teardown-shape --self-test` after fetching its
positive-control commit, and `check:i18n` and
`check:dual-build-cjs-loads` after a full `pnpm build` (`check:i18n`:
all bundles in sync). Scoped `eslint --no-inline-config
packages/plugins/plugin-security`: exit 0. CI runs everything else.
## Acceptance notes
- **Still hand-authored, no provenance.** The labels share the
descriptions' limitation: no source-hash table judges this group, so a
changed English label leaves its three translations stale with no
warning (the file header says so). The pin catches a missing or
English-copy entry, not a stale one. Moving labels and descriptions onto
a generated, provenance-checked path was out of scope; it is raised to
the seat, not built.
- `translations/index.ts` still says the hand-authored `permissions`
group carries "description translations". The claim allowed that file
only if the wiring needed it, and it did not, so the comment is left for
the next change there.
- The pin bounds a label at 80 characters, room above the longest
translation (63, the es-ES no-bypass label) while refusing a sentence
pasted as a label.
- No other open PR touches `plugin-security/src/translations/`,
`default-permission-sets.ts` or the pin (39 open PRs read before
pr_create).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01XpZzdGG7nKkYUhqd3reNzL)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3993793 commit 07bdecd
3 files changed
Lines changed: 103 additions & 14 deletions
File tree
- .changeset
- packages/plugins/plugin-security/src
- objects
- translations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
48 | 71 | | |
49 | 72 | | |
50 | 73 | | |
| |||
91 | 114 | | |
92 | 115 | | |
93 | 116 | | |
94 | | - | |
95 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
96 | 143 | | |
97 | 144 | | |
98 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| 46 | + | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| 50 | + | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
| 58 | + | |
48 | 59 | | |
49 | 60 | | |
50 | 61 | | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| 69 | + | |
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
| 73 | + | |
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
| 81 | + | |
66 | 82 | | |
67 | 83 | | |
68 | 84 | | |
| 85 | + | |
69 | 86 | | |
70 | 87 | | |
71 | 88 | | |
| 89 | + | |
72 | 90 | | |
73 | 91 | | |
74 | 92 | | |
| 93 | + | |
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
| 97 | + | |
78 | 98 | | |
79 | 99 | | |
80 | 100 | | |
| 101 | + | |
81 | 102 | | |
82 | 103 | | |
83 | 104 | | |
84 | 105 | | |
85 | 106 | | |
86 | 107 | | |
| 108 | + | |
87 | 109 | | |
88 | 110 | | |
89 | 111 | | |
| 112 | + | |
90 | 113 | | |
91 | 114 | | |
92 | 115 | | |
| 116 | + | |
93 | 117 | | |
94 | 118 | | |
95 | 119 | | |
| 120 | + | |
96 | 121 | | |
97 | 122 | | |
98 | 123 | | |
| 124 | + | |
99 | 125 | | |
100 | 126 | | |
101 | 127 | | |
| 128 | + | |
102 | 129 | | |
103 | 130 | | |
104 | 131 | | |
| 132 | + | |
105 | 133 | | |
106 | 134 | | |
107 | 135 | | |
| 136 | + | |
108 | 137 | | |
109 | 138 | | |
110 | 139 | | |
| 140 | + | |
111 | 141 | | |
112 | 142 | | |
113 | 143 | | |
0 commit comments