Skip to content

Commit 301b7c1

Browse files
docs(skills): the i18n skill names the action table column label keys (#35031)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Fixes #34917 Clause-②: no Metadata-protocol: none Served-tier: CONTRACT_REVIEW_TIER repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz ## 维护者速读 - 改了什么:已发布技能 `objectstack-i18n` 的动作键表补上两个表格列标题键 `resultDialog.columns.{path}.{column_path}` 和 `preflight.columns.{path}.{column_path}`,拒收段补上对应的两种报错情形,zh-CN 示例块加一行表格列标题的写法,evals 加一条用例。 - 为什么改:这两个键运行时已经支持,但技能没提。照技能写翻译的 agent 会把结果表格的列标题留成英文。 - 风险与回滚:只改教学文本和一条 eval,不动 spec、lint 或运行时。新增文字靠同文件删五处重复付账,token 上限行不动(6219 → 6256,上限 6333)。回滚即 revert 本 PR。 - 先看:`skills/objectstack-i18n/SKILL.md` 的 `_actions.{action_name}` 表格行;同文件 `translation-target-unknown` 段的 "Six more shapes" 一句;下面 "Cuts" 列出的五处删减。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 `skills/objectstack-i18n/SKILL.md is 6256 tokens (ceiling 6333; headroom 77)`。 - 需要你做的:无。`check-governed-merges` 判为 Tier H(`skills/**`),按低风险 skills 通道(2026-11-14 #33501 裁决)由席位落地:前提是本 head 有席位达档合同审记录,且写明 `Security-touching: no`。 ## What changes `skills/objectstack-i18n/SKILL.md`: - Key table, `_actions.{action_name}` row: names `resultDialog.columns.{path}.{column_path}` / `preflight.columns.{path}.{column_path}`. They are a table's column headers, written beside `fields`, keyed by the literal `path` of a `format: 'table'` field and then by the literal `path` of one of its `columns[]`, each value a plain string. The existing sentence that `defineTranslationBundle` refuses any other key under `preflight` now ends the list after `columns`, so it no longer says `fields` is the only key. - `translation-target-unknown` paragraph: "Five more shapes" becomes six. The new one is a `columns` key whose field path is no declared `format: 'table'` field, or whose column path that field's `columns[]` does not list. - zh-CN example block: one more line, the column keys as the platform's `sys_user` bundle ships them for `import_sso_users` (`rows` is the table field's `path`, `error.message` one column's). `skills/objectstack-i18n/evals/bundles-locales-coverage.json`: - New case 12: a result-dialog table whose headers stayed English; the prompt asks which bundle key carries them. It requires the dotted key path `resultDialog.columns.rows` and the column path `error.message`. Round 3 (review S2): the rule name `translation-target-unknown` left `must_contain`, because a correct answer to "which key" has no reason to name the lint rule; the refusal sentence stays in `expected_output`. Round 2 (review S1): the path token replaces `columns: { rows:`, and the forbidden `fields: { rows: {` is dropped. The grader matches literal substrings, so both graded spacing, quoting and line breaks. No layout-free token tells the wrong nesting apart in a literal answer, so placement is graded by the required path alone, which a wrong-nesting answer does not state. `error: {` stays as it is (review N3): the dotted spelling `error.message` reads the same whether or not the answer splits it, so no layout-free token does that job. - Case 10 (preflight) said the `preflight` node "holds nothing else" beside `fields`. It now says the node holds only `fields` and `columns`. `.changeset/34917-skills-i18n-action-column-keys.md`: `@objectstack/skills` patch, with both declaration lines. ### Cuts that pay for the text (same file) | Cut | Text that still carries it | |:--|:--| | The paragraph "For the exact Zod shape … read `node_modules/@objectstack/spec/src/system/translation.zod.ts` — `TranslationDataSchema`, `ObjectTranslationDataSchema`, and `FieldTranslationSchema`." | `## References` ("Always `Read` the source for exact field shapes; do not rely on memory of property names") and `references/_index.md`, whose Core schemas line names that file and those three exports | | "interpolation is always simple `{{variable}}` substitution" under *No ICU MessageFormat* | *Simple Format (Default)*, directly above: both adapters "substitute double-brace `{{variable}}` placeholders only" | | "so import the type from `@objectstack/spec/contracts` rather than reading `node_modules` source" under *Service Contract* | The code block directly above it: `import type { II18nService } from '@objectstack/spec/contracts';` | | Workflow step "3. Verify Coverage: Run `os i18n check` (**Translation Coverage** above)"; step 4 is renumbered 3 | `## Translation Coverage` → `os i18n check`, and `## Verify your work` | | "(an action with no `preflight` declares none)" in the refusal paragraph | The key-table row: `preflight.fields.{path}` "only under an action that declares `preflight`" | ### Size readings (`skills/**`) | | Before (origin/main 4443014) | After (bc3f321) | |:--|:--|:--| | `skills/objectstack-i18n/SKILL.md`, lines | 533 | 526 | | `skills/objectstack-i18n/SKILL.md`, tokens (ratchet, ceiling 6333) | 6219 | 6256 | | All `SKILL.md` under `skills/`, lines | 4730 | 4723 | | Bundle total, tokens (whole shipped tree) | 257961 | 258329 | The bundle moves +368 tokens: +37 in the SKILL.md and +331 in the eval fixture, which the ratchet measures and does not price. The ceiling row in `scripts/check-skills-token-ratchet.mjs` is not touched. ## Tests - No runtime behaviour changes, so there is no unit test and no ablation. - Eval assertions, checked by script over all 12 cases at bc3f321: every `must_contain` string is in its `expected_output`, no `must_not_contain` string is, and the ids are distinct. 0 violations. - Case 12 against two probe answers, graded as `grade.ts` does: a correct answer written across lines with quoted keys passes; a wrong-nesting answer written across lines fails. - The taught accept set, probed against the built `@objectstack/spec` and `@objectstack/lint` (results under Verification). ## Acceptance notes - No example app ships an action answer with a `format: 'table'` field. The only shipped one is the platform's `sys_user` → `import_sso_users`, so the example line quotes that bundle. The existing two lines of the block quote `app-crm` and `app-showcase`. - Open PR #34970 edits another section of the same SKILL.md and pays the same ratchet row. A local three-way merge of the two heads is clean and reads 6319 tokens against the 6333 ceiling, so either landing order stays under it. - Open PR #35022 edits the same eval file. A local merge of the two heads is clean and the case ids stay distinct (1 to 12). ## Verification <details><summary>Premise, on origin/main 4443014</summary> - `skills/objectstack-i18n/SKILL.md:167` named `resultDialog.fields.{path}` and `preflight.fields.{path}` and no `columns` key. `:230` named no `columns` refusal. - `packages/spec/src/system/translation.zod.ts`: `ActionResultDialogTranslationSchema.columns` and `ActionPreflightTranslationSchema.columns` are both a record of field path → record of column path → string. - `packages/lint/src/validate-translation-references.ts` (`checkActionAnswerTableColumns`) reports `translation-target-unknown` for a field path with no declared table field, and for a column path the field's `columns[]` does not list. </details> <details><summary>Accept-set probe against the built packages, at 9777f6a (round 2 changed only the eval file)</summary> `defineTranslationBundle`: - ACCEPT `resultDialog.columns.rows.{email, "error.message"}`, `preflight.columns.rows.email`, and the same under `globalActions`. - REFUSE `preflight.title` and `preflight.headers` (`unrecognized_keys`). - REFUSE a column value that is an object (`expected string`) and a `columns.rows` that is a string (`expected record`). `resolveActionResultDialog` / `resolveActionPreflight`, on a `rows` table with columns `email` and `error.message`: - `zh-CN`: result dialog headers `["邮箱","原因"]`, preflight headers `["邮箱"]`. - `en`: `["Email","Reason"]` and `["Email"]` (the authored labels). `validateTranslationReferences`: - Declared columns: no finding. - A column the table does not list, a field that is not a table, a field no row declares, and `preflight.columns` under an action with no `preflight`: each one `error translation-target-unknown`. </details> <details><summary>Gates</summary> Round 1, head 9777f6a: - `os-verify-lock` running `pnpm --workspace-concurrency=2 --filter '@objectstack/lint...' build`: `VERDICT command-exit 0`. - `dispatch-gates --commands`: 48 derived commands. `dispatch-gates --ran`: `48 derived famil(ies) accounted for — 46 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)`. The 46 exited 0. - NOT MEASURED: `pnpm check:dual-build-cjs-loads` and `pnpm check:lean-entry-closure`, both exit 3. They need a full build, which was not run locally. CI runs them. - `node scripts/check-skills-token-ratchet.mjs`: exit 0, `skills/objectstack-i18n/SKILL.md is 6256 tokens (ceiling 6333; headroom 77)`. `--self-test`: exit 0. - `pnpm --filter @objectstack/spec run check:skill-docs`: `Skill docs in sync`. `check:skill-refs` (outside the derived set): `9 generated files in sync`. - `overlap-check` against origin/main 4443014 and open PRs #34970 and #33849: `VERDICT clean exit 0`. Round 2, head 59f7a31 (the diff from round 1 is the eval file alone): - `dispatch-gates --commands` derives the same 48 commands. The 42 that need no build were re-run and all exited 0, the token ratchet among them (SKILL.md still 6256 of 6333; the eval fixture measures 2678 tokens, unpriced). - Not re-run: the four build-backed gates (`check:skill-docs`, `check:doc-formula-expressions`, `check:dts-closure`, `check:sourcemap-no-sources-content`), which do not read the eval file. `check:dual-build-cjs-loads` and `check:lean-entry-closure` remain NOT MEASURED. CI runs all six. - `overlap-check` against origin/main 65ec3c5 and open PRs #35022, #34970 and #33849: `VERDICT clean exit 0`. Round 3, head bc3f321 (the diff from round 2 is one token removed from case 12's `must_contain`): - Eval script check: 0 violations, ids distinct. - `node scripts/check-skills-token-ratchet.mjs`: exit 0, SKILL.md unchanged at 6256 of 6333; the eval fixture measures 2670 tokens, unpriced. - No other gate was re-run for a one-token change to an eval fixture. CI runs the full set. - `overlap-check` against origin/main 1282a46 and open PRs #34970 and #33849: `VERDICT clean exit 0`. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 80d474b commit 301b7c1

3 files changed

Lines changed: 33 additions & 20 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the i18n skill names the action table column label keys
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-i18n's SKILL.md lists `resultDialog.columns.{path}.{column_path}` and `preflight.columns.{path}.{column_path}` in the `_actions.{action_name}` row of its key table: the header labels of a `format: 'table'` answer field's columns, written beside `fields` and keyed by the table field's literal `path`, then by the literal `path` of one of its `columns[]`, each value a plain string. The `translation-target-unknown` paragraph gains the matching refusal (a field path that is no declared table field, or a column path the field's `columns[]` does not list), and the zh-CN example block shows the key as the platform's `sys_user` bundle spells it. One new eval case grades a result-dialog table whose headers stayed English, and the preflight eval case no longer says a `preflight` node holds only `fields`. The text is paid for in the same file by cutting five restatements, so the skill's token ceiling does not move.

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ All translatable content for a single object is aggregated under
164164
| `label` / `pluralLabel` / `description` | Object-level text (every key optional) |
165165
| `fields.{field_name}` | `label`, `help`, `placeholder`, `options` (option value → label), `inlineTitle` (the heading of the inline child grid a `master_detail` field draws on its parent's form — the field lives on the child object, so the key is the child's; untranslated it keeps its authored text, never the child's plural label), `relatedListTitle` (the title of the related list a `lookup` or `master_detail` field draws on its parent's record page — the key is the child's too; untranslated it keeps its authored text, never the child's label) per field |
166166
| `_views.{view_name}` | `label`, `description`, `title` (a form view's own heading — only a form that authors one is translated; a list view has none), `submitBehavior.title` / `submitBehavior.message` (the thank-you panel of a form whose `submitBehavior` is `kind: 'thank-you'`; only the copy the form authors is translated, and the other kinds carry none), `emptyState.title` / `emptyState.message`, `bulkActions.{def_name}` (`label`, `confirmText`, `confirmLabel`, `params`) |
167-
| `_actions.{action_name}` | `label`, `description`, `confirmText`, `submitText` (the param dialog's button verb — only under an action that declares `params`), `cancelText` (the dismiss button of the confirm or param dialog — only under an action that declares `confirmText` or a non-empty `params`), `successMessage`, `disabledReason` (the sentence a greyed action shows; absent keeps the console's default), `params.{param_name}` (and `.options.{value}` beneath it — an option's stored `value` in that param's inline `options`), `outcomeMessages.{outcome}` (an outcome the action's own `outcomeMessages` declares), `resultDialog.title` / `.description` / `.acknowledge` (only under an action that declares a `resultDialog`), `resultDialog.fields.{path}` (the literal `path` of a field in `resultDialog.fields[]`, dots included — `client.secret` is one key), `preflight.fields.{path}` (only under an action that declares `preflight`: a field's literal `path` in its `preflight.fields[]`, its value a plain string as under `resultDialog.fields`; `defineTranslationBundle` refuses any other key under `preflight`, a `title` included); the same keys hold under `globalActions.{action_name}` |
167+
| `_actions.{action_name}` | `label`, `description`, `confirmText`, `submitText` (the param dialog's button verb — only under an action that declares `params`), `cancelText` (the dismiss button of the confirm or param dialog — only under an action that declares `confirmText` or a non-empty `params`), `successMessage`, `disabledReason` (the sentence a greyed action shows; absent keeps the console's default), `params.{param_name}` (and `.options.{value}` beneath it — an option's stored `value` in that param's inline `options`), `outcomeMessages.{outcome}` (an outcome the action's own `outcomeMessages` declares), `resultDialog.title` / `.description` / `.acknowledge` (only under an action that declares a `resultDialog`), `resultDialog.fields.{path}` (the literal `path` of a field in `resultDialog.fields[]`, dots included — `client.secret` is one key), `preflight.fields.{path}` (only under an action that declares `preflight`: a field's literal `path` in its `preflight.fields[]`, its value a plain string as under `resultDialog.fields`), `resultDialog.columns.{path}.{column_path}` / `preflight.columns.{path}.{column_path}` (a table's column headers, beside `fields`: the literal `path` of a `format: 'table'` field, then of one of its `columns[]`, each a plain string; `defineTranslationBundle` refuses any other key under `preflight`, a `title` included); the same keys hold under `globalActions.{action_name}` |
168168
| `_sections.{section_name}` | Form section `label`, `description`; `fields.{field_name}` — the `label`, `placeholder`, `helpText` an entry overrides for that form alone (`helpText` here, `help` under `fields.{field_name}` above: each spells what its source does) |
169169
| `_tabs.{tab_name}` | Filter-preset tab `label` (`ViewTabSchema.name`) |
170170
| `_validations.{rule_name}` | `message` only — the sentence a rejected write returns (replaces the retired `validationMessages`) |
@@ -190,21 +190,19 @@ one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, a
190190
`flows.{flow}.records.{node_id}.fields.{field}`, picked in the organization's language (the
191191
Localization setting if set, else `i18n.defaultLocale`; never the run starter's).
192192
`os i18n extract --no-objects-only` scaffolds every group above but `messages` and
193-
`settingsCommon`, all three keys included. The `inlineTitle` and report-block keys, as the
194-
shipped `app-crm` and `app-showcase` bundles spell them for `zh-CN`:
193+
`settingsCommon`, all three keys included. The `inlineTitle`, report-block and table-column
194+
keys, as the shipped `app-crm`, `app-showcase` and platform bundles spell them for `zh-CN`
195+
(`rows` is the table field's `path`, `error.message` one column's):
195196

196197
```typescript
197198
objects: { crm_opportunity_line_item: { fields: { opportunity: { inlineTitle: '产品明细' } } } },
198199
reports: { showcase_task_overview: { blocks: { open_block: { label: '未完成任务' } } } },
200+
objects: { sys_user: { _actions: { import_sso_users: { resultDialog: { columns: { rows: { email: '邮箱', 'error.message': '未添加的原因' } } } } } } },
199201
```
200202

201203
`settings` is **platform-only** — it is keyed by a settings manifest's namespace and only
202204
the platform declares one, so an app bundle carrying it is refused by name.
203205

204-
For the exact Zod shape (and any field that may have been added since), read
205-
`node_modules/@objectstack/spec/src/system/translation.zod.ts` —
206-
`TranslationDataSchema`, `ObjectTranslationDataSchema`, and `FieldTranslationSchema`.
207-
208206
---
209207

210208
## Naming Conventions
@@ -226,9 +224,10 @@ parse, ship, and resolve to nothing.
226224
is an **error** and fails the run; `translation-option-key-unknown` is a warning.
227225
A key naming an object, field, view, tab, action, param, section, validation rule, app,
228226
nav item, dashboard, widget or flow screen that does not exist is listed alongside the names
229-
that do. Five more shapes under an action entry are the error: an outcome the action does
227+
that do. Six more shapes under an action entry are the error: an outcome the action does
230228
not declare in `outcomeMessages`; a `resultDialog.fields` or `preflight.fields` path it does
231-
not declare (an action with no `preflight` declares none);
229+
not declare; a `columns` key whose field path is no declared `format: 'table'` field, or
230+
whose column path that field's `columns[]` does not list;
232231
`resultDialog` `title` / `description` / `acknowledge` under an action that declares no
233232
`resultDialog`; `submitText` under an action with no non-empty `params`; and `cancelText`
234233
under an action that declares neither `confirmText` nor a non-empty `params` — a bundle
@@ -287,9 +286,8 @@ what the runtime implements.)
287286

288287
### No ICU MessageFormat
289288

290-
There is no ICU MessageFormat engine — interpolation is always simple
291-
`{{variable}}` substitution (the aspirational `messageFormat` config knob was
292-
removed). To pluralize, select the form in application code before calling `t()`.
289+
There is no ICU MessageFormat engine (the aspirational `messageFormat` config knob
290+
was removed). To pluralize, select the form in application code before calling `t()`.
293291

294292
---
295293

@@ -360,8 +358,7 @@ import type { II18nService } from '@objectstack/spec/contracts';
360358
```
361359

362360
(The contract's source `.ts` is not part of the published package — only
363-
`src/**/*.zod.ts` ships — so import the type from `@objectstack/spec/contracts`
364-
rather than reading `node_modules` source.)
361+
`src/**/*.zod.ts` ships — so there is no `node_modules` source to read.)
365362

366363
Methods implemented by both shipped adapters (`FileI18nAdapter` from
367364
`@objectstack/service-i18n`, and the in-memory fallback `@objectstack/core`
@@ -440,11 +437,7 @@ groups, or author them by hand.
440437

441438
Fill in the values manually.
442439

443-
### 3. Verify Coverage
444-
445-
Run `os i18n check` (**Translation Coverage** above).
446-
447-
### 4. Register
440+
### 3. Register
448441

449442
A stack registers its bundles with `defineStack({ translations: [...] })`. A **package or
450443
plugin shipping its own generated bundle** — the most common shape in this repo — has one

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
{
9595
"id": 10,
9696
"prompt": "In zh-CN the `crm_renew` action on `crm_opportunity` opens its param dialog with the rows of its pre-submit read still in English. Its `preflight.fields` declares the paths `amount` and `verdict.summary`.",
97-
"expected_output": "`objects.crm_opportunity._actions.crm_renew.preflight.fields`, keyed by each declared field's literal `path`: `amount` and `'verdict.summary'` (one key, dots included, never split into nested objects), each value the translated label string itself, with no `.label`. The node holds nothing else: the panel has no heading of its own to translate, and `defineTranslationBundle` refuses any other key under `preflight`. A path the action's `preflight.fields` does not declare is `translation-target-unknown`.",
97+
"expected_output": "`objects.crm_opportunity._actions.crm_renew.preflight.fields`, keyed by each declared field's literal `path`: `amount` and `'verdict.summary'` (one key, dots included, never split into nested objects), each value the translated label string itself, with no `.label`. Beside `fields` the node holds only `columns` (a table field's column headers): the panel has no heading of its own to translate, and `defineTranslationBundle` refuses any other key under `preflight`. A path the action's `preflight.fields` does not declare is `translation-target-unknown`.",
9898
"files": [],
9999
"assertions": {
100100
"must_contain": ["_actions", "crm_renew", "preflight", "fields", "verdict.summary"],
@@ -110,6 +110,16 @@
110110
"must_contain": ["sourceLocale", "defaultLocale: 'zh-CN'", "fallbackLocale: 'en'", "supportedLocales"],
111111
"must_not_contain": ["defaultLocale: 'en'", "sourceLocale: 'zh-CN'"]
112112
}
113+
},
114+
{
115+
"id": 12,
116+
"prompt": "In zh-CN the `import_leads` action on `crm_lead` shows the per-row table in its result dialog with English column headers, though `resultDialog.fields.rows` is translated. The `rows` field is `format: 'table'` and its `columns` declare the paths `email` and `error.message`. Which bundle key carries the headers?",
117+
"expected_output": "`objects.crm_lead._actions.import_leads.resultDialog.columns.rows`, a sibling of `resultDialog.fields` and never nested inside the `rows` entry there, which stays the field's label string. It is keyed by the table field's literal `path`, then by each column's literal `path`: `email` and `'error.message'` (one key, dots included, never split into nested objects), each value the translated header string itself — `columns: { rows: { email: '邮箱', 'error.message': '原因' } }`. A preflight table takes the same shape under `preflight.columns`. A field path that is no declared `format: 'table'` field, or a column path that field's `columns` does not list, is `translation-target-unknown`.",
118+
"files": [],
119+
"assertions": {
120+
"must_contain": ["_actions", "import_leads", "resultDialog.columns.rows", "error.message"],
121+
"must_not_contain": ["error: {"]
122+
}
113123
}
114124
]
115125
}

0 commit comments

Comments
 (0)