feat(ACI): Handle owner passed to workflow#110785
Conversation
src/sentry/workflow_engine/endpoints/validators/base/workflow.py
Outdated
Show resolved
Hide resolved
saponifi3d
left a comment
There was a problem hiding this comment.
lgtm - not quite sure why you're getting some of that type failure though, might just need to update from master to fix that, then the tests will need to be updated for the api docs.
thanks for implementing this so quickly 🙏
src/sentry/workflow_engine/endpoints/validators/base/workflow.py
Outdated
Show resolved
Hide resolved
2fea957 to
670304c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| owner_user_id = None | ||
| owner_team_id = None | ||
|
|
||
| return owner_user_id, owner_team_id |
There was a problem hiding this comment.
UnboundLocalError when owner is not user or team
Medium Severity
In update_owner, if owner is truthy but neither is_user nor is_team, the if/elif branches are both skipped, and owner_user_id and owner_team_id are never assigned. The return statement on line 32 then raises an UnboundLocalError. An else clause within the if owner: block (or initializing the variables before the conditional) would prevent this.
Backend Test FailuresFailures on
|
The `Workflow` model inherits the `OwnerModel` but the `WorkflowValidator` doesn't actually do anything if passed `owner`. This PR adds handling to the validator for the `owner` field so that it's saved and updated if passed. Thankfully the `OwnerActorField` handles all the validation needed. Tests are copied from the existing behavior in issue alert rules for creating and updating. API docs are updated (and fixed) to indicate that there can be an owner for detectors and workflows (externally, monitors and alerts).


The
Workflowmodel inherits theOwnerModelbut theWorkflowValidatordoesn't actually do anything if passedowner. This PR adds handling to the validator for theownerfield so that it's saved and updated if passed. Thankfully theOwnerActorFieldhandles all the validation needed. Tests are copied from the existing behavior in issue alert rules for creating and updating. API docs are updated (and fixed) to indicate that there can be an owner for detectors and workflows (externally, monitors and alerts).