Yesterday I prepared a Canadian tax return for a student who had been in Canada since August of 2013. He had no income for 2013 or 2014. He was filing for those years to declare his tuition and other allowable school expenses to carry forward in case he decided to work in Canada for a while before returning to China. We prepared the return as if he was a Canadian resident, but had to warn him that he might not be considered as a Canadian resident because he had no ties in Canada. The Canada Revenue Agency might take the position that he was only in Canada on a temporary basis and disallow his claim.
This is often a problem. If you are moving from one country to another they will usually accept it if family members are moving with you but are very unlikely to accept it if you are just working
somewhere else but returning home frequently. Residency is very important on the Canadian side of a cross-border return. It is less important on returns for US persons.
One other thing is that a few years ago New York state tried to tax non-residents who were telecommuting to New York jobs. I have prepared returns in other years for a person who lived in Niagara Falls, Ontario but worked in the US. He had a corporation which I believe was registered in Canada. This required another form on his US return.
The critical point of all of these residency problems is that most government bodies are pressed for revenue so they want to collect as much as they can from people who they might consider to be residents. The concept is that they want to collect revenue from these people but do not want to pay to provide services to them.