Page MenuHomePhabricator

CX desktop editor: Draft restoration fails
Closed, ResolvedPublic1 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  1. Open the CX dashboard on desktop, and select an in-progress translation to continue. If you don't have any draft translation, you should create one before following these steps.
  2. Continue to the desktop editor

What happens?:
An error message saying Unable to fetch draft information. appears and the draft translation is not restored. The API request that fetches the draft returns with the following execution error:

"error": {
        "code": "internal_api_error_TypeError",
        "info": "[8d317714-89b9-47a1-a608-aaa5dce0e784] Exception caught: ContentTranslation\\Translation::getStatus(): Return value must be of type string, null returned",
        "errorclass": "TypeError",
        "trace": "TypeError at /srv/mediawiki/php-1.45.0-wmf.10/extensions/ContentTranslation/includes/Translation.php(129)\nfrom /srv/mediawiki/php-1.45.0-wmf.10/extensions/ContentTranslation/includes/Translation.php(129)\n#0 /srv/mediawiki/php-1.45.0-wmf.10/extensions/ContentTranslation/includes/ActionApi/ApiQueryContentTranslation.php(209): ContentTranslation\\Translation->getStatus()\n#1 /srv/mediawiki/php-1.45.0-wmf.10/extensions/ContentTranslation/includes/ActionApi/ApiQueryContentTranslation.php(100): ContentTranslation\\ActionApi\\ApiQueryContentTranslation->serveDesktopEditorDraft(array)\n#2 /srv/mediawiki/php-1.45.0-wmf.10/extensions/ContentTranslation/includes/ActionApi/ApiQueryContentTranslation.php(52): ContentTranslation\\ActionApi\\ApiQueryContentTranslation->run()\n#3 /srv/mediawiki/php-1.45.0-wmf.10/includes/api/ApiQuery.php(745): ContentTranslation\\ActionApi\\ApiQueryContentTranslation->execute()\n#4 /srv/mediawiki/php-1.45.0-wmf.10/includes/api/ApiMain.php(2016): MediaWiki\\Api\\ApiQuery->execute()\n#5 /srv/mediawiki/php-1.45.0-wmf.10/includes/api/ApiMain.php(954): MediaWiki\\Api\\ApiMain->executeAction()\n#6 /srv/mediawiki/php-1.45.0-wmf.10/includes/api/ApiMain.php(925): MediaWiki\\Api\\ApiMain->executeActionWithErrorHandling()\n#7 /srv/mediawiki/php-1.45.0-wmf.10/includes/api/ApiEntryPoint.php(152): MediaWiki\\Api\\ApiMain->execute()\n#8 /srv/mediawiki/php-1.45.0-wmf.10/includes/MediaWikiEntryPoint.php(198): MediaWiki\\Api\\ApiEntryPoint->execute()\n#9 /srv/mediawiki/php-1.45.0-wmf.10/api.php(44): MediaWiki\\MediaWikiEntryPoint->run()\n#10 /srv/mediawiki/w/api.php(3): require(string)\n#11 {main}"
    },

The issue is caused by this patch: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/1163413

What should have happened instead?:
No error should appear, the API request should return the draft information and the corresponding translation units and the draft translation should be properly restored.

Screencast from test wiki

Derived Requirement
When resuming an in-progress translation from the CX dashboard in desktop mode, the draft restoration API should return complete draft data without error, and the editor should load the previously saved translation units. The API must not fail due to missing or null values (e.g., in Translation::getStatus()), and draft restoration should function reliably after https://gerrit.wikimedia.org/r/1163413.

Test Result - TestWiki

Status: ✅ PASS / ❓Need More Info / ❌ FAIL
Environment: beta/xyzwiki
OS: macOS Sequoia 15.5
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure draft translation is properly restored in CX desktop editor

  1. Go to Special:ContentTranslation on desktop.
  2. Start a new translation of any article from source language (e.g., English) to a target language (e.g., French).
  3. Translate a few units (lead section or more) and wait for the draft to auto-save.
  4. Return to the CX dashboard.
  5. Select the in-progress translation to continue.
  6. ✅❓❌⬜ AC1: Confirm that no error appears (e.g., "Unable to fetch draft information").
  7. ✅❓❌⬜ AC2: Confirm that the draft loads successfully and all previously translated content is restored in the editor.

Test Case 2: Ensure API response for draft includes valid status

  1. Open browser dev tools → Network tab.
  2. Resume an in-progress translation from the CX dashboard.
  3. Filter for the API call related to the draft (e.g., action=query&meta=contenttranslation).
  4. ✅❓❌⬜ AC3: Confirm that the API response includes a valid "status" field and does not return an internal server error.

QA Results - TestWiki

ACStatusDetails
1T399732#11011404
2T399732#11011404
3T399732#11011404

Event Timeline

ngkountas triaged this task as Unbreak Now! priority.
ngkountas set the point value for this task to 1.

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

[mediawiki/extensions/ContentTranslation@master] CX Translation::getStatus: Fix method to properly return the status

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

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

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.10] CX Translation::getStatus: Fix method to properly return the status

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

Change #1170182 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX Translation::getStatus: Fix method to properly return the status

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

Change #1170202 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.10] CX Translation::getStatus: Fix method to properly return the status

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

Mentioned in SAL (#wikimedia-operations) [2025-07-16T20:21:20Z] <bvibber@deploy1003> Started scap sync-world: Backport for [[gerrit:1170202|CX Translation::getStatus: Fix method to properly return the status (T399732)]]

Mentioned in SAL (#wikimedia-operations) [2025-07-16T20:23:35Z] <bvibber@deploy1003> bvibber, sbisson: Backport for [[gerrit:1170202|CX Translation::getStatus: Fix method to properly return the status (T399732)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-07-16T20:31:58Z] <bvibber@deploy1003> Finished scap sync-world: Backport for [[gerrit:1170202|CX Translation::getStatus: Fix method to properly return the status (T399732)]] (duration: 10m 38s)

@ngkountas No error should appear, the API request should return the draft information and the corresponding translation units and the draft translation should be properly restored, as seen in the videos below. I will move this to Sign-off. Thanks for all your work!

Test Result - TestWiki

Status: ✅ PASS
Environment: TestWiki
OS: macOS Sequoia 15.5
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure draft translation is properly restored in CX desktop editor

  1. Go to Special:ContentTranslation on desktop.
  2. Start a new translation of any article from source language (e.g., English) to a target language (e.g., French).
  3. Translate a few units (lead section or more) and wait for the draft to auto-save.
  4. Return to the CX dashboard.
  5. Select the in-progress translation to continue.
  6. AC1: Confirm that no error appears (e.g., "Unable to fetch draft information").

  1. AC2: Confirm that the draft loads successfully and all previously translated content is restored in the editor.

See AC1

Test Case 2: Ensure API response for draft includes valid status

  1. Open browser dev tools → Network tab.
  2. Resume an in-progress translation from the CX dashboard.
  3. Filter for the API call related to the draft (e.g., action=query&meta=contenttranslation).
  4. AC3: Confirm that the API response includes a valid "status" field and does not return an internal server error.

GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.
GMikesell-WMF moved this task from Needs QA to Design Signoff on the LPL Hypothesis board.

Didn't come across the error, moving to product signoff