-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(aci): Set ownership on detector #93745
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?
Conversation
Should update owner on creation and on update
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #93745 +/- ##
==========================================
+ Coverage 85.65% 88.03% +2.38%
==========================================
Files 10331 10331
Lines 596456 596402 -54
Branches 23169 23140 -29
==========================================
+ Hits 510888 525061 +14173
+ Misses 85109 70890 -14219
+ Partials 459 451 -8 |
@@ -33,6 +34,7 @@ class BaseDetectorTypeValidator(CamelSnakeSerializer): | |||
) | |||
type = serializers.CharField() | |||
config = serializers.JSONField(default={}) | |||
owner = ActorField(required=False, allow_null=True) |
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.
Should it be possible to create a detector without an owner? Right now in the UI we assume that detectors without an owner are created by Sentry
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.
🤷♂️
@@ -60,6 +62,22 @@ def data_conditions(self) -> BaseDataConditionValidator: | |||
def update(self, instance: Detector, validated_data: dict[str, Any]): | |||
instance.name = validated_data.get("name", instance.name) | |||
instance.type = validated_data.get("detector_type", instance.group_type).slug | |||
|
|||
# Handle owner field update | |||
if "owner" in validated_data: |
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 this initial if statement necessary?
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.
yes because they could omit it entirely from a partial update
# Conflicts: # src/sentry/workflow_engine/endpoints/validators/base/detector.py
Should update owner on creation and on update