Page MenuHomePhabricator

Running extensions/Babel/maintenance/migrateConfigToCommunity.php with the default configuration fails on validation error
Closed, ResolvedPublic2 Estimated Story Points

Description

While preparing for T374348, I discovered that running extensions/Babel/maintenance/migrateConfigToCommunity.php with the default Babel config fails on validation:

I have no name!@b3b007ed45ec:/var/www/html/w$ php maintenance/run.php Babel:migrateConfigToCommunity
Error when saving the new configuration
== Error details
DRAFT: NULL value found, but an array is required. Key: BabelCategorizeNamespaces
I have no name!@b3b007ed45ec:/var/www/html/w$

My Babel config:

wfLoadExtension( 'Babel' );
$wgBabelUseCommunityConfiguration = true;

The migration script should be fixed to make the migration script working. We should also add a test that ensures the script completes.

Event Timeline

We should choose whether to use null or empty arrays if not using this variable.

We should choose whether to use null or empty arrays if not using this variable.

Unfortunately, both values mean something else, this is not an either or situation. Babel interprets null as "do not care" (all namespaces allowed), while an empty array is interpreted as "no namespaces allowed" (feature is turned off). So, the right solution would be to allow null, but CommunityConfiguration doesn't support null as a value (T365145).

In theory, we could use another value to represent "any namespace is fine", such as false. However, then we run into another problem: CommunityConfiguration doesn't really handle fields with multiple types well either. The validator is able to handle multitypes just fine, but the editor cannot.

I think the possibilities here include:

  1. Adding multi-type and null support to CommunityConfiguration
  2. Add a feature flag to enable/disable the namespace check (if they are disabled, the actual value of BabelCategorizeNamespaces would be ignored)
  3. Remove the BabelCategorizeNamespaces feature altogether (it is currently used at exactly zero wikis)

