Skip to content

feat: evict durable objects with test harness#14602

Merged
edmundhung merged 7 commits into
mainfrom
edmundhung/do-eviction-api
Jul 10, 2026
Merged

feat: evict durable objects with test harness#14602
edmundhung merged 7 commits into
mainfrom
edmundhung/do-eviction-api

Conversation

@edmundhung

@edmundhung edmundhung commented Jul 8, 2026

Copy link
Copy Markdown
Member

Fixes n/a.

This PR adds Durable Object eviction support to createTestHarness

Integration tests can now gracefully evict a currently-running Durable Object by binding name and object name or ID to verify how a Durable Object recovers after its instance is torn down:

const worker = server.getWorker();
await worker.evictDurableObject("COUNTER", { name: "user-123" });

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: It will be included with the rest of the test harness docs

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b3aa1af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
miniflare Minor
wrangler Minor
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14602

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14602

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14602

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14602

miniflare

npm i https://pkg.pr.new/miniflare@14602

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14602

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14602

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14602

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14602

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14602

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14602

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14602

wrangler

npm i https://pkg.pr.new/wrangler@14602

commit: b3aa1af

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully to PR #14602.

I'm Bonk, and I've done a quick review of your PR.

The PR adds evictDurableObject() to Miniflare and surfaces it through createTestHarness, backed by a new always-on dev-control service that binds every Durable Object namespace.

Key findings I posted:

  1. (High) Duplicate binding names crash Miniflare startup for all instances — the dev-control binding list is built from Object.values(worker.do.durableObjects) (keyed by binding name), so two bindings pointing to the same DO class produce the same MINIFLARE_DEV_CONTROL_DO:<script>:<class> binding name twice, which workerd rejects during config validation. Since the service is created unconditionally, this breaks startup for every affected Miniflare instance, not just eviction. Posted a suggestion to de-duplicate.
  2. (Low) No runtime guard on the eviction target ({}idFromName(undefined)).
  3. (Low) unsafePreventEviction/remote DOs still get control bindings but won't evict meaningfully.

github run

@edmundhung edmundhung force-pushed the edmundhung/do-eviction-api branch from 321a284 to 1c6ebb9 Compare July 8, 2026 13:10
@edmundhung edmundhung marked this pull request as ready for review July 8, 2026 13:13
@workers-devprod workers-devprod requested review from a team and jamesopstad and removed request for a team July 8, 2026 13:13
@workers-devprod

workers-devprod commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@edmundhung edmundhung force-pushed the edmundhung/do-eviction-api branch from 1c6ebb9 to e5e3e5a Compare July 8, 2026 14:09
Comment thread .changeset/green-badgers-evict.md Outdated
@edmundhung edmundhung marked this pull request as draft July 9, 2026 13:53
@edmundhung edmundhung marked this pull request as ready for review July 9, 2026 20:31
@edmundhung edmundhung requested a review from jamesopstad July 9, 2026 20:31
Comment thread packages/wrangler/e2e/createTestHarness.test.ts

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jul 10, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@edmundhung edmundhung force-pushed the edmundhung/do-eviction-api branch from d1ea5cf to b3aa1af Compare July 10, 2026 13:27
@edmundhung edmundhung merged commit 7692a61 into main Jul 10, 2026
57 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 10, 2026
@edmundhung edmundhung deleted the edmundhung/do-eviction-api branch July 10, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants