| Jdlrobson renamed this task from "ext.math.styles is sometimes loaded when not needed - causing CSS size in production to fluctuate - parser cache pollution?" to "Lua module Module:Internet_Archive is causing parser cache pollution - ext.math.styles is sometimes loaded". Jdlrobson updated the task description. (Show Details) Herald added a project: Internet-Archive. |
CHANGES TO TASK DESCRIPTION
After some investigation (see detailed developer notes) I have managed to narrow this down to a Lua module that reads Wikidata data, which in turn leads to the Math module unexpectedly being added.
== Developer notes
== Replication steps
* Ensure https://www.wikidata.org/wiki/Q4115189 has a site link to https://en.wikipedia.org/wiki/User:Jdlrobson/T173949
* Visit [desktop] https://en.wikipedia.org/wiki/User:Jdlrobson/T173949?action="" incognito and purge page
* Visit [desktop] (hard refresh) https://en.wikipedia.org/wiki/User:Jdlrobson/T173949 incognito and verify that mw.loader.getState('ext.math.styles') === 'registered' is true
* Visit [mobile] https://en.m.wikipedia.org/wiki/User:Jdlrobson/T173949 and note that mw.loader.getState('ext.math.styles') === 'registered' is now false (Expected: should be true)
* Purge [mobile] https://en.m.wikipedia.org/wiki/User:Jdlrobson/T173949?action="" and verify that mw.loader.getState('ext.math.styles') === 'registered' is still false
* Visit [desktop] https://en.wikipedia.org/wiki/User:Jdlrobson/T173949 and see that mw.loader.getState('ext.math.styles') === 'registered' is now false. (Expected: should be true)
* Remove wikilink on https://www.wikidata.org/wiki/Q4115189 to https://en.wikipedia.org/wiki/User:Jdlrobson/T173949
* Refresh page and see that mw.loader.getState('ext.math.styles') === 'registered' is now true
= Developer notes
This only seems to happen when a page is associated with a Wikidata entry. When I remove the wikilink on https://www.wikidata.org/wiki/Q4115189 the problem magically goes away
It also seems to go away when the template "[[ https://en.wikipedia.org/wiki/Template:Internet_Archive_author?action="" | Internet Archive author ]]" has been removed.
The code inside https://en.wikipedia.org/wiki/Module:Internet_Archive does seem to make use of wikibase - making a call to mw.wikibase.getEntityObject().
I connected https://wikidata.beta.wmflabs.org/wiki/Q361812 to https://en.wikipedia.beta.wmflabs.org/wiki/T173949 and re-ran the experiment but it failed. I updated the module, still no luck, however when I added [[ https://wikidata.beta.wmflabs.org/w/index.php?title=Q361812&type=revision&diff=1032719&oldid=1032718 | an inception (start date) field to the Wikidata item ]] the math module started to get pulled in.
== Summary
If an article page is connected to a Wikidata entry which has an inception field AND I use Module:Internet_Archive - then the ext.math.styles module is unexpectedly pulled into the mobile view.
= Acceptance criteria
[] ext.math.styles should not be loaded on mobile for a page which does not have Math
...
I am concerned that user specific preferences are causing parser cache pollution and this problem may be a larger performance problem then we are aware of.After some investigation (see detailed developer notes) I have managed to narrow this down to a Lua module that reads Wikidata data, which in turn leads to the Math module unexpectedly being added.
== Developer notes
...
The style should only be added if the **chem** or **math** parser function is used. The only other place ext.math.styles is added relates to Wikidata: [[ https://github.com/wikimedia/mediawiki-extensions-Math/blob/670f0bb8f95b8d9ac7994ab3ff45a7bb8e91d185/src/MathWikidataHook.php#L45 | Wikidata hook]] == Replication steps
* Ensure https://www.wikidata.org/wiki/Q4115189 has a site link to https://en.wikipedia.org/wiki/User:Jdlrobson/T173949
* Visit [desktop] https://en.wikipedia.org/wiki/User:Jdlrobson/T173949?action="" incognito and purge page
* Visit [desktop] (hard refresh) https://en.wikipedia.org/wiki/User:Jdlrobson/T173949 incognito and verify that mw.loader.getState('ext.math.styles') === 'registered' is true
* Visit [mobile] https://en.m.wikipedia.org/wiki/User:Jdlrobson/T173949 and note that mw.loader.getState('ext.math.styles') === 'registered' is now false (Expected: should be true)
* Purge [mobile] https://en.m.wikipedia.org/wiki/User:Jdlrobson/T173949?action="" and verify that mw.loader.getState('ext.math.styles') === 'registered' is still false
* Visit [desktop] https://en.wikipedia.org/wiki/User:Jdlrobson/T173949 and see that mw.loader.getState('ext.math.styles') === 'registered' is now false. (Expected: should be true)
* Remove wikilink on https://www.wikidata.org/wiki/Q4115189 to https://en.wikipedia.org/wiki/User:Jdlrobson/T173949
* Refresh page and see that mw.loader.getState('ext.math.styles') === 'registered' is now true
= Developer notes
This only seems to happen when a page is associated with a Wikidata entry. When I remove the wikilink on https://www.wikidata.org/wiki/Q4115189 the problem magically goes away
It also seems to go away when the template "[[ https://en.wikipedia.org/wiki/Template:Internet_Archive_author?action="" | Internet Archive author ]]" has been removed.
The code inside https://en.wikipedia.org/wiki/Module:Internet_Archive does seem to make use of wikibase - making a call to mw.wikibase.getEntityObject().
I connected https://wikidata.beta.wmflabs.org/wiki/Q361812 to https://en.wikipedia.beta.wmflabs.org/wiki/T173949 and re-ran the experiment but it failed. I updated the module, still no luck, however when I added [[ https://wikidata.beta.wmflabs.org/w/index.php?title=Q361812&type=revision&diff=1032719&oldid=1032718 | an inception (start date) field to the Wikidata item ]] the math module started to get pulled in.
== Summary
If an article page is connected to a Wikidata entry which has an inception field AND I use Module:Internet_Archive - then the ext.math.styles module is unexpectedly pulled into the mobile view.
= Acceptance criteria
[] ext.math.styles should not be loaded on mobile for a page which does not have Math
TASK DETAIL
EMAIL PREFERENCES
To: Jdlrobson
Cc: Physikerwelt, Krinkle, brion, Niedzielski, greg, TerraCodes, Liuxinyu970226, Peter, Jdlrobson, Volker_E, Aklapper, Imarlier, Lahi, Gq86, GoranSMilovanovic, Maosef, QZanden, LawExplorer, Winter, Vali.matei, JJMC89, Debenben, Bianjiang, Nirmos, Cwek, Wikidata-bugs, Hydriz, aude, fredw, Pkra, Dinoguy1000, ssastry, scfc, Arlolra, Jackmcbarn, Mbch331, Jay8g
Cc: Physikerwelt, Krinkle, brion, Niedzielski, greg, TerraCodes, Liuxinyu970226, Peter, Jdlrobson, Volker_E, Aklapper, Imarlier, Lahi, Gq86, GoranSMilovanovic, Maosef, QZanden, LawExplorer, Winter, Vali.matei, JJMC89, Debenben, Bianjiang, Nirmos, Cwek, Wikidata-bugs, Hydriz, aude, fredw, Pkra, Dinoguy1000, ssastry, scfc, Arlolra, Jackmcbarn, Mbch331, Jay8g
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
