Repository navigation
Commit c49ea83
Declare state stores shared by 0.9 and 0.10 instances unsupported (#7494)
* Save states with the schema hash 0.9 workers check
Since #7461, `_serialize` wrote the new `_to_schema` hash (field names and
types only) next to each pickled state. Workers of 0.9.x and 0.10.0a1 compare
that hash with their own, which includes the defaults, and replace the state
with a fresh one on any mismatch. A rolling deploy or a rollback sharing Redis
or the disk state manager with them therefore silently reset every session,
and the old worker wrote the fresh state back, so the data was lost for good.
The rest of the payload was already readable by those workers.
Save the previous format's hash (`_legacy_state_schema`, now cached like
`_to_schema`) next to the pickle, and record the new hash inside the pickled
dict under `__reflex_schema__`. Older workers keep that entry as a plain
instance attribute and write it back, which stays correct because they only
accept a state whose names, types and defaults match their own.
`_deserialize` checks the recorded hash when present, so defaults remain
outside the schema for this release, and falls back to the saved hash for
pickles from 0.10.0a2 and older releases.
Fixes #7470
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjCrbdguMkfe4bhbaREiwo
* Serialize non-class field types in the previous-release schema helper
The helper that recomputes the hash 0.9 workers check mirrored only the
class branch of the old _serialize_type, so a state with a generic or
union annotation would raise instead of being checked. Mirror the other
branch too, as the 0.9.12 implementation did.
Refs #7470
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjCrbdguMkfe4bhbaREiwo
* Declare state stores shared by 0.9 and 0.10 instances unsupported
Drop the change that wrote the 0.9 schema hash next to each pickled state so
0.9 and 0.10.0a1 workers could load state saved by this release, and restore
reflex/state.py and its tests to main. Instead, a `breaking` news fragment and
the Self Hosting docs state that instances of 0.9 and 0.10 cannot share a
Redis or disk state store: 0.10 still loads state saved by 0.9, but a 0.9
instance discards state saved by 0.10, so a rolling deploy that runs both
versions, or a rollback against the same store, resets the sessions that reach
the older instance. The field-descriptors fragment no longer claims that
states saved by this release load in workers of the previous one, which has
not held since the names-and-types schema hash.
Refs #7470
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjCrbdguMkfe4bhbaREiwo
* Stop saving the entries that let 0.9 workers load a pickle
`__getstate__` added empty `dirty_vars`, `dirty_substates` and
`_backend_vars` entries so workers of the previous release could restore
a state of this one. Those workers never get past the schema check on a
state saved by this release, so the entries only made every pickle
larger. `__setstate__` keeps dropping them, and the `_backend_vars` dict,
from pickles written by 0.9 and 0.10.0a2 workers.
Refs #7470
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjCrbdguMkfe4bhbaREiwo
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent aed9b15 commit c49ea83
5 files changed
Lines changed: 30 additions & 11 deletions
File tree
- docs/hosting
- news
- reflex
- tests/units
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 100 | | |
109 | 101 | | |
110 | 102 | | |
| |||
2049 | 2041 | | |
2050 | 2042 | | |
2051 | 2043 | | |
2052 | | - | |
2053 | | - | |
| 2044 | + | |
2054 | 2045 | | |
2055 | 2046 | | |
2056 | 2047 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6671 | 6671 | | |
6672 | 6672 | | |
6673 | 6673 | | |
| 6674 | + | |
| 6675 | + | |
| 6676 | + | |
| 6677 | + | |
| 6678 | + | |
| 6679 | + | |
| 6680 | + | |
| 6681 | + | |
| 6682 | + | |
| 6683 | + | |
| 6684 | + | |
| 6685 | + | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
| 6689 | + | |
| 6690 | + | |
| 6691 | + | |
| 6692 | + | |
| 6693 | + | |
6674 | 6694 | | |
6675 | 6695 | | |
6676 | 6696 | | |
| |||
0 commit comments