It wasn’t an alliance in a ‘friendly’ sense. More like two warring mafioso defining the boundaries of the turf war. Poland’s geography means it got shafted by two totalitatarian dictatorships. Stalin’s goal appears to have been to buy some time by creating strategic depth before Germans could bust into the pre pact borders of the Soviet Union. The planning for operation that became Barbarossa in june 41 was on the table in october 1940. Stalin would have known this. However he ignored his general staff’s advice that that the onslaught would come through Belorussia (which it did) and focused on a main thrust through the UKSSR. So Stalin probably bought a little time at Poland and elsewhere’s expense, but threw some of it away due to initial tone deafness
‘Stalin’s goal appears to have been to buy some time by creating strategic depth before Germans could bust into the pre pact borders of the Soviet Union. “
Stalin’s goal was to let both sides destroy each other. Then walk in and Bolshevize all of Europe.
Stalin's goal was for Communism to take over the world, under his leadership. Invading the Baltic countries was purely about conquest. Stalin also had a personal beef with the Poles. The Polish defeat of the Red Army in the 1920 Battle of Warsaw was a humiliation for Stalin, and damaged his standing vis-à-vis Lenin and Trotsky. It also confined Communism within the boundaries of former Russian Empire at a moment when it looked as if much, or all, of the former German and Austrian Empires was within the Bolshevik's grasp.