Currently, if an entry is inserted into the recentchanges table for a username that could exist but does not, it will be inserted with rc_user 0 and rc_user_text being the username. Wikibase inserts such recentchanges entries.
Per T167246, that is not going to work in the future. Instead, the recentchanges table will have an rc_actor column referring to the actor table. The actor table will only contain entries for local users that actually exist and for things like IP users and interwiki usernames (see T179832) that cannot exist as a local user.
I can think of three ways to fix this situation:
- Have Wikibase always use interwiki usernames for these recentchanges entries.
- Have Wikibase detect whether the local user exists and is attached to the SUL account on both the client and repo wikis, and use interwiki usernames if the named user doesn't exist.
- Have Wikibase somehow autocreate the local user if it doesn't exist, assuming these RC entries are only inserted on client wikis sharing SUL with the repo wiki. You'd probably still need a fallback to interwiki usernames in case autocreation fails.
#1 would probably be the easiest, although #2 is pretty easy too using core's CentralIdLookup class. For #3 you might reuse the 'ImportHandleUnknownUser' hook.
Note to self: After this is resolved and deployed, run maintenance/cleanupUsersWithNoId.php with --table recentchanges --force, appropriate --prefix, and (if not option #1) --assign on all wikis.