Repository navigation
fix(plugin-security): translate the built-in positions under zh-CN, ja-JP and es-ES - #26606
Conversation
…scriptions Setup -> Positions under zh-CN listed the seven built-in positions in English: the plugin's bundle had no positions group. Add hand-authored zh-CN, ja-JP and es-ES entries beside the permission sets, and a test of the served overlay per locale. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nLEq1iuL8pxDHXN76
📓 Docs Drift CheckThis PR changes 1 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 6 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 17 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 792175728decf57336d064025e0e01bccdebadd5 && git checkout 792175728decf57336d064025e0e01bccdebadd5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 500bc9d5c59dc1755ab2bb0c4fc60fa2c8e447e2 352780c30a937b5022659dab51ebf12dfc3bf2ae && git checkout -B drift-repro 500bc9d5c59dc1755ab2bb0c4fc60fa2c8e447e2 && git merge --no-ff 352780c30a937b5022659dab51ebf12dfc3bf2ae
node scripts/docs-audit/affected-docs.mjs --json 500bc9d5c59dc1755ab2bb0c4fc60fa2c8e447e2
|
席位核对 · ACCEPT ·
|
| item | reading |
|---|---|
| Shape | Draft, base main, Fixes #26562. 4 files in plugin-security/src/translations/: the new hand-authored builtin-positions.ts, its test, the index.ts wiring, and a patch changeset. Clause-②: no and Metadata-protocol: none appear in both the body and the changeset. |
| Fix | Triage 6437681727. The dev measured the reader first: GET /api/v1/meta/position runs translateMetaList, then translateMetadataDocument('position'), then translatePosition, which reads positions.<name>.label / .description from the bundle SecurityPlugin loads. So the bundle was missing, not the reader. The seven built-in positions now carry zh-CN, ja-JP and es-ES (the permission-set group's locales), wired beside permissions outside withSourceFallback, as the permission sets are. English is unchanged. |
| Evidence | CI green on head 352780c30a (36 success, 11 skipped, 0 failed). Governed check: NOT governed, 211 changed lines. Red on main (27 of 29 failed), green at head (29 of 29). The package suite passed 4991 tests (45 skipped), and eslint and 61 of 61 derived gates exit 0. No ablation: the diff adds data only and the test is red on main. |
| Landing | 「按照 pm-dispatch 规则复核过的都授权」 (Leehom, 2026-10-25T11:35Z): ready and auto-merge through the relay, once every check on this head is green or an expected skip. |
Generated by Claude Code
Requested by Leehom · project thread
Fixes #26562
Clause-②: no
Metadata-protocol: none
维护者速读
positions组,英文、岗位本身的定义与授权都不变;回滚即 revert 本 PR。packages/plugins/plugin-security/src/translations/builtin-positions.ts(三种语言的译文);translations/index.ts(三行接入);translations/builtin-positions.test.ts。pnpm --filter @objectstack/plugin-security exec vitest run src/translations/builtin-positions.test.ts,预期 29/29 通过;或中文界面打开 设置 → 岗位,内置七项显示中文。What changes
packages/plugins/plugin-security/src/translations/builtin-positions.ts: hand-authoredpositions.NAME.label/.descriptionfor the seven built-in positions (platform_admin,org_owner,org_admin,org_member,org_external,everyone,guest) in zh-CN, ja-JP and es-ES, the locales the built-in permission-set group (permission-sets.ts) covers. Hand-authored for the reason that file gives: this package's extract runs objects-only, soos i18n extractwrites nopositionsgroup. English needs no entry (an untranslated locale serves the declaration's own text). Terms follow this bundle's objects: 岗位 / ポジション / puesto.translations/index.ts: each translated locale ofSecurityTranslationsgainspositionsbesidepermissions, outsidewithSourceFallback's inputs exactly like the permission-set group (enSourcecarries neither, so nothing is judged stale).translations/builtin-positions.test.ts: per locale, the group translates exactly the declared built-ins, no two labels repeat, each label and description is a non-English string naming no machine id, andtranslateMetadataDocument('position', declaration, SecurityTranslations, { locale })serves that locale's label and description with nothing else of the position changed.@objectstack/plugin-securitypatch.No
packages/spec/**change.Why
Card #26562 (triage 6437681727, p2): under zh-CN, Setup → Positions (
/_console/apps/setup/metadata/position) listed the app's positions in Chinese and the platform's seven in English.Reader measured before writing the bundle: the page reads
GET /api/v1/meta/position, whose list read (translateMetaListinpackages/rest/src/meta-item-read-gate.ts) runstranslateMetadataDocument('position', …)with the i18n service's merged bundle; that dispatches totranslatePosition(packages/spec/src/system/i18n-resolver.ts), which readspositions.NAME.label/.description.SecurityPluginloadsSecurityTranslationsinto that service atkernel:ready. So the reader existed and the bundle was missing, as the card says. The built-ins reach the door as registry declarations (builtin-positions.ts,registerBuiltinPositions), keyed byname, which is what the group keys on.Tests
Red first on
main(a14f3e61): the new test, before the bundle was added:Tests 27 failed | 2 passed (29)(every per-locale case; the two population checks pass). On the fix:Tests 29 passed (29).Package suite and typecheck at the fix
pnpm --filter @objectstack/plugin-security build && … typecheck && … testunder the verify lock:VERDICT command-exit 0;Test Files 230 passed (230),Tests 4991 passed | 45 skipped (5036).Lint:
eslint packages/plugins/plugin-security --no-inline-configexit 0.Acceptance notes
everyonereads 全体成员 / 全メンバー / Todos, since the description says every authenticated member holds it;guestreads 访客 / ゲスト / Invitado.org_admin(组织管理员) shares its text with theorganization_adminpermission set's label. They are on different pages and name the same people, so it is left as is.translateMetadataDocumentthe REST door calls.Verification
Head
352780c3(the gate loop started on65852aec, the same tree before a commit-message reword;git diff 65852aec 352780c3is empty).node scripts/pm/dispatch-gates.mjs --ran FILE --repo objectstack-ai/objectstack:61 derived famil(ies) accounted for — 61 run, 0 NOT-MEASURED.Three families first answered exit 3 (prerequisite, nothing measured) and were re-run after their prerequisite, each exit 0:
check-plugin-teardown-shape.mjs --self-testaftergit fetch --unshallow origin main(48 cases pass);check:i18nandcheck:dual-build-cjs-loadsafter a fullturbo run build(VERDICT command-exit 0):check-i18n-bundles: OK (10 package(s) — all bundles in sync, no undeclared authoring keys).test:reponot run locally (the diff touches no repo-project test); CI Test Core runs it. No dogfood battery: no!in the title and no(narrowing)arm.Every derived family and its exit code