Page MenuHomePhabricator

Disable automatic sharing of site/user scripts between Vector and Vector 2022 skins
Closed, ResolvedPublic

Description

Background

During Vector-2022's development, there was a product requirement to minimize impact on (ease the transition for) communities. To fulfill this, the Vector-2022 skin currently:

  • loads both MediaWiki:Vector.(css,js) and MediaWiki:Vector-2022.(css,js) for sites using it as the default
  • loads both User:<username>/vector.(css,js) and User:<username>/vector-2022.(css,js) for users

With T301212, this functionality can now be turned off early by a community if desired, by a configuration change to wgVectorShareUserScripts.

In late 2023 / early 2024 it will be turned off everywhere.

Detailed examples

Existing behaviour

  • User Alice uses Vector (2010) skin, and can load scripts/styles with User:Alice/vector.js and User:Alice/vector.css
  • User Bob uses Vector-2022 skin, and can load scripts/styles with User:Bob/vector-2022.js and User:Bob/vector-2022.css
    • however Bob will also automatically load any code in their User:Bob/vector.js and User:Bob/vector.css
  • Similarly, the Vector-2022 skin loads both MediaWiki:Vector.css and also MediaWiki:Vector-2022.css

Behaviour after site request, or at the end of 2023

  • User Alice can load styles/scripts on the Vector (2010) skin using User:Alice/vector.js and User:Alice/vector.css
  • User Bob can load styles/scripts on the Vector-2022 skin using User:Bob/vector-2022.js and User:Bob/vector-2022.css
  • Vector 2022 skin does not load MediaWiki:Vector.css but instead only MediaWiki:Vector-2022.css

Impact if no action

In late 2023 / early 2024, users will suddenly see "Behaviour after site request". This means local site styles would stop loading (if those are being relied on) and many user scripts would stop loading unexpectedly.

Recommendation

It is recommended that communities:

  • discuss this change and manage the timeline of this change themselves,
  • notify any users it might affect, to avoid disruption or confusion,
  • use this as a good opportunity to encourage housekeeping. E.g. deletion of local skin js/css that is no longer used.

A community can decide to do nothing, but this will eventually become the default behaviour, so delaying action here is likely to cause problems for users in the long term.

The old/existing behaviour will hopefully be removed by the end of 2023.

Before the switchover

Interface Administrators should:

  • CSS: Copy any necessary content from MediaWiki:Vector.css into MediaWiki:Vector-2022.css
  • JavaScript: Migrate any content from MediaWiki:Vector.js into MediaWiki:Common.js (NOT duplicating it, because that can cause errors, unless you know what you are doing)
  • General cleanup, as needed

Users should:

  • CSS: Copy or Migrate any necessary content from User:<username>/vector.css into User:<username>/vector-2022.css- OR - m:User:<username>/global.css
  • JavaScript: Migrate any content from User:<username>/vector.js into User:<username>/common.js - OR - m:User:<username>/global.js (NOT duplicating it, because that can cause errors, unless you know what you are doing)

Request to communities

  • Please decide if it's preferable for your community to change this configuration earlier than the end of the year. A conversation in your community portal may be sufficient.

If/When your community decides to do so:

Related Objects

Event Timeline

@Jdlrobson Hiyo.
For Tech News, I'm not sure how to condense this down into a suitable (1–3 short sentences) summary, or when to include it.

  • Please could you suggest proposed wording? (Drafts always help!)
    • E.g. Context, Change, Action-request with link.
  • I'm also not sure when it ought to be included. (Timelines always help!)
    • I.e. Is it ready immediately (it seems to still be being discussed in the linked-task)? Is it urgent? Is it riding the train? -- I always need to know which edition, and which section, to place it in.

