Page MenuHomePhabricator

Searching for special pages with REST API: The given PageIdentity Special:AbuseFilter does not represent a proper page
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Enable new Vector header.
  • Type Special:A in the search box

What happens?:

  • Fatal errors in the logs
[2022-02-09T13:53:03.369483+00:00] exception.ERROR: [c9a135346b1aa8bf78509849] /w/rest.php/v1/search/title?q=Special%3AA&limit=10   MediaWiki\Page\PageAssertionException: The given PageIdentity Special:AbuseFilter does not represent a proper page {"exception":"[object] (MediaWiki\\Page\\PageAssertionException(code: 0): The given PageIdentity Special:AbuseFilter does not represent a proper page at /srv/mediawiki/workdir/includes/page/WikiPageFactory.php:59)
[stacktrace]
#0 /srv/mediawiki/workdir/includes/page/RedirectStore.php(43): MediaWiki\\Page\\WikiPageFactory->newFromTitle()
#1 /srv/mediawiki/workdir/includes/Rest/Handler/SearchHandler.php(253): MediaWiki\\Page\\RedirectStore->getRedirectTarget()
#2 /srv/mediawiki/workdir/includes/Rest/Handler/SearchHandler.php(222): MediaWiki\\Rest\\Handler\\SearchHandler->buildSinglePage()
#3 /srv/mediawiki/workdir/includes/Rest/Handler/SearchHandler.php(185): MediaWiki\\Rest\\Handler\\SearchHandler->buildPageObjects()
#4 /srv/mediawiki/workdir/includes/Rest/Handler/SearchHandler.php(368): MediaWiki\\Rest\\Handler\\SearchHandler->doSearch()
#5 /srv/mediawiki/workdir/includes/Rest/Router.php(414): MediaWiki\\Rest\\Handler\\SearchHandler->execute()
#6 /srv/mediawiki/workdir/includes/Rest/Router.php(338): MediaWiki\\Rest\\Router->executeHandler()
#7 /srv/mediawiki/workdir/includes/Rest/EntryPoint.php(167): MediaWiki\\Rest\\Router->execute()
#8 /srv/mediawiki/workdir/includes/Rest/EntryPoint.php(132): MediaWiki\\Rest\\EntryPoint->execute()
#9 /srv/mediawiki/workdir/rest.php(31): MediaWiki\\Rest\\EntryPoint::main()
#10 {main}

What should have happened instead?:

  • No fatal errors
  • Results displayed

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
Latest MediaWiki as of now. Does not happen with a version from a week ago.

Observed in translatewiki.net canary testing during deployment.

Event Timeline

Nikerabbit triaged this task as Unbreak Now! priority.Feb 9 2022, 2:03 PM
Nikerabbit added a project: MediaWiki-REST-API.

Erring on the side of caution, I am assuming this will happen next week's train for WMF production as well. Feel free to untag/adjust priority if this is not the case.

Change 761344 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] SearchHandler: skip search results which are no proper pages

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

Jdlrobson renamed this task from Searching for special pages with new vector header: The given PageIdentity Special:AbuseFilter does not represent a proper page to Searching for special pages with REST API: The given PageIdentity Special:AbuseFilter does not represent a proper page.Feb 9 2022, 3:22 PM

Change 761344 merged by jenkins-bot:

[mediawiki/core@master] SearchHandler: skip search results which are no proper pages

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

Thank you @Zabe for the patch - definitely a big miss on my end.

Change 761659 had a related patch set uploaded (by Nikki Nikkhoui; author: Nikki Nikkhoui):

[mediawiki/core@master] Add @throws annotation to getRedirectTarget()

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

Change 761659 merged by jenkins-bot:

[mediawiki/core@master] Add @throws annotation to getRedirectTarget()

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

FWIW we did do deployment to translatewiki.net and haven't seen issues. Feel free to adjust priority or close if nothing more needs to be done.

Krinkle reopened this task as Open.EditedFeb 15 2022, 12:30 AM
Krinkle subscribed.

@Pchelolo I believe this change is fallout from change 753810 (for T296671).

I note that this seems very likely to end up not being needed after all (but Web team still deciding based on input at T296225#7635399 and T296671#7695667).

However, I believe your above change has interpreted the new fatal incorrectly. The problem was that special pages were making into the redirect modification code. The problem was not that special pages are in the results at all. If these were not genuine or useful pages to be found, they would presumably not be returned from the search backend in the first place.

As I understand, there has not been a feature request to remove Special pages from search engine backends, which it seems this change has caused by filtering them out after the fact, which I would consider a significant bug. I'm re-opening this as such.

Two good test cases:

1. Special page names.2. Special subpages
Screenshot 2022-02-15 at 00.29.19.png (464×551 px, 60 KB)
Screenshot 2022-02-15 at 00.29.28.png (191×576 px, 24 KB)
Krinkle lowered the priority of this task from Unbreak Now! to High.Feb 15 2022, 12:31 AM

Change 762945 had a related patch set uploaded (by Nikki Nikkhoui; author: Nikki Nikkhoui):

[mediawiki/core@master] Include Special pages in Search Results

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

@Krinkle it looks to me like this endpoint has always been filtering out Special Pages from search results (see this older branch) but I'm wondering how you generated the screenshot, i might be misunderstanding the code that i linked

If we change the existing behavior, and actually include special pages, that would mean the schema would also have to change. As an example, (as i understand it) special pages won't ever have an id right? or do those typically come back with id:0 ?

it looks to me like this endpoint has always been filtering out Special Pages from search results (see this older branch) but I'm wondering how you generated the screenshot, i might be misunderstanding the code that i linked

That screenshot is from the search widget used by all skins except new vector, which internally uses the Action API (api.php?action=opensearch).

Change 771378 had a related patch set uploaded (by Nikki Nikkhoui; author: Nikki Nikkhoui):

[mediawiki/core@master] Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into review/nikki_nikkhoui/T301346

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

Change 771378 abandoned by Nikki Nikkhoui:

[mediawiki/core@master] Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into review/nikki_nikkhoui/T301346

Reason:

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

@Majavah i followed up with @Krinkle on IRC and we cleared up my confusion, thanks!

Change 762945 merged by jenkins-bot:

[mediawiki/core@master] Include Special pages in Search Results

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

Should be fixed now!