Page MenuHomePhabricator

Preview showed me removing content that I'd never added
Open, LowPublic

Description

I was editing https://www.mediawiki.org/wiki/Wikimedia_Engineering/2015-16_Q3_Goals using VisualEditor. I made a bunch of changes over the course of five minutes, and clicked save. I'd made so many changes over the five minutes that I wanted to preview my edit. To my surprise, the preview showed me removing a bunch of content that was not on the page when I started editing it. I was quite concerned, but since I know how to fix this kind of thing, I just saved my edit anyway.

After saving my edit, I checked the diff of my edit, and it was 100% correct and didn't show me removing any content. But, I did see an intermediate edit, between when I clicked edit and when I showed the preview, which added content that looked like the content the preview showed me removing.

I want to stress that, in the end, the edit was saved 100% correctly as I expected it to be with no removal of content. That's great! But, the preview was wrong.

Below are some steps that I think will reproduce the bug, but it's hard to say because I'm not certainly exactly what happened.

  • Load a page
  • Open VisualEditor on that page
  • Using a different browser logged into a different account, load the same page, make some changes, and save the page.
  • Go back to the first tab. Make some changes. View the wikitext diff.

At this point, the wikitext diff will (likely) show you removing the content that you added using the other browser.

Event Timeline

Deskana created this task.Dec 11 2015, 1:54 AM
Deskana raised the priority of this task from to Needs Triage.
Deskana updated the task description. (Show Details)
Deskana added a subscriber: Deskana.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 11 2015, 1:54 AM
Jdforrester-WMF triaged this task as Low priority.Dec 11 2015, 1:55 AM
Jdforrester-WMF added a project: Design.
Jdforrester-WMF set Security to None.

I think this happens for autoresolved edit conflicts with wikitext editor, too.

Yeah, I'm pretty sure this is "VE and WT work the same, but it's odd…".

awight added a comment.Feb 8 2016, 3:58 PM

I can confirm that I saw this bug in the wikitext editor, so I would suggest removing the VisualEditor tag. I would also say that, for the people experiencing this bug, it's not "low" priority, it's quite disruptive.

awight removed a subscriber: awight.Mar 21 2019, 4:00 PM

This is still the case in wikitext editor, but the behavior in visual editor (even for wikitext diffs) has changed: we show changes compared to the revision you started editing, rather than to the article's most recent revision. This happened in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/418698 (2018).

I think this will handle conflicts very slightly differently. The old API didn't pass the oldid, and so showed you exactly the diff you would generate if you saved, for example it would show the force merge if the conflict is with yourself. This API call explicitly passes an oldid, so will always show the difference between the page you loaded and the content you typed.

I think the new behavior is actually an improvement, in particular in case of automatically resolved edit conflicts. The previous behavior compared your text to the latest revision of the page, no matter at what revision you started editing. The proposed behavior compares your text to the revision you started editing.

For example, let's say I start editing a page, in the meantime someone edits and saves a change to a different part of the page, then I try to save/review my changes. The diff will show me undoing their changes, even though upon saving they will actually be automerged.

I guess ideally we would displaying the automerged diff, but I'm not sure if that's possible, and it could be confusing in some cases ("why did this line I didn't touch change?"). The behavior proposed here is definitely better than the current one.