Skip to content

Change to `all` for stricter check

2156b77
Select commit
Loading
Failed to load commit list.
Merged

feat(tracemetrics): Bypass metric field validation for equations #112479

Change to `all` for stricter check
2156b77
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: sentry-backend-bugs completed Apr 8, 2026 in 1m 2s

1 issue

sentry-backend-bugs: Found 1 issue (1 medium)

Medium

all() on empty sequence bypasses metric field validation - `src/sentry/explore/endpoints/serializers.py:228-232`

Python's all() returns True for empty iterables. When aggregateField is missing, empty, or contains items with empty/missing yAxes, the generator produces zero elements and has_equations evaluates to True. This allows queries without equations (and without aggregate fields) to bypass the metric field validation on the metrics dataset, contrary to the intended behavior of only bypassing validation when all y-axes are equations.


Duration: 59.8s · Tokens: 121.0k in / 2.6k out · Cost: $0.25 (+extraction: $0.00, +fix_gate: $0.00)

Annotations

Check warning on line 232 in src/sentry/explore/endpoints/serializers.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: sentry-backend-bugs

all() on empty sequence bypasses metric field validation

Python's `all()` returns `True` for empty iterables. When `aggregateField` is missing, empty, or contains items with empty/missing `yAxes`, the generator produces zero elements and `has_equations` evaluates to `True`. This allows queries without equations (and without aggregate fields) to bypass the metric field validation on the metrics dataset, contrary to the intended behavior of only bypassing validation when all y-axes are equations.