Skip to content

[workflows] Local delete() and deleteBatch() have no test coverage #15139

Description

@petebacondarwin

Split out of #15123 so that PR can land. Raised by Devin: #15123 (comment)

Problem

The local WorkflowInstance.delete() and Workflow.deleteBatch() support added in #15123 has no test coverage. Confirmed: packages/workflows-shared/tests/ contains no reference to delete, and no test file in the repo references deleteBatch.

Untested code paths:

  • packages/workflows-shared/src/binding.ts:243WorkflowBinding.deleteBatch()
  • packages/workflows-shared/src/binding.ts:522WorkflowHandle.delete()
  • packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts:37deleteBatch() wrapper
  • packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts:137delete() wrapper

There is an existing suite at packages/workflows-shared/tests/binding.test.ts covering create, get, createBatch and WorkflowHandle, so there is a clear home for these.

Worth covering

  • Deleting a running instance, and that it is actually gone afterwards.
  • Deleting an instance ID that does not exist.
  • The batch guard rails: the empty-batch and >100-instance errors (binding.ts:246-256).
  • Duplicate IDs within one batch.
  • The deleted/errors split — note this is currently broken (see [workflows] Local deleteBatch() always reports success, so failures are invisible #15138), so these tests should be written against the intended semantics decided there, and will likely land with that fix.

Acceptance

  • delete() and deleteBatch() are covered in packages/workflows-shared/tests/binding.test.ts, including at least one case that asserts a failure is reported rather than being reported as a success.

Metadata

Metadata

Assignees

No one assigned

    Labels

    product:workflowsRelating to Cloudflare Workflows: https://developers.cloudflare.com/workflows/tech-debtIssue to do with technical debt

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions