Skip to content

[explorer] show DO object names where possible#13133

Merged
emily-shen merged 10 commits into
mainfrom
emily/do-names
Apr 9, 2026
Merged

[explorer] show DO object names where possible#13133
emily-shen merged 10 commits into
mainfrom
emily/do-names

Conversation

@emily-shen

@emily-shen emily-shen commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

DOs can be instantiated with a name (idFromName), with an existing id (idFromString) or with a new random id (newUniqueId). When idFromName is used, ctx.id.name is set inside the DO; name cannot be known if initialised with the other methods.

We already wrap user DOs for the local explorer. This PR adds a bit to the constructor that stores a map of object name to hex ID in an internal table __miniflare_do_name. Then, when we list DO objects, we can get the DO name if available and list this alongside the ids.

I've also added a bit to the UI that can find a specific DO by name/id, instead of having to find the listing in the table, which is useful if you have lots of DO instances.

Screenshot 2026-03-31 at 15 33 01
  • 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)

image
Open with Devin

@emily-shen emily-shen requested a review from a team as a code owner March 31, 2026 04:33
@emily-shen emily-shen requested a review from penalosa March 31, 2026 04:33
@changeset-bot

changeset-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 01c5756

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Mar 31, 2026
@emily-shen emily-shen changed the title [explorer] include DO names [explorer] show DO object names where possible Mar 31, 2026
@workers-devprod

workers-devprod commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions

github-actions Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Changeset Review

Summary

All changesets look good

Detailed Review

reject-v8-coverage-provider.md

  • Version Type: patch - appropriate for clearer error messaging
  • Changelog Quality: Good - explains the problem and solution clearly
  • Markdown Headers: None
  • Notes: Well-documented changeset explaining why V8 coverage is rejected and the alternative

