Uh oh!
There was an error while loading. Please reload this page.
tests(core): Move anthropic node integration tests to use a real client - #21906
Conversation
Replaces the hand-written MockAnthropic classes across the anthropic node-integration-test scenarios (streaming, tools, errors, and truncation) with the real @anthropic-ai/sdk driven by express mock servers, matching the rest of the suite. Removes the redundant manual-client scenario — the auto integration already wraps clients via the same instrumentAnthropicAiClient it would exercise. No SDK/instrumentation behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5b08c83 to
3b1d083CompareThere was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3b1d083. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -1,115 +0,0 @@ | |||
| import { instrumentAnthropicAiClient } from '@sentry/core'; | |||
There was a problem hiding this comment.
this one should be redundant, since the auto-instrumentation basically just calls the manual instrumentation helper internally so no need to have a separate scenario for that
JPeer264
left a comment
There was a problem hiding this comment.
LGTM. Getting rid of mocks is always great
Uh oh!
There was an error while loading. Please reload this page.
… client (#21909) similar to #21906 Using a real client should generally be more useful as this is what we instrument and also allows us to reuse the integration suites for our orchestrion ports since orchestrion injects the channels only in the real client. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

While working on the orchestrion port for the anthropic instrumentation I noticed that all of the anthropic tests use fake clients instead of the pattern openai uses with a real client and a mocked server. Since the client is what we instrument it should be much more useful to use the real one in our tests and also allows to reuse all the scenarios here for the orchestrion port, since orchestrion instruments the real library source so that doesn't work with a fake.
This PR ports all the tests to a real client. Porting this over also uncovered a minor bug where the stop reason is not being recorded correctly during streaming (will fix in a follow up).