Page MenuHomePhabricator

Test validity of Community Configuration schemas via CI
Closed, ResolvedPublic

Description

MediaWiki-extensions-CommunityConfiguration creates configuration forms for other extension, based on registered schemas. Those schemas need to meet certain requirements to be considered valid by CommunityConfiguration. Those requirements should be validated by CI, to alert developers of a mistake as soon as possible. Validating this within CI is trickier than usually, as the requirements are imposed by the CommunityConfiguration extension, but need to be met within its client extension.

We plan to create a base testing class in CommunityConfiguration, which would contain relevant tests for the schemas. This base class can then be inherited from in client extensions (such as GrowthExperiments, AutoModerator or Babel), actually ensuring the requirements are met. We need to take care to test all schemas, not only schemas that happen to be registered by default (there would likely need to be a separate list of schemas).

Example of rules to validate:

  • all public constants that are arrays contain the required keys to form a schema (JsonSchema::TYPE and JsonSchema::DEFAULT; other keys are required based on the type),
  • JsonSchema is a parent of the schema,
  • verifying at least the required i18n messages exist,
  • maybe: version is included (so that migrations can be done if needed),
  • to ensure integration works: schema builder is capable of generating the schema

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1054350 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] Add abstract TestCase to assert Schema default values

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

KStoller-WMF moved this task from Incoming to Doing on the Growth-Team (Current Sprint) board.

Change #1079236 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] tests: abstract test-case for asserting emergency defaults

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

Change #1079236 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] tests: abstract test-case for asserting emergency defaults

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

Change #1054349 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/GrowthExperiments@master] Add emergency defaults for Homepage and CommunityUpdates

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

Change #1054349 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add emergency defaults for Homepage and CommunityUpdates

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

Change #1081216 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/Babel@master] Add CommunityConfiguration defaults file and Schema test

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

Change #1081223 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/AutoModerator@master] Add CommunityConfiguration defaults file and Schema test

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

Change #1081216 merged by jenkins-bot:

[mediawiki/extensions/Babel@master] Add CommunityConfiguration defaults file and Schema test

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

Change #1082263 had a related patch set uploaded (by Michael Große; author: Michael Große):

[integration/config@master] Automoderator: Make CommunityConfiguration a dependency

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

Change #1082263 merged by jenkins-bot:

[integration/config@master] Automoderator: Make CommunityConfiguration a dependency

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

Change #1081223 merged by jenkins-bot:

[mediawiki/extensions/AutoModerator@master] Add CommunityConfiguration defaults file and Schema test

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

Change #1083132 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] test: assert version is present in every Schema

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

The description lists a bunch of things as "examples", but I think what the changes up for review are currently covering is a good start.

We may wish to add further validation in the future (for example to make sure that a max validation value is not smaller than a min validation value), and this WIP change contains already some first steps in that direction: 1083133: [WIP]tests(SchemaProviderTestCase): assert properties are plausible | https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CommunityConfiguration/+/1083133
But overall, it seems worth leaving that for a future iteration when we have more need/capacity to focus on it.

Change #1054350 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] test: assert default values exist for Schema top-level properties

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

Change #1083132 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] test: assert version is present in every Schema

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