c3-frameworks-update-13276.md, c3-frameworks-update-13275.md, c3-frameworks-update-13278.md, c3-frameworks-update-13279.md, c3-frameworks-update-13274.md

  • Status: Skipped (dependency update changesets for create-cloudflare - per rule wrangler tail #5)

tender-dryers-ask.md

  • Version Type: patch - appropriate for autoconfig fix
  • Changelog Quality: Good - explains the behavioral change
  • Markdown Headers: None

email-service-commands.md

  • Version Type: minor - appropriate for new CLI commands
  • Changelog Quality: Good - comprehensive list of all new commands
  • Markdown Headers: None (uses list format, not headers)

use-formatConfigSnippet-in-dev-compat-date.md

  • Version Type: patch - appropriate for format fix
  • Changelog Quality: Good - explains the fix clearly
  • Markdown Headers: None

dependabot-update-13241.md, dependabot-update-13305.md

  • Version Type: patch - appropriate for dependency updates
  • Changelog Quality: Clear table format showing version changes
  • Markdown Headers: None
  • Notes: These are dependabot changesets for miniflare/wrangler (not create-cloudflare), so they are validated

all-fans-march.md

  • Version Type: minor - appropriate for new feature (ReadableStream support)
  • Changelog Quality: Good - explains the feature and its benefit (overcoming 1MB limit)
  • Markdown Headers: None

calm-beers-help.md

  • Version Type: minor - appropriate for experimental feature enhancement
  • Changelog Quality: Good - notes the experimental nature of the feature
  • Markdown Headers: None
  • Experimental Feature Note: Includes "Note: The local explorer is a WIP experimental feature."

good-falcons-remain.md

  • Version Type: minor - appropriate for UI overhaul
  • Changelog Quality: Good - explains the styling changes
  • Markdown Headers: None

images-chainable-handle.md

  • Version Type: patch - appropriate for API alignment fix
  • Changelog Quality: Good - explains the pattern change and references workerd PR
  • Markdown Headers: None

c3-node-version-check.md

  • Version Type: patch - appropriate for error message improvement
  • Changelog Quality: Good - explains the problem and solution
  • Markdown Headers: None

@ask-bonk

ask-bonk Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Now I have a thorough understanding of the changes. Let me analyze the key issue I spotted:

The main concern is in executeListDOObjects in do.ts (lines 265-283). For every object in the paginated list, it instantiates the DO stub and calls GET_DO_NAME_METHOD. This means:

  1. Performance: Every listed DO gets instantiated just to fetch its name. For each DO in the list, a get() call is made which wakes up the DO (or creates it), and then an RPC call is made. With a default page size of 50, this means up to 50 DO instances get woken up on every list call. This is the main concern.

  2. The void ctx.blockConcurrencyWhile(...) in the constructor (line 33) - the void means the promise is fire-and-forget from the constructor's perspective. While blockConcurrencyWhile will prevent concurrent requests from executing until it completes, the void here is correct since constructors can't be async. However, I should check if there's a race condition between the constructor's blockConcurrencyWhile and the GET_DO_NAME_METHOD call.

Actually, thinking more carefully: blockConcurrencyWhile gates all incoming requests to the DO until the callback resolves. So when GET_DO_NAME_METHOD is called via RPC, it won't execute until blockConcurrencyWhile has completed. This is correct.

Let me think about the performance issue more carefully. The DO instances are being woken up anyway in production to serve requests, and this is a local dev explorer tool. The concern is less critical in a local dev context. However, the name is already being persisted to SQLite - why not just read it directly from the SQLite file on disk instead of waking up every DO?

Actually, reading the SQLite file from disk would bypass the DO isolation. The current approach using stubs is the "correct" way to interact with DO storage. And since this is local dev only, the performance is acceptable.

Let me check one more thing - whether the name field could leak undefined into the JSON response when no name is found:

Looking at lines 277-279 of do.ts:

return {
    id,
    name,
    hasStoredData: true,
};

When name is undefined, JSON serialization will omit the property, which matches the test expectations (the unique-id DO entry in the snapshot doesn't have a name field). This is fine.

Let me also check the isHexId function and its implications for the URL routing:

The isHexId function at $objectId.tsx:28 checks for exactly 64 hex characters. If a user names their DO with a 64-character hex string (unlikely but possible), it would be incorrectly treated as an ID rather than a name. This is an edge case but worth noting.

Let me also verify the LocalDODriver constructor - when navigating by name, objectId is null and objectName is the value. The LocalDOConnection constructor checks if (!objectId && !objectName) which would throw if both are falsy. Since null is falsy, this means objectName must be truthy. This is fine since the UI guards against empty input.

Wait, but there's another issue. In the $objectId.tsx loader, objectId and objectName are derived from the same URL param. When isHexId is false, objectName is set to params.objectId. But then LocalDODriver is constructed with new LocalDODriver(namespace.id, null, objectName). The LocalDOConnection will then query using durable_object_name, which calls idFromName() on the server side. This means the DO will be created if it doesn't exist yet - which is expected behavior for idFromName. So that's fine.

Overall the PR looks well-structured. The only actionable concern I see is the performance implication of waking up every DO on list, but given this is a local dev tool and the page is limited to 50, it's pragmatically acceptable. Let me check if there's anything else.

Looking at the void on line 33 of do-wrapper.worker.ts - the returned promise from blockConcurrencyWhile is explicitly voided. This is correct since constructors can't return promises, and blockConcurrencyWhile is designed for exactly this pattern.

One thing I notice: the GET_DO_NAME_METHOD is synchronous (no async), but the type GetDONameMethod in constants.ts declares it as () => string | undefined (not Promise<string | undefined>). When called over RPC via stub[GET_DO_NAME_METHOD](), it returns a promise (since RPC is async). The await in the caller handles this correctly. This is fine.

Let me do one final check on whether the __miniflare_do_name table gets created for non-SQLite DOs:

In the constructor (line 34), ctx.storage.sql is accessed. For non-SQLite DOs, ctx.storage.sql would be undefined, so the if (sql) guard prevents any table creation. Good.

But wait - GET_DO_NAME_METHOD (line 61) also accesses this.ctx.storage.sql for the fallback path. For non-SQLite DOs where ctx.id.name is undefined, this would try to access sql which would be undefined, and the if (sql) guard handles it. Good.

I'm satisfied this PR is well-implemented. No bugs, no security issues, no backward compatibility concerns. The approach is sound for a local dev tool.

LGTM

github run

Comment thread packages/local-explorer-ui/src/routes/do/$className/$objectId.tsx
@pkg-pr-new

pkg-pr-new Bot commented Mar 31, 2026

Copy link
Copy Markdown
create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 01c5756

devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen emily-shen force-pushed the emily/do-names branch 2 times, most recently from e53d6e5 to 658ea88 Compare March 31, 2026 07:27
@NuroDev NuroDev self-requested a review March 31, 2026 11:12
Comment thread .changeset/calm-beers-help.md Outdated
Comment thread packages/local-explorer-ui/src/drivers/do.ts Outdated
Comment thread packages/miniflare/src/workers/core/do-wrapper.worker.ts Outdated
Comment thread packages/local-explorer-ui/src/drivers/do.ts Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Mar 31, 2026
Comment thread packages/miniflare/test/plugins/local-explorer/do.spec.ts
Comment thread packages/miniflare/test/plugins/local-explorer/do.spec.ts Outdated
Comment thread packages/miniflare/test/plugins/local-explorer/do.spec.ts
devin-ai-integration[bot]

This comment was marked as resolved.

emily-shen and others added 3 commits April 7, 2026 14:45
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@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

devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen emily-shen added this pull request to the merge queue Apr 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 7, 2026
@emily-shen emily-shen added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 8, 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
@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
@emily-shen emily-shen added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 42c7ef0 Apr 9, 2026
49 checks passed
@emily-shen emily-shen deleted the emily/do-names branch April 9, 2026 04:10
@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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants