decodeState

fun <S : Any> decodeState(model: AggregateModel<S>, text: String): S

The state text of a snapshot, read as model's state class: a Jackson exception when it does not parse, an IllegalArgumentException when the state read does not write back as the same JSON. A state that silently dropped what it could not take back (a read-only property Jackson does not fill) would decide on lost data; a computed property writes back the same and passes.

The same JSON is the same value, not the same text (sameJson): a backend may give back the state it stores normalised, PostgreSQL JSONB with its keys reordered and 1.0E10 as 10000000000, and such a snapshot still loads. A state whose value does not survive the round trip, a number its property cannot hold or a property it cannot take back, is still refused.