I believe you only need to work at a particular location for 6 months in a year to be considered a resident for tax purposes. But yeah there’s a certain flexibility with the truth if you go over but it’s not like the biggest deal since you’re paying state taxes either way and not that many people do it anyway.
It gets even more complicated when treaties are involved because they’ll supercede the law, have a lot less jurisprudence and are often unreadable gobblygook.
You end up with rules like (paraphrasing):
“If a member of a contracting state contracts in the other contracting state, they will only pay taxes in their other contracting state”