Skip to content

Add initial plumbing for a local explorer worker#12034

Merged
emily-shen merged 7 commits intomainfrom
emily/ui-api
Jan 22, 2026
Merged

Add initial plumbing for a local explorer worker#12034
emily-shen merged 7 commits intomainfrom
emily/ui-api

Conversation

@emily-shen
Copy link
Copy Markdown
Contributor

@emily-shen emily-shen commented Jan 21, 2026

Currently with a no-op local explorer worker.

By commit:

  • create a new fixture with many bindings for testing
  • Add resource api worker to miniflare. This includes an 'unsafeLocalExplorer' flag that we do not set on the proxy miniflare instance in ProxyController. This means the resource api stuff only runs in the user worker's miniflare instance. We also reuse miniflare's magic proxy proxyBindings to give the local explorer worker access to the user's resource bindings, as this already contains the user worker's resource bindings.
  • Add X_LOCAL_EXPLORER to gate this experimental feature

  • 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: experimental feature

A picture of a cute animal (not mandatory, but encouraged)
Screenshot 2026-01-22 at 13 56 52


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: a6b0cff

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

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jan 21, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: a6b0cff

@emily-shen emily-shen marked this pull request as ready for review January 22, 2026 10:58
@emily-shen emily-shen requested a review from a team as a code owner January 22, 2026 10:58
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

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 potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

request = new Request(request, { cf });

// The proxy client will always specify an operation
// The magic proxy client (used by getPlatformProxy) will always specify an operation
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.

For another day... perhaps we should go through the code and change all "magic proxy" (and other references to this) to just be "platform proxy"?

});

afterAll(async () => {
await stop?.();
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.

nit: I find it nice to return a fn from BeforeAll for something init'd there

@emily-shen emily-shen changed the title Add initial plumbing for a resource inspector worker Add initial plumbing for a local explorer worker Jan 22, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View issue and 5 additional flags in Devin Review.

Open in Devin Review

@emily-shen emily-shen force-pushed the emily/ui-api branch 2 times, most recently from 8e8b07b to 85ee118 Compare January 22, 2026 14:38
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View issue and 6 additional flags in Devin Review.

Open in Devin Review


export default class LocalExplorerAPI extends WorkerEntrypoint {
async fetch(): Promise<Response> {
return new Response("Hello from local explorer API");
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.

NIT:

Suggested change
return new Response("Hello from local explorer API");
return Response.json({message: "Hello from local explorer API"});

or

Suggested change
return new Response("Hello from local explorer API");
return Response.json({});

or perhaps some HTTP unimplemented error?

* `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/explorer.
* This is an experimental feature flag. Defaults to false when not set.
*/
export const getLocalExplorerFromEnv = getBooleanEnvironmentVariableFactory({
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.

Can we make this sound more like a boolean flag?

Suggested change
export const getLocalExplorerFromEnv = getBooleanEnvironmentVariableFactory({
export const getLocalExplorerEnabledFromEnv = getBooleanEnvironmentVariableFactory({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm! i'll change that in my next PR though if that's okay!

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jan 22, 2026
@emily-shen emily-shen merged commit 05714f8 into main Jan 22, 2026
45 of 48 checks passed
@emily-shen emily-shen deleted the emily/ui-api branch January 22, 2026 17:34
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jan 22, 2026
@NuroDev NuroDev mentioned this pull request Jan 22, 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.

5 participants