Page MenuHomePhabricator

Community configuration: i18n messages are not generated correctly
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Use the following as SuggestedEditsSchema (includes/Config/Schemas/SuggestedEditsSchema.php in GrowthExperiments):

class SuggestedEditsSchema extends JsonSchema {

	public const GEInfoboxTemplates = [
		self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
	];

// ***** STRUCTURED TASKS *****
	public const image_recommendation = [
		self::TYPE => self::TYPE_OBJECT,
		self::PROPERTIES => [
			'disabled' => [
				self::TYPE => self::TYPE_BOOLEAN,
				self::DEFAULT => false,
			],
			'excludedTemplates' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'excludedCategories' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'learnmore' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
			],
			'maxTasksPerDay' => [
				self::TYPE => self::TYPE_NUMBER,
			],
		],
	];

	public const section_image_recommendation = [
		self::TYPE => self::TYPE_OBJECT,
		self::PROPERTIES => [
			'disabled' => [
				self::TYPE => self::TYPE_BOOLEAN,
				self::DEFAULT => false,
			],
			'excludedTemplates' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'excludedCategories' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'learnmore' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
			],
			'maxTasksPerDay' => [
				self::TYPE => self::TYPE_NUMBER,
			],
		],
	];
}

Ensure the following i18n messages exist:

{
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-label": "Infobox templates",
	"communityconfiguration-growthsuggestededits-geinfoboxtemplates-help-text": "These templates are needed for the image suggestions newcomer task feature. Articles containing these templates will not be listed as image suggestion tasks.",
	"communityconfiguration-growthsuggestededits-copyedit-label": "Copyedit",
	"communityconfiguration-growthsuggestededits-expand-label": "Expand short articles",
	"communityconfiguration-growthsuggestededits-links-label": "Add links (unstructured)",
	"communityconfiguration-growthsuggestededits-references": "Find references",
	"communityconfiguration-growthsuggestededits-update": "Update articles",
	"communityconfiguration-growthsuggestededits-image_recommendation-label": " Add an image to an unillustrated article",
	"communityconfiguration-growthsuggestededits-image_recommendation-disabled-label": "Is the task enabled?",
	"communityconfiguration-growthsuggestededits-image_recommendation-disabled-control-label": "The task is disabled.",
	"communityconfiguration-growthsuggestededits-image_recommendation-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
	"communityconfiguration-growthsuggestededits-image_recommendation-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type",
	"communityconfiguration-growthsuggestededits-image_recommendation-learnmore-label": "Destination page for learning more about image recommendation task type",
	"communityconfiguration-growthsuggestededits-image_recommendation-maxtasksperday-label": "The maximum number of \"Add an image to an unillustrated article\" suggested tasks a newcomer can complete daily",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-label": "Add an image to an article section",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-label": "Is the task enabled?",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-control-label": "The task is disabled.",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-learnmore-label": "Destination page for learning more about image recommendation task type",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-maxtasksperday-label": "The maximum number of \"Add an image to an unillustrated article\" suggested tasks a newcomer can complete daily"
}

Once that is done, go to http://localhost:8080/wiki/Special:CommunityConfiguration/GrowthSuggestedEdits.

What happens?:

image.png (2,262×1,370 px, 188 KB)

As you can see, the i18n messages for section_image_recommendation do not get displayed. Adding console.log to init.js shows that the messages are not requested from the server at all. This is confusing, as both image_recommendation and section_image_recommendation have the same code.

What should have happened instead?:

The bottom half of the form looks the same as the top part.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

urbanecm@wmf3345 CommunityConfiguration % git show -s HEAD
commit 633a0ddbb5491a0036afcaa35d82b9a1ed5488e3 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Große <mgrosse@wikimedia.org>
Date:   Fri Apr 19 17:37:50 2024 +0200

    Add validation warnings
    
    Only warning about some issues instead of failing will be necessary when
    migrating a Schema to a newer version that might have new parameters or
    might drop some.
    
    This could in principle be implemented with the existing
    `IValidator::validate` method by fully relying on the difference between
    `StatusValue::isOK` and `StatusValue::isGood`. However, that difference
    is subtle and prone to confusion and thus errors. Though this could be
    mitigated with thorough and explicit testing.
    For now, this change introduces a second method on `IValidator` to make
    it explicit that this will return a StatusValue that is still `OK` if
    there are warnings. `::validate` has been renamed to make the intended
    functionality explicit.
    
    For now, this change assumes that IValidator will not be stable neither
    to implement nor to call by external code. If this assumption changes,
    then we may want to reconsider whether these public method signatures
    are the best to make stable, or whether we should find a solution that
    is more extendable under a stable interface policy. This could, for
    example, mean to only expose a single ::validate() method that then
    would have a second "mode" parameter that could either be
    `IValidator::FOR_READS` or `IValidator::FOR_WRITES`.
    
    Bug: T362042
    Change-Id: Ie53284c56f43684256bb3a8cb0e10cf4fd24986e
urbanecm@wmf3345 CommunityConfiguration % 

