Skip to content

feat(aci): Add created_by search filter to workflow index endpoint#112873

Merged
malwilley merged 1 commit intomasterfrom
malwilley/workflow-created-by
Apr 13, 2026
Merged

feat(aci): Add created_by search filter to workflow index endpoint#112873
malwilley merged 1 commit intomasterfrom
malwilley/workflow-created-by

Conversation

@malwilley
Copy link
Copy Markdown
Member

Ref ISWF-2448

The workflow index endpoint already supports filtering by name and action in the query parameter, but there's no way to filter by who created the workflow. This logic works similarly to the assignee filter in the detector_index endpoint

This uses parse_user_value from the existing search utils to resolve values like me (current user) or an email/username to a user ID, then filters on created_by_id. Supports =, !=, and IN operators (e.g. created_by:me, !created_by:user@example.com, created_by:[user1,user2]).

@malwilley malwilley requested a review from a team as a code owner April 13, 2026 22:28
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 13, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 13, 2026
Copy link
Copy Markdown
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 prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Negated list filter silently ignored for created_by
    • Added 'NOT IN' to the operator match pattern and updated the condition to exclude() for both '!=' and 'NOT IN' operators, fixing the silent ignore of negated list filters.

Create PR

Or push these changes by commenting:

@cursor push 8783d188f7
Preview (8783d188f7)
diff --git a/src/sentry/workflow_engine/endpoints/organization_workflow_index.py b/src/sentry/workflow_engine/endpoints/organization_workflow_index.py
--- a/src/sentry/workflow_engine/endpoints/organization_workflow_index.py
+++ b/src/sentry/workflow_engine/endpoints/organization_workflow_index.py
@@ -176,7 +176,9 @@
                             "workflowdataconditiongroup__condition_group__dataconditiongroupaction__action__type",
                             distinct=True,
                         )
-                    case SearchFilter(key=SearchKey("created_by"), operator=("=" | "IN" | "!=")):
+                    case SearchFilter(
+                        key=SearchKey("created_by"), operator=("=" | "IN" | "!=" | "NOT IN")
+                    ):
                         values = (
                             filter.value.value
                             if isinstance(filter.value.value, list)
@@ -184,7 +186,7 @@
                         )
                         user_ids = [parse_user_value(v, request.user).id for v in values]
                         created_by_q = Q(created_by_id__in=user_ids)
-                        if filter.operator == "!=":
+                        if filter.operator in ("!=", "NOT IN"):
                             queryset = queryset.exclude(created_by_q)
                         else:
                             queryset = queryset.filter(created_by_q)

diff --git a/tests/sentry/workflow_engine/endpoints/test_organization_workflow_index.py b/tests/sentry/workflow_engine/endpoints/test_organization_workflow_index.py
--- a/tests/sentry/workflow_engine/endpoints/test_organization_workflow_index.py
+++ b/tests/sentry/workflow_engine/endpoints/test_organization_workflow_index.py
@@ -548,6 +548,18 @@
             str(self.workflow_two.id),
         }
 
+    def test_query_by_created_by_negation_multiple(self) -> None:
+        other_user = self.create_user(email="other@example.com")
+        self.workflow.update(created_by_id=self.user.id)
+        self.workflow_two.update(created_by_id=other_user.id)
+
+        response = self.get_success_response(
+            self.organization.slug,
+            qs_params={"query": f"!created_by:[{self.user.email},{other_user.email}]"},
+        )
+        assert len(response.data) == 1
+        assert response.data[0]["id"] == str(self.workflow_three.id)
+
     def test_query_by_created_by_invalid_user(self) -> None:
         self.workflow.update(created_by_id=self.user.id)
         response = self.get_success_response(

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0788019. Configure here.

Support filtering workflows by creator using the query parameter
(e.g. created_by:me, created_by:user@example.com). Supports =, !=,
and IN operators, matching the pattern used for assignee filtering
in the detector index endpoint.
@malwilley malwilley merged commit 71bcf8b into master Apr 13, 2026
56 checks passed
@malwilley malwilley deleted the malwilley/workflow-created-by branch April 13, 2026 23:10
malwilley added a commit that referenced this pull request Apr 14, 2026
Add frontend support for the created_by search filter in the
automations list, following the same pattern as the detector search
assignee filter. Refactor filter key definitions into a
useAutomationFilterKeys hook that provides dynamic member values
for the created_by dropdown.

Refs #112873
malwilley added a commit that referenced this pull request Apr 14, 2026
Add frontend support for the created_by search filter in the
automations list, following the same pattern as the detector search
assignee filter. Refactor filter key definitions into a
useAutomationFilterKeys hook that provides dynamic member values
for the created_by dropdown.

Refs #112873
malwilley added a commit that referenced this pull request Apr 14, 2026
Add frontend support for the created_by search filter in the
automations list, following the same pattern as the detector search
assignee filter. Refactor filter key definitions into a
useAutomationFilterKeys hook that provides dynamic member values
for the created_by dropdown.

Refs #112873
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.

3 participants