Page MenuHomePhabricator

Add Image: Load recommendation data
Closed, ResolvedPublic

Description

Add backend code for fetching image recommendation data for a given page or set of pages:

  • Add an ImageRecommendationProvider service, a static implementation for unit tests (like StaticLinkRecommendationProvider), a subpage-based implementation for testing / developer setups (like SubpageLinkRecommendationProvider) and a client for the image recommendation API (like ServiceLinkRecommendationProvider). (Unlike Add Link, there is no need for caching data in the DB.)
  • Add a value object for holding the returned by the service (like LinkRecommendation + LinkRecommendationMetadata - the split into two separate classes is probably not worth repeating, and there won't be much metadata in any case).
  • Update HomepageHooks::onBeforePageDisplay() to select the appropriate mechanism, based on the task type, to load the task data. One possible way:
    • create a shared interface for LinkRecommendation and the image recommendation equivalent
    • create a shared interface for LinkRecommendationProvider and ImageRecommendationProvider
    • drop LinkRecommendationHelper::getLinkRecommendation(), move the pruning logic to the DB-based link recommendation provider (maybe as a decorator so it can be used with the subpage-based provider as well), have onBeforePageDisplay() call the provider's get() method directly
    • add a TaskTypeHandler method for obtaining the provider service

Event Timeline

kostajh triaged this task as Medium priority.Aug 25 2021, 11:36 AM

Change 715157 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] [WIP] Add Image: Add recommendation data object and providers

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

Change 715338 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] Handle arbitrary recommendation types in BeforePageDisplay

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

kostajh added subscribers: Etonkovidova, kostajh.

I think that's everything here. @Etonkovidova this touched a lot of backend code, so re-verifying various link recommendation workflows would be useful when you are QA'ing. thank you!

Change 715157 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add Image: Add recommendation data object and providers

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

Change 715338 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Handle arbitrary recommendation types in BeforePageDisplay

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