Skip to content

refactor(workflow-run): persist explicit node graph - #86

Merged
nighca merged 1 commit into
1024XEngineer:mainfrom
xyh202131:feat/workflow-run-core-clean
Aug 7, 2026
Merged

refactor(workflow-run): persist explicit node graph#86
nighca merged 1 commit into
1024XEngineer:mainfrom
xyh202131:feat/workflow-run-core-clean

Conversation

@xyh202131

@xyh202131 xyh202131 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

目的

统一前后端工作流概念:前端原 Step 与后端 Node 表达的是同一种图节点。本 PR 删除双重建模,让 WorkflowRun.nodes 直接保存真实节点图,并把节点之间的边纳入持久化契约。

当前设计

  • WorkflowRun 是一次制作流程的持久化容器;Quick Start 与 Workflow Editor 只是两种独立界面,共用同一张节点图。
  • WorkflowNode 与编辑器卡片一一对应,目前包含 Character 与 Action 两类;生成、选择、审核等过程由节点内部 phase 表达。
  • 不再存在 WorkflowRun → root node → steps,也不再保留 Step、Revision 或 driver 概念。
  • 每个节点通过 dependsOnNodeIds 保存直接前置节点,因此边会随 nodes JSON 一起落库,不再依赖数组位置推断。
  • 多个 Action 节点可以共同依赖同一个 Character 节点;前置依赖通过后可以并行推进。
  • 每个节点保存 GenerationTask 引用;异步结果使用 nodeId + taskId 识别目标,避免重做前的晚到结果污染当前节点。

持久化契约

前端只对接后端已经声明的四个资源接口:

  • POST /workflow-runs
  • GET /workflow-runs/{id}
  • PATCH /workflow-runs/{id}
  • DELETE /workflow-runs/{id}

请求和响应中的 nodes 都是前端节点数组本身,不再额外包裹假根节点。响应水合时会校验节点字段、依赖 ID、重复 ID、悬空边、自依赖和环;已完成节点还必须保留已确认资产。

本 PR 包含

  • WorkflowRun、WorkflowNode、节点 phase、Generation 引用和显式依赖边类型。
  • WorkflowRun CRUD API 适配器、DTO 映射和节点图运行时校验。
  • Controller 的 nodeId / advanceNode / updateNode / restartFromNode 接口边界。
  • 直接节点映射、并行 Action、悬空边、环和完成态资产校验测试。
  • 清除误合入的后端快照、页面实现和 workflow-run/workflow-run 等重复目录。

明确不包含

  • 后端实现;后端 WorkflowRun CRUD service 仍待后端完成。
  • WorkflowController 的具体推进实现。
  • Quick Start、Workflow Editor 或 Playtest 页面实现。
  • Generation 创建、查询或 SSE 适配器。
  • WorkflowRun 列表、按 Character 查询、订阅、本地存储或 Revision 历史。

验证

  • Frontend:19 个测试文件、89 项测试通过。
  • Frontend:lint、typecheck、build 通过。
  • Backend(未产生代码差异):Ruff、import-linter、Pytest 通过。
  • 本次修改文件格式检查与 git diff --check 通过。

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 7, 2026 7:10am

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found in this review.

Verified:

  • npm test -- --run src/entities/workflow-run/store.test.ts
  • npm run typecheck

Note: dependency installation completed with a Node engine warning because this sandbox uses Node 20 while react-router@8.3.0 declares Node >=22.22.0.

Comment thread frontend/src/entities/workflow-run/model/constants.ts Outdated
Comment thread frontend/src/entities/workflow-run/model/constants.ts Outdated
Comment thread frontend/src/entities/workflow-run/model/constants.ts Outdated
Comment thread frontend/src/entities/workflow-run/model/constants.ts Outdated
Comment thread frontend/src/entities/workflow-run/store/workflow-run-store.ts Outdated
Comment thread frontend/src/entities/workflow-run/store/workflow-run-store.ts Outdated
Comment thread frontend/src/entities/workflow-run/service/workflow-run-service.ts Outdated
@huyanxius

Copy link
Copy Markdown
Collaborator

@fennoai /review

@fennoai

fennoai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Complete

Submitted a non-blocking PR review with one low-severity documentation finding: frontend/src/pages/home/index.tsx:32 still references the removed eight-step WORKFLOW_STEP_ORDER vocabulary after this PR moved WorkflowRun to card-aligned character / action steps with phases.

Verified locally:

  • npm run test passed: 5 files, 17 tests
  • npm run typecheck passed
  • npm run lint passed
  • npm run build passed
  • git diff --check 023bf0f86e8089681ae9a09427a12306b3c0b3dc...014e83a958d3b965b4ec5738e95ae805f9d188de passed

Note: npm ci emitted an engine warning because this sandbox uses Node v20.20.2 while react-router@8.3.0 declares Node >=22.22.0.

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review findings:

  • Low: frontend/src/pages/home/index.tsx:32 still documents the old eight-step WORKFLOW_STEP_ORDER model (character-setup, template-candidate, complete-animation, etc.), but this PR replaces that public vocabulary with card-aligned WORKFLOW_STEP_ORDERS containing character / action steps and phase-based internals. Anyone updating the home workflow copy from this comment will now be pointed at deleted names and the wrong model shape. Please update or remove this comment alongside the WorkflowRun model change.

Verification run locally: npm run test, npm run typecheck, npm run lint, npm run build, and git diff --check 023bf0f86e8089681ae9a09427a12306b3c0b3dc...014e83a958d3b965b4ec5738e95ae805f9d188de. Note: npm ci emitted an engine warning because this sandbox uses Node v20.20.2 while react-router@8.3.0 declares Node >=22.22.0.

