Skip to content

fix(aci): Ensure QuerySubscription changes to AlertRule are reflected on Detector DataSource#102334

Merged
kcons merged 1 commit into
masterfrom
kcons/fixify
Oct 30, 2025
Merged

fix(aci): Ensure QuerySubscription changes to AlertRule are reflected on Detector DataSource#102334
kcons merged 1 commit into
masterfrom
kcons/fixify

Conversation

@kcons

@kcons kcons commented Oct 29, 2025

Copy link
Copy Markdown
Member

Fixes ACI-505.

@kcons kcons requested a review from saponifi3d October 29, 2025 16:08
@kcons kcons requested a review from a team as a code owner October 29, 2025 16:08
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 29, 2025
@codecov

codecov Bot commented Oct 29, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ry/workflow_engine/migration_helpers/alert_rule.py 70.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #102334    +/-   ##
=========================================
  Coverage   80.95%    80.96%            
=========================================
  Files        8769      8770     +1     
  Lines      389622    389754   +132     
  Branches    24777     24777            
=========================================
+ Hits       315431    315561   +130     
- Misses      73813     73815     +2     
  Partials      378       378            

@kcons kcons requested a review from mifu67 October 29, 2025 21:37
@kcons

kcons commented Oct 29, 2025

Copy link
Copy Markdown
Member Author

FYI, all the uncovered lines are for the "if for some weird reason the snuba/subscription/datasource id doesn't actually exist, log and exit" cases. I find that adding test cases for every control flow branch even the ones that just log a thing isn't super useful, but just assuming things exist and allowing the exception when they don't to be caught and reported up the stack (as is the design here) tends to make cursor bot and seer bot freak out.

@saponifi3d saponifi3d left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm to fix the legacy api, but not sure if this is a problem in the new api as well -- we should probably double check that as well.

)


def update_data_source_for_detector(alert_rule: AlertRule, detector: Detector) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since this code is meant to be temporary (the directory is meant to be deletable once we want to start removing the dual write code). should we have this live somewhere else? it seems like this only affects metric alerts, so maybe somewhere in the incidents app?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we want this to be deleted to, pending confirmation that we are actually updating QuerySubscriptions properly on AlertRule-less DataSources.

@kcons kcons merged commit 239de5a into master Oct 30, 2025
69 of 70 checks passed
@kcons kcons deleted the kcons/fixify branch October 30, 2025 22:20
isabellaenriquez pushed a commit that referenced this pull request Oct 31, 2025
shashjar pushed a commit that referenced this pull request Nov 4, 2025
andrewshie-sentry pushed a commit that referenced this pull request Nov 13, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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