Page MenuHomePhabricator

Move /random endpoint from RESTBase to Wikifeeds
Closed, ResolvedPublic

Description

In order to migrate wikifeeds from restbase to REST gateway we need to move the random title redirections logic from RESTBase to wikifeeds.

Previous context for historical reasons

As WikiFeeds is getting moved from RESTbase to the API gateway, we want to use this opportunity to narrow the scope of what WikiFeeds provides as a capability as being more explicit and self-serving for our consumers. As part of this effort, the random endpoint that current is provided through WikiFeeds API is thought to be more client-agnostic and should be a wider platform capability.

Event Timeline

@Mholloway would you say this is an accurate statement of the context for this?

Yeah. The only background I would add is this:

There is an API module (ApiQueryRandom) for querying for a random page. The results can be limited to a specific namespace (e.g., 0 for main namespace articles) but otherwise there are no quality guarantees. It might return a stub article, or a list article, or a disambiguation page.

https://en.wikipedia.org/w/api.php?action=query&generator=random&grnnamespace=0

What currently lives in Wikifeeds aims to be a "smart" random article endpoint that builds and improves on ApiQueryRandom by requesting several random pages from it and then applying a ranking heuristic to pick the best one. Articles get points for things like having images, having long summary extracts, and not being list or disambiguation pages. The goal is to ensure that a good quality article is returned.

I think this task is to update ApiQueryRandom to allow filtering at the source for things like the page having an image, not being a disambiguation page, etc., so that the Wikifeeds-powered /page/random API endpoint is no longer needed to get a good quality random article.

In the context of restbase sunset I think the initial suggestion to migrate /page/random/{format} to MediaWiki core would put more effort than rerouting to the existing codebase.
Any thoughts on that @daniel @MSantos ?

Personally, I prefer to just contain this to the restbase sunset context and just point REST gateway to the existing service.

Change 930186 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/services/wikifeeds@master] RESTBase compat: Implement a random title redirect

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

In the context of restbase sunset I think the initial suggestion to migrate /page/random/{format} to MediaWiki core would put more effort than rerouting to the existing codebase.
Any thoughts on that @daniel @MSantos ?

Personally, I prefer to just contain this to the restbase sunset context and just point REST gateway to the existing service.

I don't have strong feelings about this. If wikifeeds already knows how to pick random pages, we can just use that.

Change 930186 merged by jenkins-bot:

[mediawiki/services/wikifeeds@master] RESTBase compat: Implement a random title redirect

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

In the context of restbase sunset I think the initial suggestion to migrate /page/random/{format} to MediaWiki core would put more effort than rerouting to the existing codebase.
Any thoughts on that @daniel @MSantos ?

Personally, I prefer to just contain this to the restbase sunset context and just point REST gateway to the existing service.

LGTM. Should we rename the task then?

Jgiannelos renamed this task from Move /random endpoint from WikiFeeds into MediaWiki to Move /random endpoint from RESTBase to Wikifeeds.Jun 15 2023, 11:36 AM
Jgiannelos updated the task description. (Show Details)

Change 930630 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/services/wikifeeds@master] Prefix random redirects - overlapping title param

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

Change 930630 merged by jenkins-bot:

[mediawiki/services/wikifeeds@master] Prefix random redirects - overlapping title param

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