Page MenuHomePhabricator

Community configuration: Make use of JSONSchema-provided defaults instead of falling back to GlobalVarConfig
Closed, ResolvedPublic



For config variables that are not defined in the on-wiki JSON page, Community configuration 1.0 attempts to read the same configuration variable (of the same name) from GlobalVarConfig and it uses the GlobalVarConfig-provided value as the fallback. This made sense back then, as Community configuration 1.0 only supports a very rudimentary validation (a datatype-based validation combined with an allowlist of variables).

In Community configuration 2.0, we're adding support for JSONSchemas, which contain a default key. Conceptually, it doesn't make much sense to have information about a configuration provider in multiple places: the JSON schema, extension.json (which needs to define the config variables as well) and possibly operations/mediawiki-config. Instead, we should have as much information as possible in a single place: the JSON schema itself.

If a client extension wishes to use GlobalVarConfig options as the default, we can make use of T358799: CommunityConfiguration: Switch to generating schemas from PHP classes rather than committing them as JSON files directly and simply dynamically load the default from that place, and it should work.

Acceptance Criteria
  • default section of JSONSchema is respected and used in case a configuration variable is not present in the Community configuration
  • Calling IConfigurationProvider::loadValidConfiguration() enhances the data loaded from the configuration store with the defaults

Event Timeline

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

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

[mediawiki/extensions/GrowthExperiments@master] Add GEUseCommunityConfigurationExtension feature flag

Ehh... Wrong task ID copied. Ignore, please.

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

[mediawiki/extensions/CommunityConfiguration@master] Respect JsonSchema defaults

Change 1011310 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Respect JsonSchema defaults

This has been making its way through the QA column for multiple sprints. Considering there were no issues noticed so far, I am boldly closing the task as resolved. Feel free to fill bugs/improvements as folliwups.