Page MenuHomePhabricator

Page URL should update on redirect
Closed, DeclinedPublic

Description

Go to http://marvin.wmflabs.org/wiki/Einstein. The page redirects to "Albert Einstein" but the URL isn't updated. This task encompasses the work to update the URL when a redirect occurs due to URL encoding or wiki redirects for both client and server scenarios.

AC

Related Objects

Event Timeline

Some AC

  • Server side render of a redirect, responds with 301 to canonical url
  • Client side render of a redirect, replace the url with the canonical one

Change 384985 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[marvin@master] Chore: expose HTTP response statuses from data clients

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

Change 384985 merged by jenkins-bot:
[marvin@master] Chore: expose HTTP response statuses from data clients

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

Change 387328 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[marvin@master] Update: report server URL redirect statuses

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

Niedzielski changed the task status from Open to Stalled.Nov 2 2017, 5:59 PM
Niedzielski added a subscriber: bearND.

Denormalized / canonical page title information is available in the page summary endpoint's titles.title and titles.namespace_name properties. The client can use this to update the Marvin URL for summaries. e.g:

http://appservice.wmflabs.org/en.wikipedia.org/v1/page/summary/Dog
{
  "type": "standard",
  "title": "Dog",
  "displaytitle": "Dog",
  "titles": {
    "title": "Dog",
    "normalized_title": "Dog",
    "display_title": "Dog",
    "namespace_id": 0,
    "namespace_name": ""
  },
  "pageid": 4269567,
  "thumbnail": {
    "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Collage_of_Nine_Dogs.jpg/320px-Collage_of_Nine_Dogs.jpg",
    "width": 320,
    "height": 281,
    "original": "https://upload.wikimedia.org/wikipedia/commons/d/d9/Collage_of_Nine_Dogs.jpg"
  },
  "originalimage": {
    "source": "https://upload.wikimedia.org/wikipedia/commons/d/d9/Collage_of_Nine_Dogs.jpg",
    "width": 1665,
    "height": 1463
  },
  "lang": "en",
  "dir": "ltr",
  "revision": "806438597",
  "timestamp": "2017-10-22T01:20:54Z",
  "description": "domestic animal",
  "extract": "The domestic dog is a member of genus Canis (canines) that forms part of the wolf-like canids, and is the most widely abundant carnivore. The dog and the extant gray wolf are sister taxa, with modern wolves not closely related to the wolves that were first domesticated, which implies that the direct ancestor of the dog is extinct. The dog was the first domesticated species and has been selectively bred over millennia for various behaviors, sensory capabilities, and physical attributes.",
  "extract_html": "<p>The <b>domestic dog</b> is a member of genus <i><span>Canis</span></i> (canines) that forms part of the <span>wolf-like canids</span>, and is the most widely abundant <span>carnivore</span>. The dog and the extant <span>gray wolf</span> are sister <span class=\"mw-redirect\">taxa</span>, with modern wolves not closely related to the wolves that were first domesticated, which implies that the direct ancestor of the dog is extinct. The dog was the first <span>domesticated</span> species and has been <span>selectively bred</span> over millennia for various behaviors, sensory capabilities, and physical attributes.</p>"
}

References:

These changes are yet deployed but will be.

For the mobile-sections-lead endpoint, @bearND made a nice ticket here to add a titles.title property of some kind. We can use this property with the existing ns_text property to get the resolved canonical URL. Note that redirects with fragments are not yet supported by RESTBase (T148645).

Change 387328 merged by jenkins-bot:
[marvin@master] Update: report server URL redirect statuses

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

Niedzielski changed the task status from Stalled to Open.Nov 7 2017, 7:40 PM

@bearND has taken the trouble to add the title property to the lead response in T179600 (thanks!). The change has been merged and appears to be available on appservice.wmflabs.org. We're waiting for it to appear on prod but I believe this task can be worked on in parallel.

Niedzielski changed the task status from Open to Stalled.Nov 9 2017, 1:37 PM

The sections endpoint is deprecated so these changes have been rolled back per discussion offline.

Change 392573 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[marvin@master] Fix: gracefully handle redirects to external sites

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

Change 394476 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[marvin@master] Chore: add fetch wrapper tests

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

This should also include a "redirected from" notice, cf. https://en.m.wikipedia.org/wiki/Einstein and T53736#3382857 .

Also, regarding section redirects,
http://marvin.wmflabs.org/wiki/Economy_of_Christmas_Island should redirect to http://marvin.wmflabs.org/wiki/Christmas_Island#Economy (@Krinkle's example from T53736#3389432 .)

More generally, is this already implementing the RfC outcome on implementing proper HTTP redirects (T53736)?

This should also include a "redirected from" notice, cf. https://en.m.wikipedia.org/wiki/Einstein and T53736#3382857 .

@Tbayer, thanks! Now tracked in T182120.

I think that section redirects are blocked by T148645 too.

is this already implementing the RfC outcome on implementing proper HTTP redirects

Regardless of redirects, Marvin needs the final resolved page title which ideally would be provided in the response body. (This data is already present in the summary staging endpoint and is planned for PCS.) We're currently handling redirects manually to obtain it for the client. On the server, we must handle the redirect to propagate the appropriate HTTP response. This is necessary even with HTTP redirects.

Change 394476 merged by jenkins-bot:
[marvin@master] Chore: add fetch wrapper tests

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

Change 392573 merged by jenkins-bot:
[marvin@master] Fix: gracefully handle redirects to external sites

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

This task is stalled until we switch to PCS.

Aklapper subscribed.

Declining open Marvin tasks as per T203749#4605708