Page MenuHomePhabricator

Bug: Random still occasionally displays disambiguation articles, even though we are now filtering them out in most cases.
Closed, ResolvedPublic

Description

When we show a random article in the feed, we request a few random titles and sort by various criteria to show the "best" one.

When the api returns article data it can usually tell us whether a random title is a disambiguation page, such as when we get data for the "enwiki > anona" article:

https://en.m.wikipedia.org/w/api.php?action=mobileview&format=jsonfm&page=anona&sections=1&prop=text%7Cpageprops%7Cdescription&pageprops=*

{
    "mobileview": {
        "pageprops": {
            "disambiguation": "",
            "wikibase_item": "Q20996443"
        },
        "sections": [
            {
                "id": 1,
                "text": "<h2><span class=\"mw-headline\" id=\"See_also\">See also</span><span><a href=\"#/editor/1\" title=\"Edit section: See also\" data-section=\"1\" class=\"mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page icon-32px\">Edit</a></span></h2>\n<ul>\n<li><a href=\"/wiki/Annona_(disambiguation)\" title=\"Annona (disambiguation)\" class=\"mw-disambig\">Annona (disambiguation)</a></li>\n</ul>\n<table id=\"disambigbox\" class=\"metadata plainlinks dmbox dmbox-disambig\" style=\"\" role=\"presentation\">\n<tr>\n<td class=\"mbox-image\" style=\"padding: 2px 0 2px 0.4em;\"><a href=\"/wiki/File:Disambig_gray.svg\" class=\"image\"><img alt=\"Disambiguation icon\" src=\"//upload.wikimedia.org/wikipedia/en/thumb/5/5f/Disambig_gray.svg/30px-Disambig_gray.svg.png\" width=\"30\" height=\"23\" srcset=\"//upload.wikimedia.org/wikipedia/en/thumb/5/5f/Disambig_gray.svg/45px-Disambig_gray.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/5/5f/Disambig_gray.svg/60px-Disambig_gray.svg.png 2x\" data-file-width=\"220\" data-file-height=\"168\" /></a></td>\n<td class=\"mbox-text\" style=\"padding: 0.25em 0.4em; font-style: italic;\">This <a href=\"/wiki/Help:Disambiguation\" title=\"Help:Disambiguation\">disambiguation</a> page lists articles associated with the title <b>Anona</b>.<br />\n<small>If an <a class=\"external text\" href=\"//en.wikipedia.org/w/index.php?title=Special:WhatLinksHere/Anona&amp;namespace=0\">internal link</a> led you here, you may wish to change the link to point directly to the intended article.</small></td>\n</tr>\n</table>"
            }
        ]
    }
}

Note "disambiguation": "" page prop is present in the result above, which is correct.

However, sometimes the api messes up and doesn't include the "disambiguation" key, as is the case with "enwiki > HMS Dauntless":

https://en.m.wikipedia.org/w/api.php?action=mobileview&format=jsonfm&page=HMS%20Dauntless&sections=1&prop=text%7Cpageprops%7Cdescription&pageprops=*

{
    "mobileview": {
        "pageprops": {
            "displaytitle": "HMS <i>Dauntless</i>",
            "defaultsort": "Dauntless, Hms",
            "wikibase_item": "Q5632089"
        },
        "description": "Wikipedia disambiguation page",
        "sections": [
            {
                "id": 1,
                "text": "<h2><span class=\"mw-headline\" id=\"In_popular_culture\">In popular culture</span><span><a href=\"#/editor/1\" title=\"Edit section: In popular culture\" data-section=\"1\" class=\"mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page icon-32px\">Edit</a></span></h2>\n<ul>\n<li>In the 2003 film <i><a href=\"/wiki/Pirates_of_the_Caribbean:_The_Curse_of_the_Black_Pearl\" title=\"Pirates of the Caribbean: The Curse of the Black Pearl\">Pirates of the Caribbean: The Curse of the Black Pearl</a></i>, the fictional HMS <i>Dauntless</i> appears as the flagship and pride of the <a href=\"/wiki/Royal_Navy\" title=\"Royal Navy\">Royal Navy</a>.</li>\n</ul>"
            }
        ]
    }
}

Note "disambiguation": "" page prop is missing in the result above, which is incorrect (at least, if the wiki data description is to be believed) and the cause of the bug.

Best fix: So we need to file an upstream ticket for this.

Work-around: In the mean time we could set "isDisambiguation" to YES if either the server response has the "disambiguation" page props key, or if the wiki data description contains the string "disambiguation page".

Event Timeline

Mhurd raised the priority of this task from to Needs Triage.
Mhurd updated the task description. (Show Details)
Mhurd moved this task to Needs Triage on the Wikipedia-iOS-App-Backlog board.
Mhurd subscribed.
Mhurd set Security to None.
Mhurd updated the task description. (Show Details)
Mhurd updated the task description. (Show Details)
Mhurd added a subscriber: Deskana.

@Deskana Heya! We found a weird issue where occasionally the "disambiguation" page prop isn't being correctly set for some search results. Is this a know issue or should I file a ticket for the search team?

Mhurd renamed this task from Random items still occasionally display disambiguation articles to Random still occasionally displays disambiguation articles, even though we are now filtering them out in most cases..Dec 11 2015, 11:48 PM
Mhurd renamed this task from Random still occasionally displays disambiguation articles, even though we are now filtering them out in most cases. to Bug: Random still occasionally displays disambiguation articles, even though we are now filtering them out in most cases..Dec 12 2015, 12:58 AM

[[HMS Dauntless]] is not marked as a disambiguation page on-wiki, because the template on the bottom of it, shipindex, doesn't contain the DISAMBIG magic word that Extension:Disambiguator uses to mark pages as disambiguation pages. So, accordingly, the API does not treat the page as a disambiguation page. I wouldn't exactly say this is "working as intended", but the API is doing the right thing based on the information that it has.

The way to fix this is to convince the relevant users that shipindex (and other relevant templates) should contain the DISAMBIG magic word. I'd recommend speaking to your community liaison about that.

JMinor subscribed.

Refreshed the Radom item 20 times, no Disambig pages were shown. Not a systematic test, but I think we've done what we can here.