The pandemic seemed to pass over the city-state. Then the government was blindsided by an outbreak among poor migrant workers in packed dormitories.