Page MenuHomePhabricator

Fully translated articles not saving when using the CX
Closed, ResolvedPublic4 Estimated Story PointsBUG REPORT

Description

There are occurrence of translated pages not saving reported:

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

  • Start and finish translating all the sections in the Antisocial personality disorder from English to Romanian
  • Click on Publish.

What happens?:

  • The page just says "Saving..." continuously and doesn't save

What should have happened instead?:

  • The page is supposed to be saved and published.

image.png (1,318×901 px, 162 KB)

Second scenario

  • Start and finish translating all the sections in the Melbourne Cup from English to Portuguese -

What happens?:

  • The article did not save automatically

What should have happened instead?:

  • The page is supposed to be automatically saved and once I click publish, it should publish the article

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Derived Requirement

Ensure that fully translated articles in Content Translation (CX) are reliably saved (automatically and manually) and successfully published without getting stuck in the "Saving..." state.


Test Result - Beta|Prod

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

Test Artifact(s):

Test Steps

Test Case 1: Ensure Manual Save and Publish Works After Full Translation (English → Romanian)

  1. Go to the Content Translation tool on beta Wikipedia.
  2. Start a new translation of the article *Antisocial personality disorder* from English to Romanian.
  3. Translate some sections.
  4. Click the Publish button.
  5. ✅❓❌⬜ AC1: Confirm that the translation is automatically saved and published successfully without getting stuck on "Saving...".

QA Results - Test Wiki

ACStatusDetails
1✅T380195#10850271

Event Timeline

Nikerabbit moved this task from Needs Triage to Bugs on the ContentTranslation board.

Another one from English to Romanian: "The Assassination of John F. Kennedy" -- no more saving after the "Oswald" subsection. Error in debug console reads:

Uncaught TypeError: sectionState is undefined
  processSectionChange mw.cx.TranslationTracker.js:415
  processChangeQueue mw.cx.TranslationTracker.js:385
  processChangeQueue mw.cx.TranslationController.js:146
  processSaveQueue mw.cx.TranslationController.js:344
  later oojs-ui-core.js:251
  setTimeout handler*OO.ui.debounce/< oojs-ui-core.js:259
  onSectionChange mw.cx.TranslationController.js:109
  emit oojs.js:858
  emitSectionChange ve.dm.CXSectionNode.js:97
  setTimeout handler*ve.dm.CXSectionNode.prototype.onUpdate ve.dm.CXSectionNode.js:92
  emit oojs.js:858
  setLength ve.dm.Node.js:741
  adjustLength ve.dm.Node.js:754
  setLength ve.dm.Node.js:737
  adjustLength ve.dm.Node.js:754
  setLength ve.dm.Node.js:737
  adjustLength ve.dm.Node.js:754
  applyTreeOperation ve.dm.TreeModifier.js:363
  applyTreeOperations ve.dm.TreeModifier.js:105
  process ve.dm.TreeModifier.js:394
  process ve.dm.TransactionProcessor.js:110
  commit ve.dm.Document.js:417
  changeInternal ve.dm.Surface.js:971
  change ve.dm.Surface.js:940
  changeModel ve.ce.Surface.js:3772
  handleObservedChanges ve.ce.Surface.js:2272
  pollOnceInternal ve.ce.SurfaceObserver.js:152
  pollOnce ve.ce.SurfaceObserver.js:108
  onDocumentInput ve.ce.Surface.js:1963
  callListener ve.EventSequencer.js:423
  onEvent ve.EventSequencer.js:257
  makeEventHandler ve.EventSequencer.js:61
  jQuery 7
hueitan subscribed.

From the logstash,

Epidemiology of antisocial personality disorder (English to Romanian) - logstash

Recursive link purge enqueued for Epidemiology of antisocial personality disorder

Melbourne Cup (English to Portuguese) - logstash

Parsing Melbourne Cup was slow, took 4.12 seconds

Another one from English to Romanian: "The Assassination of John F. Kennedy" -- no more saving after the "Oswald" subsection. Error in debug console reads:

I wasn't able to get the same console debug error, when I click on the "Oswald" section, api load the translation successfully but doesn't render, and here's the console warning message

