-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workflow_engine): Add in hook for producing occurrences from the stateful detector #7
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: workflow-engine-stateful-detector-before
Are you sure you want to change the base?
Conversation
… stateful detector (#80168) This adds a hook that can be implemented to produce an occurrence specific to the detector that is subclassing the StatefulDetector. Also change the signature of evaluate to return a dict keyed by groupkey instead of a list. This helps avoid the chance of duplicate results for the same group key. <!-- Describe your PR here. -->
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) -> list[DetectorEvaluationResult]: | ||
| # TODO: Implement | ||
| return [] | ||
| class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]): |
Copilot
AI
Nov 14, 2025
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.
The MetricAlertDetectorHandler class now inherits from StatefulDetectorHandler but provides no implementation for the required abstract methods (get_dedupe_value, get_group_key_values, and build_occurrence_and_event_data). This will cause runtime errors when instantiated. Either provide concrete implementations or add a comment explaining why this is intentionally incomplete.
| class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]): | |
| class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]): | |
| """ | |
| Placeholder for a future stateful detector handler for metric alerts. | |
| This class intentionally does not implement the required abstract methods | |
| (get_dedupe_value, get_group_key_values, build_occurrence_and_event_data) | |
| and should not be instantiated until the abstraction is complete. | |
| """ |
| event_data, | ||
| ) | ||
| occurrence_2, event_data_2 = build_mock_occurrence_and_event( | ||
| detector.detector_handler, "group_2", 6, PriorityLevel.HIGH |
Copilot
AI
Nov 14, 2025
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.
The value parameter passed to build_mock_occurrence_and_event should be 10, not 6, to match the group_vals data packet on line 177 where 'group_2': 10. This inconsistency could mask bugs in the occurrence generation logic.
| detector.detector_handler, "group_2", 6, PriorityLevel.HIGH | |
| detector.detector_handler, "group_2", 10, PriorityLevel.HIGH |
| self.enqueue_state_update(group_key, is_active, new_status) | ||
| event_data = None | ||
| result = None | ||
| result: StatusChangeMessage | IssueOccurrence |
Copilot
AI
Nov 14, 2025
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.
[nitpick] The type annotation for 'result' is redundant since it's immediately assigned in both branches of the if-else statement. Consider removing this line or initializing result with a default value.
| result: StatusChangeMessage | IssueOccurrence | |
| result |
Test 10
Replicated from ai-code-review-evaluation/sentry-copilot#9