Page MenuHomePhabricator

Parsoid should provide an easy way for hooks to check if parser content is unbalanced
Open, MediumPublic

Description

Background

We'd like to disable mobile transformations on pages which have unbalanced HTML as it can result in broken experience for readers. This is preferable as it gives editors clear feedback that something is broken (for example in the example of T416431: Section wrapping not working on page on pages with unbalanced templates it is unclear the page is broken unless you are on mobile and scroll down to the references section. In future it may also make sense to add a warning message at the top of the page.

User story

As an editor I want to know when I've introduced a template error that breaks a page on mobile.

Requirements

  • Given an OutputPage and Title object it should be possible to determine if the page has unbalanced HTML to support MobileFrontend disabling behaviours based on the outcome.
$oracle = MediaWikiServices::getInstance()->getService( 'ParserMigration.Oracle' );
$parsoidPageUnbalanced = $oracle->parsoidPageUnbalanced( $ title );

BDD

  • For QA engineer to fill out

Test Steps

  • For QA engineer to fill out

Design

Potential use case:

Screenshot 2026-02-12 at 2.12.24 PM.png (695×361 px, 92 KB)

Acceptance criteria

  • Add acceptance criteria

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

This task was created by Version 1.2.0 of the Web team task template using phabulous

Event Timeline

Probably parsoid would add something to the ParserOutput extension data to flag this. We could also add a new ParserOutputFlag but that seems heavyweight. We'd have to maintain this property across selective update.

MSantos added a subscriber: JasKaur2004.
Jdlrobson-WMF lowered the priority of this task from High to Medium.Wed, Mar 25, 12:11 AM

Removing this as a blocker. While this is inconsistent with how things currently work and will seed confusion (so should be fixed at some point) it is not a blocker for Parsoid roll out from a reader POV.