Page MenuHomePhabricator

Expose transform/wikitext/to/lint endpoints in production and reroute /rest_v1/ requests to them
Closed, ResolvedPublic3 Estimated Story Points

Description

Genesis: T384216#10495696

As far as I can see, wikitext/to/lint is simply not enabled in production.

@cscott should it be? Adding it to coreRoutes.json should Just Work...

In order to have compatibility with RESTBase endpoints, we should expose the endpoint in MW core properly.

So yeah, bit of coordination required here if we need to roll it out before the end of the quarter. Summary of steps as I understand them are below (for clarity):

  • Technically enable in production.
  • Test functionality internally, to identify gaps in behaviors between RESTbase and Core implementations.
  • Update REST API documentation to include it as an option (moved out of scope for this Epic, to be addressed by MWI)
    • MediaWiki REST API docs
    • API portal
    • Generated docs
  • Rerouting test period
    • Request rerouting to test.wikipedia first
    • Community CTA for testing existing bots/tools/integrations against test.wikipedia
  • Reroute all RESTbase calls

Event Timeline

MSantos renamed this task from Expost wikitext/to/lint endpoint in production to Expose wikitext/to/lint endpoint in production.Feb 24 2025, 12:23 PM

@MSantos Do you have any metrics about how heavily used this is in RESTbase? That would inform the priority of exposing in the core REST endpoints. Similarly, it sounds like this is a blocker for RESTbase sunset overall?

If enabling in production is easy, I'd suggest we do that as a first step. We will also need to update documentation in MediaWiki (and the API portal) to surface it as an option, because we currently have a slightly different presentation style for the {x}/to/{y} endpoints, where they're presented as wikitext/to/html/{title} (and html/to/wikitext/{title}). I believe we would also need to make a slight change include the new endpoint the generated docs work too, but would look to @BPirkle to confirm.

Once enabled, I'd also suggest a slow roll out for rerouting from RESTbase to Core, including announcing availability on test.wikipedia first, so that we can have a call to action for developers who use the RESTbase endpoint to verify that rerouting works and doesn't introduce breaking changes.

So yeah, bit of coordination required here if we need to roll it out before the end of the quarter. Summary of steps as I understand them are below (for clarity):

  • Technically enable in production.
  • Test functionality internally, to identify gaps in behaviors between RESTbase and Core implementations.
  • Update REST API documentation to include it as an option
    • MediaWiki REST API docs
    • API portal
    • Generated docs
  • Rerouting test period
    • Request rerouting to test.wikipedia first
    • Community CTA for testing existing bots/tools/integrations against test.wikipedia
  • Reroute all RESTbase calls

Which of those would you expect to take on directly, and where would you like MWI to support?

I get in trouble every time I think I understand too much about parsing. So to confirm, I see I see the following in RESTBase:

  • /transform/wikitext/to/lint
  • /transform/wikitext/to/lint/{title}
  • /transform/wikitext/to/lint/{title}/{revision}

We're just talking about making these available under rest.php via TransformHandler, right?

As Daniel says, it looks like adding them to coreRoutes.json alongside the other transform endpoints should work. The existing entries can serve as a pattern, so this is mostly copy/paste.

As Halley said, generateResponseSpec(), which would also need a trivial tweak.

Unless I'm missing something, this doesn't sounds too difficult from a coding perspective. Of course, as Halley also said, we'll want to be careful that the behaviors match, or that any discrepancies are acceptable.

@HCoplin-WMF and @BPirkle not heavily used according to our turnillo dataset, but it does impact a few bots and gadgets that I am aware of.

HCoplin-WMF moved this task from Incoming (Needs Triage) to Next Up on the MW-Interfaces-Team board.
HCoplin-WMF renamed this task from Expose wikitext/to/lint endpoint in production to Expose transform/wikitext/to/lint endpoint in production.Feb 27 2025, 4:20 PM
HCoplin-WMF updated the task description. (Show Details)

We note that we're seeing hits for /w/rest.php/$WIKI/v3/transform/wikitext/to/lint/ against parsoid at the moment - parsoid is slated for decommissioning very soon, so this is a concern for that work as well as RESTbase.

Change #1189936 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on test2wiki

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

Change #1189938 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[operations/deployment-charts@master] Handle transform/wikitext/to/lint(.*) requests routed to the gateway

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

aaron renamed this task from Expose transform/wikitext/to/lint endpoint in production to Expose transform/wikitext/to/lint endpoints in production and reroute /rest_v1/ requests to them.Sep 22 2025, 2:40 PM

Change #1189938 merged by jenkins-bot:

[operations/deployment-charts@master] Handle transform/wikitext/to/lint(.*) requests routed to the gateway

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

Change #1194994 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on group0

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

Change #1194995 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on group1

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

Change #1194996 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on all wikis

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

aaron set the point value for this task to 3.

Change #1189936 merged by Hnowlan:

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on test2wiki

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

Change #1194994 merged by Hnowlan:

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on group0

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

Change #1194995 merged by Clément Goubert:

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on group1

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

Change #1194996 merged by Hnowlan:

[operations/puppet@production] Route transform/wikitext/to/lint(.*) to the gateway on all wikis

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