All of this requires that batches is already sorted (the .last here and in the VersionedStore, and the existing progression?).  I had assumed it was guaranteed to be sorted already.  If this is not the case, maybe it should just be sorted at the top?