Repository navigation
feat(components): a type: flow metadata embed shows each decision's branches and their conditions - #36327
Merged
objectstack-fleet[bot] merged 5 commits intoNov 22, 2026
Conversation
… and their conditions The business view lists each decision's branches with the condition read from the live definition (field label from the flow's object, amount in the reader's locale and currency), or a neutral marker when the condition is outside the reader's grammar. The entry condition is shown once above the steps. Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
… conditions never draw unread for a render Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…rawing a condition Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Nov 22, 2026
…d, so no exported name has two authorities plugin-list already exports a ConditionField interface; one-authority-per-exported-name counts the flow reader's interface as a second declaration of that name. Claude-Session: https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ Final head for L1 · area f7-shell · 2026-11-22T08:48Z
|
Contributor
Author
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf L1 ACCEPT · head 维护者速读
席位核对
|
…ow-embed-branches
Contributor
Author
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ Landing · area f7-shell · 2026-11-22T14:13Z
State: ready + auto-merge into the merge queue. |
objectstack-fleet
Bot
deleted the
claude/issue-36094-flow-embed-branches
branch
November 22, 2026 14:35
This was referenced Nov 22, 2026
247257110
pushed a commit
to 247257110/objectstack
that referenced
this pull request
Nov 23, 2026
…steps in the reader's language (objectstack-ai#36335) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbUq2j5tRRVo3TVY3wcS1Fdg)_ Part of objectstack-ai#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 objectstack-ai#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 objectstack-ai#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 objectstack-ai#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 <details><summary>Pins (one top-level describe in the existing viewer harness)</summary> `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. </details> <details><summary>Runs</summary> - 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 e061084 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. </details> ## Acceptance notes - **Merges.** This branch merged `origin/main` twice. First merge (c261a7c, objectstack-ai#36316, already on main): objectstack-ai#36316 moved `activeFlowsBundle` into `@object-ui/i18n` at the same path this branch had used. Resolution kept main's `flowsBundle.ts` byte-for-byte, dropped this branch's duplicate move, and kept `flowLabels.ts` and its export. `git grep` on the merged tree: one `function activeFlowsBundle` (`ui/packages/i18n/src/flowsBundle.ts`), no app-shell copy, no `utils/flowsBundle` import left. Second merge (e605773, objectstack-ai#36327): kept its branches and entry-condition code and its tests, and added the two label reads plus the branch-target label. - **Measurement for Asked item 2 (built elsewhere).** hotcrm `opportunity_approval` (hotcrm 01d3ec4): 13 nodes; 11 drawn at the default business altitude; 2 have a key (`approval`), 9 do not: 1 start, 3 decision, 4 notify, 1 end. - The embed's subtitle is the authored `flow.description`. The spec's `flows` group has no description key, so it stays authored. - No `content/docs` page documents the viewer (only its ADR, a governed surface), so no docs page changed. - Changeset: `@object-ui/components` and `@object-ui/i18n` patch. `@object-ui/app-shell` is private and its behaviour is unchanged. ## Verification <details><summary>Gates</summary> - `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. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ)_ <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #36094
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
ui/packages/components/src/renderers/basic/flow-branches.ts(new, pure):decisionBranchesreads a decision's branches in both forms the engine runs (aconfig.conditionsdecision through its out-edge labels,default/isDefaultas "otherwise"; a gateway decision through its out-edges'condition).readConditionis 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 == nullunder||) are dropped, since the platform's null-guard rule puts one on every ordering comparison. Anything else answersnull. A top-level conjunction with some unread terms reads asA and other conditions: each read term is necessary, the rest are named rather than dropped.metadata-viewer.tsxFlowView, 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 inFlowConditions, 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.element.metadataViewer.*strings in all eleven packs (condition,otherwise,conditionAnd,conditionOr,conditionMore,runsWhen).type: flowblock draws its title and steps in the authored language — the viewer does not read the package's flows translations, and a decision or notify step has no key #35979 changes (flow.label,n.label) are untouched. A branch's target label readstarget.labelinBranches; whichever PR lands second routes it through Doc metadata embed: atype: flowblock draws its title and steps in the authored language — the viewer does not read the package's flows translations, and a decision or notify step has no key #35979's resolver.FlowConditionField:@object-ui/plugin-listalready exports aConditionFieldinterface, andone-authority-per-exported-namerefuses a second declaration of one exported name (it went red inTest UI (10/16)at c3bc920; renamed in c8300e9).@object-ui/componentsand@object-ui/i18npatch.Read first (riskiest first):
flow-branches.tsisGuardandread(what is dropped as a guard, and when a partial reading is allowed), thenFlowConditionsinmetadata-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 sixflow 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-leveldescribe), on a hotcrm-shapedopportunity_approvalserved with{ dialect: 'cel', source }envelopes:Amount > 500,000beside the branch to Sales Director Sign-off andAmount ≤ 500,000beside the other branch; a 750000 threshold in the served definition drawsAmount > 750,000and no500,000;$500,000under 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.Readings at head c8300e9 (the rename)
Test UI (10/16)at c3bc920 was red onui/scripts/__tests__/one-authority-per-exported-name-6273.test.ts: "ConditionField — a NEW colliding name",flow-branches.ts:348againstplugin-list/src/conditions/conditionModel.ts:31. c8300e9 renames the reader's interface toFlowConditionField(3 files, 7 lines, no behaviour change), so no ablation.flow-branches-36094.test.tsplusmetadata-viewer.test.tsxgaveTest 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) gaveTest Files 172 passed | 2 skipped (174),Tests 5122 passed | 2 skipped (5124),VERDICT command-exit 0.pnpm --filter @object-ui/components run type-checkexit 0, thenpnpm check:type-check-debtexit 0 ("129/132 workspace packages type-checked ... 0 in the DEBT ledger").Test UIandTest UI (10/16)success).Readings at head c3bc920
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.tsxgaveTest Files 2 passed (2),Tests 46 passed (46).packages/i18n/(key-parity tests included) gaveTest Files 107 passed (107),Tests 2007 passed | 13 skipped,VERDICT command-exit 0.pnpm --filter @object-ui/components run type-checkexit 0 andpnpm --filter @object-ui/i18n run type-checkexit 0.--listFilescounts the new test file and the harness in the test program (2) and the new module in the source program (1).scripts/ablation-replace.mjs(anchor 1 to 0, blob moved) and was restored to the HEAD blob withgit diff HEADempty:readComparisonreturns null.3 failed | 11 passed (14).1 failed | 13 passed (14).1 failed | 13 passed (14).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.node ui/scripts/check-i18n-call-site-keys.mjsexit 0,check-i18n-dead-keys.mjsexit 0,check-i18n-en-drift.mjsexit 0 ("No en value changed in this range").Acceptance notes
FlowSchema(spec source at this branch's base): edge and startconditioncome back as{ dialect: 'cel', source }(a bare string normalizes to it), andconfig.conditions[].expressionstays a bare string. The reader takes both spellings ofEvaluatedExpressionInputSchemaand no other. A liveGET /api/v1/meta/flow/…read was NOT MEASURED: no server build was available in the container while the verify lock was saturated.@object-ui/componentsimports. app-shell'scelToRowsis a round-trip reader for the edge inspector's own spellings, and app-shell is off-limits to components.@objectstack/formula'sparseCelToAstis a real parser, but components does not declare that dependency. Per the dispatch, this PR writes the smallest reader and fails closed. Moving it ontoparseCelToAstwould need a manifest edit and is noted here, not done.previous.*, a field compared with a field, function calls, list membership, booleans, dates, percents, and aget_recordvariable reading another object (it would need a second object request). hotcrm's start condition readsAmount ≥ 100,000 and other conditions.Mark Approved, anupdate_record) are named in the branch line even though the step list hides them.approve/rejectout-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, includingpnpm --dir ui exec vitest run scripts/andpnpm check:type-check-debt(both NOT MEASURED at c3bc920).--ranreconciliation: "41 derived famil(ies) accounted for — 41 run, 0 NOT-MEASURED".node scripts/check-platform-checklist.mjs --changed-from origin/mainexit 0 (0 anchored files).overlap-checkat c8300e9:VERDICT overlap exit 1, conflicting only with #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