Skip to content

Fix how local explorer handles multiple workers bound to the same resource#13336

Merged
NuroDev merged 10 commits intomainfrom
emily/workers-api
Apr 9, 2026
Merged

Fix how local explorer handles multiple workers bound to the same resource#13336
NuroDev merged 10 commits intomainfrom
emily/workers-api

Conversation

@emily-shen
Copy link
Copy Markdown
Contributor

@emily-shen emily-shen commented Apr 8, 2026

754e51c - update fixture to include resources shared between workers, for testing.

57b6706 - scaffold /local/workers endpoint

  • i've renamed /workers endpoint to /local/workers to prevent confusion with the /workers/workers (list worker scripts) endpoint, which we've not implemented.
  • adds bindings property to /local/workers response. This replaces the 'worker' property that was previously added to resource listing endpoints, which incorrectly implies a 1-1 resource to worker mapping, and is also a divergence from the actual list API endpoint

f270697 - plumb binding config from miniflare to explorer worker

  • passes a filtered subset of miniflare options to the explorer worker as a JSON binding. note there is some duplication and cleaning up that can be done between the explorer worker's JSON bindings, but i'm leaving that alone for now to make this PR easier to review.

6ae37cc - update sidebar/ui

  • use the per-worker bindings info to populate the sidebar, instead of listing and filtering for each resource type.

80ce34a - preserve worker search param on navigation
previously, the selected worker in the sidebar would change when navigating between D1 tables etc.

da577bd - remove workerName from list endpoints


  • 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: wip thing

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


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: 119b8b7

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

@workers-devprod workers-devprod requested review from a team and vicb and removed request for a team April 8, 2026 06:02
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 8, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

✅ All changesets look good

Summary

Reviewed 4 changeset files:

  1. eleven-wolves-cry.md - Minor bump for @cloudflare/local-explorer-ui and miniflare

    • Experimental feature properly noted
    • Clear description of the fix
    • No markdown headers
  2. fix-ai-search-remote-bindings.md - Patch bump for wrangler

    • Appropriate version type for bug fix
    • Detailed description explaining the issue and fix
    • No markdown headers
  3. c3-frameworks-update-13358.md - Patch bump for create-cloudflare

    • Dependency update (exempt from detailed validation per guidelines)
    • Clear table showing what changed
    • No markdown headers
  4. calm-beers-help.md - Minor bump for @cloudflare/local-explorer-ui and miniflare

    • Experimental feature properly noted
    • Clear description of the feature
    • No markdown headers

All changesets comply with the formatting guidelines from .changeset/README.md.

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

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

Minor note: the /api/local/workers handler fetches the dev registry twice per request — once at line 351 to build localWorkers, and again inside getPeerUrlsIfAggregating at line 370 (which internally calls loopback.fetch("http://localhost/core/dev-registry") again). This is a redundant loopback call on every request. Not blocking, but worth noting for a future cleanup.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 8, 2026

LGTM

The changes are clean and well-structured. The PR correctly:

  1. Renames /workers to /local/workers to avoid confusion with the Cloudflare API.
  2. Adds per-worker bindings to the workers endpoint response, replacing the previous approach of filtering flat resource lists by workerName.
  3. Preserves the worker query param across navigation using the search: (prev) => ({ ...prev, ... }) pattern.
  4. Extracts getSelectedWorker as a reusable utility.
  5. Properly handles cross-instance aggregation by having each peer provide its own workers with bindings.
  6. Includes good test coverage for the new endpoint with multi-instance scenarios.

The only minor observation I left was about the duplicate dev-registry fetch in the /api/local/workers handler, which is a non-blocking cleanup opportunity.

github run

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 7 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 119b8b7

@emily-shen emily-shen marked this pull request as draft April 8, 2026 06:33
@emily-shen emily-shen marked this pull request as ready for review April 8, 2026 09:43
Copy link
Copy Markdown
Member

@NuroDev NuroDev left a comment

Choose a reason for hiding this comment

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

I'm also seeing locally that the fixture types need to be updated:

❓ Your types might be out of date. Re-run `wrangler types` to ensure your types are correct.

@emily-shen emily-shen requested a review from NuroDev April 9, 2026 05:03
Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

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 Apr 9, 2026
@emily-shen emily-shen added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@NuroDev NuroDev added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@emily-shen emily-shen added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@NuroDev NuroDev added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit a42e0e8 Apr 9, 2026
92 of 93 checks passed
@NuroDev NuroDev deleted the emily/workers-api branch April 9, 2026 10:17
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants