Skip to content

feat(flow designer): edge conditions as field rows, and an approval inserts with approve and reject edges - #34932

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-jcwgnf
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-jcwgnf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

repo:objectstack#3 · os-support-ai · session_01WGufzgae1jRRi8FRrTxaZL

Part of #34818 (slice 2 of 3: items 3 and 4; slice 3 takes items 5 to 9 and closes the card).

Clause-②: no
Metadata-protocol: none

维护者速读

  • 连线条件默认按「字段 / 运算符 / 值」逐行填写(用的是列表工具栏的筛选组件,原样引入),右上角一键切到「公式」。不写公式就能配出「截止日期 晚于 今天」,存下来是 record.due_date != null && record.due_date > today()。
  • 已有的条件只有和逐行写法逐字一致时才以逐行打开;其他任何条件都以公式打开、原样不动。点「按字段填写」会说明为什么不能转。
  • 引用选择器业务字段在前、平台字段(审计、租户、id)在后;有显示名的字段以显示名为主,内部路径做小字。
  • 插入审批节点时自带两条出边:插在连线上时「通过」接原来的下一步,「驳回」接新建的「已驳回」结束节点;追加时两条分别接新建的「已通过」「已驳回」。画布上标签按界面语言显示。
  • 审批缺「通过」或「驳回」出边时,「问题」页签各报一条,点击定位到该审批节点。
  • 元数据结构、引擎行为、发布检查都不变。审批说明文字里「给出边打标签」那句,席位同意挪到第 3 片(它在 flow-node-config.ts,第 3 片本来就要改)。

What changes

Edge conditions as field rows (item 3).

  • New inspectors/flow-edge-condition-rows.ts bridges a guard and the FilterBuilder's rows. It is imported from @object-ui/components and not edited.
    • rowsToCel writes one fixed spelling per operator. Ordering, between and the string methods are null-guarded (S != null && …), the guard the server's null-guard gate asks for (objectstack#27513). Empty checks follow the spec's expandEmptyOperator table in ConditionBuilder's clauses. A date column's relative points become the formula stdlib's calendar calls ({today} → today(), {yesterday} → daysAgo(1), {tomorrow} → daysFromNow(1)).
    • A finished row it cannot write faithfully is refused by id and nothing is committed: icontains, a datetime or time literal (datetime-local has no zone), a relative window on between, an operator the builder does not offer for the column, or a comparison on a multi-value column.
    • celToRows reads a stored guard back only when re-writing the rows it read gives back the same bytes. Anything else answers null.
  • FlowEdgeInspector.tsx gains EdgeConditionEditor.
    • Rows are the default whenever the flow has a record trigger and the stored guard reads back. Otherwise the existing VariableTextInput formula input is shown, with the guard unchanged.
    • The switch back to rows is offered only for a guard the rows can show. For any other guard it stays a formula and says why.
    • Rows being edited are held locally, so an unfinished row stays on screen. Both modes write through writeExpressionSource, so a stored envelope keeps its dialect.
    • The subjects are the edge scope's own spellings (TriggerScope.fieldPrefix + name), by label, business fields first.

