Skip to content

Commit f2a990b

Browse files
feat(spec): every step a flow drawing shows can be translated, under flows.FLOW.nodes.NODE_ID.label (#36383)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbYV2nRmpjdz5BmCf9psuMXA)_ Part of #35979 (Asked item 2 only, as ruled in comment 7076440876; Asked item 1 is PR #36335, merged) repo:objectstack#7 · zhuangjianguo · session_01QsR2jTrJZvNaijgX3NxBMc Clause-②: yes (widening: a new translation key `flows.FLOW.nodes.NODE_ID.label`; the new exports `FLOW_TECHNICAL_NODE_TYPES` and `isFlowTechnicalNodeType` from `@objectstack/spec/automation`; and `@object-ui/i18n`'s exported `FlowLabelTranslations` type gains the member `screenTitle`, and its `stepLabel` parameter accepts a `config`) Metadata-protocol: added Skills-docs: follow-up #36401 ## 维护者速读 - 用户能看到什么变化:应用包现在可以给流程里每个步骤(开始、判断、通知、结束等)写各语言名称;手册里的流程图和 Studio 流程画布都按读者语言显示这些步骤名,中文下不再夹英文。已发布语言的应用在检查里会多出这些步骤的缺译提示。 - 为什么做:HotCRM 销售手册的审批流程图在中文下仍显示英文的判断和通知步骤,维护者在卡上选了「补上翻译位,可以翻译」。 - 出错会怎样:只影响显示和缺译提示,不改流程运行和任何数据;可直接撤回。 - 要你做什么:无。 ## What changes Both halves are on this branch: the key, its validation and its coverage demand, and the readers that draw it (on `main` since PR #36335 merged the shared flow-label resolution into `@object-ui/i18n`). - **The key** (`packages/spec/src/system/translation.zod.ts`). `flows.FLOW.nodes.NODE_ID.label`, a strict entry with one plain-text leaf, `label`, overlaying the node's own `FlowNode.label`. It addresses every node but a `screen` (whose `screens.NODE_ID.title` covers `config.title ?? node.label`) and an `approval` (`approvals.NODE_ID.label`), so one string keeps one key. `nodes` was an unknown-key alias onto `screens`; it is now the real group (`node` aliases onto it). The `## nodes` docblock section states the rule; the convention list gains the row. - **Start and end nodes (ruling item 3).** Keyed like any other step; the viewer supplies no words of its own. Measured on `examples/app-showcase` at c448c61: of the start/end labels, 25 are `End` and 11 `Start`, but the rest name an outcome or a trigger (`Approved` x5, `Rejected` x5, `Signed Off`, `Declined`, `On Task Created` x3, `Daily at 06:00`, ...), which a generic word would erase. - **Validation** (`packages/lint/src/validate-translation-references.ts`). A `nodes` key over an unknown node is `translation-target-unknown` with the nearest node offered; over a `screen` it is pointed at `screens.NODE_ID.title`, over an `approval` at `approvals.NODE_ID.label`. The reverse slips now point at the new key: a `screens` or `approvals` key over any other node says `its label is keyed nodes.NODE_ID.label` (two existing messages gain that clause instead of "so nothing resolves"). - **The demand** (`packages/lint/src/i18n-walk.ts`, `i18n/missing-flow`). Every top-level node the docs embed draws at its default `detail: business` altitude, minus screens and approvals, which were already demanded; and, since the embed's branch list names the step each branch of a drawn decision leads to, a folded technical step a branch names (seat reading L2 S1; live case: app-todo's `check_recurring` branching to the `compute_next_due_date` script). `decisionBranchTechnicalTargets` mirrors which out-edges the viewer lists (`flow-branches.ts` `decisionBranches`). Region-nested nodes are accepted by validation but not demanded: the embed does not draw them. `packages/cli/src/utils/i18n-coverage.ts` only updates the bucket's description. - **The readers** (`ui/packages/i18n/src/flowLabels.ts`). The shared `stepLabel` now reads each step's one key by node type: `approvals.NODE_ID.label` for an approval, `screens.NODE_ID.title` for a screen with no `config.title`, `nodes.NODE_ID.label` for any other node. The docs viewer's `type: flow` embed (`metadata-viewer.tsx`, new `flowStepName`) names each drawn step and each decision-branch target by it; the Studio canvas (`FlowCanvas`, and `flow-region-view`'s `RegionNode` for nested region nodes) and the inspector heading read the same `stepLabel` unchanged, so a nested node's key, which validation accepts, has a reader. - **A titled screen (seat reading S3).** A screen with its own `config.title` shows that heading at run time, translated under `screens.NODE_ID.title`; its canvas label has no key. The docs embed names such a screen by its heading (translated where the bundle carries it), unless the heading holds a `{{ }}` hole a drawing cannot fill, in which case it keeps the authored label. `FlowLabelTranslations` gains `screenTitle` for this read. The Studio canvas keeps a titled screen's authored label, since that is the label the designer edits. - **One table for business altitude** (`packages/spec/src/automation/flow-altitude.ts`). The viewer's private `TECHNICAL_NODE_TYPES` set becomes `FLOW_TECHNICAL_NODE_TYPES` + `isFlowTechnicalNodeType` in `@objectstack/spec/automation`; the viewer folds steps by it and the walk demands by it, so they agree on which steps a reader sees. - **Examples.** `app-crm`'s lead-conversion wizard gets its three drawn steps in zh-CN (its baseline stays 0). The ratchet in `scripts/i18n-coverage-baseline.json` is raised for the new population, as the PR that first walked the validation-message family did: `app-showcase` 317 -> 425 (+108, one of them the folded `showcase_inquiry_purge.purge` a branch names), `app-todo` 106 -> 130 (+24, two of them `todo_task_completion.compute_next_due_date` in its two translated locales); the other 12 configs are unchanged (the ten bundle packages stay 0, `check:i18n` in sync). - **Ledger and pins.** `liveness/translation.json` gains `flows.nodes` (+ `label`), `live`, citing `flowLabelTranslations`, `flowStepName`, `FlowCanvas` and `RegionNode`. `flows-translation-face.test.ts`: the `node.label` row now lists `nodes.NODE.label` beside `approvals.NODE.label`. - **Generated.** `api-surface/automation.json`, `export-origins/automation.json`, `content/docs/references/system/translation.mdx`, the strictness-ledger counts and the liveness state counts, regenerated by `check:generated --fix`. ## Read first (by risk) 1. `packages/lint/src/i18n-walk.ts`, the new loop at the end of `walkScreenFlows`: what is demanded (top level, not technical, not screen/approval). 2. `ui/packages/i18n/src/flowLabels.ts` `stepLabel` and `metadata-viewer.tsx` `flowStepName`: which key each node type reads, and the titled-screen rule. 3. `packages/spec/src/system/translation.zod.ts`, the `nodes` entry and the `nodes` / `steps` alias changes. 4. `packages/lint/src/validate-translation-references.ts`, the `nodes` block and the two redirect clauses. Two-minute check: `pnpm --filter @objectstack/cli exec vitest run --project unit test/i18n-flow-node-coverage.test.ts`; expect 6 passed, including HotCRM's `opportunity_approval` shape asking for its start, decision, notify, loop and end labels and nothing for its approvals, screen or record write. ## Tests <details><summary>Pins</summary> - `packages/cli/test/i18n-flow-node-coverage.test.ts` (new family file, like the screen / approval / refusal family files beside it): the walker harvests exactly the drawn steps with no other key, seeded with the authored label; a folded step only where a drawn decision's listed branch names it, once (a conditions-free decision lists every out-edge; a `conditions` decision its default and its claimed labels; an unclaimed label and a non-decision source name nothing); nothing for any other `FLOW_TECHNICAL_NODE_TYPES` step or an id-less node; every harvested key parses and is kept by `TranslationDataSchema`; the coverage gate lists them in the flow bucket and goes quiet once translated. - `packages/lint/src/validate-translation-references.test.ts`: a new top-level describe (clean run over start / decision / loop / nested notify / end beside the other groups; `nodes` over an approval and over a screen redirected; unknown node with suggestion), the two changed redirect messages, and the one-line-verdict arm list gains the four new arms. - The screen, approval and liveness-gate family files in `packages/cli/test/` pin exact key lists of their own family; they now read every key but the `nodes` family (one predicate per file, pointing at the new file). - `ui/packages/components/src/__tests__/metadata-viewer.test.tsx`: a new top-level describe: start / decision / notify / end by `nodes`, an untitled screen by `screens` title, a titled screen by its translated heading and a holed heading by its label, a decision-branch target by `nodes`, and the business view folding exactly `FLOW_TECHNICAL_NODE_TYPES`. - `ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx`: `stepLabel` reads each group by node type (and never another type's group under the same id); the canvas draws a decision's and a nested notify's translation; the inspector heading titles a decision by its `nodes` key with the authored label beside it. </details> <details><summary>Runs at cafc3fd (the spec half) unless noted</summary> - `@objectstack/lint` whole suite (before the L2 S1 widening): `Test Files 225 passed (225)`, `Tests 9431 passed (9431)` (at eabf0e6; lint unchanged since). - `@objectstack/cli` unit project, the 60 i18n / translation / lint test files: 18 failures at eabf0e6, all exact key lists in the three family files above; after the predicate, those 4 files `Tests 52 passed (52)`. - `@objectstack/spec`: `flows-translation-face.test.ts` + `translation.test.ts`, `Tests 238 passed (238)`. - `pnpm --filter @objectstack/spec check:generated`: 5 stale before regeneration, all 5 green after `--fix`. - `node scripts/check-i18n-coverage.mjs`: before the baseline edit `app-crm 0 -> 3`, `app-showcase 317 -> 424`, `app-todo 106 -> 128`; after: `OK (14 config(s), 552 baselined untranslated string(s), none new)`. `pnpm check:i18n`: all ten bundle packages in sync. `pnpm check:i18n-walk-parity`: 17 declared, 15 walked, 2 exempted. - Derived gate sweep at cafc3fd (`dispatch-gates --commands`, 127 commands): 126 exit 0, 1 NOT MEASURED (`check:dual-build-cjs-loads`, exit 3 for want of a full build; left to CI). `dispatch-gates --ran`: 127 accounted for. </details> <details><summary>Runs at bc0171d (the reader half, after merging main at dda5e74)</summary> - ui, from `ui/`: `FlowCanvas.test.tsx` + `flowNodeLabels.sites-13200.test.ts`, 64 tests passed; `metadata-viewer.test.tsx` at its final edit, `Tests 22 passed (22)` (two runs before it failed on the test's own isolation: a shared i18n instance and a locale-specific string, both fixed in the test). - `pnpm --filter @object-ui/i18n run type-check`, `@object-ui/components`, `@object-ui/app-shell`: all exit 0 (after building app-shell's dependency closure, 68 of 68 tasks). - `pnpm --filter @objectstack/spec check:generated --fix`: the 2 artifacts the merge deferred plus the liveness counts regenerated, all 3 re-checked green. - Derived gates for the files changed since the first sweep (`dispatch-gates --commands`, 96 commands): 96 exit 0. `dispatch-gates --ran`: 96 accounted for, 0 NOT MEASURED (derived from recorded exit codes). - `overlap-check.mjs`: merges cleanly with `origin/main` at 316f757. </details> <details><summary>Runs at 04d28e0 (the L1 / L2 rework)</summary> - `@objectstack/lint` whole suite: `Test Files 225 passed (225)`, `Tests 9444 passed (9444)`. - `@objectstack/cli` unit project, the 4 flow family files: `Tests 53 passed (53)` (the new folded-branch-target pin included). - `node scripts/check-i18n-coverage.mjs`: `app-showcase 424 -> 425`, `app-todo 128 -> 130` before `--update`; the new keys are `flows.showcase_inquiry_purge.nodes.purge.label` and `flows.todo_task_completion.nodes.compute_next_due_date.label`. `check:generated` green after rebuilding spec. - Derived gates for the files changed since bc0171d (`dispatch-gates --commands`, 105 commands): 105 exit 0; `--ran`: 105 accounted for, 0 NOT MEASURED. - `overlap-check.mjs`: clean against `origin/main` and the open PRs sharing files (#36517, #36527). </details> ## Acceptance notes - `flows.FLOW.label` is still demanded only for a flow with a screen or an approval node, although item 1's viewer draws the label of every embedded flow. Not widened here, by the seat's word: filed as #36400. - HotCRM's own translations (`opportunity_approval`: 9 of 11 drawn steps) are a follow-up in that repository now that the key has a reader: #36402. - The i18n skill's text for the new key is owed: #36401. - A titled screen whose heading holds a `{{ }}` hole is drawn in the docs embed by its authored label, which has no key, so it stays in the authored language: carded as #36530 with the L2's N2. Every other step the embed names has a key and a reader. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jTrJZvNaijgX3NxBMc)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTrJZvNaijgX3NxBMc <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTrJZvNaijgX3NxBMc --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a10987a commit f2a990b

29 files changed

Lines changed: 865 additions & 89 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/lint': minor
4+
'@objectstack/cli': minor
5+
'@object-ui/i18n': minor
6+
'@object-ui/components': patch
7+
---
8+
9+
feat(spec): every step a flow drawing shows can be translated, under `flows.<flow>.nodes.<node_id>.label`
10+
11+
Clause-②: yes (widening: a new translation key `flows.<flow>.nodes.<node_id>.label`; the new exports `FLOW_TECHNICAL_NODE_TYPES` and `isFlowTechnicalNodeType` from `@objectstack/spec/automation`; and `@object-ui/i18n`'s exported `FlowLabelTranslations` type gains the member `screenTitle`, and its `stepLabel` parameter accepts a `config`)
12+
Metadata-protocol: added
13+
Skills-docs: follow-up #36401
14+
15+
A package can now translate the label of any flow step, not only a screen's heading and an approval step's label. A manual that embeds a flow (a `type: flow` metadata embed) lists its steps by label, and until now a start, decision, notify or end step had nowhere to put a translation, so a zh-CN reader saw those steps in English beside translated approval steps.
16+
17+
- **The key.** `flows.<flow>.nodes.<node_id>.label`, keyed by the node's `id`, at any depth. It overlays the node's own `label` and is plain text. A `screen` keeps its `screens.<node_id>.title` and an `approval` its `approvals.<node_id>.label`, so one string keeps one key: `objectstack validate` points a `nodes` key over either at that key, and points a `screens` or `approvals` key over any other node at `nodes.<node_id>.label`. A key over a node the flow does not declare is refused. `nodes` was an unknown-key hint that suggested `screens`; it is now its own group.
18+
- **Start and end steps are translated like any other.** Their labels are the author's words and often name an outcome or a trigger ("Approved", "On Task Created"), so nothing substitutes words of its own for them.
19+
- **Missing translations are reported.** `os lint` and `os i18n check` (`i18n/missing-flow`) now ask for the label of every top-level step the embed draws at its default `detail: business` altitude, except screens and approvals, which they already asked for, and of a folded technical step where a drawn decision's branch list names it as the step the branch leads to (a decision whose branch runs a `script` first). `os i18n extract` scaffolds the keys. An app that ships translated locales gets new findings for its flows until it translates them.
20+
- **The drawings read it.** The docs viewer's `type: flow` embed (`element:metadata_viewer`) and the Studio flow designer's canvas, nested region nodes included, now name each step by its translation in the reader's language, through the one resolution in `@object-ui/i18n`: `stepLabel` reads `approvals.<node_id>.label` for an approval, `screens.<node_id>.title` for a screen with no `config.title`, and `nodes.<node_id>.label` for any other node. A step the package leaves untranslated keeps its authored label. A decision's branch list names the step a branch leads to the same way.
21+
- **A titled screen is named by its heading in the docs embed.** A screen that authors its own `config.title` shows that heading at run time, translated under `screens.<node_id>.title`, so the embed names it by the heading (translated where the bundle carries it) instead of its canvas label, which has no key. A heading with a `{{ }}` hole cannot be filled in a drawing, so such a screen keeps its authored label. `FlowLabelTranslations` gains `screenTitle` for this read. The Studio canvas keeps a titled screen's authored label.
22+
- **One table for what business altitude hides.** `FLOW_TECHNICAL_NODE_TYPES` (and `isFlowTechnicalNodeType`) in `@objectstack/spec/automation` lists the node types `detail: business` folds away (`script`, `http`, `connector_action`, `assignment`, `get_record`, `create_record`, `update_record`, `delete_record`, `boundary_event`). The docs viewer folds steps by it and the coverage check asks for translations by it, so they agree on which steps a reader sees.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ beneath an action entry are judged the same way under either.
11891189
| `hooks.{hook}.refusals.{code}.reasons.{reason}` | a reason that code declares under `reasons` |
11901190
| `flows.{flow}.screens.{node}` | the `id` of a `type: 'screen'` node in that flow, nodes nested in loop, parallel and try/catch regions included |
11911191
| `flows.{flow}.screens.{node}.fields.{field}` | a `config.fields[].name` on that screen — an object-form screen (`config.objectName`) declares none, and its input labels live under `objects.{objectName}.fields` |
1192+
| `flows.{flow}.nodes.{node}` | the `id` of a node in that flow that is neither a `screen` nor an `approval` (those two are keyed under `screens` and `approvals`), nodes nested in loop, parallel and try/catch regions included |
11921193

11931194
An unresolvable key is an **error**, not a warning: `os validate`, `os lint` and
11941195
`os compile` each report it as `translation-target-unknown` and exit non-zero, so

‎content/docs/references/system/translation.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ Translation data for a single object
297297
| **screens** | `Record<string, { title?: string; description?: string; fields?: Record<string, object> }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) |
298298
| **refusals** | `Record<string, { message?: string }>` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` |
299299
| **approvals** | `Record<string, { label?: string }>` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node |
300+
| **nodes** | `Record<string, { label?: string }>` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` |
300301
| **notices** | `Record<string, { message?: string }>` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node |
301302
| **records** | `Record<string, { fields?: Record<string, string> }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node |
302303

@@ -486,6 +487,7 @@ Translation data for a single object
486487
| **screens** | `Record<string, { title?: string; description?: string; fields?: Record<string, object> }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) |
487488
| **refusals** | `Record<string, { message?: string }>` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` |
488489
| **approvals** | `Record<string, { label?: string }>` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node |
490+
| **nodes** | `Record<string, { label?: string }>` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` |
489491
| **notices** | `Record<string, { message?: string }>` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node |
490492
| **records** | `Record<string, { fields?: Record<string, string> }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node |
491493

@@ -738,6 +740,7 @@ Translation data for a single object
738740
| **screens** | `Record<string, { title?: string; description?: string; fields?: Record<string, object> }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) |
739741
| **refusals** | `Record<string, { message?: string }>` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` |
740742
| **approvals** | `Record<string, { label?: string }>` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node |
743+
| **nodes** | `Record<string, { label?: string }>` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` |
741744
| **notices** | `Record<string, { message?: string }>` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node |
742745
| **records** | `Record<string, { fields?: Record<string, string> }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node |
743746

@@ -959,6 +962,7 @@ Translation data for a single object
959962
| **screens** | `Record<string, { title?: string; description?: string; fields?: Record<string, object> }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) |
960963
| **refusals** | `Record<string, { message?: string }>` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` |
961964
| **approvals** | `Record<string, { label?: string }>` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node |
965+
| **nodes** | `Record<string, { label?: string }>` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` |
962966
| **notices** | `Record<string, { message?: string }>` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node |
963967
| **records** | `Record<string, { fields?: Record<string, string> }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node |
964968

‎content/docs/ui/translations.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export default defineStack({
9191
| Page tab labels (`page:tabs` items) | `pages.<name>.components.<tabsId>.items.<value>.label` — keyed by the tabs component's `id` and the item's `value`; an item without a `value` has no key (localize it with an inline locale map), and `page:accordion` panels have none |
9292
| A page `object-form`'s thank-you panel | `pages.<name>.components.<formId>.submitBehavior.title` / `.message` — keyed by the `object-form` component's `id` (a form without an `id` has no key), by the same rules as a form view's panel |
9393
| Screen-flow wizards (flow label, screen headings and body text, screen field copy) | `flows.<flow>.label` / `flows.<flow>.screens.<node_id>.title` / `.description` / `.fields.<field>.label` / `.placeholder` / `.inlineHelpText` — a screen field's help text is `inlineHelpText`, the key the field itself declares, not `help`; see the boundary note below |
94+
| Flow step names (each step a drawing of the flow shows, such as a manual's flow embed) | `flows.<flow>.nodes.<node_id>.label` — keyed by the node's `id`, for a start, decision, notify, end or any other step; an `approval` step's name is `flows.<flow>.approvals.<node_id>.label` and a screen's is its heading, `flows.<flow>.screens.<node_id>.title`, so `os validate` points a `nodes` key over either there. `os lint` asks for every step a flow embed draws at its default business altitude |
9495
| Text a flow writes into a record (a `create_record` / `update_record` field value marked `{ dialect: 'template', source }`) | `flows.<flow>.records.<node_id>.fields.<field>` — picked in the organization's language (the Localization setting when set, else the app's `i18n.defaultLocale`), never the run starter's; see [Flows](/docs/automation/flows#text-a-record-keeps--a-field-value-marked-as-text) |
9596
| Hook refusal messages | `hooks.<hook>.refusals.<CODE>.message` — one per entry of the hook's `refusals` catalogue — and `hooks.<hook>.refusals.<CODE>.reasons.<REASON>.message`, one per reason an entry declares. A hook (a `js` body or a TypeScript `handler`) refuses by code, optionally with a declared reason, and the server answers the refusal with this sentence in the caller's locale, else the declared one. A translation of an entry that declares `params` keeps its `{{ name }}` holes; the server fills them after picking the translation |
9697
| Hook texts | `hooks.<hook>.texts.<key>.message` — one per entry of the hook's `texts`. A hook asks for the sentence with `ctx.text(key, params)` when it writes it into a record, and the server answers it in the **organization's** language (the Localization setting somebody set, else the app's `i18n.defaultLocale`), never the caller's, else the declared one. A translation of an entry that declares `params` keeps its `{{ name }}` holes; the server fills them after picking the translation |

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/system.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ hand-patch a number here** — fix the code or the verdict and regenerate.
1919

2020
| Dir | Sites |
2121
|---|---|
22-
| `system/` | 407 |
22+
| `system/` | 408 |

‎examples/app-crm/src/translations/crm.translation.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,12 @@ export const CrmTranslationBundle = defineTranslationBundle({
413413
label: '将线索转化为客户和商机',
414414
successMessage: '🎉 线索已转化 — 已创建客户和商机。',
415415
errorMessage: '线索转化未完成 — 请检查线索后重试。',
416+
// Each step's name where a manual draws the flow.
417+
nodes: {
418+
start: { label: '开始' },
419+
check_converted: { label: '已转化?' },
420+
end: { label: '结束' },
421+
},
416422
screens: {
417423
screen_already_converted: { title: '已转化', description: '该线索已转化为商机。' },
418424
screen_account: {

‎packages/cli/src/utils/i18n-coverage.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ const COVERAGE_SOURCE: Record<ExpectedEntry['source'], CoverageIssue['source']>
364364
// toasts (`flows.<f>.successMessage` / `.errorMessage`, #22507) and a refused
365365
// `end` node's message (`flows.<f>.refusals.<n>.message`, #22450), and an
366366
// approval flow's label with each `approval` node's step label
367-
// (`flows.<f>.approvals.<n>.label`, #24916) — the author's own text, so
367+
// (`flows.<f>.approvals.<n>.label`, #24916), and every other step a docs
368+
// flow embed draws (`flows.<f>.nodes.<n>.label`, ruling 7076440876) — the
369+
// author's own text, so
368370
// it keeps its own bucket and reports as `i18n/missing-flow` rather than
369371
// folding away with `--include-platform`. Until this bucket existed the
370372
// family could not report a screen-flow gap at all: HotCRM measured
@@ -461,7 +463,7 @@ const SOURCE_SURFACE: Record<CoverageIssue['source'], string> = {
461463
report: 'reports',
462464
picklist: 'picklists',
463465
page: 'pages',
464-
flow: 'flow screens, approval steps, toasts and refusals',
466+
flow: 'flow screens, steps, approval steps, toasts and refusals',
465467
hook: 'hook refusals',
466468
position: 'positions',
467469
permission: 'permission sets',

‎packages/cli/test/i18n-flow-approval-coverage.test.ts‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ import { collectExpectedEntries, extractTranslations } from '../src/utils/i18n-b
2727
import { computeI18nCoverage } from '../src/utils/i18n-coverage.js';
2828
import { TranslationDataSchema } from '@objectstack/spec/system';
2929

30+
/**
31+
* The `flows.<flow>.nodes.<node_id>.label` family (ruling 7076440876) is
32+
* demanded beside this file's own and pinned by `i18n-flow-node-coverage.test.ts`;
33+
* these pins measure their family, so they read every key but that one.
34+
*/
35+
const notNodeLabel = (key: string) => !/^flows\.[^.]+\.nodes\./.test(key);
36+
3037
/** An approval-only flow: record-triggered, two approval steps, no screen. */
3138
const expenseApproval = {
3239
name: 'expense_approval',
@@ -67,11 +74,13 @@ const nightlyDigest = {
6774
};
6875

6976
const flowKeys = (config: any) =>
70-
collectExpectedEntries(config).filter((e) => e.path[0] === 'flows').map((e) => e.path.join('.'));
77+
collectExpectedEntries(config).filter((e) => e.path[0] === 'flows').map((e) => e.path.join('.')).filter(notNodeLabel);
7178

7279
describe('what the walker harvests from an approval flow (#24916)', () => {
7380
it('emits the flow label and each approval step label, seeded with the authored text', () => {
74-
const entries = collectExpectedEntries({ flows: [expenseApproval] }).filter((e) => e.path[0] === 'flows');
81+
const entries = collectExpectedEntries({ flows: [expenseApproval] }).filter(
82+
(e) => e.path[0] === 'flows' && notNodeLabel(e.path.join('.')),
83+
);
7584

7685
expect(entries.map((e) => e.path.join('.'))).toEqual([
7786
'flows.expense_approval.label',
@@ -99,7 +108,7 @@ describe('the coverage gate demands the approval flow and its steps (#24916)', (
99108
translations: [{ 'zh-CN': { ...(flows ? { flows } : {}) } }],
100109
});
101110
const zhFlowIssues = (config: any) =>
102-
computeI18nCoverage(config).issues.filter((i) => i.locale === 'zh-CN' && i.source === 'flow');
111+
computeI18nCoverage(config).issues.filter((i) => i.locale === 'zh-CN' && i.source === 'flow' && notNodeLabel(i.key));
103112

104113
it('lists the untranslated approval flow label and step labels in the flow bucket', () => {
105114
const keys = zhFlowIssues(tree()).map((i) => i.key).filter((k) => k.startsWith('flows.expense_approval.'));
@@ -154,11 +163,11 @@ describe('the skeleton `os i18n extract` writes for an approval flow (#24916)',
154163
const result = extractTranslations({ flows: [expenseApproval] }, { locales: ['en', 'zh-CN'] });
155164

156165
it('writes the authored labels into the default locale and empty slots into the others', () => {
157-
expect((result.bundles.en as any).flows.expense_approval).toEqual({
166+
expect((result.bundles.en as any).flows.expense_approval).toMatchObject({
158167
label: 'Expense Approval',
159168
approvals: { manager_review: { label: 'Manager Review' }, finance_review: { label: 'Finance Review' } },
160169
});
161-
expect((result.bundles['zh-CN'] as any).flows.expense_approval).toEqual({
170+
expect((result.bundles['zh-CN'] as any).flows.expense_approval).toMatchObject({
162171
label: '',
163172
approvals: { manager_review: { label: '' }, finance_review: { label: '' } },
164173
});

‎packages/cli/test/i18n-flow-liveness-gate.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ import {
5757
import { computeI18nCoverage } from '../src/utils/i18n-coverage.js';
5858
import { authorWarnedProperties, lintLivenessProperties } from '@objectstack/lint';
5959

60+
/**
61+
* The `flows.<flow>.nodes.<node_id>.label` family (ruling 7076440876) is
62+
* demanded beside this file's own and pinned by `i18n-flow-node-coverage.test.ts`;
63+
* these pins measure their family, so they read every key but that one.
64+
*/
65+
const notNodeLabel = (key: string) => !/^flows\.[^.]+\.nodes\./.test(key);
66+
6067
const leadConversion = {
6168
name: 'lead_conversion',
6269
label: 'Convert Lead',
@@ -114,7 +121,7 @@ const app = (withFlowCopy: boolean) => ({
114121
});
115122

116123
const flowDemands = (config: any) =>
117-
computeI18nCoverage(config).issues.filter((i) => i.source === 'flow');
124+
computeI18nCoverage(config).issues.filter((i) => i.source === 'flow' && notNodeLabel(i.key));
118125
const flowWarnings = (config: any) =>
119126
lintLivenessProperties(config).filter((f) => f.message.includes('`flows`'));
120127

@@ -210,6 +217,7 @@ describe('the liveness gate on the i18n coverage walk', () => {
210217
const keys = collectExpectedEntries(app(false), UNGATED)
211218
.filter((e) => e.path[0] === 'flows')
212219
.map((e) => e.path.join('.'))
220+
.filter(notNodeLabel)
213221
.sort();
214222

215223
expect(keys).toEqual([

0 commit comments

Comments
 (0)