Page MenuHomePhabricator

mw.user.bucket does not re-bucket when a cookie is present and the version number has increased
Closed, DeclinedPublic

Description

Author: reha

Description:
After updating the bucketing configuration (and bumping up the version number), users are not re-bucketed.

REPRODUCE:

Assuming a config like so:

array(

'buckets' => array(
    'zero' => 50,
    'one' => 50,
),
'version' => 1,

);

After initial bucketing, you'll see a cookie (I used the web developer toolbar) like so:

Name mediaWiki.user.bucket:mykey
Value 1%3Azero

And "zero" would be returned.

If you then:

  1. Update the version in the config from 1 to 2
  2. Reload the page (and confirm that you have the new config, of course)
  3. Attempt mw.user.bucket

It will still return "zero", and the cookie will still have the value "1%3Azero".

EXPECTED:

A cookie like so, indicating re-bucketing:

Name mediaWiki.user.bucket:mykey
Value 2%3Azero

WORKAROUND:

You can pass the version as part of the key:

mw.user.bucket( 'mykey@' + cfg.version, cfg )

Which will result in a cookie like this:

Name mediaWiki.user.bucket:mykey@2
Value 2%3Azero

And will re-bucket when you change the version.

FIX:

https://svn.wikimedia.org/viewvc/mediawiki/branches/wmf/1.19wmf1/resources/mediawiki/mediawiki.user.js?view=markup

~ line 140, check the version from the cookie against the version in the config, and set bucket to null if they don't match. The check on line 141 will then pass and re-bucketing will occur.


Version: 1.19
Severity: normal

Details

Reference
bz36138

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 12:26 AM
bzimport set Reference to bz36138.
bzimport added a subscriber: Unknown Object (MLST).

mw.user.bucket has been deprecated in I5a66e1a4 and will not be worked on (unless you submit a patch). Sorry.