You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 343c49c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(app-shell): Studio flow designer shows the package's translated flow and approval-step labels (#34947)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBXim82sEGBUBXqH4hkWyBJX)_Fixes#34903
repo:objectstack#3 · os-support-ai · session_01WGufzi3ezPzTysQPDEjmVz
Clause-②: yes
Metadata-protocol: none
## 维护者速读
- 改了什么:Studio
流程设计器现在读取包自带的流程标签翻译(`flows.<flow>.label`)和审批步骤标签翻译(`flows.<flow>.approvals.<step>.label`),按查看者的语言显示;检查器标题下另起一行显示原文标签。
- 为什么改:zh-CN 管理员打开 HotCRM 的
opportunity_approval,看到的仍是英文流程名和英文审批步骤名,尽管包里已带中文翻译。
- 风险与回滚:只改显示,草稿本身从不写入翻译;没有翻译时一切与之前相同。回滚即 revert 本 PR。
- 先看:`previews/flow-label-translations.tsx`(读取逻辑)、`FlowPreview.tsx` 中
`flowSelectionHeading` 的 hunk、`StudioDesignSurface.tsx` 的三处调用点。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx`,预期新增的
6 个用例全部通过。
- 需要你做的:无,席位落地。
## What changes
- **One reader, reused.** A new `previews/flow-label-translations.tsx`
reads the bundle `FlowRunner` already reads: `activeFlowsBundle` over
the loaded i18next resource tree. The flow label goes through the spec's
`translateFlow`, the runner's path. The approval-step label is the
spec-typed address `flows.<flow>.approvals.<node_id>.label`, and only
`approval` nodes read it. There is no third translation client and no
new loader. It is display only: the draft never carries a translation,
so editing, renaming and saving still work on the authored label.
- **Canvas.** `FlowPreview` hands those translations to the canvas
through a context. An approval node card shows its translated step
label. Nested approval cards in an expanded region also show it
(`flow-region-view.tsx`).
- **Inspector header.** `flowSelectionHeading` takes the translations as
an optional argument. An approval step is titled by its translation and
returns the authored label as `source`. `FlowSelectionTitle` draws that
label under the title: "Authored label: “…”" / 原文标签:“…”. Studio is the
authoring surface, so the author still sees the text they edit.
- **Flow label.** The Automations header caption names the flow by
`flows.<flow>.label` when the bundle has it, and falls back to the
authored label, then the name.
- **Decision/other node labels and edge labels stay authored text: the
spec has no keys for them; the filer files that card if wanted.**
- **Key added: yes, one.** `engine.inspector.flowNode.sourceLabel` is in
the lazy `studio` namespace (`en.ts`, `zh.ts`). The eager
`locales/en.ts` is unchanged: `git diff 189358f --
ui/packages/i18n/src/locales/` is empty. No budget ceiling was touched.
- **Surface growth (claim amendment 6954477935).**
`StudioDesignSurface.tsx` gets only call-site lines: the hook call, the
caption title, the heading argument and the title render.
`flow-region-view.tsx` gets the nested-approval label line. This is not
a deviation.
## Tests
<details><summary>Pins, in the existing FlowCanvas harness (one new
top-level describe)</summary>
`FlowCanvas.test.tsx`, under the describe "Flow designer — package label
translations (flows.FLOW.label, approvals.STEP.label)":
- the helper resolves the flow label and both step labels from a real
`createI18n` resource tree loaded with a zh-CN `TranslationData`; a
decision node gets nothing, and an unknown flow gets no bundle;
- `useFlowLabelTranslations` reads the `I18nProvider`'s active language;
- the canvas draws 经理审核 and, after expanding the region, the nested
总监签批; the decision label and the edge label stay authored;
- with no provider the canvas draws the authored labels, as before;
- `FlowPreview`, rendered inside `I18nProvider`, hands the bundle to the
canvas (the end-to-end fixture reading);
- the inspector heading is `{ title: '经理审核', source: 'Manager review'
}`, and `FlowSelectionTitle` renders the source line; a decision has no
`source`; with no translations the heading is byte-identical to before.
`flowNodeLabels.sites-13200.test.ts`: the four ledgered `own-title`
sites are re-keyed to their new source lines. The verdicts, the site
count and the floors are unchanged.
</details>
<details><summary>Runs (head 4972af6)</summary>
- `vitest run` FlowCanvas.test.tsx, flowNodeLabels-13143,
flowNodeLabels.sites-13200, `packages/i18n/`, `scripts/` → `Test Files
276 passed | 2 skipped (278)`, `Tests 7041 passed | 15 skipped`, lock
`VERDICT command-exit 0`.
- An earlier wider run over `previews/`, `studio-design/` and
`packages/i18n/` (602 files) found the 13200 ledger red, its only
failure, and that is fixed above.
- `pnpm --filter @object-ui/app-shell run type-check` → `VERDICT
command-exit 0` (both `tsc` programs; the test program compiles
`FlowCanvas.test.tsx`, which it caught once). `@object-ui/i18n`
type-check → Done.
- Ablation (committed fix, then `ablation-replace.mjs`): the FlowCanvas
call site reverted to `label={node.label || node.id}` → 2 failed (the
canvas pin and the FlowPreview pin), then restored with `blob == HEAD`
and an empty `git diff HEAD`.
</details>
## Acceptance notes
- **i18n-locale-en reading:** `locales/en.ts` has an empty diff, so the
eager catalogue is unchanged. The budget gate
(`check-eager-locale-catalogues.mjs`) was NOT MEASURED locally, reason:
`PREREQUISITE NOT MET`, because it weighs a built
`apps/console/dist/eager-closure.json`. CI's UI build carries it.
- **Live readings** (comment 6958860242): real console over bf090e8,
zh-CN. Showcase (real pack): caption 项目预算审批; approval cards 经理审核 and
高管审核; inspector 经理审核 / 原文标签:“Manager Review”. Fixture package mirroring
opportunity_approval: caption 大额商机审批; cards 经理审核 and 总监签批; after
Customize, the Label field edits the authored text while the card keeps
the translation. en, and a zh flow with no entry: authored labels, no
source line. A nested approval card is not producible, because the spec
refuses approval in region bodies (ruling 5724940095 D). Studio already
loads the package's flows group: `loadLanguage` fetches the server's
merged `GET /api/v1/i18n/translations/LOCALE` tree. Screenshots,
readings.txt and scripts:
/mnt/project-files/objectstack-seat3/34903-live/.
- **Fix round (L1 6956195648 M1), head f5c62bd:** bf090e8 merges
main forward (#34932 landed), and f5c62bd is test-only. #34932 draws
an approval's approve out-edge as a localized outcome pill, so the
authored-edge assertion moved to a decision branch edge. No product code
changed. Runs: app-shell studio-design/ + previews/ + i18n/ → `Test
Files 605 passed (605)`, `Tests 6315 passed | 13 skipped`; `ui scripts/`
→ `171 passed | 2 skipped`; dispatch-gates 38/38 run, 0 UNRUN;
check:eager-closure exit 0, `i18n-locale-en 60.4 KB / 60.5 KB ceiling`.
- The Automations header caption has no pin of its own. It is one
expression over the same helper the pins cover. The rail row that lists
flows still shows the authored label, which is outside this card's
surface.
- The docblock of `utils/flowsBundle.ts` still lists three reader
surfaces; the designer is now a fourth. That file is outside the
surface, so it is left unedited.
## Verification
<details><summary>Gates</summary>
- `node scripts/pm/dispatch-gates.mjs --commands`: 38 families. All ran,
and `--ran` reconciliation shows 38 derived / 38 run / 0 UNRUN. Each
exited 0, except `check:test-source-alias`, which went red on the new
FlowPreview import in the test. That was fixed with the module-top
`import '@objectstack/lint'` the gate prescribes, and the rerun printed
`check-test-source-alias OK`.
- `pnpm check:new-line-citations` (ui): `0 new citation(s)`.
`check-nul-bytes`: OK. `check-i18n-call-site-keys`: exit 0.
- `node scripts/pm/overlap-check.mjs --branch=HEAD` before each push:
`VERDICT clean`. It merges cleanly with #34932, #34926, #34925, #34914
and #34799. Landing order: #34932 first, then this PR merges main
forward.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi3ezPzTysQPDEjmVz -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(app-shell): the Studio flow designer shows a package's translated flow label and approval-step labels
7
+
8
+
Clause-②: yes
9
+
Metadata-protocol: none
10
+
11
+
A package can translate a flow's label (`flows.<flow>.label`) and an approval step's label (`flows.<flow>.approvals.<node_id>.label`). The flow runner already used both. The Studio flow designer ignored them, so a zh-CN admin saw the authored English flow name and step names. The designer now reads the same bundle the runner reads, through the spec's `translateFlow`, in the viewer's language. The automation header names the flow by its translation. Approval nodes show their translated step label on the canvas (nested ones included) and in the inspector header. The inspector also shows the authored label on a second line ("Authored label: …"), because Studio is where that label is edited. With no translation, every label shows as authored, as before. The draft is never rewritten with a translation.
12
+
13
+
The spec has no key for a decision or other node's label, or for an edge label, so those still show the authored text.
14
+
15
+
`@object-ui/i18n` gains one lazy `studio`-namespace key, `engine.inspector.flowNode.sourceLabel` (en and zh). The eager `locales/en.ts` pack is unchanged.
0 commit comments