A user reported that the user's personal upload [[ https://commons.wikimedia.org/wiki/File:Kameldornbaum_Sossusvlei.jpg | File:Kameldornbaum_Sossusvlei.jpg ]] is appearing in CAT but with no label suggestions. Examination of the DB revealed that the label suggestion reviews are in an inconsistent state: all have votes of 1 (accepted) or -1 (rejected) except for one which has a -2 (withheld) state. The expectation is that the reviews will be either all 0s, all -2s, or a combination of 1s and -1s.
Here's what appears to have hapened:
- The image was loaded in CAT, and labels were requested
- One suggested Wikidata ID value (Q6484949) refers to a deleted item, so no text label was returned with it, and it was omitted from being shown in the voting UI.
- Votes were submitted for all suggestions but that one; four were accepted. A wbsetclaim request was made to set the four depicts statements.
- In the PageContentSaveComplete hook handler following the claim submission, the file was checked (again) for inclusion in CAT using TitleFilter, failed because it now had more than 1 (`MachineVisionMaxExistingDepictsStatements`) existing depicts statements, and the remaining, not-voted-upon label suggestion was marked withheld (-2).
- Now, when the user requests unreviewed personal images in CAT, the image is identified as a candidate for voting because it is a personal upload with one or more suggested labels in state 0 (unreviewed) or -2 (withheld), but the only suggestion remaining in one of those states cannot be shown because it has no text label available.
Needed follow-ups:
[x] When a label suggestion is received by the frontend with no label provided, submit a 'not-displayed' vote on it if and when the user submits votes.
[] Improve detection of deleted Wikidata items when storing label suggestions so that invalid item IDs are discarded.
[] Clean up faulty data in the DB.