Skip to content

[miniflare] Restrict dev registry registration to user workers - #15040

Merged
edmundhung merged 2 commits into
mainfrom
edmundhung/restrict-dev-registry-registration-v2
Aug 5, 2026
Merged

[miniflare] Restrict dev registry registration to user workers#15040
edmundhung merged 2 commits into
mainfrom
edmundhung/restrict-dev-registry-registration-v2

Conversation

@edmundhung

@edmundhung edmundhung commented Aug 5, 2026

Copy link
Copy Markdown
Member

Fixes #15035.

This replaces #10411 with a fresh implementation on current main.

Miniflare previously advertised every named worker in the dev registry. That includes internal workers started by the Cloudflare Vite plugin and any external helper workers sharing the Miniflare instance. This adds an opt-in unsafeRegisterWorker worker option and enables it only for user-worker paths in Wrangler, the Vite plugin, and platform proxy.

The dev registry, cross-process queue, Local Explorer, and compatibility fixture tests now explicitly register the workers that other processes need to discover.

Windows validation using the same harness as #15038 is running in #15041.


  • 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: this is an internal local-development integration; the new Miniflare option is documented in the package README.

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


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: db3a117

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

This PR includes changesets to release 8 packages
Name Type
miniflare Major
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
wrangler 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 Aug 5, 2026
@workers-devprod
workers-devprod requested review from a team and penalosa and removed request for a team August 5, 2026 14:53
@workers-devprod

workers-devprod commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Confirmed: watch() (line 2198) is called separately from register() (line 2729). External service discovery is independent of registration. The empty-entries short-circuit in register is safe.

The PR is well-implemented, well-tested, and correctly scoped. All user-worker instantiation paths are updated, docs and changeset are correct, and I found no logic bugs, security issues, backward-compat violations, or incorrect API behavior.

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15040

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15040

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15040

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: db3a117

@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

Copy link
Copy Markdown
Member Author

Validation result: this does not fix the Windows flake, so #15040 should be judged as the internal-worker collision/churn fix for #15035 only.

I reused #15038's harness unchanged in #15041 and ran the vite dev <-> vite dev suite four times on Windows. The result was:

  • 19 std::terminate aborts (versus 23 in DO NOT MERGE: validate dev-registry reconcile fix on Windows #15038)
  • 11 sessions marked CRASH-DETECTED
  • 3 failed tests out of 42:
    • round 1 supports exported handler fetch over service binding returned Vite HTML instead of the Worker response
    • round 2 of the same test timed out
    • round 2 supports tail handler timed out in waitFor

Job: https://github.com/cloudflare/workers-sdk/actions/runs/31017919389/job/92346768939

The difference in raw abort count is too small and noisy to indicate an improvement; the abort remains readily reproducible after the internal registry entries are removed. #15018's Windows skip needs to stay. This rules out the fixed-name internal-worker collisions as the sole trigger, while #15040 still removes those accidental entries and the cross-session registry traffic they cause.

@petebacondarwin petebacondarwin 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.

Approved with a few nits.

To be clear this is actually a breaking change for Miniflare, which is allowed because we are in v5 pre-release.

Comment thread packages/miniflare/src/plugins/core/index.ts
Comment thread .changeset/quiet-workers-register.md Outdated
Comment thread .changeset/quiet-workers-register.md Outdated
@petebacondarwin
petebacondarwin removed the request for review from penalosa August 5, 2026 16:57

@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 Aug 5, 2026
@edmundhung
edmundhung merged commit 99eb50c into main Aug 5, 2026
70 of 72 checks passed
@edmundhung
edmundhung deleted the edmundhung/restrict-dev-registry-registration-v2 branch August 5, 2026 19:29
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Aug 5, 2026
@ask-bonk ask-bonk Bot mentioned this pull request Aug 6, 2026
5 tasks
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.

[vite-plugin] Internal Workers collide in the shared dev registry across concurrent dev sessions

3 participants