When they went upstairs to the crowded common room, it was to find Fred and George had set off half a dozen Dungbombs in a fit of end-of-term high spirits.
-- Harry Potter and the Prisoner of Azkaban by J.K. Rowling
It was to find~ doesn’t seem like a regular cleft structure. What kind of one is it?