-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(rules): Migrate 'bad' rules to be disabled #55941
Conversation
src/sentry/migrations/0546_migrate_no_action_dupe_issue_alerts.py
Outdated
Show resolved
Hide resolved
This PR has a migration; here is the generated SQL for --
-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:
-- Raw Python operation
-- |
Codecov Report
@@ Coverage Diff @@
## master #55941 +/- ##
==========================================
- Coverage 79.99% 79.98% -0.01%
==========================================
Files 5063 5063
Lines 217841 217848 +7
Branches 36879 36881 +2
==========================================
- Hits 174254 174250 -4
- Misses 38243 38249 +6
- Partials 5344 5349 +5
|
src/sentry/migrations/0546_migrate_no_action_dupe_issue_alerts.py
Outdated
Show resolved
Hide resolved
src/sentry/migrations/0546_migrate_no_action_dupe_issue_alerts.py
Outdated
Show resolved
Hide resolved
d6819b4
to
4a7c3f4
Compare
This PR has a migration; here is the generated SQL for --
-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:
-- Raw Python operation
-- |
4a7c3f4
to
f50ed55
Compare
This PR has a migration; here is the generated SQL for --
-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:
-- Raw Python operation
-- |
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.
is it possible to write a test for this? I know we previously added some tooling around data migration tests
I can - could you point me to where that is? I'm not finding much for |
Let me know if there's enough context here: https://develop.sentry.dev/database-migrations/#testing |
I added a test based on that but running it locally (even with the env var set) always says: Update: Fixed 0547 locally and I get the same message. |
ah annoying! i'll try running it on my local in a sec and see what happens. thanks for adding that! |
Oh duh - they're all marked as skippable: |
tests/sentry/migrations/test_0549_migrate_no_action_dupe_issue_alerts.py
Outdated
Show resolved
Hide resolved
@markstory do you know on this one? do we generally make them skip after the PR is merged? |
src/sentry/migrations/0549_migrate_no_action_dupe_issue_alerts.py
Outdated
Show resolved
Hide resolved
9ccc76f
to
a3c8931
Compare
This PR has a migration; here is the generated SQL for --
-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:
-- Raw Python operation
-- |
#55941 had a mistake where rules that were the exact same in the same project that had different environments were being disabled due to a discrepancy in how we need to compare rule data in the app (a data dict including the environment data, if set) versus how we need to compare rule data in the database (if the environment is set, it's a column in the table, not in `data`). This migration will find disabled rules with an environment id set and compare them against other rules in the project. If they're actually duplicates (including the environment) we'll leave it alone, but if they're duplicates _except_ for the environment, we'll re-enable it.
#55941 had a mistake where rules that were the exact same in the same project that had different environments were being disabled due to a discrepancy in how we need to compare rule data in the app (a data dict including the environment data, if set) versus how we need to compare rule data in the database (if the environment is set, it's a column in the table, not in `data`). This migration will find disabled rules with an environment id set and compare them against other rules in the project. If they're actually duplicates (including the environment) we'll leave it alone, but if they're duplicates _except_ for the environment, we'll re-enable it.
Migrate alert rules that have no action or are exact duplicates of another rule in the same project to be disabled. We now prevent these from being created, this will just clean up old ones.
Closes #55502