test: E2E deterministic tests (无 LLM) #33

Closed
opened 2026-06-04 04:16:09 +00:00 by xiaoju · 0 comments
Owner

背景

开源前需要 E2E 验证 uwf 核心链路。test 层不碰 LLM,100% 确定性。

方案:uwf-mock agent + mock 数据文件

Mock Agent

新增 packages/agent-mock,复用 createAgent 框架。通过 --mock-data <file> 参数读取预设输出。

Mock 数据文件格式

steps:
  - role: planner
    output: |
      ---
      status: planned
      tasks:
        - implement login
      ---
      Plan content.
  - role: developer
    output: |
      ---
      status: done
      ---
      Implementation.

Mock agent 每次调用时:

  1. --mock-data 参数拿数据文件
  2. 读 thread chain 数步数 → 得到 step index
  3. 输出 steps[index].output
  4. 校验 steps[index].role === --role(发现 moderator bug)

传参方式

config.yaml agent args 传入(不用 env):

agents:
  mock:
    command: uwf-mock
    args: ["--mock-data", "./test/fixtures/scenario.yaml"]

测试方式

准备 workflow YAML + mock 数据文件 → uwf workflow adduwf thread start → N 次 uwf thread exec --agent uwf-mock → 验证 thread 状态

范围

  • moderator 路由正确性
  • agent spawn + frontmatter extract 管道
  • CAS 存储完整性
  • 多步 workflow 流转 + $END 终止
  • 错误场景

验收标准

  • vitest 全过,CI 硬门槛

小橘 🍊(NEKO Team)

## 背景 开源前需要 E2E 验证 uwf 核心链路。test 层不碰 LLM,100% 确定性。 ## 方案:uwf-mock agent + mock 数据文件 ### Mock Agent 新增 `packages/agent-mock`,复用 `createAgent` 框架。通过 `--mock-data <file>` 参数读取预设输出。 ### Mock 数据文件格式 ```yaml steps: - role: planner output: | --- status: planned tasks: - implement login --- Plan content. - role: developer output: | --- status: done --- Implementation. ``` Mock agent 每次调用时: 1. 读 `--mock-data` 参数拿数据文件 2. 读 thread chain 数步数 → 得到 step index 3. 输出 `steps[index].output` 4. 校验 `steps[index].role === --role`(发现 moderator bug) ### 传参方式 config.yaml agent args 传入(不用 env): ```yaml agents: mock: command: uwf-mock args: ["--mock-data", "./test/fixtures/scenario.yaml"] ``` ### 测试方式 准备 workflow YAML + mock 数据文件 → `uwf workflow add` → `uwf thread start` → N 次 `uwf thread exec --agent uwf-mock` → 验证 thread 状态 ## 范围 - moderator 路由正确性 - agent spawn + frontmatter extract 管道 - CAS 存储完整性 - 多步 workflow 流转 + $END 终止 - 错误场景 ## 验收标准 - vitest 全过,CI 硬门槛 --- 小橘 🍊(NEKO Team)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/united-workforce#33