For this task itself, I'm confused by this Description sentence: "If communities do nothing, on the long term this functionality is likely to be disabled so it may be beneficial to do this now."

  • Does that mean "if nobody ends up using this on-request-config-option, we will remove it again in X [weeks? years?]" ? -- Or, does it mean "in the future, we may change this option to be the default" ? -- Or something else?
  • I wonder if it might be helpful to re-write the Description into 3 clear sections explaining:
    • Pre-Existing behavior;
    • New behavior (default, and optional alternative, PLUS the action-needed to get the alternative);
    • Far-future plan (with rough timescale, and how that will change the behavior).

Thanks!

Quiddity changed the subtype of this task from "Bug Report" to "Task".Mar 10 2023, 10:59 PM
Quiddity moved this task from To Triage to Not ready to announce on the User-notice board.
Jdlrobson updated the task description. (Show Details)

@Quiddity how about:
"Communities are recommended to make a Site Request to disable the unusual behaviour that makes Vector 2022 skin load Vector site and user styles to avoid unexpected disruption later in the year."
(feel free to tweak)

I've attempted to further-edit the task description so that it is a bit clearer, primarily by using 2 different example users, and formatting the page-names. Please check for accuracy @Jdlrobson

I'm still not sure of Tech News wording that is clear enough for both Interface Admins and all users who might need to start/participate in a discussion. Ideally, the wording used in Tech News (once translated by volunteers on meta), would be enough to copy&paste to start a local discussion.
Perhaps @Tacsipacsi and/or @Nux (as multilingual InterfaceAdmins who are already following the other task) could help advise on how to phrase the Tech News entry, and/or otherwise most efficiently communicate this?
The best I can think of currently is this, which is at the edge of being too long. (If it must get much longer then I'd recommend a mediawiki-wiki page):

"Currently, sites and users that use Vector-2022 will also load any JavaScript and CSS that is applied to Vector. At the end of 2023 this will change. You should migrate (or copy) any code from your Vector.js/.css into your Common.js/.css (or Vector-2022.js/.css) before then. This is also a good opportunity to encourage housekeeping - e.g. deletion of local js/css that is no longer used. Communities that wish to turn this off earlier than the end of the year can file a request.

(with a link pointing to this task?)

Re: Timing. If I understand correctly then this isn't urgent, so I will not attempt to push this into next week's Tech News.

I think using “Vector” and “Vector-2022” is confusing, making me wonder if “Vector-2022” is some part of “Vector”. While the technical skin names are vector and vector-2022 for legacy reasons, the UI names (e.g. in preferences) are “Vector legacy (2010)” and “Vector (2022)”, so you should use those both in the Tech News entry and the task description (or, if you want to keep it short, “Vector-2010” and “Vector-2022” may still be clear choices, but bare “Vector” is definitely not).


You should migrate (or copy) any code from your Vector.js/.css into your Common.js/.css (or Vector-2022.js/.css) before then.

Things shouldn’t be copied from Vector.css/js to Common.css/js, only moved. CSS just gets unnecessarily duplicated, but JS runs twice, which can cause more serious issues (e.g. adds things twice, or errors out because it tries to remove things that have already been removed). Copying to Vector-2022.css is, on the other hand, okay (and necessary if things should really only apply to the two Vector skins). Copying to Vector-2022.js may also be required, but one has to be extra careful to avoid running things twice that shouldn’t be run twice. I think this is complicated enough that it shouldn’t be in the Tech News entry, but in the task description. In the entry, I’d write something like

You should make sure until then that you don’t depend on this behavior.


can file a request.

I don’t think that link should point here. Instead, a usual [1] link at the end of the entry should point here, so that not only people come here who want to opt out now, but anyone interested in this change. “file a request” could either point to https://meta.wikimedia.org/wiki/Requesting_wiki_configuration_changes, or nowhere (no link).

Thanks for the recommendations, it is appreciated. With those tweaks, the Tech News entry could say something like this... - but I'd be happy to have anything better, suggested! I still feel like it is very unclear what specific immediate action is needed by individual editors and/or interface admins. It is also already pushing the length-limits.
I'll split each sentence into single-lines, for easier tweak/replacement-suggestions:

Currently, sites and users that use Vector-2022 will also load any JavaScript and CSS that is applied to Vector-2010, e.g. User:Example/vector.css.
At the end of 2023 this will change.
You should make sure before then that you don’t depend on this behavior.
This is also a good opportunity to encourage housekeeping, e.g. deletion of local js/css that is no longer used.
Communities that wish to turn this off earlier than the end of the year can file a request.
More details are available.

Also, still awaiting confirmation on (1) details in the edited Description, and (2) deadline/ideal-timing, from @Jdlrobson. Thanks!

This looks good on both fronts. The immediate(but optional) action is making the site request.

When will the switch be possible?

@Nux you can make the switch as soon as today if you are ready.

(A) I have made a significant overhaul of the Task Description, trying to clarify all the necessary details that may otherwise be confusing. The main content change to the earlier text is:

  1. a new "Background" (intro) section at the top
  2. a new "Before the switchover" section, specifying exactly what InterfaceAdmins and Users need to do before the switchover.

I *believe* I have the details correct, but would appreciate a close examination, and edits-if-needed, from @Jdlrobson and @Tacsipacsi (and perhaps @Izno ? Or anyone else who deeply understands this change and the likely points of confusion/uncertainty?)

(B) I'd also appreciate confirmation on the proposed Tech News entry text (above at T331679#8723157) or suggestions to improve it, from any of @Tacsipacsi, @Nux, or another multilingual tech ambassador/InterfaceAdmin. Then we can include it in a Tech News edition, once you think it is clear enough for technical editors in most communities.

Regarding the interface side, since we're talking to interface admins here, I would suggest

JavaScript: Migrate any content from MediaWiki:Vector.js into MediaWiki:Common.js (NOT duplicating it, because that can cause errors, unless you know what you are doing)

should be

JavaScript: Assess whether content in MediaWiki:Vector.js can be moved to Common.js or if it should be copied to Vector-2022.css and then move or copy it as appropriate.

(Which raises an interesting point regarding errors, but if a wiki intends down this path before the EOY timeline then they probably can do this quick enough relative to when the config option gets flipped that nothing should blow up from the error tracking side here?)

If they don't know where it should go they can ask someone who does (the stewards, most likely, but sometimes we'll see a few global editors show up on en.wp WP:VPT as an example). Alternatively, they could make subtasks of this ticket or similar asking for help to get ready, which should relieve work that might come at the end of the year. That's up to Reading or others to decide whether that's a good direction or not.

