If a retroactive tax is legal why not the ability to tax income of nonresidents?
As a career Navy man I had several ties over the years to the State of California. When stationed in Japan, I had a mailing address (Fleet Post Office Box) in San Francisco. Following that, I went to survival school just North of San Diego for about six weeks prior to going to Viet Nam for a year (and again using a Fleet Post Office Box in California). My last two-year tour was in San Diego - where as a "geographical batchelor" I lived in the barracks on base (a Federal Reservation, by the way).
At the time I retired in September 1990 California wanted to tax my military retired pay based on the percentage of it that was earned during the amount of time that I had a California address. They didn't care that I had actually never lived in the state other than on a federal reservation outside of state jurisdiction. The US Supreme Court took a challenge to this practice and declared it unconstitutional (Thank Goodness). Otherwise they would have been taxing me and a lot of other people based on "Sourced earnings".