Consider lazy durable entity state serialization semantics
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
Línea de trabajo
Comience con la entidad principal de Durable Task, StateShim, y trace cómo set_state(), get_state(), la finalización de operaciones, el rollback y la eliminación gestionan actualmente el estado serializado. Compare la semántica de mutación con otros Durable Entity SDKs antes de decidir si la serialización diferida es adecuada. Añada cobertura para la mutación posterior a set_state, los fallos de serialización, el rollback, la eliminación, las wire payloads sin cambios y varias operaciones en un mismo batch.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 40
- Forks
- 33
- Merge medio
- 2 d 2 h
- PR fusionados (30 d)
- 6
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/durabletask-python
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
microsoft/durabletask-python#268 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
microsoft/durabletask-python#266 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
microsoft/durabletask-python#249 ·
-
bug Functions Parity
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
microsoft/durabletask-python#241 · 2 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
microsoft/durabletask-python#222 ·
Todos los issues de microsoft/durabletask-python
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
canonical/paas-charm#368 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
addition to tracking list Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
StevenBlack/hosts#3256 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
qualcomm/qai-appbuilder#275 ·