Couldn't we use MongoDB atomicity in some way? In the way that `derive_state` is nonexistent if append was successful in some other thread? That you cannot have `derive_state` still defined but value already in the stream?