Page MenuHomePhabricator

Gracefully handle non-wikitext pages when returning HTML from the page endpoints
Closed, ResolvedPublic

Description

The v1/(page|revision)/{title}/html endpoints curently get all HTML from ParsoidOutputAccess. ParsoidOutputAccess will fail hard for content models not supported by Parsoid (currently, wikitext and JSON).

For example, the following should not trigger a 500: https://www.wikidata.org/w/rest.php/v1/page/Q3/html.
We should return a 4xx error for now. 415 perhaps.

Note that for now, we just need to avoid a hard crash. Eventually, the endpoints should handle requests for non-wikitext content (or multi-slot pages) gracefully, by using ParserOutputAccess instead of ParsoidOutputAccess if the content model isn't supported by parsoid. See T311648: Allow WikitextContentHandler to use Parsoid for rendering wikitext.

Event Timeline

daniel triaged this task as High priority.Jun 30 2022, 2:45 PM
daniel created this task.

Change 810852 had a related patch set uploaded (by D3r1ck01; author: Derick Alangi):

[mediawiki/core@master] parser: Default to ParserOutputAccess if content model not supported

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

daniel updated the task description. (Show Details)
daniel lowered the priority of this task from High to Medium.Sep 5 2022, 9:22 AM
daniel raised the priority of this task from Medium to High.Dec 7 2022, 9:53 PM

Bumping to high per T324711

daniel lowered the priority of this task from High to Medium.Dec 14 2022, 12:21 PM

Change 810852 abandoned by D3r1ck01:

[mediawiki/core@master] parser: Default to ParserOutputAccess if content model not supported

Reason:

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

daniel raised the priority of this task from Medium to High.Jan 9 2023, 10:02 AM
daniel updated the task description. (Show Details)

Change 877115 had a related patch set uploaded (by D3r1ck01; author: Derick Alangi):

[mediawiki/core@master] ParsoidOutputAccess: Completely handle unsupported content models

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

Change 877115 merged by jenkins-bot:

[mediawiki/core@master] ParsoidOutputAccess: Completely handle unsupported content models

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

Change 877997 had a related patch set uploaded (by D3r1ck01; author: Derick Alangi):

[mediawiki/core@master] ParsoidOutputAccess: Mark dummy parser output as non-cacheable

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

Change 877997 merged by jenkins-bot:

[mediawiki/core@master] ParsoidOutputAccess: Mark dummy parser output as non-cacheable

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

daniel updated the task description. (Show Details)

For example, the following should not trigger a 500: https://www.wikidata.org/w/rest.php/v1/page/Q3/html.

It still does, whereas https://www.wikidata.org/api/rest_v1/page/html/Q3 responds with a dummy msg

Change 1009205 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] REST: HTML endpoints should support all content models

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

Change 1009205 merged by jenkins-bot:

[mediawiki/core@master] REST: HTML endpoints should support all content models

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