hole-filled-two-phases.ts 1.0 KB

1234567891011121314151617181920212223
  1. // A filled hole whose body opens with a marker: the hole's own phase claims no step, yet it
  2. // keeps its place in the control-flow phase table through its mark node; the body's two
  3. // phases follow it carrying `fill=<hole id>`, every site the fill wrote is `<hole id>/…`, and
  4. // the outer ids are untouched. The body is an async arrow: a strand the outer `await` joins.
  5. interface Survey {
  6. slowest: string;
  7. }
  8. interface Smoke {
  9. failed: string[];
  10. }
  11. interface Plan {
  12. groups: string[][];
  13. }
  14. phase("摸底");
  15. const survey = await agent("勘察员").ask<Survey>("列出最慢的测试文件");
  16. const plan = await hole<Plan>("决定分组", `最慢的是 ${survey.slowest}`, async () => {
  17. phase("冒烟测试");
  18. const smoke = await agent("烟测员").ask<Smoke>(`只跑一遍 ${survey.slowest} 里的用例`);
  19. phase("分组");
  20. return await agent("分组员").ask<Plan>(`按模块分组,先排 ${smoke.failed.length} 个已失败用例`);
  21. });
  22. phase("执行");
  23. return agent("执行者").ask<string>(`按 ${plan.groups.length} 组执行`);