diff --git a/.changeset/36530-titled-screen-node-label.md b/.changeset/36530-titled-screen-node-label.md new file mode 100644 index 00000000000..52a52ae7555 --- /dev/null +++ b/.changeset/36530-titled-screen-node-label.md @@ -0,0 +1,22 @@ +--- +'@objectstack/spec': minor +'@objectstack/lint': minor +'@object-ui/i18n': minor +'@object-ui/components': minor +--- + +feat(i18n): a flow screen with its own heading gets a translatable step name, `flows.FLOW.nodes.NODE_ID.label` + +Clause-②: yes (widening) +Metadata-protocol: added + +A screen node that sets its own `config.title` has a heading and a separate canvas label. Until now only the heading could be translated (`flows.FLOW.screens.NODE_ID.title`), so the label stayed in the authoring language. The docs flow embed and the Studio flow designer both draw that label. + +- **New key accepted.** `objectstack validate` now accepts `flows.FLOW.nodes.NODE_ID.label` over a screen whose `config.title` is a non-empty string. A screen with no `config.title` is still refused there and pointed at `screens.NODE_ID.title`, because its heading is its label and one string keeps one key. An `approval` node is still pointed at `approvals.NODE_ID.label`. +- **Docs embed.** The `type: flow` embed (`element:metadata_viewer`) names a titled screen by its heading, translated where the bundle has the heading. When the heading holds a `{{ }}` hole, which a drawing cannot fill, the embed now names the screen by the new key, and falls back to the authored label only if the key is missing. +- **Studio designer.** The canvas draws a titled screen's label from the new key. +- **Untitled screen with a hole.** If a translated `screens.NODE_ID.title` contains a `{{ }}` hole, the embed and the canvas now draw the authored label rather than the raw template. +- **Coverage.** `os lint`'s i18n coverage and `os i18n extract` ask for the new key on a top-level screen whose authored heading holds a `{{ }}` hole. These are the screens the embed draws by their label. +- **One branch rule.** `@objectstack/spec/automation` exports `flowDecisionEdgeBranch`, `FlowDecisionEdgeBranch` and `FLOW_DECISION_DEFAULT_BRANCH_LABEL`. They decide which out-edges of a decision a drawing lists as branches. The docs embed's branch list and the i18n walk's folded branch targets both read them, so the two can no longer disagree. + +Nothing to migrate. A bundle that does not use the new key keeps working. diff --git a/content/docs/references/system/translation.mdx b/content/docs/references/system/translation.mdx index e6ae24a7478..4579b6656da 100644 --- a/content/docs/references/system/translation.mdx +++ b/content/docs/references/system/translation.mdx @@ -297,7 +297,7 @@ Translation data for a single object | **screens** | `Record }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) | | **refusals** | `Record` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` | | **approvals** | `Record` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node | -| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` | +| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than an untitled `screen` or an `approval` | | **notices** | `Record` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node | | **records** | `Record }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node | @@ -487,7 +487,7 @@ Translation data for a single object | **screens** | `Record }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) | | **refusals** | `Record` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` | | **approvals** | `Record` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node | -| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` | +| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than an untitled `screen` or an `approval` | | **notices** | `Record` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node | | **records** | `Record }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node | @@ -740,7 +740,7 @@ Translation data for a single object | **screens** | `Record }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) | | **refusals** | `Record` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` | | **approvals** | `Record` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node | -| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` | +| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than an untitled `screen` or an `approval` | | **notices** | `Record` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node | | **records** | `Record }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node | @@ -962,7 +962,7 @@ Translation data for a single object | **screens** | `Record }>` | optional | Screen translations keyed by screen node id (`FlowNode.id`, the client's `ScreenSpec.nodeId`) | | **refusals** | `Record` | optional | Refusal translations keyed by the node id (`FlowNode.id`) of an `end` node declaring `outcome: 'refused'` | | **approvals** | `Record` | optional | Approval-step translations keyed by the node id (`FlowNode.id`) of an `approval` node | -| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval` | +| **nodes** | `Record` | optional | Node-label translations keyed by node id (`FlowNode.id`) — every node other than an untitled `screen` or an `approval` | | **notices** | `Record` | optional | Save-notice translations keyed by the node id (`FlowNode.id`) of a `save_notice` node | | **records** | `Record }>` | optional | Record-write text translations keyed by the node id (`FlowNode.id`) of a `create_record` / `update_record` node | diff --git a/packages/cli/test/i18n-flow-node-coverage.test.ts b/packages/cli/test/i18n-flow-node-coverage.test.ts index d698b4dfd6f..7c6a4107564 100644 --- a/packages/cli/test/i18n-flow-node-coverage.test.ts +++ b/packages/cli/test/i18n-flow-node-coverage.test.ts @@ -136,6 +136,34 @@ describe('what the walker harvests for the steps a docs flow embed draws (ruling ).toMatchObject({ sourceValue: 'Compute Next Due Date', source: 'flow' }); }); + it('asks for a titled screen\'s label exactly where its heading holds a hole, which the embed then draws it by', () => { + const flow = { + name: 'welcome', + label: 'Welcome', + nodes: [ + { id: 'confirm', type: 'screen', label: 'Confirm' }, + { id: 'plain', type: 'screen', label: 'Plain step', config: { title: 'Welcome aboard' } }, + { id: 'greet', type: 'screen', label: 'Greeting step', config: { title: 'Hello {{ vars.name }}' } }, + { + id: 'each', + type: 'loop', + label: 'Each', + config: { + collection: '{rows}', + body: { nodes: [{ id: 'inner', type: 'screen', label: 'Inner', config: { title: 'Row {{ row.name }}' } }] }, + }, + }, + ], + edges: [], + }; + // An untitled screen is named by `screens..title`, a plain heading by that same key, + // and a nested screen is not drawn by the embed: only `greet` is asked. + expect(nodeKeys({ flows: [flow] })).toEqual(['flows.welcome.nodes.greet.label', 'flows.welcome.nodes.each.label']); + expect( + collectExpectedEntries({ flows: [flow] }).find((e) => e.path.join('.') === 'flows.welcome.nodes.greet.label'), + ).toMatchObject({ sourceValue: 'Greeting step', inline: 'Greeting step', source: 'flow' }); + }); + it('skips a step with no id: nothing could address it', () => { const flow = { ...opportunityApproval, nodes: [{ type: 'decision', label: 'Anonymous' }] }; expect(nodeKeys({ flows: [flow] })).toEqual([]); diff --git a/packages/lint/src/i18n-walk.ts b/packages/lint/src/i18n-walk.ts index f25862a2074..3e17d742610 100644 --- a/packages/lint/src/i18n-walk.ts +++ b/packages/lint/src/i18n-walk.ts @@ -186,7 +186,7 @@ import { import { FLOW_REGION_SLOTS_BY_TYPE, flowScreenFieldOptionKey, isFlowTextEnvelopeShaped, templateSlotSource } from '@objectstack/spec/automation'; import { DEFAULT_METADATA_TYPE_REGISTRY } from '@objectstack/spec/kernel'; import { deriveFieldGroupLayout } from '@objectstack/spec/data'; -import { APPROVAL_NODE_TYPE, isFlowTechnicalNodeType } from '@objectstack/spec/automation'; +import { APPROVAL_NODE_TYPE, flowDecisionEdgeBranch, isFlowTechnicalNodeType } from '@objectstack/spec/automation'; import { expandViewContainer, InlineLocaleMapSchema } from '@objectstack/spec/ui'; import { authorWarnedProperties } from './lint-liveness-properties.js'; import { walkPageComponents } from './page-walk.js'; @@ -2292,18 +2292,16 @@ function collectFlowNodesDeep(nodes: unknown): any[] { } -/** The label a decision's fall-through branch carries (`DEFAULT_BRANCH_LABEL` in the engine). */ -const DECISION_DEFAULT_BRANCH = 'default'; - /** * The folded technical steps a business-altitude flow drawing still names: the * top-level `FLOW_TECHNICAL_NODE_TYPES` node a top-level decision's branch * leads to, in edge order, each once. * - * Mirrors which out-edges the docs viewer lists as branches - * (`decisionBranches`, `ui/packages/components/src/renderers/basic/flow-branches.ts`): - * every out-edge of a decision with no `config.conditions`; otherwise a - * default edge (`isDefault`, or the `default` label) and an edge whose label a + * Which out-edges are branches is the spec's `flowDecisionEdgeBranch`, the one + * rule the docs viewer lists them by (`decisionBranches`, + * `ui/packages/components/src/renderers/basic/flow-branches.ts`): every + * out-edge of a decision with no `config.conditions`; otherwise a default + * edge (`isDefault`, or the `default` label) and an edge whose label a * condition claims. The viewer finds the target among the top-level nodes * only, so a region's nested node is not one. */ @@ -2317,17 +2315,10 @@ function decisionBranchTechnicalTargets(flow: any, topLevel: any[]): { id: strin const targets: { id: string; label: unknown }[] = []; for (const node of topLevel) { if (!node || typeof node !== 'object' || node.type !== 'decision' || typeof node.id !== 'string') continue; - const conditions: any[] = Array.isArray(node.config?.conditions) - ? node.config.conditions.filter((c: unknown) => c !== null && typeof c === 'object' && !Array.isArray(c)) - : []; + const conditions: unknown = node.config && typeof node.config === 'object' ? node.config.conditions : undefined; for (const edge of edges) { if (!edge || typeof edge !== 'object' || edge.source !== node.id || typeof edge.target !== 'string') continue; - const listed = - conditions.length === 0 || - edge.isDefault === true || - edge.label === DECISION_DEFAULT_BRANCH || - conditions.some((c) => typeof edge.label === 'string' && c.label === edge.label); - if (!listed) continue; + if (!flowDecisionEdgeBranch(edge, conditions)) continue; const target = byId.get(edge.target); if (!target || !isFlowTechnicalNodeType(target.type) || seen.has(target.id)) continue; seen.add(target.id); @@ -2583,16 +2574,28 @@ function walkScreenFlows(config: any, out: ExpectedEntry[]): void { // every step the docs viewer's `type: flow` embed draws at its default // altitude (`detail: business`): a top-level node whose type // `isFlowTechnicalNodeType` does not fold away, the one table that viewer - // reads. A `screen` and an `approval` are drawn too, but their label is - // keyed already (`screens..title`, `approvals..label`), - // so they are not asked twice. Start and end nodes are asked like any - // other step: the viewer draws the author's words for them, not its own. - // A region's nested nodes (ADR-0031) are not drawn by that embed, so they - // are accepted by `os validate` but not demanded here. + // reads. An `approval` and an untitled `screen` are drawn too, but their + // label is keyed already (`approvals..label`, + // `screens..title`), so they are not asked twice. A screen that + // authors its own `config.title` is drawn by that heading, keyed + // `screens..title` too, unless the heading holds a `{{ }}` hole a + // drawing cannot fill; the embed then draws the screen's label, so that + // screen alone is asked for its `nodes` key (`flowStepName`, + // `metadata-viewer.tsx`). The Studio canvas draws every titled screen by + // that key, but the walk asks only for what the docs embed draws, as it + // does for the technical steps that canvas also draws. Start and end + // nodes are asked like any other step: the viewer draws the author's words + // for them, not its own. A region's nested nodes (ADR-0031) are not drawn + // by that embed, so they are accepted by `os validate` but not demanded + // here. const topLevel: any[] = Array.isArray(flow.nodes) ? flow.nodes : []; for (const node of topLevel) { if (!node || typeof node !== 'object') continue; - if (node.type === SCREEN_NODE_TYPE || node.type === APPROVAL_NODE_TYPE) continue; + if (node.type === APPROVAL_NODE_TYPE) continue; + if (node.type === SCREEN_NODE_TYPE) { + const title: unknown = node.config && typeof node.config === 'object' ? node.config.title : undefined; + if (typeof title !== 'string' || !title.includes('{{')) continue; + } if (isFlowTechnicalNodeType(node.type)) continue; const nodeId = typeof node.id === 'string' && node.id.length > 0 ? node.id : undefined; // No id, no key: nothing could address the step. diff --git a/packages/lint/src/validate-translation-references.test.ts b/packages/lint/src/validate-translation-references.test.ts index 53e78e98cd2..0ee5566297b 100644 --- a/packages/lint/src/validate-translation-references.test.ts +++ b/packages/lint/src/validate-translation-references.test.ts @@ -2452,6 +2452,7 @@ describe('validateTranslationReferences — flow node labels (`nodes..l { id: 'start', type: 'start', label: 'Start' }, { id: 'gate', type: 'decision', label: 'High Value (> $500K)?' }, { id: 'collect', type: 'screen', label: 'Collect', config: { fields: [{ name: 'note' }] } }, + { id: 'greet', type: 'screen', label: 'Greeting', config: { title: 'Hello {{ vars.name }}' } }, { id: 'manager_review', type: 'approval', @@ -2503,13 +2504,31 @@ describe('validateTranslationReferences — flow node labels (`nodes..l ); }); - it('points a `nodes` key over a `screen` node at its heading', () => { + it('points a `nodes` key over an untitled `screen` node at its heading', () => { const findings = validateTranslationReferences(bundle({ opportunity_approval: { nodes: { collect: { label: 'x' } } } })); - expect(findings).toHaveLength(1); - expect(findings[0].message).toBe( - 'Translations are keyed to node "collect", which flow "opportunity_approval" declares as a `screen` node; ' + - 'its heading is keyed `screens.collect.title`.', - ); + expect(findings.map((f) => [f.rule, f.severity, f.path])).toEqual([ + [TRANSLATION_TARGET_UNKNOWN, 'error', 'translations[0]["zh-CN"].flows.opportunity_approval.nodes.collect'], + ]); + expect(findings[0].message).toContain('`screens.collect.title`'); + }); + + it('accepts a `nodes` key over a screen that authors its own `config.title`, beside that screen\'s heading key', () => { + expect( + validateTranslationReferences( + bundle({ + opportunity_approval: { + nodes: { greet: { label: '问候' } }, + screens: { greet: { title: '你好 {{ vars.name }}' } }, + }, + }), + ), + ).toEqual([]); + }); + + it('offers a titled screen as the nearest node for a misspelt `nodes` key', () => { + const findings = validateTranslationReferences(bundle({ opportunity_approval: { nodes: { gret: { label: 'x' } } } })); + expect(findings.map((f) => f.rule)).toEqual([TRANSLATION_TARGET_UNKNOWN]); + expect(findings[0].message).toContain('Did you mean "greet"?'); }); it('refuses a `nodes` key over an UNKNOWN node, with the nearest labelled node offered', () => { diff --git a/packages/lint/src/validate-translation-references.ts b/packages/lint/src/validate-translation-references.ts index f9ba75c327e..a9bc09364d3 100644 --- a/packages/lint/src/validate-translation-references.ts +++ b/packages/lint/src/validate-translation-references.ts @@ -509,6 +509,13 @@ interface ScreenFacts { * screen without one resolves nothing. */ hasDescription: boolean; + /** + * Whether the screen AUTHORS its own heading (`config.title`, a non-empty + * string). Such a screen is titled apart from its label, so its label has a + * key of its own, `…nodes..label`; an untitled screen's label IS + * its heading, keyed `…screens..title`. + */ + titled: boolean; } /** Everything a `flows..…` key may legally name under one flow. */ @@ -1692,6 +1699,7 @@ function buildUniverse(stack: AnyRec): Universe { fieldOptions, objectName: strName(config?.objectName), hasDescription: typeof config?.description === 'string' && config.description.length > 0, + titled: typeof config?.title === 'string' && config.title.length > 0, }); } flows.set(flowName, { screens, refusals, notices, records, approvals, messages, otherNodes }); @@ -2573,10 +2581,13 @@ export function validateTranslationReferences(stack: AnyRec): TranslationRefFind ); } // ── flows..nodes. (ruling 7076440876) ────────────── - // Any node but a `screen` or an `approval`, at any depth: those two - // carry their label under a key of their own, so a `nodes` key over - // one is pointed there rather than accepted as a second key. + // Any node but an `approval` or an untitled `screen`, at any depth: + // those two carry their label under a key of their own, so a `nodes` + // key over one is pointed there rather than accepted as a second key. + // A screen that authors its own `config.title` is titled apart from + // its label, so its label is keyed here. for (const nodeId of Object.keys(asRecord(rawFlow.nodes))) { + if (flow.screens.get(nodeId)?.titled) continue; const nodeType = flow.screens.has(nodeId) ? SCREEN_NODE_TYPE : flow.otherNodes.get(nodeId); if (nodeType && nodeType !== SCREEN_NODE_TYPE && nodeType !== APPROVAL_NODE_TYPE) continue; orphan( @@ -2584,15 +2595,16 @@ export function validateTranslationReferences(stack: AnyRec): TranslationRefFind `${flowPath}.nodes.${nodeId}`, nodeType === SCREEN_NODE_TYPE ? `Translations are keyed to node "${nodeId}", which flow "${flowName}" declares as a ` + - `\`screen\` node; its heading is keyed \`screens.${nodeId}.title\`.` + `\`screen\` node with no \`config.title\` of its own, so its label is its heading, keyed ` + + `\`screens.${nodeId}.title\`.` : nodeType === APPROVAL_NODE_TYPE ? approvalRedirect('node', nodeId, flowName) : `Translations are keyed to node "${nodeId}", which flow "${flowName}" does not declare, so ` + `its drawn step keeps its authored label.` + - suggest( - nodeId, - [...flow.otherNodes].filter(([, type]) => type !== APPROVAL_NODE_TYPE).map(([id]) => id), - ), + suggest(nodeId, [ + ...[...flow.otherNodes].filter(([, type]) => type !== APPROVAL_NODE_TYPE).map(([id]) => id), + ...[...flow.screens].filter(([, screen]) => screen.titled).map(([id]) => id), + ]), `Node-label translations are keyed by a node's \`id\`, not its \`label\`.`, ); } diff --git a/packages/spec/api-surface/automation.json b/packages/spec/api-surface/automation.json index 93249fbe4c7..373884ba501 100644 --- a/packages/spec/api-surface/automation.json +++ b/packages/spec/api-surface/automation.json @@ -135,6 +135,7 @@ "ExecutionStepSkipReason (type)", "ExecutionStepSkipReasonSchema (const)", "FLOW_BUILTIN_NODE_TYPES (const)", + "FLOW_DECISION_DEFAULT_BRANCH_LABEL (const)", "FLOW_NODE_EXPRESSION_PATHS (const)", "FLOW_NODE_SIBLING_EXPRESSION_BLOCKS (const)", "FLOW_NODE_TEXT_SLOTS (const)", @@ -152,6 +153,7 @@ "FlowCollectionSlot (type)", "FlowCollectionSlotParsed (type)", "FlowCollectionSlotSchema (const)", + "FlowDecisionEdgeBranch (type)", "FlowEdge (type)", "FlowEdgeParsed (type)", "FlowEdgeSchema (const)", @@ -344,6 +346,7 @@ "describeMissingScheduleOrganization (function)", "exportConstructsToBpmn (function)", "findRegionEntry (function)", + "flowDecisionEdgeBranch (function)", "flowFilterOperands (function)", "flowForm (const)", "flowNodeConfigRefusals (function)", diff --git a/packages/spec/export-origins/automation.json b/packages/spec/export-origins/automation.json index 89a05a08a18..f9cc34198ec 100644 --- a/packages/spec/export-origins/automation.json +++ b/packages/spec/export-origins/automation.json @@ -130,6 +130,7 @@ "ExecutionStepSkipReason": "src/automation/execution.zod.ts#ExecutionStepSkipReason (type)", "ExecutionStepSkipReasonSchema": "src/automation/execution.zod.ts#ExecutionStepSkipReasonSchema (const)", "FLOW_BUILTIN_NODE_TYPES": "src/automation/flow.zod.ts#FLOW_BUILTIN_NODE_TYPES (const)", + "FLOW_DECISION_DEFAULT_BRANCH_LABEL": "src/automation/flow-altitude.ts#FLOW_DECISION_DEFAULT_BRANCH_LABEL (const)", "FLOW_NODE_EXPRESSION_PATHS": "src/automation/flow-node-expression-paths.ts#FLOW_NODE_EXPRESSION_PATHS (const)", "FLOW_NODE_SIBLING_EXPRESSION_BLOCKS": "src/automation/flow-node-expression-paths.ts#FLOW_NODE_SIBLING_EXPRESSION_BLOCKS (const)", "FLOW_NODE_TEXT_SLOTS": "src/automation/flow-text-slot-template.ts#FLOW_NODE_TEXT_SLOTS (const)", @@ -147,6 +148,7 @@ "FlowCollectionSlot": "src/automation/builtin-node-config.zod.ts#FlowCollectionSlot (type)", "FlowCollectionSlotParsed": "src/automation/builtin-node-config.zod.ts#FlowCollectionSlotParsed (type)", "FlowCollectionSlotSchema": "src/automation/builtin-node-config.zod.ts#FlowCollectionSlotSchema (const)", + "FlowDecisionEdgeBranch": "src/automation/flow-altitude.ts#FlowDecisionEdgeBranch (type)", "FlowEdge": "src/automation/flow.zod.ts#FlowEdge (type)", "FlowEdgeParsed": "src/automation/flow.zod.ts#FlowEdgeParsed (type)", "FlowEdgeSchema": "src/automation/flow.zod.ts#FlowEdgeSchema (const)", @@ -337,6 +339,7 @@ "describeMissingScheduleOrganization": "src/automation/schedule-organization.zod.ts#describeMissingScheduleOrganization (function)", "exportConstructsToBpmn": "src/automation/bpmn-mapping.ts#exportConstructsToBpmn (function)", "findRegionEntry": "src/automation/control-flow.zod.ts#findRegionEntry (function)", + "flowDecisionEdgeBranch": "src/automation/flow-altitude.ts#flowDecisionEdgeBranch (function)", "flowFilterOperands": "src/automation/flow-node-expression-paths.ts#flowFilterOperands (function)", "flowForm": "src/automation/flow.form.ts#flowForm (const)", "flowNodeConfigRefusals": "src/automation/flow-node-config-refusals.ts#flowNodeConfigRefusals (function)", diff --git a/packages/spec/liveness/translation.json b/packages/spec/liveness/translation.json index 3e10f9a5d30..8a6dfdfc61c 100644 --- a/packages/spec/liveness/translation.json +++ b/packages/spec/liveness/translation.json @@ -260,13 +260,13 @@ "verifiedAt": "2026-11-22", "evidenceScope": "in-repo", "evidence": "ui/packages/i18n/src/flowLabels.ts#flowLabelTranslations (the one resolution of a flow drawing's step names: `stepLabel` reads each `nodes.` entry for its `label`, the drilled child below)", - "note": "FLIPPED planned → live 2026-11-22 on the commit that lands the reader, as this row's planned note prescribed (ruling 7076440876 on objectstack#35979, option A). A flow node's display label, `flows..nodes..label`, for every node but a `screen` (keyed `screens..title`) and an `approval` (keyed `approvals..label`). Refused by `objectstack validate` over an unknown node or a screen/approval node (packages/lint/src/validate-translation-references.ts#validateTranslationReferences), and demanded by the i18n walk for every step the docs flow embed draws at `detail: business` (packages/lint/src/i18n-walk.ts#walkScreenFlows). DRILLED to its one key, `label`: the entry's face is closed (`.strict()`).", + "note": "FLIPPED planned → live 2026-11-22 on the commit that lands the reader, as this row's planned note prescribed (ruling 7076440876 on objectstack#35979, option A). A flow node's display label, `flows..nodes..label`, for every node but an untitled `screen` (keyed `screens..title`) and an `approval` (keyed `approvals..label`); a screen that authors its own `config.title` has its label keyed here. Refused by `objectstack validate` over an unknown node, an untitled screen or an approval node (packages/lint/src/validate-translation-references.ts#validateTranslationReferences), and demanded by the i18n walk for every step the docs flow embed draws by its label at `detail: business`, a titled screen whose heading holds a `{{ }}` hole included (packages/lint/src/i18n-walk.ts#walkScreenFlows). DRILLED to its one key, `label`: the entry's face is closed (`.strict()`).", "children": { "label": { "status": "live", "verifiedAt": "2026-11-22", "evidenceScope": "in-repo", - "evidence": "ui/packages/i18n/src/flowLabels.ts#flowLabelTranslations (`stepLabel` spells `flows..nodes..label` for any node that is not an `approval` or a `screen`, out of the reader's language in the loaded resource tree); ui/packages/components/src/renderers/basic/metadata-viewer.tsx#flowStepName (the docs viewer's `type: flow` embed names each drawn step, and each step a decision branch leads to, by it, else the authored label); ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.tsx#FlowCanvas and ui/packages/app-shell/src/views/metadata-admin/previews/flow-region-view.tsx#RegionNode (the Studio flow designer's canvas, nested region nodes included, by the same `stepLabel`)", + "evidence": "ui/packages/i18n/src/flowLabels.ts#flowLabelTranslations (`stepLabel` spells `flows..nodes..label` for any node that is not an `approval` or an untitled `screen`, out of the reader's language in the loaded resource tree); ui/packages/components/src/renderers/basic/metadata-viewer.tsx#flowStepName (the docs viewer's `type: flow` embed names each drawn step, and each step a decision branch leads to, by it, else the authored label; a titled screen by its heading, and by this key where the heading holds a `{{ }}` hole); ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.tsx#FlowCanvas and ui/packages/app-shell/src/views/metadata-admin/previews/flow-region-view.tsx#RegionNode (the Studio flow designer's canvas, nested region nodes included, by the same `stepLabel`)", "producer": "ui/packages/i18n/src/flowsBundle.ts#activeFlowsBundle (the app's `flows` group in the reader's language, out of the bundle the host loaded)", "note": "Overlays the node's own `FlowNode.label`, plain text, the step name a drawing of the flow shows. FLIPPED planned → live 2026-11-22 with its container `flows.nodes` (see that row). Display only: no run, no stored row and no engine-rendered copy reads it. Pinned by ui/packages/components/src/__tests__/metadata-viewer.test.tsx (the docs embed) and ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx (the designer); the key spelling is held to `TranslationDataSchema` by packages/cli/test/i18n-flow-node-coverage.test.ts." } diff --git a/packages/spec/src/automation/flow-altitude.ts b/packages/spec/src/automation/flow-altitude.ts index 4713f1bead2..b92bfa3cddc 100644 --- a/packages/spec/src/automation/flow-altitude.ts +++ b/packages/spec/src/automation/flow-altitude.ts @@ -20,6 +20,11 @@ * every step it draws, and a folded step only where a drawn decision's * branch list names it as the step the branch leads to. * + * The branch list is the second rule the two readers share, so it lives here + * too: {@link flowDecisionEdgeBranch} says which out-edges of a decision the + * viewer lists (`decisionBranches`, `ui/packages/components`) and therefore + * which folded steps the walk asks a label for (`decisionBranchTechnicalTargets`). + * * Display only: nothing here changes how a flow runs. */ @@ -42,3 +47,51 @@ const TECHNICAL = new Set(FLOW_TECHNICAL_NODE_TYPES); export function isFlowTechnicalNodeType(type: unknown): boolean { return typeof type === 'string' && TECHNICAL.has(type); } + +/** + * The label a decision's fall-through branch carries: an out-edge labelled so + * is taken when no condition matches. The same word as the automation + * engine's `DEFAULT_BRANCH_LABEL` (`@objectstack/service-automation`). + */ +export const FLOW_DECISION_DEFAULT_BRANCH_LABEL = 'default'; + +/** + * How a drawing reads one out-edge of a `decision` node: + * + * - `default` — the fall-through branch (`isDefault`, or, on a decision that + * declares `config.conditions`, the {@link FLOW_DECISION_DEFAULT_BRANCH_LABEL} label); + * - `edge` — a decision with no `config.conditions` is a gateway whose + * out-edges carry their own `condition`, so every out-edge is a branch; + * - `condition` — the declared condition whose `label` the edge's `label` names. + */ +export type FlowDecisionEdgeBranch = + | { kind: 'default' } + | { kind: 'edge' } + | { kind: 'condition'; condition: Readonly> }; + +function isPlainRecord(value: unknown): value is Record { + return value !== null && typeof value === 'object' && !Array.isArray(value); +} + +/** + * Which branch of a decision the out-edge `edge` is, given the decision's + * `config.conditions` as authored; `undefined` for an edge no branch can ever + * take (a labelled edge of a `conditions` decision whose label neither a + * condition nor the default claims), which a drawing leaves out. + * + * The one rule both readers apply: the docs viewer's branch list + * (`decisionBranches`) and the i18n walk's folded branch targets + * (`decisionBranchTechnicalTargets`, `packages/lint`). + */ +export function flowDecisionEdgeBranch(edge: unknown, conditions: unknown): FlowDecisionEdgeBranch | undefined { + if (!isPlainRecord(edge)) return undefined; + const declared = Array.isArray(conditions) ? conditions.filter(isPlainRecord) : []; + if (edge.isDefault === true || (declared.length > 0 && edge.label === FLOW_DECISION_DEFAULT_BRANCH_LABEL)) { + return { kind: 'default' }; + } + if (declared.length === 0) return { kind: 'edge' }; + const label = edge.label; + if (typeof label !== 'string') return undefined; + const condition = declared.find((c) => c.label === label); + return condition ? { kind: 'condition', condition } : undefined; +} diff --git a/packages/spec/src/automation/index.ts b/packages/spec/src/automation/index.ts index b512ff81590..9903ffd4fc6 100644 --- a/packages/spec/src/automation/index.ts +++ b/packages/spec/src/automation/index.ts @@ -7,8 +7,15 @@ export * from './flow.zod'; export { FLOW_RESERVED_NODE_TYPES, reservedFlowNodeTypeRefusal } from './flow-reserved-node-types'; export * from './region-slots'; // [ADR-0051 §3.4] The node types a business-altitude flow drawing folds away, -// read by the docs viewer and by the i18n walk that demands the drawn labels. -export { FLOW_TECHNICAL_NODE_TYPES, isFlowTechnicalNodeType } from './flow-altitude'; +// read by the docs viewer and by the i18n walk that demands the drawn labels; +// and which out-edges of a decision that viewer lists as its branches. +export { + FLOW_TECHNICAL_NODE_TYPES, + isFlowTechnicalNodeType, + FLOW_DECISION_DEFAULT_BRANCH_LABEL, + flowDecisionEdgeBranch, + type FlowDecisionEdgeBranch, +} from './flow-altitude'; export * from './control-flow.zod'; export * from './io-node-config.zod'; export * from './builtin-node-config.zod'; diff --git a/packages/spec/src/system/translation.zod.ts b/packages/spec/src/system/translation.zod.ts index b91b7d2c59d..6ceb1efe6de 100644 --- a/packages/spec/src/system/translation.zod.ts +++ b/packages/spec/src/system/translation.zod.ts @@ -1788,7 +1788,7 @@ const appTranslationDataShape = () => ({ * flows..screens..fields..options. (#22507) * flows..refusals..message (a refused `end` node, #22450) * flows..approvals..label (an `approval` node's step label) - * flows..nodes..label (any other node's display label, ruling 7076440876) + * flows..nodes..label (any other node's display label, a titled screen's included, ruling 7076440876) * flows..records..fields. (text a record write keeps) * * Every user-read string slot of the flow schemas is either one of these @@ -1930,13 +1930,16 @@ const appTranslationDataShape = () => ({ * - **Grouped by what it overlays, not by node type.** Every other group * addresses one node type; this one addresses the node label of every * node whose label has no key of its own, at any depth (an ADR-0031 region - * included). That excludes two types, each of which has a key of its - * own, so one string keeps one key: an `approval` (`approvals..label`) - * and a `screen`, whose `screens..title` covers - * `config.title ?? node.label`. A screen that authors its own `config.title` - * is titled apart from its label, so its canvas label has no key; a drawing - * names such a screen by its heading instead. `objectstack validate` - * points a `nodes` key over either type at its own key. + * included). That excludes an `approval` (`approvals..label`) + * and an untitled `screen`, whose `screens..title` covers + * `config.title ?? node.label`, so one string keeps one key. + * `objectstack validate` points a `nodes` key over either at its own key. + * - **A titled screen's label is keyed here.** A screen that authors its + * own non-empty `config.title` is titled apart from its label, so its + * label has no other key: the Studio canvas draws it, and the docs embed + * draws it where the heading holds a `{{ }}` hole a drawing cannot fill + * (elsewhere the embed names the screen by its heading). Its heading + * stays `screens..title`. * - **Start and end nodes included.** Their labels are the author's words * like any other step's, and often name an outcome or a trigger * ("Approved", "On Task Created"), so a viewer does not substitute words of @@ -2187,8 +2190,10 @@ const appTranslationDataShape = () => ({ // [ruling 7076440876] Any other node's display label, the step name a // drawing of the flow shows (the docs viewer's `type: flow` embed and the // Studio designer). Grouped by what it overlays, `FlowNode.label`, not by - // node type: a screen's heading and an approval step's label already have - // their own keys, so `objectstack validate` points a key over either at it. + // node type: an untitled screen's heading and an approval step's label + // already have their own keys, so `objectstack validate` points a key over + // either at it; a screen that authors its own `config.title` has its label + // keyed here. nodes: z.record(z.string(), strictObject({ surface: 'this flow node translation', history: TRANSLATION_HISTORY, @@ -2206,11 +2211,12 @@ const appTranslationDataShape = () => ({ }, { label: z.string().optional().describe( "Translated node label — overlays the node's own `label` (`FlowNode.label`), the step name a drawing of the " - + 'flow shows; for any node but a `screen` (keyed `screens..title`) and an `approval` (keyed ' - + '`approvals..label`)', + + 'flow shows; for any node but an untitled `screen` (keyed `screens..title`) and an `approval` ' + + '(keyed `approvals..label`). A screen that authors its own `config.title` has its label keyed here', ), })).optional().describe( - 'Node-label translations keyed by node id (`FlowNode.id`) — every node other than a `screen` or an `approval`', + 'Node-label translations keyed by node id (`FlowNode.id`) — every node other than an untitled `screen` or an ' + + '`approval`', ), // [#28251] A `save_notice` node's message, picked by the ENGINE in the // triggering writer's locale before its holes are filled — the `refusals` diff --git a/ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx index eb3067b97cd..b5cc9046af4 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx @@ -625,8 +625,8 @@ describe('Flow designer — package label translations (flows..label, appr opportunity_approval: { label: '大额商机审批', approvals: { manager_review: { label: '经理审核' }, director_signoff: { label: '总监签批' } }, - nodes: { big: { label: '超过一百万?' }, tell_signer: { label: '通知签署人' } }, - screens: { confirm: { title: '确认' }, review_deal: { title: '审阅交易' } }, + nodes: { big: { label: '超过一百万?' }, tell_signer: { label: '通知签署人' }, review_deal: { label: '审阅交易步骤' } }, + screens: { confirm: { title: '确认' }, review_deal: { title: '审阅交易' }, greet: { title: '你好 {{vars.name}}' } }, }, }, }; @@ -677,8 +677,8 @@ describe('Flow designer — package label translations (flows..label, appr expect(t.stepLabel({ id: 'tell_signer', type: 'notify' })).toBe('通知签署人'); // An untitled screen by `screens..title`, the key its run-time title already uses. expect(t.stepLabel({ id: 'confirm', type: 'screen' })).toBe('确认'); - // A titled screen's label has no key: its `screens` title overlays the heading, read apart. - expect(t.stepLabel({ id: 'review_deal', type: 'screen', config: { title: 'Review the deal' } })).toBeUndefined(); + // A titled screen's label by `nodes..label`; its `screens` title overlays the heading, read apart. + expect(t.stepLabel({ id: 'review_deal', type: 'screen', config: { title: 'Review the deal' } })).toBe('审阅交易步骤'); expect(t.screenTitle({ id: 'review_deal', type: 'screen' })).toBe('审阅交易'); // One string, one key: a type reads its own group only, whatever the id. expect(t.stepLabel({ id: 'manager_review', type: 'decision' })).toBeUndefined(); @@ -728,6 +728,25 @@ describe('Flow designer — package label translations (flows..label, appr expect(card('each').textContent).not.toContain('Tell signer'); }); + it('draws a titled screen by its nodes key; an untitled screen whose translated title adds a hole keeps its authored label', () => { + const screens = [ + { id: 'review_deal', type: 'screen', label: 'Review deal step', config: { title: 'Review the deal' } }, + { id: 'greet', type: 'screen', label: 'Greeting' }, + ]; + const t = zh(); + expect(t.stepLabel({ id: 'greet', type: 'screen' })).toBeUndefined(); + const { container } = render( + + {}} /> + , + ); + const card = (id: string) => container.querySelector(`[data-node-id="${id}"]`) as HTMLElement; + expect(card('review_deal').textContent).toContain('审阅交易步骤'); + expect(card('review_deal').textContent).not.toContain('Review deal step'); + expect(card('greet').textContent).toContain('Greeting'); + expect(card('greet').textContent).not.toContain('{{'); + }); + it('with no translation the canvas draws the authored labels, as before', () => { const { container } = render( {}} />, diff --git a/ui/packages/components/src/__tests__/metadata-viewer.test.tsx b/ui/packages/components/src/__tests__/metadata-viewer.test.tsx index 5ad06a151a1..955a9092089 100644 --- a/ui/packages/components/src/__tests__/metadata-viewer.test.tsx +++ b/ui/packages/components/src/__tests__/metadata-viewer.test.tsx @@ -318,7 +318,8 @@ describe('element:metadata_viewer flow embed: package label translations (flows. * view draws has a key. A start, decision, notify or end step is named by * `flows..nodes..label`; an untitled screen by * `screens..title`; a titled screen by its heading, translated under - * that same key, unless the heading holds a `{{ }}` hole a drawing cannot fill. + * that same key, unless the heading holds a `{{ }}` hole a drawing cannot fill; + * it is then named by its label's `nodes..label`. * The steps folded away are the spec's `FLOW_TECHNICAL_NODE_TYPES`, the table * the i18n coverage check reads to ask for exactly these translations. */ @@ -374,7 +375,7 @@ describe('element:metadata_viewer flow embed: every drawn step by its key (flows renderIn(ZH, ONBOARDING); await waitFor(() => expect(screen.getByText('欢迎加入')).toBeTruthy()); expect(screen.queryByText('Welcome screen')).toBeNull(); - // `Hello {{vars.name}}` cannot be filled in a drawing: the authored label, which has no key, stands. + // `Hello {{vars.name}}` cannot be filled in a drawing: with no `nodes` key in the bundle, the authored label stands. expect(screen.getByText('Greeting screen')).toBeTruthy(); expect(screen.queryByText(/你好/)).toBeNull(); cleanup(); @@ -386,6 +387,25 @@ describe('element:metadata_viewer flow embed: every drawn step by its key (flows expect(screen.getByText('Greeting screen')).toBeTruthy(); }); + it('names a titled screen whose heading holds a hole by its nodes key, and never by its heading', async () => { + const zh = ZH.flows!.onboarding!; + renderIn({ flows: { onboarding: { ...zh, nodes: { ...zh.nodes, greet: { label: '问候页' }, welcome: { label: '欢迎页' } } } } }, ONBOARDING); + await waitFor(() => expect(screen.getByText('问候页')).toBeTruthy()); + expect(screen.queryByText('Greeting screen')).toBeNull(); + expect(screen.queryByText(/你好/)).toBeNull(); + // A heading with no hole still names its screen; the label key does not displace it. + expect(screen.getByText('欢迎加入')).toBeTruthy(); + expect(screen.queryByText('欢迎页')).toBeNull(); + }); + + it('names an untitled screen whose translated title adds a hole by its authored label', async () => { + const zh = ZH.flows!.onboarding!; + renderIn({ flows: { onboarding: { ...zh, screens: { ...zh.screens, confirm: { title: '确认 {{vars.name}}' } } } } }, ONBOARDING); + await waitFor(() => expect(screen.getByText('入职时')).toBeTruthy()); + expect(screen.getByText('Confirm')).toBeTruthy(); + expect(screen.queryByText(/确认/)).toBeNull(); + }); + it('names the step a decision branch leads to by its nodes key too', async () => { const flow = { name: 'onboarding', diff --git a/ui/packages/components/src/renderers/basic/flow-branches.ts b/ui/packages/components/src/renderers/basic/flow-branches.ts index e3d1d7f16b2..19fb0fcbaaf 100644 --- a/ui/packages/components/src/renderers/basic/flow-branches.ts +++ b/ui/packages/components/src/renderers/basic/flow-branches.ts @@ -32,6 +32,8 @@ * read at all. */ +import { flowDecisionEdgeBranch } from '@objectstack/spec/automation'; + // --------------------------------------------------------------------------- // Graph: decisions and their branches // --------------------------------------------------------------------------- @@ -55,9 +57,6 @@ export interface DecisionBranch { guard: BranchGuard; } -/** The label a decision's fall-through branch carries (`DEFAULT_BRANCH_LABEL` in the engine). */ -const DEFAULT_BRANCH = 'default'; - type Rec = Record; function isRec(value: unknown): value is Rec { @@ -89,27 +88,28 @@ function outEdges(flow: unknown, nodeId: string): Rec[] { * The branches of the decision node `node`, in declaration order. An out-edge * no branch can ever take (a labelled edge of a `config.conditions` decision * whose label no condition and no default claims) is left out. + * + * Which out-edges are branches is the spec's `flowDecisionEdgeBranch`, the one + * rule the i18n walk (`packages/lint`, `decisionBranchTechnicalTargets`) also + * reads to ask a translation for each step a branch here names. */ export function decisionBranches(flow: unknown, node: unknown): DecisionBranch[] { if (!isRec(node) || node.type !== 'decision' || typeof node.id !== 'string') return []; - const config = isRec(node.config) ? node.config : undefined; - const conditions = Array.isArray(config?.conditions) ? config.conditions.filter(isRec) : []; + const conditions = isRec(node.config) ? node.config.conditions : undefined; const branches: DecisionBranch[] = []; outEdges(flow, node.id).forEach((edge, i) => { const key = typeof edge.id === 'string' ? edge.id : String(i); const target = edge.target as string; - if (edge.isDefault === true || (conditions.length > 0 && edge.label === DEFAULT_BRANCH)) { + const branch = flowDecisionEdgeBranch(edge, conditions); + if (!branch) return; + if (branch.kind === 'default') { branches.push({ key, target, guard: { kind: 'otherwise' } }); - return; - } - if (conditions.length === 0) { + } else if (branch.kind === 'edge') { branches.push({ key, target, guard: guardOf(edge.condition) }); - return; + } else { + const guard = guardOf(branch.condition.expression); + branches.push({ key, target, guard: guard.kind === 'none' ? { kind: 'opaque' } : guard }); } - const claimed = conditions.find((c) => typeof edge.label === 'string' && c.label === edge.label); - if (!claimed) return; - const guard = guardOf(claimed.expression); - branches.push({ key, target, guard: guard.kind === 'none' ? { kind: 'opaque' } : guard }); }); return branches; } diff --git a/ui/packages/components/src/renderers/basic/metadata-viewer.tsx b/ui/packages/components/src/renderers/basic/metadata-viewer.tsx index d225e006ed8..4c07701a3b6 100644 --- a/ui/packages/components/src/renderers/basic/metadata-viewer.tsx +++ b/ui/packages/components/src/renderers/basic/metadata-viewer.tsx @@ -397,22 +397,22 @@ function StateMachineView({ object, name }: ViewerProps) { * What the embed names a step by, in the reader's language where the package * translates it. * - * Every step by its label's one key (`approvals` / untitled `screens` / - * `nodes`, `useFlowLabelTranslations`), else the authored label. A screen that - * authors its own `config.title` is named by that heading — the words its - * reader meets at run time, translated under `screens..title` — - * unless the heading holds a `{{ }}` hole a drawing cannot fill; it then keeps - * its authored label, which has no key. + * A screen that authors its own `config.title` is named by that heading — the + * words its reader meets at run time, translated under + * `screens..title` — unless the heading holds a `{{ }}` hole a + * drawing cannot fill. Every other step, and such a screen, by its label's one + * key (`approvals` / untitled `screens` / `nodes`, `useFlowLabelTranslations`), + * else the authored label. */ function flowStepName(node: any, translated: FlowLabelTranslations | undefined): string | undefined { if (!node) return undefined; - const own = translated?.stepLabel(node); - if (own) return own; const title = node.type === 'screen' ? node.config?.title : undefined; if (typeof title === 'string' && title) { const heading = translated?.screenTitle(node) ?? title; if (!heading.includes('{{')) return heading; } + const own = translated?.stepLabel(node); + if (own) return own; return typeof node.label === 'string' && node.label ? node.label : node.id; } diff --git a/ui/packages/i18n/src/flowLabels.ts b/ui/packages/i18n/src/flowLabels.ts index 03f9f0298bd..7ebf2e00ffc 100644 --- a/ui/packages/i18n/src/flowLabels.ts +++ b/ui/packages/i18n/src/flowLabels.ts @@ -15,10 +15,13 @@ * - an `approval` node: `flows..approvals..label`; * - a `screen` node with no `config.title`: `flows..screens..title` * (the executor titles such a screen by its label, so one key covers both); - * - any other node: `flows..nodes..label` (ruling 7076440876). + * - any other node, a screen that authors its own `config.title` included: + * `flows..nodes..label` (ruling 7076440876). Such a screen is + * titled apart from its label, so its label is keyed like any other step's. * - * A screen that authors its own `config.title` is titled apart from its label, - * and its label has no key, so `stepLabel` answers nothing for it. + * An untitled screen's translated title is a run-time template: one holding a + * `{{ }}` hole a drawing cannot fill is not a step name, so `stepLabel` + * answers nothing for it and the drawing keeps the authored label. * * The Studio flow designer and the docs viewer's `type: flow` embed * (`element:metadata_viewer`) both read them here, and the flow label goes @@ -40,8 +43,9 @@ export interface FlowLabelTranslations { flowLabel?: string; /** * The step's translated label: `approvals..label` for an `approval`, - * `screens..title` for an untitled `screen`, `nodes..label` - * for any other node. `undefined` for a titled screen and an id-less node. + * `screens..title` for an untitled `screen` (unless it holds a + * `{{ }}` hole), `nodes..label` for any other node, a titled screen + * included. `undefined` for an id-less node. */ stepLabel: (node: { id?: unknown; type?: unknown; config?: unknown }) => string | undefined; /** @@ -76,9 +80,10 @@ export function flowLabelTranslations( if (node.type === 'approval') return text(flow?.approvals?.[node.id]?.label); if (node.type === 'screen') { const config = node.config && typeof node.config === 'object' ? (node.config as { title?: unknown }) : {}; - return config.title === undefined || config.title === null || config.title === '' - ? text(flow?.screens?.[node.id]?.title) - : undefined; + if (config.title === undefined || config.title === null || config.title === '') { + const title = text(flow?.screens?.[node.id]?.title); + return title?.includes('{{') ? undefined : title; + } } return text(flow?.nodes?.[node.id]?.label); },