Commit e505a94
test(node): Fix flaky Vercel AI integration test (#21076)
The `creates ai related spans with sendDefaultPii: false` test in the
Vercel AI integration suite was looking up `firstGenerateContentSpan`
via `find()` by name + `vercel.ai.operationId` +
`GEN_AI_INPUT_MESSAGES_ATTRIBUTE === undefined`.
With `sendDefaultPii: false`, both the first and the third
`generate_content mock-model-id` spans have undefined input messages
(the first because telemetry isn't explicitly enabled, the third —
the tool-call generation — for the same reason). Depending on the
order spans arrive in the container, `find()` could match the third
span (which has `inputTokens: 15`) and the subsequent
`expect(...INPUT_TOKENS).toBe(10)` would fail.
Tightens the find query to also require
`GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE === 10`,
mirroring the disambiguation already used for `firstInvokeAgentSpan`
in the same test.
The same pattern is also present in `v5/test.ts` and `v6/test.ts` —
fixed there as well.
Fixes #20997
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2069779 commit e505a94
3 files changed
Lines changed: 6 additions & 3 deletions
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
0 commit comments