Opting into beta doesn't work for anons on beta cluster [not production]
Closed, ResolvedPublic3 Estimated Story Points

Description

As an anon user in an incognito window
Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Special:MobileOptions
Check beta box
Click save.
Go back to settings page and you are still in stable

Seen in Chrome on desktop and nexus 5
When logged in this doesn't seem to happen.


Test Plan

  • Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Main_Page (the base domain has a weird redirect) as an anon.
  • Visit the mobile settings page by opening the menu and clicking "Settings".
  • Check "Beta".
  • Click "Save".
  • Observe that the optin cookie is set for the .wikipedia.beta.wmflabs.org domain.
  • Visit the mobile settings page.
  • Observe that "Beta" is checked.
  • Switch to the desktop mode of the site by clicking "Desktop" in the footer menu.
  • Observe that the stopMobileRedirect cookie is set for the .wikipedia.beta.wmflabs.org domain.

Repeat the above for your local wiki. If you're using MediaWiki-Vagrant, then you can visit both http://127.0.0.1:8080/ and http://dev.wiki.local.wmftest.net:8080, for which the cookie domains should be 127.0.0.1 and .wiki.local.wmftest.net respectively.

Event Timeline

Cc @phuedx
(Haven't checked if this is device specific yet)

Jdlrobson renamed this task from Opting into beta doesn't work on Nexus 5 to Opting into beta doesn't work.Oct 24 2016, 5:15 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)

More information: I can opt into beta via Special:MobileOptions while logged in on Chrome (54.0.2840.71) on macOS Sierra (10.12)

Jdlrobson renamed this task from Opting into beta doesn't work to Opting into beta doesn't work for anons.Oct 24 2016, 5:16 PM
Jdlrobson updated the task description. (Show Details)
ovasileva set the point value for this task to 3.Oct 24 2016, 5:21 PM
This comment was removed by phuedx.

I've verified that opting into beta via Special:MobileOptions works on:

  • Firefox (49.0.2) on macOS Sierra (10.12)
  • Safari on iOS 10.0.2 on an iPhone 6

Ok...I've been observing the following behavior:
https://en.m.wikipedia.beta.wmflabs.org/wiki/Special:MobileOptions
ONLY goes to beta via a VPN connection to WMF
Else
https://en.m.wikipedia.beta.wmflabs.org/wiki/Special:MobileOptions
goes to stable
Regular beta: https://en.m.wikipedia.org/wiki/Main_Page seems to work just fine
Tried multiple browsers/networks/machines - still only seems to work for the VPN. Very weird.

Server/Client communication works properly. On form submit server sends

set-cookie: optin=beta; expires=Sun, 11-Dec-2016 19:30:06 GMT; Max-Age=2592000; path=/; domain=.wmflabs.org; secure; httponly

But the opt-in cookie is rejected by browser.

Reason:

As HTTP State Management Mechanism RFC 6265 - Section 5.3 - Storage Model says:

If the user agent is configured to reject "public suffixes" and the domain-attribute is a public
[...] Ignore the cookie entirely and abort these steps.

The public suffixes list is available on https://publicsuffix.org, direct link to the list: https://publicsuffix.org/list/public_suffix_list.dat
This list contains an entry :

// Wikimedia Labs : https://wikitech.wikimedia.org
// Submitted by Yuvi Panda <yuvipanda@wikimedia.org>
wmflabs.org

Because domain wmflabs.org is a public suffix - browser rejects the cookie. On another request cookie is not set - so server thinks that user uses stable mode.

Classic @yuvipanda ;-)
Well that sounds good that this is a beta cluster only issue.

Yuvi: The mobile web beta opt in cookie is rejected for the beta cluster. This means we can't easily test the beta mode for anonymous users on the beta cluster. Is there some way we can make this work again?

Jdlrobson renamed this task from Opting into beta doesn't work for anons to Opting into beta doesn't work for anons on beta cluster [not production].Nov 14 2016, 9:09 AM

Change 321796 had a related patch set uploaded (by Pmiazga):
Fix Beta optin on Beta cluser

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

If I am reading that cookie line correctly, it is setting the cookie to be readable by all of *.wmflabs.org, which is incorrect. It should be set to something beta specific, and that should work.

Change 321796 merged by jenkins-bot:
Fix MobileContext::getBaseDomain() method

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

I'll update this task with some domains to test @pmiazga's change against and the expected optin and stopMobileRedirect cookie domains for 'em.

Jdlrobson added subscribers: Verdy_p, Florian, bmansurov.

(I merged the above task into here as the issue described in there was not being able to opt into beta which hopefully is related to these fixes).
Categories in stable is tracked in T24660

There is a problem with beta labs described at T151894, but this task is resolved.