Page MenuHomePhabricator

Article cannot be published without any visible sign other than console error
Open, MediumPublic

Description

As reported by an Indonesian editor (T219851#5163519, and T219851#5166850):

I just try to publish my translation (Asuka Langley Soryu from en to id, Translation ID: 648911), but it won't let me. Even after I change the publish destination to my own user namespace. The button "Publishing..." stays in grey after clicking, and the Developer Console says this:
In Firefox:

TypeError: string is undefined load.php:2293:192
  jQuery:
  tokenise
  getUnmodifiedMTPercentageInTranslation

In Chrome:

Uncaught TypeError: Cannot read property 'match' of undefined
    at Object.mw.cx.TranslationTracker.static.tokenise (<anonymous>:872:206)
    at MwCXTranslationTracker.<anonymous> (<anonymous>:881:901)
    at Array.forEach (<anonymous>)
    at MwCXTranslationTracker.mw.cx.TranslationTracker.getUnmodifiedMTPercentageInTranslation (<anonymous>:881:774)
    at MwCxTranslationController.mw.cx.TranslationController.checkForMTAbuse (<anonymous>:869:815)
    at MwCxTranslationController.mw.cx.TranslationController.publish (<anonymous>:866:183)
    at VeInitMwCXTarget.oo.EventEmitter.emit (<anonymous>:68:486)
    at VeInitMwCXTarget.ve.init.mw.CXTarget.onPublishButtonClick (<anonymous>:347:461)
    at VeUiCXPublishTool.ve.ui.CXPublishTool.onSelect (<anonymous>:357:477)
    at OoUiBarToolGroup.OO.ui.ToolGroup.onMouseKeyUp (<anonymous>:126:569)

...
When I click "Publish", it just stuck. But in the console, I found "Uncaught TypeError: Cannot read property 'match' of undefined" like mentioned on the post before.

I created this link to translate a replica of the article. In my experiment, I was able to publish a translation for all the paragraphs using MT (replacing one paragraph with test text just to pass the limits). So I could not reproduce the issue initially. When edited the article further to move the test text at the end of the article in a new section, I experienced the same error mentioned above (maybe restoring the translation is a key step to reproduce the error):

Uncaught TypeError: Cannot read property 'match' of undefined
    at Object.mw.cx.TranslationTracker.static.tokenise (<anonymous>:872:206)
    at MwCXTranslationTracker.<anonymous> (<anonymous>:881:901)
    at Array.forEach (<anonymous>)
    at MwCXTranslationTracker.mw.cx.TranslationTracker.getUnmodifiedMTPercentageInTranslation (<anonymous>:881:774)
    at MwCxTranslationController.mw.cx.TranslationController.checkForMTAbuse (<anonymous>:869:815)
    at MwCxTranslationController.mw.cx.TranslationController.publish (<anonymous>:866:183)
    at VeInitMwCXTarget.oo.EventEmitter.emit (<anonymous>:68:486)
    at VeInitMwCXTarget.ve.init.mw.CXTarget.onPublishButtonClick (<anonymous>:347:461)
    at VeUiCXPublishTool.ve.ui.CXPublishTool.onSelect (<anonymous>:357:477)
    at OoUiBarToolGroup.OO.ui.ToolGroup.onMouseKeyUp (<anonymous>:126:569)

Details

Related Gerrit Patches:
mediawiki/extensions/ContentTranslation : masterDon't match whitespace as included content while restoring

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 9 2019, 1:19 PM
Pginer-WMF updated the task description. (Show Details)May 9 2019, 1:42 PM
Pginer-WMF triaged this task as Medium priority.May 9 2019, 1:47 PM
Pginer-WMF updated the task description. (Show Details)
Pginer-WMF added subscribers: santhosh, Petar.petkovic.

Reports about this error used these articles:

Loading these examples into Content Translation tool, we see that they start with an empty paragraph. Error described in this ticket will always happen when restoring gets broken and sections with content gets restored against blank sections at the top, like described in T222905. I suspect that both reports (from @Etonkovidova and @williamsp) involved loading articles from draft state before trying to publish.

The error logged in console will prevent publishing, and is guaranteed to happen when restoring fails. Whether this is the only way to reproduce it, I don't know. Doesn't look like this error can happen without restoring step.
We can add some extra checks in code to guard against cases like this, but I think solving T222905 is the right way to approach this.

The console error that you see is the reason publishing is stuck. @Pginer-WMF created T222882 to track the error, and I think wrong restoring of sections described in T222905 is the cause. In your previous comments, it seems you have been going back to dashboard and loading the draft translation again. Can you confirm that you had section restored wrongly like described in T222905 when you encountered the error you're talking about? Wrong section restoration means that there is empty section on top, against which some content is restored, like you can see here:

Yes, I have been going back to dashboard and loading the draft translation again. Usually I can do this many times before publishing the article. In my spare time, usually I only translate one section first, and continue it later on another spare time. In case my translation on Asuka Langley Soryu, there is a wrong section restoration. But there are no empty section on top like the screenshot you provide before.

Initially, the infobox was not shown in the CT, so I just continue to translate the other paragraphs. Later, when I open the draft, the infobox magically appears, but it was linked with my translation for the first paragraph. The actual first paragraph now has no translation next to it. But, the second paragraph correctly linked to the translation for it.

Later, I cut the translation for the infobox (which is actually for the opening paragraph), and leave it with empty paragraph on the translation. Next, I re-add translation for the opening paragraph (with MT), and paste my clipboard there and do some other modifications.

After come back later, the infobox is still there with blank translation, but my translation for the opening paragraph was reverted to MT version. Whatever modification I do, now it won't be saved (even in the status bar said Saved), and reverted back to MT when I come back. Maybe it was saved to invisible wrong section?

When loading the draft, on the console, I found:

[Error]   [CX] Section 2 not restored / load.php
[Warning] [CX] Attempting to remove non-existing section 1 from save queue. / load.php

Change 509174 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Don't match whitespace as included content while restoring

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

Change 509174 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Don't match whitespace as included content while restoring

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

Pginer-WMF closed this task as Resolved.May 24 2019, 12:48 PM

Based on a test and user report this seems to be fixed.

Hi, I still can't publish the article.

Here's the log:

[CX] Section 2 not restored load.php:2258:350
[CX] Section 14 not restored load.php:2258:350
[CX] Attempting to remove non-existing section 24 from save queue. load.php:2314:431
[CX] Attempting to remove non-existing section 18 from save queue. load.php:2314:431
[CX] Attempting to remove non-existing section 14 from save queue. load.php:2314:431
[CX] Attempting to remove non-existing section 13 from save queue. load.php:2314:431
[CX] Attempting to remove non-existing section 5 from save queue. load.php:2314:431
[CX] Attempting to remove non-existing section 1 from save queue. load.php:2314:431
[CX] Mismatch in restored translation has progress. Saved progress was: {"any":0.7631578947368421,"human":0.7368421052631579,"mt":0.02631578947368421,"mtSectionsCount":1,"translatedSectionsCount":29} load.php:2303:45
TypeError: string is undefined load.php:2301:535
    forEach self-hosted:262
    <anonymous> self-hosted:991

Attached the API response.


Pginer-WMF reopened this task as Open.May 31 2019, 9:29 AM
Pginer-WMF moved this task from Done to Backlog on the Language-Team (Language-2019-April-June) board.

Hi, I still can't publish the article.

Ok. It seems that this translation was not (or not only) affected by the problem with translations with an initial empty paragraph (T222905).
I'm reopening the ticket for future investigation.
Thanks for the details provided, these are very useful for the investigation. Please, let us know if you experience similar situations with other articles.

@Pginer-WMF Hi, I'd like to report that I'm facing same issue as reported by @williamsp

The error seen in my browser console was

[CX] Mismatch in restored translation has progress. Saved progress was: {"any":0.65625,"mt":0.7277227722772277,"human":0.2722772277227723}

and the response of GET https://id.wikipedia.org/w/api.php?action=query&format=json&list=contenttranslation&translationid=775302 is available here:

Let me know if I could provide more details on this error. Thanks!