strand-fire-and-forget.ts 870 B

12345678910111213141516171819
  1. // A fan-out nobody ever awaits: the script starts A's subagents, walks on to B, and returns
  2. // without joining them. Nothing in the script orders A's work against B's, so nothing may be
  3. // claimed — the only fact left is that the run outlived the strand.
  4. //
  5. // Expected:
  6. // causality — NO edge between ask#1 (the fan-out's) and ask#2 (B's).
  7. // cfg — `ask#1@1 -> sink join` (no `via`: the callback falls out of its body rather than
  8. // returning a value). Strands still parked when the root body ends are drained into the
  9. // sink, which is where "the script outlived it" is written down. And
  10. // `phase phase#2 "B" alongside=phase#1`, since A's strand was live at B's marker.
  11. const ids = [1, 2, 3];
  12. phase("A");
  13. ids.map(async (i) => {
  14. await agent(`a-${i}`).ask<string>(`background ${i}`);
  15. });
  16. phase("B");
  17. return await agent("b").ask<string>("b");