emission-graph-join-in-object-literal.ts 1.0 KB

123456789101112131415161718
  1. // Two joins grouped in ONE object literal, their results read downstream. Regression guard
  2. // for resolvePlace's gating contract: literals.ts `fieldValue` is
  3. // `resolvePlace(expr) ?? evalExpr(expr, ctx)`, so a join that resolves as a place BEFORE it
  4. // has ever been evaluated short-circuits `evalExpr` — handleJoin never runs, and the join
  5. // site, its in/out edges and its markFacade all disappear. resolvePlace therefore gates the
  6. // join case on the `joinResults` registry (which handleJoin populates), never on the site
  7. // table.
  8. // Expected: both joins present; ask#1/#2 -> join#1 ports 0/1, ask#3 -> join#2 port 0;
  9. // both joins AND all three producers reach the reviewer (additive relay); reviewer -> sink.
  10. const a = agent("analyst");
  11. const b = agent("builder");
  12. const groups = {
  13. docs: Promise.all([a.ask<string>("read docs"), a.ask<string>("read specs")]),
  14. code: Promise.all([b.ask<string>("read code")]),
  15. };
  16. const docs = await groups.docs;
  17. const code = await groups.code;
  18. return agent("reviewer").ask<string>(`${docs.join()} ${code.join()}`);