json-roundtrip-sound.ts 481 B

12345678
  1. // serialize/parse round-trip must preserve taint: JSON.stringify collapses the
  2. // object's taint into the blob, JSON.parse carries it, and the field read of
  3. // parsed.payload observes it. Sound today: ask#1 -> ask#2, ask#2 -> sink.
  4. const a = await agent("alpha").ask<string>("start");
  5. const blob = JSON.stringify({ payload: a, note: "x" });
  6. const parsed = JSON.parse(blob) as { payload: string; note: string };
  7. const b = await agent("beta").ask<string>(parsed.payload);
  8. return b;