I was purifying a few of my Shadow Pokémon when I suddenly noticed the Zubat I had purified apparently had taken 1 damage somewhere. I had literally just purified it, I was still in the Pokemon screen; I didn't use it in battle or anything.
I also noticed many other purified Pokémon (Rattata, Bulbasaur, Golbat) with very little damage, but still hurt. I tried purifying a fainted (0 HP) Shadow Squirtle, and it came out at full HP. I can't trade them if they're damaged, and I don't have infinite potions to heal.
Where is the random damage coming from?