Page MenuHomePhabricator

Allow features to be registered with unnamed requirements
Closed, DeclinedPublic

Description

Quoting @polishdeveloper:

[The] existing solution is pretty verbose, creating single Feature requires us to define name, config variable, group.

The most basic (and likely most common) usecase for the developer will be to create a feature that has one or more requirements that are specific to that feature. Vector's Feature Manager currently requires that requirements be created separately to features, e.g.

$featureManager->registerSimpleRequirement( 'foo_enabled', $config->get( 'wgFooEnabled' ) );
$featureManager->registerRequirement( new LatestSkinVersionRequirement() );
$featureManager->registerFeature( 'FooFeature', [
  'foo_enabled',
  LatestSkinVersionRequirement::class
] );

It should be possible to write the above using on function call:

$featureManager->registerFeature(  'FooFeature', [
  $config->get( 'wgFooEnabled' ),
  new LatestSkinVersionRequirement(),
] );

Event Timeline

ovasileva triaged this task as Medium priority.May 4 2020, 11:25 AM
ovasileva added a project: Web-Team-Backlog.
ovasileva moved this task from Incoming to Triaged but Future on the Web-Team-Backlog board.

Change 626359 had a related patch set uploaded (by Phuedx; owner: Phuedx):
[mediawiki/skins/Vector@master] featureManager: Register requirements implicitly

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

Change 649402 had a related patch set uploaded (by Jdlrobson; owner: DannyS712):
[mediawiki/core@master] Add Skin::supportsFeature

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

Change 649402 abandoned by Jdlrobson:
[mediawiki/core@master] Add Skin::supportsFeature

Reason:
Let's discuss further on ticket. Can't review unless we agree on the approach first

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

Change 626359 abandoned by Phuedx:

[mediawiki/skins/Vector@master] featureManager: Register requirements implicitly

Reason:

This isn't The Fix™. When I get a little down time (next Monday is the most likely), then I'll create a task detail The Fix™.

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

@phuedx would it make sense to track this in your new team's backlog?

@phuedx would it make sense to track this in your new team's backlog?

IIRC the Core Platform Team is also looking at this problem (I think there's an RfC?). If so, it might be worth holding off on any further changes to MobileFrontend/MinervaNeue and Vector and making sure that our usecases are understood.

If that's agreeable, I'd be happy to decline this task.

IIRC the Core Platform Team is also looking at this problem (I think there's an RfC?).

It's not just the Core Platform Team. See T267928: Configuration Modes and T242835: RFC: Standard method for feature-management in skins/extensions.