urbanecm@wmf3345 core % git show -s HEAD
commit ce9d259317b876fdd2334d4065230b2f9e1f1510 (HEAD -> master, origin/master, origin/HEAD)
Merge: 10ec2e342a9 ed7e787f32e
Author: [BOT] jenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Date:   Mon Apr 22 17:11:41 2024 +0000

    Merge "Ignore/fix MediaWiki.Commenting.PropertyDocumentation.WrongStyle"
urbanecm@wmf3345 core % 

urbanecm@wmf3345 CommunityConfigurationExample % git show -s HEAD
commit 5596a3e42014e8d88bef8f571d5940ed5d2bacf6 (HEAD -> main, origin/main, origin/HEAD)
Author: Martin Urbanec <martin.urbanec@wikimedia.cz>
Date:   Sat Mar 30 20:30:45 2024 +0100

    i18n: Add default form labels
urbanecm@wmf3345 CommunityConfigurationExample %

Other information (browser name/version, screenshots, etc.):

The snippets from this task are based on my patches for T360471: Growth features: Migrate Suggested edits from Special:EditGrowthConfig to Community configuration 2.0.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Urbanecm_WMF triaged this task as High priority.
Urbanecm_WMF added a subscriber: Sgs.

Assigning to @Sgs per our meeting today.

Change #1025367 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] Editor: fix the editor messages generation

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

Change #1025367 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Editor: fix the editor messages generation

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

Change #1025715 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] i18n: fix array label generation

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

Change #1025715 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] i18n: fix array label generation

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

@Sgs - when testing Especial:CommunityConfiguration/GrowthSuggestedEdits and comparing to the figma design, I noticed two small issues (not sure if they are in the scope of this task):

(1) The message under Infobox template :"These templates are needed for the image suggestions newcomer task feature. Articles containing these templates will not be listed as image suggestion tasks." has a link for " the image suggestions " in the figma design. The current implementation doesn't indicate any links in that message:

figma designeswiki beta
Screen Shot 2024-05-28 at 4.41.25 PM.png (1,746×716 px, 156 KB)
Screen Shot 2024-05-28 at 4.51.13 PM.png (2,088×920 px, 177 KB)

(2) The label "List of excluded sections from the Add link task" doesn't have an associated text field (more comments on the labels in this comment on T360471).

Screen Shot 2024-05-28 at 4.53.50 PM.png (2,140×1,336 px, 200 KB)

@Sgs - when testing Especial:CommunityConfiguration/GrowthSuggestedEdits and comparing to the figma design, I noticed two small issues (not sure if they are in the scope of this task):

(1) The message under Infobox template :"These templates are needed for the image suggestions newcomer task feature. Articles containing these templates will not be listed as image suggestion tasks." has a link for " the image suggestions " in the figma design. The current implementation doesn't indicate any links in that message:

figma designeswiki beta
Screen Shot 2024-05-28 at 4.41.25 PM.png (1,746×716 px, 156 KB)
Screen Shot 2024-05-28 at 4.51.13 PM.png (2,088×920 px, 177 KB)

Indeed, that is a known limitation of all form messages (namely field labels and field help text). Filed as T366270.

(2) The label "List of excluded sections from the Add link task" doesn't have an associated text field (more comments on the labels in this comment on T360471).

Screen Shot 2024-05-28 at 4.53.50 PM.png (2,140×1,336 px, 200 KB)

Nice catch. I think this is a defect from T364717 that we need to take action. In CC1.0 this field used the "chips input" control and I find it quite appropriate.

Screenshot 2024-05-30 at 14.15.48.png (1,664×280 px, 49 KB)

In CC2.0 we don't have support for using this control in the context of "free text" items (we use it for page titles and namespaces but those do not accept free text). Some alternatives:

  1. Implement T366274, and for empty collections show an initial empty item ready to fill.
  2. Implement a variant of the chip input control, similar to Namespaces control but without a menu and accepting free text. Note that this control implements "collection management" already by design. Then make excludedSections use that custom control by creating a MediaWiki/Growth definition for it

Leaning towards (1) since we know it would also be benefitial for other cases. (2) seems more of a special casing / nice to have that can be left for the future. What do you think? cc @KStoller-WMF @Michael @Urbanecm

As per the main goal of this task, a way to test we fixed generating used messages is to render the form using the uselang=qqx parameter in the URL and compare the form message keys in the screen with the ones requested via API (there can be several requests as the client requests messages in batches of 50). If I diff these I don't get extra messages. Can we consider this resolved @Etonkovidova ?

In T363477#9846176, @Sgs wrote:
Leaning towards (1) since we know it would also be benefitial for other cases. (2) seems more of a special casing / nice to have that can be left for the future. What do you think?

Sounds good, I agree we should prioritize the first solution if it works for this use cases and other existing use cases.

As per the main goal of this task, a way to test we fixed generating used messages is to render the form using the uselang=qqx parameter in the URL and compare the form message keys in the screen with the ones requested via API (there can be several requests as the client requests messages in batches of 50). If I diff these I don't get extra messages. Can we consider this resolved @Etonkovidova ?

Thx, @Sgs for clarifying! Yes, the scope of the task is done and other cases/issues that I mentioned, could be addressed outside of this task. Resolving this task.