Skip to content

Commit 140b1cd

Browse files
authored
fix(issues): Add typing to around event_frames (#97898)
# Summary I picked up [SENTRY-45X5](https://sentry.sentry.io/issues/6731943173/) on a lark. It seems like we're somehow getting `event_frames` full of `None` returns. While trying to figure that out, I jumped around and typed every instance of `event_frames`. Figured it'd be better to put it up as a PR than not. # Test Plan Only changes are typing changes; `mypy` no errors.
1 parent 6aa920a commit 140b1cd

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,11 @@ module = [
595595
"sentry.utils.celery",
596596
"sentry.utils.codeowners",
597597
"sentry.utils.colors",
598+
"sentry.utils.committers",
598599
"sentry.utils.email.*",
599600
"sentry.utils.env",
600601
"sentry.utils.event",
602+
"sentry.utils.event_frames",
601603
"sentry.utils.event_tracker",
602604
"sentry.utils.forms",
603605
"sentry.utils.function_cache",

src/sentry/tasks/groupowner.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
2+
from collections.abc import Mapping, Sequence
23
from datetime import timedelta
3-
from typing import cast
4+
from typing import Any, cast
45

56
import sentry_sdk
67
from django.utils import timezone
@@ -33,7 +34,13 @@
3334

3435

3536
def _process_suspect_commits(
36-
event_id, event_platform, event_frames, group_id, project_id, sdk_name=None, **kwargs
37+
event_id,
38+
event_platform,
39+
event_frames: Sequence[Mapping[str, Any]],
40+
group_id,
41+
project_id,
42+
sdk_name=None,
43+
**kwargs,
3744
):
3845
metrics.incr("sentry.tasks.process_suspect_commits.start")
3946
set_current_event_project(project_id)
@@ -196,7 +203,7 @@ def _process_suspect_commits(
196203
def process_suspect_commits(
197204
event_id,
198205
event_platform,
199-
event_frames,
206+
event_frames: Sequence[Mapping[str, Any]],
200207
group_id,
201208
project_id,
202209
sdk_name=None,

src/sentry/utils/committers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def score_path_match_length(path_a: str, path_b: str) -> int:
4848
return score
4949

5050

51-
def get_frame_paths(event: Event | GroupEvent) -> Any | Sequence[Any]:
51+
def get_frame_paths(event: Event | GroupEvent) -> Sequence[Mapping[str, Any]]:
5252
return find_stack_frames(event.data)
5353

5454

0 commit comments

Comments
 (0)