Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 8ba2088

Browse files
committed
"Fix" errors calling get_flag_names on None
The recent switch to `get_flag_names` has caused a couple of "new" Sentry errors. Though they are not really "new", but rather just different from previous errors. It seems like the existing code is passing `None` as Report in a bunch of places, and has seemingly always done so. The error now is just a different one. Nonetheless, I paper over that error in some places by defaulting to `[]` instead on an empty Report. The code will still fail on a different line though.
1 parent 7189c13 commit 8ba2088

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

graphql_api/types/commit/commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def resolve_coverage_totals(
326326
@commit_coverage_analytics_bindable.field("flagNames")
327327
@sync_to_async
328328
def resolve_coverage_flags(commit: Commit, info: GraphQLResolveInfo) -> list[str]:
329-
return commit.full_report.get_flag_names()
329+
return commit.full_report.get_flag_names() if commit.full_report else []
330330

331331

332332
@sentry_sdk.trace

services/components.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ def component_filtered_report(
3232
Filter a report such that the totals, etc. are only pertaining to the given component.
3333
"""
3434
flags, paths = [], []
35+
report_flags = report.get_flag_names() if report else []
3536
for component in components:
36-
flags.extend(component.get_matching_flags(report.get_flag_names()))
37+
flags.extend(component.get_matching_flags(report_flags))
3738
paths.extend(component.paths)
3839
filtered_report = report.filter(flags=flags, paths=paths)
3940
return filtered_report

0 commit comments

Comments
 (0)