Skip to content

DX-2588: complete bulk action coverage - #208

Merged
CahidArda merged 6 commits into
mainfrom
DX-2588-support-all-bulk-actions
Aug 7, 2026
Merged

DX-2588: complete bulk action coverage#208
CahidArda merged 6 commits into
mainfrom
DX-2588-support-all-bulk-actions

Conversation

@ytkimirti

@ytkimirti ytkimirti commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes the remaining gaps between the QStash API and the workflow client.

  • logs({ workflowRunIds }) — fetch logs for a set of runs in one call (server workflowRuns param). Combinable with filter.
  • failureFunctionState filter now accepts multiple values and is typed as FailureFunctionState instead of string.
  • dlq.cancelFailureFunction({ dlqId }) — cancels an in-progress failure function call (DELETE /v2/workflows/dlq/callback/:dlqId). The server answers success with 302 and an empty body, so that status is treated as success.

Related: upstash/qstash-js#274

@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown

DX-2588

Comment thread src/client/index.ts Outdated
@ytkimirti
ytkimirti force-pushed the DX-2588-support-all-bulk-actions branch from 8119d79 to 84aeb99 Compare August 4, 2026 15:12
@CahidArda
CahidArda requested a review from Copilot August 6, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to close remaining gaps between the QStash Workflow API and this workflow client by tightening workflow/DLQ typing and extending DLQ operations, with corresponding tests.

Changes:

  • Introduces a shared FailureFunctionState type and applies it across workflow logs and DLQ structures.
  • Extends failureFunctionState filtering to support multiple values (OR semantics) and updates typings accordingly.
  • Adds dlq.cancelFailureFunction({ dlqId }) to cancel in-progress failure function calls (treating 302 as success) and adds tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/client/types.ts Adds FailureFunctionState and reuses it in failure-function log typing.
src/client/filter-types.ts Updates filter typing to allow multi-value failureFunctionState using FailureFunctionState.
src/client/dlq.ts Adds cancelFailureFunction implementation and reuses FailureFunctionState in DLQ message typing.
src/client/dlq.test.ts Adds tests for multi-value failureFunctionState filtering and for cancelFailureFunction.
Suppressed comments (2)

src/client/dlq.ts:327

  • DLQResumeRestartOptions is marked @deprecated in src/client/types.ts, but this new public method references it in its parameter type. It’s better to type this parameter directly (or via a non-deprecated helper type) so users don’t see deprecation warnings when using cancelFailureFunction.
  async cancelFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">) {

src/client/filter-types.ts:46

  • PR description mentions adding logs({ workflowRunIds }) to fetch logs for a set of runs in one call, but the current client logs implementation still only supports a single workflowRunId via legacy params / filter.workflowRunId (no workflowRunIds support found in src/client/index.ts). If bulk log fetching is intended in this PR, the API/types/tests for logs likely still need to be updated to match the description.
  /**
   * Filter by the state of the failure function call. Supports multiple values:
   * pass an array to match runs in any of the given states (OR semantics).
   */
  failureFunctionState?: FailureFunctionState | FailureFunctionState[];
};

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/client/filter-types.ts Outdated
Comment thread src/client/dlq.ts Outdated
CahidArda and others added 2 commits August 6, 2026 15:46
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…stency

- Make cancelExpecting timeout configurable (default 10 s); pass 20 s
  for the workflowUrl exact-match tests, which use a separate index that
  can lag longer than the prefix index.  Also raise their test timeout
  to 60 s to accommodate the wider polling window.
- Add a 1 s sleep between the first (labelOne) and second (labelTwo)
  cancel in the multi-label test so the cancellation propagates to the
  labelTwo index before we assert cancelled: 0.  Raise test timeout to
  45 s accordingly.

Co-authored-by: CahidArda <57228345+CahidArda@users.noreply.github.com>
Copilot AI requested a review from CahidArda August 6, 2026 13:14
…ount

QStash made filter-based bulk cancel asynchronous (server-side "bulk action"
registry). The cancelled field is now a snapshot of how many runs matched the
filter when the action was registered, not how many were cancelled, and
re-issuing the same filter dedups onto the in-flight action instead of
sweeping again. The old helper summed counts across repeated identical
cancels, which is meaningless under those semantics.

Assert on the runs themselves instead: re-issue the cancel until every
targeted run 404s, then check the untargeted ones are still live. Cancel by
id stays synchronous and exact, so it is still asserted on counts and is used
for cleanup.
@CahidArda
CahidArda merged commit c2cf56a into main Aug 7, 2026
84 of 92 checks passed
@CahidArda
CahidArda deleted the DX-2588-support-all-bulk-actions branch August 7, 2026 11:11
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.

4 participants