Repository navigation
Commit f2a990b
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
- .changeset
- content/docs
- protocol/kernel
- references/system
- ui
- docs/audits/2026-07-unknown-key-strictness-ledger.counts
- examples/app-crm/src/translations
- packages
- cli
- src/utils
- test
- lint/src
- spec
- api-surface
- export-origins
- liveness
- state-counts
- src
- automation
- system
- scripts
- ui/packages
- app-shell/src/views/metadata-admin/previews
- components/src
- __tests__
- renderers/basic
- i18n/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
| 1192 | + | |
1192 | 1193 | | |
1193 | 1194 | | |
1194 | 1195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
| |||
486 | 487 | | |
487 | 488 | | |
488 | 489 | | |
| 490 | + | |
489 | 491 | | |
490 | 492 | | |
491 | 493 | | |
| |||
738 | 740 | | |
739 | 741 | | |
740 | 742 | | |
| 743 | + | |
741 | 744 | | |
742 | 745 | | |
743 | 746 | | |
| |||
959 | 962 | | |
960 | 963 | | |
961 | 964 | | |
| 965 | + | |
962 | 966 | | |
963 | 967 | | |
964 | 968 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
416 | 422 | | |
417 | 423 | | |
418 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
368 | 370 | | |
369 | 371 | | |
370 | 372 | | |
| |||
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
464 | | - | |
| 466 | + | |
465 | 467 | | |
466 | 468 | | |
467 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
70 | | - | |
| 77 | + | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
74 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
75 | 84 | | |
76 | 85 | | |
77 | 86 | | |
| |||
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | | - | |
| 111 | + | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
| |||
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
157 | | - | |
| 166 | + | |
158 | 167 | | |
159 | 168 | | |
160 | 169 | | |
161 | | - | |
| 170 | + | |
162 | 171 | | |
163 | 172 | | |
164 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
| |||
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
117 | | - | |
| 124 | + | |
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
| |||
210 | 217 | | |
211 | 218 | | |
212 | 219 | | |
| 220 | + | |
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
| |||
0 commit comments