Skip to content

fix(ACI): Parse and persist owner field#110807

Open
ceorourke wants to merge 4 commits intomasterfrom
ceorourke/ISWF-2237
Open

fix(ACI): Parse and persist owner field#110807
ceorourke wants to merge 4 commits intomasterfrom
ceorourke/ISWF-2237

Conversation

@ceorourke
Copy link
Member

Follow up to #110785 and #110381 to write and update the owner on a workflow if that data is passed to the legacy endpoint and we have the feature flag flipped so that we single write.

@ceorourke ceorourke requested a review from a team as a code owner March 16, 2026 21:48
@linear-code
Copy link

linear-code bot commented Mar 16, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 16, 2026
@github-actions
Copy link
Contributor

Backend Test Failures

Failures on d0e5fbb in this run:

tests/sentry/api/endpoints/test_project_rule_details.py::UpdateProjectRuleTest::test_update_owner_typelog
tests/sentry/api/endpoints/test_project_rule_details.py:752: in test_update_owner_type
    workflow = Workflow.objects.get(id=workflow_response.data["id"])
.venv/lib/python3.13/site-packages/django/db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/models/query.py:635: in get
    raise self.model.DoesNotExist(
E   sentry.workflow_engine.models.workflow.Workflow.DoesNotExist: Workflow matching query does not exist.

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

if owner:
actor = parse_and_validate_actor(str(owner), project.organization_id)
if actor is not None:
workflow_payload["owner"] = actor.identifier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner clearing fails when explicitly set to None

Medium Severity

The if owner: check in format_request_data treats an explicitly-passed None value the same as a missing key. When a user sends "owner": null to clear an existing owner, data.get("owner") returns None, the falsy check skips the block, and workflow_payload never receives an owner key. The WorkflowValidator.update method then sees "owner" not in validated_data and preserves the old owner. The downstream update_owner function correctly handles None by clearing both owner_user_id and owner_team_id, but it's never reached. The existing test_no_owner test doesn't catch this because the workflow starts without an owner. A check like if "owner" in data with separate handling for None vs. truthy values is needed.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant