Skip to content

feat: multi-value filters for bulk workflow run cancel#205

Open
CahidArda wants to merge 3 commits into
mainfrom
multi-value-bulk-cancel-filters
Open

feat: multi-value filters for bulk workflow run cancel#205
CahidArda wants to merge 3 commits into
mainfrom
multi-value-bulk-cancel-filters

Conversation

@CahidArda

Copy link
Copy Markdown
Collaborator

Add multi-value filter support to the bulk workflow-run cancel endpoint, mirroring the Workflow API change. A run matches if its value equals any of the given values (OR logic); separate filters are combined with AND logic.

  • workflowUrl and workflowUrlStartingWith now accept string | string[].
  • callerIp and flowControlKey cancel filters now accept string | string[] (scoped to cancel via a dedicated CancelUniversalFilterFields; DLQ and logs filters remain single-value).
  • The workflowUrl translation helper handles array URLs.

Tests added for multiple exact URLs, multiple prefix URLs, multi-value callerIp/flowControlKey, and multiple labels.

Add multi-value filter support to the bulk workflow-run cancel endpoint,
mirroring the Workflow API change. A run matches if its value equals any of
the given values (OR logic); separate filters are combined with AND logic.

- `workflowUrl` and `workflowUrlStartingWith` now accept `string | string[]`.
- `callerIp` and `flowControlKey` cancel filters now accept `string | string[]`
  (scoped to cancel via a dedicated `CancelUniversalFilterFields`; DLQ and logs
  filters remain single-value).
- The workflowUrl translation helper handles array URLs.

Tests added for multiple exact URLs, multiple prefix URLs, multi-value
callerIp/flowControlKey, and multiple labels.
Widen the shared filter types so multi-value filtering (pass an array to match
any value, OR semantics) is available on the workflow DLQ and logs endpoints
too, not just bulk cancel:

- `callerIp` and `flowControlKey` now accept `string | string[]` everywhere.
- `workflowUrl` now accepts `string | string[]` on DLQ/logs filters.
- Simplified the cancel filter types to reuse the now-widened shared base.

Tests:
- Live (real QStash): cancel by multiple workflowUrls (exact, OR), and logs
  filtered by multiple workflowUrls (OR, discriminating).
- Mocked: DLQ list with multi-value workflowUrl/callerIp/flowControlKey
  serialized as repeated query params.
Verified against the live server that the workflow cancel and logs endpoints
accept `host`/`path` filters (and discriminate correctly), while the DLQ
endpoint rejects them — mirroring qstash. So `host`/`path` are added to the
cancel and logs filter types (each supporting multiple values), and omitted
from the DLQ type.

Tests:
- Live (real QStash): cancel by host/path (discriminating) and logs by
  host/path (discriminating).
- Mocked: cancel with host[]/path serialized as repeated query params.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant