This task tracks the high-ish-level goal of creating a framework to enrol users in experiments, track those enrolments, and bucket the user.
Since the first milestone targets experimentation on the Wikipedias, the framework is limited to PHP and JS.
=== Pseudocode
```lang=php,name=pseudocode.php
use RequestContext;
use MediaWiki\MediaWikiServices;
$context = RequestContext::getMain();
$user = $context->getUser();
$experimentManagerFactory = MediaWikiServices::getInstance()->getService( 'Experiments.ExperimentManagerFactory' );
$experimentManager = $experimentManagerFactory->newExperimentManager( $context );
foreach ( $experimentManager->getExperiments() as $experiment ) {
echo "User {$user->getName()} was enrolled in the {$experiment->getName()} experiment. " .
"They were placed in the \"{$experiment->getBucket()}\" bucket. ";
}
```
```lang=js,name=pseudocode.js
const experimentManager = require( 'mw.experiments' ).enroll();
for ( let experiment in experimentManager.getExperiments() ) {
console.log(
`User ${mw.user.getName()} was enrolled in the "${experiment.name}" experiment. ` +
`They were placed in the "${experiment.bucket}" bucket. `
);
} );
// FIXME: require? using?
experimentManager.getExperiment( 'PSEUDOCODE' ).load( ( experiment ) => {
// The RL modules associated with the bucket have been loaded…
} );
```
=== TODO
==== Tasks
[] Investigate other PHP and JS experimentation/feature management frameworks
** Growthbook: https://docs.growthbook.io/lib/php and https://docs.growthbook.io/lib/js
** #growthexperiments: https://phabricator.wikimedia.org/T335124#8795980