It's actually pretty easy. Each source has a unique ID, they get assigned when originally created (When Shard 3 was created, in this case.) and are assigned left to right, top to bottom. So the top source has a lower ID number than the one below it, as it was assigned first. These IDs are permanent.
If you use "let sources = room.find(FIND_SOURCES);" to find the sources, you'll get sources[0] pointing to the top one, and sources[1] pointing to the bottom one. the sources array returned by find will have a length of 2. The ID itself for the top one will be "sources[0].id"
But if you wander over to the sources and then search for the closest one, you'll just get whichever one is 'closer.' One of them has to be closer, even if they're both 1 away.
So... the problem is how you're searching for the sources.