Skip to content

[Durable Objects] Document ctx.id.jurisdiction and improve ctx.id.name scanability#30900

Merged
vy-ton merged 7 commits into
productionfrom
api-id-name-enhancements
May 27, 2026
Merged

[Durable Objects] Document ctx.id.jurisdiction and improve ctx.id.name scanability#30900
vy-ton merged 7 commits into
productionfrom
api-id-name-enhancements

Conversation

@iglesiasbrandon

@iglesiasbrandon iglesiasbrandon commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR covers two related bodies of work on the Durable Objects ctx.id API documentation:

  1. Improve scanability of the name section in src/content/docs/durable-objects/api/id.mdx (companion to [Durable Objects] Address review feedback on ctx.id.name changelog #30897 which addressed Vy's review feedback on the ctx.id.name changelog).
  2. Document the jurisdiction property of DurableObjectId, which is now generally available (no longer experimental). The property reports the jurisdiction a Durable Object is restricted to ("eu" or "fedramp"), and is now consistently available on ctx.id.jurisdiction inside the Durable Object — including across toString()/idFromString() round-trips and inside alarm handlers for alarms scheduled on 2026-03-15 or later.

Changes

name section scanability (existing commit)

  • Bulleted list for undefined cases. The dense run-on sentence covering idFromString(), names > 1,024 bytes, and newUniqueId() is now a scannable three-bullet list. The newUniqueId() case is consolidated here for completeness (it was previously only in the first paragraph).
  • Alarms tip callout. Added a :::tip[Useful for alarms]::: callout between the bulleted list and the existing historical-caveat note. Alarms are the strongest use case for ctx.id.name — when an alarm fires, no client called the DO, so ctx.id.name is the only way to know which named object woke up. The existing historical-caveat note (pre-2026-03-15 alarms) is preserved unchanged.
  • In-DO code example. Added a new <Tabs> group (JavaScript + Python) showing ctx.id.name usage inside a Durable Object class, placed after the existing client-side code examples.

jurisdiction documentation (new commit)

File Change
src/content/changelog/durable-objects/2026-05-18-durable-object-id-jurisdiction.mdx New changelog entry announcing GA
src/content/docs/durable-objects/api/id.mdx New ### jurisdiction section under Properties, modeled after the existing ### name section
src/content/docs/durable-objects/reference/data-location.mdx New discoverability hook linking from the jurisdiction conceptual page to the new API reference

Upstream sources:

Related

Documentation checklist

- Break up the dense 'undefined' sentence into a bulleted list, and
  consolidate the newUniqueId() case into the same list for completeness.
- Add a tip callout highlighting alarms as a primary use case for
  ctx.id.name (companion to the existing historical-caveat note).
- Add an in-Durable-Object code example (JavaScript and Python) showing
  ctx.id.name in use, alongside the existing client-side examples.
@github-actions github-actions Bot added product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ size/s labels May 18, 2026
@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/product-owners
/src/content/docs/durable-objects/ @elithrar, @vy-ton, @joshthoward, @oxyjun, @lambrospetrou, @mikenomitch, @cloudflare/product-owners

@iglesiasbrandon iglesiasbrandon changed the title [Durable Objects] Improve scanability of api/id.mdx name section [Durable Objects] Document ctx.id.jurisdiction and improve ctx.id.name scanability May 19, 2026
Comment thread src/content/docs/durable-objects/api/id.mdx Outdated
- Changelog: drop experimental flag framing; clarify idFromString bullet
- id.mdx: invert 'jurisdiction' section framing to lead with availability
  and enumerate only the two undefined cases

`jurisdiction` is preserved across every ID-construction path, including:

- IDs created from a jurisdiction-restricted subnamespace, for example `env.MY_DURABLE_OBJECT.jurisdiction("eu").idFromName("foo")` or `.newUniqueId()`.

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.

a lot of detail for the changelog. Let's make sure these bullets are in API reference docs and link to from the sentence above

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated, thank you!

date: 2026-03-26
---

`ctx.id.jurisdiction` inside a Durable Object now reports the [jurisdiction](/durable-objects/reference/data-location/#restrict-durable-objects-to-a-jurisdiction) that the object was created in, matching the value seen client-side. If a Worker accesses a Durable Object through a jurisdiction-restricted namespace — for example `env.MY_DURABLE_OBJECT.jurisdiction("eu")` — the same jurisdiction is available on `ctx.id.jurisdiction` inside the object, so you can make region-aware decisions without passing the jurisdiction through method arguments or persisting it in storage.

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.

Second sentence repeats the same info, I would combine into 1

- The Durable Object was created with `newUniqueId()`.

:::tip[Useful for alarms]
`ctx.id.name` is especially useful inside [alarm handlers](/durable-objects/api/alarms/), where there is no calling client to pass the name as an argument. When the alarm fires, `ctx.id.name` holds the same name the object was originally accessed with.

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.

Combine with note below for single one for alarms behavior

Comment thread src/content/docs/durable-objects/api/id.mdx Outdated

<Tabs>

<TabItem label="JavaScript" icon="seti:javascript">

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.

Add Typescript tab too

iglesiasbrandon and others added 3 commits May 21, 2026 09:18
…t-id-jurisdiction.mdx

Co-authored-by: Vy Ton <vy@cloudflare.com>
Co-authored-by: Vy Ton <vy@cloudflare.com>
- Changelog: collapse duplicate sentences in the opening paragraph
  into one and remove the 4-bullet ID-construction-path list (info now
  lives in the API reference, with an inline link from the changelog).
- API reference: merge the 'Useful for alarms' tip and pre-2026-03-15
  note in the name section into a single Alarms callout.
- API reference: add TypeScript tabs to both Tabs groups in the name
  section for consistency with the JavaScript and Python examples.
- API reference: add the 'preserved across every ID-construction path'
  bullets to the jurisdiction section so the detail dropped from the
  changelog has a home in the reference docs.

Per Vy Ton's review on #30900.
@iglesiasbrandon
iglesiasbrandon requested a review from vy-ton May 21, 2026 16:01
@vy-ton
vy-ton marked this pull request as ready for review May 27, 2026 21:19
@vy-ton
vy-ton requested a review from a team as a code owner May 27, 2026 21:19
@vy-ton
vy-ton merged commit be46a18 into production May 27, 2026
21 checks passed
@vy-ton
vy-ton deleted the api-id-name-enhancements branch May 27, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants