Page MenuHomePhabricator

Please report linter-errors in parse-API too
Open, MediumPublicBUG REPORT

Description

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

What happens?:
This simple call would create a wikipage with two linter errors of type missing-end-tag

What should have happened instead?:
I would be really glad, when there is some (maybe additional) parameter in the parse-API which reports those errors.

Event Timeline

Arlolra triaged this task as Medium priority.Aug 22 2023, 7:45 PM
Arlolra moved this task from Backlog to Action API on the MediaWiki-extensions-Linter board.
Arlolra subscribed.

A request can be made to the REST API to lint arbitrary wikitext,

> curl -X POST -H "Content-Type: application/json" -d '{"wikitext":"<div>test"}' https://www.mediawiki.org/api/rest_v1/transform/wikitext/to/lint
[{"type":"missing-end-tag","dsr":[0,9,5,0],"params":{"name":"div","inTable":false}}]

but the parse result isn't included.

A request can be made to the REST API to lint arbitrary wikitext,

Although it looks like that is being deprecated in T334238

We should probably add the lint errors to the ParserOutput object when useParsoid is set; after that is done it ought to be straightforward to export them from the parse API.

In fact, we should probably use a LinkUpdate job to update the linter table in that case, instead of Parsoid's special backdoor hook: T361413: Parsoid should perhaps use LinkUpdate job for lints instead of special Linter API/Hook.

On the other hand, being able to do linting asynchronously and have it not affect the performance of Parsoid read views is kinda nice. In that case, the parse API needs to do a separate database query to fetch the lints for the title which is being "parsed". This code will be more complicated, especially if you are not parsing a title but instead wikitext passed in directly via the parse API.