fix(anthropic): Close span on GeneratorExit
#5643
+96
−97
Merged
GitHub Actions / warden: code-review
completed
Mar 12, 2026 in 1m 13s
1 issue
code-review: Found 1 issue (1 medium)
Medium
Missing test coverage for GeneratorExit scenario - `sentry_sdk/integrations/anthropic.py:367-413`
The PR adds try/finally handling to close spans when GeneratorExit is raised (e.g., when consumers break early from a streaming iterator), but no test verifies this behavior. Without a test that simulates early iterator termination, there's no regression protection for this fix.
Duration: 1m 13s · Tokens: 468.1k in / 5.1k out · Cost: $0.60
Annotations
Check warning on line 413 in sentry_sdk/integrations/anthropic.py
github-actions / warden: code-review
Missing test coverage for GeneratorExit scenario
The PR adds try/finally handling to close spans when GeneratorExit is raised (e.g., when consumers break early from a streaming iterator), but no test verifies this behavior. Without a test that simulates early iterator termination, there's no regression protection for this fix.
Loading