MCPcopy Create free account
hub / github.com/ShipSecAI/studio / runWithTrace

Function runWithTrace

worker/src/temporal/__tests__/workflow-runner.test.ts:362–404  ·  view source on GitHub ↗
(runId: string)

Source from the content-addressed store, hash-verified

360 });
361
362 const runWithTrace = async (runId: string) => {
363 const events: TraceEvent[] = [];
364 const trace = {
365 record: (event: TraceEvent) => {
366 events.push(event);
367 },
368 };
369
370 const nodeIOStarts: NodeIOStartEvent[] = [];
371 const nodeIOCompletions: NodeIOCompletionEvent[] = [];
372 const nodeIO = {
373 recordStart: async (data: NodeIOStartEvent) => {
374 nodeIOStarts.push(data);
375 },
376 recordCompletion: async (data: NodeIOCompletionEvent) => {
377 nodeIOCompletions.push(data);
378 },
379 };
380
381 const result = await executeWorkflow(
382 definition,
383 {},
384 {
385 runId,
386 trace,
387 nodeIO,
388 },
389 );
390
391 expect(result.success).toBe(true);
392
393 // Validate node I/O was recorded for all nodes
394 expect(nodeIOStarts).toHaveLength(4);
395 expect(nodeIOCompletions).toHaveLength(4);
396 expect(nodeIOCompletions.every((c) => c.status === 'completed')).toBe(true);
397
398 // Validate merge node received correct input via node I/O
399 const mergeCompletion = nodeIOCompletions.find((c) => c.nodeRef === 'merge');
400 expect(mergeCompletion).toBeDefined();
401 expect(mergeCompletion?.status).toBe('completed');
402
403 return events.map(normalizeEvent);
404 };
405
406 const firstSequence = await runWithTrace('determinism-run-1');
407 const secondSequence = await runWithTrace('determinism-run-2');

Callers 1

Calls 2

executeWorkflowFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected