Introduce max_id_ever_seen state

Work in progress. We now use it, but it isn't computed yet.