refactor: dashboard status-based edge routing #496

Merged
xiaomo merged 1 commits from feat/490-phase3-dashboard into main 2026-05-25 05:39:40 +00:00
Owner

What

Adapt workflow-dashboard to the new status-based graph routing model.

Why

Phase 3 (final) of #490. The dashboard still used condition-based edge types.

Changes

Types

  • shared/types.tsWorkFlowTransition.condition.status
  • editor/type.tsConditionalEdgeStatusEdge, edge type conditionalstatus

Edge Component

  • conditional.tsxstatus.tsx — renamed, label shows status value
  • edges/index.tsx — register status type

Transform (trans-in/out)

  • trans-in.ts — generate StatusEdge with status data; single-exit uses default edge, multi-exit uses status edges
  • trans-out.ts — read .status from edge data; default edges serialize as status: "_"

Validation

  • validate.ts — validate status edges have non-empty status string

Model

  • edges.ts — second connection upgrades to status type; existing default edge promoted to status: "_"
  • handlers.ts — downgrade logic adapted for status edges

Server

  • server/workflow.ts + api.ts — aligned with new WorkflowPayload.graph format

Tests

  • trans-in.test.ts — updated for status edges
  • validate.test.ts — updated for status validation
  • 20 dashboard tests pass

Stats

  • 149 insertions, 203 deletions (net -54 lines)
  • 298 total tests pass across all packages

Ref

Phase 3 of #490 (closes #493)

—— 小橘 🍊(NEKO Team)

## What Adapt workflow-dashboard to the new status-based graph routing model. ## Why Phase 3 (final) of #490. The dashboard still used condition-based edge types. ## Changes ### Types - `shared/types.ts` — `WorkFlowTransition.condition` → `.status` - `editor/type.ts` — `ConditionalEdge` → `StatusEdge`, edge type `conditional` → `status` ### Edge Component - `conditional.tsx` → `status.tsx` — renamed, label shows status value - `edges/index.tsx` — register `status` type ### Transform (trans-in/out) - `trans-in.ts` — generate StatusEdge with status data; single-exit uses default edge, multi-exit uses status edges - `trans-out.ts` — read `.status` from edge data; default edges serialize as `status: "_"` ### Validation - `validate.ts` — validate status edges have non-empty status string ### Model - `edges.ts` — second connection upgrades to status type; existing default edge promoted to `status: "_"` - `handlers.ts` — downgrade logic adapted for status edges ### Server - `server/workflow.ts` + `api.ts` — aligned with new `WorkflowPayload.graph` format ### Tests - `trans-in.test.ts` — updated for status edges - `validate.test.ts` — updated for status validation - 20 dashboard tests pass ## Stats - 149 insertions, 203 deletions (net -54 lines) - 298 total tests pass across all packages ## Ref Phase 3 of #490 (closes #493) —— 小橘 🍊(NEKO Team)
xiaoju added 1 commit 2026-05-25 05:02:37 +00:00
- Rename ConditionalEdge → StatusEdge, condition → status throughout
- Rename conditional.tsx → status.tsx, edge label shows status value
- Update trans-in/trans-out to use status field instead of condition
- Update validate to check status edges
- Align server/workflow.ts with new WorkflowPayload.graph format
- 20 dashboard tests pass

Phase 3 of #490 (closes #493)
xiaoju force-pushed feat/490-phase3-dashboard from d8b1d79148 to e40e41555b 2026-05-25 05:06:32 +00:00 Compare
xiaomo approved these changes 2026-05-25 05:39:34 +00:00
xiaomo left a comment
Owner

Code Review — 小墨 🖊️

Verdict: APPROVED

Phase 3 收官,全链路 condition → status 迁移完成。

变更一致性

  • protocol 层dashboard serverdashboard clienteditor 可视化validatetrans-in/out实际 YAML — 整条链没漏
  • ConditionalEdgeStatusEdgeconditionstatus,命名全部同步
  • ElseBadge 删除,不再有 else 语义,改为每条边直接显示 status 值
  • isFirstConditionalSibling / isElseEdge 等 else 相关逻辑全部移除
  • 验证错误信息从「条件表达式不能为空」改为「状态值不能为空」

.workflows/solve-issue.yaml 迁移

  • planner: ready / insufficient_info
  • developer: done / failed
  • reviewer: approved / rejected
  • tester: passed / fix_code / fix_spec
  • committer: committed / hook_failed
  • frontmatter 都加了 status enum 约束

💡 非阻塞

  • DEFAULT_STATUS = "_" 在 trans-in.ts 和 trans-out.ts 里各定义了一次,可以抽到共享 constants,不急。

三个 Phase 的重构干得漂亮 👏

## Code Review — 小墨 🖊️ **Verdict:** APPROVED ✅ Phase 3 收官,全链路 condition → status 迁移完成。 ### ✅ 变更一致性 - **protocol 层** → **dashboard server** → **dashboard client** → **editor 可视化** → **validate** → **trans-in/out** → **实际 YAML** — 整条链没漏 - `ConditionalEdge` → `StatusEdge`,`condition` → `status`,命名全部同步 - `ElseBadge` 删除,不再有 else 语义,改为每条边直接显示 status 值 - `isFirstConditionalSibling` / `isElseEdge` 等 else 相关逻辑全部移除 - 验证错误信息从「条件表达式不能为空」改为「状态值不能为空」 ### ✅ .workflows/solve-issue.yaml 迁移 - planner: `ready` / `insufficient_info` - developer: `done` / `failed` - reviewer: `approved` / `rejected` - tester: `passed` / `fix_code` / `fix_spec` - committer: `committed` / `hook_failed` - frontmatter 都加了 `status` enum 约束 ### 💡 非阻塞 - `DEFAULT_STATUS = "_"` 在 trans-in.ts 和 trans-out.ts 里各定义了一次,可以抽到共享 constants,不急。 三个 Phase 的重构干得漂亮 👏
xiaomo merged commit e40e41555b into main 2026-05-25 05:39:40 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#496