Page MenuHomePhabricator

Comment is not getting added after Citation, Template,Gallery,Math node and Table
Closed, ResolvedPublic0 Estimated Story Points

Description

Comment is not getting added after Citation, Template,Gallery,Math node and Table, nothing in Review your changes section after adding it

Event Timeline

Ryasmeen raised the priority of this task from to Medium.
Ryasmeen updated the task description. (Show Details)
Ryasmeen added a project: VisualEditor.
Ryasmeen subscribed.

As far as I can tell this is a Parsoid issue, or possibly in the RESTy things between VE and Parsoid. VE generates correct HTML, sends it via requestParsoid() in PHP code, and gets back incorrect wikitext.

Minimal steps to reproduce:

  1. Save a page with this content:
asd<ref>foo</ref>

<references />
  1. Open for editing in VE, add a non-empty comment after the ref.
  2. Try saving or viewing a diff – the wikitext has not changed.
matmarex added a project: Parsoid.
matmarex subscribed.

This session shows that Parsoid is correctly serializing the html. So, worth doing a dump of HTML that VE is sending to Parsoid. As a first step, dump the HTML (https://www.mediawiki.org/wiki/Parsoid/Debugging#Dumping_HTML_DOM_before_save_in_VE) and try serializing it via parse.js?

[subbu@earth lib] echo "asd<ref>foo</ref>\n\n<references />" > /tmp/wt
[subbu@earth lib] node parse < /tmp/wt > /tmp/old.html
[subbu@earth lib] sed 's/<\/body>/<\!-- comment at end --><\/body>/g;' < /tmp/old.html > /tmp/new.html
[subbu@earth lib] node parse --html2wt < /tmp/new.html
asd<ref>foo</ref>

<references />
<!-- comment at end -->
[subbu@earth lib] node parse --selser --oldtextfile /tmp/wt --oldhtmlfile /tmp/old.html < /tmp/new.html
asd<ref>foo</ref>

<references />
<!-- comment at end -->

The dumped HTML is correct and the conversion to wikitext is also correct, and yet something is stripping the comment away. I watched the api.php communication of VE – when serializeforcache is called, the returned md5 cache key corresponds to the HTML with the newly added comment missing. Something is wrong with Parsoid or the VirtualRESTServiceClient thing.

VirtualRESTServiceClient thing.

That just handles making an HTTP request and dealing with the response. I doubt it's responsible for specific parts of the content going missing.

I watched the movie and looked at the specific place where Rummana added the comment. She added it not at the end of file, but right after the ref. So, I did that and use following new html

<!DOCTYPE html>
<html prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"><head prefix="mwr: http://en.wikipedia.org/wiki/Special:Redirect/"><meta property="mw:articleNamespace" content="0"/><meta property="mw:parsoidVersion" content="0"/><link rel="dc:isVersionOf" href="//en.wikipedia.org/wiki/Main%20Page"/><title></title><base href="//en.wikipedia.org/wiki/"/><link rel="stylesheet" href="//en.wikipedia.org/w/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;skin=vector"/></head><body data-parsoid='{"dsr":[0,31,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p data-parsoid='{"dsr":[0,14,0,0]}'>X <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"dsr":[2,14,5,6]}' data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span><!--boo--></p>

<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"dsr":[16,30,2,2]}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">a</span></li></ol>
</body></html>

Note the <!--boo--> comment at the end of the paragraph there. With this edited html, I can confirm that selser loses the comment.

[subbu@earth tests] node parse --selser --oldtextfile /tmp/wt --oldhtmlfile /tmp/old.html < /tmp/new.html 
X <ref>a</ref>

<references />

[subbu@earth tests] node parse --html2wt < /tmp/new.html
X <ref>a</ref><!--boo-->

<references />

I have a bunch of different directions to take on this one .. and trying to figure out how deep of a rabbit hole I want to go down in (based on investigating it this morning) ... but, should have a fix for this sometime this week.

I have a bunch of different directions to take on this one .. and trying to figure out how deep of a rabbit hole I want to go down in (based on investigating it this morning) ... but, should have a fix for this sometime this week.

Awesome, thanks. :-)

Change 193981 had a related patch set uploaded (by Subramanya Sastry):
WIP: T90517: Add missing updates to modification flags in P handler

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

Change 193981 merged by jenkins-bot:
T90517: Update node modification flags in the main loop of WTS.

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

Change 194114 had a related patch set uploaded (by Subramanya Sastry):
T90517: Reinstate modification markers for comments

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

Change 194114 merged by jenkins-bot:
T90517: Reinstate modification markers for comments

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

This should now be fixed in beta labs .. @Ryasmeen could you test in beta labs and close resolved if fixed, or update with any new failures you see?

If all is good with RT-testing, this will be deployed tomorrow afternoon.