Skip to content

.

e28a436
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

ref(strawberry): Simplify span creation #5647

.
e28a436
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden completed Mar 12, 2026 in 2m 19s

2 issues

Medium

Span context manager not properly cleaned up when exception occurs at yield - `sentry_sdk/integrations/strawberry.py:189-204`

The __enter__() call at line 189 sets scope.span = self.graphql_span and stores the previous span for restoration. However, if an exception is thrown at the yield point (line 196), the code after yield including __exit__() (line 204) will not execute. This leaves the scope in a corrupted state where scope.span still points to the graphql_span, and the span is never finished. The old code used finish() which also wouldn't run on exception, but it didn't call __enter__() to modify scope, so no scope corruption occurred.

Span.__exit__ always called with None arguments, preventing error status on exceptions - `sentry_sdk/integrations/strawberry.py:204`

The Span.__exit__ method checks if value is not None to set SPANSTATUS.INTERNAL_ERROR on the span when an exception occurs. By always calling self.graphql_span.__exit__(None, None, None), exceptions that occur during GraphQL operations won't mark the span as errored. This means error tracking for GraphQL operations loses exception context that the Span class is designed to capture.

4 skills analyzed
Skill Findings Duration Cost
code-review 1 2m $0.42
find-bugs 1 59.7s $0.32
skill-scanner 0 18.6s $0.07
security-review 0 21.8s $0.08

Duration: 3m 40s · Tokens: 589.6k in / 9.3k out · Cost: $0.90 (+fix_gate: $0.00, +dedup: $0.00)