Skip to content

.

f873d09
Select commit
Loading
Failed to load commit list.
Merged

feat(sqlalchemy): Support span streaming #6132

.
f873d09
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Apr 24, 2026 in 11m 46s

7 issues

Medium

Test assumes non-deterministic span ordering without verification - `tests/integrations/sqlalchemy/test_sqlalchemy.py:1212-1213`

The test asserts spans[0] is the auto.db.sqlalchemy span and spans[1] is the manual span without first verifying these positions by checking span names. Other similar tests in the codebase (test_redis.py, test_redis_asyncio.py, test_celery.py) properly unpack and verify spans by name before asserting on attributes (e.g., assert parent_span["name"] == "custom parent"). This could lead to flaky test failures if span streaming order isn't guaranteed.

render_span_tree may crash if no root span found in streamed spans - `tests/conftest.py:508`

When root_span=None and no span in spans lacks a parent_span_id, the root_span variable will remain None. The subsequent call to render_span(root_span) at line 508 will fail with a TypeError when attempting to access span["attributes"] or span["span_id"] on None. While valid span data should always include a root span, edge cases or corrupted data could trigger this crash.

Low

Debug print statement left in test fixture - `tests/conftest.py:486`

A print(span) statement on line 486 appears to be debugging code left over from development. This will output span data to stdout during every test run that uses this fixture, adding noise to test output and potentially slowing tests.

Missing SERVER_ADDRESS assertion in span streaming test path - `tests/integrations/sqlalchemy/test_sqlalchemy.py:162`

In test_transactions, the span streaming branch (lines 158-162) asserts only SPANDATA.SERVER_PORT not in span["attributes"], while the non-streaming branch (lines 199-204) asserts both SERVER_ADDRESS and SERVER_PORT are not in the span data. This asymmetry means the span streaming path has reduced test coverage and may miss regressions if SERVER_ADDRESS is incorrectly included in span attributes.

Also found at:

  • tests/integrations/sqlalchemy/test_sqlalchemy.py:588-590
Unreachable code branch in fake_record_sql_queries within else clause - `tests/integrations/sqlalchemy/test_sqlalchemy.py:989-994`

In the else branch (lines 962-1022), the fake_record_sql_queries class contains an if span_streaming: check at line 989. Since we're inside else (only reached when span_streaming=False), the True branch at lines 990-991 is dead code that will never execute. This is excessive branching in test code that reduces maintainability.

Debug print statement left in test fixture - `tests/conftest.py:486`

Line 486 contains print(span) which appears to be a leftover debug statement. This will output debugging information to stdout during test execution, potentially cluttering test output and making it harder to read test results.

Missing SERVER_ADDRESS assertion in span_streaming test branch - `tests/integrations/sqlalchemy/test_sqlalchemy.py:162`

In test_transactions, the span_streaming branch (line 162) only asserts SPANDATA.SERVER_PORT not in span["attributes"] but is missing the assertion for SPANDATA.SERVER_ADDRESS not in span["attributes"]. The non-span_streaming branch (lines 203-204) correctly asserts both are absent. This is an asymmetry in test coverage between the two modes that could mask a regression where SERVER_ADDRESS is incorrectly set for SQLite in-memory databases.

Also found at:

  • tests/integrations/sqlalchemy/test_sqlalchemy.py:293
4 skills analyzed
Skill Findings Duration Cost
code-review 4 7m 45s $5.05
find-bugs 3 11m 25s $8.50
skill-scanner 0 4m 15s $1.48
security-review 0 9m 35s $1.38

Duration: 32m 59s · Tokens: 10.5M in / 117.8k out · Cost: $16.44 (+extraction: $0.01, +merge: $0.00, +fix_gate: $0.02, +dedup: $0.01)