Page MenuHomePhabricator

Constraint checks crash if explicit constraint scope differs from supported context types
Closed, ResolvedPublic

Description

If a constraint type is only supported for certain context types (e.g. “mandatory qualifiers” can only be checked on the main snak, not on qualifiers and references), but the constraint scope in the constraint parameters specifies a different context type (e.g. “constraint checked on qualifiers”), we show a warning on the constraint definition –

Screenshot 2021-08-19 at 15-51-03 property with mandatory qualifier constraint.png (245×912 px, 31 KB)

– but when checking the constraint, we ignore the supported context types that the constraint type declares (main snak only), and call the constraint checker on contexts that it doesn’t support. (In the case of the “mandatory qualifiers” checker, this results in a crash.)

Event Timeline

Change 713874 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseQualityConstraints@master] Always use supported context types when parsing scope

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

Change 713874 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Always use supported context types when parsing scope

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