[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Combine the user.tokens and user.options modules
Closed, ResolvedPublic

Description

See also Migration guide § user.tokens module. In short: Replace user.tokens with user.options.

The user.options used to contain the default user options as well, but this was split off into a regular module called user.defaults (stateless, cacheable) in 2015 (https://gerrit.wikimedia.org/r/177501).

What's left is a fairly small blob of JSON that is user-specific, private, and embedded into the HTML head. Which is exactly what user.tokens is as well.

Let's merge these.

Actual plan
  • Merge user.tokens into user.options (Yes, we found a way. Yes, it's hacky but it's worth it as it'll be least disruptive to end-users and developers this way).
  • Update uses of user.tokens to user.options in core.
  • Update uses of user.tokens to user.options in WMF extensions.
  • Update uses of user.tokens to user.options on WMF wikis (after the core change is deployed to all wikis).
  • Write a short migration guide on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users).
  • Remove user.tokens in MW 1.35.

Original plan
  • Define new module user.private that does what both of these do. Leaving user.options and user.tokens as empty modules (properly empty with isKnownEmpty returning true and no dependencies, not even an alias to the new module). The benefit of it being properly empty is that it will get a preset state=ready declaration and thus never roundtrip. We don't need this to have a back-compat alias because the module is always loaded so we can fulfil it without looking at user.private and anything using it will still observe tokens and options as having been loaded. Per T235457#5817934, they will be empty modules with back-compat alias.
  • Update any uses in core, tarballed/WMF-extensions.
  • Ask Krenair or Krinkle to run tourbot to the majority of uses. There should be little to none because it is loaded by default and can't be lazy-loaded even if it weren't due to being private/embed-only.
  • Remove the addModules() call and the empty modules.

Event Timeline

https://www.mediawiki.org/wiki/ResourceLoader/Core_modules#user.options states: "This module is loaded asynchronously and may depend on a separate HTTP request for the user.defaults module. Always declare the relevant dependencies for your module, or use mw.loader.using()." Assuming this is still true and won't be changed, setting the state of user.options to ready immediately might break scripts.

Krinkle triaged this task as Medium priority.Oct 19 2019, 7:36 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.

https://www.mediawiki.org/wiki/ResourceLoader/Core_modules#user.options states: "This module is loaded asynchronously and may depend on a separate HTTP request for the user.defaults module. Always declare the relevant dependencies for your module, or use mw.loader.using()." Assuming this is still true and won't be changed, setting the state of user.options to ready immediately might break scripts.

Thanks, yeah, we'll leave them as empty modules than with a simple dependency on user.private which, like user.options today will start in state loading with the embedded script fulfilling it via the implement() call. Any uses of the old name will result in it first waiting for the embed to complete, and then requesting the empty placeholder together wit the main batch. Still effectively free of cost given it won't need its own roundtrip and won't flush a unique response body. It'll just be an empty implement() call which compresses well along other modules.

Change 579660 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Merge 'user.tokens' module into 'user.options'

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

Change 579660 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Merge 'user.tokens' module into 'user.options'

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

Krinkle updated the task description. (Show Details)

Change 584001 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/AbuseFilter@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584003 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/AdvancedSearch@master] Remove unneeded 'user.tokens' dependency from SearchnamespaceTokenModule

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

Change 584004 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/LiquidThreads@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584009 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/MobileFrontend@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584010 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/Translate@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584001 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584009 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584004 merged by jenkins-bot:
[mediawiki/extensions/LiquidThreads@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584010 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Migrate 'user.tokens' dependency to 'user.options'

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

Change 584003 merged by jenkins-bot:
[mediawiki/extensions/AdvancedSearch@master] Remove unneeded 'user.tokens' dependency from SearchnamespaceTokenModule

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

Krinkle updated the task description. (Show Details)

Uses on public WMF wikis have all been fixed (search results). The remaining results are either unrelated mentions (such as in HTML code), or outdated search results from titles that have already been fixed.

Change 585853 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Remove 'user.tokens' module alias

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

Change 585853 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Remove 'user.tokens' module alias

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

Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF updated the task description. (Show Details)