Repository navigation
fix: DurableObjectState publishes only workerd's members (#256) - #260
Merged
Merged
Conversation
- `_blockConcurrencyWhile`, `_runConcurrencyBlock`, `_resetAfterConcurrencyFailure`, `_ready` and `_socket` were non-enumerable members of the state's prototype, reachable from guest code; workerd has none of them. They are `#`-private instance methods now, and the class's static block hands the runtime the three closures it needs (`__stateReady`, `__stateSocket`, `__stateFailBlock`). The bodies are unchanged, so nesting, the 30-second limit, the nested-block drain, the failure reset and hibernatable socket dispatch keep their semantics; this is a surface change, not a behavioral one. - The state's prototype members are enumerable as workerd's are, so `Object.getOwnPropertyNames(Object.getPrototypeOf(ctx))` and `Object.keys` of it answer workerd's list. - The differential gate gains `do/state-surface` (233 total): it pins the tag, own keys, prototype chain, the absence of every internal name and a nested block through the public API. It fails on the parent commit. - Docs: changelog entry, cloudflare-compat.md (the state is clean; `ctx.facets` is the remaining object with host-internal prototype helpers), and the Durable Objects reflection row.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 24, 2026
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.
Closes #256
DurableObjectState.prototypecarried_ready,_socket,_blockConcurrencyWhile,_runConcurrencyBlockand_resetAfterConcurrencyFailure: non-enumerable, but reachable from guest code, and workerd has none of them. Left by #254 as a separate refactor.Change
#-private instance methods now. The class's static block hands the runtime the three entry points it reaches from outside (__stateReady,__stateSocket,__stateFailBlock), which replace the call sites in_readyInstance, the four__ws*dispatch paths andprocess.exit. The bodies are unchanged, so nesting, the 30-second limit, the nested-block drain, the failure reset and hibernatable WebSocket dispatch are the same code — this is a surface change, not a behavioural one.__webidlPrototype(DurableObjectState)), soObject.keysandObject.getOwnPropertyNamesof the prototype answer workerd's list.Verification
do/state-surface(233 total) pins the tag, enumerable own keys, the sorted prototype chain, the absence of every internal name (Object.getOwnPropertyNames(proto)has no_member andtypeof ctx._readyisundefined) and a nestedblockConcurrencyWhilethrough the public API. It DIVERGES on the parent commit (5590070); on this head all 233 cases agree.cargo test --profile ci --locked -p cello --no-fail-fastexit 0, 66 suites ok (covers block concurrency, transactions, hibernatable sockets and disconnect retention).cargo clippy --profile ci --locked --all-targets -- -D warnings,cargo fmt --check,node scripts/check-docs.mjsclean.mainafter fix: Durable Object and D1 surface leftovers match workerd (#251) #254 merged needed no manual resolution.Docs: changelog #256 entry;
cloudflare-compat.mdrecords that the state no longer publishes host-internal members and thatctx.facetsis the only object left with_-prefixed prototype helpers (non-enumerable, unsupported, out of this issue); the Durable Objects reflection row is updated.