When editing the preview does not correspond to the saved page. The infobox appears first in the preview not the lead paragraph:
We pass a parameter mobileformat "true" to the API in edit previews. MobileFrontend extends ApiParseExtender when this is present.
This could be a possible regression caused by T245160 if onOutputPageBeforeHTML is run inside API parse queries (although I think this is unlikely). It's more likely it doesn't know it's the lead section and the paragraph needs moving.
- Make sure the MobileFormatter applies transforms to all content in edit preview
- To avoid spamming logstash with notices (and reopening T245160), disable the logging provided by $wgMFLogWrappedInfoboxes for API driven changes. A disableLogging function may be useful and called in ApiParseExtender.
During analysis please work out how the ApiParseExtender works and make sure it's providing suitable parameters to MobileFormatter and calling the right methods. Knowing exactly why the lead transform fails to apply will be useful to know.