Page MenuHomePhabricator

Triggering Infobox duplication: Adds a large block of source text
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • When I submit relatively small edits to this page using Visual Editor, it has been duplicating the Infobox despite the fact that I have not touched the actual Infobox at all:

https://en.wikipedia.org/wiki/Henry_Hastings_Sibley

*The Preview prior to submission also does NOT show that I have triggered duplication of the Infobox.

What happens?:

  • It adds a crazy block of source text, which only becomes apparent after I've submitted the edit:
}}<templatestyles src="Module:Infobox/styles.css"></templatestyles><templatestyles src="Module:Infobox/styles.css"></templatestyles><templatestyles src="Module:Infobox/styles.css"></templatestyles><templatestyles src="Module:Infobox/styles.css"></templatestyles><templatestyles src="Module:Infobox/styles.css"></templatestyles><table class="infobox vcard"><tr><th colspan="2" class="infobox-above" style="font-size: 100%;"><div class="fn" style="font-size:125%;">Henry Hastings Sibley</div></th></tr><tr><td colspan="2" class="infobox-image">[[File:Henry_Hastings_Sibley2.jpg|frameless]]</td></tr><tr><td colspan="2" class="infobox-full-data"><templatestyles src="Module:Infobox/styles.css"></templatestyles></td></tr><tr><th colspan="2" class="infobox-header" style="background:lavender;line-height:normal;padding:0.2em;">1st&#x20;[[Governor of Minnesota]]</th></tr><tr><td colspan="2" class="infobox-full-data" style="border-bottom:none"><span class="nowrap">'''In office'''</span><br />May 24, 1858&nbsp;–&#x20;January 2, 1860</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left">[[Lieutenant Governor of Minnesota|Lieutenant]]</th><td class="infobox-data">[[William Holcombe]]</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left"><span class="nowrap">Preceded by</span></th><td class="infobox-data">[[Samuel Medary]] <br />as Territorial Governor</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left"><span class="nowrap">Succeeded by</span></th><td class="infobox-data">[[Alexander Ramsey]]</td></tr><tr><th colspan="2" class="infobox-header" style="background:lavender;line-height:normal;padding:0.2em;">Member of the <span style="display: inline-block;">[[United States House of Representatives|U.S.&#x20;House&#x20;of&#x20;Representatives]]</span><br />from [[Minnesota Territory]]'s [[Minnesota Territory's At-large congressional district|at-large]] district</th></tr><tr><td colspan="2" class="infobox-full-data" style="border-bottom:none"><span class="nowrap">'''In office'''</span><br />July 7, 1849&nbsp;–&#x20;March 3, 1853<br />(Delegate)</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left"><span class="nowrap">Preceded by</span></th><td class="infobox-data">'''New district'''</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left"><span class="nowrap">Succeeded by</span></th><td class="infobox-data">[[Henry Mower Rice]]</td></tr><tr><th colspan="2" class="infobox-header" style="background:lavender;line-height:normal;padding:0.2em;">Member of the <span style="display: inline-block;">[[United States House of Representatives|U.S.&#x20;House&#x20;of&#x20;Representatives]]</span><br />from [[Wisconsin Territory]]'s [[Wisconsin Territory's At-large congressional district|at-large]] district</th></tr><tr><td colspan="2" class="infobox-full-data" style="border-bottom:none"><span class="nowrap">'''In office'''</span><br />October 30, 1848&nbsp;–&#x20;March 3, 1849<br />(Delegate)</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left"><span class="nowrap">Preceded by</span></th><td class="infobox-data">[[John H. Tweedy]]</td></tr><tr><th scope="row" class="infobox-label" style="text-align:left"><span class="nowrap">Succeeded by</span></th><td class="infobox-data">'''District abolished'''</td></tr><tr style="display:none"><td colspan="2"></td></tr><tr><th colspan="2" class="infobox-header" style="background:lavender">Personal details</th></tr><tr><th scope="row" class="infobox-label">Born</th><td class="infobox-data"><span style="display:none">(<span class="bday">1811-02-20</span>)</span>February 20, 1811<br />[[Detroit]], [[Michigan Territory]]</td></tr><tr><th scope="row" class="infobox-label">Died</th><td class="infobox-data">February 18, 1891<span style="display:none">(1891-02-18)</span> (aged&nbsp;79)<br />[[Saint Paul, Minnesota]]</td></tr><tr><th scope="row" class="infobox-label">Political party</th><td class="infobox-data">[[Democratic Party (United States)|Democratic]]</td></tr><tr><th scope="row" class="infobox-label">Spouse(s)</th><td class="infobox-data">Red Blanket Woman<br />Sarah Jane (Hume) Steele</td></tr><tr><th scope="row" class="infobox-label">Profession</th><td class="infobox-data">Fur trader<br />Politician<br />Military leader</td></tr><tr><th scope="row" class="infobox-label">Signature</th><td class="infobox-data">[[File:Henry_Hastings_Sibley_signature.svg|alt=|128x128px|Henry Hastings Sibley's signature]]</td></tr><tr><th colspan="2" class="infobox-header" style="background:lavender">Military service</th></tr><tr><th scope="row" class="infobox-label">Allegiance</th><td class="infobox-data">[[United States|United States of America]]<br />[[Union (American Civil War)|Union]]</td></tr><tr><th scope="row" class="infobox-label">Branch/service</th><td class="infobox-data">[[United States Army]]<br />[[Union Army]]</td></tr><tr><th scope="row" class="infobox-label">Years&nbsp;of service</th><td class="infobox-data">1862–1866</td></tr><tr><th scope="row" class="infobox-label">Rank</th><td class="infobox-data">[[File:Union_Army_brigadier_general_rank_insignia.svg|35x35px]] [[Brigadier general (United States)|Brigadier General, USV]]<br /><span class="nowrap">[[File:Union_Army_major_general_rank_insignia.svg|35x35px]] [[Brevet (military)|Brevet]] [[Major general (United States)|Major General, USV]]</span></td></tr><tr><th scope="row" class="infobox-label">Commands</th><td class="infobox-data">District of Minnesota</td></tr><tr><th scope="row" class="infobox-label">Battles/wars</th><td class="infobox-data">[[American Civil War]]<br />[[Dakota War of 1862]]</td></tr><tr><td colspan="2" class="infobox-below" style="border-top: 1px solid right; font-size: 95%"><div></div></td></tr></table>