Regarding the user side

CSS: Copy or Migrate any necessary content from User:<username>/vector.css into User:<username>/vector-2022.css- OR - m:User:<username>/global.css
JavaScript: Migrate any content from User:<username>/vector.js into User:<username>/common.js - OR - m:User:<username>/global.js (NOT duplicating it, because that can cause errors, unless you know what you are doing)

I don't think this should be recommending anything to do with global.js as that can cause its own issues regarding duplication (unexpected loads on specific wikis where you have a doubled script loading). And not for CSS because the CSS in that page loads in all skins and thus may not be relevant for some skins. (What makes JS different is that it should generally load in all skins, even if it doesn't today....). There's also the point that global.css|js has a specific use case which is not arbitrary editors on arbitrary singular wikis but instead some much more limited subset of editors working on multiple wikis who have other parts of the chrome they want to optimize for themselves.

JavaScript: Migrate any content from MediaWiki:Vector.js into MediaWiki:Common.js (NOT duplicating it, because that can cause errors, unless you know what you are doing)
JavaScript: Assess whether content in MediaWiki:Vector.js can be moved to Common.js or if it should be copied to Vector-2022.css and then move or copy it as appropriate.

I think if they will be cleaning things it would probably be best to move stuff to default gadgets. Fortunately on Polish Wikipedia this was done over the years already so there is not much to do there. Gadgets have the ability to be loaded for specific skins so if they can work for both Vector and Vector 2022 it is easy to do. If they can work for more skins that is an easy change too. No code duplication needed and customizable and easier to update. Win, win, win 🙂

