feat(asgi): Make integration fully span first compatible #5920
3 issues
High
Inverted filter logic causes capture_items to skip all items when types=None - `tests/conftest.py:341-342`
The filter condition if types is None or item.type not in types: continue is inverted. When types=None, the condition is true (because types is None), so the loop continues and skips ALL items - the opposite of the intended behavior where types=None should capture all items. The correct logic should be if types is not None and item.type not in types: continue.
Medium
AnnotatedValue objects in header attributes may cause serialization errors - `sentry_sdk/integrations/_asgi_common.py:123-124`
The _filter_headers() function returns Mapping[str, Union[AnnotatedValue, str]], where sensitive headers are replaced with AnnotatedValue objects. On lines 123-124, these values are stored directly as span attributes. However, the Attributes type only accepts primitive types (str, bool, float, int, or lists/tuples thereof), not AnnotatedValue objects. This may cause type errors or unexpected behavior when these attributes are serialized and sent to Sentry.
capture_items filter logic inverts expected behavior when types is None - `tests/conftest.py:341-342`
The filter condition if types is None or item.type not in types: will skip ALL items when types=None, which inverts the typical filter semantics where None means "capture everything". Currently, calling capture_items() without arguments returns an empty list because every item is skipped. The correct logic should be if types is not None and item.type not in types: to only skip items when a filter is specified and the item doesn't match.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 2 | 5m 37s | $3.04 |
| find-bugs | 1 | 3m 19s | $3.89 |
| skill-scanner | 0 | 2m 35s | $0.78 |
| security-review | 0 | 2m 1s | $1.12 |
Duration: 13m 32s · Tokens: 5.2M in / 48.2k out · Cost: $8.85 (+extraction: $0.01, +merge: $0.00, +fix_gate: $0.01, +dedup: $0.01)