iteration-fanout-join-in-object-literal.ts 902 B

12345678910111213
  1. // The structural blast radius of emission-graph-join-in-object-literal, one level up: a
  2. // `.map` whose callback's only facade sites sit inside a join nested in an object literal.
  3. // When `fieldValue` short-circuits `evalExpr` for the join call, the WHOLE subtree goes
  4. // unevaluated — the join and the ask inside its array literal alike — so markFacade never
  5. // fires and the iteration candidate never promotes. What vanishes is the fan-out NODE
  6. // itself, not merely an edge.
  7. // Expected: fan-out#1 promoted, with `within=fan-out#1` on both the join and the ask;
  8. // ask#1 -> join#1 port=0; fan-out#1, join#1 and ask#1 all reach the reader; reader -> sink.
  9. const items = ["a", "b", "c"];
  10. const a = agent("a");
  11. const outer = items.map((item) => ({ pending: Promise.all([a.ask<string>(`work ${item}`)]) }));
  12. const first = await outer[0]!.pending;
  13. return agent("reader").ask<string>(`${first[0]}`);