So maybe add a link to https://www.mediawiki.org/wiki/Extension:Gadgets#Options so they know what options are available (in case admins don't remember).

CSS: Copy or Migrate any necessary content from User:<username>/vector.css into User:<username>/vector-2022.css- OR - m:User:<username>/global.css
JavaScript: Migrate any content from User:<username>/vector.js into User:<username>/common.js - OR - m:User:<username>/global.js (NOT duplicating it, because that can cause errors, unless you know what you are doing)

As for this I already announced this will happen and suggested too many steps and options I think. There was one user that said he didn't understand, but he also said he didn't want to use the new vector so he didn't need to change anything 🙃.

Trying to simplify my suggestions maybe use this steps:

  1. Move universal styles from [[Special:MyPage/vector.css]] to [[Special:MyPage/common.css]].
  2. Copy non-universal styles from [[Special:MyPage/vector.css]] to [[Special:MyPage/vector-2022.css]].
  3. Move universal scripts from [[Special:MyPage/vector.js]] to [[Special:MyPage/common.js]].
  4. Copy non-universal scripts from [[Special:MyPage/vector.js]] to [[Special:MyPage/vector-2022.js]].

Ask for help of [[Special:ListUsers/interface-admin|interface administrators]] if you get stuck.

I'll let you know if those steps worked better once T332809 is done :-). I plan to use those steps in a message after the change.

This looks great all. Plus one to linking to T332809 when that's done - I'll backport that today.

As a follow up to pl.wikipedia switch:

  1. I announced the changes on the bulletin board with details in the village pump (we call it a bar/cafe, not a pump ;)).
  2. In the announcement, I clearly emphasized that the problem only affects people using the new Vector, so a fairly small number of people.
  3. Only one person reported not knowing what was going on (reported via Discord).

Surprisingly, I wasn't lynched 😉. So that went well.

It looks like this direction would resolve a long-standing platform and ecosystem incompatibility that Vector 22 introduced in terms of load order guruantee between Skin.js and Common.js, as previously raised in T305594: Vector 2022 skin should not load user's vector.js before site's MediaWiki:Common.js. Is that correct?

@Krinkle yes. T305594 should likely be stalled or declined in favor of T301212. Community response has been slow (only one made the switch so far) and T347871 has been requested to help with that.

Change 1003505 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[operations/mediawiki-config@master] New communities will not share scripts going forward

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

Change 1003505 merged by jenkins-bot:

[operations/mediawiki-config@master] New communities will not share scripts going forward

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

