Page MenuHomePhabricator

action=query&list=deletedrevs with a new-style continuation fails
Closed, ResolvedPublic

Description

When I call action=query&list=deletedrevs&titles=... with the new mode for continuation (continue=) and there are more results than the limit and drstart is set, the second query fails. If drstart is not set, the result of the second query sometimes contain deleted revisions of another page.

Examples

You need to be a sysop on frwiki to see the results.

First query:
https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=Utilisateur:Orlodrim/R%C3%A9f%C3%A9rences%20incorrectes&drprop=user&drstart=2013-11-30T14:25:56Z&drlimit=1&continue=
Result:
Information on one deleted revision as expected + the following tag for continuation:
<continue drcontinue="2|Orlodrim/Références_incorrectes|20131128195552|6069941" continue="-||" />

Second query:
https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=Utilisateur:Orlodrim/R%C3%A9f%C3%A9rences%20incorrectes&drprop=user&drstart=2013-11-30T14:25:56Z&drlimit=1&continue=-||&drcontinue=2|Orlodrim/R%C3%A9f%C3%A9rences_incorrectes|20131128195552|6069941
Result:
<error code="drbadparams" info="The start parameter cannot be used in mode 3" xml:space="preserve">

Expected result: no error and information about the next deleted revision of the same page.

If drstart is not set, there is no error, but the result is sometimes invalid:

Sequence that does not work (the second query returns a deleted revision of https://fr.wikipedia.org/wiki/%F0%9F%9A%80):

  1. https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=Utilisateur:Orlodrim/R%C3%A9f%C3%A9rences%20incorrectes&drprop=user&drlimit=1&continue=
  2. https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=Utilisateur:Orlodrim/R%C3%A9f%C3%A9rences%20incorrectes&drprop=user&drlimit=1&continue=-||&drcontinue=2|Orlodrim/R%C3%A9f%C3%A9rences_incorrectes|20131208231758|6069944

Sequence that works:

  1. https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=A-Live&drprop=user&drlimit=1&continue=https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=A-Live&drprop=user&drlimit=1&continue=
  2. https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=A-Live&drprop=user&drlimit=1&continue=https://fr.wikipedia.org/w/api.php?action=query&list=deletedrevs&titles=A-Live&drprop=user&drlimit=1&continue=-||&drcontinue=0|A-Live|20081002173128|5600890

Investigation

I noticed that if the "continue" parameter is equal to "-||", $generatorDone is set to true in ApiQuery::execute(), so mPageSet is not initialized. Because of that, ApiQueryDeletedrevs is in mode 3 ("List all deleted revisions in the given namespace") instead of mode 1 ("List deleted revisions for the given title"). If I manually replace "-||" with "||" in the "continue" parameter, the second query works.

ApiResult::endContinuation() sets "continue" to "-||" if "Generator and prop modules are all done". I believe that the root cause is the incorrect assumption that "action=query&list=..." never makes use of the "titles" parameter.

However, I do not understand why it does not consistently fail without "drstart".


Version: 1.24rc
Severity: normal

Details

Reference
bz71389

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:45 AM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz71389.
bzimport added a subscriber: Unknown Object (MLST).

The root cause here is that "list=deletedrevs" is pretending to be a "prop" module when it's actually not. The new-style continuation doesn't know it's pretending to be a prop module, so it doesn't set the continuation fields correctly.

I'm inclined to deprecate list=deletedrevs using the pageset at all, and instead add all three of "drtitles", "drpageids", and "drrevids" to make it more like all other 'list' submodules. I'll have to check whether anyone is using list=deletedrevs with a generator though, as "drgenerator" would be insane. Or else make something like "prop=deletedrevisions" for mode 1 and "list=alldeletedrevisions" for modes 2 and 3, and deprecate list=deletedrevs entirely.

Change 168646 had a related patch set uploaded by Anomie:
API: Split list=deletedrevs into prop=deletedrevisions and list=alldeletedrevisions

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

Change 168646 merged by jenkins-bot:
API: Split list=deletedrevs into prop=deletedrevisions and list=alldeletedrevisions

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