Skip to content

fix: Suppress mypy await type error in AsyncHttpTransport._request

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

feat: Add experimental async transport (port of PR #4572) #5646

fix: Suppress mypy await type error in AsyncHttpTransport._request
82c0094
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden: find-bugs completed Mar 12, 2026 in 10m 31s

3 issues

find-bugs: Found 3 issues (1 medium, 2 low)

Medium

Context manager __exit__ silently fails to close AsyncHttpTransport - `sentry_sdk/client.py:1041-1048`

The _Client's exit method (line 1137) calls close(), but close() (lines 1041-1052) silently returns early when transport is AsyncHttpTransport without flushing or closing anything. Users using with Client(...) context manager with async transport enabled will have data silently lost. The class also lacks aexit to support async with patterns, though this is outside the hunk.

Also found at:

  • sentry_sdk/integrations/asyncio.py:80-88
  • sentry_sdk/integrations/asyncio.py:71-74

Low

Missing space in assertion error message makes output harder to read - `tests/test_client.py:1905-1906`

The f-string concatenation on lines 1905-1906 lacks a space between the two strings, resulting in a message like 'SOCKS == Truebut got' instead of 'SOCKS == True but got'. This affects the readability of test failure messages but has no functional impact.

Missing test cleanup for global scope client in test_async_transport_concurrent_requests - `tests/test_transport.py:1074`

The test sets sentry_sdk.get_global_scope().set_client(client) at line 1074 but does not add a finalizer to clean it up. This can cause test pollution - if subsequent tests rely on the global scope being clean, they may fail or behave unexpectedly. Other tests in the same file (e.g., test_async_transport_rate_limiting_with_concurrency at line 1098) correctly use request.addfinalizer(lambda: sentry_sdk.get_global_scope().set_client(None)).


Duration: 10m 26s · Tokens: 10.9M in / 70.5k out · Cost: $15.39 (+extraction: $0.01, +merge: $0.00, +fix_gate: $0.00)

Annotations

Check warning on line 1048 in sentry_sdk/client.py

See this annotation in the file changed.

@github-actions github-actions / warden: find-bugs

Context manager __exit__ silently fails to close AsyncHttpTransport

The _Client's __exit__ method (line 1137) calls close(), but close() (lines 1041-1052) silently returns early when transport is AsyncHttpTransport without flushing or closing anything. Users using `with Client(...)` context manager with async transport enabled will have data silently lost. The class also lacks __aexit__ to support `async with` patterns, though this is outside the hunk.

Check warning on line 88 in sentry_sdk/integrations/asyncio.py

See this annotation in the file changed.

@github-actions github-actions / warden: find-bugs

[D5B-DUV] Context manager __exit__ silently fails to close AsyncHttpTransport (additional location)

The _Client's __exit__ method (line 1137) calls close(), but close() (lines 1041-1052) silently returns early when transport is AsyncHttpTransport without flushing or closing anything. Users using `with Client(...)` context manager with async transport enabled will have data silently lost. The class also lacks __aexit__ to support `async with` patterns, though this is outside the hunk.

Check warning on line 74 in sentry_sdk/integrations/asyncio.py

See this annotation in the file changed.

@github-actions github-actions / warden: find-bugs

[D5B-DUV] Context manager __exit__ silently fails to close AsyncHttpTransport (additional location)

The _Client's __exit__ method (line 1137) calls close(), but close() (lines 1041-1052) silently returns early when transport is AsyncHttpTransport without flushing or closing anything. Users using `with Client(...)` context manager with async transport enabled will have data silently lost. The class also lacks __aexit__ to support `async with` patterns, though this is outside the hunk.