bug: tax residency warning uses one rolling 12mo / 183d rule for every country
bug: tax residency warning uses one rolling 12mo / 183d rule for every country
observed
the bot warned me about thailand residency with "you risk becoming a tax resident in N days bc you've been there for X days in the last 12 months". so it's computing 183 - days_in_trailing_365, and the same rule seems to be applied to every country.
expected
thailand = 180 days, calendar year (jan 1–dec 31), cumulative, resets jan 1 (revenue code s.41). no rolling window. in november there aren't enough days left in the year to reach 180, so the warning shouldn't fire.
what's wrong
wrong window type: trailing 365 days, but thailand uses the calendar year.
wrong threshold: 183, but thailand is 180.
projection ignores the window end: the projected date lands next year, after the count has already reset. for tax-year countries it isn't reachable.
rolling projection is wrong even on its own terms: in a trailing window, old days age out as new ones accrue. "N more days" assumes none of the existing days drop off in that time.
warns about the wrong country: the warning seems to fire only for the current check-in country. a country where the trailing 12mo count is already higher, even over 183 by the bot's own rule, gets no warning.
repro
check in to a calendar-year country late in the year with a decent amount of days already logged there in the last 12 months. for #5, also have more days logged in another country in that window.
impact
false positives and false negatives at the same time. users may cut stays short or plan border runs around a deadline that doesn't exist, while not being told about the country that actually matters. the same logic will also misfire for other calendar-year and fiscal-year countries (uk, india, australia, etc.).
Log in to comment and vote
No comments yet
Be the first to share your thoughts.