Page MenuHomePhabricator

CentralAuth: Audit autologin procedure for performance and code quality
Closed, DeclinedPublic

Description

I'm not happy about how the (still relatively new) added feature for autologin works.

The new JS-based procedure replaces old the in-between page and its <img> loads.

This is a reminder to perform a back-to-back audit of it and clean or refactor it. Perhaps we can walk through it this September when I'm visiting the office.

It currently performs upto 55 network requests to get things set up:F or each of the entry points CA tries to hit (listed below) multiplied by the number of wiki projects (wikipedia, wikibooks, wiktionary, etc.)

  • Special:CentralAutoLogin/start,
  • Special:CentralAutoLogin/checkLoggedIn
  • Special:CentralAutoLogin/createSession
  • Special:CentralAutoLogin/validateSession
  • Special:CentralAutoLogin/setCookies
See also

Details

Reference
bz66828

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:25 AM
bzimport set Reference to bz66828.
bzimport added a subscriber: Unknown Object (MLST).
At T91196, @Nemo_bis wrote:

In an ideal world, unregistered users wouldn't need to load Special:CentralAutoLogin/checkLoggedIn on every single page view (e.g. https://login.wikimedia.org/wiki/Special:CentralAutoLogin/checkLoggedIn?type=script&wikiid=itwikiquote&proto=https).

The offending line is in ext.centralauth.centralautologin.js

mw.loader.load( url );

I wonder if this should only be executing on a window onload event

Edge login seems to be triggered more than it should (e.g. a successful edge login on a wiki sets the CentralAuthDoEdgeLogin flag so the next visit to that wiki will trigger another edge login; I don't really get the point of that).

Other than that I'm not sure what small changes we could do performance-wise (the code quality could certainly be improved). At some point we'll have to get rid of edge login and having the login interface available on every wiki (T348388: SUL3: Use a dedicated domain for login and account creation), and then we can try to simplify things. But that will be a major refactoring.

matmarex subscribed.

While working on T327046 last year, I've read through all of this code, and made a number of code quality improvements (https://gerrit.wikimedia.org/r/q/owner:matmarex+project:mediawiki/extensions/CentralAuth+mergedafter:2023-10-10+mergedbefore:2024-01-01). I'm not sure if you can call this an audit, but I felt that what was left was ugly but necessary, and I feel that a more formal audit is not needed.