Page MenuHomePhabricator

[MEX][QC] Fetch and store constraint violation information one page load / statement save
Open, Needs TriagePublic

Description

To support the display of constraint violation information in MEX (T400676) we need to fetch the details of current constraint violations from the backend and store them in the wbui pinia store.

The existing implementation of WikibaseQualityConstraints for the front-end is as a bundle of Javascript that is loaded if the wbEntityId and wbIsEditView flags are set (source) and hooks into the wikibase.entityPage.entityLoaded and wikibase.statement.saved hooks (source).

An implementation for MEX would likely need to define a new ResourceLoader module that determines if the wikibase.wbui2025.lib module is loaded (mw.loader.getModuleNames().includes("wikibase.wbui2025.lib") in the skipFunction script), and in that case hook behaviours into wikibase.entityPage.entityLoaded and wikibase.statement.saved hooks that populate the wbui pinia store with information about constraint violations by hitting the wbcheckconstraints API call, possibly using refactored versions of the existing fullCheck and snakCheck functions.

Acceptance Criteria

  • For wikis where WikibaseQualityConstraints is loaded and MEX is enabled and in use, the wbui2025 pinia store is populated with information about constraint violations on entityInit and statement save. (exactly where the information should be stored may depend on the implementation of T411604, but the exact location shouldn't be a blocker to the rest of the implementation)

Event Timeline

ArthurTaylor updated the task description. (Show Details)
ArthurTaylor updated the task description. (Show Details)

hook behaviours into wikibase.entityPage.entityLoaded and wikibase.statement.saved hooks

Note that wbui2025 doesn’t fire the latter hook yet – we’ll have to add that, as part of this task or another one (perhaps T411609). See Hooks JS for the arguments of the hook.

ArthurTaylor renamed this task from [MEX] Fetch and store constraint violation information one page load / statement save to [MEX][QC] Fetch and store constraint violation information one page load / statement save.Dec 4 2025, 7:21 AM

From task time on 4/12 - we would write the icon name, SVG and some associated HTML for the pop-over to the wbui2025 store and allow Wikibase to decide how that should be rendered (or if, for example, icons should be overridden?). Associated HTML here might be a reference to a Vue component that should be rendered inside the popover.

Change #1218239 had a related patch set uploaded (by Hasan Akgün (WMDE); author: Hasan Akgün (WMDE)):

[mediawiki/extensions/WikibaseQualityConstraints@master] Fetch and store constraint violation information one page load / statement save

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

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

[mediawiki/extensions/WikibaseQualityConstraints@master] Refactor gadget code to allow reuse of API functions

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

hoo removed hoo as the assignee of this task.Mon, Dec 22, 5:28 PM
hoo subscribed.

When reviewing this, please especially look for potential XSS / code injection. Other than that, the code looked good to me (I reviewed the combined diff from both patches at once).

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

[mediawiki/extensions/WikibaseQualityConstraints@master] Remove gadget skip function

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

I added a new change to address that comment; I think this is now ready for review again.

Change #1219534 abandoned by Arthur taylor:

[mediawiki/extensions/WikibaseQualityConstraints@master] Refactor gadget code to allow reuse of API functions

Reason:

merged into parent change

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

Change #1224053 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Remove gadget skip function

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

Change #1218239 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Fetch and store constraint violation information

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