Skip to content

Commit 431f880

Browse files
docs(skills): objectstack-i18n teaches that a stack may translate the platform's Setup and Account apps (#39033)
Fixes #38793 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:让 AI 把平台自带的“设置”和“账户”两个应用的标题、菜单翻译成中文时,AI 现在会直接写出翻译;以前它会说做不了,或者另造一个同名应用。 - 为什么做:属于“应用翻译”这条线;平台已经放行这类翻译,但教 AI 的技能说明和文档页还停在旧说法。 - 出错会怎样:AI 作者如果把菜单项的标识抄错,校验不会报错,那一项会继续显示原文;本改动只有文字,可以直接撤回。 - 要你做什么:审阅并亲手合并(技能文字属于须由你合并的范围)。 ## What changes Read first, by risk: 1. `skills/objectstack-i18n/SKILL.md`, the verify line (First checks 3) and the new first note under the key map. This is the text an AI author follows. 2. `skills/objectstack-i18n/SKILL.md`, the four places that pay for it (title line, locale check, the `inlineTitle` note, the report and book note). 3. `content/docs/protocol/kernel/i18n-standard.mdx`, the `apps.{app}` and `apps.{app}.navigation.{id}` rows. The skill now says what the merged `translation-target-unknown` rule does, in the words of its `os explain` text ("A platform app a stock runtime serves (`setup`, `account`) resolves too and its navigation ids are not judged: the runtime applies the key over the served app, whose items come from the plugins the deployment composes."): - The refusal sentence stays and is scoped: `os validate` refuses a key naming nothing the metadata declares, except a platform app's. - One note under the key map: `apps.setup` and `apps.account` translate the platform apps a stock runtime serves; `os validate` does not judge their `navigation.{id}` ids, which the deployment's plugins supply, so the ids are read from the served app. The docs rows carry the same two facts in full, plus what the skill has no room for and the rule's code and tests state: `studio` is not served by a stock boot and stays an orphan; a stack that declares its own app under one of the two names is judged against its own declaration; ids the stack itself contributes into a platform app are not judged either; and a `translation` item saved through the metadata API is judged against the served apps when the host states them. One eval case (id 17, `bundles-locales-coverage.json`): a stack that declares no `setup` app is asked to translate Setup's title and its `nav_users` entry. The answer must contain `apps`, `setup`, `navigation`, `nav_users` and the translated label, and must not declare an app to carry the key. Skill size, the two readings: | | before | after | |:--|:--|:--| | `skills/objectstack-i18n/SKILL.md`, lines | 161 | 162 | | `skills/objectstack-i18n/SKILL.md`, tokens (ratchet convention) | 2243 | 2243 (ceiling 2243) | | all `skills/*/SKILL.md`, lines | 2144 | 2145 | | authored bundle, tokens | 182270 | 182270 | The file sat at zero headroom, so the new text is paid for by deletion in the same file: a shorter title line, the clause "not an English `defaultLocale`" (the sentence already names the two values to declare), and three worked key paths that restated their own sentence (the child-object `inlineTitle` path, the report block path, the book group path). The rules those paths illustrated still read in full, and the eval cases that grade them (ids 8 and 9) supply the names in their prompts. The ceiling row is not touched. ## Tests Text only; no package source changes, so there is no package test to run. All readings at head `0d07a96c`. <details><summary>Local gate readings</summary> - `node scripts/check-skills-token-ratchet.mjs`: exit 0, "61 authored bundle file(s) within their ceilings"; the i18n row reads `2243 / 2243 (+0)`. - `pnpm --filter @objectstack/spec run check:skill-examples`: exit 0, "344 prose examples type-check across 3 surface(s)" (after building the client-react closure it reads). - `pnpm --filter @objectstack/spec run check:skill-docs`, `check:skill-refs`, `check:docs`: exit 0. - `pnpm check:skill-links`, `check:skill-identifier-liveness`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:skill-top-level-keys`, `check:doc-authoring`, `check:doc-anchors`, `check:nul-bytes`: exit 0. - Every other family `dispatch-gates.mjs --commands` derives (75 in all): exit 0, except the two below. `--ran`: "75 derived famil(ies) accounted for, 74 run, 1 NOT-MEASURED". - NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3, its own prerequisite refusal (it needs a full workspace build); left to CI. - RED, and not a verdict on this diff: `pnpm check:closed-ceremony-text`, exit 1, `spawnSync git ENOBUFS`. See Acceptance notes. </details> ## Acceptance notes - `pnpm check:closed-ceremony-text` is expected to be red on this PR for a reason outside the diff. Its file listing runs `git ls-files -z` over `packages`, `content/docs` and `.changeset` through `execFileSync` with the default 1 MiB output buffer. On `origin/main` at `444dce61` that listing is 1,048,565 bytes, 11 bytes under the 1,048,576 limit; this PR's one new changeset path takes it to 1,048,611 and the call throws before any file is read. The same gate exited 0 on this branch one commit earlier (`6b959d0d`, every content change, no new file). Any pull request that adds a tracked path of 12 bytes or more under those roots meets the same failure. The fix belongs to that script (a `maxBuffer` on the call) and is outside this card's file surface, so it is reported to the seat and not made here. The phrases the gate looks for do not occur in the added text (grep over the changeset: 0 hits). - The skill does not state the metadata-API case or the `studio` and own-declaration cases; the docs rows do. The entry file had no room for them without cutting a rule. - The skill tells the author to read navigation ids from the served app and does not name a command or route for it. ## Verification Two minutes: run `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-translation-references.test.ts -t "a platform app the runtime serves"` and compare its five cases with the two skill sentences and the two docs rows: accepted with any navigation id; accepted when the stack also contributes into the app; `studio` reported; an own `setup` app judged against its own declaration; at the save door, a platform app the environment does not serve reported. ## Patch round 1 Head `309fcaea`, answering the contract review of `f7641974` (M1, S1; comment 7335881986). The skill file is unchanged from the reviewed head. - M1: eval case 8 required `crm_opportunity_line_item` and `open_block`, which only the two worked paths this PR removed from the entry file spelled. Its prompt now names the child object, its field and the block, so the case grades the rule (the key is the child's; a block is keyed by its `name`) and not a recalled name. - S1: eval case 17 now requires a written bundle: one any-of group over the navigation key (`nav_users: {`, its JSON spelling, or `navigation.nav_users.label`) and one over the app title's `label` spelling. An answer that echoes the prompt or declines no longer passes. - Readings at `309fcaea` (dev report 7336075205): token ratchet exit 0, i18n row `2243 / 2243 (+0)`; the eval reader's test (`test/skill-evals/skill-evals.test.ts`) 40 passed; 73 of the 75 derived gate families exit 0, 2 not measured locally (`check:dual-build-cjs-loads` needs a full build; the comment-mask sweep reads JS sources and this round changed none). --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ)_ <!-- signed: repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a0ee7d2 commit 431f880

