Page MenuHomePhabricator

Prepare upgrade to justinrainbow/json-schema to 6.x in CommunityConfiguration
Open, MediumPublic3 Estimated Story PointsSpike

Description

For the update of the justinrainbow/json-schema library in core (see parent task) several CommunityConfiguration unit tests are failing in JsonSchemaValidatorTest.php, like the following:

00:01:35.130 1) MediaWiki\Extension\CommunityConfiguration\Tests\JsonSchemaValidatorTest::testValidate with data set "wrong type" (MediaWiki\Extension\CommunityConfiguration\Schema\JsonSchema@anonymous/workspace/src/extensions/CommunityConfiguration/tests/phpunit/unit/Validation/JsonSchemaValidatorTest.php:66$27a Object (), array('baz'), false, array('type'), false, false, array(array('Number', '/Number', 'String value found, but a num...quired', array('type'))))
00:01:35.135 Failed asserting that two arrays are identical.
00:01:35.135 --- Expected
00:01:35.135 +++ Actual
00:01:35.135 @@ @@
00:01:35.135  Array &0 (
00:01:35.135 -    0 => 'type'
00:01:35.135 +    0 => Array &1 (
00:01:35.135 +        'name' => 'type'
00:01:35.135 +        'params' => Array &2 (
00:01:35.135 +            'found' => 'string'
00:01:35.135 +            'expected' => 'a number'
00:01:35.135 +        )
00:01:35.135 +    )
00:01:35.135  )
00:01:35.135 
00:01:35.135 /workspace/src/extensions/CommunityConfiguration/tests/phpunit/unit/Validation/JsonSchemaValidatorTest.php:359

We should:

  • figure out if any production code changes are required to make use of the v6 version
  • figure out how to adjust the tests so that they either work with both v5 and v6 of the library, or disable the tests, do the library update, and then reenable them for v6
  • investigate if the new version of the library contains any improvements that we may want to make use of

Event Timeline

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

Change #1233935 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/CommunityConfiguration@master] JsonSchemaValidatorTest: Update for justinrainbow/json-schema 6.x

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

Change #1233943 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/CommunityConfiguration@master] JsonSchemaValidatorTest: Test for justinrainbow/json-schema 6.x

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

Urbanecm_WMF changed the subtype of this task from "Task" to "Spike".Mar 9 2026, 3:19 PM
Urbanecm_WMF subscribed.

This is more of a spike task, where we need to understand what work we need to do.

KStoller-WMF set the point value for this task to 3.Mar 9 2026, 3:56 PM

Ok, so I looked into this, and I think in practice the actual changes are almost only related to tests?

The upgrade changes what the API returns in the additionalData field if there is a validation issue. However, crucially, I could not find any users of that field! (code search, none of the other uses seem to refer to the CommunityConfiguration api.)
That makes somewhat sense, as that field introduced as "intentionally undocumented" in Introduce ValidationStatus.

Still, it would be great if someone could verify that it is indeed unused.

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

[mediawiki/extensions/CommunityConfiguration@master] JsonSchemaValidator: Prepare for justinrainbow/json-schema 6.x

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

I read through your reasoning and the linked code search results. I think your reasoning makes sense, but I'd like an engineer who was on the team when ValidationStatus was introduced to double-check this.

Ok, so I looked into this, and I think in practice the actual changes are almost only related to tests?

The upgrade changes what the API returns in the additionalData field if there is a validation issue. However, crucially, I could not find any users of that field! (code search, none of the other uses seem to refer to the CommunityConfiguration api.)
That makes somewhat sense, as that field introduced as "intentionally undocumented" in Introduce ValidationStatus.

Still, it would be great if someone could verify that it is indeed unused.

It looks indeed unused. I would consider even removing it if we don't have a good use case for it, but that's not part of this task.

Change #1285405 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] JsonSchemaValidator: Prepare for justinrainbow/json-schema 6.x

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