fix(backup): Fix mis-migrated AlertRule imports#62526
Merged
azaslavsky merged 2 commits intomasterfrom Jan 3, 2024
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #62526 +/- ##
=======================================
Coverage 81.25% 81.25%
=======================================
Files 5197 5197
Lines 230098 230110 +12
Branches 39745 39748 +3
=======================================
+ Hits 186960 186975 +15
+ Misses 37399 37398 -1
+ Partials 5739 5737 -2
|
hubertdeng123
approved these changes
Jan 3, 2024
armenzg
pushed a commit
that referenced
this pull request
Jan 8, 2024
In theory, as part of the ongoing "actor refactor", all `AlertRule` instances with an `owner_id` pointing to a non-null `Actor` should have that `Actor` instance's populated `user_id` or `team_id` field hoisted into the `AlertRule` model (see #58667 for more). In practice, we've seen some failing relocations of real self-hosted data, implying that there have been some misses in the migration, causing newly imported models to fail validation. In the long term, we'd like to implement a migration that fixes all of the missing edge cases. Until that happens, this import-time fix should allow us to work around the issue. The basic logic is to manually do the hoisting at import-time if possible. If not possible (either due to a missing `owner_id`, or because the `Actor` being pointed to both `team` and `user` set to null), we ensure that the `owner_id` is nulled out.
azaslavsky
added a commit
that referenced
this pull request
Jan 10, 2024
Recently, we've added a couple of import handlers where we selectively null out fields based on certain conditions (see: PRs #62665 and #62526). This commit adds comparator support for this condition, allowing us to define comparators that say "make sure these fields are either equal or have been removed on the right side".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In theory, as part of the ongoing "actor refactor", all
AlertRuleinstances with anowner_idpointing to a non-nullActorshould have thatActorinstance's populateduser_idorteam_idfield hoisted into theAlertRulemodel (see #58667 for more). In practice, we've seen some failing relocations of real self-hosted data, implying that there have been some misses in the migration, causing newly imported models to fail validation.In the long term, we'd like to implement a migration that fixes all of the missing edge cases. Until that happens, this import-time fix should allow us to work around the issue. The basic logic is to manually do the hoisting at import-time if possible. If not possible (either due to a missing
owner_id, or because theActorbeing pointed to bothteamanduserset to null), we ensure that theowner_idis nulled out.