From those options, option 1 is conceptually best, but it is also quite a bit of work. Apart from that, option 2 (if we need/want to keep the feature) or option 3 (if we don't) seem also acceptable.

@KStoller-WMF @Trizek-WMF How would you feel about possibly dropping the config flag for deciding in which namespaces should Category:User LANG-LEVEL categories be added automatically? As I mentioned above, no wiki makes use of that.

Change #1112202 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/Babel@master] [tests] Add MigrateConfigToCommunityTest

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

What does this config element do? How is the categorization done? You probably detailed it elsewhere but I can't find it back.

The essential point is that users should have Babel boxes working as they used to, or, at least, with all the features it currently offers.

(it is currently used at exactly zero wikis)

I don’t think you can state this. Babel is not only for first-party wikis, nor is its Community Configuration integration. (Introduced in T69334, it was intended for WMF wikis, which apparently never happened, but this doesn’t mean third-party wikis didn’t start to use it in the past decade either. And, actually, eswiki or other WMF wikis may start to use it if Community Configuration makes it available – I guess the lack of usage is due to the bureaucracy of configuration requests, not due to the lack of interest in it.)

  1. Adding multi-type and null support to CommunityConfiguration
  2. Add a feature flag to enable/disable the namespace check (if they are disabled, the actual value of BabelCategorizeNamespaces would be ignored)

I think the best developer and user experience would be a mix of the two: add nullable array support (or maybe nullable type support, but not generic multi-type support), but display it as a feature flag, like

  • Turn on nullable feature 1
  • Turn on nullable feature 2

Nullable feature 2 config: [_________]

i.e. dynamically hide the config if the feature is not enabled. This is better than either version, because

  • for users, null and empty array are clearly distinguishable – an empty multi-select field could mean both;
  • for developers, there’s no confusion about what it means if the feature flag is disabled but the array has some elements, since this is impossible.

What does this config element do? How is the categorization done? You probably detailed it elsewhere but I can't find it back.

If you look at my volunteer userpage you will see I use Babel there. In the list of categories, you will see the page was added to Category:User cs and Category:User en. This categorisation is done by Babel. By default, Babel will add the category to any page it is used on (even if it is used on an article, it would add the category to the article). The config option would allow you to define the list of namespaces in which this categorisation works.

The essential point is that users should have Babel boxes working as they used to, or, at least, with all the features it currently offers.

Since this configuration option is unused at all Wikimedia wikis, the behaviour would be unchanged regardless of what we do here.

(it is currently used at exactly zero wikis)

I don’t think you can state this. Babel is not only for first-party wikis, nor is its Community Configuration integration.

Fair point. In that case, I modify my original statement to "it is currently used at exactly zero WMF wikis".

Fair point. In that case, I modify my original statement to "it is currently used at exactly zero WMF wikis".

Thanks, that’s right. (Although exactly community configuration may – or, of course, may not – change this, as I explained above.) In addition, even the statement “it isn’t, and hasn’t ever been, used on any WMF wikis” is true currently (I grepped through git log --patch in the rOMWC repo, and the string BabelCategorizeNamespaces has never appeared in it).

Urbanecm_WMF set the point value for this task to 2.Jan 21 2025, 3:45 PM
Urbanecm_WMF edited projects, added: Growth-Team (Current Sprint); removed: Growth-Team.

@KStoller-WMF and myself discussed this yesterday, and we decided to remove the namespaces configuration from Special:CommunityConfiguration for now. That way, we would be able to deploy most of the configuration. In the future, we could re-add this to community configuration (in a way that works).

Change #1113994 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/Babel@master] [tests] Add ConfigWrapperTest

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

Change #1113995 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/Babel@master] Remove BabelCategorizeNamespaces from CommunityConfiguration

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

Change #1113994 merged by jenkins-bot:

[mediawiki/extensions/Babel@master] [tests] Add ConfigWrapperTest

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

Change #1113995 merged by jenkins-bot:

[mediawiki/extensions/Babel@master] Remove BabelCategorizeNamespaces from CommunityConfiguration

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

Change #1112202 merged by jenkins-bot:

[mediawiki/extensions/Babel@master] [tests] Add MigrateConfigToCommunityTest

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

Change #1114751 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/Babel@wmf/1.44.0-wmf.13] [tests] Add ConfigWrapperTest

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

Change #1114752 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/Babel@wmf/1.44.0-wmf.13] Remove BabelCategorizeNamespaces from CommunityConfiguration

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

Change #1114975 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/Babel@wmf/1.44.0-wmf.13] [tests] Add MigrateConfigToCommunityTest

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

Change #1114751 merged by jenkins-bot:

[mediawiki/extensions/Babel@wmf/1.44.0-wmf.13] [tests] Add ConfigWrapperTest

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

Change #1114752 merged by jenkins-bot:

[mediawiki/extensions/Babel@wmf/1.44.0-wmf.13] Remove BabelCategorizeNamespaces from CommunityConfiguration

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

Change #1114975 merged by jenkins-bot:

[mediawiki/extensions/Babel@wmf/1.44.0-wmf.13] [tests] Add MigrateConfigToCommunityTest

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

Mentioned in SAL (#wikimedia-operations) [2025-01-29T12:50:35Z] <urbanecm@deploy2002> Started scap sync-world: Backport for [[gerrit:1114751|[tests] Add ConfigWrapperTest (T383905)]], [[gerrit:1114752|Remove BabelCategorizeNamespaces from CommunityConfiguration (T383905)]], [[gerrit:1114975|[tests] Add MigrateConfigToCommunityTest (T383905)]], [[gerrit:1114976|migrateConfigToCommunity: Deal with false category names (T384941)]], [[gerrit:1114973|migrateConfigToCommunity: Deal with

Mentioned in SAL (#wikimedia-operations) [2025-01-29T13:41:41Z] <urbanecm@deploy2002> Finished scap sync-world: Backport for [[gerrit:1114751|[tests] Add ConfigWrapperTest (T383905)]], [[gerrit:1114752|Remove BabelCategorizeNamespaces from CommunityConfiguration (T383905)]], [[gerrit:1114975|[tests] Add MigrateConfigToCommunityTest (T383905)]], [[gerrit:1114976|migrateConfigToCommunity: Deal with false category names (T384941)]], [[gerrit:1114973|migrateConfigToCommunity: Deal with