Page MenuHomePhabricator

Nested ref support is broken in Cite-Parsoid
Closed, ResolvedPublic

Description

Consider this wikitext:

Foo {{refn|group="note2"|Foo-ref <ref>abcd</ref>}}
Bar {{refn|group="note2"|name="Bar-name"|Bar-ref.<ref name="Bar-name">pqrs</ref>}}

<references group="note2" />

Parsoid's HTML doesn't include the nested ref for Bar and instead leaves behind this: <sup typeof="mw:DOMFragment/sealed/ref" id="mwMg" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;attrs&quot;:{&quot;name&quot;:&quot;Bar-name&quot;},&quot;body&quot;:{&quot;extsrc&quot;:&quot;pqrs&quot;}}"></sup>. That should have been properly processed in Cite and replaced with the right sup-tag with the nested ref content.

Not sure if this has always been broken or broken recently, but needs fixing.

But, https://en.wikipedia.org/w/index.php?title=User:SSastry_(WMF)/sandbox&oldid=1278679014 has a test case on wiki.

The actual page where I found this error was https://en.wikipedia.org/wiki/2020_BWF_World_Tour which is one of the pages throwing the convert-offsets error in rt-testing (only in some special circumstances, not always, as it turns out).

Event Timeline

ssastry triaged this task as High priority.Mar 3 2025, 11:29 PM
ssastry added subscribers: awight, ihurbain.

Discovered while poking around T386663 in recent rt-testing runs (which are not actually seen in production but only in rt-testing).

Commit message of https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/1124202 explains why we didn't catch it before (even if we didn't have that issue, we would have caught this one week after it rolled out to production because parsoidtest1001 gets new code as part of the train, and so only after the broken cite rolled out on the train and stayed there for a week).

:facepalm: you can have two references with the same name and two different groups and that would actually be a valid link.

Change #1124458 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/Cite@master] Fix nested refs with the same name but a different group

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

Change #1124458 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix nested refs with the same name but a different group

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

Could you get this backported tomorrow? This will let us run rt-testing without having crashers from this. Plus, we can roll out the fragment support fix early next week and not get tripped by this.

Change #1125104 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/Cite@wmf/1.44.0-wmf.19] Fix nested refs with the same name but a different group

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

I don't have much hope it's going to fit in the afternoon window, but we can try.

Change #1125104 merged by jenkins-bot:

[mediawiki/extensions/Cite@wmf/1.44.0-wmf.19] Fix nested refs with the same name but a different group

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

Mentioned in SAL (#wikimedia-operations) [2025-03-06T13:59:45Z] <hashar@deploy2002> Started scap sync-world: Backport for [[gerrit:1125104|Fix nested refs with the same name but a different group (T387800)]]

Mentioned in SAL (#wikimedia-operations) [2025-03-06T14:02:47Z] <hashar@deploy2002> hashar, ihurbain: Backport for [[gerrit:1125104|Fix nested refs with the same name but a different group (T387800)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Change #1125203 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/Cite@master] Tweak wikitext syntax on newly added nested refs tests

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

Change #1125203 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Tweak wikitext syntax on newly added nested refs tests

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