V2 - changes to episode ordering cause silent and permanent mislabelings

Sonarr version (exact version):
Mono version (if Sonarr is not running on Windows): 4.2.3
OS: Ubuntu 16.04
Debug logs: Have none, nature of the issue makes it impossible to reproduce manually and hard to pin down exactly when it happens.
Description of issue:

I’ve noticed this several times with different shows over the past few months. Every so often something changes (I’m assuming either on the TVDB or XEM) with a show’s episode ordering, and suddenly half the episodes in that show are mislabeled. To take a concrete example from the show I most recently noticed has this problem, four episodes that were previously and correctly labeled as being regular episodes in the regular seasons are now marked as being specials, I’m guessing because those specials were suddenly given absolute order numbers that the affected regular episodes used to have.

There are some additional issues that compound this problem to make it extremely frustrating:

  1. There is a follow-on effect, where every episode after the first misplaced one is mislabeled (probably because all of them had an absolute ordering change).
  2. Even though the episode files are not actually moved (e.g. a S2E01 that suddenly is seen as S0E01 is still in the S2 folder with the original name), clicking the “Update series info and scan disk” button does nothing. It seems that Sonarr has decided that S2E01 is the proper filename for S0E01 and nothing will make it change its mind.
  3. There is no way short of deleting the episodes and re-importing them to fix this issue. This is not ideal because a) it’s a bunch of manual effort moving the files around and b) it resets the episodes’ history, which I would prefer to keep preserved so I can trace the origin of each file. Ideally I could fix the issue within the Sonarr GUI somehow.
  4. When this happens, it often leaves some episodes that were already available as missing, which can cause Sonarr to later download a (possibly worse) version to fill in the gap which will overwrite good files.
  5. The biggest issue is that this corruption is effectively silent. I don’t know if these breaking changes to episode ordering are possibly logged, but if they are that would be the only place, and I’m not constantly reading the logs anyway. So I might (and based on the frequency I’ve seen this issue, probably do) have a dozen more shows that are messed up like this, and no fast and easy way to check.

Now, I understand that there can’t be an easy fix for this. Sonarr obviously must take the information from TVDB and XEM as the source of truth, and if that truth suddenly changes, there isn’t a universally good way to deal with it. However, I do have some suggestions that might improve the situation:

  1. Try to identify when potentially breaking changes happens to a show’s ordering and make it easy to find such shows. Even better would be if the exact changes are available to be seen, which can take some of the guesswork out of how to fix things. The flag can be manually set back to the not-broken state once the user has checked and fixed anything that went wrong.
    • One suggestion for a relatively simple check for this flag would be if there’s any change to the relationship between the absolute ordering and the season ordering for an existing episode file.
  2. Have an option to stop any new downloads for shows that have the above “broken order” flag set. This will help prevent overwriting good episode files with worse ones, and just makes figuring out a fix easier because there’s fewer factors to consider. This should be an option because I can see some people not wanting to have shows randomly stop downloading, especially if it turns out most “broken” shows aren’t actually messed up. But I personally would prefer to have such an option turned on.
  3. Make the flow to manually re-assign an episode file to the correct episode entry more streamlined than the current option of “delete and re-import”. Especially nice would be to preserve the history associated with the episode somehow (which should be possible since the currently automatically reassigned episodes seem to take their history with them, from the example above the “new” S0E01 episode has the history that used to be linked to S2E01).

Finally, I realize that my Sonarr is out of date even for V2, but based on the searches I’ve made for reports of this issue that haven’t turned up anything, I suspect it’s not fixed. But if anyone can tell me for sure that it is fixed somehow, whether in a more recent release of V2 or in V3, I would be very grateful.