Skip to content

Commit 2684ca8

Browse files
github-actions[bot]threepointone
authored andcommitted
Version Packages
1 parent d86c61c commit 2684ca8

10 files changed

Lines changed: 47 additions & 41 deletions

File tree

.changeset/setname-bootstrap.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

fixtures/chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"nanoid": "^5.1.9",
12-
"partyserver": "^0.5.1",
12+
"partyserver": "^0.5.2",
1313
"partysocket": "^1.1.18",
1414
"react": "^19.2.5",
1515
"react-dom": "^19.2.5"

fixtures/globe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"cobe": "^2.0.1",
12-
"partyserver": "^0.5.1",
12+
"partyserver": "^0.5.2",
1313
"partysocket": "^1.1.18",
1414
"react": "^19.2.5",
1515
"react-dom": "^19.2.5"

fixtures/hono/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dependencies": {
1111
"hono": "^4.12.15",
1212
"hono-party": "^2.1.0",
13-
"partyserver": "^0.5.1",
13+
"partyserver": "^0.5.2",
1414
"partysocket": "^1.1.18",
1515
"react": "^19.2.5",
1616
"react-dom": "^19.2.5"

fixtures/tiptap-yjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@tiptap/extension-collaboration": "^3.22.4",
1212
"@tiptap/react": "^3.22.4",
1313
"@tiptap/starter-kit": "^3.22.4",
14-
"partyserver": "^0.5.1",
14+
"partyserver": "^0.5.2",
1515
"react": "^19.2.5",
1616
"react-dom": "^19.2.5",
1717
"tailwindcss": "^4.2.4",

