cloudflare / cloudflare/workers-sdk
[workflows] Local `delete()` and `deleteBatch()` have no test coverage
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
Split out of #15123 so that PR can land. Raised by Devin: https://github.com/cloudflare/workers-sdk/pull/15123#discussion_r3756702997
### 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:243` — `WorkflowBinding.deleteBatch()`
- `packages/workflows-shared/src/binding.ts:522` — `WorkflowHandle.delete()`
- `packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts:37` — `deleteBatch()` wrapper
- `packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts:137` — `delete()` 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 #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.
Contributor guide
Research direction
Start with packages/workflows-shared/tests/binding.test.ts and the referenced methods in packages/workflows-shared/src/binding.ts and packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts. Run the existing binding test suite, then cover delete() and deleteBatch() for the listed cases, including the intended deleted/errors failure semantics from #15138.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100