Skip to content

Commit 9d70768

Browse files
docs(skills): teach the flow step-name and related-list title translation keys (#37072)
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr Fixes #36401 Fixes #36575 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感;读「多语言」和「数据建模」技能的 AI 助手现在知道,流程里每一步的名称、以及记录页上自定义的关联列表标签页标题,各自该写在哪个翻译位置。 - 为什么做:这两个翻译位置已经随平台发布,技能文字却没跟上,是「流程步骤名可翻译」和「关联列表标题可翻译」两项改动各自欠下的技能说明,这里一次补齐。 - 出错会怎样:只是技能里的几句说明和一条测评用例,不影响任何运行行为;写错的话 AI 助手会把翻译写到不生效的位置,可以直接撤回这一个合并。 - 要你做什么:批准合并。只改技能文字和一道评测题;因为一个 PR 同时关两张卡,工具无法判断走哪张卡的低风险通道,所以按需要人工批准处理。契约审核 PASS:记录 7141681211,Head-sha `7523971c565c850e5183385030f0007e4ff08fd0`。 ## What changes One commit per card, then one merge of `main` and one fix commit after the contract review. **`76538fe36f`, the flow step-name key (#36401, the follow-up owed by the flows `nodes` group).** `skills/objectstack-i18n/SKILL.md`, the paragraph on keys that sit deeper than their group's `label`, now names a fourth key: > any other step's name at `flows.{flow}.nodes.{node_id}.label` (a screen is named by its heading, `flows.{flow}.screens.{node_id}.title`, and takes a `nodes` key only beside a `title` of its own; `os i18n check` asks for a flow's top-level steps, and for one of `FLOW_TECHNICAL_NODE_TYPES` — `script`, `http`, `connector_action`, `assignment`, `boundary_event`, the four `*_record` types — only where a decision's branch leads to it) "Three keys" and "all three keys included" become four. This is what the readers do: the walk in `packages/lint/src/i18n-walk.ts` asks `nodes.NODE_ID.label` for each top-level node, skips an `approval` (keyed `approvals.NODE_ID.label`) and a screen whose label `screens.NODE_ID.title` already covers, skips `isFlowTechnicalNodeType` nodes, and adds back a technical step a drawn decision's branch names (`decisionBranchTechnicalTargets`); `os i18n extract` reads the same walk. The nine types are the literal list of `FLOW_TECHNICAL_NODE_TYPES` in `packages/spec/src/automation/flow-altitude.ts`, whose source file does not ship in the package, so the skill lists them. **`cd690662c7`, the related-list title key (#36575, the follow-up owed by the related-list title translation).** - `skills/objectstack-i18n/SKILL.md`, the object translation group table, gains the `_relatedLists.{list}` row beside `_tabs`: the `label` of an object-form `relatedLists` entry on the parent object, by the entry's literal `list` (`event.related_to` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label; "Spelled `relatedLists`, the group is refused, naming this one" (the alias table of `ObjectTranslationDataSchema` maps the unprefixed spelling to `_relatedLists` as a refusal, never an accepted second spelling). - `skills/objectstack-data/rules/relationships.md`, the `relatedLists` entry: "its `label` translates at `objects.{parent}._relatedLists.{list}.label` (none: nothing to translate)". - `skills/objectstack-i18n/evals/bundles-locales-coverage.json`: one case (id 16) covering both keys. Precedence is stated as the contract has it (`RelatedListEntryObjectSchema.label` in `packages/spec/src/data/object.zod.ts`: the entry `label`, then the child FK's `relatedListTitle`, then the child's plural label). **`40f4e27ee0`, merge of `origin/main` `159113f4fe`** (plain merge, no conflict; brings #37044's edit to the same file). **`7523971c56`, the contract review's S1 and N1** (record 7141134189), `relationships.md` only: - S1: the `'primary'` bullet ends "its tab stays unless `relatedLists` omits it" again (the first round had cut the qualifier, leaving a sentence that was false for a declared list that omits the child). - N1: "override the derived title / columns (columns: the child's `highlightFields`); an entry's `label` / `columns` win." **Paid in the same files; no ceiling of the skills token ratchet moves.** Restatement cut from `skills/objectstack-i18n/SKILL.md`: three sentences repeating the heading above them; the "Use both gates" paragraph keeps its one new fact; the `relatedListTitle` cell says "likewise"; "Requires `--out`" loses its restating clause; the per-namespace row loses "assembled by your own imports" (said above the table for every layout); "Both shipped adapters" loses the parenthetical the Service Contract section spells in full; the `translation` item section loses its heading restated as a sentence; the Register step folds a repeat of the authoring section. Cut from `skills/objectstack-data/rules/relationships.md`, inside the related-list section: "absent, nothing changes" (the section opens by saying every child relationship shows by default, and objectstack-ui Record Page says it too); the section's opening sentence loses "You usually don't declare the related list on the parent's record detail page" (it restated "by default"); "a self-referential FK (a hierarchy)" loses the parenthetical. The "Catalog auto-fill" bullet and the Delete Behaviors section are untouched. Published-skill size against `main` `159113f4fe` (before) and `7523971c56` (after): | | lines | bytes | tokens (ceiling) | |:--|:--|:--|:--| | `skills/objectstack-i18n/SKILL.md` | 520 / 515 | 25215 / 25193 | 6299 / 6294 (6333) | | `skills/objectstack-data/rules/relationships.md` | 401 / 402 | 16805 / 16800 | 4202 / 4200 (4203) | | `skills/objectstack-i18n/evals/bundles-locales-coverage.json` | 155 / 165 | 14511 / 15724 | 3628 / 3931 (eval fixture, not ratcheted) | The two authored files are 27 bytes smaller together; the eval case is the tree's only growth. ## Tests Text only: no package source, test or behaviour changes, so there is no ablation. The pins the text was written from were read, not edited: `packages/cli/test/i18n-flow-node-coverage.test.ts` and `packages/lint/src/i18n-related-lists-label-36528.test.ts`. ## Acceptance notes - The body opens with the seat signature line; the closing lines follow it. - `check:dual-build-cjs-loads` and `check:lean-entry-closure` were NOT MEASURED locally (exit 3, prerequisite: a whole-workspace build); the diff touches no package and CI runs both. - The flows `nodes` key is accepted by `os validate` at any depth and for a titled screen; the skill teaches what `os i18n check` asks for and the one screen rule an author can get wrong, not the full acceptance set. - Contract review nit N2 (the nine-type list is a hand copy of `FLOW_TECHNICAL_NODE_TYPES` with no gate tying them) is accepted as is. ## Verification Read first, by risk: the "Four keys sit deeper" paragraph and the `_relatedLists.{list}` row of `skills/objectstack-i18n/SKILL.md`; the three related-list bullets of `skills/objectstack-data/rules/relationships.md`. Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints `60 authored bundle file(s) within their ceilings`, with `skills/objectstack-data/rules/relationships.md is 4200 tokens (ceiling 4203; headroom 3)`. `overlap-check` at `7523971c56`: `VERDICT clean exit 0` against `origin/main`, #36158 and #35129. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr)_ <!-- signed: repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 254e396 commit 9d70768

4 files changed

Lines changed: 50 additions & 32 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the i18n and data skills teach the flow step-name key `flows.FLOW.nodes.NODE_ID.label` and the related-list title key `objects.OBJECT._relatedLists.LIST.label`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-i18n's SKILL.md, in the paragraph on the keys that sit deeper than their group's `label`, now names the flow step-name key `flows.FLOW.nodes.NODE_ID.label`: a screen is named through its heading `flows.FLOW.screens.NODE_ID.title` and takes a `nodes` key only beside a `title` of its own, `os i18n check` asks for a flow's top-level steps, and a step of one of the `FLOW_TECHNICAL_NODE_TYPES` (listed) is asked only where a decision's branch leads to it. Text only; paid inside the same file by cutting three restatements in the coverage and extract sections.
11+
12+
The object translation group table gains the `_relatedLists.LIST` row beside `_tabs`: the `label` of an object-form `relatedLists` entry on the parent object, keyed by the entry's literal `list` (a dotted `object.field` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label; the unprefixed `relatedLists` spelling is refused, naming the key. objectstack-data's `rules/relationships.md` says the same on the `relatedLists` entry: its `label` translates at `objects.PARENT._relatedLists.LIST.label`, and an entry with none has nothing to translate. One eval case covers both keys. Paid inside each file by cutting restatement; no ceiling of the skills token ratchet moves.

‎skills/objectstack-data/rules/relationships.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ InvoiceLine = {
340340

341341
### Detail-page related lists (the read-side mirror)
342342

343-
You usually don't declare the **related list** on the parent's record detail page: every child relationship
344-
is shown **by default** as a tab with its count, a `master_detail` child too. The
343+
On the parent's record detail page every child relationship is a **related list**,
344+
shown **by default** as a tab with its count, a `master_detail` child too. The
345345
relationship flags *refine* that:
346346

347347
```typescript
@@ -357,22 +357,23 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false },
357357
- `relatedList: false` — the child object is not shown on the parent record page.
358358
- `'primary'` — a full-width table in the record's details, with no tab. A parent field
359359
group naming a `master_detail` child (`relatedList: 'quote_line'`, written only when asked)
360-
places its table there too; its tab stays unless a declared `relatedLists` omits it.
361-
- The parent's `relatedLists` is the tab list (objectstack-ui Record Page): absent,
362-
nothing changes; declared, only the named lists show, in order, built-ins by name
360+
places its table there too; its tab stays unless `relatedLists` omits it.
361+
- The parent's `relatedLists` is the tab list (objectstack-ui Record Page): declared,
362+
only the named lists show, in order, built-ins by name
363363
(`sys_attachment`, `sys_approval_request`, `sys_activity`). An entry is the child,
364-
`object.field` or `{ list, label, columns }`. A child in the stack with no inbound FK
364+
`object.field` or `{ list, label, columns }`; its `label` translates at
365+
`objects.{parent}._relatedLists.{list}.label` (none: nothing to translate).
366+
A child in the stack with no inbound FK
365367
is refused everywhere; one that exists nowhere is refused by `os validate` /
366368
`os build` (bar a platform or sibling-artifact name) and by a metadata
367369
write naming no package (one into a package is stored, placing nothing).
368370

369371
`relatedListTitle` / `relatedListColumns` override the derived title / columns
370-
(an entry's `label` / `columns` win); otherwise columns auto-derive from
371-
the child object's `highlightFields`. Audit FKs
372+
(columns: the child's `highlightFields`); an entry's `label` / `columns` win. Audit FKs
372373
(`created_by`/`updated_by`/`owner_id`) never become related lists. A child that
373374
references the parent through several FKs (e.g. `primary_account` +
374375
`partner_account`) yields **one related list per FK**; a self-referential FK
375-
(a hierarchy) surfaces a "children" list.
376+
surfaces a "children" list.
376377

377378
## Incorrect vs Correct
378379

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ metadata:
2222

2323
### Stack-Level I18n Config
2424

25-
Configure i18n settings in your `objectstack.config.ts`:
26-
2725
<!-- os:check -->
2826
```typescript
2927
import { defineStack } from '@objectstack/spec';
@@ -160,11 +158,12 @@ All translatable content for a single object is aggregated under
160158
| Sub-key | Holds |
161159
|:--------|:------|
162160
| `label` / `pluralLabel` / `description` | Object-level text (every key optional) |
163-
| `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 |
161+
| `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` (likewise, the title of the related list a `lookup` or `master_detail` field draws on its parent's record page) per field |
164162
| `_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`) |
165163
| `_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}` |
166164
| `_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) |
167165
| `_tabs.{tab_name}` | Filter-preset tab `label` (`ViewTabSchema.name`) |
166+
| `_relatedLists.{list}` | `label` of an object-form `relatedLists` entry on this (parent) object, by its literal `list` (`event.related_to` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label. Spelled `relatedLists`, the group is refused, naming this one |
168167
| `_validations.{rule_name}` | `message` only — the sentence a rejected write returns (replaces the retired `validationMessages`) |
169168
| `_actions.{action_name}.refusals.{CODE}` | `message`, and `reasons.{reason}.message` per declared reason — the sentences of the action's `refusals` catalogue (**objectstack-ui** → Actions), for a code and reason it declares (any other is `translation-target-unknown`); the same under `globalActions.{action_name}` |
170169

@@ -183,16 +182,21 @@ book once carried stays retired), `mappings` (an import mapping's `label` by its
183182
`datasets.{dataset}.{dimensions,measures}.{member}` (a member's `synonyms` have no key: one
184183
authored list carries every language), and a joined report's block headings sit at
185184
`reports.{report}.blocks.{block_name}.{label,description}`, keyed by the block's required `name`.
186-
Three keys sit deeper than their group's `label`: a `page:tabs` item at
185+
Four keys sit deeper than their group's `label`: a `page:tabs` item at
187186
`pages.{page}.components.{tabs_id}.items.{value}.label` (by the item's `value`; an item without
188-
one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, and the text a
187+
one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, any other step's
188+
name at `flows.{flow}.nodes.{node_id}.label` (a screen is named by its heading,
189+
`flows.{flow}.screens.{node_id}.title`, and takes a `nodes` key only beside a `title` of its own;
190+
`os i18n check` asks for a flow's top-level steps, and for one of `FLOW_TECHNICAL_NODE_TYPES` —
191+
`script`, `http`, `connector_action`, `assignment`, `boundary_event`, the four `*_record` types —
192+
only where a decision's branch leads to it), and the text a
189193
`create_record` / `update_record` writes into a field marked `{ dialect: 'template', source }` at
190194
`flows.{flow}.records.{node_id}.fields.{field}`. That text, and each sentence a hook or a `script`
191195
action declares in `texts` and writes through `ctx.text` — `hooks.{hook}.texts.{key}.message`,
192196
`_actions.{action_name}.texts.{key}.message` (also under `globalActions`) — is picked in the
193197
organization's language (the Localization setting if set, else `i18n.defaultLocale`; never the caller's).
194198
`os i18n extract --no-objects-only` scaffolds every group above but `messages` and
195-
`settingsCommon`, all three keys included. The `inlineTitle`, report-block, table-column and
199+
`settingsCommon`, all four keys included. The `inlineTitle`, report-block, table-column and
196200
mapping keys, as the shipped `app-crm`, `app-showcase` and platform bundles spell them for `zh-CN`
197201
(`rows` is the table field's `path`, `error.message` one column's):
198202

@@ -250,13 +254,13 @@ directory tree for you.
250254
|:--|:--|:--|
251255
| Bundled | one `crm.translation.ts` holding every locale | under 5 objects, 2-3 locales |
252256
| Per-locale (recommended) | `src/translations/{en,zh-CN,ja-JP}.ts` + `index.ts` | 5-20 objects, 3-5 locales |
253-
| Per-namespace | `i18n/{locale}/{object}.json`, assembled by your own imports | 20+ objects, 5+ locales |
257+
| Per-namespace | `i18n/{locale}/{object}.json` | 20+ objects, 5+ locales |
254258

255259
---
256260

257261
## Authoring at Runtime: the `translation` Item
258262

259-
Translations do not have to ship as files. A **`translation` metadata item** — created in
263+
A **`translation` metadata item** — created in
260264
the Studio, through the metadata API, or by an agent — carries one locale's worth of the
261265
**same** `objects.*` groups documented above plus the `locale` it translates. `locale` is
262266
required, one locale per item, and published items load at boot and on every publish,
@@ -271,7 +275,7 @@ exact Zod shape is `TranslationItemSchema` in
271275

272276
### Simple Format (Default)
273277

274-
Both shipped adapters (`FileI18nAdapter` and the in-memory fallback) substitute
278+
Both shipped adapters substitute
275279
**double-brace** `{{variable}}` placeholders only — single braces pass through
276280
unchanged. (The schema docstring mentions `{variable}` notation, but that is not
277281
what the runtime implements.)
@@ -296,8 +300,6 @@ was removed). To pluralize, select the form in application code before calling `
296300

297301
### `os i18n check`
298302

299-
The working coverage path is the CLI:
300-
301303
```bash
302304
os i18n check # every locale found in the config
303305
os i18n check --locales=zh-CN # scope to specific locales
@@ -324,15 +326,11 @@ os i18n extract <config> --locales=zh-CN,ja-JP --fill=default \
324326
fails if that differs from what is committed in `--out`, naming each stale or
325327
missing file and printing the regenerate command.
326328

327-
**Use both gates — they answer different questions.** `os i18n check` asks *are
328-
the strings translated?* (coverage: human work). `extract --check` asks *are the
329-
generated bundles still what the schema produces?* (freshness: machine output).
330-
Renaming a label or removing a spec key leaves coverage at 100% while bundles go
331-
stale — how the platform's own ended up translating keys the schema had deleted.
329+
**Use both gates:** renaming a label or removing a spec key leaves coverage at
330+
100% while the bundles go stale.
332331

333332
It runs in the same **merge mode** as a normal extract, so it never asks for
334-
re-translation: an up-to-date bundle re-extracts byte-identically. Requires
335-
`--out` — there is nothing to compare against without it.
333+
re-translation: an up-to-date bundle re-extracts byte-identically. Requires `--out`.
336334

337335
### Diff & Coverage Schemas
338336

@@ -414,8 +412,6 @@ produced; a client renders it as received.
414412

415413
### 1. Extract Skeletons from Metadata
416414

417-
Scaffold ready-to-edit translation files from your stack config:
418-
419415
```bash
420416
os i18n extract --locales=zh-CN --out=./src/translations
421417
```
@@ -433,9 +429,8 @@ the rest: `--filter`, `--no-merge`, `--dry-run`, `--json`, …
433429

434430
### 2. Register
435431

436-
A stack registers its bundles with `defineStack({ translations: [...] })`. A **package or
437-
plugin shipping its own generated bundle** — the most common shape in this repo — has one
438-
more step: a generated module exports an objects *subtree*
432+
A **package or plugin shipping its own generated bundle** has one more step than
433+
`defineStack({ translations: [...] })`: a generated module exports an objects *subtree*
439434
(`NonNullable<TranslationData['objects']>`), not a `TranslationData`, so it must be
440435
wrapped before it is a bundle at all.
441436

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@
150150
"must_contain": ["hooks", "lead_follow_up", "texts", "follow_up_subject", "defaultLocale"],
151151
"must_not_contain": ["messages: {", "_hooks"]
152152
}
153+
},
154+
{
155+
"id": 16,
156+
"prompt": "In zh-CN the `crm_account` record page still titles one tab `Meetings`: the object declares `relatedLists: [{ list: 'crm_event.related_to', label: 'Meetings' }, 'crm_contact']`. The manual's drawing of the `opportunity_approval` flow names its `high_value` decision in English too, and `os i18n check` never asks for the flow's `mark_approved` `update_record` step. Which keys do I add, and is the check missing one?",
157+
"expected_output": "`objects.crm_account._relatedLists['crm_event.related_to'].label` on the parent, keyed by the entry's literal `list` as one key; the bare `crm_contact` entry authors no `label`, so it has no key and keeps the child field's `relatedListTitle`, else the child's plural label. `flows.opportunity_approval.nodes.high_value.label` for the decision. The check is not missing one: `update_record` is one of the technical node types, whose `nodes` key it asks for only where a decision's branch leads to the step.",
158+
"files": [],
159+
"assertions": {
160+
"must_contain": ["_relatedLists", "crm_event.related_to", "nodes", "high_value"],
161+
"must_not_contain": ["approvals.high_value", "screens.high_value"]
162+
}
153163
}
154164
]
155165
}

0 commit comments

Comments
 (0)