async-promise-nested-join-destructure.ts 968 B

12345678910111213141516
  1. // Nested joins: an outer `Promise.all` whose ELEMENTS are themselves `Promise.all`
  2. // calls, destructured into per-group tuples. Divergence repro: handleJoin used to mint a
  3. // fresh result value each pass, so the outer element's `mayAlias` set — which dedups by
  4. // slot IDENTITY — received a never-before-seen inner-join object every pass and the
  5. // fixpoint ran to ITERATION_CAP. Join results are now canonical per call site.
  6. // Expected:
  7. // ask#1/#2 -> join#2 ports 0/1, ask#3 -> join#3 port 0 (inner joins' in-taints)
  8. // join#2 -> join#1 port=0, join#3 -> join#1 port=1 (inner joins into the outer)
  9. // the destructured reads reach the sink through both relay labels and the asks (additive)
  10. const a = agent("a");
  11. const b = agent("b");
  12. const [gates, reviews] = await Promise.all([
  13. Promise.all([a.ask<string>("gate one"), a.ask<string>("gate two")]),
  14. Promise.all([b.ask<string>("review")]),
  15. ]);
  16. return `${gates[0]} ${gates[1]} ${reviews[0]}`;