I-am-a-panda
Rí
You must have the necessary techs for upgrade. Anything found after its discovery is still same old same old.
I had all my archers turn into riflemen yesterday after LW but I think it is because I had all the techs without rushing. In a game later yesterday I rushed to LW since another civ was making a go of it and they didn't upgrade. I know it's sketchy but I think you have to have all the lower techs in line with the units complete for it to work. VERY nice when you have 40+ archer armies suddenly convert to riflemen!
This brings another question though, if another civ has already built it will yours still upgrade if you do, and can you even build a wonder if another civ already has it?
Leonardo's is simple.
If you have the tech for a unit, and your unit is of the same lineage as the tech, finishing the building will upgrade the unit.
.