It had been sunny for a week when the storm broke out.
Is this sentence logically valid and sound?
If I think of it, it looks like it means when the storm broke out, it was sunny. There couldn't be stormy weather and sunny weather at the same moment, could it? It's like being both black and white at the same time.
So it would be natural to say "It had been (or was) sunny for a week before the storm broke out", wouldn't it?