Page MenuHomePhabricator

CX2: Previously blanked section not saved when switched to MT
Closed, ResolvedPublic

Description

  1. Start fresh translation
  2. Translate one paragraph
  3. Switch to "Don't use MT", if it's not already applied by default
  4. Return to dashboard and open draft again
  5. Switch previously blanked section to some MT provider
  6. Return to dashboard
  7. Open the draft to see that section is still blanked and MT provided content is missing

Event Timeline

I followed the same steps and inspected what is coming out from database at step 7. Here is the output from query contenttranslation api output

image.png (294×1 px, 49 KB)

As we can see, there is user translation that blanks the section. There is html, but no text content(From step 3). Then there is unmodified MT from Apertium(From step 5)

The restore logic we have is this:

restoredContent = OO.getProp( savedSection, 'user', 'content' ) || OO.getProp( savedSection, 'mt', 'content' );

Tthis is based on a (wrong) assumption that if there is user translation, that is always the latest content than unmodified content. Which is wrong in the case of Blank->Unmodified MT step. If there is user translation just after Unmodified MT stage, the issue wont happen.

I am inclined to use the timestamp of the records instead of the above logic. From the examples, you can see, User translation is at 2018-09-03T09:35:00Z and unmodified MT is at 2018-09-03T09:36:56Z which is one minute later than user translation. So unmodified MT is the recent content.

santhosh triaged this task as Medium priority.
santhosh moved this task from Backlog to In Review on the Language-2018-July-September board.

Change 457410 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Restore: Use the timestamps of the translation units to choose one

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

Petar.petkovic renamed this task from CX2: Previously blanked section not saved when switched to MT to Not updating timestamps causes stale content when switching MT providers.Sep 11 2018, 10:04 AM
Petar.petkovic updated the task description. (Show Details)

I have updated the description after reviewing the patch from @santhosh that takes the latest timestamp into account when restoring content. The patch is good, but it's futile unless the behavior from newly updated description is not changed.

I created T204038: Updates to the section does not update the timestamp in cx_corpora table to track the issue of TranslationStorageManager not updating timestamp. This ticket as its original description is still valid and the fix in the https://gerrit.wikimedia.org/r/457410 is still valid. That fix exposed the issue with time stamps. So I will retain the old description.

santhosh renamed this task from Not updating timestamps causes stale content when switching MT providers to CX2: Previously blanked section not saved when switched to MT.Sep 11 2018, 11:27 AM
santhosh updated the task description. (Show Details)

Change 457410 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Restore: Use the timestamps of the translation units to choose one

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

Etonkovidova subscribed.

Checked in testwiki (wmf.23) - the issue is fixed.