feat: 工作流画布支持草稿试运行(target=draft 执行当前草稿图)

This commit is contained in:
董宏凯 committed 2026-08-30 20:02:15 +08:00
1 parent 3384f2e51c
commit 222595d6c4
7 files changed
+198 -32

No files matched your search

@@ -274,6 +274,15 @@ class WorkflowRunExecutor:
)
async def _load_graph(self, run: dict[str, Any]) -> WorkflowGraph | None:
# Draft test-runs carry their execution graph in run.context (version id
# is the literal "draft", no published row exists for it).
draft_graph = (run.get("context") or {}).get("draftGraph")
if draft_graph:
try:
return WorkflowGraph.model_validate(draft_graph)
except Exception: # noqa: BLE001
logger.warning("draft run %s has an invalid graph", run["id"], exc_info=True)
return None
version = await self._workflows.get_version(run["workflow_version_id"])
if version is None or version.get("workflow_id") != run["workflow_id"]:
return None