Use ViolationMessage in ConstraintParameterException
Closed, ResolvedPublic

Description

Make ConstraintParameterException accept a ViolationMessage instead of a string. (For a short transition period, probably both, just like ViolationMessageRenderer::render.) The string message passed to the superclass constructor can probably just be the message key – it should never be seen anyways.

Note that this requires T185999: Make ViolationMessage serializable, since CPEs are serialized and deserialized by SparqlHelper in the regex cache.

Patch-For-Review:

Lucas_Werkmeister_WMDE updated the task description. (Show Details)

Actually, the transition period will have to be a bit longer, since we need to support pre-rendered messages out of the SparqlHelper regexp cache for at least the duration of one deployment. And in fact we might need to find some mechanism to explicitly evict such old entries, otherwise the more commonly used ones might stay in cache for a long time.

Change 410420 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Inject ViolationMessageSerializer and -Deserializer

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

Change 410420 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Inject ViolationMessageSerializer and -Deserializer

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

WMDE-leszek renamed this task from Use ViolationMessage in ConstraintParameterException to Use ViolationMessage in ConstraintParameterException (days: 1).Feb 14 2018, 2:13 PM
WMDE-leszek renamed this task from Use ViolationMessage in ConstraintParameterException (days: 1) to Use ViolationMessage in ConstraintParameterException.Feb 15 2018, 10:38 AM
WMDE-leszek removed a project: Patch-For-Review.
WMDE-leszek updated the task description. (Show Details)
WMDE-leszek moved this task from Review to In Progress on the Wikidata-Sprint-2018-02-14 board.

Regarding the transition period… I’m not sure if we even need to have one. At some point we will have to throw out invalid CPEs, and just doing it up-front shouldn’t hurt too much, I think. We have plenty of other checks that always hit WDQS, so I think a few more queries to WDQS should be acceptable. (Keep in mind that the CPE only happens in the first place in case of an invalid regex, which should be rare.)

Change 411305 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Use ConstraintParameterException::getViolationMessage()

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

Change 411306 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Extract ConstraintParameterException serialization

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

Change 411307 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Use ViolationMessageRenderer in CheckConstraintParameters

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

Change 411308 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Support ViolationMessage in ConstraintParameterException

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

Change 411309 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Use ViolationMessage in ConstraintParameterParser

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

Change 412675 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Remove plain message CPE serializations from cache map

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

Change 411305 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Use ConstraintParameterException::getViolationMessage()

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

Lucas_Werkmeister_WMDE updated the task description. (Show Details)

Change 411306 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Extract ConstraintParameterException serialization

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

Change 411307 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Use ViolationMessageRenderer in CheckConstraintParameters

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

Change 411308 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Support ViolationMessage in ConstraintParameterException

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

Change 411309 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Use ViolationMessage in ConstraintParameterParser

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

Lucas_Werkmeister_WMDE closed this task as Resolved.
Lucas_Werkmeister_WMDE moved this task from Review to Done on the Wikidata-Sprint-2018-02-14 board.

Change 412675 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Remove plain message CPE serializations from cache map

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