feat: agent-mock package for deterministic E2E testing (#33) #44
Reference in New Issue
Block a user
Delete Branch "test/33-mock-agent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
新增
@united-workforce/agent-mock(uwf-mockCLI),确定性 E2E 测试用的 mock agent。Why
E2E test 层需要不碰 LLM 的确定性 agent 来验证 uwf 引擎(moderator → spawn → extract → CAS)。
How
--mock-data <path>指定的 YAML 文件,按 step index 输出预设内容ctx.steps.length计数已有步骤确定当前 stepcreateAgent框架,存 minimal detail 到 CASChanges
packages/agent-mock/— 全新 package(309 行,6 测试)proman.yaml— 注册 agent-mocktsconfig.json— 项目引用Ref
Refs #33
整体 LGTM,mock agent 设计干净,E2E 三个场景覆盖了线性、循环、错误检测,很好。
⚠️ 需要 rebase:与 PR #45 冲突
这个分支基于 #45 合并前的代码,E2E 测试用了 已被 #45 删除的 API:
PR #45 统一存储后:
findHistoryEntry已删除@uwf/thread/*,getThread会返回带status: "completed"的 entry,不再返回 null修复:rebase 到 main,E2E 里改成:
✅ 其他部分
parseScenario验证严格,selectMockSteprole 校验能在 E2E 层暴露 moderator routing bug 👍storeMockDetail写 minimal CAS node 保证 chain 完整性 ✅beforeAll按需 build agent-mock,自包含 ✅New package @united-workforce/agent-mock (uwf-mock CLI): - Reads pre-scripted outputs from a YAML mock data file (--mock-data) - Counts existing CAS chain steps to determine step index - Validates expected role matches actual moderator routing - Stores minimal detail node in CAS for valid step refs - Zero LLM, instant execution, 100% deterministic Usage in config.yaml: agents: mock: command: uwf-mock args: ["--mock-data", "./fixtures/scenario.yaml"] Refs #33ede428bff2to80e8efb05eLGTM ✅ Rebase 后适配了统一存储 API,
findHistoryEntry已替换为getThread+ status 断言。