Bug Description
The traceSpanSchema Zod schema in packages/contracts/src/index.ts declares the kind field twice. Zod applies schemas sequentially, so the second definition overwrites the first. The first definition includes all 9 span kinds (workflow, agent, tool, llm, queue, memory, trigger, retry, replay), but the second definition omits 'memory' and 'trigger'. Any trace span with kind: 'memory' or kind: 'trigger' fails Zod validation and is silently dropped — no error is raised.
This was introduced by PR #34 which added a new comprehensive kind line but kept the old narrower one below it.
Prerequisites
Steps to Reproduce
- Open
packages/contracts/src/index.ts.
- Observe two
kind declarations in traceSpanSchema at lines 74 and 76-84.
- Run the following validation:
import { traceSpanSchema } from '@pulsestack/contracts';
const rest = {
spanId: 'span_1',
parentSpanId: null,
traceId: 'trace_1',
executionId: 'exec_1',
workflowId: 'wf_1',
name: 'test',
status: 'running',
startedAt: new Date().toISOString(),
endedAt: null,
attributes: {},
error: null,
};
traceSpanSchema.parse({ kind: 'memory', ...rest }); // FAILS
traceSpanSchema.parse({ kind: 'trigger', ...rest }); // FAILS
Expected Behavior
Both kind: 'memory' and kind: 'trigger' should parse successfully. The inferred TypeScript type TraceSpan should include all 9 span kinds.
Actual Behavior
Line 74 declares all 9 kinds, but lines 76-84 overwrite it with a narrower set missing 'memory' and 'trigger':
// Line 74 — comprehensive
kind: z.enum(['workflow', 'agent', 'tool', 'llm', 'queue', 'memory', 'trigger', 'retry', 'replay']),
// Lines 76-84 — overwrites line 74, missing 'memory' and 'trigger'
kind: z.enum([
'workflow',
'agent',
'tool',
'llm',
'queue',
'retry',
'replay',
]),
The inferred type also excludes them:
export type TraceSpan = z.infer<typeof traceSpanSchema>;
// 'memory' and 'trigger' are NOT in the type
Diagnostic Information
Environment Details
Additional Context
This causes silent data loss in the tracing subsystem — memory-agent spans and trigger spans are never recorded. The fix is to remove lines 76-84, keeping only the comprehensive definition at line 74.
Bug Description
The
traceSpanSchemaZod schema inpackages/contracts/src/index.tsdeclares thekindfield twice. Zod applies schemas sequentially, so the second definition overwrites the first. The first definition includes all 9 span kinds (workflow,agent,tool,llm,queue,memory,trigger,retry,replay), but the second definition omits'memory'and'trigger'. Any trace span withkind: 'memory'orkind: 'trigger'fails Zod validation and is silently dropped — no error is raised.This was introduced by PR #34 which added a new comprehensive
kindline but kept the old narrower one below it.Prerequisites
mainbranch of PulseStack.Steps to Reproduce
packages/contracts/src/index.ts.kinddeclarations intraceSpanSchemaat lines 74 and 76-84.Expected Behavior
Both
kind: 'memory'andkind: 'trigger'should parse successfully. The inferred TypeScript typeTraceSpanshould include all 9 span kinds.Actual Behavior
Line 74 declares all 9 kinds, but lines 76-84 overwrite it with a narrower set missing
'memory'and'trigger':The inferred type also excludes them:
Diagnostic Information
Environment Details
mainbranch, post-PR fix runtime tenant tracing events #34Additional Context
This causes silent data loss in the tracing subsystem — memory-agent spans and trigger spans are never recorded. The fix is to remove lines 76-84, keeping only the comprehensive definition at line 74.