Page MenuHomePhabricator

Revise hack "// Hack: link styles"
Closed, ResolvedPublic

Description

Disclaimer: I know very little about the internals of Parsoid

I noticed this line recently:
https://gerrit.wikimedia.org/g/mediawiki/services/parsoid/+/a9a4390b71060edbeeb7fc80a7d7696ebabac1c6/src/Wt2Html/DOMPostProcessor.php#670

This is problematic for several reasons

  • The mediawiki.legacy.commonPrint and mediawiki.legacy.shared modules are deprecated and their contents duplicated inside the module mediawiki.skinning.interface and skins.vector.styles
  • mediawiki.skinning.interface - this module is a subset of skins.vector.styles
  • skins.vector.styles - this will soon refer to the new Vector UI that's being developed as part of desktop refresh. If you want to retain the existing (and current Vector UI this is now named skins.vector.styles.legacy.

Naively given that Parsoid is just parser content, my guess is that you either

  1. may not need any of these styles
  2. should only need to include mediawiki.skinning.interface

Please let me understnd what's trying to be achieved here and I'll be happy to help advise with the best solution.

Event Timeline

We added those baseline modules long back and it is possible we have gone out of sync with changes in core. Can you submit a patch that matches what core parser does wrt baseline styles?

Might need some help from Timo here.
I assume the desired output should be something like this?: https://en.wikipedia.org/w/index.php?title=Dog&useskin=apioutput

Might need some help from Timo here.
I assume the desired output should be something like this?: https://en.wikipedia.org/w/index.php?title=Dog&useskin=apioutput

Yes, that looks right.

Change 581777 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/services/parsoid@master] Drop unnecessary style modules in parsoid output

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

^ haven't tested but please let me know if any obvious styles are missing in the output (they shouldn't be).

LGoto triaged this task as Medium priority.Mar 20 2020, 4:13 PM
LGoto moved this task from Needs Triage to Known Differences on the Parsoid board.

Can we get the mobile app team to review this? Mobile app and kiwix are the only ones who use the Parsoid style output, I believe. (The parser team uses the styles only for internal debugging.)

Change 581777 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Drop unnecessary style modules in parsoid output

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

Change 584120 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a8

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

Change 584120 merged by jenkins-bot:
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a8

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

This should be deployed on beta (but not production yet).

In theory it should look like the API output:
https://en.wikipedia.org/w/index.php?title=Dog&useskin=apioutput
Here's enwiki (group2) which should still be the pre-patch output:
https://en.wikipedia.org/api/rest_v1/page/html/Dog

If you examine the <head> of that page, you can see:

<link rel="stylesheet" href="/w/load.php?modules=mediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.skinning.content.parsoid%7Cmediawiki.skinning.interface%7Cskins.vector.styles%7Csite.styles%7Cext.cite.style%7Cext.cite.styles%7Cmediawiki.page.gallery.styles&amp;only=styles&amp;skin=vector">

with the mediawiki.legacy.commonPrint being the problematic content.

Now compare to beta, which *should* have the new patch:
https://en.wikipedia.beta.wmflabs.org/api/rest_v1/page/html/Dog

(There's some unrelated template breakage on beta, caused by beta not having all the templates, oh well...)

Unfortunately, the <head> here on beta will also has the mediawiki.legacy.commonPrint stylesheet. Perhaps this is just RESTBase caching the old output, though.

Directly querying Parsoid seems to give the right output:

$ ssh deployment-parsoid11.deployment-prep.eqiad.wmflabs
user@deployment-parsoid11$ curl -x deployment-parsoid11:80 'http://en.wikipedia.beta.wmflabs.org/w/rest.php/en.wikipedia.beta.wmflabs.org/v3/page/html/Dog/413818'

So I think we're good to proceed with the deploy, even though I can't directly verify the output on beta (yet).

Change 607105 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a18

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

Pppery removed a project: Patch-For-Review.
Pppery subscribed.

Presuming this is resolved as the above deployment happened ages ago.