Page MenuHomePhabricator

[MEX][QC][SPIKE] Correctly associate constraint violations with snaks in wbui2025
Closed, ResolvedPublic

Description

In wbui2025, we’re currently saving the constraint violations of each snak in a Map that stores constraint violations of each snak hash. This means we’re assuming that the same snak will always have the same violations. However, this is not true: constraint checks are highly contextual, and the same snak can have very different constraint check results based on where it occurs (on which entity; as a main snak, qualifier, or reference) and which other snaks are “next” to it (other statements on the same entity, qualifiers on the same statement, or snaks in the same reference).

In the following example, the snak “property with single value constraint – value A” is fine in the first reference, but problematic in the second reference:

image.png (337×524 px, 42 KB)

We need to fix the data structure, and the way in which WikibaseQualityConstraints sends the indicator contents to Wikibase, so that each snak is identified completely uniquely. (Historical note: the wbcheckconstraints response originally didn’t include enough information to completely identify each snak either, which is why we ended up overhauling the response structure as part of rolling out constraint checks on qualifiers and references: see T174544: Document, announce, and use new wbcheckconstraints API format on Wikidata.)

Acceptance criteria for the spike (timebox 8 h):

  • We have a general idea of how to implement this, including the necessary changes in (probably) both Wikibase and WikibaseQualityConstraints
  • If the implementation is straightforward enough, it may happen directly in this spike, otherwise one or more follow-up tasks with details have been created

Event Timeline

Lucas_Werkmeister_WMDE renamed this task from [MEX] Correctly associate constraint violations with snaks in wbui2025 to [MEX][QC] Correctly associate constraint violations with snaks in wbui2025.Jan 27 2026, 10:21 AM
Lucas_Werkmeister_WMDE renamed this task from [MEX][QC] Correctly associate constraint violations with snaks in wbui2025 to [MEX][QC][SPIKE] Correctly associate constraint violations with snaks in wbui2025.Jan 27 2026, 10:44 AM
Lucas_Werkmeister_WMDE updated the task description. (Show Details)
Lucas_Werkmeister_WMDE updated the task description. (Show Details)

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

[mediawiki/extensions/Wikibase@master] WIP: Separate snak indicators/popovers per context

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

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

[mediawiki/extensions/WikibaseQualityConstraints@master] Add constraint reports for qualifiers+references in wbui2025

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

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

[mediawiki/extensions/Wikibase@master] Remove compatibility interface for indicators/popovers

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

I think this is now finally ready for review (unless CI unexpectedly still fails).

Change #1239115 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Separate snak indicators/popovers per context

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

Change #1239116 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Add constraint reports for qualifiers+references in wbui2025

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

Change #1239117 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Remove compatibility interface for indicators/popovers

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

Change #1240604 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Add missing statementId property to snakValue spec

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

Change #1240604 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Add missing statementId property to snakValue spec

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