Skip to content

Merge branch 'master' into feat/async-transport

c88848e
Select commit
Loading
Failed to load commit list.
Merged

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

Merge branch 'master' into feat/async-transport
c88848e
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Mar 30, 2026 in 17m 8s

6 issues

Medium

httpcore[asyncio] dependency breaks Python 3.6/3.7 test environments - `scripts/populate_tox/tox.jinja:90`

The common: httpcore[asyncio] dependency is added without Python version restrictions, but httpcore 1.x requires Python 3.8+. The common test environment runs on py3.6 and py3.7 (line 21 of template). This will cause pip installation failures in those environments. The dependency should be conditioned on Python 3.8+ similar to how py3.8-common: hypothesis is version-restricted.

Also found at:

  • sentry_sdk/transport.py:553-559
Test will fail because isinstance check fails on Mock with spec - `tests/integrations/asyncio/test_asyncio.py:667-668`

The test creates mock_transport = Mock(spec=AsyncHttpTransport) and assigns it to mock_client.transport. However, in _flush() (asyncio.py:71), isinstance(client.transport, AsyncHttpTransport) will return False because a Mock object with a spec is not an actual instance of the class. This causes early return, so close_async is never called and the assertions at lines 680-681 will fail.

Also found at:

  • sentry_sdk/client.py:1057
Missing test cleanup leaves global scope client set after test - `tests/test_transport.py:998`

test_async_transport_concurrent_requests sets the global scope client on line 998 but does not register a cleanup finalizer like the other async tests do. This can cause test pollution - if this test fails or if tests run in a certain order, subsequent tests may use the stale client. Compare to test_transport_works_async (line 928) and test_async_transport_rate_limiting_with_concurrency (line 1024) which both properly clean up.

Also found at:

  • tests/test_transport.py:1031
Test test_loop_close_flushes_async_transport will always fail due to isinstance check with Mock - `tests/integrations/asyncio/test_asyncio.py:669-677`

The test creates mock_transport = Mock(spec=AsyncHttpTransport) and sets it as mock_client.transport. However, in the actual _flush() function (asyncio.py line 71), there's a check isinstance(client.transport, AsyncHttpTransport) which will always return False for a Mock object, even with spec=AsyncHttpTransport. The spec parameter only controls which attributes are available on the mock, not its type hierarchy. As a result, _flush() returns early without calling close_async(), causing the assertion mock_client.close_async.assert_called_once() to fail.

Low

Unused helper function _make_async_transport_options is dead code - `tests/test_transport.py:54-72`

The _make_async_transport_options helper function is defined but never called anywhere in the codebase. This appears to be dead code that was introduced but not used by any tests. While not a runtime error, it adds unnecessary maintenance burden and could confuse future developers.

Missing global scope cleanup in test_async_transport_concurrent_requests causes test pollution - `tests/test_transport.py:998`

The test test_async_transport_concurrent_requests sets sentry_sdk.get_global_scope().set_client(client) at line 998 but never cleans it up with a finalizer. Other similar tests in this file (e.g., test_transport_works_async at line 928, test_async_transport_rate_limiting_with_concurrency at line 1024) properly add request.addfinalizer(lambda: sentry_sdk.get_global_scope().set_client(None)). This inconsistency can cause test pollution where the client leaks into subsequent tests.

4 skills analyzed
Skill Findings Duration Cost
code-review 4 7m 42s $9.44
find-bugs 2 16m 58s $16.89
skill-scanner 0 15m 27s $4.28
security-review 0 9m 2s $6.53

Duration: 49m 8s · Tokens: 21.4M in / 175.3k out · Cost: $37.29 (+extraction: $0.02, +merge: $0.00, +fix_gate: $0.00, +dedup: $0.12)