Mentioned in SAL (#wikimedia-operations) [2024-02-14T21:05:02Z] <cjming@deploy2002> Started scap: Backport for [[gerrit:1003505|New communities will not share scripts going forward (T331679)]]

Mentioned in SAL (#wikimedia-operations) [2024-02-14T21:08:00Z] <cjming@deploy2002> cjming and jdlrobson: Backport for [[gerrit:1003505|New communities will not share scripts going forward (T331679)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-02-14T21:28:14Z] <cjming@deploy2002> Started scap: Backport for [[gerrit:1003505|New communities will not share scripts going forward (T331679)]], [[gerrit:1003542|Register dblist]]

Mentioned in SAL (#wikimedia-operations) [2024-02-14T21:29:41Z] <cjming@deploy2002> cjming and jdlrobson: Backport for [[gerrit:1003505|New communities will not share scripts going forward (T331679)]], [[gerrit:1003542|Register dblist]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-02-14T21:38:21Z] <cjming@deploy2002> Finished scap: Backport for [[gerrit:1003505|New communities will not share scripts going forward (T331679)]], [[gerrit:1003542|Register dblist]] (duration: 10m 06s)

Jdlrobson renamed this task from Communities can disable sharing of site/user scripts between Vector and Vector 2022 skins to Disable sharing of site/user scripts between Vector and Vector 2022 skins.Mar 2 2024, 12:48 AM
Jdlrobson updated the task description. (Show Details)

Change 1007992 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[operations/mediawiki-config@master] Stop sharing vector and vector-2022 scripts on wikis where no users are impacted

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

Change 1007992 merged by jenkins-bot:

[operations/mediawiki-config@master] Stop sharing vector and vector-2022 scripts on wikis where no users are impacted

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

Mentioned in SAL (#wikimedia-operations) [2024-03-05T21:07:20Z] <urbanecm@deploy2002> Started scap: Backport for [[gerrit:1005161|Move account vanishing contact form to Meta wiki. (T343536)]], [[gerrit:1007992|Stop sharing vector and vector-2022 scripts on wikis where no users are impacted (T331679)]]

Mentioned in SAL (#wikimedia-operations) [2024-03-05T21:10:29Z] <urbanecm@deploy2002> jdlrobson and urbanecm and dbrant: Backport for [[gerrit:1005161|Move account vanishing contact form to Meta wiki. (T343536)]], [[gerrit:1007992|Stop sharing vector and vector-2022 scripts on wikis where no users are impacted (T331679)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-03-05T21:22:07Z] <urbanecm@deploy2002> Finished scap: Backport for [[gerrit:1005161|Move account vanishing contact form to Meta wiki. (T343536)]], [[gerrit:1007992|Stop sharing vector and vector-2022 scripts on wikis where no users are impacted (T331679)]] (duration: 14m 46s)

Only 3 projects are now remaining.

  • I will be disabling English Wikipedia, Meta Wiki and chinese Wikipedia per the plan in T301212 next week. The site scripts on these projects are prepped so the main impact will be on user scripts, but we have had very few reports of significant disruption (2 tech village pump discussions) that were easily rectified via the instructions in this task.
  • Once that's done the compatibility module will be removed in Vector skin: https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1031456?usp=search
  • This will result in user scripts loading after site scripts again (as a consequence of alphabetical ordering)
  • This will result in user scripts loading after site scripts again (as a consequence of alphabetical ordering)

Would this alphabetical ordering be sufficient to prevent similar breakage in the future?

Xaosflux renamed this task from Disable sharing of site/user scripts between Vector and Vector 2022 skins to Disable automatic sharing of site/user scripts between Vector and Vector 2022 skins.Thu, May 16, 4:48 PM

[…] This will result in user scripts loading after site scripts again (as a consequence of alphabetical ordering)

In the devtools, you'll find the "user" module actually loads in its own request (we give it its own "group"). As it does not share a web request with other modules, the sort order of query parameters of this request, does not affect it.

You might be thinking of stylesheets, where apart from guarantees between whole groups, styles within a group indeed only have their sort order to go on to ensure a deterministic outcome between pages and users.

The "user" module executes after the "site" module, because it is functional requirement (ref T305594#8045766). This is nowadays implemented in mediawiki.loader.js, and tested. This dependency became explicit when we designed RL. MediaWiki did the same thing before RL. The user style/script features were introduced to ease overriding of site-level things. Applying them in the opposite order, would make that more difficult.

(I realize T305594 is in the past now, but I wonder if skins.vector.user could have set dependencies=site?)

For scripts, rather than styles, the sort order of module names mostly does not affect execution order. Bundlers like ResourceLoader often sort payloads when combining them, to improve caching. Execution order is generally controlled by the dependency tree, not load order. This is great, because it means we can safely and quickly load all code in parallel. Bundlers wrap code in a closure, and can control when it executes by choosing when to call the closure. Hope that helps :)

Thanks for clarification. skins.vector.user will be removed as part of this ticket. I'll remove the -2 on https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1031456 in a few days time.

Change #1031456 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Vector and Vector 2022 no longer share site styles or scripts

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

Very little disruption being reported. Only conversation I am aware of relating to this is: https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#c-Izno-20240521170900-Izno-20240520220600 which was quickly resolved. I think we can push ahead with removal on Friday.