Currently user name normalization is applied very inconsistently. For example, User::newFromName with make user name canonical, while (new User)->setName() allows you to pass in anything regardless of validity or normalization. This problem proliferates all the way to the DB layer - User::createNew will create a row in the actor and user tables with the name passed in with no normalization.
Other way around, when looking up users by name in the database we apply normalizations very selectively, so some codepaths look up by canonical name, while others not. All this works because of a fine balance between bugs.
We should start requiring that UserIdentityValue name be in a canonical form and then move the codebase towards this goal.
Actions TBD.