There's a creep of code appearing after
if ( $wmgRealm === 'labs' ) { require __DIR__ . '/CommonSettings-labs.php'; }
in CommonSettings.php.
I suspect there's very few cases that this is actually desired (as it can result in overriding of config set in CommonSettings-labs.php).
Most of the code should probably be moved above the require. If there's any code that does need to stay there, we should try and document it...