jquery.js:3783 jQuery.Deferred exception: Cannot read properties of undefined (reading 'getRange') TypeError: Cannot read properties of undefined (reading 'getRange')
    at ve.dm.MWReferenceNode.static.toDomElements (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.cite.visualEditor.core&skin=contenttranslation&version=1vvxl:21:468)
    at ve.dm.CXReferenceNode.static.toDomElements (https://ro.wikipedia.org/w/load.php?lang=ro&modules=mw.cx.visualEditor&skin=contenttranslation&version=u27m5:37:800)
    at ve.dm.Converter.getDomElementsFromDataElement (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.visualEditor.core&skin=contenttranslation&version=1guka:286:815)
    at ve.dm.Converter.getDomSubtreeFromData (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.visualEditor.core&skin=contenttranslation&version=1guka:311:438)
    at ve.dm.MWReferenceNode.static.toDomElements (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.cite.visualEditor.core&skin=contenttranslation&version=1vvxl:22:487)
    at ve.dm.CXReferenceNode.static.toDomElements (https://ro.wikipedia.org/w/load.php?lang=ro&modules=mw.cx.visualEditor&skin=contenttranslation&version=u27m5:37:800)
    at ve.dm.Converter.getDomElementsFromDataElement (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.visualEditor.core&skin=contenttranslation&version=1guka:286:815)
    at ve.dm.Converter.getDomSubtreeFromData (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.visualEditor.core&skin=contenttranslation&version=1guka:308:184)
    at ve.dm.Converter.getDomSubtreeFromModel (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.visualEditor.core&skin=contenttranslation&version=1guka:303:598)
    at ve.dm.Converter.getDomFromModel (https://ro.wikipedia.org/w/load.php?lang=ro&modules=ext.visualEditor.core&skin=contenttranslation&version=1guka:302:658) undefined
`

TODO: Better logging is needed on the front-end and back-end code to understand the reason behind the failures

Another one from English to Romanian: "The Assassination of John F. Kennedy" -- no more saving after the "Oswald" subsection. Error in debug console reads:

Uncaught TypeError: sectionState is undefined
  processSectionChange mw.cx.TranslationTracker.js:415
  processChangeQueue mw.cx.TranslationTracker.js:385
  processChangeQueue mw.cx.TranslationController.js:146
  processSaveQueue mw.cx.TranslationController.js:344
  ....
  makeEventHandler ve.EventSequencer.js:61
  jQuery 7

I was able to see this error logged multiple times in Logstash: https://logstash.wikimedia.org/app/dashboards#/view/AXUcknnN1pGl6xFM7hlq?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-1M%2Cto%3Anow))

I can reproduce this issue on https://de.wikipedia.org/w/index.php?title=Spezial:Inhalts%C3%BCbersetzung&campaign=interlanguagelink&filter-id=previous-edits&filter-type=automatic&from=en&page=British+Rail+Class+800&to=de (Got the URL from Logstash). Everytime I translate a section, I see the Uncaught TypeError: sectionState is undefined error logged in the console.

Then when publishing I get the same error again: Uncaught TypeError: sectionState is undefined and the publishing button is stuck

Uncaught TypeError: sectionState is undefined
    getUnmodifiedMTPercentageInTranslation mw.cx.TranslationTracker.js:640
    getUnmodifiedMTPercentageInTranslation mw.cx.TranslationTracker.js:637
mw.cx.TranslationTracker.js:640:4
    getUnmodifiedMTPercentageInTranslation mw.cx.TranslationTracker.js:640
    forEach self-hosted:157
    getUnmodifiedMTPercentageInTranslation mw.cx.TranslationTracker.js:637
    getMTAbuseMsg mw.cx.TranslationController.js:918
    publish mw.cx.TranslationController.js:688
    emit oojs.js:858
    onPublishButtonClick ve.init.mw.CXTarget.js:613
    onSelect ve.ui.CXPublishTool.js:45
    onMouseKeyUp oojs-ui-toolbars.js:1324
    onDocumentMouseKeyUp oojs-ui-toolbars.js:1305
    (Async: EventListener.handleEvent)
    onMouseKeyDown oojs-ui-toolbars.js:1271

image.png (2,508×1,183 px, 582 KB)

abi_ set the point value for this task to 4.

Some more debugging notes: Uncaught TypeError: sectionState is undefined occurs because of an earlier error:

Uncaught TypeError: itemNode is undefined
    toDomElements load.php:20
    toDomElements ve.dm.CXReferenceNode.js:60
    getDomElementsFromDataElement ve.dm.Converter.js:500
    getDomSubtreeFromData ve.dm.Converter.js:1711
    toDomElements load.php:21
load.php:20:618
    toDomElements load.php:20
    toDomElements ve.dm.CXReferenceNode.js:60
    getDomElementsFromDataElement ve.dm.Converter.js:500
    getDomSubtreeFromData ve.dm.Converter.js:1711
    toDomElements load.php:21
    toDomElements ve.dm.CXReferenceNode.js:60
    getDomElementsFromDataElement ve.dm.Converter.js:500
    getDomSubtreeFromData ve.dm.Converter.js:1513
    getDomSubtreeFromModel ve.dm.Converter.js:1287
    getDomFromModel ve.dm.Converter.js:1243
    getDomFromNode ve.dm.Converter.js:1261
    init mw.cx.TranslationTracker.js:273
    onSurfaceReady mw.cx.TranslationController.js:882
    emit oojs.js:858
    surfaceReady ve.init.mw.Target.js:276
    surfaceReady ve.init.mw.CXTarget.js:374
    (Async: setTimeout handler)
    setTranslation ve.init.mw.CXTarget.js:290
    init mw.cx.init.Translation.js:100
    (Async: promise callback)
    init mw.cx.init.Translation.js:88
    (Async: promise callback)
    init mw.cx.init.Translation.js:75
    initCX mw.cx.init.js:67
    jQuery 37
    fetchTitleSuggestion mw.cx.MachineTranslationService.js:66

This seems to be coming from https://gerrit.wikimedia.org/g/mediawiki/extensions/Cite/+/4175e5ea6572237e20e3d169cdfff860370a2ada/modules/ve-cite/ve.dm.MWReferenceNode.js#143

This issue is easily reproducible when translating the article British Rail Class 800 locally as well.

Wrapping the code here in a try...catch allows the code to execute and allows article publishing as well.

try {
	sectionState.setSource( ve.dm.converter.getDomFromNode( sectionModel ).body.innerHTML );
} catch ( e ) {
	sectionState.setSource( '' );
}

I've reached out to the Editing-team for help with this.

Change #1138759 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/ContentTranslation@master] CX: Add error handling when converting VE node to HTML

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

Change #1138759 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Add error handling when converting VE node to HTML

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

Nikerabbit changed the task status from Open to In Progress.May 12 2025, 7:16 AM

In addition to fixing the issue that was mentioned in this comment, we've added a try...catch block around the code that publishes the translation. This should avoid the stuck "Loading..." problem and should allow users to try publishing again. We've also added logging to ensure that these logs are present in Logstash.

Now that we have additional logging, I'm hoping that we can get more specific errors that should help us to debug these problems.

I'm inclined to mark this task as done.

@abi_ On Chrome, I was not getting any errors but on Edge, I'm getting a grm error as seen in the gifs below. Also, can you take a look at the other possible issue? As for the actual task, it passes since it does automatically save and publish without issues.

UPDATE: T380195#10851996

Test Result - Test Wiki

Status: ✅ PASS
Environment: Test Wiki
OS: macOS Sequoia 15.4.1
Browser: Chrome 136, Edge 136
Device: MBA
Emulated Device: NA

Test Artifact(s):

Chrome
https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&from=en&to=ro&page=Antisocial%20personality%20disorder
https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&from=en&to=ro&page=British%20Rail%20Class%20800

Edge
https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&from=en&to=pt&page=Melbourne%20Cup
https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&from=en&to=cs&page=Hejaz%20Vilayet

Test Steps

Test Case 1: Ensure Manual Save and Publish Works After Full Translation (English → Romanian)

  1. Go to the Content Translation tool on beta Wikipedia.
  2. Start a new translation of the article *Antisocial personality disorder* from English to Romanian.
  3. Translate some sections.
  4. Click the Publish button.
  5. ✅ AC1: Confirm that the translation is automatically saved and published successfully without getting stuck on "Saving...".

✅ Browser: Chrome

En→German: ChromeEn→Ro: Chrome
2025-05-22_14-23-30.mp4.gif (1,130×662 px, 3 MB)
2025-05-22_14-29-20.mp4.gif (1,126×666 px, 3 MB)

✅ Browser: Edge

En→Czech: EdgeEnglish→Portuguese: Edge
2025-05-22_14-32-57.mp4.gif (1,082×600 px, 2 MB)
2025-05-22_14-37-48.mp4.gif (1,076×592 px, 2 MB)

Other issue: A couple of errors when searching and going into translation

UPDATE: T380195#10851996
✅ Browser: Chrome

2025-05-22_14-57-37.mp4.gif (1,134×664 px, 886 KB)

@abi_ On Chrome, I was not getting any errors but on Edge, I'm getting a grm error as seen in the gifs below. Also, can you take a look at the other possible issue? As for the actual task, it passes since it does automatically save and publish without issues.

This looks like an error from Grammarly extension. It should be OK as long as you are able to save and publish the translation.