Skip to content

feat(workflow_engine): Add in hook for producing occurrences from the stateful detector#6

Open
akshayutture-augment wants to merge 1 commit into
workflow-engine-stateful-detector-beforefrom
workflow-engine-stateful-detector-after
Open

feat(workflow_engine): Add in hook for producing occurrences from the stateful detector#6
akshayutture-augment wants to merge 1 commit into
workflow-engine-stateful-detector-beforefrom
workflow-engine-stateful-detector-after

Conversation

@akshayutture-augment

@akshayutture-augment akshayutture-augment commented Nov 14, 2025

Copy link
Copy Markdown

Test 10


Replicated from ai-code-review-evaluation/sentry-cursor#10


Note

Adds a hook for stateful detectors to build IssueOccurrences and event data, updates evaluate() to return a dict keyed by group key, and produces OCCURRENCE/STATUS_CHANGE payloads to Kafka.

  • Workflow Engine:
    • Stateful detectors: Add build_occurrence_and_event_data() abstract hook; evaluate_group_key_value() now builds IssueOccurrence on activation and StatusChangeMessage on resolve.
    • Processing API change: DetectorHandler.evaluate() returns dict[DetectorGroupKey, DetectorEvaluationResult] (was list); process_detectors() updated to iterate dict and produce Kafka messages via produce_occurrence_to_kafka.
    • Detector model: Add group_type property and use it in detector_handler resolution.
    • Metric alert handler: MetricAlertDetectorHandler now extends StatefulDetectorHandler.
  • Tests:
    • Update tests to new dict-based results, add mocks/assertions for Kafka production, refactor common setup into BaseDetectorHandlerTest, and expand coverage for state commit, dedupe, multi-group, and status change behaviors.

Written by Cursor Bugbot for commit de60b7f. Configure here.

… 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. -->
@cursor

cursor Bot commented Nov 14, 2025

Copy link
Copy Markdown

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 14.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@akshayutture-augment

Copy link
Copy Markdown
Author

cursor review

# TODO: Implement
return []
class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]):
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Broken Inheritance: Abstract Methods Missing

MetricAlertDetectorHandler now extends StatefulDetectorHandler but doesn't implement the required abstract methods: counter_names, get_dedupe_value, get_group_key_values, and build_occurrence_and_event_data. This makes the class non-instantiable and will cause a TypeError when attempting to create instances.

Fix in Cursor Fix in Web

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants