It seems to me that there are often no notifications at all - either of pending attack or of "failed to defend". Often the attack itself seems to be entirely invisible, with not even the settlers reacting to it!
I've been extra cautious after my last bugged settlement defence caused me to lose about 4 hrs of gameplay by reloading. However, in my current game, I've just noticed in Pip-boy one of my large settlements showing a defence warning sign, despite having surplus defence over food + water. I go there, and the place is destroyed.
I back up about twenty minutes in saves (I'm now saving every few minutes to try and catch these mysterious settlement destructions) and go to the settlement - ie should be in plenty of time for the attack, even if its not notified.
Whilst i'm standing there, all the crops start to fall over, the turrets go offline and the generators stop. The settlement is destroyed before my eyes. The settlers appear not to notice anything. Oddly, there is some blood spattered on my field of view, as if I in combat - but there is nothing. No enemy, no gunfire - just my settlement being destroyed.
This game really is bugged to hell (my install is completely vanilla with no mods).