Page MenuHomePhabricator

Lead paragraph hoisting and lazy images are disabled for users in the experiment on legacy parser
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
Notice that the infobox appears before the lead paragraph in treatment BUT not in control. This means this is not a proper A/B test.

Screenshot 2026-02-03 at 1.49.17 PM.png (1×662 px, 444 KB)

Notice that images are NOT lazy loaded and all load on page load

What should have happened instead?:
The lead paragraph appears before the infobox. This is based on MoveLeadParagraphTransform logic in MobileFrontend.

Screenshot 2026-02-03 at 1.49.35 PM.png (1×666 px, 259 KB)

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Decision path for fix

Out come of spike on T416503 was that we could make a transform hack that seemed to work, but Jon and Brooke agreed the risk of breaking non-experiment code was greater than we were comfortable with and we plan to force the control group to use parsoid for consistency between the two parts of the experiment, without any effect on non-experiment renderings.

QA notes

Event Timeline

Jdlrobson-WMF removed Jdlrobson-WMF as the assignee of this task.EditedFeb 4 2026, 12:10 AM
Jdlrobson-WMF subscribed.

It looks like the lead paragraph transform has a hidden dependency on section collapsing. This is by design as being able to identify the lead section is what it uses to work out what the lead paragraph is.

So you have several options (assuming you need to support BOTH legacy and Parsoid)

  1. Implement a fallback in `MoveLeadParagraphTransform::apply and LazyImageTransform that works without sections. This seems like a lot of effort so wouldn't recommend.
	public function apply( Element $node ) {
		$section = DOMCompat::querySelector( $node, 'section' );
		if ( $section ) {
			$this->moveFirstParagraphBeforeInfobox( $section, $section->ownerDocument );
		}
	} else {
		// implement fallback here.
        }
  1. Revisit the use of $wgMFNamespacesWithoutCollapsibleSections

This approach can't be used if you want to retain the lead paragraph transform. You'd need to explore an alternative that keeps the sections but disables the JavaScript behaviour.

It's probably medium effort but your best option if you need to do this.

  1. Ship with the lead paragraph/lazy images transform removed. Worry about this when you scale.

Given the experiment introduces the bug in both test groups it's probably okay.

Jdlrobson-WMF renamed this task from Lead paragraph should be before infobox on mobile to Lead paragraph hoisting and lazy images are disabled for users in the experiment on legacy parser.Feb 4 2026, 12:12 AM
Jdlrobson-WMF updated the task description. (Show Details)

Change #1237347 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/MobileFrontend@master] Proposed fix for lead para transform when section collapsing is disabled

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

bvibber subscribed.

Spike is looking good. If no objection moving this into code review for the patch.

Change #1237347 abandoned by Bvibber:

[mediawiki/extensions/MobileFrontend@master] Fix for lead para transform without legacy section collapsing

Reason:

abandoning proposed patch as still too risky; we'll go with switching the control group to parsoid, which is a known quantity

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

bvibber set the point value for this task to 2.

Change #1239410 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/ParserMigration@master] ShouldUseParsoidHook interface for overriding ParserMigration state

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

Change #1239411 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/ReaderExperiments@master] Override ParserMigration state for Minerva TOC treatment and control

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

Change #1239410 merged by jenkins-bot:

[mediawiki/extensions/ParserMigration@master] ShouldUseParsoidHook interface for overriding ParserMigration state

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

Ok moving forward with alternate patch based on the spike results:

  • ParserMigration side merged (thanks @cscott!)
  • ReaderExperiments side about to do...

Change #1240078 had a related patch set uploaded (by Bvibber; author: Bvibber):

[integration/config@master] Update CI dependencies for ReaderExperiments

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

Change #1240078 merged by jenkins-bot:

[integration/config@master] Update CI dependencies for ReaderExperiments

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

Change #1240081 had a related patch set uploaded (by Bvibber; author: Bvibber):

[integration/config@master] Tweak CI deps for ReaderExperiments

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

Change #1240081 merged by jenkins-bot:

[integration/config@master] Tweak CI deps for ReaderExperiments

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

Change #1240360 had a related patch set uploaded (by Bvibber; author: Bvibber):

[integration/config@master] Drop MobileFrontend from ReaderExperiments deps

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

Change #1240360 merged by jenkins-bot:

[integration/config@master] Drop MobileFrontend from ReaderExperiments deps

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

Change #1239411 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] Override ParserMigration state for Minerva TOC treatment and control

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

egardner subscribed.

Confirming that this works as expected on production now.