Consider lazy durable entity state serialization semantics
還沒有人認領這個 Issue。
評估
研究方向
從核心 Durable Task 實體 StateShim 開始,追蹤 set_state()、get_state()、操作完成、回滾和刪除目前如何處理序列化狀態。在決定延遲序列化是否適當之前,將 mutation 語義與其他 Durable Entity SDKs 進行比較。為 set_state 後的 mutation、序列化失敗、回滾、刪除、未變更的 wire payload,以及單一 batch 中的多個操作新增涵蓋。
由索引模型根據 Issue 內容生成。
描述
Summary
Durable entity state is currently serialized eagerly when set_state() is called. This snapshots the value immediately, so mutations made to the same Python object after set_state() do not affect the state eventually persisted at the end of the operation.
state = Point(1)
self.set_state(state)
state.value = 99
The persisted state is Point(1), not Point(99).
This may surprise Python users who expect ordinary reference semantics and could introduce subtle bugs when entity code mutates an object after passing it to set_state().
Scope
The behavior is implemented in the core durabletask entity StateShim, so it affects core durabletask entities and providers built on it, including durabletask-azuremanaged and azure-functions-durable.
Current rationale
Eager serialization was introduced intentionally to:
- surface serialization errors inside the operation that called
set_state(); - preserve per-operation rollback behavior in an entity batch;
- retain the original serialized wire payload when state is unmodified; and
- prevent mutations to values returned by
get_state()from implicitly changing persisted state without a correspondingset_state().
Design question
Should set_state() retain the live value and defer serialization until successful operation completion, so mutations made after set_state() but before the operation returns are persisted?
If so, the design needs to define:
- whether
get_state()afterset_state()returns the same pending live object or a reconstructed copy; - where serialization occurs so serialization failures still fail and roll back the current operation;
- behavior across multiple operations in one entity batch;
- compatibility implications of changing
set_state()from snapshot-at-call semantics to retain-reference-until-commit semantics; and - consistency with Durable Entity semantics in other language SDKs.
Suggested investigation
- Compare mutation semantics with other Durable Entity SDKs.
- Prototype deferred serialization at the operation commit boundary.
- Add tests for post-
set_state()mutation, serialization failure, rollback, deletion, unmodified wire payloads, and multiple operations in one batch. - Document the current requirement to perform mutations before the final
set_state()call unless the behavior changes.
- 主要語言
- Python
- 星號
- 40
- 分支
- 33
- 平均合併
- 2 天 2 小時
- 30 天內合併 PR
- 6
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/durabletask-python 的其他 Issue
-
難度 5/5 一週以上 新手友好度 45/100
microsoft/durabletask-python#268 ·
-
難度 3/5 1-2 天 新手友好度 72/100
microsoft/durabletask-python#266 ·
-
難度 5/5 一週以上 新手友好度 38/100
microsoft/durabletask-python#249 ·
-
bug Functions Parity
難度 5/5 一週以上 新手友好度 35/100
microsoft/durabletask-python#241 · 2 則留言 ·
-
難度 3/5 1-2 天 新手友好度 76/100
microsoft/durabletask-python#222 ·
查看 microsoft/durabletask-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
anthropics/skills#1811 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·