What should have happened instead?:

  • It shouldn't have added all that garbage which I didn't add! I didn't even go anywhere near the Infobox in the visual editor and was editing something minor much lower down on the page. (I tried this a few times so have managed to reproduce the problem.)

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

  • Using Visual Editor, Chrome, MacOS

Thanks for your help!

Event Timeline

Aklapper renamed this task from Visual editor - Triggering Infobox duplication to Triggering Infobox duplication: Adds a crazy block of source text.Jan 21 2022, 3:52 PM
Aklapper added a project: VisualEditor.
Reedy renamed this task from Triggering Infobox duplication: Adds a crazy block of source text to Triggering Infobox duplication: Adds a large block of source text.Jan 21 2022, 9:08 PM

Change 756005 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Revert \"Re-duplicate deduplicated TemplateStyles\"

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

Change 756066 had a related patch set uploaded (by Brennen Bearnes; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@wmf/1.38.0-wmf.18] Revert \"Re-duplicate deduplicated TemplateStyles\"

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

This was caused by a recent change that was meant to improve how templates using TemplateStyles are shown in visual diffs and when using visual editor to edit a single section (on mobile). We're reverting it now, which will fix this bug. Sorry about this, and in particular that it took us so long to notice this bug report.

brennen triaged this task as Unbreak Now! priority.Jan 21 2022, 9:22 PM

Change 756005 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Revert \"Re-duplicate deduplicated TemplateStyles\"

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

Change 756066 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@wmf/1.38.0-wmf.18] Revert \"Re-duplicate deduplicated TemplateStyles\"

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

Mentioned in SAL (#wikimedia-operations) [2022-01-21T21:38:56Z] <brennen@deploy1002> Synchronized php-1.38.0-wmf.18/extensions/VisualEditor/modules/ve-mw: Backport: [[gerrit:756066|Revert "Re-duplicate deduplicated TemplateStyles" (T287675 T299251 T299767)]] (duration: 00m 49s)

It's fixed now. Note that the fix won't take effect on users who currently have the editor open (only when they open it the next time), so it might take some more minutes until the corrupted edits stop appearing. :(

brennen lowered the priority of this task from Unbreak Now! to Needs Triage.Jan 21 2022, 9:41 PM
brennen subscribed.

Emergency fix deployed to 1.38.0-wmf.18 (T293959). Lowering priority and leaving this open in case there's any followup work.

The cause of this bug is:

When I was porting this Parsoid code: https://phabricator.wikimedia.org/diffusion/GPAR/browse/master/src/Wt2Html/PP/Handlers/DedupeStyles.php$25 to be used in VisualEditor here: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/751453/3/modules/ve-mw/preinit/ve.utils.parsoid.js#143 I omitted the check for fosterable positions. I don't remember why I thought that it isn't needed in this context. But it clearly is needed, as many infoboxes produce TemplateStyles' <style> tags as children of <tr> tags (which is a fosterable position), and transforming those tags to <link> causes the markup to come out wrong when Parsoid tries to convert it to wikitext (I don't exactly understand why it's corrupted in this exact way, the discussion on https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/452964 where this was originally implemented may explain it).

Example fragment from the Parsoid HTML for https://en.wikipedia.org/wiki/Damian_Williams_(lawyer):

<tr><td colspan="2" class="infobox-full-data" style="border-bottom:none"><span class="nowrap"><b>Assumed office</b></span><span typeof="mw:Entity"> </span><br/>October 10, 2021</td><style data-mw-deduplicate="TemplateStyles:r1066479718" typeof="mw:Extension/templatestyles" about="#mwt10" data-mw='{"name":"templatestyles","attrs":{"src":"Module:Infobox/styles.css"},"body":{"extsrc":""}}'></style></tr>

When processed by VisualEditor, this would become:

<tr><td colspan="2" class="infobox-full-data" style="border-bottom:none"><span class="nowrap"><b>Assumed office</b></span><span typeof="mw:Entity"> </span><br>October 10, 2021</td><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1066479718" typeof="mw:Extension/templatestyles" about="#mwt10" data-mw='{"name":"templatestyles","attrs":{"src":"Module:Infobox/styles.css"},"body":{"extsrc":""}}'></tr>

With this understanding, we'll probably re-attempt the change next week (since reverting it regressed the issues described in T287675 and T299251).

matmarex moved this task from To Triage to Triaged on the VisualEditor board.

@matmarex is there anything remaining to be done here that's relevant to 1.38.0-wmf.19?

No, patches are included in wmf.19.