I've entered an issue on Github regarding this issue. It is definitely unexpected behavior. However, I don't know how critical it is since there is a workaround.
https://github.com/plataformatec/devise/issues/4992
The upgrade from 5.2.0 to 5.2.2 is fairly safe. There wasn't much changes. Have you looked at this episode yet https://www.driftingruby.com/episodes/upgrading-ruby-on-rails-versions?