Community Configuration to make the process of configuration AutoModerator more seamless and user friendly.

Designs/copy

Initial explorations in the Figma files linked in T349238. Note that we're moving message strings such as edit summary out of config.

Community Config Technical Details

Note: Null data types are not supported in CC 2.0. For now, we should just use empty strings in our schema in places where we would otherwise use null and update code accordingly.

Step 1:
Download the extension and enable it per documentation here.

Step 2:
Update AutoModerator's extension.json to include the community configuration provider.

	"attributes": {
		"CommunityConfiguration": {
			"Providers": {
				"MyProvider": {
					"store": {
						"type": "wikipage",
						"args": [
							"MediaWiki:AutoModeratorConfig.json"
						]
					},
					"validator": {
						"type": "jsonschema",
						"args": [
							"AutoModerator\\Config\\Validation\\AutoModeratorConfigSchema"
						]
					},
					"type": "mw-config"
				}
			}
		}
	},

Step 3: Create an AutoModeratorConfigSchema class in the AutoModerator extension that will be referenced in your provider config from step 1:

class AutoModeratorConfigSchema extends JsonSchema
{
	public const AutoModeratorEnableRevisionCheck = [
		self::TYPE => self::TYPE_BOOLEAN
	];

         public const AutoModeratorFalsePositivePageTitle = [
	        self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
         ];

	public const AutoModeratorSkipUserGroups = [
		self::TYPE => self::TYPE_ARRAY,
                self::ITEMS => [
			self::TYPE => self::TYPE_STRING,
		],
	];

	public const AutoModeratorUseEditFlagMinor = [
		self::TYPE => self::TYPE_BOOLEAN
	];

	public const AutoModeratorRevertTalkPageMessageEnabled = [
		self::TYPE => self::TYPE_BOOLEAN
	];

	public const AutoModeratorCautionLevel = [
		self::TYPE => self::TYPE_STRING,
		self::ENUM => ['Very cautious', 'Cautious', 'Somewhat cautious', 'Less cautious']
	];
}

You can then validate the configuration on wiki and ensure the types are being validated correctly.

Details

Kgraessle changed the task status from Open to Stalled.Jul 26 2024, 3:05 PM

These should be both merged. They are only waiting on our end on QA, but can already be used.

Note that this is an upstream bug. We look into it when we find the time, but the bug is not in our main code-bases, but in mediawiki core. The current workaround is to replace [foo] with \[foo\] in the message in the en.json file.

These should be both merged. They are only waiting on our end on QA, but can already be used.

Note that this is an upstream bug. We look into it when we find the time, but the bug is not in our main code-bases, but in mediawiki core. The current workaround is to replace [foo] with \[foo\] in the message in the en.json file.

@Michael
Great! thank you for the update. I'm still seeing the <br> tags not parsing correctly on help text and descriptions. My patch is

Note that this is an upstream bug. We look into it when we find the time, but the bug is not in our main code-bases, but in mediawiki core. The current workaround is to replace [foo] with \[foo\] in the message in the en.json file.

@Michael
Great! thank you for the update. I'm still seeing the <br> tags not parsing correctly on help text and descriptions. My patch is here if you want to take a look.

Mh, after trying it out, it seems <br> tags are not supported in any js-based interface message. The

I refactored to keep our validation and config hooks in place alongside the community configuration form.
I did this because of feedback from RTL and also when I was testing the user rights configuration, it was updating but causing some strange behavior (queueing the job before the precheck) and wasn't toggling between the values.

Change #1051822 merged by jenkins-bot:

[mediawiki/extensions/AutoModerator@master] Integrate Community Configuration into AutoModerator

One issue that was pointed out to us - the links for Help:Minor edit and Manual:Bots should point to MediaWiki, at the following two links, instead of at the local wiki:

Any idea why the label for the skipped-user-groups field isn't displaying?

This should ideally be pulling options from the list of possible user rights, but I can only select from bot and autopatrol.

If I try to add another group I get an undefined error:

Change #1071939 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] Integrate Community Configuration into AutoModerator - Fix message strings for user rights to skip and add all possible options

Any idea why the label for the skipped-user-groups field isn't displaying?

This is due to the field changing its name from AutoModeratorSkipUserGroups to AutoModeratorSkipUserRights so the form label i18n messages needed to be updated.
I have a follow up patch out that fixes this, the Help:Minor edit and Manual:Bots links, and populating the user rights dynamically.

This should ideally be pulling options from the list of possible user rights, but I can only select from bot and autopatrol.

If I try to add another group I get an undefined error:

This requires a change to Community Configuration to work as we designed it - T374609: Support enums with dynamically generated options in Community Configuration.

In the meantime is there a stopgap version of this feature that we could implement? Something with no validation or options to select from, perhaps?

This should ideally be pulling options from the list of possible user rights, but I can only select from bot and autopatrol.

If I try to add another group I get an undefined error:

This requires a change to Community Configuration to work as we designed it - T374609: Support enums with dynamically generated options in Community Configuration.

In the meantime is there a stopgap version of this feature that we could implement? Something with no validation or options to select from, perhaps?

@Samwalton9-WMF we discussed this yesterday in engineering weekly and found a workaround which I have pushed to this

Change #1071939 merged by jenkins-bot:

