Page MenuHomePhabricator

CheckUser extension should use EventBus.UserEntitySerializer service instead of constructor
Closed, ResolvedPublic

Description

In T392516: [EventBus] Stabilize EventSerializer and related classes EventBus' reusable entity serializers were exposed as MediaWiki Service objects.

The CheckUser extension's SuggestedInvestigationsInstrumentationClient constructs a new UserEntitySerializer directly.

In T423952: Create mediawiki.user_change event stream, we are evolving the UserEntitySerializer constructor. CI is complaining with:

ArgumentCountError: Too few arguments to function MediaWiki\Extension\EventBus\Serializers\MediaWiki\UserEntitySerializer::__construct(), 3 passed in /workspace/src/extensions/CheckUser/src/SuggestedInvestigations/Instrumentation/SuggestedInvestigationsInstrumentationClient.php on line 86 and exactly 4 expected

The CheckUser code was committed after we merged the new EventBus MW Services and adapted CirrusSearch to use them. I'm not sure how we missed CheckUser!

This is blocking T423952.

Done is

  • CheckUser uses EventBus.UserEntitySerializer MediaWiki Service instead of directly constructing instances.

Event Timeline

Ottomata renamed this task from CheckUser extension should use UserEntitySerializer service instead of constructor to CheckUser extension should use EventBus.UserEntitySerializer service instead of constructor.EditedMay 8 2026, 5:09 PM

@Dreamy_Jazz I was going to submit a patch to just inject EventBus.UserEntitySerializer into the SuggestedInvestigationsInstrumentationClient constructor via ServiceWiring.php, but, it looks like maybe EventBus extension is meant to be an optional dependency?

It is an optional dependency to avoid breaking tests in CI. In practice it's intended that a wiki with Suggested Investigations enabled would have EventBus installed.

So it should be a soft dependency but it's fine if that essentially disables the instrumentation when EventBus is not installed. So perhaps the same logic of using the no-op instrumentation client can happen when EventBus is not installed (as used for no EventLogging)

Ottomata triaged this task as High priority.

Change #1285427 had a related patch set uploaded (by Ottomata; author: Ottomata):

[mediawiki/extensions/CheckUser@master] Use EventBus.UserEntitySerializer service

https://gerrit.wikimedia.org/r/1285427

Change #1285427 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Use EventBus.UserEntitySerializer service

https://gerrit.wikimedia.org/r/1285427