Skip to content

[DRAFT] Remove query_builder from mypy typing-issues list#119042

Draft
cursor[bot] wants to merge 2 commits into
masterfrom
cursor/untyped-module-cleanup-095a
Draft

[DRAFT] Remove query_builder from mypy typing-issues list#119042
cursor[bot] wants to merge 2 commits into
masterfrom
cursor/untyped-module-cleanup-095a

Conversation

@cursor

@cursor cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove sentry.snuba.metrics.query_builder from pyproject.toml's "sentry modules with typing issues" override list
  • fix mypy issues in src/sentry/snuba/metrics/query_builder.py by tightening/narrowing types around action-by fields, metric condition rhs handling, interval checks, and metric key typing
  • preserve rich metric params (including team_key_transaction tuple-list params) while satisfying stricter static typing

Testing

  • PATH=".venv/bin:$PATH" .venv/bin/python -m tools.mypy_helpers.mypy_without_ignores src/sentry/snuba/metrics/query_builder.py
  • PATH=".venv/bin:$PATH" .venv/bin/mypy src/sentry/snuba/metrics/query_builder.py
  • PATH=".venv/bin:$PATH" .venv/bin/prek run -q
  • SENTRY_SKIP_SERVICE_VALIDATION=1 PATH=".venv/bin:$PATH" .venv/bin/pytest -n3 -svv --reuse-db "tests/sentry/snuba/metrics/test_query_builder.py::test_only_can_groupby_operations_can_be_added_to_groupby[valid grouping by metrics expression]" "tests/sentry/snuba/metrics/test_query_builder.py::test_only_can_filter_operations_can_be_added_to_where[valid filtering by metrics expression]"
  • attempted broader tests/sentry/snuba/metrics/test_query_builder.py, but this environment lacks local Postgres; Redis dependency was remediated locally and remaining failures were reduced to DB-related setup/runtime warnings

Review

@armenzg please review this draft PR.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Open in Web View Automation 

cursoragent and others added 2 commits July 6, 2026 12:07
Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant