Skip to content

Commit e5f76d4

Browse files
fix(autofix): Handle missing state in get_autofix_state (#97556)
Fixes [SENTRY-43FP](https://sentry.io/organizations/sentry/issues/6709226854/). The issue was that: GitHub webhook for non-Autofix PR caused Seer to return null state, leading to `DictError` during validation. - Explicitly check for a missing `state` key in the result of `get_autofix_state`. - Return `None` if the `state` key is missing to avoid errors when validating. This fix was generated by Seer in Sentry, triggered by Rohan Agarwal. 👁️ Run ID: 734775 Not quite right? [Click here to continue debugging with Seer.](https://sentry.io/organizations/sentry/issues/6709226854/?seerDrawer=true) <!-- Sentry employees and contractors can delete or ignore the following. --> ### 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. Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com>
1 parent 06da4e1 commit e5f76d4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/sentry/seer/autofix/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ def get_autofix_state_from_pr_id(provider: str, pr_id: int) -> AutofixState | No
148148
if not result:
149149
return None
150150

151-
return AutofixState.validate(result.get("state", None))
151+
state = result.get("state", None)
152+
if state is None:
153+
return None
154+
155+
return AutofixState.validate(state)
152156

153157

154158
def is_seer_scanner_rate_limited(project: Project, organization: Organization) -> bool:

0 commit comments

Comments
 (0)