4 files changed

Lines changed: 46 additions & 12 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-i18n teaches that a stack may translate the platform's Setup and Account apps
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`os validate` accepts an `apps.setup` or `apps.account` key in a stack's translation bundle and the runtime applies it over the served app, but the published skill said only that a key naming nothing the metadata declares is refused. An AI author asked to translate Setup's menu either declined or declared an app of its own named `setup`. Text only: no schema, rule or runtime behaviour changes here.
11+
12+
`skills/objectstack-i18n/SKILL.md`:
13+
14+
- The verify line keeps its refusal sentence and scopes it: a key naming nothing the metadata declares is refused, except a platform app's.
15+
- The key map gains one note: `apps.setup` and `apps.account` translate the platform apps a stock runtime serves; `os validate` does not judge the `navigation.{id}` ids under them, because the deployment's plugins supply those items, so the ids are read from the served app.
16+
17+
The file does not grow. The new text is paid for inside it: the title line is shortened, the locale check no longer repeats "not an English `defaultLocale`" after naming the two values to declare, and three worked key paths that restated their own sentence are dropped (the child-object `inlineTitle` path, the report block path and the book group path). Each rule those paths illustrated still reads in full.
18+
19+
One eval case is added: a stack that declares no `setup` app translates `apps.setup.label` and `apps.setup.navigation.nav_users.label`, and the answer must write the bundle (the navigation key and the title's `label`) and must not declare an app to carry the key. The existing case about a child grid title and a report block now names the child object, its field and the block in its prompt, since the entry file no longer spells those two paths.

‎content/docs/protocol/kernel/i18n-standard.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,8 +1200,8 @@ beneath an action entry are judged the same way under either.
12001200
| `{action}.resultDialog.fields.{path}` | the literal `path` of a field the action's `resultDialog.fields[]` declares — dots included, so `client.secret` is one key |
12011201
| `{action}.resultDialog.columns.{path}.{column}` / `{action}.preflight.columns.{path}.{column}` | a column header of a table: `{path}` the literal `path` of a `format: 'table'` field in that block's `fields[]`, `{column}` the literal `path` of one of its `columns[]` — dots included at both levels, so `columns.rows["error.message"]` is two keys deep, not three |
12021202
| `{action}.resultDialog.title` / `.description` / `.acknowledge` | an action that declares a `resultDialog`, whether or not the dialog sets that text itself — for an action that declares none, nothing reads the dialog's copy |
1203-
| `apps.{app}` | an app declared, or one a `navigationContributions` entry anywhere in the artifact contributes into — including an app owned outside the artifact; under an app that is only contributed into, `apps.{app}.label` may be left out (the owning package's label survives the merge) |
1204-
| `apps.{app}.navigation.{id}` | a navigation item `id` the app declares (nested `children` and `areas[]` included) or one contributed into it; under an app that is only contributed into, the contributed ids alone |
1203+
| `apps.{app}` | an app declared, or one a `navigationContributions` entry anywhere in the artifact contributes into — including an app owned outside the artifact; under an app that is only contributed into, `apps.{app}.label` may be left out (the owning package's label survives the merge); **or** a platform app a stock runtime serves that the stack does not declare itself: `setup` or `account` (`PLATFORM_PROVIDED_APP_NAMES` in `@objectstack/spec/system`). The runtime applies the key over the served app, so the stack's label is the one shown. `studio` is not one of them: a stock boot does not serve it, so `apps.studio` is an orphan. A stack that declares its own app under one of these names is judged against its own declaration |
1204+
| `apps.{app}.navigation.{id}` | a navigation item `id` the app declares (nested `children` and `areas[]` included) or one contributed into it; under an app that is only contributed into, the contributed ids alone. Under a platform app the stack does not declare (`setup`, `account`) the ids are **not judged**, ids the stack itself contributes into it included: that app's menu comes from the plugins the deployment composes, which these commands cannot see, the same reason a platform object's fields are not judged. A mistyped id there is not reported and translates nothing, so read each `id` from the served app. When a `translation` item is saved through the metadata API and the host states the apps the environment serves, those served apps are the reference instead: a platform app it serves resolves with its ids judged against the served items, and one it does not serve is an orphan |
12051205
| `dashboards.{dash}` / `.widgets.{id}` / `.actions.{actionUrl}` | a dashboard declared / a widget `id` on it / a header action's `actionUrl` on it |
12061206
| `flows.{flow}` | a flow's machine `name`, declared |
12071207
| `positions.{name}` | a position's `name`, declared, or an audience anchor (`everyone`, `guest`) |

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ metadata:
1616
tags: i18n, translation, locale, l10n, bundle, coverage
1717
---
1818

19-
# Internationalization — ObjectStack I18n Protocol
19+
# ObjectStack i18n
2020

2121
## First checks
2222

@@ -29,10 +29,10 @@ metadata:
2929
read by `os lint`, `os i18n check`, `os i18n extract` and label serving;
3030
`supportedLocales` are BCP-47 codes (`ja-JP`); `fallbackLocale` serves a missing
3131
translation. An app authored in English for Chinese users declares
32-
`defaultLocale: 'zh-CN', sourceLocale: 'en'`, not an English `defaultLocale`.
32+
`defaultLocale: 'zh-CN', sourceLocale: 'en'`.
3333
3. **Verify**: `os i18n check` lists missing keys per locale (`--locales=zh-CN`; CI:
3434
`--strict --threshold=95`); `os validate` refuses a key naming nothing the metadata
35-
declares (`translation-target-unknown`).
35+
declares, except a platform app's (`translation-target-unknown`).
3636

3737
## A bundle
3838

@@ -105,20 +105,21 @@ hooks.{hook}: texts.{key}.message, and refusals as under _actions
105105
messages: flat dotted ids ('common.save'); dashboards, metadataForms, settingsCommon
106106
```
107107

108+
- `apps.setup` and `apps.account` translate the platform apps a stock runtime serves.
109+
`os validate` does not judge their `navigation.{id}` ids, which the deployment's plugins
110+
supply, so read them from the served app.
108111
- `inlineTitle` (the grid a `master_detail` or `lookup` field draws on its parent's form) and
109112
`relatedListTitle` (its related list on the parent's record page) are keys of the CHILD
110-
object, where the field lives: `objects.crm_opportunity_line_item.fields.opportunity.inlineTitle`.
111-
Untranslated, the authored text shows, never the child's plural label.
113+
object, where the field lives. Untranslated, the authored text shows, never the child's
114+
plural label.
112115
- A form's `sections` are read before `_sections`, key by key.
113116
- `columns` is a sibling of `fields`: a `format: 'table'` field's `path`, then a column's
114117
(`resultDialog: { columns: { rows: { email: '邮箱', 'error.message': '原因' } } }`).
115118
`preflight` holds `fields` and `columns` only, no `title`.
116119
- `_relatedLists.{list}` is on the parent, for a `relatedLists` entry that authors a `label`;
117120
one without has no key and shows the child field's `relatedListTitle`, else its plural label.
118-
- A report block is keyed by its `name`
119-
(`reports.showcase_task_overview.blocks.open_block.label`); a `books` group by its stable
120-
`key`, never its position (`books.crm_manual.groups.getting_started.label`); its pages
121-
localize through `doc.translations`.
121+
- A report block is keyed by its `name`; a `books` group by its stable `key`, never its
122+
position; its pages localize through `doc.translations`.
122123
- A flow step is keyed under `approvals`, `screens` or `nodes` (any other kind).
123124
`os i18n check` asks for a technical step (`script`, `http`, `connector_action`,
124125
`assignment`, `boundary_event`, `*_record`) only where a decision's branch leads to it.

‎skills/objectstack-i18n/evals/bundles-locales-coverage.json‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
},
7474
{
7575
"id": 8,
76-
"prompt": "In zh-CN the `Products` grid heading on the `crm_opportunity` form and the `Open Tasks` block heading of the joined `showcase_task_overview` report are still English.",
76+
"prompt": "In zh-CN the `Products` grid heading on the `crm_opportunity` form, drawn by the `opportunity` field of `crm_opportunity_line_item`, and the `Open Tasks` heading of the block named `open_block` in the joined `showcase_task_overview` report are still English.",
7777
"expected_output": "`objects.crm_opportunity_line_item.fields.opportunity.inlineTitle` — the field lives on the child object, so the key is the child's, and an untranslated `inlineTitle` keeps its authored text (no fallback to the child's plural label); `reports.showcase_task_overview.blocks.open_block.label`, keyed by the block's required `name`.",
7878
"files": [],
7979
"assertions": {
@@ -160,6 +160,20 @@
160160
"must_contain": ["_relatedLists", "crm_event.related_to", "nodes", "high_value"],
161161
"must_not_contain": ["approvals.high_value", "screens.high_value"]
162162
}
163+
},
164+
{
165+
"id": 17,
166+
"prompt": "Our stack declares one app, `crm`, and nothing named `setup`. Our zh-CN admins want the platform's Setup app titled 设置 and its Users menu entry, whose served navigation item `id` is `nav_users`, to read 用户. Can our own translation bundle carry that, or does `os validate` refuse the keys because our stack declares no `setup` app?",
167+
"expected_output": "Yes, in the stack's zh-CN `TranslationData`: `apps: { setup: { label: '设置', navigation: { nav_users: { label: '用户' } } } }`, that is `apps.setup.label` and `apps.setup.navigation.nav_users.label`. `setup` (like `account`) is a platform app a stock runtime serves, so the key translates the served app and `os validate` does not refuse it, though the stack declares no such app. `os validate` does not judge the navigation ids under it, because the deployment's plugins supply that menu's items; so the `id` is read from the served app (here `nav_users`), never guessed. The stack declares no app of its own named `setup` to carry the key.",
168+
"files": [],
169+
"assertions": {
170+
"must_contain": ["apps", "setup", "navigation", "nav_users", "用户"],
171+
"must_contain_any": [
172+
["nav_users: {", "\"nav_users\": {", "navigation.nav_users.label"],
173+
["label: '设置'", "label: \"设置\"", "\"label\": \"设置\""]
174+
],
175+
"must_not_contain": ["defineApp", "name: 'setup'"]
176+
}
163177
}
164178
]
165179
}

0 commit comments

Comments
 (0)