Background
2028-09-17 MinT for Readers AA test missing subject IDs incident report includes a recommendation that would have prevented the cause (a subtly misconfigured stream) of the issue:
To safeguard against future incidents like this, we highly recommend for wgEventStreams to have a schema and for there to be a test that validates the stream configuration against that schema, preventing patches from being merged if the resulting stream configuration does not pass schema validation.
Another example of a subtle stream misconfiguration is:
The schema_title does not have a '/' at the beginning. schema_title must match exactly the title of the JSONSchema.
In that case, since we know that schemas in the primary and secondary repositories do not have a '/' at the beginning, we could have a regular expression to catch certain mistakes (e.g. starts with '/', includes a version number)
Additional notes
- https://opis.io/json-schema/
- is an Apache-licensed open source PHP library
- supports draft-2020-12, draft-2019-09, draft-07 and draft-06 of JSON Schema
- is in use in production by Wikilambda (T290274)
- there are plans to migrate others to its use: T293710: Migrate from justinrainbow/json-schema to opis/json-schema and remove from MW vendor
- Is there a location in https://gerrit.wikimedia.org/r/plugins/gitiles/operations/mediawiki-config/+/refs/heads/master where the schema can live?
Acceptance criteria
- Schema for wgEventStreams (preferably using JSONSchema draft-2020-12)
- Note: there's a draft available to use: https://gitlab.wikimedia.org/bearloga/eventstreamconfig-schema-prototype/-/blob/main/eventstreamconfig/1.0.0.yml?ref_type=heads
- Test in operations/mediawiki-config that validates wgEventStreams against that schema (using a validator that supports draft-2020-12)