Skip to content

fix(components): the docs flow embed names the flow and its approval steps in the reader's language - #36335

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-35979-flow-embed-labels
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-35979-flow-embed-labels

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Part of #35979 (Asked item 1 only. Asked item 2, a translation key for decision / notify / start / end node labels, was ruled option A on the card and is built on its own claim and branch, not in this PR; the card stays open for it)

repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:非英文读者打开带流程嵌入的使用手册时,流程标题、审批步骤名,以及判断分支指向的审批步骤名,改用读者语言显示(例如「大额商机审批」「销售经理审核」);包里没有译文的地方仍显示原文。
  • 为什么做:HotCRM 中文手册里的审批流程图标题和步骤全是英文,而包里已带中文译文;这是此前 Studio 流程设计器同类修复未覆盖的文档查看器。
  • 出错会怎样:只影响显示,最坏情况是某个步骤仍显示原文;不改任何数据,可直接撤回。开始、判断、通知、结束这几类步骤的译文位置已裁定要补,由另一项单独完成,本次仍显示原文。
  • 要你做什么:无。

What changes

  • The docs viewer's flow embed reads the package's flow labels. FlowView in element:metadata_viewer now draws the flow title from flows.FLOW.label and each approval step from flows.FLOW.approvals.NODE_ID.label, in the reader's language, and falls back to the authored label (then the name / node id) where the bundle has no entry. Two label reads changed (flow.label, n.label), through one hook call placed before the early returns.
  • Branch targets too. Since feat(components): a type: flow metadata embed shows each decision's branches and their conditions #36327 landed, the business view lists each decision's branches and names the step each branch leads to. That name now takes the same translated step label (a stepLabel prop on Branches), so an approval step reached from a decision is not named in English beside its translated row.
  • The flow-label resolution moved to @object-ui/i18n. ui/packages/i18n/src/flowLabels.ts holds flowLabelTranslations and useFlowLabelTranslations, moved from the Studio module because @object-ui/components cannot import @object-ui/app-shell. It is built on activeFlowsBundle, which feat(automation): the stage confirms name the flows a move would start (#35928) #36316 already moved into @object-ui/i18n (flowsBundle.ts); this PR adds no second copy of that reader. The flow label still goes through the spec's translateFlow; the step label is still read for approval nodes only. The Studio module keeps its own parts (the Automations rail reader and the canvas context) and re-exports the moved ones, so its call sites are unchanged.
  • Which steps can be translated today. The spec's flows.FLOW group has a label key only for approval steps. A start, decision, notify or end step keeps its authored label until the Asked item 2 work adds its key.
  • No spec change, no server change. GET /meta/flow is unchanged; the embed reads the bundle the host already loads.

Read first (by risk)

  1. ui/packages/components/src/renderers/basic/metadata-viewer.tsx, the FlowView and Branches hunks: the hook sits before the early returns, beside the business flag from feat(components): a type: flow metadata embed shows each decision's branches and their conditions #36327.
  2. ui/packages/i18n/src/flowLabels.ts: the moved resolver; compare with the Studio original removed from flow-label-translations.tsx.
  3. ui/packages/app-shell/src/views/metadata-admin/previews/flow-label-translations.tsx: what stays in Studio, and the re-export.

Two-minute check: pnpm --dir ui exec vitest run packages/components/src/__tests__/metadata-viewer.test.tsx; expect 18 passed, including the three tests under "flow embed: package label translations".

Tests

Pins (one top-level describe in the existing viewer harness)

metadata-viewer.test.tsx, describe "element:metadata_viewer flow embed: package label translations (flows.FLOW.label, approvals.STEP.label)", with a real createI18n instance loaded from a zh-CN TranslationData through transformSpecTranslations, inside I18nProvider:

  • an opportunity_approval-shaped flow draws 大额商机审批, 销售经理审核 and 销售总监签批, and none of the English approval labels; the start, decision, notify and end steps keep their authored labels;
  • a bundle entry without the flow label and without one step falls back to the authored text; a bundle that translates only another flow leaves everything authored;
  • a decision branch whose target is an approval step names it 销售总监签批, and the English label appears nowhere on the card.

The Studio pins in FlowCanvas.test.tsx exercise the moved resolver unchanged.

Runs
  • At 78faa00, under the verify lock: vitest run of metadata-viewer.test.tsx and FlowCanvas.test.tsx: Test Files 2 passed (2), Tests 47 passed (47); then pnpm --filter @object-ui/components run type-check (both tsc programs); VERDICT command-exit 0.
  • At 10f5352 (first main merge), under the lock: turbo build of the @object-ui/app-shell^... and @object-ui/components^... closures (68 tasks successful), the same two files (Tests 40 passed (40)), and pnpm --filter @object-ui/i18n --filter @object-ui/components --filter @object-ui/app-shell run type-check: test exit 0, type-check exit 0.
  • Ablation at 78faa00 through scripts/ablation-replace.mjs --delete: anchor (target && stepLabel?.(target)) ?? 1 to 0, blob e0610844af58 to 1bcbe5a1bdbb. Result: Tests 1 failed | 17 passed (18), the branch-target pin red. Restored: blob equals HEAD and git diff HEAD is empty. A first attempt with --replacement '' was refused by the tool before any test ran (it cannot count an empty replacement), so it measured nothing. The test resolves the viewer through src, so no dist preflight applies.
  • Earlier ablation of the two label reads (seat 4, at 1ffd047): both original pins red, restored clean.

Acceptance notes

Verification

Gates
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 78faa00: 38 families, the same list as at 10f5352. At 10f5352 all 37 non-vitest families exited 0, each exit code captured before any pipe, and pnpm --dir ui exec vitest run scripts/ under the lock gave Test Files 172 passed | 2 skipped (174), VERDICT command-exit 0. The re-run at the final head is in the report on the card.
  • node scripts/pm/overlap-check.mjs at 5999753: VERDICT clean exit 0 (origin/main e605773 merges cleanly, no open PR head overlaps).
  • CI at 10f5352: all eleven required contexts success.

Generated by Claude Code

…approval steps in the reader's language

The flow-label resolution the Studio designer and FlowRunner read moves from
app-shell into @object-ui/i18n, so the docs viewer's FlowView reads the same
flows.FLOW.label and flows.FLOW.approvals.STEP.label, falling back to the
authored text.

Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1
Co-Authored-By: Claude <noreply@anthropic.com>
…tep labels and their authored fallback

Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1
Co-Authored-By: Claude <noreply@anthropic.com>
…low-label helpers

The flows-bundle reader moves into @object-ui/i18n as flowsBundle.ts, kept
whole, and flowLabels.ts imports it, so the Studio test's import and the
package entry match the parallel move of the same reader.

Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1
Co-Authored-By: Claude <noreply@anthropic.com>
main already moved activeFlowsBundle into @object-ui/i18n; keep main's
flowsBundle.ts and drop this branch's duplicate move. This branch keeps
flowLabels.ts, its index export and the docs viewer's two label reads.

Claude-Session: https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ
Co-authored-by: Claude <noreply@anthropic.com>
…helpers this PR adds

Claude-Session: https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ
Co-authored-by: Claude <noreply@anthropic.com>
…embed-labels

Keeps main's FlowView branches and entry condition and this branch's two
label reads. The branch list main added names each target step, so it
takes the same translated step label: an approval step a decision leads
to is named in the reader's language there too, pinned in the label
translations describe.

Claude-Session: https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ
Co-authored-by: Claude <noreply@anthropic.com>
…translated step label

Claude-Session: https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ

Final head for L1 · area f7-shell · 2026-11-22T15:06Z
Head-sha: 599975314ab00f37bb3ff72ae93020a2f6be943e

…ject-ui/i18n's public exports

Claude-Session: https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf

L1 ACCEPT · head 38fa51fb3e03d7ea5be0381b9dc3fd06a5c26c9c · 2026-11-22T15:30Z

维护者速读

席位核对

  • 卡片关系:首行 Part of #35979,写明只做第 1 项,第 2 项按裁定 A 另立认领和分支。第 1 项要求「显示流程名,以及 spec 允许包翻译的每个步骤名,用读者的语言,没有就退回原文,解析和 fix(app-shell): Studio flow designer shows the package's translated flow and approval-step labels #34947 给 Studio 设计器的一样」,本 PR 做到了:标题读 flows.<flow>.label(经 spec 的 translateFlow),approval 步骤读 flows.<flow>.approvals.<node_id>.label,其余类型 spec 没有键,照原文。Part of 对,卡保留 pm:dispatched。
  • 席位要我裁定的那一处:分支指向的步骤名也用译文。 我认,属于本卡第 1 项的范围。feat(components): a type: flow metadata embed shows each decision's branches and their conditions #36327 合入 main 之后,业务视图的判断步骤下面会列出分支,并写出每个分支指向哪一步。如果这里不用同一个译文,同一张卡片上同一个审批步骤会一处中文、一处英文,卡上「done when」那句「没有英文步骤留下」就做不到。用的是同一个 stepLabel,没有新的解析路径。有专门的测试钉住,消融删掉 (target && stepLabel?.(target)) ?? 后 1 条变红,复原后 blob 等于 HEAD。
  • 代码:
    • FlowView 里 useFlowLabelTranslations(name ?? '') 放在所有提前 return 之前,hook 顺序稳定;
    • Branches 的 (target && stepLabel?.(target)) ?? target?.label ?? b.target:目标不存在、或没有译文时,都退回原来的写法;
    • flowLabels.ts 和 Studio 原来那份我逐行比过:flowLabelTranslations 和 useFlowLabelTranslations 的函数体逐字相同,只是 useObjectTranslation 改从包内的 provider.js 取、activeFlowsBundle 改从同包的 flowsBundle.js 取。Studio 模块 re-export 这两个,调用处不变。@object-ui/i18n 的 dependencies 本来就有 @objectstack/spec,所以新的运行时导入 translateFlow 不欠依赖。
    • 两次合入 main:第一次 feat(automation): the stage confirms name the flows a move would start (#35928) #36316 已把 activeFlowsBundle 移进 @object-ui/i18n,正文写了保留 main 那份、去掉本分支的重复。我在本 head 上核过只有 ui/packages/i18n/src/flowsBundle.ts 一处定义。
  • 声明:Clause-②: yes (widening) 对,@object-ui/i18n 包根新导出了 flowLabelTranslations、useFlowLabelTranslations 和 FlowLabelTranslations 类型,没有删改。正文和 changeset 两处已经一致(38fa51fb 那一笔就是把 changeset 的 no 改成 yes (widening))。Metadata-protocol: none 对,不碰 spec 和服务端。不欠 Skills-docs,也不欠 dogfood。
  • changeset:@object-ui/components 和 @object-ui/i18n 都有 patch 条目;@object-ui/app-shell 是私有包,不欠。我逐句核过三段:嵌入读同一个 bundle、同一个解析、没有键就退回原文、分支指向的审批步骤用同一个译文;其余四类步骤没有键仍是原文;@object-ui/i18n 的三个新导出,建在已有的 activeFlowsBundle 上。每一句都和 diff 一致。
  • 已发布文档:正文写明 content/docs 没有页面讲这个查看器,只有它的 ADR。我认。index.ts 里 activeFlowsBundle 那段注释也补上了文档查看器。
  • 测试:新的 describe 用真实的 createI18n 和 zh-CN 的 TranslationData。它钉住三件事:opportunity_approval 形状的流程画出三个中文名且没有英文审批名,其余四类步骤保持原文;bundle 缺流程名或缺某一步时退回原文,bundle 只翻译别的流程时全部是原文;分支指向审批步骤时用中文名,卡片上没有那个英文名。两个标签读取点早先由 seat 4 消融过,分支那一处见上。
  • 门禁读数:正文里的本地运行记在 78faa00e 和 10f53529,本 head 是在它们之后合入 main(feat(components): a type: flow metadata embed shows each decision's branches and their conditions #36327)再加两笔只改 changeset 的提交。正文说最终 head 的重跑在卡上的报告里。CI 在本 head 上全部跑完,覆盖到了。
  • CI @ 38fa51fb:45 success、13 skipped、0 failed;mergeable clean;不在治理面。
  • 落地:非受管。Clause-② widening,按席位的安排走 L2,通过后由区 ready + auto-merge。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ

Final head for delta L1 + L2 · area f7-shell · 2026-11-22T15:31Z
Head-sha: 38fa51fb3e03d7ea5be0381b9dc3fd06a5c26c9c

  • One changeset-only commit over 5999753, on the seat's Clause-② ruling: Clause-②: no → Clause-②: yes (widening) (readClause2Line: value yes, arm widening); the last paragraph now says "has new public exports for the flow-label resolution". Bump level stays patch; no code moved.
  • Same respelling, no head move: PR body Clause-② line, and claim 7075955098 amended (flowLabelTranslations, useFlowLabelTranslations, FlowLabelTranslations type, new in @object-ui/i18n; default-tier L2 owed).
  • CI at this head: 58 check-runs, 45 success, 13 skipped, 0 failed (Check Changeset success). Changeset gates and overlap-check exit 0.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 38fa51fb3e03d7ea5be0381b9dc3fd06a5c26c9c
Local-runs: none

The face is the declaration face. The diff touches no published schema and no governed path, and the PR body and the changeset both carry Clause-②: yes (widening). Inputs read: card #35979 with all eight comments (the triage, seat 4's claim, seat 4's dev report, the handover, seat 7's amended claim, the item 2 ruling 7076440876, the item 2 claim, seat 7's dev report 7081009848), the PR body, its three comments (the final-head note, the L1 ACCEPT 7081363239 and the delta head note), the net diff of six files, and the 58 check-runs on the head.

① Derived judgments

  • Card scope is right. The PR says Part of #35979 and builds Asked item 1 only. Item 2 was ruled option A (7076440876) and is built on its own claim (7076477667), so the card stays open, and that is correct.
  • The public surface of @object-ui/i18n is widened, and that is right. The package root gains flowLabelTranslations, useFlowLabelTranslations and the FlowLabelTranslations type (new ui/packages/i18n/src/flowLabels.ts, export line in src/index.ts). Nothing is removed or renamed, so this is a widening and not a narrowing.
  • The move is complete, and that is right. At the head there is exactly one function flowLabelTranslations and one function useFlowLabelTranslations (both in i18n/src/flowLabels.ts) and one function activeFlowsBundle (i18n/src/flowsBundle.ts, which feat(automation): the stage confirms name the flows a move would start (#35928) #36316 put on main). The Studio module flow-label-translations.tsx keeps only useFlowLabelOf and the canvas context, and it re-exports the three moved names. Its consumers (FlowPreview.tsx, StudioDesignSurface.tsx, FlowCanvas.tsx, flow-region-view.tsx) still import from it, so their call sites resolve unchanged. The moved bodies match the removed ones line for line. The only change is that useObjectTranslation now comes from the package's own provider.js. @object-ui/react re-exports that same hook, so the behaviour is the same.
  • No new dependency cycle, and that is right. flowLabels.ts imports @objectstack/spec/system (translateFlow, a type) and two local modules only. It imports no @object-ui/* package. @object-ui/i18n already listed @objectstack/spec in dependencies and already imports it at runtime (i18n.ts, pickLocalized.ts, locales/registry.ts). @object-ui/components already depended on @object-ui/i18n. No package gains an edge it did not have.
  • The viewer reads the translated labels, and that is right. In FlowView, useFlowLabelTranslations(name ?? '') runs before every early return, so the hook order is stable. The title is translated?.flowLabel ?? flow.label ?? flow.name ?? name. Each step is (n && translated?.stepLabel(n)) ?? n?.label ?? n?.id ?? '(step)'. The step label answers only for approval nodes with a string id, which matches the spec's flows.<flow>.approvals.<node_id>.label address. Every other node type falls through to the authored text.
  • The Branches target uses the translated label too, and that is right. The Branches list from feat(components): a type: flow metadata embed shows each decision's branches and their conditions #36327 now names its target step with (target && stepLabel?.(target)) ?? target?.label ?? b.target. This goes beyond the claim, and L1 (7081363239) ruled it inside item 1, since otherwise one approval step would appear once in Chinese and once in English on the same card. It uses the same stepLabel and no new resolution path. When there is no target or no translation, the text is what it was before.
  • Without a provider, nothing changes. Outside an I18nProvider, activeFlowsBundle returns undefined because it guards on getResourceBundle, so translated is undefined and every read keeps its authored value. The existing flow embed tests, which render without a provider, pass in Test UI.
  • The tests are right. The new top-level describe in metadata-viewer.test.tsx uses a real createI18n instance with zh-CN TranslationData passed through transformSpecTranslations. It pins three things. First, the flow and both approval steps draw 大额商机审批, 销售经理审核 and 销售总监签批, no English approval label appears, and start, decision, notify and end keep their authored labels. Second, the authored text comes back when the flow label or one step key is missing, and when the bundle translates only another flow. Third, a decision branch's approval target is named 销售总监签批 and the English label appears nowhere on the card. The dev reports state ablations: the two label reads at 1ffd047, and the branch target at 78faa00, where the result was 1 failed and the restored blob equals HEAD.
  • The gates passed. All 58 check-runs on the head have completed: 45 success, 13 skipped, 0 failed. Lint UI, Type Check UI, Test UI (16 of 16 shards), Build and E2E UI, Live E2E UI, Check Changeset and the PR-body guards are all success. UI Published Artifacts is skipped by its own github.event_name != 'pull_request' condition, so its skip is by design and not a gap.

② Semver level

The changeset .changeset/35979-flow-embed-labels.md lists @object-ui/components and @object-ui/i18n at patch. These are the two published packages the diff changes. @object-ui/app-shell is "private": true, so it owes no entry. AGENTS.md (Post-Task Checklist item 3) ships a non-protocol change, widening or breaking, at patch. Only a Metadata-protocol kind other than none raises the floor to minor. Here Metadata-protocol: none is right, because no spec key, accepted value or metadata type changes and packages/spec is untouched. So patch is the right level. The changeset body carries Clause-②: yes (widening) and Metadata-protocol: none, and its prose matches the diff: the embed reads the same bundle with an authored fallback, the branch target uses the same label, the four unkeyed node types stay authored, and the three new exports are built on activeFlowsBundle.

Clause-②: yes (widening) is right. The commit 38fa51f respelled it from no, following the seat's ruling, and the PR body and the amended claim 7075955098 now agree with the changeset.

③ Boundary flags

  • open_questions[0] in dev report 7075347512 asked about overlap with feat(automation): the stage confirms name the flows a move would start (#35928) #36316 and who lands first. It is answered: feat(automation): the stage confirms name the flows a move would start (#35928) #36316 landed first, and merge a2a1f2d kept main's flowsBundle.ts and dropped the duplicate. Only one definition remains at the head.
  • open_questions[1] in the same report asked about Asked item 2 (node-label keys). It is answered by ruling 7076440876 (option A), which moved item 2 to its own claim and branch. Correctly, this PR does not build it.
  • Dev report 7081009848 carries an empty open_questions list. Its one flagged addition, the Branches target label, was ruled in scope by L1 7081363239, and this review agrees with that ruling (see ①).
  • Deviations in 7075347512. The pins went into the shared harness under ruling 6583487846, which is accepted. The local runs were narrowed at that head, and CI on this head now covers them. The surface grew because the resolver move needed it, and only import and re-export lines changed in the Studio files. All of these are accepted.
  • SQL push-down: none applies. The diff adds no data access, no id materialisation and no in-app join. It reads an i18next resource tree already in memory. The viewer's one object request predates this PR (feat(components): a type: flow metadata embed shows each decision's branches and their conditions #36327).

No must-fix, no should-fix.

Implemented-by: claude/issue-35979-flow-embed-labels
Reviewed-by: session_01QsR2jTeURPvEm465RcoYEC

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ

Landing · area f7-shell · 2026-11-22T15:36Z
Head-sha: 38fa51fb3e03d7ea5be0381b9dc3fd06a5c26c9c

Probe Reading
L1 ACCEPT 7081363239 (L1-d) at 38fa51f, including the branch-target translated label as in scope for item 1
L2 PASS 7081422677 (seat 7, TIER_DEFAULT, no findings) at 38fa51f; Clause-②: yes (widening) for the new @object-ui/i18n exports
Landing K 8 at 38fa51f (< 15)
Checks at head 58 check-runs: 45 success, 13 skipped, 0 failed; mergeable_state clean
Governed check-governed-merges --pr 36335: NOT governed, 309 changed lines

State: ready + auto-merge into the merge queue. Part of #35979: item 1 is delivered by this PR; item 2 is PR #36383, so the card stays open.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 15:37
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit dda5e74 Nov 22, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35979-flow-embed-labels branch November 22, 2026 15:58
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
objectstack-ai#35928) (objectstack-ai#36316)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_

repo:objectstack#7 · zhuangjianguo · session_01QsR2jVTYADzVWfarACx5j3

Fixes objectstack-ai#35928

Clause-②: yes (widening: one new public read, `POST
/api/v1/automation/_record-starts`, and the UI exports that read it)
Metadata-protocol: added
Skills-docs: none — no skill under `skills/**` teaches the console's
stage confirms; `content/docs/automation/flows.mdx` and
`content/docs/frontend/plugins/plugin-grid.mdx` document the read and
the list in this change.
Ruling-ref: 7073655354

## 维护者速读

-
用户在列表单元格或记录页改阶段时,确认框在原来那句话下面列出这次改动会启动的流程名称(按用户语言显示),带审批的流程标「发起审批」;以前只写「可能触发相关自动化」。
- 属于行内编辑专题,按维护者的裁定「能改这条记录的人都看到流程名称」,让用户确认前就知道保存后会发生什么。
- 出错时最多是清单少列或不显示,确认框退回今天那句话,保存本身不受影响;整个改动可以直接撤回。
- 无。

## What changes

**Server (one new read).**

- `@objectstack/spec/api`: `RecordUpdateStartsRequestSchema` (`{ object,
recordId, changes }`, strict), `RecordUpdateStartSchema` (`{ name,
label, startsApproval }`), `RecordUpdateStartsResponseSchema`, and the
contract entry `listRecordUpdateStarts` (`POST
/api/v1/automation/_record-starts`). `_record-starts` joins the
`/automation` domain's reserved position literals (underscore-led, so
the package-namespace install gate is not narrowed).
- `@objectstack/spec/contracts`: `RecordUpdateStartsInput` and the
optional `IAutomationService.listRecordUpdateStarts`.
- `@objectstack/spec/automation`: `recordChangeTriggerHookEvents` /
`recordChangeTriggerFiresOnUpdate`, the record-change token grammar
MOVED out of `@objectstack/trigger-record-change` (whose
`triggerTypeToHookEvents` now delegates to it), so the trigger and the
preview read one rule.
- `@objectstack/service-automation`:
`AutomationEngine.listRecordUpdateStarts` (`record-update-starts.ts`). A
flow is asked only when it is enabled and armed on a `record_change`
trigger for this object whose token binds an update; whether it starts
is `startConditionHolds`, the one start-condition gate every run attempt
passes, over the variables `seedRunVariables` seeds (`record`, its
flattened fields, `previous`). The approval mark is the presence of an
`APPROVAL_NODE_TYPE` node (ADR-0019). A condition that throws is not
listed. Hooks are never listed (ADR-0077 §2).
- `@objectstack/runtime`: the `/automation` domain's `_record-starts`
door, mounted in the dispatcher plugin and recorded in the route ledger.
Order: query parameters refused `400 VALIDATION_ERROR`; body parsed
through the request schema (`400 VALIDATION_FAILED`); `501` when the
engine has no preview; the record read AS THE CALLER through the `/data`
door's own `get` (`callData`), so an unreadable record answers `404
RECORD_NOT_FOUND` exactly like an absent one and the engine is never
asked; a read that answers no record is refused the same `404`; every
`changes` key must be a declared field of the object (else `400
VALIDATION_FAILED` on `changes.KEY`, the engine never asked); then the
engine is handed `previous` = the record read, `record` = that record
with `changes` applied, and the caller's `userId` / `tenantId`.
Anonymous `401`.
- `@objectstack/client`:
`client.automation.listRecordUpdateStarts(request)`.

**UI (two confirms, one reader).**

- `@object-ui/plugin-detail`: `stageChangeStarts.tsx` —
`useRecordUpdateStarts(ask)` (asks the route once per pending move
through the host's `apiFetch`, parses the answer through
`RecordUpdateStartsResponseSchema`, answers `[]` while in flight,
refused, failing, malformed or empty) and `StageChangeStarts` (the list
under the sentence: each flow by its label translated through
`activeFlowsBundle` + the spec's `translateFlow`, the flow runner's
reading; an approval flow marked). Exported for the grid.
- Record page: `recordPathStageChange.tsx` draws it in both
confirmations (the path's `AlertDialog` and the header stage menu's
`RequiredFieldsDialog`, via a new optional `notice` slot in
`@object-ui/fields`).
- List cell: `ObjectGrid`'s state-machine confirm draws it;
`StateChangeConfirm` gains an optional `ask` (the row's record id and
the move).
- `@object-ui/i18n`: `activeFlowsBundle` moves here from
`@object-ui/app-shell`'s module-internal `utils/flowsBundle` (its three
app-shell importers repointed), since the confirms' packages do not
depend on the console; two keys in all eleven packs:
`detail.stageChangeStartsHeading`, `detail.stageChangeStartsApproval`.
- The confirm's sentence is never replaced (not this card: objectstack-ai#35685 S3). A
move that starts nothing, and a failed read, leave the confirm exactly
as today.

Docs: `content/docs/automation/flows.mdx` (§ Which flows a record update
would start), `content/docs/frontend/plugins/plugin-grid.mdx` (the
confirm now names the flows). Changesets:
`35928-record-update-starts-read.md`,
`35928-stage-confirm-names-flows.md`, both carrying the Clause-② and
Metadata-protocol lines.

## Tests

- Engine `record-update-starts.test.ts` (8): condition holds / does not
hold; approval mark CONTROL (an approval flow and a plain flow side by
side); no condition; create / delete / other object / obsolete never
named while `record-before-write` is; an unevaluable condition not
named; an unarmed engine answers nothing; `current_user` evaluated as
the writer named.
- Door `automation-record-update-starts.test.ts` (13): a member is
answered (body parsed through the response schema) and the engine is
handed exactly the record read as the caller; empty list; unreadable
record `404 RECORD_NOT_FOUND` with the engine never asked; unreadable
and absent answer alike; anonymous `401` before any read; malformed body
`400 VALIDATION_FAILED`; query parameter `400 VALIDATION_ERROR`; `501`
without the preview; a GET of the literal is not this door.; a change
key that is not a field `400 VALIDATION_FAILED` on that key (an
undeclared key, a key off the field-name grammar, an inherited member
name), the engine never asked; a change on an object the registry does
not declare refused alike; a read that answers no record `404
RECORD_NOT_FOUND`, never previewed; and the ledger row names
`RecordUpdateStartsRequestSchema` / `RecordUpdateStartsResponseSchema`,
as the clone and publish-drafts suites pin theirs.
- Spec `automation-api.zod.test.ts`: contract count and the new entry's
method/path; request strictness; a leaked `condition` / `nodes` dropped
by the response parse. Each `changes` key is held to the field-name
grammar (refused: a dotted, an upper-case, a digit-initial, a spaced and
an empty key).
- List cell, in its confirm's harness
`ObjectGrid.autosave-35685.test.tsx` (new top-level describe, 3): list
(request body pinned, labels, approval mark under the unchanged
sentence), empty, failure (and Change still saves the move).
- Record page, in each confirm's harness (new top-level describe in
each, 3 + 3): `record-path.stageChange-28199.test.tsx` (the path's
confirmation) and `RecordStageMenu-35891.test.tsx` (the header stage
menu's dialog): list, empty, failure (a refused read, a network error
and a malformed envelope each draw no list).
- `stageChangeStarts-label-35928.test.tsx` (2): a flow named by its
translation where the app's `flows` bundle has one, by its authored
label where not; nothing drawn for no flows.
- Ablation (one-shot under the verify lock, restored by trap, `git diff
HEAD` on both sources empty): removing the `StageChangeStarts` render
from `ObjectGrid.tsx` and from both confirmations in
`recordPathStageChange.tsx` turns exactly the three `list:` pins red
(`Tests 3 failed | 6 passed`); empty and failure pins stay green, as
they should.

## Acceptance notes

- Card acceptance: "Changing a stage that starts a flow shows that flow
by name in both confirms" — pinned in both confirms (list cell, and both
record-page confirmations) and measured live (below); "a stage with
nothing attached shows no list" — the empty pins; "a read failure falls
back to the generic sentence" — the failure pins.
- Residual, stated in the contract docblocks and `flows.mdx`: the
preview binds the caller's user id and tenant only, not their positions,
request params or expand as a live run does, so for a condition reading
those the preview can differ from the save in either direction (it can
miss a flow, or list one a negated test of the writer would stop); the
seat files the follow-up for positions.
- Residual (not widened here): conditions are judged on the record as
the CALLER reads it (field-level security applied), so a condition that
reads a field the caller cannot see is judged on what they see, and one
that throws on a missing field is not listed. The preview can therefore
under-list for a caller with masked fields; it never reveals a masked
value. Documented in `flows.mdx`.
- Residual: the header stage menu's dialog asks with the stage alone;
values typed into that dialog for required fields are not part of the
preview's `changes`.
- Two existing confirm suites (`RecordStageMenu-35891`,
`record-path.stageChange-28199`) now stub `fetch` with a `501` answer in
`beforeEach`, so the new read does not leave for the network under test;
no existing assertion changed. Across the touched UI packages the run
shows 0 `ECONNREFUSED`.
- The approval mark is the ruling's test, "the flow contains an approval
node". Measured live, showcase's `showcase_project_closure` reaches its
sign-off approval through a `subflow` node (the approval node lives in
`showcase_closure_signoff`), so the preview lists it with
`startsApproval: false`. Following subflow references for the mark is a
reading beyond the ruling: filed objectstack-ai#36322.
- Overlap (`overlap-check.mjs` at the head below, exit 1, reported and
not merged around): objectstack-ai#36296 and objectstack-ai#36236 have landed and are merged in.
objectstack-ai#36335 (part of objectstack-ai#35979) moves `activeFlowsBundle` into `@object-ui/i18n`
too and conflicts in `ui/packages/i18n/src/flowsBundle.ts`,
`ui/packages/i18n/src/index.ts` and
`ui/packages/app-shell/src/views/metadata-admin/previews/flow-label-translations.tsx`;
it lands after this PR and drops its copy of the move. Every other open
PR that shares a file merges cleanly.
- Declaration correction: the claim and ruling 7073655354 read
`Metadata-protocol: none`, but the three new `@objectstack/spec/api`
schemas enter the `api` authorable-surface shard (10 keys), which `Check
Changeset` reads as `added` (`none-baseline-moved`). The line is `added`
and `@objectstack/spec` is graded `minor`, as objectstack-ai#32251, objectstack-ai#35789 and objectstack-ai#31883
were for new api request/response schemas. No flow or other metadata key
is added, so the ruling's "no new authorable key" still holds.

## Verification

- Read first: `packages/runtime/src/domains/automation.ts`
`respondToRecordUpdateStarts` (the order of refusals and the
caller-scoped read that admits the engine), then
`packages/services/service-automation/src/record-update-starts.ts`
(which flows are asked and the one gate they pass).
- Live, on a fresh showcase (`pnpm dev -- --fresh`), as a member created
by the admin (`role: user`, not an admin):
- `Website Relaunch` `status: active → completed`: `200
{"flows":[{"name":"showcase_project_closure","label":"Project Closure
with Sign-off (nested pause)","startsApproval":false}]}`
  - same record `→ on_hold` (CONTROL): `200 {"flows":[]}`
- same record `budget 150000 → 250000`: `200
{"flows":[{"name":"showcase_budget_approval","label":"Project Budget
Approval","startsApproval":true}]}`
- an absent record: `404 RECORD_NOT_FOUND`; anonymous: `401
UNAUTHENTICATED`; a body without `changes`: `400 VALIDATION_FAILED`
naming `changes`.
- Zone 2 premise, measured before any code: the same kind of member
reads `GET /api/v1/meta/flow` (200, 33 flows with labels, the admin's
set) and `GET /api/v1/meta/flow/showcase_closure_signoff` (200, its
nodes).
- The console itself was not driven in a browser (its dist is not built
in this container); both confirms are pinned through the real components
above.
- Local, all under `scripts/pm/os-verify-lock.sh` (shared box):
- touched UI packages (`plugin-detail`, `plugin-grid`, `fields`,
`i18n`): `Test Files 1131 passed | 2 skipped` · `Tests 13186 passed | 38
skipped`; after folding the pins into their harness files the three
files plus the label file: `Tests 77 passed (77)`.
- type-check: `tsc --noEmit` (src and test projects) for `i18n`,
`fields`, `plugin-detail`, `plugin-grid`, and src for `app-shell`;
`service-automation`, `runtime`, `client` exit 0.
- server: engine 8/8, door 9/9, `route-ledger.conformance` +
`automation-api-contract-mounts` + `http-dispatcher` green, client
conformance 11, spec `automation-api.zod` + `address-grammar` 87,
`trigger-record-change` 122.
- `dispatch-gates.mjs --commands` (129 families) run and reconciled with
`--ran`: `129 run, 0 NOT-MEASURED`. First pass reds were all this diff's
own owed artefacts, fixed and re-run green: spec `gen:api-surface` /
`gen:docs` / `gen:export-origins` / `gen:declaration-map` /
`gen:strictness-ledger` (api count 533 → 536: the three new schemas),
the route-ledger census sentence (149 → 150), and
`check:test-source-alias` (a spec/automation alias in the trigger
package's vitest config; the door test pays `@objectstack/metadata` at
collection).

- Re-verified after the hand-over (seat 7), main `b3bcfefc` merged in at
`472457d9`, the generated surfaces regenerated at `6bd111ff`
(`gen:schema` → spec build → `gen:api-surface` → `gen:export-origins` →
`gen:declaration-map` → `gen:docs` → `gen:strictness-ledger`;
`check-regen-pending` clear), the changeset correction at `99bfd857`.
Under the verify lock at `6bd111ff`:
- type-check exit 0: `@object-ui/i18n`, `fields`, `plugin-detail` (src
and test; the hand-over's stale-dist red is gone after the closure
build), `plugin-grid`, `app-shell`; `@objectstack/spec`, `runtime` (src
and test layer, after building `@objectstack/driver-turso`),
`service-automation`, `client`, `trigger-record-change`.
- tests: `runtime` Tests 11745 passed | 25 skipped; `service-automation`
4224 passed; `client` 820 passed; `trigger-record-change` 122 passed;
spec `automation-api.zod` + `address-grammar` 87 passed; `plugin-detail`
+ `plugin-grid` + `fields` + `i18n` Test Files 1135 passed | 2 skipped,
Tests 13300 passed | 38 skipped.
- `dispatch-gates.mjs --commands` (129 families): run at `99bfd857` (the
six that started before that commit re-run on it) and reconciled with
`--ran`: `129 derived, 128 run, 1 NOT-MEASURED, 0 UNRUN`. The one
NOT-MEASURED is `check:dual-build-cjs-loads` (exit 3, PREREQUISITE NOT
MET: it needs every package's dist, which this container does not
build); CI runs it in its Lint jobs, green at this head.
- CI at `99bfd857`: every check-run green or skipped by design. Check
Changeset shows two runs: the `synchronize` run (09:07Z, before the body
said `added`) red, the `edited` run (09:08Z) green.
- Contract review rework (L2 at `99bfd857`), at `3ba211dc` and
`d2279e6c` (head):
- the door refuses a change key that is not a declared field of the
object and a read that answers no record; the request schema holds each
change key to the field-name grammar; the ledger row is pinned; the
preview's caller binding is stated in the contract docblocks and
`flows.mdx`; `_record-starts` joins the address module's literal list.
- ablation, one-shot under the verify lock (`ablation-replace.mjs`,
restored by trap, blob == HEAD and `git diff HEAD` empty after each):
the declared-field refusal disabled → `Tests 2 failed | 11 passed` (the
two refusal pins); the no-record refusal disabled → `Tests 1 failed | 12
passed` (its pin).
- local: `runtime` Test Files 637 passed, Tests 11749 passed | 25
skipped; door suite 13/13 at the head; spec `automation-api.zod` +
`address-grammar` 88 passed; type-check exit 0 for `spec`, `runtime`
(src and test layer, at `d2279e6c`), `service-automation`, `client`,
`plugin-detail`.
- `dispatch-gates.mjs --commands` at `3ba211dc`: `129 derived, 129 run,
0 NOT-MEASURED, 0 UNRUN`; the 37 families that read test files re-run at
`d2279e6c` (a one-line test-type fix), all exit 0.
- CI at `d2279e6c`: 70 check-runs, 61 success and 9 skipped by design,
Check Changeset green.
- Delta round (L1-d 7078831268, L2 nit N3 from 7078841748), at
`41487226` (head): the 401 and 501 pins assert `body.error.code`
(`UNAUTHENTICATED`, `NOT_IMPLEMENTED`) beside the status; the spec
changeset names the undeclared-change-key `400 VALIDATION_FAILED` and
the no-record `404` among the door's refusals; the caller-binding limit
reads "can differ from the save in either direction" in the request
schema's docblock, `RecordUpdateStartsInput` and `flows.mdx`. Door suite
13/13; type-check exit 0 for `spec` and `runtime` (src and test layer);
`dispatch-gates.mjs --commands` at `41487226`: `129 derived, 129 run, 0
NOT-MEASURED, 0 UNRUN`; CI at `41487226`: 70 check-runs, 61 success and
9 skipped by design.

https://claude.ai/code/session_01FEkQ5keqTTiV8ptWFNc6ZF
https://claude.ai/code/session_01QsR2jVTYADzVWfarACx5j3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jVTYADzVWfarACx5j3 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…ranches and their conditions (objectstack-ai#36327)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbUq2j5tRRVo3TVY3wcS1Fdg)_
Fixes objectstack-ai#36094

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 文档里嵌入的流程图(业务视图)现在在每个判断步骤下列出各分支:条件(如"金额 >
500,000",按读者语言和币种格式化)和去向步骤;流程的触发条件在步骤上方显示一次。
- 为 HotCRM 销售手册服务:大额审批的金额门槛随管理员在 Studio 中的修改自动更新,手册不用再手抄金额。
- 读不懂的复杂条件只显示中性的"条件"字样,不会显示原始表达式;出错只影响这张卡片的显示,撤回本 PR 即恢复原样。
- 无。

## What changes

- `ui/packages/components/src/renderers/basic/flow-branches.ts` (new,
pure): `decisionBranches` reads a decision's branches in both forms the
engine runs (a `config.conditions` decision through its out-edge labels,
`default` / `isDefault` as "otherwise"; a gateway decision through its
out-edges' `condition`). `readCondition` is a small fail-closed reader:
comparisons of one field of the flow's object with one literal, joined
by `&&` / `||`, with parentheses. Presence guards on the compared field
(`has(x)`, `x != null`; `!has(x)`, `x == null` under `||`) are dropped,
since the platform's null-guard rule puts one on every ordering
comparison. Anything else answers `null`. A top-level conjunction with
some unread terms reads as `A and other conditions`: each read term is
necessary, the rest are named rather than dropped.
- `metadata-viewer.tsx` `FlowView`, business view only: under each
decision, its branches (condition or neutral marker, arrow, target
step). The start node's condition is shown once above the steps (`Runs
when …`). Field label and options come from the flow's object,
`useMetadataItem('object', start.config.objectName)`, which is one extra
request per embed. That request lives in `FlowConditions`, which mounts
once the flow is known, so the conditions never draw unread for a
render. Amounts use the reader's locale (`useDisplayLocale`) and, for a
currency field, `resolveFieldCurrency(field, tenant currency)`. A whole
threshold prints whole (`$500,000`). The technical view (`detail:
technical`) is unchanged and makes no object request.
- Six new `element.metadataViewer.*` strings in all eleven packs
(`condition`, `otherwise`, `conditionAnd`, `conditionOr`,
`conditionMore`, `runsWhen`).
- The two label reads objectstack-ai#35979 changes (`flow.label`, `n.label`) are
untouched. A branch's target label reads `target.label` in `Branches`;
whichever PR lands second routes it through objectstack-ai#35979's resolver.
- The reader's field shape is named `FlowConditionField`:
`@object-ui/plugin-list` already exports a `ConditionField` interface,
and `one-authority-per-exported-name` refuses a second declaration of
one exported name (it went red in `Test UI (10/16)` at c3bc920;
renamed in c8300e9).
- Changeset: `@object-ui/components` and `@object-ui/i18n` patch.

**Read first** (riskiest first): `flow-branches.ts` `isGuard` and `read`
(what is dropped as a guard, and when a partial reading is allowed),
then `FlowConditions` in `metadata-viewer.tsx` (the loading gate).

**Two-minute check:** `pnpm --dir ui exec vitest run
packages/components/src/__tests__/metadata-viewer.test.tsx`. Expect 15
passed, including the six `flow branches (objectstack#36094)` cases.

## Tests

-
`ui/packages/components/src/renderers/basic/__tests__/flow-branches-36094.test.ts`:
the reader (9 readable shapes, 17 refused shapes), both decision forms,
the subject and entry-guard resolution.
- `metadata-viewer.test.tsx` (the component's shared harness, one new
top-level `describe`), on a hotcrm-shaped `opportunity_approval` served
with `{ dialect: 'cel', source }` envelopes: `Amount > 500,000` beside
the branch to Sales Director Sign-off and `Amount ≤ 500,000` beside the
other branch; a 750000 threshold in the served definition draws `Amount
> 750,000` and no `500,000`; `$500,000` under a USD tenant; a
field-to-field condition draws the neutral marker and no raw CEL; the
conditions wait for the object; the technical view draws no branch, no
entry line and makes no object request.

<details><summary>Readings at head c8300e9 (the rename)</summary>

- `Test UI (10/16)` at c3bc920 was red on
`ui/scripts/__tests__/one-authority-per-exported-name-6273.test.ts`:
"ConditionField — a NEW colliding name", `flow-branches.ts:348` against
`plugin-list/src/conditions/conditionModel.ts:31`. c8300e9 renames
the reader's interface to `FlowConditionField` (3 files, 7 lines, no
behaviour change), so no ablation.
- Under the verify lock at c8300e9: that gate test plus
`flow-branches-36094.test.ts` plus `metadata-viewer.test.tsx` gave `Test
Files 3 passed (3)`, `Tests 57 passed (57)`, `VERDICT command-exit 0`.
- `pnpm --dir ui exec vitest run --maxWorkers=2 scripts/` (NOT MEASURED
at c3bc920) gave `Test Files 172 passed | 2 skipped (174)`, `Tests
5122 passed | 2 skipped (5124)`, `VERDICT command-exit 0`.
- `pnpm --filter @object-ui/components run type-check` exit 0, then
`pnpm check:type-check-debt` exit 0 ("129/132 workspace packages
type-checked ... 0 in the DEBT ledger").
- CI on c8300e9: 45 success, 13 skipped, 0 failed (`Test UI` and
`Test UI (10/16)` success).

</details>

<details><summary>Readings at head c3bc920</summary>

- Green, at c3bc920, run without the lock and declared (the lock
queue had not moved for over 40 minutes): `pnpm --dir ui exec vitest run
--maxWorkers=1
packages/components/src/renderers/basic/__tests__/flow-branches-36094.test.ts
packages/components/src/__tests__/metadata-viewer.test.tsx` gave `Test
Files 2 passed (2)`, `Tests 46 passed (46)`.
- Earlier, under the lock, at 29ee835: the two files plus
`packages/i18n/` (key-parity tests included) gave `Test Files 107 passed
(107)`, `Tests 2007 passed | 13 skipped`, `VERDICT command-exit 0`.
- `pnpm --filter @object-ui/components run type-check` exit 0 and `pnpm
--filter @object-ui/i18n run type-check` exit 0. `--listFiles` counts
the new test file and the harness in the test program (2) and the new
module in the source program (1).
- Ablations, one per leg. Each mutation went through
`scripts/ablation-replace.mjs` (anchor 1 to 0, blob moved) and was
restored to the HEAD blob with `git diff HEAD` empty:
  - reader: `readComparison` returns null. `3 failed | 11 passed (14)`.
- neutral marker: unreadable source drawn raw. `1 failed | 13 passed
(14)`.
- technical view: technical card wrapped in the condition scope. `1
failed | 13 passed (14)`.
- loading gate: `if (subject.loading)` deleted. `3 failed | 12 passed
(15)` at c3bc920. The same mutation stayed green (14/14) at
29ee835, before the deterministic pin "waits for the flow's object"
was added. That pin is why it exists.
- i18n gates: `node ui/scripts/check-i18n-call-site-keys.mjs` exit 0,
`check-i18n-dead-keys.mjs` exit 0, `check-i18n-en-drift.mjs` exit 0 ("No
en value changed in this range").

</details>

## Acceptance notes

- **Served shape, measured at the parse layer only.** A hotcrm-shaped
fixture through the spec's `FlowSchema` (spec source at this branch's
base): edge and start `condition` come back as `{ dialect: 'cel', source
}` (a bare string normalizes to it), and
`config.conditions[].expression` stays a bare string. The reader takes
both spellings of `EvaluatedExpressionInputSchema` and no other. A live
`GET /api/v1/meta/flow/…` read was NOT MEASURED: no server build was
available in the container while the verify lock was saturated.
- **No CEL-to-text helper exists in a package `@object-ui/components`
imports.** app-shell's `celToRows` is a round-trip reader for the edge
inspector's own spellings, and app-shell is off-limits to components.
`@objectstack/formula`'s `parseCelToAst` is a real parser, but
components does not declare that dependency. Per the dispatch, this PR
writes the smallest reader and fails closed. Moving it onto
`parseCelToAst` would need a manifest edit and is noted here, not done.
- **Not read (neutral marker):** `previous.*`, a field compared with a
field, function calls, list membership, booleans, dates, percents, and a
`get_record` variable reading another object (it would need a second
object request). hotcrm's start condition reads `Amount ≥ 100,000 and
other conditions`.
- Branch targets that are technical steps (for example `Mark Approved`,
an `update_record`) are named in the branch line even though the step
list hides them.
- An approval node's `approve` / `reject` out-edges are not drawn as
branches. The card asks for decisions only.

## Verification

Local subset from `node scripts/pm/dispatch-gates.mjs --commands` (41
families), re-run at c8300e9: 41 exit 0, including `pnpm --dir ui
exec vitest run scripts/` and `pnpm check:type-check-debt` (both NOT
MEASURED at c3bc920). `--ran` reconciliation: "41 derived famil(ies)
accounted for — 41 run, 0 NOT-MEASURED". `node
scripts/check-platform-checklist.mjs --changed-from origin/main` exit 0
(0 anchored files). `overlap-check` at c8300e9: `VERDICT overlap exit
1`, conflicting only with objectstack-ai#36335 (the sibling label-translation PR,
routed to land after this one and merge main). The full farm is CI's: on
c8300e9, 45 check-runs success, 13 skipped, 0 failed.

---

_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ)_

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jV3scu6UYPb42n5okQ -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…flows.FLOW.nodes.NODE_ID.label (objectstack-ai#36383)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbYV2nRmpjdz5BmCf9psuMXA)_

Part of objectstack-ai#35979 (Asked item 2 only, as ruled in comment 7076440876; Asked
item 1 is PR objectstack-ai#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 objectstack-ai#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 objectstack-ai#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 (objectstack-ai#36517, objectstack-ai#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 objectstack-ai#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:
objectstack-ai#36402.
- The i18n skill's text for the new key is owed: objectstack-ai#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 objectstack-ai#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant