Repository navigation
Commit 378d403
committed
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_01SjCrbdguMkfe4bhbaREiwo1 parent 8239259 commit 378d403
3 files changed
Lines changed: 161 additions & 23 deletions
| 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 | + | |
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
| |||
1071 | 1076 | | |
1072 | 1077 | | |
1073 | 1078 | | |
1074 | | - | |
| 1079 | + | |
1075 | 1080 | | |
| 1081 | + | |
1076 | 1082 | | |
1077 | 1083 | | |
1078 | 1084 | | |
| |||
2040 | 2046 | | |
2041 | 2047 | | |
2042 | 2048 | | |
2043 | | - | |
| 2049 | + | |
2044 | 2050 | | |
2045 | 2051 | | |
2046 | 2052 | | |
| |||
2049 | 2055 | | |
2050 | 2056 | | |
2051 | 2057 | | |
2052 | | - | |
2053 | | - | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
2054 | 2065 | | |
2055 | 2066 | | |
2056 | 2067 | | |
| |||
2135 | 2146 | | |
2136 | 2147 | | |
2137 | 2148 | | |
2138 | | - | |
| 2149 | + | |
| 2150 | + | |
2139 | 2151 | | |
2140 | 2152 | | |
2141 | 2153 | | |
| |||
2207 | 2219 | | |
2208 | 2220 | | |
2209 | 2221 | | |
2210 | | - | |
2211 | | - | |
2212 | | - | |
2213 | | - | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
2214 | 2225 | | |
2215 | 2226 | | |
2216 | 2227 | | |
2217 | 2228 | | |
| 2229 | + | |
2218 | 2230 | | |
2219 | | - | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
2220 | 2237 | | |
2221 | 2238 | | |
2222 | 2239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
5573 | 5574 | | |
5574 | 5575 | | |
5575 | 5576 | | |
| 5577 | + | |
| 5578 | + | |
| 5579 | + | |
| 5580 | + | |
| 5581 | + | |
| 5582 | + | |
| 5583 | + | |
| 5584 | + | |
| 5585 | + | |
| 5586 | + | |
| 5587 | + | |
| 5588 | + | |
| 5589 | + | |
| 5590 | + | |
| 5591 | + | |
| 5592 | + | |
| 5593 | + | |
| 5594 | + | |
| 5595 | + | |
| 5596 | + | |
| 5597 | + | |
| 5598 | + | |
| 5599 | + | |
| 5600 | + | |
| 5601 | + | |
| 5602 | + | |
| 5603 | + | |
| 5604 | + | |
| 5605 | + | |
| 5606 | + | |
| 5607 | + | |
| 5608 | + | |
| 5609 | + | |
| 5610 | + | |
| 5611 | + | |
| 5612 | + | |
| 5613 | + | |
| 5614 | + | |
| 5615 | + | |
| 5616 | + | |
| 5617 | + | |
| 5618 | + | |
| 5619 | + | |
| 5620 | + | |
| 5621 | + | |
| 5622 | + | |
| 5623 | + | |
| 5624 | + | |
| 5625 | + | |
| 5626 | + | |
| 5627 | + | |
| 5628 | + | |
| 5629 | + | |
5576 | 5630 | | |
5577 | 5631 | | |
5578 | 5632 | | |
5579 | 5633 | | |
5580 | 5634 | | |
5581 | 5635 | | |
5582 | 5636 | | |
5583 | | - | |
5584 | | - | |
5585 | | - | |
5586 | | - | |
5587 | | - | |
5588 | | - | |
5589 | | - | |
5590 | | - | |
5591 | | - | |
5592 | | - | |
5593 | | - | |
5594 | | - | |
5595 | | - | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
5596 | 5642 | | |
5597 | 5643 | | |
5598 | 5644 | | |
| |||
5602 | 5648 | | |
5603 | 5649 | | |
5604 | 5650 | | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
| 5691 | + | |
| 5692 | + | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
| 5703 | + | |
| 5704 | + | |
| 5705 | + | |
| 5706 | + | |
| 5707 | + | |
| 5708 | + | |
| 5709 | + | |
| 5710 | + | |
| 5711 | + | |
| 5712 | + | |
| 5713 | + | |
| 5714 | + | |
| 5715 | + | |
| 5716 | + | |
| 5717 | + | |
| 5718 | + | |
| 5719 | + | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
| 5724 | + | |
5605 | 5725 | | |
5606 | 5726 | | |
5607 | 5727 | | |
| |||
0 commit comments