I don't see why 9 wouldn't see the pending keydir?  Recall if frozen we should be blocking at step 7 until after step 8 when the pending and main keydirs should be merged.

Also: Is there a way to model each keydir as a dict, which we then retain a pointer to when a fold happens?