Share browser hibernation host helpers - #39
Merged
Conversation
Promote the reference HibernationMirror and browser WebSocket upgrade globals into the package API so extension hosts do not copy lifecycle-sensitive shims. The examples and conformance lanes now consume the same exports downstream embedders will use, which makes their passing coverage validate the published path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Rook hibernation integration #146 proved that two pieces of the reference embedder were being copied into downstream hosts: the in-memory hibernation mirror and the browser Request/Response upgrade accommodation. Those copies contain lifecycle-sensitive behavior, so the package should own and test them once.
This follows the hibernatable WebSocket runtime added in do-runtime #37 and matches Cloudflare documentation that
acceptWebSocket()keeps clients connected while the Durable Object is evicted and reconstructed: https://developers.cloudflare.com/durable-objects/best-practices/websockets/What changed
HibernationMirrorfrom the package root, including copied metadata snapshots and rehydration seeding@mcp-b/do-runtime/browserfor the clone-safe Request marker and status-101 Response socketVerification
Downstream
Once the Changesets release publishes, Rook can delete its local
WorkerHibernationMirrorand browser upgrade shim and import these owners directly.