Commit cfe5070
fix(cached-adapter-store): read persisted hash with string default to avoid numeric coercion
fs-storage `get(key, default)` returns the raw stored string only for a
string default; a non-string default (e.g. `null`) drives the `JSON.parse`
branch. `put` stores strings raw, so an all-numeric, no-leading-zero hash
(the `crc32b(uuid())` shape kendo's backend emits, e.g. `'55776784'`)
round-tripped back as a Number. `localHash` then never strict-equaled the
string server hash, so skip-when-equal never matched and a spurious
`retrieveAll()` fired on every affected cold page-load.
Read the persisted hash with a string default (raw value returned verbatim)
and normalize the empty-string sentinel back to `null` so the
`localHash !== null` cold-start guard is preserved. Behavior is unchanged for
the null and non-numeric-string cases; only the all-numeric case is corrected.
Regression test exercises the REAL fs-storage round-trip (the existing stub
ignores the default and is blind to this bug): an all-numeric persisted hash
equal to the server hash now skips the inner fetch. Verified failing against
the old `null`-default line and passing against the fix.
Bumps to 0.2.3 + adds the package CHANGELOG. Closes enforcement queue #130;
mirrors wijs PR #122.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1C8cLed2opuG5H6MFVssS1 parent 90a2284 commit cfe5070
4 files changed
Lines changed: 66 additions & 2 deletions
File tree
- packages/cached-adapter-store
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
215 | 227 | | |
216 | 228 | | |
217 | 229 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
1209 | 1210 | | |
1210 | 1211 | | |
1211 | 1212 | | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1212 | 1257 | | |
0 commit comments