[mediawiki/extensions/AutoModerator@master] Integrate Community Configuration into AutoModerator - Fix message strings for user rights to skip and add all possible options

Change #1072649 had a related patch set uploaded (by Scardenasmolinar; author: Scardenasmolinar):

[mediawiki/extensions/AutoModerator@master] Use wikiConfig instead of config when gtting threshold

Samwalton9-WMF added a comment.Sep 13 2024, 8:32 AM

Merged the patch!

Thanks! Checking it out on Beta.

It looks like we don't have any dropdown of possible options, is that intentional? (I think it's OK, just clarifying)

I added some nonsense user rights and it looks like we're missing the automoderator-config-validator-userrights-not-allowed system message in the error:

Merged the patch!

Thanks! Checking it out on Beta.

It looks like we don't have any dropdown of possible options, is that intentional? (I think it's OK, just clarifying)

Yep! We removed the drop down options due to the message strings not populating.

I added some nonsense user rights and it looks like we're missing the automoderator-config-validator-userrights-not-allowed system message in the error:

So what's interesting is that message is actually set to

User right $1 does not exist please try another.

So I'm not sure why it's displaying the message key above it- can you add the query parameter

?uselang=qqx

to the end of the URL when that message appears and let me know what the message key is? I'm not an admin on beta so I cannot click save.

Change #1072805 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] Update copy on caution level description.

Change #1072649 merged by jenkins-bot:

[mediawiki/extensions/AutoModerator@master] Use wikiConfig instead of config when gtting threshold

Samwalton9-WMF added a comment.Sep 16 2024, 9:09 AM

Change #1072805 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] Update copy on caution level description.

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

Can I suggest a small change to add to this patch too, just to clarify the first sentence. I also don't think the second sentence serves a purpose because this should be documented elsewhere, and isn't necessary information when setting the threshold in my opinion.

From

This extension leverages the new revert risk models that can calculate a score for every revision denoting the likelihood that the edit should be reverted. The models support only Wikipedia projects and trained on the main (article) namespace.

to

Automoderator uses machine learning models which calculate a score for every revision, denoting the likelihood that the edit should be revered.

I added some nonsense user rights and it looks like we're missing the automoderator-config-validator-userrights-not-allowed system message in the error:

So what's interesting is that message is actually set to

User right $1 does not exist please try another.

So I'm not sure why it's displaying the message key above it- can you add the query parameter

?uselang=qqx

to the end of the URL when that message appears and let me know what the message key is? I'm not an admin on beta so I cannot click save.

Unfortunately it seems like the page doesn't want to load when the language is set to qqx.

fwiw, the page loads for me

The reason why that text key is shown in the message is because AutoModerator's custom validator yields this as an error code in https://gerrit.wikimedia.org/g/mediawiki/extensions/AutoModerator/+/f2fadadfb57be5cc276ea86e701a9395de49e8fc/src/Config/Validation/AutoModeratorConfigValidation.php#82. The markup is:

<p>{{ errorCode }}</p>
		<ul
			v-if="errorResponse.errors"
		>
			<li
				v-for="( error, index ) in errorResponse.errors"
				:key="index"
				v-html="error.html"
			></li>
		</ul>
...

Change #1073821 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] Fix default caution level

Change #1073821 merged by jenkins-bot:

[mediawiki/extensions/AutoModerator@master] Fix default caution level

fwiw, the page loads for me

The reason why that text key is shown in the message is because AutoModerator's custom validator yields this as an error code in https://gerrit.wikimedia.org/g/mediawiki/extensions/AutoModerator/+/f2fadadfb57be5cc276ea86e701a9395de49e8fc/src/Config/Validation/AutoModeratorConfigValidation.php#82. The markup is:

<p>{{ errorCode }}</p>
		<ul
			v-if="errorResponse.errors"
		>
			<li
				v-for="( error, index ) in errorResponse.errors"
				:key="index"
				v-html="error.html"
			></li>
		</ul>
...

It looks like this is the only remaining work to do here and then we can announce Community Configuration for Automoderator is ready for use!

@Samwalton9-WMF it seems this is the intended behavior if I'm understanding @Sgs correctly.

The errorCode is being displayed above the error message which in our case is the message key.
Do we want the error code to be something other than the message key?

@Samwalton9-WMF it seems this is the intended behavior if I'm understanding @Sgs correctly.

The errorCode is being displayed above the error message which in our case is the message key.
Do we want the error code to be something other than the message key?

Ah, I understand, thanks! I found this confusing because I thought a message wasn't being displayed correctly. I think users only need the bullet point ("User right x does not exist. Please try another.") rather than the error code too, if that's possible?

Samwalton9-WMF added subscribers: BAPerdana-WMF, Dogu, Renvoy.

We talked about this a little more and decided it's not a big deal.

@Dogu @Renvoy @BAPerdana-WMF You can now feel free to use [[Special:CommunityConfiguration/AutoModerator]] on your wiki to configure Automoderator, instead of using MediaWiki:AutoModeratorConfig.json. That MediaWiki page will still contain the json configuration, and will be updated by the Special page, so you can continue to look at its page history, watchlist it, etc. The strings for that Special page are translatable in TranslateWiki if you haven't already.

You may wish to update the 'Configure Automoderator' link on Automoderator's user page to point to this Special page instead of the .json page.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant