Certain pages wrap the .infobox element inside a .mw-stack element courtesy of the Stack template
As a result, infobox will appear first on these pages.
Examples:
https://en.m.wikipedia.org/wiki/Christopher_II_of_Denmark
https://en.m.wikipedia.org/wiki/O.%20J.%20Simpson
https://en.m.wikipedia.org/wiki/Beijing#/editor/0 uses {{stack begin}}
https://en.m.wikipedia.org/wiki/Xi'an uses {{stack begin}}
This impacts around 20k pages a day on English Wikipedia (note that it's hard to get an idea of unique pages due to the nature of the logging):
https://logstash.wikimedia.org/app/kibana#/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now%2Fw,mode:quick,to:now%2Fw))&_a=(columns:!(_source),index:'logstash-*',interval:d,query:(query_string:(analyze_wildcard:!t,query:'message:%22Found%20infobox%20wrapped%20with%20container%20on%22')),sort:!('@timestamp',desc)))
= Changes
[] If an infobox is contained inside an mw-stack element, move the lead paragraph above the first mw-stack element. Do not log inside logInfoboxesWrappedInContainers
[] Currently we are logging events on cached HTML. Restrict the logging to only occur for logged in users (this will reduce a lot of the noise in the logs)
[] Add a test case for an .infobox element wrapped in a .mw-stack element
[] Add a test case for an .infobox element wrapped in an element which does not have the mw-stack class.
= Pre sign off
Create new tasks if necessary...
[] Check how this impacts [[ https://logstash.wikimedia.org/app/kibana#/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now%2Fw,mode:quick,to:now%2Fw))&_a=(columns:!(_source),index:'logstash-*',interval:d,query:(query_string:(analyze_wildcard:!t,query:'message:%22Found%20infobox%20wrapped%20with%20container%20on%22')),sort:!('@timestamp',desc)) | logged events ]]
[] investigate remaining problematic templates
[] If logged events > 1000 switch on for German Wikipedia
[] In new task ask the question can we/should we turn it off. Note, an acceptable outcome might be to keep the logging and check it via chores. A new template introduction might break this functionality so we may want to monitor it as part of maintenance.