Reference picker (item 3).

  • flow-scope.ts: isPlatformField (the served system flag, id, or the spec's FIELD_GROUP_SYSTEM_FIELDS) and businessFieldsFirst. triggerFieldRefs lists business fields first and gives a labelled field its label as label.
  • VariableTextInput.tsx: a ref whose label differs from its token shows the label as main text, with the token muted beside it. Refs with no name of their own (variables, outputs) render as before.

Approval outcomes (item 4).

  • FlowCanvas.tsx:
    • approvalOutcomes builds the approve and reject edges and the new end nodes.
    • insertOnEdge and addNode use it for an approval. Every other type inserts as before.
    • An approval's approve / reject / revise pills read in the designer's language, with the keyword kept in the title.
  • FlowPreview.tsx: mintNodeId takes alsoTaken, so one gesture mints distinct ids that still respect the session ledger (os build --json's failure payloads carry no warnings, so the truncation notice's --json pointer is a dead end when a later gate fails #11772).
  • flow-problems.ts: approvalOutcomeProblems adds one warning per missing approve / reject out-edge, targeted at the node. revise is not asked for.
  • flow-canvas-parts.tsx: comment only.
  • i18n: new studio keys in en and zh (edge condition modes and notes, the two end labels, the problem sentence).

Tests

  • inspectors/flow-edge-condition-rows.test.ts (44 tests), with the read-back pinned both ways:
    • 18 written forms round-trip;
    • 18 other stored guards read as null, including near misses of the writer's own spellings (unguarded ordering, extra parentheses, double quotes, spacing, a quoted number, mixed joins, vars.*, previous.*, a bare field);
    • five refusals;
    • the formula engine (@objectstack/formula celEngine) evaluates "date after today" true for tomorrow, false for yesterday and for null, and the null-guarded text and list spellings on null.
  • inspectors/FlowEdgeInspector.conditionRows-34818.test.tsx (6 tests):
    • rows open for a guard the rows write, and Formula shows the same guard;
    • a hand-written guard opens unchanged and stays a formula;
    • an empty edge opens as rows;
    • a row edit keeps the envelope's dialect;
    • no record trigger gives the formula input only;
    • the picker lists business fields first, by label.
  • inspectors/flow-scope.test.ts: ordering, labels, isPlatformField.
  • previews/FlowCanvas.approvalOutcomes-34818.test.tsx (5 tests): insert on a connection, append, the plain-node control, ids that skip the session ledger, and the pill words with a control.
  • previews/flow-problems.approvalOutcomes-34818.test.ts (4 tests): both missing, one missing (case and space tolerant), both present, and the control on other node types.
  • Updated: inspectors/inspectorStrings.i18n-10748.test.tsx.
    • Its picker cases now click Formula first, because an empty guard opens as rows.
    • Its detail case reads labelled fields by their label, with the token beside it. The words it pins are unchanged.

Ablations (scripts/ablation-replace.mjs, each restored to HEAD and verified):

Mutation Result
triggerFieldRefs without businessFieldsFirst 1 of 56 flow-scope tests red
celToRows without the byte-equality check 4 of 44 bridge tests red (the near misses)
insertOnEdge approval branch off 1 of 5 canvas tests red (append still uses addNode)
approvalOutcomeProblems not pushed 2 of 4 problem tests red (the "nothing reported" cases stay green)
VariableTextInput label branch off 1 of 6 edge tests red (the picker case)
rows mode off (showRows = false) 3 of 6 edge tests red

Acceptance notes

  • "不写公式能配出「会议日期 晚于 今天」这样的分支条件":
    • live: built as rows, "截止日期 · 晚于 · 今天" on showcase_task, stored as record.due_date != null && record.due_date > today();
    • engine: evaluated by the bridge suite.
  • "新插入的审批节点有「通过」「驳回」两条出边": live. The inserted approval's out-edges were approve to the next step and reject to a new 已驳回 end, and the pills read 通过 / 驳回.
  • Item 4, "缺任一条时在「问题」页签报出来": live. With the reject edge removed, Problems listed 审批「审批」没有「驳回」出边… and the click selected the node.

Verification

Measured on head cbb82b02c (base e05445e4f), on a shared box.

  • Tests: pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin packages/i18n gave 850 files, 9940 passed and 14 skipped, exit 0. The same run on the previous base d947a93cf gave 849 files. Its one red, inspectorStrings.i18n-10748, is the updated file listed under Tests.
  • Type-check: pnpm --filter @object-ui/app-shell type-check (both projects) exit 0. A first run failed in AiChatPage.tsx on publishFromShellBar. The cause was a plugin-chatbot dist built before main added that prop. After pnpm --filter @object-ui/plugin-chatbot build it exits 0. No file of this PR is involved.
  • Derived gates: 88 derived on base d947a93cf, all run.
    • 83 exited 0.
    • Two were red and are fixed in this branch. check:test-source-alias asked for a module-top import '@objectstack/lint' in the updated inspectorStrings.i18n-10748 test. check:dts-closure reported a missing ui/apps/console/plugin.d.ts, local tree state left by an earlier gate's console vite build. After build:plugin it exits 0.
    • check-partof-closing-keyword exited 0 with this body as PR_BODY.
    • Two need a PR number and token, so they are left to this PR's PR-body guards: check-closing-target-claim and check-single-claim-paths.
    • After the restart on e05445e4f, which brought two shared studio i18n files, these were re-run with exit 0: check-changeset-no-major, check-empty-changeset, check:changeset-fixed, check:i18n-stale-fill and check:test-source-alias.
  • Eager bundle: not measured. Every new key is in the lazy studio namespace, and no eager pack changed.
  • Live: showcase backend (pnpm --filter @objectstack/example-showcase dev -- --fresh), the console under Vite with DEV_PROXY_TARGET, and Playwright at 1280×860 with zh-CN and en. The flow is a draft on showcase_task (record-after-create). The readings are in the comment below, and the screenshots and script are in the seat's project files under objectstack-seat3/34818-live/slice2/ (zh-1…zh-7, en-1…en-7).
  • Not run locally, left to CI: the full ui suite, test:repo and the dogfood battery (no ! and no (narrowing) arm).

@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgae1jRRi8FRrTxaZL

Live readings for #34932 (slice 2 of #34818). They were taken on the slice 2 commits over d947a93cf. The head cbb82b02c is the same three commits over e05445e4f, and none of the 17 commits between those bases touches the flow designer.

Setup:

  • Backend: pnpm --filter @objectstack/example-showcase dev -- --fresh.
  • Console: ui/apps/console under Vite with DEV_PROXY_TARGET.
  • Browser: Playwright at 1280×860, with locale set to zh-CN and to en.
  • Data: a flow draft on showcase_task (record-after-create), staged with PUT /meta/flow/…?mode=draft. It has a decision 标记任务 with two out-edges, 截止在未来 (empty) and 手写条件 (record.due_date > today()).
  • Script, flow and screenshots: the seat's project files, objectstack-seat3/34818-live/slice2/ (check.mjs, flow.json, zh-1…zh-7, en-1…en-7, zh.log, en.log).
Reading zh-CN en
Empty edge opens as rows (shot 1) 条件 · 公式 · + 添加条件… Condition · Formula · + Add a condition…
Field list in the rows, in order business fields first (标题, 项目, … 同步错误), then 创建人, 更新时间, 更新人, 负责人, 创建时间 the same order in English
Built "截止日期 · 晚于 · 今天" in the rows (shots 1–2) summary 1 个条件 summary 1 condition
Stored e2.condition {"dialect":"cel","source":"record.due_date != null && record.due_date > today()"} identical
Formula shows the same guard (shot 3) record.due_date != null && record.due_date > today() identical
Picker order (shot 3) record · 触发记录, then 标题 · record.title, 项目 · record.project …; last are 组织 · record.organization_id, 更新时间 · record.updated_at, 创建时间 · record.created_at Title · record.title …; last are Organization, Last Modified At, Created
Back to rows same single row, nothing rewritten same
Hand-written record.due_date > today() (shot 4) opens in the formula input unchanged. 按字段填写 keeps it there and reads 这个条件超出了按字段填写能表示的范围,请继续用公式编辑。 This condition goes beyond what the field rows can show. Keep editing it as a formula.
Approval inserted on 标记任务 → 提醒 (shot 5) out-edges approve → 提醒 and reject → 已驳回 (new end node), pills 通过 / 驳回 approve → 提醒 and reject → Rejected, pills Approve / Reject
Reject edge removed, then Problems (shot 6) 审批「审批」没有「驳回」出边,做出这个决定后流程无处可走。请从它连出一条连线,并把审批分支设为「驳回」。 Approval "Approval" has no "Reject" connection, so after that decision the flow has nowhere to go. Draw a connection out of it and set its approval branch to "Reject".
Click on that row (shot 7) the approval node is selected and its inspector opens same

The two author-named edge pills (截止在未来, 手写条件) stay as the author wrote them in both languages. Only an approval's outcome keywords are translated.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzf35CD4CvA4nKbwwUn

L1: ACCEPT
Head-sha: cbb82b0

What I read at this head:

The head merges cleanly with current main. check-governed-merges reads 1366 lines, not governed. Part of #34818 is right for slice 2 of 3.

Shape

  • Claim surface. Every changed file falls inside the amended surface:

    • FlowEdgeInspector.tsx and the new flow-edge-condition-rows.ts;
    • flow-scope.ts and VariableTextInput.tsx;
    • FlowCanvas.tsx, FlowPreview.tsx (mintNodeId(alsoTaken)) and flow-canvas-parts.tsx (comment);
    • flow-problems.ts;
    • studio en.ts and zh.ts;
    • the tests beside them, and the changeset.

    inspectorStrings.i18n-10748.test.tsx is the existing pin for the inspector's strings, which these edits touch, so I read it as one of "the tests beside each". FlowNodeInspector.tsx (Studio 自动化栏与界面栏:节点和视图的属性面板先标签后内部名,删除收进菜单,导航项类型用中文 #34796) and flow-node-config.ts are untouched.

  • Changeset. It names @object-ui/i18n, the one published package whose src moved. @object-ui/app-shell is private, so listing it does no harm.

  • Declarations. Clause-②: no and Metadata-protocol: none hold. The new keys sit in the lazy studio namespace, there is no spec change, and stored edges stay CEL strings.

  • Strings. All 8 new keys exist in both en and zh. The zh readings show no machine names; the only English left is the engine keyword approve/reject in a pill's title, and that is on purpose.

The code reads right

Live readings (6954346552)

They are in zh-CN and en, and cover:

  • an empty edge opening as rows;
  • business fields listed first;
  • 截止日期 · 晚于 · 今天 stored as record.due_date != null && record.due_date > today(), and the formula input showing the same guard;
  • the round trip back to rows rewriting nothing;
  • a hand-written guard staying in the formula input, with the explanatory line;
  • the picker showing the label first and the path muted;
  • an approval inserted on an edge with approve → 提醒 and reject → 已驳回;
  • removing the reject edge raising the Problems row, and a click on that row selecting the node.

They were taken on the same three commits over d947a93, and the card thread states that no flow-designer file changed between that base and e05445e.

Notes

  • Two paths have unit pins but no live reading:

    • the refused-row line (conditionRowRefused);
    • appending an approval, as opposed to inserting it on an edge, which yields both 已通过 and 已驳回 ends.

    Both are small and pinned. If slice 3's live run passes through them, one shot each would close the set.

  • Stale help text. As accepted in 6950765531, the approval help text still asks the author to label edges that the insert now creates. Slice 3 owns that wording.

  • CI. It was starting at this read, and landing needs it green at the final head. Nothing touches the eager locales/*.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgae1jRRi8FRrTxaZL

Landing #34932 (slice 2 of #34818) at head cbb82b02c.

Probe Reading
Governed surfaces (check-governed-merges --pr 34932) 0 of 17 paths governed; 1366 changed lines, under 3000
K (first-parent, PRBASE e05445e4f, the merge base) 4 (4c8e853c7 plugin-audit, 13e0305c3 console draft-preview form, 189358f21 scenarios, d576509c8 lint). None shares a file with this PR, and the merge with current main is clean.
CI on cbb82b02c every check success or skipped
Reviews L1-b ACCEPT 6954415659. No seat L2, since Clause-②: no.

State: ready for review and auto-merge enabled. #34818 stays open for slice 3 (Part of).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 17:00
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 2fcc9cf Nov 17, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-jcwgnf branch November 17, 2026 17:26
os-support-ai pushed a commit that referenced this pull request Nov 17, 2026
Brings in #34932 (flow designer edge conditions), which lands before this PR.

Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz
Co-authored-by: Claude <noreply@anthropic.com>
os-support-ai pushed a commit that referenced this pull request Nov 17, 2026
…oval outcome

After the merge of #34932 an approval's approve/reject out-edges render the
designer's localized outcome pill, so the label-translation pin asserts the
authored text on a decision branch edge instead.

Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz
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/xl tests 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.

2 participants