As heat waves become longer and more common, communities have to prepare—and prepare to fail