Extension output is wrapped in <div class='mw-parser-output'> breaking editing in VE and rendering elsewhere
Closed, ResolvedPublic0 Story Points

Description

https://gerrit.wikimedia.org/r/#/c/350634 wraps parser output in a new <div>. Since that patch got rolled out to the production cluster before it was reverted today, May 12, all Parsoid output in that period would likely have broken rendering and editing experience in VE. This seems to primarily affect <math> editing experience.

We need to figure out if Parsoid needs to expect this <div> as part of action=parse request it makes to the action API to process extension output or whether there are core patches that will strip / prevent this <div> before the API response goes out.

Original bug report
Since may 9 2017 the visual editor can no longer produce inline math formulas. This makes it very difficult to write scientific texts that apply formulas.
See T165096

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 12 2017, 10:00 AM
Esanders added a subscriber: Esanders.EditedMay 12 2017, 8:42 PM

This looks like a Parsoid bug (or Mathoid or Math?). We're getting a <div> splitting the paragraph when display=inline.

HansVanLeunen closed this task as Resolved.May 12 2017, 8:56 PM
HansVanLeunen claimed this task.

The behavior of the editor turned back to its original healthy status. Thanks to the one who did that.

Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptMay 12 2017, 8:56 PM
ssastry added a subscriber: ssastry.EditedMay 12 2017, 9:45 PM

Looks like this is related to T165115#3257961 and T165115#3257490.

I happened to see this behavior in Parsoid's visual diff run y'day ...

... but assumed it is some CSS regression that is visual diff testing specific.

But, https://gerrit.wikimedia.org/r/#/c/353566/ may fix the problem as well. I haven't followed all the threads in the discussion yet.

In any case, before the reverted change in https://gerrit.wikimedia.org/r/#/c/353584/ is redeployed, we should verify that Parsoid isn't getting that div-wrapped output as part of action=parse, and if it is and that is expected, we should update Parsoid to strip that <div> tag.

Parsoid output snippet from https://en.wikipedia.beta.wmflabs.org/api/rest_v1/page/html/Selenium_Echo_link_test_0.7097762172580837 shows

<div class="mw-parser-output" typeof="mw:Extension/math" about="#mwt4" data-mw="{&quot;name&quot;:&quot;math&quot;,&quot;attrs&quot;:{},&quot;body&quot;:{&quot;extsrc&quot;:&quot;(G;\\cdot)&quot;}}" id="mwAw"><p><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mo stretchy="false">(</mo>
        <mi>G</mi>
        <mo>;</mo>
        <mo>⋅<!-- ⋅ --></mo>
        <mo stretchy="false">)</mo>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle (G;\cdot )}</annotation>
  </semantics>
</math></span><img src="//en.wikipedia.beta.wmflabs.org/api/rest_v1/media/math/render/svg/e860c64a53f7fd6199923771405c15f7e4b4287f" class="mwe-math-fallback-image-inline" aria-hidden="true" style="vertical-align: -0.838ex; width:5.369ex; height:2.843ex;" alt="{\displaystyle (G;\cdot )}"></span></p>

</div>
ssastry renamed this task from Visual editor can no longer insert math formulas inline to Extension output is wrapped in <div class='mw-parser-output'> breaking editing in VE and rendering elsewhere.May 12 2017, 10:00 PM
ssastry reopened this task as Open.
ssastry triaged this task as Normal priority.
ssastry updated the task description. (Show Details)
ssastry added subscribers: Anomie, Services.

@mobrovac @Pchelolo @GWicke might be worth purging stored RB content since the Tue rollout. Any pages

  • whose content refreshed in RB during these 3 days,
  • contains inline math content
  • hasn't been subsequently edited before a VE edit

might see a broken editing experience for inline math formulae.

This is a small subset of pages but if any editors encounter this issue ?action=purge will be a quick fix.

Mentioned in SAL (#wikimedia-operations) [2017-05-13T00:31:15Z] <urandom> T165139: Truncating RESTBase summary tables (corruption)

Mentioned in SAL (#wikimedia-operations) [2017-05-13T00:54:44Z] <urandom> T165139: Truncating RESTBase feed_aggregated tables (corruption)

Finding such a subset of pages is non-trivial. On the other hand, re-rendering (all) pages is also useless since the parser content fetched by Parsoid is fetched from cache, so until all of these have been either edited or null-edited there is not much we can do here at the moment.

You might try supplying an empty value for the new wrapoutputclass parameter to action=parse to suppress the wrapper, if that's what you're using.

Change 353707 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/extensions/ParsoidBatchAPI@master] Disable parser output wrapper

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

Change 353709 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] T165139: Prevent <div> wrapping of action=parse output

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

Change 353707 merged by jenkins-bot:
[mediawiki/extensions/ParsoidBatchAPI@master] Disable parser output wrapper

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

Change 353709 merged by jenkins-bot:
[mediawiki/services/parsoid@master] T165139: Prevent <div> wrapping of action=parse output

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

ssastry moved this task from Backlog to In Progress on the Parsoid board.May 15 2017, 10:28 PM
ssastry claimed this task.
ssastry added a subscriber: greg.May 16 2017, 4:01 PM

This is now fixed in the beta cluster. https://en.wikipedia.beta.wmflabs.org/api/rest_v1/page/html/Selenium_Echo_link_test_0.9285218489365489 no longer has the <div> wrapper.

So, as long as the ParsoidBatchAPI patch above is deployed with the core patch, this won't break in production either.

@greg But, if the core patch is reverted from 1.30.0-wmf.2, the ParsoidBatchAPI patch above should also be reverted! Otherwise, you will see a lot of crashers in production.

ssastry closed this task as Resolved.May 16 2017, 4:01 PM
Jdforrester-WMF set the point value for this task to 0.May 17 2017, 6:25 PM

Mentioned in SAL (#wikimedia-operations) [2017-05-22T20:46:44Z] <arlolra> Updated Parsoid to ebac1890 (T165139)