Skip to content

feat(workflow-run): 实现执行记录 CRUD 服务与 API - #176

Merged
nighca merged 1 commit into
1024XEngineer:mainfrom
xiaocheny214:feat/workflow-run
Aug 10, 2026
Merged

nighca merged 1 commit into
1024XEngineer:mainfrom
xiaocheny214:feat/workflow-run

Conversation

@xiaocheny214

Copy link
Copy Markdown
Contributor

概述

实现工作流执行记录(WorkflowRun)的完整 CRUD,为工作流节点编排和前端画布提供持久化层。

包含内容

模型层(server/workflow_run/model.py)

  • dataclass → SQLAlchemy ORM(windup_workflow_run 表)
  • nodes 字段:JSONB(Postgres)/ JSON(SQLite),前端自定义结构,后端不校验
  • status 字段:active / soft_deleted
  • version 字段:每次更新自增,支持乐观并发

服务层(server/workflow_run/service.py)

  • SqlAlchemyWorkflowRunService:实现 WorkflowRunService 接口
  • create_run / get_run / list_runs(分页) / update_run / delete_run(软删除)

API 层(web/api/workflow_run.py)

  • POST /workflow-runs — 创建
  • GET /workflow-runs?project_id=... — 分页列表(排除软删除)
  • GET /workflow-runs/{id} — 详情
  • PATCH /workflow-runs/{id} — 全量更新 nodes / status
  • DELETE /workflow-runs/{id} — 软删除
  • 全部端点加 JWT 归属校验(通过 project_id 反查 user_id)

路由注册(bootstrap/app.py)

  • 注册 workflow_run_router
  • 导入 WorkflowRun model 触发 Base.metadata 注册,启动时自动建表

测试(17 用例全通过)

  • 创建(空 nodes / 带 nodes)
  • 列表(空 / 分页 / 软删除过滤)
  • 详情 / 404
  • 更新(nodes / status / 无效 status 400)
  • 删除 / 404
  • 跨用户权限校验(5 用例)

关联

@vercel

vercel Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
windup Ignored Ignored Preview Aug 10, 2026 6:08am

@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 actionable issues found in the fixed PR diff. compileall and git diff --check pass; the targeted pytest suite could not be run because pytest is not installed in the review environment.

huyanxius
huyanxius previously approved these changes Aug 10, 2026
@huyanxius

Copy link
Copy Markdown
Collaborator

等等,发现个问题

@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 时 PR head 从锁定的 9ad72d5 回退到 ea24946,因此新增的 .github/workflows/deploy.yml 已不在当前 PR diff 中,相关部署工作流发现不再适用于当前版本。对当前可见的 CRUD diff,除已有未解决的乐观并发版本校验评论外,没有新增的高置信度问题。git diff --check 通过;当前环境未安装 pytest,未能运行目标测试。

@huyanxius

Copy link
Copy Markdown
Collaborator

没问题,可以合并

@nighca
nighca merged commit 1813e8c into 1024XEngineer:main Aug 10, 2026
10 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