Skip to content

fix(orchestrator): 运行历史抽屉按画布工作流隔离(#79) - #81

Merged
chumingjun merged 1 commit into
mainfrom
fix/run-history-workflow-isolation
Aug 28, 2026
Merged

fix(orchestrator): 运行历史抽屉按画布工作流隔离(#79)#81
chumingjun merged 1 commit into
mainfrom
fix/run-history-workflow-isolation

Conversation

@chumingjun

Copy link
Copy Markdown
Owner

背景

fix #79。画布运行面板「历史」抽屉拉取 GET /wf1/api/runs 不带过滤参数,展示工作区内全部工作流的运行记录,点选还会把别的工作流的节点状态投影回当前画布(onSelect 恢复路径与画布图不匹配)。

方案

后端过滤为主、口径与 workflow_runs 助手工具族对齐:

  • sqlite-storelistRuns(limit, workflowId?) 新增可选过滤,WHERE workflow_id = ? 命中既有 runs_workflow_started_at 索引;缺省(含 null/空串/草稿)语句与行为完全不变
  • orchestratorrecentRuns 透传 workflowId;GET /wf1/api/runs 接受可选 workflowId query 参数,缺省维持工作区级全量(RunSwitcher 等既有调用不受影响)
  • 前端RunHistoryworkflowId prop(拉取时带 query,useEffect 依赖变更即重拉);App.jsx 挂载点传 currentWf?.id || null——草稿画布无 workflowId,自然走全量,符合 issue 期望行为

验证

  • 单测:sqlite-store.test.mjs 新增过滤用例(命中/limit/无匹配/缺省全量四态);schedule-api.integration.test.mjs 新增 API 用例(两工作流 + 草稿混合记录:过滤只含本工作流、无匹配空列表、缺省全量)
  • 全量:orchestrator 17 套全绿、web 14 套全绿、build-web.sh 双构建通过
  • 真机(scratch profile + Playwright 真实浏览器,worflow 工作区 15 条混合运行记录):
    • API:?workflowId=wf_mt14cem3 → 5 条;?workflowId=wf_sqlite... → 1 条;无参 → 15 条
    • UI「新工作流」画布:历史抽屉只显示其 5 条运行(修复前混入 15 条)
    • UI「工程手册」画布:历史抽屉只显示该工作流运行,无「新工作流」/「SQLite」混入
    • 草稿画布:null workflowId → 与修复前相同的代码路径(无 query 参数),行为不变

问题:画布运行面板「历史」抽屉拉取 GET /wf1/api/runs 时不带过滤参数,
展示的是工作区内全部工作流的运行记录,还会把别的工作流的节点状态
投影回当前画布。

修复:
- sqlite-store listRuns 增加可选 workflowId 参数(命中既有
  runs_workflow_started_at 索引),缺省维持全量行为
- /wf1/api/runs 接受可选 workflowId query 参数并透传 store;
  草稿画布与 RunSwitcher 等既有全量消费方不受影响
- RunHistory 接收当前画布 workflowId prop(App.jsx 传
  currentWf?.id),fetch 时带上;草稿(无 id)不传参维持全量

测试:sqlite-store 过滤用例(含 limit/无匹配/缺省回归)+
schedule-api 集成用例(两工作流 + 草稿混合记录的过滤断言)。
全量单测 + build-web.sh 双构建通过。
@chumingjun
chumingjun merged commit b5c5b11 into main Aug 28, 2026
1 check passed
@chumingjun
chumingjun deleted the fix/run-history-workflow-isolation branch August 28, 2026 04:02
chumingjun added a commit that referenced this pull request Aug 28, 2026
v0.5.1 以来 main 已合四个用户可见改动:
- 定时任务 per-schedule 时区支持(#58/#78)
- 运行中节点详情弹窗实时显示执行轨迹(#52/#80)
- 运行历史抽屉按画布工作流隔离(#79/#81)
- token 用量可视化:节点/运行级汇总 + cache 口径防误读(#64/#82)

两 feat 一 feat 一 fix → minor 0.6.0。8 个插件 package.json 与
dsh-ccpg-one 内部依赖表同步 bump;升级器测试的 npm latest mock
0.5.1 → 0.6.0(保持 latest 领先已装的语义)。

验证:全量单测绿;build-web.sh 双构建通过;assemble-one +
publish-npm --dry-run 通过(dsh-harness-one@0.6.0,117 files)。
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.

bug: 运行历史抽屉未按当前画布工作流隔离,列出全部工作流的运行记录

1 participant