-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(webhooks): Forward check run events to Seer #104455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| # XXX: Add support for registering functions to call | ||
| from sentry.seer.error_prediction.webhooks import forward_github_event_for_error_prediction | ||
|
|
||
| forward_github_event_for_error_prediction(organization=organization, event=event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: CheckRunEventWebhook._handle never called without repository key
The CheckRunEventWebhook class inherits from GitHubWebhook but doesn't override the __call__ method. The parent class's __call__ method only invokes _handle when the event contains a "repository" key (line 116 of the base class). GitHub check_run webhook events for rerequested actions may not include a repository field in the payload, and the test fixtures confirm this. As a result, _handle will never be called for check_run events lacking a repository, and the forwarding to Seer won't happen. The InstallationEventWebhook class handles this correctly by overriding __call__ entirely.
| success = forward_github_event_for_error_prediction( | ||
| organization=self.organization, | ||
| event=self.event, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test uses undefined self.event instead of self.action_rerequested_event
Several test methods reference self.event which is never defined. The setUp method defines self.action_rerequested_event, but tests test_forwards_rerequested_action_to_seer, test_handles_seer_error_response, and test_includes_signed_headers all use self.event. These tests will fail with an AttributeError when run.
Additional Locations (2)
| } | ||
| }""" | ||
|
|
||
| # Simplified example of a check_run rerequested action event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there docs that list the event format if we want to check the full payload later?
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
|
||
| @property | ||
| def event_type(self) -> IntegrationWebhookEventType: | ||
| return IntegrationWebhookEventType.PULL_REQUEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be CHECK_RUN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be.
| @@ -0,0 +1 @@ | |||
| # Error prediction module for Seer integration | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should call it code_review that is closer to the external name of the feature?
| } | ||
|
|
||
| # Check if error prediction/AI features are enabled for this org | ||
| if not features.has("organizations:gen-ai-features", organization): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a function for this somewhere... and I'm not sure this check is complete. But I'd have to double check too 😅
This is in order to support re-running error predictions checks (see https://github.com/getsentry/seer/pull/4173).
Fixes CW-18