Skip to content

[miniflare] Simplify dev-registry proxy and fix asset routing#12600

Draft
penalosa wants to merge 12 commits intomainfrom
penalosa/native-registry
Draft

[miniflare] Simplify dev-registry proxy and fix asset routing#12600
penalosa wants to merge 12 commits intomainfrom
penalosa/native-registry

Conversation

@penalosa
Copy link
Contributor

Depends on cloudflare/workerd#6100 (refcounted debug port connection state).

Simplifies the dev-registry proxy worker now that the workerd debug port fix keeps connections alive for deferred proxying (WebSocket passthrough, streamed response bodies).

  • Removes fetchViaHttp HTTP fallback — WebSocket upgrades now work natively through the debug port RPC
  • Removes the _client reference hack that was preventing GC of the debug port connection
  • Removes eager response.arrayBuffer() body buffering workaround
  • Replaces hasAssets: boolean with defaultEntrypointService: string in WorkerDefinition for correct routing to the right workerd service:
    • assets:rpc-proxy:${name} for miniflare/wrangler workers with assets
    • core:user:__vite_proxy_worker__ for vite workers
    • core:user:${name} for plain workers
  • Fixes waitForTimeout in vite↔vite tail handler test

  • 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: Internal dev tooling change, no public API change

@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2026

⚠️ No Changeset found

Latest commit: 45ef645

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Feb 18, 2026
@penalosa penalosa force-pushed the penalosa/native-registry branch 2 times, most recently from b2f8d24 to 5fb825a Compare February 18, 2026 23:05
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 19, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 45ef645

Replace HTTP-based dev registry proxy with native workerd debug port:
- Use WorkerdDebugPort binding for direct Cap'n Proto RPC to remote workers
- Service bindings and DOs now route through debug port instead of HTTP proxy
- Support RPC method calls, fetch, and tail handlers through debug port
- Add HTTP fallback for WebSocket upgrades (debug port RPC doesn't support them)
- Remove old dev-registry.worker.ts HTTP proxy implementation
- Simplify external-service.ts by removing HTTP proxy infrastructure

All 17 dev-registry tests pass including WebSocket upgrades.
The vite dev <-> vite dev tail handler test was missing the waitForTimeout
parameter on one of its waitFor calls, causing it to use the default (shorter)
timeout which could flake in CI.
…port RPC

Remove the HTTP fallback, eager body buffering, _client GC hack, and WebSocket
special-casing from the dev-registry proxy workers. These workarounds existed
because the workerd debug port would close connections prematurely when the
initial subrequest completed. With the refcounted DebugPortConnectionState fix
in workerd (cloudflare/workerd#6100), connections now survive as long as any
response body or WebSocket is in use.

Key changes:
- Replace hasAssets/entryAddress with defaultEntrypointService and
  userWorkerService fields in WorkerDefinition/RegistryEntry
- Route DOs and named entrypoints through userWorkerService (bypassing
  assets/vite proxy layer) instead of hardcoding core:user: prefix
- Validate required registry fields in resolveTarget() to handle stale entries
- Inline and delete getWorkerdServiceName() helper
- Remove dead entryAddress field and fetchViaHttp code path
- Remove DO WebSocket 501 error and DO body buffering workarounds
…uting

Vite workers with assets were incorrectly routing through assets:rpc-proxy
in the dev registry, but in vite dev mode assets are served by the vite
proxy worker, not workerd's asset pipeline. This caused cross-service
fetch to vite workers with assets to fail (timeout).

Add unsafeOverrideDefaultEntrypoint to miniflare's core options schema so
the vite plugin can explicitly specify which workerd service handles the
default entrypoint. This replaces the brittle inference from
unsafeDirectSockets[].serviceName.
…nd tests

After the debug port RPC refactor, unsafeDirectSockets in the user worker
config, vite plugin, and dev-registry tests no longer serve a functional
purpose — nobody reads the socket URLs. The only remaining use is in
wrangler's ProxyController for InspectorProxyWorker (not touched here).
The Reflect.has check already handles keys that exist on the target.
For keys not on the target, the runtime doesn't probe handler properties
through the proxy get trap in a way that requires suppression — confirmed
by tests passing without it.
…ndings instead

Instead of mutating workerOpts with symbol-tagged designators before plugin
processing (requiring every consumer to special-case them), we now let the
plugin system process all bindings normally, then rewrite external service
bindings and tails to point at the dev registry proxy afterward. This follows
the same post-processing pattern already used for assets at line 1673.

Removes kResolvedServiceDesignator, ResolvedServiceDesignator, the zod
validator, and checks in getCustomServiceDesignator, maybeGetCustomServiceService,
and normaliseServiceDesignator.
@penalosa penalosa force-pushed the penalosa/native-registry branch from d3a87ad to 4c37d41 Compare February 19, 2026 10:27
The proxy's get trap now returns values that are both callable (for
env.SERVICE.method()) and thenable (for await env.SERVICE.property),
matching workerd's JsRpcProperty behavior. Without the .then property,
awaiting a proxy-intercepted property would resolve to the function
itself rather than triggering remote resolution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

1 participant

Comments