@huyanxius

Copy link
Copy Markdown
Collaborator

@fennoai /compact 根据当前PR 现状和评论列出未定事项,不要删除任何评论

@fennoai

fennoai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

未定事项

  • WorkflowRun 到底保持“一个根节点 = 一个 run”,还是按评论里提到的思路拆成多个 run 由 Workflow Editor 关联
  • 如果继续用单个 WorkflowRun,URL 参数如何表达“从哪个卡片重做”以及“给已有 character 追加 action”
  • restartFromStep 的历史保留语义是否最终保留;评论里明确提过后端是树状纯存储,不提供回退 / revision 历史,这一点和当前实现还要再对齐
  • home/index.tsx 里的旧 WORKFLOW_STEP_ORDER 说明是否要同步删改,避免继续引用已删除的流程词汇

当前 PR 仍是 open,GitHub 侧未给出 review decision。

View job run

@fennoai

fennoai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

未定事项

  • restartFromStep 的历史保留语义是否最终保留;当前实现保留了 Revision 链,但评论里提过后端是树状纯存储、不提供回退 / revision 历史,这两种模型还没完全对齐
  • frontend/src/pages/home/index.tsx 里的旧 WORKFLOW_STEP_ORDER 说明是否要同步删改,避免继续引用已经被这次 PR 替换掉的流程词汇

PR 目前仍是 open,GitHub 侧没有新的 review decision。

View job run

@xyh202131 xyh202131 reopened this Aug 7, 2026

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two persistence/hydration issues in the workflow-run changes.

Additional non-inline finding:

  • frontend/src/pages/home/index.tsx:32: The workflow guidance comment still says WORKFLOW_STEP_ORDER has eight steps and maps action-setup, first-frame, complete-animation, and export, but this PR changes the source of truth to five steps with action-generation. Please update this comment with the model change so future workflow edits do not follow stale guidance.

Verified: npm run typecheck; npm test -- src/entities/workflow-run/store.test.ts.

value: unknown,
): CompleteAnimationGenerationResult | null {
if (!isRecord(value) || value.type !== 'complete_animation') return null
if (!['walk', 'idle', 'attack', 'jump', 'custom'].includes(String(value.actionType))) return null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActionType is currently just string, and the existing UI handles unknown action names by falling back to the raw type. This validator now rejects any completed animation whose actionType is not one of these five literals, so a workflow for a custom/template-defined action can be saved but then dropped on reload because isWorkflowStep calls this parser during hydration. Please validate a non-empty string here, or share a real action-type enum across the app instead of hard-coding this subset.

migrateReferences(characterTemplate),
migrateReferences(templateCandidate),
{
...migrateReferences(collapsedAction),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This collapses whichever legacy action step is active or failed, but only changes its type. A real v1 first-frame step will still carry a first_frame input/output shape, and action-setup may not have the firstFrameUrl required by the new action-generation validator. After migrateVersionThreeRun calls isWorkflowRun, those migrated runs fail validation and disappear from localStorage. Please normalize the collapsed step's input/output for each legacy step before the final validation.

xyh202131 added a commit to xyh202131/Windup that referenced this pull request Aug 7, 2026
- Remove localStorage persistence, replace with async API adapter (store.ts)
- Remove Revision concept (no rollback/history per backend tree model)
- Remove WorkflowDriver — set once, never read
- Align GenerationType with backend: character_image / character_action
- Flatten WorkflowRun: steps/generationStatus/exportStatus directly on run
- Fix step model docs: first 3 steps serial, action-generation pairs concurrent
- Sync backend infrastructure (ai_engine impl, new providers, config files)
- Sync frontend infrastructure (shared/api, auth-session, export-package, etc.)
- Update tests: async store contract, aligned generation types

Addresses nighca review comments 1024XEngineer#1-1024XEngineer#6 on PR 1024XEngineer#86
@xyh202131
xyh202131 force-pushed the feat/workflow-run-core-clean branch from 15c963d to 07d0cd7 Compare August 7, 2026 03:12
@xyh202131
xyh202131 force-pushed the feat/workflow-run-core-clean branch from 050fbf8 to 2020aa8 Compare August 7, 2026 03:40
@xyh202131

Copy link
Copy Markdown
Contributor Author

@fennoai 评价一下

@fennoai

fennoai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

An internal error occurred. Please try again later.

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review findings:

) {
return false
}
return (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: this accepts selectedImageUrl: null even when the card has already reached completed, so a hydrated WorkflowRun can look valid while still losing the confirmed candidate reference. The same issue applies to the action validator below. Please require the selected asset once the step is complete.

Comment thread frontend/src/entities/workflow-run/index.ts Outdated
@xyh202131
xyh202131 force-pushed the feat/workflow-run-core-clean branch from eaec15b to 8cf6b31 Compare August 7, 2026 07:10
@xyh202131 xyh202131 changed the title feat(workflow-run): implement resumable generation orchestration refactor(workflow-run): persist explicit node graph Aug 7, 2026

@nighca nighca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有细节待确认,不过不影响合入

}

/** 工作流图中的真实节点。前端和后端统一使用 node,不再保留 step 或假 root。 */
export type WorkflowNode = CharacterWorkflowNode | ActionWorkflowNode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有个细节问题,两种 node 就够了吗?确实不是每一次“用户动作”都需要表现为一个不一样的 node,可以多个动作合并在同一个 node 内(对应 node 的不同状态/phase),不过我记得按之前的 live demo,好像并不会合并得这么夸张?

@nighca
nighca merged commit 1233a72 into 1024XEngineer:main Aug 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants