Skip to content

Conversation

@armenzg
Copy link
Member

@armenzg armenzg commented Dec 5, 2025

This is in order to support re-running error predictions checks (see https://github.com/getsentry/seer/pull/4173).

Fixes CW-18

@armenzg armenzg self-assigned this Dec 5, 2025
@linear
Copy link

linear bot commented Dec 5, 2025

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 5, 2025
# 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)
Copy link
Contributor

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.

Fix in Cursor Fix in Web

success = forward_github_event_for_error_prediction(
organization=self.organization,
event=self.event,
)
Copy link
Contributor

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)

Fix in Cursor Fix in Web

}
}"""

# Simplified example of a check_run rerequested action event
Copy link
Contributor

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?

@codecov
Copy link

codecov bot commented Dec 5, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
294 1 293 20
View the top 1 failed test(s) by shortest run time
::tests.sentry.integrations.github.test_check_run_webhook
Stack Traces | 0s run time
#x1B[31mImportError while importing test module '.../integrations/github/test_check_run_webhook.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
#x1B[1m#x1B[.../hostedtoolcache/Python/3.13.1.../x64/lib/python3.13/importlib/__init__.py#x1B[0m:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
#x1B[1m#x1B[.../integrations/github/test_check_run_webhook.py#x1B[0m:13: in <module>
    from .testutils import GitHubWebhookTestCase
#x1B[1m#x1B[31mE   ModuleNotFoundError: No module named 'tests.sentry.integrations.github.testutils'#x1B[0m#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.


@property
def event_type(self) -> IntegrationWebhookEventType:
return IntegrationWebhookEventType.PULL_REQUEST
Copy link
Contributor

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?

Copy link
Member Author

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
Copy link
Contributor

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):
Copy link
Contributor

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 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants