Skip to content

types: Move sentry.search.events.filter from mypy ignore to stronglist#113191

Draft
kcons wants to merge 3 commits intomasterfrom
kcons/typey
Draft

types: Move sentry.search.events.filter from mypy ignore to stronglist#113191
kcons wants to merge 3 commits intomasterfrom
kcons/typey

Conversation

@kcons
Copy link
Copy Markdown
Member

@kcons kcons commented Apr 16, 2026

Fixes ENG-6456.

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 16, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

Backend Test Failures

Failures on 4c9a7ab in this run:

tests/sentry/seer/endpoints/test_group_ai_autofix.py::GroupAutofixEndpointExplorerRoutingTest::test_open_prlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/seer/endpoints/test_group_ai_autofix.py:1087: in test_open_pr
    assert response.status_code == 202, f"Failed for {flag}: {response.data}"
E   AssertionError: Failed for organizations:seer-explorer: None
E   assert 404 == 202
E    +  where 404 = <Response status_code=404>.status_code
tests/sentry/issues/endpoints/test_organization_group_index.py::GroupListTest::test_semver_buildlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/issues/endpoints/test_organization_group_index.py:1779: in test_semver_build
    assert response.status_code == 400, response.content
E   AssertionError: b'{"detail":"Internal Error","errorId":null}'
E   assert 500 == 400
E    +  where 500 = <Response status_code=500, "application/json">.status_code
tests/sentry/seer/endpoints/test_group_ai_autofix.py::GroupAutofixEndpointExplorerRoutingTest::test_open_pr_with_repo_namelog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/seer/endpoints/test_group_ai_autofix.py:1129: in test_open_pr_with_repo_name
    assert response.status_code == 202, f"Failed for {flag}: {response.data}"
E   AssertionError: Failed for organizations:seer-explorer: None
E   assert 404 == 202
E    +  where 404 = <Response status_code=404>.status_code
tests/sentry/seer/endpoints/test_group_ai_autofix.py::GroupAutofixEndpointExplorerRoutingTest::test_open_pr_without_repo_namelog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/seer/endpoints/test_group_ai_autofix.py:1172: in test_open_pr_without_repo_name
    assert response.status_code == 202, f"Failed for {flag}: {response.data}"
E   AssertionError: Failed for organizations:seer-explorer: None
E   assert 404 == 202
E    +  where 404 = <Response status_code=404>.status_code

# We explicitly use `raw_value` here to avoid converting wildcards to shell values
version: str = search_filter.value.raw_value
raw_version = search_filter.value.raw_value
assert isinstance(raw_version, str)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assertion crashes with 500 instead of returning 400 for unsupported semver IN-list syntax

The new assert isinstance(raw_version, str) on line 337 will raise AssertionError (500 error) when a user queries with list syntax like release.version:[1.0.0, 2.0.0]. Before this change, the list would pass through to parse_semver() which properly raises InvalidSearchQuery("Invalid operation 'IN' for semantic version filter.") (400 error). The assertion is used for type narrowing but blocks reaching the user-friendly error handler.

Verification

Traced the code path: 1) text_in_filter grammar rule matches release.version:[...] syntax and creates SearchFilter with list raw_value and operator='IN'. 2) Filter routes to _semver_filter_converter. 3) Line 337 assertion fails on list type. 4) Previously, parse_semver (line 481-483) would catch 'IN' operator and raise InvalidSearchQuery. SearchValue.raw_value type is str | float | datetime | Sequence[float] | Sequence[str].

Suggested fix: Replace assertion with explicit type check that raises InvalidSearchQuery for non-string values, maintaining the user-friendly error message.

Suggested change
assert isinstance(raw_version, str)
if not isinstance(raw_version, str):
raise InvalidSearchQuery(
"Invalid operation 'IN' for semantic version filter."
)

Identified by Warden sentry-backend-bugs · EN3-URR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is incorrect.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, kinda.

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