Skip to content

Commit c4ffba2

Browse files
committed
test(anthropic): Assert stream dedup emits no duplicate span
The nested-create test only checked that spans existed. Add a negative assertion that the stream helper's internal `create` delegation produces exactly one span for the streamed response, so a regressed suppress path that double-emits would fail.
1 parent 332d9d5 commit c4ffba2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • dev-packages/node-integration-tests/suites/tracing/anthropic

dev-packages/node-integration-tests/suites/tracing/anthropic/test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,12 @@ describe('Anthropic integration', () => {
425425
expect(nestedSpan).toBeDefined();
426426
expect(nestedSpan.attributes['sentry.op'].value).toBe('gen_ai.chat');
427427

428-
const streamingSpan = container.items.find(
428+
// The helper's own internal `create` delegation must be deduped: exactly one span
429+
// for the streamed response, not a duplicate child span.
430+
const streamingSpans = container.items.filter(
429431
span => span.attributes[GEN_AI_RESPONSE_ID_ATTRIBUTE]?.value === 'msg_stream_1',
430432
);
431-
expect(streamingSpan).toBeDefined();
433+
expect(streamingSpans).toHaveLength(1);
432434
},
433435
})
434436
.start()

0 commit comments

Comments
 (0)