[PR #926] [MERGED] v0.4 workflow migrations #1079

Closed
opened 2026-03-03 01:07:35 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/certimate-go/certimate/pull/926
Author: @fudiwei
Created: 8/14/2025
Status: Merged
Merged: 8/22/2025
Merged by: @fudiwei

Base: nextHead: dev


📝 Commits (10+)

  • f440103 fix(ui): lost animation effect when the drawer closes
  • c7b88cb feat(ui): add onDocumentChange handler in WorkflowDesigner
  • 139746b feat(ui): node outputs adapt to new workflow designer
  • 089aed2 feat(ui): drop legacy workflow designer, and adapt to the new one
  • 79667c0 feat(migration): workflow draft and content migrations
  • dd7aa78 refactor: rename some fields
  • 6c6b3dd feat(ui): search by id
  • 089d66d refactor: rename some fields
  • 50136dd fix(ui): node validation error
  • 1098dcc feat: workflow engine adapt to new designer

📊 Changes

271 files changed (+5469 additions, -18551 deletions)

View changed files

📝 internal/applicant/applicant.go (+9 -8)
📝 internal/certificate/service.go (+29 -31)
internal/certificate/service_deps.go (+19 -0)
📝 internal/deployer/deployer.go (+4 -4)
📝 internal/domain/certificate.go (+1 -2)
📝 internal/domain/dtos/workflow.go (+6 -0)
📝 internal/domain/workflow.go (+162 -132)
📝 internal/domain/workflow_output.go (+13 -6)
📝 internal/domain/workflow_run.go (+6 -6)
📝 internal/notify/notifier.go (+4 -4)
📝 internal/repository/access.go (+2 -2)
📝 internal/repository/acme_account.go (+2 -2)
📝 internal/repository/certificate.go (+4 -5)
📝 internal/repository/workflow.go (+13 -11)
📝 internal/repository/workflow_log.go (+2 -2)
📝 internal/repository/workflow_output.go (+8 -59)
📝 internal/repository/workflow_run.go (+43 -6)
📝 internal/rest/handlers/certificate.go (+12 -9)
📝 internal/rest/handlers/statistics.go (+4 -3)
📝 internal/rest/handlers/workflow.go (+8 -6)

...and 80 more files

📄 Description

该 PR 包含以下内容变更:

  • feat: 新的工作流引擎:
    • 新的节点执行器,适配新的工作流编辑器数据;
    • 新的任务调度器。尝试修复 #790
  • feat: 迁移脚本,转换低版本的工作流节点数据。
  • feat: 前端完全适配新的工作流编辑器。
  • fix: 修复抽屉表单关闭时动画丢失的问题。

备注

关于新的工作流节点执行器

👀 展开查看

v0.3.x 中提供了 NodeProcessor 这一抽象类型,但实现方式上有所欠缺,导致节点执行器本身还需要关注输入输出、日志记录等与执行自身无关的事情。

新版实现中重新梳理了业务,并由此抽象出了 WorkflowEngineNodeExecutorNodeExecutionContextNodeExecutionResult 等接口,并配合 AOP(面向切面编程)的设计模式,使得节点执行器更专注于执行自身,将与之无关的逻辑放至上层调度器中实现。

关于新的工作流任务调度器

👀 展开查看

v0.3.x 中的 WorkflowDispatcher + WorkflowInvoker 实现过于复杂,导致了以下两点问题:

  1. WorkflowInvoker 对节点执行逻辑侵入过深,出现了大量类似于 /internal/workflow/processor/processor.go#L39-L45/internal/workflow/processor/processor.go#L69-L77 这样的分支条件判断,可读性较差,也不利于后续新的节点类型,尤其是分支节点。
  2. WorkflowDispatcher 利用了较多的锁和管道结构,本意是想在内存中实现完整的工作流任务流转。但可读性较差,尤其是为了支持可取消的上下文而存在大量雷同但又不尽相同的 ctx.Err 判断代码。

新版实现试图解决上述问题,同时不再试图将任务流转完全放至内存中进行,而是利用数据库本身已有的数据结构来完成。同时,对进程意外中断而导致的执行挂起也有了自动恢复能力(目前暂时的实现方式是将其全部标记为已取消)。


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/certimate-go/certimate/pull/926 **Author:** [@fudiwei](https://github.com/fudiwei) **Created:** 8/14/2025 **Status:** ✅ Merged **Merged:** 8/22/2025 **Merged by:** [@fudiwei](https://github.com/fudiwei) **Base:** `next` ← **Head:** `dev` --- ### 📝 Commits (10+) - [`f440103`](https://github.com/certimate-go/certimate/commit/f440103fcea9e35281689270cd146fab32c32ea7) fix(ui): lost animation effect when the drawer closes - [`c7b88cb`](https://github.com/certimate-go/certimate/commit/c7b88cbcfb2a73cd3a4fb1bd9d3c7b3bfce0e5fa) feat(ui): add onDocumentChange handler in WorkflowDesigner - [`139746b`](https://github.com/certimate-go/certimate/commit/139746ba62aeb7242e66cee7a2029b87f45dee68) feat(ui): node outputs adapt to new workflow designer - [`089aed2`](https://github.com/certimate-go/certimate/commit/089aed2afbe1588f638432dae13764705ec68f2f) feat(ui): drop legacy workflow designer, and adapt to the new one - [`79667c0`](https://github.com/certimate-go/certimate/commit/79667c0d9fb7bc189b56a49cc90db60b0a241629) feat(migration): workflow draft and content migrations - [`dd7aa78`](https://github.com/certimate-go/certimate/commit/dd7aa788fec504200aa1adb6cf76cd5e71786458) refactor: rename some fields - [`6c6b3dd`](https://github.com/certimate-go/certimate/commit/6c6b3dd512644fa9e1e7bdc1f57a91fd12fb77b3) feat(ui): search by id - [`089d66d`](https://github.com/certimate-go/certimate/commit/089d66de04c1b6448d5dc98a898525447006d2ec) refactor: rename some fields - [`50136dd`](https://github.com/certimate-go/certimate/commit/50136dd339cc10f2d1c6534bb7dee565734b94d8) fix(ui): node validation error - [`1098dcc`](https://github.com/certimate-go/certimate/commit/1098dcce182d2283db42d2ec7761da71df2556c7) feat: workflow engine adapt to new designer ### 📊 Changes **271 files changed** (+5469 additions, -18551 deletions) <details> <summary>View changed files</summary> 📝 `internal/applicant/applicant.go` (+9 -8) 📝 `internal/certificate/service.go` (+29 -31) ➕ `internal/certificate/service_deps.go` (+19 -0) 📝 `internal/deployer/deployer.go` (+4 -4) 📝 `internal/domain/certificate.go` (+1 -2) 📝 `internal/domain/dtos/workflow.go` (+6 -0) 📝 `internal/domain/workflow.go` (+162 -132) 📝 `internal/domain/workflow_output.go` (+13 -6) 📝 `internal/domain/workflow_run.go` (+6 -6) 📝 `internal/notify/notifier.go` (+4 -4) 📝 `internal/repository/access.go` (+2 -2) 📝 `internal/repository/acme_account.go` (+2 -2) 📝 `internal/repository/certificate.go` (+4 -5) 📝 `internal/repository/workflow.go` (+13 -11) 📝 `internal/repository/workflow_log.go` (+2 -2) 📝 `internal/repository/workflow_output.go` (+8 -59) 📝 `internal/repository/workflow_run.go` (+43 -6) 📝 `internal/rest/handlers/certificate.go` (+12 -9) 📝 `internal/rest/handlers/statistics.go` (+4 -3) 📝 `internal/rest/handlers/workflow.go` (+8 -6) _...and 80 more files_ </details> ### 📄 Description 该 PR 包含以下内容变更: - [x] **feat**: 新的工作流引擎: - [x] 新的节点执行器,适配新的工作流编辑器数据; - [x] 新的任务调度器。尝试修复 #790 - [x] **feat**: 迁移脚本,转换低版本的工作流节点数据。 - [x] **feat**: 前端完全适配新的工作流编辑器。 - [x] **fix**: 修复抽屉表单关闭时动画丢失的问题。 --- ### 备注 #### 关于新的工作流节点执行器 <details> <summary>👀 展开查看</summary> v0.3.x 中提供了 `NodeProcessor` 这一抽象类型,但实现方式上有所欠缺,导致节点执行器本身还需要关注输入输出、日志记录等与执行自身无关的事情。 新版实现中重新梳理了业务,并由此抽象出了 `WorkflowEngine`、`NodeExecutor`、`NodeExecutionContext`、`NodeExecutionResult` 等接口,并配合 AOP(面向切面编程)的设计模式,使得节点执行器更专注于执行自身,将与之无关的逻辑放至上层调度器中实现。 </details> #### 关于新的工作流任务调度器 <details> <summary>👀 展开查看</summary> v0.3.x 中的 `WorkflowDispatcher` + `WorkflowInvoker` 实现过于复杂,导致了以下两点问题: 1. `WorkflowInvoker` 对节点执行逻辑侵入过深,出现了大量类似于 [/internal/workflow/processor/processor.go#L39-L45](https://github.com/certimate-go/certimate/blob/b9e28db08902306d2cb37e3c005014a108031abf/internal/workflow/processor/processor.go#L39-L45)、[/internal/workflow/processor/processor.go#L69-L77](https://github.com/certimate-go/certimate/blob/b9e28db08902306d2cb37e3c005014a108031abf/internal/workflow/processor/processor.go#L69-L77) 这样的分支条件判断,可读性较差,也不利于后续新的节点类型,尤其是分支节点。 2. `WorkflowDispatcher` 利用了较多的锁和管道结构,本意是想在内存中实现完整的工作流任务流转。但可读性较差,尤其是为了支持可取消的上下文而存在大量雷同但又不尽相同的 ctx.Err 判断代码。 新版实现试图解决上述问题,同时不再试图将任务流转完全放至内存中进行,而是利用数据库本身已有的数据结构来完成。同时,对进程意外中断而导致的执行挂起也有了自动恢复能力(目前暂时的实现方式是将其全部标记为已取消)。 </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 01:07:35 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/certimate#1079
No description provided.