Page MenuHomePhabricator

Mark Mathoid endpoints as deprecated
Closed, ResolvedPublic3 Estimated Story Points

Description

Description

The only active capability with a dependency on RESTBase is the Mathoid service. The Content Transform team is currently in the process of updating Wikimedia projects to rely on client side rendering of mathematical formulas instead of the Mathoid service. As that work wraps up, we need to deprecate the public facing endpoints. Because these endpoints see very little adoption outside of WMF owned features, we expect there to be a relatively short deprecation cycle; however, the sooner we can announce and mark the existing endpoints as deprecated, the sooner they can be officially sunset.

Conditions of acceptance

  • All math endpoints are marked as deprecated (see Meta for sandbox documentation)
    • Marked as deprecated within the spec
    • Display as deprecated within the sandbox
    • Deprecation header is returned on responses ("Deprecation: @<UNIX timestamp>" like we do in Handler.php )
  • The Math API module is marked as deprecated (see implementation details note) (external modules do not have a top-level deprecation flag)
  • Coordinate with Halley to match the "from" date with community facing comms and when the patch will actually ride the train; we may want to pad it by a few days or up to a week.
NOTE: The per-wiki endpoints are already marked as deprecated, with a preference for the meta pattern. This work takes it a step further to deprecate all public facing endpoints related to the mathoid service.

Implementation details

  • Pretty sure we have the ability to mark both the endpoints themselves and the module as a whole as deprecated, but please confirm and update ticket accordingly
  • Information about the header itself can be found here: https://phabricator.wikimedia.org/T405038
  • We may have a follow up ticket to add the notion of "sunsetting" to the response header, so that we may more proactively communicate when the service will be turned off in addition to when the deprecation cycle began.

Event Timeline

Because these endpoints see very little adoption outside of WMF owned features, we expect there to be a relatively short deprecation cycle;

Note they are used in default installation of Math in 1.42 and before (though all such versions are EOL), and later version if they enable the mathoid mode (it is disabled by default). See T373705 and https://www.mediawiki.org/wiki/Extension:Math#Math_output_modes

So before that we need to remove the Mathoid mode from Math.

AGhirelli-WMF set the point value for this task to 3.Jul 16 2026, 5:24 PM

Because these endpoints see very little adoption outside of WMF owned features, we expect there to be a relatively short deprecation cycle;

Note they are used in default installation of Math in 1.42 and before (though all such versions are EOL), and later version if they enable the mathoid mode (it is disabled by default). See T373705 and https://www.mediawiki.org/wiki/Extension:Math#Math_output_modes

So before that we need to remove the Mathoid mode from Math.

Yep, that's T432511: Remove Mathoid/RESTBase integration from Math extension. I expect we'll do that after the last WMF wiki switches over (schedule at T271001), but before shutting down Mathoid and archiving its repos (T432514).

aaron changed the task status from Open to In Progress.Aug 13 2026, 7:27 PM
aaron claimed this task.

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

[operations/mediawiki-config@master] Mark all Mathoid-based endpoints as deprecated

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

Change #1326410 merged by jenkins-bot:

[operations/mediawiki-config@master] Mark all Mathoid-based endpoints as deprecated

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

Mentioned in SAL (#wikimedia-operations) [2026-08-24T20:35:55Z] <aaron@deploy1003> Started scap sync-world: Backport for [[gerrit:1326410|Mark all Mathoid-based endpoints as deprecated (T431372)]]

Mentioned in SAL (#wikimedia-operations) [2026-08-24T20:37:57Z] <aaron@deploy1003> aaron: Backport for [[gerrit:1326410|Mark all Mathoid-based endpoints as deprecated (T431372)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-08-24T20:48:28Z] <aaron@deploy1003> Finished scap sync-world: Backport for [[gerrit:1326410|Mark all Mathoid-based endpoints as deprecated (T431372)]] (duration: 12m 33s)

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

[mediawiki/services/restbase@master] Add "Deprecation" header to math endpoint responses

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

Change #1338570 abandoned by Aaron Schulz:

[mediawiki/services/restbase@master] mathoid: add "Deprecation" header to math endpoint responses

Reason:

this the mirror

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

Change #1338570 restored by Aaron Schulz:

[mediawiki/services/restbase@master] mathoid: add "Deprecation" header to math endpoint responses

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

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

[operations/puppet@production] restbase: make /media/math/ endpoints emit 'Deprecated' header

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

Change #1338570 abandoned by Aaron Schulz:

[mediawiki/services/restbase@master] mathoid: add "Deprecation" header to math endpoint responses

Reason:

Better to do it the ATS way

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

@Fabfur: This perhaps needs to be done on the haproxy layer. Can you please check that and confirm here?

@HCoplin-WMF we discussed this with @Clement_Goubert last week, the proper way to implement this should be on haproxy side, which is why the change was abandoned.

I know that @Fabfur accepted to take a look at doing that (thanks!).

Hello, yes we can deprecate it at HAProxy level, just let me know what exactly to use to match (all paths, specific hosts, and so on) and if we want to respond with some specific status code (usually 403 but we can also redirect or add some additional header)

Hello, yes we can deprecate it at HAProxy level, just let me know what exactly to use to match (all paths, specific hosts, and so on) and if we want to respond with some specific status code (usually 403 but we can also redirect or add some additional header)

This would be adding the following headers:

# Deprecated since 2026-08-31T00:00:00Z RFC9745
Deprecation: @1788134400 
# Sunset on 2026-09-28T00:00:00Z RFC 8594
Sunset: Mon, 28 September 2026 00:00:00 UTC

to every path matching https://(.*)/api/rest_v1/media/math

Change #1353052 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] cace:haproxy: deprecating mathoid as a service endpoint

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

@HCoplin-WMF We're only returning the header for now, and not a 403 response, right?

Confirmed out of band that we are for now only returning the headers and not blocking traffic. We can do that in the same place when ready.
Once the haproxy patch is merged, headers will be returned for every path under /api/rest_v1/media/math/

Change #1353052 merged by Fabfur:

[operations/puppet@production] cache:haproxy: deprecating mathoid as a service endpoint

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

Confirmed that the cache servers are now returning the deprecation and sunset headers for that path

curl -v https://en.wikipedia.org/api/rest_v1/media/math/ 2>&1| grep -E 'deprecation|sunset'
< deprecation: @1788134400
< sunset: Mon, 28 September 2026 00:00:00 UTC

Thanks Fabrizio and Clement! Marking this as resolved, @HCoplin-WMF let us know if any change is needed here