Introduce max_id_ever_seen state

we now compute, store, and later use, a `max_id_ever_seen` state.