-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(seer-activity): Better communicate incompatible alerts #119007
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,6 +138,32 @@ export function findConflictingConditions( | |
| }; | ||
| } | ||
|
|
||
| // Check for action filters incompatible with Seer activity triggers | ||
| const hasSeerActivityTrigger = triggers.conditions.some( | ||
| c => c.type === DataConditionType.SEER_ACTIVITY_TRIGGER | ||
| ); | ||
| if (hasSeerActivityTrigger) { | ||
| const seerConflictingActionFilters: Record<string, Set<string>> = {}; | ||
| let hasSeerConflicts = false; | ||
|
|
||
| for (const actionFilter of actionFilters) { | ||
| const conflicts = findSeerActivityIncompatibleConditions(actionFilter); | ||
| if (conflicts.size > 0) { | ||
| hasSeerConflicts = true; | ||
| seerConflictingActionFilters[actionFilter.id] = conflicts; | ||
| } | ||
| } | ||
|
|
||
| if (hasSeerConflicts) { | ||
| return { | ||
| conflictingConditionGroups: seerConflictingActionFilters, | ||
| conflictReason: t( | ||
| 'The conditions highlighted in red are not compatible with Seer activity triggers.' | ||
| ), | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| conflictingConditionGroups: {}, | ||
| conflictReason: null, | ||
|
|
@@ -158,6 +184,33 @@ const frequencyTypes = new Set<DataConditionType>([ | |
| DataConditionType.EVENT_UNIQUE_USER_FREQUENCY_PERCENT, | ||
| ]); | ||
|
|
||
| /** | ||
| * Filters that require a GroupEvent to evaluate. Activity-based triggers | ||
| * (like Seer activity) pass an Activity object, so these filters always | ||
| * return false and will block the workflow if the logic type is ALL. | ||
| */ | ||
| const eventRequiredConditions = new Set<DataConditionType>([ | ||
| DataConditionType.EVENT_ATTRIBUTE, | ||
| DataConditionType.TAGGED_EVENT, | ||
| DataConditionType.LEVEL, | ||
| DataConditionType.LATEST_RELEASE, | ||
| DataConditionType.LATEST_ADOPTED_RELEASE, | ||
| ]); | ||
|
|
||
| /** | ||
| * Slow conditions that require Snuba queries. Activity-based triggers | ||
| * cannot be enqueued for delayed evaluation, so these conditions are | ||
| * silently skipped. | ||
| */ | ||
| const slowConditions = new Set<DataConditionType>([ | ||
| DataConditionType.EVENT_FREQUENCY_COUNT, | ||
| DataConditionType.EVENT_FREQUENCY_PERCENT, | ||
| DataConditionType.EVENT_UNIQUE_USER_FREQUENCY_COUNT, | ||
| DataConditionType.EVENT_UNIQUE_USER_FREQUENCY_PERCENT, | ||
| DataConditionType.PERCENT_SESSIONS_COUNT, | ||
| DataConditionType.PERCENT_SESSIONS_PERCENT, | ||
| ]); | ||
|
|
||
| function findFirstSeenEventConflictingConditions( | ||
| conditionGroup: DataConditionGroup | ||
| ): Set<string> { | ||
|
|
@@ -253,6 +306,31 @@ function findConflictingPriorityConditions( | |
| return conflictingConditions; | ||
| } | ||
|
|
||
| function findSeerActivityIncompatibleConditions( | ||
| conditionGroup: DataConditionGroup | ||
| ): Set<string> { | ||
| const allIncompatibleConditions = new Set([ | ||
| ...eventRequiredConditions, | ||
| ...slowConditions, | ||
| ]); | ||
| const anyLogicTypes = new Set([ | ||
| DataConditionGroupLogicType.ANY_SHORT_CIRCUIT, | ||
| DataConditionGroupLogicType.ANY, | ||
| ]); | ||
| const incompatibleConditions = conditionGroup.conditions.filter(c => | ||
| allIncompatibleConditions.has(c.type) | ||
| ); | ||
| // With ANY logic, if at least one condition is compatible, the filter can still pass | ||
| if ( | ||
| anyLogicTypes.has(conditionGroup.logicType) && | ||
| incompatibleConditions.length !== conditionGroup.conditions.length | ||
| ) { | ||
| return new Set<string>(); | ||
|
Comment on lines
+324
to
+328
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The function Suggested FixUpdate Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| } | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| return new Set<string>(incompatibleConditions.map(c => c.id)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NONE logic false Seer conflictsLow Severity
Reviewed by Cursor Bugbot for commit 4c97a6a. Configure here. |
||
| } | ||
|
|
||
| function findDuplicateTriggerConditions(triggers: DataConditionGroup): Set<string> { | ||
| const conditionCounts: Record<string, string[]> = {}; | ||
| const duplicates = new Set<string>(); | ||
|
|
||


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: The
slowConditionsset is missing two frequency-based conditions, causing the UI to not warn users about silently non-functional automation rules.Severity: MEDIUM
Suggested Fix
Add
DataConditionType.EVENT_UNIQUE_USER_FREQUENCY_WITH_CONDITIONS_COUNTandDataConditionType.EVENT_UNIQUE_USER_FREQUENCY_WITH_CONDITIONS_PERCENTto theslowConditionsset inutils.tsxto ensure they are correctly flagged as incompatible with Seer activity triggers.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.