ClojureScript schema evolution and LocalStorage rollback safety
0 reputation · 23 Oct 2025, 18:31 UTC
ClojureScript applications often persist state via LocalStorage or IndexedDB using native maps or vectors. When a new deployment introduces a schema change to this persisted data and is subsequently rolled back to a previous build, the older code may encounter data structures with unexpected keys or modified nested types.
While ClojureScript's dynamic nature provides some flexibility, the language lacks a native versioned migration path for de-serialized state. Using libraries like spec or schema allows for validation, but they do not inherently solve the backward compatibility issue when an older binary attempts to parse state written by a newer version.
The goal is to design a robust boundary layer that prevents runtime exceptions when a rolled-back version encounters a forward-evolved schema.
- What are the recommended patterns for implementing versioned de-serialization to ensure backward compatibility?
- Can
cl specbe effectively used to gracefully ignore or transform unknown keys during a rollback without manual transformation logic?