Page MenuHomePhabricator

CX: Modify query endpoint to fetch translations based on the UI scenario that needs them
Closed, ResolvedPublic

Description

Currently, the contenttranslation list endpoint for the query action is used in 6 different cases:

  1. Inside SX/unified dashboard, to fetch the draft and published translations (in these requests the sectiontranslationsonly param is set).
  2. When a draft translation is continued on mobile, in order to fetch the translation corpora units (the translationid is passed as parameter in this case)
  3. Inside the translation lists of the CX (desktop) dashboard to fetch draft and published translations (where the type parameter is used)
  4. Inside the RecommendTool to fetch translations to be used as seeds (here the sourcelanguage and targetlanguage params are used)
  5. Inside desktop editor, during translation initialization, to fetch draft translation and check for conflicting translations if needed (here the sourcelanguage, targetlanguage and the sourcetitle are used as parameters)
  6. Inside desktop editor, during translation initialization, to fetch translation corpora units in case of continuing a draft translation (the translationid is passed as parameter in this case)

The contenttranslation list exposes several optional parameters and the results that are being returned in each request, depend on some combination of the given request parameters. These parameters are supposed to provide some versatility in this query action, but in fact the caller must be aware of the specific combination they need to provide, in order to fetch the translations for a specific scenario.

A very indicative example of this complexity is the case no. 5, where when a registered user sends a request with the "sourcetitle", "sourcelanguage" and "targetlanguage" params, the response may contain a draft translation (if such translation is found for the current user) or a conflicting translation. On the other hand, for the cases no. 2 and no. 6, where only the "translationid" parameter is passed to the request, a draft translation, the translation corpora units and the target categories are returned. These differences in the response payloads cannot be anticipated by an unsuspected caller, and thus there is no added versatility through the several exposed parameters.

Based on the above analysis, in order to provide a clearer interface for the identified usecases, and avoid the complexity of all the different combinations, this task proposes the introduction of a usecase parameter that will support the translation retrieval for each one of the 5 usecases presented above. For now, we can continue to support the old combinations too, for backward compatibility, if it's needed.

Event Timeline

ngkountas triaged this task as Medium priority.Oct 10 2023, 6:19 PM
ngkountas added a project: ContentTranslation.

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

[mediawiki/extensions/ContentTranslation@master] CX contenttranslation list: Add "usecase" parameter

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

Change 964863 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX contenttranslation list: Add "usecase" parameter

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

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

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20231026

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

Change 969073 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20231026

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

Change 968776 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@wmf/1.42.0-wmf.2] CX3 Build 0.2.0+20231026

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

Change 968777 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@wmf/1.42.0-wmf.1] CX3 Build 0.2.0+20231026

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

Change 968777 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.42.0-wmf.1] CX3 Build 0.2.0+20231026

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

Mentioned in SAL (#wikimedia-operations) [2023-10-26T13:31:10Z] <lucaswerkmeister-wmde@deploy2002> Started scap: Backport for [[gerrit:968777|CX3 Build 0.2.0+20231026 (T348563 T308836)]]

Mentioned in SAL (#wikimedia-operations) [2023-10-26T13:32:30Z] <lucaswerkmeister-wmde@deploy2002> lucaswerkmeister-wmde and kartik: Backport for [[gerrit:968777|CX3 Build 0.2.0+20231026 (T348563 T308836)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2023-10-26T13:45:58Z] <lucaswerkmeister-wmde@deploy2002> Finished scap: Backport for [[gerrit:968777|CX3 Build 0.2.0+20231026 (T348563 T308836)]] (duration: 14m 48s)

Change 968776 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.42.0-wmf.2] CX3 Build 0.2.0+20231026

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

Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:38:16Z] <lucaswerkmeister-wmde@deploy2002> Started scap: Backport for [[gerrit:968776|CX3 Build 0.2.0+20231026 (T348563 T308836)]]

Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:39:36Z] <lucaswerkmeister-wmde@deploy2002> kartik and lucaswerkmeister-wmde: Backport for [[gerrit:968776|CX3 Build 0.2.0+20231026 (T348563 T308836)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:52:18Z] <lucaswerkmeister-wmde@deploy2002> Finished scap: Backport for [[gerrit:968776|CX3 Build 0.2.0+20231026 (T348563 T308836)]] (duration: 14m 01s)

QA Scenario 1:

The "usecase" parameter set to "unified-dashboard" is used to fetch the draft and the published translations. Separate requests are used, and the "type" parameter defines which kind of translations should be fetched (draft or published)

Screenshot 2023-11-07 at 17.06.57.png (1×2 px, 590 KB)

Screenshot 2023-11-07 at 17.06.49.png (1×2 px, 635 KB)

QA Scenario 2:

The "usecase" parameter set to "translation-corpora-units" is used to fetch the translation corpora units during draft translation restoration in mobile editor.

Screenshot 2023-11-07 at 17.11.46.png (1×2 px, 602 KB)

QA Scenario 5-6:

The "usecase" parameter set to "desktop-editor-draft" is used to fetch the draft translation info, as well as the translation corpora units, during draft translation restoration in desktop editor. The previous 2 separate requests are now combined into a single one, as demonstrated in the following screenshots.

Screenshot 2023-11-07 at 17.19.55.png (2×3 px, 771 KB)

Screenshot 2023-11-07 at 17.21.30.png (2×3 px, 903 KB)

Scenarios 3 and 4 have not been changed, and continue to work with the previous implementation. This is because we are soon moving to the unified dashboard, and it didn't make sense to spend time on refactoring code that will soon be obsolete. Based on above QA, this task can be considered as done.