feat(workflow-editor): create workflow characters atomically - #198
Merged
xyh202131 merged 3 commits intoAug 11, 2026
Merged
Conversation
New WorkflowRuns can confirm a character template before any Character asset exists. Create the bound Character, seed its default outfit, and return it to the editor before advancing the template node. Keep subsequent action generation on the real Character and cover the flow with runtime and page regressions.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Review Summary
Found one correctness issue in the new Character creation path. git diff --check passed. Targeted tests could not be rerun because the mounted workspace has no runnable local Vitest installation (vitest: Permission denied / module unavailable).
Template confirmation has validation and idempotent paths that lacked behavior coverage. Exercise invalid selection inputs and the existing Character with Outfit path. Keep patch coverage focused on observable session behavior.
Concurrent editor sessions could persist multiple Characters for one WorkflowRun. Enforce database uniqueness and recover conflicts through a project-scoped get-or-create path. Keep duplicate creation idempotent without exposing Characters across projects.
Collaborator
Author
|
@fennoai 还有其他问题吗 |
Contributor
还有 3 个问题
验证
|
xyh202131
approved these changes
Aug 11, 2026
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.
在 Workflow Editor 确认身份母版时创建正式 Character,并在后端保证每个 WorkflowRun 只关联一个同项目 Character,使并发编辑会话也能安全继续真实动作生成流程。
Why
PR #190 接入真实 WorkflowRun 画布后,新建流程在确认身份母版时仍可能没有对应 Character。仅在前端 session 内判断无法处理两个编辑会话的并发创建:重复 Character 会让后续恢复失败,冲突回查若不校验项目归属还可能暴露其他项目的角色数据。
Changes
workflow_run_id增加数据库唯一约束,避免并发请求持久化多个 Character。POST /characters在唯一约束冲突后 rollback,并通过项目归属校验安全返回既有 Character。Implementation
WorkflowController.confirmCharacterTemplate,页面不直接调用资产 API。create_all/ model 约束模式,不引入迁移框架。Verification
npm test -- src/pages/workflow-editor/runtime.test.ts src/pages/workflow-editor/index.test.tsx:2 个测试文件、36 项测试通过。npm run test:coverage -- src/pages/workflow-editor/runtime.test.ts src/pages/workflow-editor/index.test.tsx:通过;runtime.ts行覆盖率 91.66%,分支覆盖率 88.88%。npm run typecheck:通过。npm run lint -- src/pages/workflow-editor/runtime.ts src/pages/workflow-editor/runtime.test.ts src/pages/workflow-editor/index.tsx src/pages/workflow-editor/index.test.tsx:通过。npm run format:check -- src/pages/workflow-editor/runtime.ts src/pages/workflow-editor/runtime.test.ts src/pages/workflow-editor/index.tsx src/pages/workflow-editor/index.test.tsx:通过。uv run pytest -q tests/test_character_api.py:10 项测试通过。uv run ruff check <相关 Character 文件>:通过。uv run lint-imports:2 项分层契约通过。git diff --check upstream/main...HEAD:通过。Scope