Rule reminder
Use trapassato prossimo to describe what had already happened by a certain past moment.
Quando ho aperto il frigo, qualcuno … (mangiare) tutti i dolci.