Page MenuHomePhabricator

Repurpose ApiQueryContentTranslationSuggestions API module to only serve favorite suggestions
Closed, ResolvedPublic2 Estimated Story Points

Description

Currently, CX has two legacy tables in its database infrastructure, that were used to serve suggestions in previous CX versions: cx_lists and cx_suggestions. However, the Unified Dashboard doesn't make any use of these tables except one single case: the favorite suggestions.

In the past there was also a API module to support addition and removal of suggestions to suggestion lists named ApiContentTranslationSuggestionList, but that was removed as part of T395653, and it was replaced with a new API module named ApiContentTranslationFavoriteSuggestions (T397354).

Following the same logic, this task proposes the renaming of the ApiQueryContentTranslationSuggestions API module to ApiQueryContentTranslationFavoriteSuggestions and its repurposing to only serve favorite suggestions, as no other kind of suggestions are anymore stored in the databases.


Derived Requirement

Repurpose the ApiQueryContentTranslationSuggestions API module to serve only favorite suggestions and rename it to ApiQueryContentTranslationFavoriteSuggestions.
The updated API should:

  • Retrieve only favorite suggestions from the database.
  • Exclude all other suggestion types previously stored in legacy tables (cx_lists and cx_suggestions).
  • Maintain existing functionality for querying, filtering, and returning user-specific favorite suggestions.
  • Ensure compatibility with the Unified Dashboard, which relies solely on favorite suggestions.
Test Steps

Test Case 1: Verify API renaming

  1. Access the API sandbox or endpoint for ApiQueryContentTranslationFavoriteSuggestions.
  2. Execute a GET request to confirm endpoint accessibility.
  3. ✅❓❌⬜ AC1: Confirm that the endpoint ApiQueryContentTranslationFavoriteSuggestions exists and ApiQueryContentTranslationSuggestions is deprecated or removed.

Test Case 2: Verify only favorite suggestions are returned

  1. Using the new ApiQueryContentTranslationFavoriteSuggestions endpoint, execute a query as a logged-in user with saved favorite suggestions.
  2. Review the API response payload.
  3. ✅❓❌⬜ AC2: Confirm that the returned data includes only favorite suggestions (no other suggestion types).

Test Case 3: Verify no legacy data (non-favorite suggestions) are served

  1. Query the API using a user account that has data in the legacy tables (cx_lists or cx_suggestions) but no favorite suggestions.
  2. ✅❓❌⬜ AC3: Confirm that the response is empty or includes only favorite suggestions, not legacy entries.

QA Results - TestWiki

ACStatusDetails
1T404049#11256995
2T404049#11256995
3T404049#11256995

Event Timeline

ngkountas changed the task status from Open to In Progress.Sep 9 2025, 9:00 AM
ngkountas triaged this task as Medium priority.
ngkountas set the point value for this task to 2.
ngkountas moved this task from Prioritized to In-progress on the LPL Hypothesis board.

Change #1186450 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Rename and repurpose ApiQueryContentTranslationSuggestions

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

Change #1186450 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Rename and repurpose ApiQueryContentTranslationSuggestions

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

Change #1192155 had a related patch set uploaded (by Eamedina; author: Eamedina):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250929

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

Change #1192155 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250929

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

@ngkountas Confirmed repurpose ApiQueryContentTranslationSuggestions API module to only serve favorite suggestions, as seen in videos. I will move this to Sign-off. Thanks for all your work!

Test Result - Test Wiki

Status: ✅ PASS
Environment: Test Wiki
OS: macOS Tahoe 26.0.1
Browser: Chrome 140
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&filter-type=automatic&filter-id=previous-edits&active-list=suggestions&from=en&to=es#/
https://test.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=&list=contenttranslationfavoritesuggestions&formatversion=2

Test Steps

Test Case 1: Verify API renaming

  1. Access the API sandbox or endpoint for ApiQueryContentTranslationFavoriteSuggestions.
  2. Execute a GET request to confirm endpoint accessibility.
  3. AC1: Confirm that the endpoint ApiQueryContentTranslationFavoriteSuggestions exists and ApiQueryContentTranslationSuggestions is deprecated or removed.

Test Case 2: Verify only favorite suggestions are returned

  1. Using the new ApiQueryContentTranslationFavoriteSuggestions endpoint, execute a query as a logged-in user with saved favorite suggestions.
  2. Review the API response payload.
  3. AC2: Confirm that the returned data includes only favorite suggestions (no other suggestion types).

See AC1

Test Case 3: Verify no legacy data (non-favorite suggestions) are served

  1. Query the API using a user account that has data in the legacy tables (cx_lists or cx_suggestions) but no favorite suggestions.
  2. AC3: Confirm that the response is empty or includes only favorite suggestions, not legacy entries.

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF moved this task from Needs QA to Design Signoff on the LPL Hypothesis board.

@ngkountas Is there a follow-up tasks to remove/sunset the database tables? I assume those need to be cleaned up too.

There is no database table left unused even after the latest changes, as we still follow the old way of fetching and storing suggestions, the difference is that we only store/fetch favorite suggestions now and no other type of suggestions is supported. That means we still rely on both cx_lists and cx_suggestions database tables. Of course, there is no longer need for two tables, but that would require the creation of a new table (cx_favorite_suggestions) and some data migration to avoid losing existing favorites. Then, we could drop cx_lists and cx_suggestions tables. If this is something we want to do, I can create a task about it.