fix(rivetkit): unwrap state proxies before persisting to stop exponential proxy nesting - #5582
Conversation
|
Stack for rivet-dev/actors Get stack: change rqtppzkm |
|
🚅 Deployed to the actors-pr-5582 environment in rivet-frontend
|
Code ReviewReviewed the fix for exponential state-proxy nesting ( Findings 1. Commit path bypasses the unwrap, so mutation can still trigger the bug this PR fixes —
2. Map/Set unwrap reorders entries — Unwrapping object-typed Map/Set entries via delete-then-set/add moves any entry whose key/value identity changed during unwrap to the end of iteration order. If application code relies on Map/Set iteration order (ordered tag sets, LRU-style maps), a state spread-and-reassign persist can silently reorder entries even though nothing in app logic reordered them. Worth preserving original position (e.g. rebuild via a single pass that keeps insertion order) if this is a supported state shape. 3. Minor: inconsistent env-var validation —
4. Nit: There are now three separate implementations of Summary The core fix (unwrapping proxies before persist on the setter/initialize paths) looks correct for the reassignment case demonstrated in the new tests, but finding #1 suggests the fix is incomplete for the mutation-based commit path, which can reintroduce the same nested-proxy persistence bug. Recommend addressing that before merge, or explicitly scoping the fix to reassignment-only in the PR description if mutation-triggered commits are out of scope for this change. |
…tial proxy nesting
67cfa59 to
71f371b
Compare
No description provided.