Skip to content

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

Merged
merged 3 commits into from
Jun 20, 2025

Conversation

scttcper
Copy link
Member

Should update owner on creation and on update

Should update owner on creation and on update
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 17, 2025
@scttcper scttcper requested a review from a team as a code owner June 17, 2025 19:57
Copy link

codecov bot commented Jun 17, 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   #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)
Copy link
Member

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

Copy link
Member Author

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:
Copy link
Member

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?

Copy link
Member Author

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
@scttcper scttcper merged commit 37375d9 into master Jun 20, 2025
64 checks passed
@scttcper scttcper deleted the scttcper/set-ownership-on-creation branch June 20, 2025 17:12
@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 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