There is an edge case on the `Special:UserLogout` page, when Minerva `$skinOptions` object in initialized improperly. The SkinOptions keeps user preferences because it's initialized before MediaWiki core logs out the user.
1. User visits Special::UserLogout page, MediaWiki code starts running
2. During [[https://www.mediawiki.org/wiki/Manual:Hooks/RequestContextCreateSkin | RequestContextCreateSkin ]] hook, MobileFrontend calls `RequestContextCreateSkinMobile` hook. which triggers `MinervaHooks::onRequestContextCreateSkinMobile` hook handler.
3.User object is loaded from RequestContext, SkinOptions is set with proper options (beta flag, amc flag, etc)
4. Special::UserLogout page calls [[ https://github.com/wikimedia/mediawiki/blob/86dacb5de2d49c5dcd4dc12dd68c8ee2df9c9be1/includes/specials/SpecialUserLogout.php#L66 | $user->logout() ]],
5. MediaWiki starts rendering page
6. Based on SkinOptions set in step 2 (which is outdated because user object doesn't apply any more) we render page in the way logged user would see it (things like BETA features or AMC mode stays enabled).
Please note, that `RequestContext::getMain()->getUser()` will return the same `User` object with cleared various cached data. System do not nullify `User` object, only calls `User::clearInstanceCache()`. Most probably we should be fine, but please double check that.
The mobile skin initialization is one big hack around MediaWiki core and there is no easy and clean way to do. Most probably we cannot change the skin initialization logic, and I think we shouldn't postpone SkinOptions initialization. As an example, before MediaWiki core logs out the user, something might want to log user actions (like beta user just logged out), before MediaWiki logs out the user, the SkinOptions object is set properly.
We can listen to `UserLogoutComplete` hook, and when that happens - reset the SkinOptions object. When HTML rendering kicks in, the SkinOptions will contain default settings (no AMC mode, no BETA mode), and the page should be rendered correctly as an anon user.
- Login to mobile Wikipedia as a AMC user
- verify that the MainMenu has AMC entries in it
- log out
- stay on the page, verify that menu doesn't have AMC entries any more