iteration-fanout-while-shift.ts 603 B

1234567891011121314
  1. // while-loop consuming a tracked array with .shift(): shift is an unknown call, so
  2. // its result is the receiver's collapse — the element taint must survive into the
  3. // ask after the loop. No fan-out (while is control structure, renders as a cycle).
  4. // Expected: source -> world-read#1; world-read#1 -> ask#1 (MUST); ask#1 -> sink;
  5. // NO fan-out node.
  6. const queue = await files.glob("*.md");
  7. const notes: string[] = [];
  8. while (queue.length > 0) {
  9. const item = queue.shift();
  10. if (item !== undefined) {
  11. notes.push(item);
  12. }
  13. }
  14. return agent("summarizer").ask<string>(notes.join(","));