Page MenuHomePhabricator

CommunityConfiguration: Support minimum / maximum validation constraints for JSONSchema
Closed, ResolvedPublic

Description

CommunityConfiguration is built on top of JSON schemas, reusing the basic JSON datatypes, such as number (or integer). In certain cases, it only makes sense to use positive (non-negative) numbers/integers. In JSONSchema, this can be set using the minimum / maximum validation constraints. However, those constraints are not yet respected by CommunityConfiguration. Let's add the support for them, as it would be useful for certain fields
GrowthExperiments, such as Maximum number of links to show per task.

Acceptance Criteria
  • Representation of JSONSchema in CommunityConfiguration allows users to set minimum/maximum value for numbers/integers
Original description

As of now, no numeric fields do not complain when a negative number is added. For example, at https://es.wikipedia.beta.wmflabs.org/wiki/Especial:CommunityConfiguration/GrowthSuggestedEdits, it is completely possible to configure a negative number under Maximum number of links to show per task:

image.png (760×2 px, 125 KB)

Using a negative number in this place does not make any sense at all, but it's currently allowed.

Event Timeline

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

This is a low-priority enhancement. But, we already got a patch for this in T364056 (thanks @Michael!).

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

[mediawiki/extensions/GrowthExperiments@master] Add validation to max number of image validation tasks per day config

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

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

[mediawiki/extensions/CommunityConfiguration@master] Add validation for Min/Max numbers

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

Provisionally assigning to @Michael, as the author of the patches. Please move to sprint if you intend to continue working or this, or unclaim if not (both would be fine I think, up to you). Thanks!

I'm unassigning as I will be off until Tuesday. If someone wants to work on this till then, that's fine.

Overall, my understanding behind this work is/was that we want GrowthExperiments to behave functionally the same with or without CommunityConfiguration. It is/was my understanding that GE sets limits for what values some configuration options can take, for example the config option for the maximum number of tasks per day must not have a value lower than two.
If that restrained is enforced in the configuration of GrowthExperiments, then it makes sense for the restraint to be available in CommunityConfiguration as well, because otherwise enabling CommunityConfiguration would allow users to set configuration options designed as undesired in GE.
If, however, GE is enforcing that constraint in its business logic (or at least some wiring close to it) and that would also apply to the data coming from CommunityConfiguration, then this task is much less urgent and can probably be tackled as a subtask of T358659.

Change #1031896 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Add validation for Min/Max numbers

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

Change #1031898 abandoned by Michael Große:

[mediawiki/extensions/GrowthExperiments@master] Add validation to max number of image validation tasks per day config

Reason:

Let's abandon this for now. We should probably do a sweep later and add min/max in all GE schemas in a single commit

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

Urbanecm_WMF renamed this task from Suggested edits configuration: Make it impossible to save negative numbers for numerical fields where that makes no sense to CommunityConfiguration: Support minimum / maximum validation constraints for JSONSchema.Jun 17 2024, 9:52 AM
Urbanecm_WMF updated the task description. (Show Details)
Urbanecm_WMF assigned this task to Michael.

I decided to split the GrowthExperiments follow-up to T367720: GrowthExperiments CommunityConfiguration: Add minimum and maximum validation constraints to applicable fields, as this task reached some state of completionness. I did this mainly so that I could fill a bug (T367721) I just found in the merged patch in a meaningful way. Since there is nothing else to follow up here, closing as Resolved.