If an entity has no statements, then we don’t have any CheckResults to store in the result array (not even NullResults), so CheckingResultsBuilder returns a completely empty array. This is already a violation of the wbcheckconstraints API, I think (consumers should probably be able to expect the entity ID and an empty claims array, at least), but it also results in an error in CachingResultsBuilder when trying to access the results for that entity to cache them:
Notice: Undefined index: Q50580715 in /srv/mediawiki/php-1.31.0-wmf.25/extensions/WikibaseQualityConstraints/src/Api/CachingResultsBuilder.php on line 242
Not sure what the best solution for this will be… probably some kind of NullContextCursor (only entity ID, no statement etc.) that we can plug into the NullResult we already have from T178160?
Patch-For-Review (two chains):
- quick fix:
- proper fix:
- refactoring
- [add EntityContextCursor](https://gerrit.wikimedia.org/r/420320)
- actual fix