Page MenuHomePhabricator

Make WikimediaEvents depend on TestKitchen
Closed, ResolvedPublic8 Estimated Story Points

Description

Background

Currently, WikimediaEvents depends on EventLogging and EventBus. However, increasingly more experiment owners are putting their experiment code in the WikimediaEvents extension and, because TestKitchen isn't depended on and therefore might not be available, they have to wrap their experiment code in guards or loading statements, e.g.

Hooks.php
class Hooks {
  public function __construct( private readonly ExperimentManagerInterface ?experimentManager = null ) {
  }

  public function myAwesomeHook(): void {
    if ( $this->experimentManager ) {
      $e = $this->experimentManager->getExperiment( 'my-awesome-experiment' );
    }
  }
}
my-awesome-experiment.js
mw.loader.using( 'ext.testKitchen', () => {
  const e = mw.testKitchen.getExperiment( 'my-awesome-experiment' );
} );

These aren't necessarily Bad™ per se but they are unnecessary and, in the case of loading statements, they could lead to experiment-related analytics events being lost as the ext.testKitchen module isn't loaded before the user navigates away from the page.

AC

  • WikimediaEvents lists TestKitchen as a requirement and this change has rolled out. The rollout should happen before removing the mw.loader.using( 'ext.testKitchen', … ) statements.
  • PSA in talk-to channel that this change is happening and the longer format is no longer required.
  • All mw.loader.using( 'ext.testKitchen', … ) statements are removed from WikimediaEvents
  • CI passes

Event Timeline

I met with @hashar about this and this is what we'd have to do to make this work. As I understand it, we'd have to:

  1. Make WikimediaEvents depend on TestKitchen in CI
  2. Make all extensions that depend on WikimediaEvents in CI also depend on TestKitchen
  3. Make all extensions whose tests are run during WikimediaEvents CI also depend on TestKitchen
  4. Make WikimediaEvents explicitly depend on TestKitchen in extension.json
JVanderhoop-WMF moved this task from Incoming to READY TO GROOM on the Test Kitchen board.
KReid-WMF set the point value for this task to 8.

Here's another instance of the lack of an explicit dependency causing issues: https://wikimedia.slack.com/archives/C06K74G4K0F/p1777495282722029

(Sorry it's a Slack thread. There's no Phab task)

I am seeing CI failure in WikiEditor (2010). Is it related to this ticket?

I'm sorry that I didn't see your message sooner, @Bhsd. Unfortunately, the CI artefact has expired. Is the CI failure still happening?

Is the CI failure still happening?

It has been fixed and the patch has been merged. Thanks!

My thanks to @Jdforrester-WMF and @kostajh for the patch and merging the patch, respectively. This is Done™.

KReid-WMF claimed this task.

Change #1294953 had a related patch set uploaded (by DLynch; author: DLynch):

[mediawiki/extensions/WikimediaEvents@master] Add resourceloader dependency on ext.testKitchen

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

Change #1294953 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Add resourceloader dependency on ext.testKitchen

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