Ok the USSR did pursue collective security through Litvinov, helped the Spanish Republic when most democracies stayed neutral, and tried several times to form an anti Nazi front before the West shut the door.
But at the same time, it’s hard to overlook that Molotov-Ribbentrop included a secret protocol dividing Eastern Europe and the Red Army did enter Poland in 1939 and annex those territories, followed by mass arrests and deportations. Even if those regions had large non Polish populations, the incorporation wasn’t a liberation but a was state occupation under Moscow.
So I think both things can be true: the USSR was strongly anti fascist in the 30s and tried to prevent war, and also, once diplomacy failed, it chose realpolitik by cutting a deal with Hitler, partitioning Poland, and expanding westward until 1941. The switch to the Allied side happened only after Barbarossa, not out of ideological unity but because Germany attacked.