fixtures/tldraw/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"start": "vite dev"
88
},
99
"dependencies": {
10-
"partyserver": "^0.5.1",
10+
"partyserver": "^0.5.2",
1111
"partysocket": "^1.1.18",
1212
"react": "^19.2.5",
1313
"react-dom": "^19.2.5",

fixtures/todo-sync/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dependencies": {
1111
"nanoid": "^5.1.9",
1212
"partyfn": "^0.1.0",
13-
"partyserver": "^0.5.1",
13+
"partyserver": "^0.5.2",
1414
"partysocket": "^1.1.18",
1515
"partysync": "^2.1.0",
1616
"react": "^19.2.5",

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/partyserver/CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# partyflare
22

3+
## 0.5.2
4+
5+
### Patch Changes
6+
7+
- [#383](https://github.com/cloudflare/partykit/pull/383) [`fe030f6`](https://github.com/cloudflare/partykit/commit/fe030f62348c7556a57132a4d135a31e71ba21c1) Thanks [@threepointone](https://github.com/threepointone)! - `setName()` is now the sanctioned bootstrap API for non-`idFromName` DOs.
8+
9+
When `ctx.id.name` is undefined (e.g. Cloudflare Agents facets, which are spawned via `ctx.facets.get(...)` rather than `idFromName()`), `setName(name)` now persists the name to the legacy `__ps_name` storage key in addition to stashing it in memory. This means cold-wake invocations of the DO recover the name through `#ensureInitialized()`'s legacy storage fallback without the framework having to reach into PartyServer's private storage layout.
10+
11+
Frameworks that previously did:
12+
13+
```ts
14+
await this.ctx.storage.put("__ps_name", name);
15+
await this.__unsafe_ensureInitialized();
16+
```
17+
18+
can now do:
19+
20+
```ts
21+
await this.setName(name);
22+
```
23+
24+
Backward compatible:
25+
26+
- For DOs addressed via `idFromName()` / `getByName()` (the happy path), `setName()` continues to NOT write storage — `ctx.id.name` is the source of truth and `setName()` is just a no-op-plus-onStart.
27+
- The pre-existing direct-storage-write pattern keeps working — the storage write becomes idempotent with what `setName()` would do.
28+
29+
`setName()`'s `@deprecated` docblock has been clarified: it remains the supported API for framework-level bootstrap of non-`idFromName` DOs and for delivering initial `props` to `onStart()`. The deprecation only applies to redundant calls on DOs that were addressed via `idFromName()`.
30+
331
## 0.5.1
432

533
### Patch Changes
@@ -9,6 +37,7 @@
937
0.5.0 moved the legacy storage hydrate into `alarm()` only, breaking Cloudflare Agents facets and any other framework that writes `__ps_name` directly before calling `__unsafe_ensureInitialized()`. Facet DOs are spawned via `ctx.facets.get(...)` rather than `idFromName()` and therefore have `ctx.id.name === undefined`; they relied on PartyServer reading the storage record back to populate `this.name` before `onStart()`.
1038

1139
Changes:
40+
1241
- Move the legacy `__ps_name` hydrate from `alarm()` into `#ensureInitialized()`, still gated on `!ctx.id.name && !#_name` so it costs nothing on the happy path (normal `idFromName()`/`getByName()` DOs skip the storage read entirely).
1342
- `Server.fetch()` now delegates to `#ensureInitialized()` for the hydrate instead of doing its own. The `x-partykit-room` header fallback remains as a last resort when neither `ctx.id.name` nor a legacy storage record is available.
1443
- `Server.alarm()` is simplified — it no longer needs its own hydrate call since `#ensureInitialized()` handles it.
@@ -23,6 +52,7 @@
2352
Durable Objects now expose `ctx.id.name` on every entry point (constructor, fetch, alarm, hibernating websocket handlers) when the DO is addressed via `idFromName()`/`getByName()`. PartyServer now uses this as the primary source of `this.name`, which simplifies routing, eliminates storage writes, and makes `this.name` available inside the constructor.
2453

2554
Changes in `partyserver`:
55+
2656
- `this.name` resolves from `this.ctx.id.name`. The apologetic `workerd#2240` error message is gone.
2757
- `this.name` is now available **inside the constructor** and from class field initializers, not just after `setName()`/`fetch()` has run.
2858
- `routePartykitRequest` no longer issues a `setName()`/`_initAndFetch()` RPC before `fetch()`. The WebSocket path goes from 2 RPCs to 1; the HTTP path remains 1 RPC. Props, when supplied, are delivered to the DO via the `x-partykit-props` request header, set after `onBeforeConnect`/`onBeforeRequest` hooks run.
@@ -34,6 +64,7 @@
3464
- When reading `this.name` throws, it is because `ctx.id.name` is undefined and no legacy fallback has populated the name: the DO was addressed via `idFromString()` or `newUniqueId()` (both unsupported), the runtime is too old to expose `ctx.id.name`, or a pre-2026-03-15 alarm fired before the legacy storage fallback ran.
3565

3666
Changes in all affected packages (`partyserver`, `partysub`, `partysync`, `y-partyserver`, `hono-party`):
67+
3768
- `@cloudflare/workers-types` peer dependency bumped from `^4.20240729.0` to `^4.20260424.1`. The old range predates `ctx.id.name` in the type surface.
3869

3970
Not supported: addressing PartyServer DOs via `idFromString()` or `newUniqueId()`. These paths return `ctx.id.name === undefined` inside the DO and will surface as a clear error from `this.name`. PartyServer has always assumed name-based addressing via `getServerByName` / `routePartykitRequest`; this release makes that assumption explicit.
@@ -354,12 +385,14 @@
354385
### Patch Changes
355386

356387
- [`528adea`](https://github.com/threepointone/partyserver/commit/528adeaced6dce6e888d2f54cc75c3569bf2c277) Thanks [@threepointone](https://github.com/threepointone)! - some fixes and tweaks
388+
357389
- getServerByName was throwing on all requests
358390
- `Env` is now an optional arg when defining `Server`
359391
- `y-partyserver/provider` can now take an optional `prefix` arg to use a custom url to connect
360392
- `routePartyKitRequest`/`getServerByName` now accepts `jurisdiction`
361393

362394
bonus:
395+
363396
- added a bunch of fixtures
364397
- added stubs for docs
365398

packages/partyserver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "partyserver",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"repository": {
55
"type": "git",
66
"url": "git://github.com/cloudflare/partykit.git"

0 commit comments

Comments
 (0)