Skip to content

test(aci milestone 3): rewrite subscription processor tests for workflow engine #95487

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

Merged
merged 11 commits into from
Aug 14, 2025

Conversation

mifu67
Copy link
Contributor

@mifu67 mifu67 commented Jul 14, 2025

Duplicate tests from subscription_processor.py but rewritten for workflow engine. These will be used for single processing to ensure we don't lose test coverage. This has a lot of tests but isn't comprehensive, there will be follow up PRs for:

Copy link

codecov bot commented Jul 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #95487      +/-   ##
==========================================
+ Coverage   80.08%   80.65%   +0.56%     
==========================================
  Files        8569     8569              
  Lines      377479   377479              
  Branches    24577    24577              
==========================================
+ Hits       302293   304444    +2151     
+ Misses      74820    72669    -2151     
  Partials      366      366              

Copy link
Member

@ceorourke ceorourke left a comment

Choose a reason for hiding this comment

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

If you wanna rebase + maybe address my questions today I can take this over for the smaller bits and do the rest of the tests separately.

detector_trigger.comparison = new_threshold
detector_trigger.save()

def build_subscription_update(self, subscription, time_delta=None, value=EMPTY):
Copy link
Member

Choose a reason for hiding this comment

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

This function and send_update look to be the same as from the existing ProcessUpdateTest - are they copied just so it's easier for us to delete the legacy stuff once we've moved over? We do have tests that we won't be deleting (like test_removed_project for example) but I suppose we can just move those over into the newer files and delete the entire old file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I want to do a quick and easy file deletion once the switch to ACI is fully complete :P

Comment on lines +41 to +42
self.update_threshold(detector, DetectorPriorityLevel.HIGH, 0.5)
self.update_threshold(detector, DetectorPriorityLevel.OK, 0.5)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we update it twice? Won't it just be the latest one (line 42)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The detector priority level here determines the data condition whose threshold gets updated. We have to update both the resolve and critical conditions.

Copy link
Member

Choose a reason for hiding this comment

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

ooh I see okay

@ceorourke ceorourke force-pushed the mifu67/aci/subscription-processor-tests branch from 1cb8e67 to 8985b19 Compare August 11, 2025 22:43
@ceorourke ceorourke marked this pull request as ready for review August 11, 2025 23:40
@ceorourke ceorourke requested a review from a team as a code owner August 11, 2025 23:40
@ceorourke ceorourke requested a review from a team August 11, 2025 23:40
else:
# XXX: after we fully migrate to single processing we can return early here
# this just preserves test functionality for now
metrics.incr("incidents.alert_rules.skipping_update_invalid_aggregation_value")
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Anomaly Detection Fails With Null Aggregation Value

The commit unintentionally allows anomaly detection processing to occur with aggregation_value=None, specifically calling get_anomaly_data_from_seer_legacy with a None value, which was previously prevented by an early return. Additionally, the incidents.alert_rules.skipping_update_invalid_aggregation_value metric is now incremented whenever aggregation_value is None, regardless of the has_metric_issue_single_processing flag, altering its previous behavior.

Fix in Cursor Fix in Web

@ceorourke ceorourke merged commit 691e18b into master Aug 14, 2025
64 checks passed
@ceorourke ceorourke deleted the mifu67/aci/subscription-processor-tests branch August 14, 2025 17:58
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.

2 participants