Scene, habit or ongoing state: imparfait
Use the imparfait when you look from inside a situation without focusing on its boundary. It sets the scene, describes an action in progress, a past habit or an ongoing state. Long duration does not force the imparfait, and a time phrase alone cannot decide for you.
Je lisais quand tu as appelé.A completed event or the next beat: passé composé
Use the passé composé when the speaker presents an event as completed or moves the story to its next beat. Even a three-hour meeting can use the passé composé if it is presented as one completed event.
La réunion a duré trois heures.Ask what you want the reader to see
In « Il pleuvait quand le bus est arrivé », the rain is the ongoing scene and the bus’s arrival is the next event. Do not begin by measuring how long it rained. Ask what each verb is doing in the story.
Il faisait beau quand je suis arrivée.
