I just have to ask, is there a reason we aren't able to get the user name of IPs? mw.user.getName() returns null for IPs. At first, I thought maybe this is because of some security or privacy concern, but I'm not sure that makes any sense. Does it have to do with caching?
Ideally, mw.user.getName() should return the IP for IPs, and if you want to differentiate between IPs and logged-in users you would use mw.user.isAnon(), and mw.user.isAnon() would have to be reworked to no longer rely on mw.user.getName(). Unfortunately, that would be a breaking change for code that relies on comparing mw.user.getName() with null to tell IPs and logged-in users apart, but maybe that would be acceptable with enough communication (tech news, mailing lists, console.log)?