Skip to content

Commit 62fb704

Browse files
committed
ref(supergroups): Use direct dict access consistently for Seer response
The TypedDict guarantees the "data" key exists. Defensive .get() was misleading and would silently return wrong data on a malformed response instead of failing loudly.
1 parent bd2c305 commit 62fb704

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sentry/seer/supergroups/endpoints/organization_supergroups_by_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get(self, request: Request, organization: Organization) -> Response:
9898
# bulk, and strip out non-matching ones.
9999
if status_param is not None:
100100
all_response_group_ids: set[int] = set()
101-
for sg in data.get("data", []):
101+
for sg in data["data"]:
102102
all_response_group_ids.update(sg["group_ids"])
103103

104104
matching_ids = set(
@@ -109,7 +109,7 @@ def get(self, request: Request, organization: Organization) -> Response:
109109
).values_list("id", flat=True)
110110
)
111111

112-
for sg in data.get("data", []):
112+
for sg in data["data"]:
113113
sg["group_ids"] = [gid for gid in sg["group_ids"] if gid in matching_ids]
114114
# Drop supergroups that have no matching groups after filtering
115115
data["data"] = [sg for sg in data["data"] if sg["group_ids"]]

0 commit comments

Comments
 (0)