rP18467 introduced the Upgrade component and a Transform helper.
rP18754 uses it for a structure upgrade.
rP19095 uses it for a unit upgrade.
rP19103 revert the unit upgrade as it didn't work.
rP19195 adress the bug of the upgrade component related to those limit restriction (noticeable for the structure upgrade)
There is still a Command check (for unit, not for structure) which is adressed here.
I am not really proud of the patch as it leaves me the feeling to stack things over things. But it adresses the bug.