Skip to content

[DRAFT] typing: remove query_builder from untyped modules list - #121154

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/untyped-module-cleanup-4245
Draft

[DRAFT] typing: remove query_builder from untyped modules list#121154
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/untyped-module-cleanup-4245

Conversation

@cursor

@cursor cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This PR removes one module from the typing-issues allowlist and fixes its typing errors.

Summary

  • Removed sentry.snuba.metrics.query_builder from tool.mypy.overrides under # begin: sentry modules with typing issues in pyproject.toml.
  • Fixed mypy errors in src/sentry/snuba/metrics/query_builder.py by tightening type narrowing and adding explicit casts/guards for:
    • metric operation parsing
    • metric action field overload handling
    • metric params passed into metric expression APIs
    • where-condition rhs resolution for operations requiring tag resolution
    • optional interval handling for discover time grouping
    • component entity typing for derived metrics
    • post-query params typing paths

Validation

  • python -m tools.mypy_helpers.mypy_without_ignores src/sentry/snuba/metrics/query_builder.py
  • .venv/bin/mypy --config pyproject.toml src/sentry/snuba/metrics/query_builder.py
  • .venv/bin/pytest -n3 -svv --reuse-db tests/sentry/snuba/metrics/test_query_builder.py
  • .venv/bin/pytest -n0 -svv --reuse-db tests/sentry/test_mypy_stronglist.py
  • .venv/bin/prek run -q

@armenzg could you 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 

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 4, 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