Shimano Tiagra 4700 10 speed lever only shifting 9 gears
By removing the cable from the derailleur and operating the shifter while applying tension to the cable by hand you have proved the shifter is the problem (unless the cable is hanging up somewhere, it's best to do this test holding the cable as close to the shifter as possible).

Sometimes shifters can get a bit of dried grease or dirt in them that prevents a pawl from catching on a ratchet. Unfortunately they cannot be disassembled as they are riveted together.

Soaking with WD40 or equivalent and/or blowing out with a compressed air hose can reportedly clear the contamination.