Page MenuHomePhabricator

Implement Gadgets 2.0
Open, MediumPublic

Assigned To
None
Authored By
Krinkle
Jun 4 2011, 5:22 PM
Referenced Files
None
Tokens
"Stroopwafel" token, awarded by Bugreporter2."Love" token, awarded by Sunpriat2."Orange Medal" token, awarded by Krinkle."Heartbreak" token, awarded by He7d3r."Love" token, awarded by Liuxinyu970226."Mountain of Wealth" token, awarded by RandomDSdevel."Love" token, awarded by Qgil."Love" token, awarded by Luke081515."Love" token, awarded by Ricordisamoa.

Related Objects

StatusSubtypeAssignedTask
InvalidNone
OpenNone
OpenNone
ResolvedKrinkle
DeclinedNone
Resolvedkaldari
Resolvedkaldari
ResolvedKrinkle
OpenNone
ResolvedKrinkle
ResolvedKrinkle
ResolvedKrinkle
ResolvedKrinkle
ResolvedKrinkle
DeclinedLegoktm
ResolvedLegoktm
DeclinedLegoktm
ResolvedLegoktm
ResolvedKrenair
ResolvedNone
ResolvedLegoktm
ResolvedLegoktm
ResolvedKrenair
ResolvedLegoktm
Resolvedkaldari
ResolvedKrinkle
Resolved Fhocutt
Resolvedkaldari
Resolvedkaldari
OpenNone
ResolvedNone
ResolvedNone
ResolvedNone
InvalidNone
OpenNone
ResolvedSD0001

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

What's the current situation here? Is this task stalled? I can neither see any major contributions done to this (nearly done?) project in more then a year nor any major blockers.

Had been hoping to put "Work on Gadgets 2.0" on the wishlist this year, but they are excluding "Global" work, following up on @MGChecker's note from last year - has this been abandoned?

In a conversation last year on wmtech IRC I got an answer, that WMF pulled devs out of this task to do more important stuff. This task therefore have got no devs and money attached from a Foundation and it is not going to be fixed in a near future.

Just for the sake of not loosing the information: I noted that there seems to be something like a standard pattern of how other web-tech-based projects deal with this, namely the pattern of:

  • Front-End-Side APIs to create UI
  • message passing between components
  • declaration of needed access rights and capabilities

These patterns can be found in

https://www.figma.com/plugin-docs/intro/
https://wiki.mozilla.org/WebExtensions
https://dev.jamovi.org/index.html

It might be helpful to look into these things. Particularly the way figma approached the security problems of sharing client-side run code is interesting; they published some blogposts about it.

There might also be a good connect to recent ideas to use react/MVVM that make hook into DOM hard (not that it is a sustainable idea in the first place…)

Is this task (which has 3 or 4 open subtasks) superseded by Gadgets-2.0 nowadays (which currently has 11 open tasks), or what is its exact difference (as it says "implement" and not "deploy")?

Change 981674 had a related patch set uploaded (by Krinkle; author: SD0001):

[mediawiki/extensions/Gadgets@master] Remove redundant data updates for NamespaceRepo

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

Change 981674 merged by jenkins-bot:

[mediawiki/extensions/Gadgets@master] Remove redundant data updates for GadgetDefinitionNamespaceRepo

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

Hello! I see that work on gadgets is being done a little more actively than before. And I see that almost all the tasks in this epic are closed. Should we expect gadgets 2.0 soon? And if not, is there any active roadmap? :)

Changed 980519 is merged:

[mediawiki/extensions/Gadgets@master] Goodbye Gadget/Gadget_definition namespaces!

What:

  • Remove unused Gadget and Gadget_definition namespaces.
  • Remove unused "gadgets-definition-edit" user right.
  • Remove unused namespace permissions for NS_GADGET.

Why: […]

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Gadgets/+/980519/

Proposed text for Tech-News:

Gadgets allow interface admins to create custom features with CSS and JavaScript. In 2015, the Gadget and Gadget_definition namespaces and gadgets-definition-edit user right were reserved for an experiment, but never used. These were visible on Special:Search and Special:ListGroupRights. The unused namespaces and user rights are now removed. No pages are moved, and no changes need to be made. (T31272)

Longer explanation:

The Gadgets extension allows admins to define gadgets via a configuration page in the "MediaWiki" namespace, as well as store CSS and JavaScript for these gadgets as wiki pages in that same namespace. For security reasons, the "MediaWiki" namespace is restricted such that only elected admins can create and edit pages there. This is how the Gadgets extension has worked since its inception, originally created in 2006 by Daniel Kinzler.

In 2011, @Krinkle and @Catrope proposed the "Gadgets 2.0" initiative to improve the UX and editing experience for managing gadget definitions (details at mw:Extension:Gadgets/Gadgets_2.0). We implemented a GUI for gadget mgmt, a rewritten backend for gadgets that would use JSON instead of the novel syntax we have today, and redefined access control.

The project was green-lit in 2012, and we began to experiment with different ideas, I suggested we move gadget definitons to a dedicated namespace, protected with separate user rights. I proposed this because, at the time, the user right that protected the "MediaWiki" namespace (editinterface) and the Administrator user group (sysop) were predominantly granted to volunteers for the purpose of content moderation (i.e. protecting/deleting pages, and blocking users). Understanding sofware security isn't part of the assessment communities make. Placing this behind a separate user right would improve security and separate the concerns (in both directions; both to not require giving content moderation to gadget devs, and to not require giving security access to moderators). At the time, it seemed most robust to implement this by having the pages in a separate namespace.

By the end of 2012, resourcing was cut. The code remains in the experimental "RL2" branch in Git, separate from the main Gadgets codebase.

Meanwhile, MediaWiki core gained native support for content models in 2013, including a built-in model for JSON pages.

In 2015, Kunal (@Legoktm) dusted off the Gadgets 2.0 experiment as volunteer, and added some of it to the master branch. Kunal simplified the code a lot by embracing the native JSON support in MediaWiki core. However, it did keep the new namespaces and user right. The feature remained disabled by default, via a configuration flag, however, it did unconditionally reserve the new namespaces and user right, thus exposing them all Wikimedia wikis (e.g. on Special:Search) as empty and non-editable namespaces.

Meanwhile, following a MediaWiki core decision in 2018 (T190015), access controls were refined in MediaWiki core to split off new editsitecss, editsitejs, and editsiteconfig from the old editinterface, along with a new "Interface admin" user group (https://meta.wikimedia.org/wiki/Creation_of_separate_user_group_for_editing_sitewide_CSS/JS).

As of 2024, the Gadgets 2.0 implementation is internally known as MediaWikiGadgetsJsonRepo, and remains incomplete and disabled by default via a configuration variable. Last week, I updated this code and simplified it further to embrace the above developments. In particular:

  • Remove reservation of the Gadget and Gadget_definition namespaces. These have been clobbering the user interface in various places since 2015 (e.g. Special:Search, and dropdown menus on Special:Contributions, Special:MovePage, etc.).
  • Remove reservation of the gadgets-definition-edit user right.

The MediaWikiGadgetsJsonRepo feature, if completed, would now store its JSON pages under MediaWiki:Gadgets/<id>.json instead of Gadget_definition:<id>. This is in line with present-day expectations and matches how extensions like AbuseFilter, SpamBlacklist, VisualEditor and Citoid store their editable configuration pages.

Changed 980519 is merged:

[mediawiki/extensions/Gadgets@master] Goodbye Gadget/Gadget_definition namespaces!

What:

  • Remove unused Gadget and Gadget_definition namespaces.
  • Remove unused "gadgets-definition-edit" user right.
  • Remove unused namespace permissions for NS_GADGET.

Why: […]

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Gadgets/+/980519/

Note: If there are pages in Gadget namespace, they will become inaccessable and should be moved to a valid title starting with Gadget: once the namespace is gone.

There are, at least on enwiki (and probably only enwiki). The most correct outcome for them is to fall out of the gadget namespace into the main namespace with "Gadget: Foo" titles, since they were never meant to be in gadget namespace in the first place, but I am willing to clean up locally as long as they don't fall into the void.

In particular, https://en.wikipedia.org/wiki/Gadget_talk:Invention,_Travel,_%26_Adventure contains significant content which as much as I'd like to have it vanish into the void and forget about this whole episode <mostly sarcastic>, really should be moved to another namespace rather than deleted. I guess I could manually empty the namespace before the new version is deployed, though.

Pages that need migration:

krinkle@mwmaint1002
$ foreachwiki sql.php --json --query 'SELECT page_namespace,page_title FROM page WHERE page_namespace IN (2300,2301,2302,2303) ORDER BY page_title ASC;' | tee gadget_ns.txt
…
$ cat gadget_ns.txt | grep -vE '\[\]|---|^[a-z0-9_]+wik[a-z]+$' > gadget_ns.grep.txt
…

Results from public wikis:

1arwiki: [
2arwiki: {
3arwiki: "page_namespace": "2301",
4arwiki: "page_title": "Dr_Amany_Awad\/\u0645\u0644\u0639\u062814"
5arwiki: }
6arwiki: ]
7elwiki: [
8elwiki: {
9elwiki: "page_namespace": "2303",
10elwiki: "page_title": "ManosHacker\/\u03c0\u03c1\u03cc\u03c7\u03b5\u03b9\u03c1\u03bf\/\u0396\u03cd\u03bc\u03b7"
11elwiki: }
12elwiki: ]
13enwiki: [
14enwiki: {
15enwiki: "page_namespace": "2300",
16enwiki: "page_title": "Invention,_Travel,_&_Adventure"
17enwiki: },
18enwiki: {
19enwiki: "page_namespace": "2301",
20enwiki: "page_title": "Invention,_Travel,_&_Adventure"
21enwiki: },
22enwiki: {
23enwiki: "page_namespace": "2300",
24enwiki: "page_title": "Invention,_Travel,_and_Adventure"
25enwiki: },
26enwiki: {
27enwiki: "page_namespace": "2301",
28enwiki: "page_title": "Invention,_Travel,_and_Adventure"
29enwiki: },
30enwiki: {
31enwiki: "page_namespace": "2300",
32enwiki: "page_title": "Past_as_Future"
33enwiki: },
34enwiki: {
35enwiki: "page_namespace": "2301",
36enwiki: "page_title": "Past_as_Future"
37enwiki: }
38enwiki: ]
39idwiki: [
40idwiki: {
41idwiki: "page_namespace": "2301",
42idwiki: "page_title": "Ade_Kurniawan_(pengisi_suara)"
43idwiki: }
44idwiki: ]
45mgwiki: [
46mgwiki: {
47mgwiki: "page_namespace": "2301",
48mgwiki: "page_title": "Sima"
49mgwiki: },
50mgwiki: {
51mgwiki: "page_namespace": "2301",
52mgwiki: "page_title": "Sonia_Nemati_Serin_Torke_Khar_Azeri_Olagh_Urmu_tabriz"
53mgwiki: },
54mgwiki: {
55mgwiki: "page_namespace": "2301",
56mgwiki: "page_title": "Sonia_s"
57mgwiki: }
58mgwiki: ]
59mswiki: [
60mswiki: {
61mswiki: "page_namespace": "2303",
62mswiki: "page_title": "Kota_Samarahan"
63mswiki: },
64mswiki: {
65mswiki: "page_namespace": "2301",
66mswiki: "page_title": "Nightline"
67mswiki: }
68mswiki: ]
69ruwiktionary: [
70ruwiktionary: {
71ruwiktionary: "page_namespace": "2303",
72ruwiktionary: "page_title": "\u0417\u0430\u0447\u0435\u043c"
73ruwiktionary: },
74ruwiktionary: {
75ruwiktionary: "page_namespace": "2301",
76ruwiktionary: "page_title": "\u0437\u0430\u0447\u0435\u043c"
77ruwiktionary: }
78ruwiktionary: ]

Reminder to myself to never underestimate the creativity of vandals. All of the non-enwiki pages were vandalism/nonsense of some sort which I've tagged for deletion.

One question arrived now: Is editing of any MediaWiki:Gadgets/ page requiring successor of previous editinterface or gadgets-definition-edit right?

If gadgets-definition is given to all sysops by MediaWiki:Gadgets/<id>.json this will change access to gadget management, may be wanted or unwanted:

  • Small wikis without IF-admin could manage offered gadgets and circumstances themselve.
  • Severe security influence is not expected by gadgets-definition.
  • However, gadgets-definition does need an advanced understanding of effects. By bad default too many resources may be loading, or the list of required .js and .css pages is too long or short, and together with hidden a desaster could be covered.

What is the future extent of editsiteconfig?

BTW, there is a typo sofware in the press release, and mgmt should not get broadcasted.

Small wikis without IF-admin could manage offered gadgets and circumstances themselve.

Such issue should be solved by global gadgets.

However, gadgets-definition does need an advanced understanding of effects. By bad default too many resources may be loading, or the list of required .js and .css pages is too long or short, and together with hidden a desaster could be covered.

Once T323811 is a thing, we would have a interface to configure gadgets (so we no longer need to edit the definition manually), and we may include good practice there.

Small wikis without IF-admin could manage offered gadgets and circumstances themselve.

Such issue should be solved by global gadgets.

A global gadget solving issues specific to issues with Brobdingnag language for Brobdingnag Wikipedia is not a valid case for a global gadget.

No, global gadgets are not a solution for everything, and even if some global gadgets are offered the configuration as desired by local community is on decision of the local community, not the decision of a global WMF government deciding for 950 wikis what is good and useful for everybody.

One question arrived now: Is editing of any MediaWiki:Gadgets/ page requiring successor of previous editinterface or gadgets-definition-edit right?

If gadgets-definition is given to all sysops by MediaWiki:Gadgets/<id>.json this will change access to gadget management, […]

Today, MediaWiki:Gadgets-definition is declared as a "Raw HTML message", which is how we restrict non-JS pages to require the editsitejs right, which is generally given to the "Interface admin" user group and not "Administrators" (sysop).

The MediaWikiGadgetsJsonRepo experiment, in its current draft, requires the same editsitejs right for editing MediaWiki:Gadgets/<id>.json pages.

Please note that at the moment these page titles are not anything. Not today, this week, nor next week. I was describing a change within an experimental feature that is currently incomplete, disabled by default, and plays no role in this weeks train deployment.

Pages that need migration:

[…] Results from public wikis: P58013

Reminder to myself to never underestimate the creativity of vandals. All of the non-enwiki pages were vandalism/nonsense of some sort which I've tagged for deletion.

Thanks. I've forked paste P58013 and update it. Diff at https://phabricator.wikimedia.org/transactions/detail/PHID-XACT-PSTE-r2k7e22q3mrfvvk/

1elwiki: [
2elwiki: {
3elwiki: "page_namespace": "2303",
4elwiki: "page_title": "ManosHacker\/\u03c0\u03c1\u03cc\u03c7\u03b5\u03b9\u03c1\u03bf\/\u0396\u03cd\u03bc\u03b7",
5elwiki: "page_id": "504766"
6elwiki: }
7elwiki: ]
8enwiki: [
9enwiki: {
10enwiki: "page_namespace": "2300",
11enwiki: "page_title": "Invention,_Travel,_&_Adventure",
12enwiki: "page_id": "47552662"
13enwiki: },
14enwiki: {
15enwiki: "page_namespace": "2301",
16enwiki: "page_title": "Invention,_Travel,_&_Adventure",
17enwiki: "page_id": "55171054"
18enwiki: },
19enwiki: {
20enwiki: "page_namespace": "2300",
21enwiki: "page_title": "Invention,_Travel,_and_Adventure",
22enwiki: "page_id": "75565945"
23enwiki: },
24enwiki: {
25enwiki: "page_namespace": "2301",
26enwiki: "page_title": "Invention,_Travel,_and_Adventure",
27enwiki: "page_id": "76155900"
28enwiki: },
29enwiki: {
30enwiki: "page_namespace": "2300",
31enwiki: "page_title": "Past_as_Future",
32enwiki: "page_id": "75565925"
33enwiki: },
34enwiki: {
35enwiki: "page_namespace": "2301",
36enwiki: "page_title": "Past_as_Future",
37enwiki: "page_id": "75740635"
38enwiki: }
39enwiki: ]
40mswiki: [
41mswiki: {
42mswiki: "page_namespace": "2303",
43mswiki: "page_title": "Kota_Samarahan",
44mswiki: "page_id": "1157142"
45mswiki: },
46mswiki: {
47mswiki: "page_namespace": "2301",
48mswiki: "page_title": "Nightline",
49mswiki: "page_id": "1140214"
50mswiki: }
51mswiki: ]
52ruwiktionary: [
53ruwiktionary: {
54ruwiktionary: "page_namespace": "2303",
55ruwiktionary: "page_title": "\u0417\u0430\u0447\u0435\u043c",
56ruwiktionary: "page_id": "2469241"
57ruwiktionary: },
58ruwiktionary: {
59ruwiktionary: "page_namespace": "2301",
60ruwiktionary: "page_title": "\u0437\u0430\u0447\u0435\u043c",
61ruwiktionary: "page_id": "2469240"
62ruwiktionary: }
63ruwiktionary: ]

Affected pages on Wikipedias where the change is not yet deplyoyed. These could be moved (without redirect please) to e.g. under a Broken/ prefix in the main namespace. After tomorrow, admins can then easily delete them, or rename them "back" without that prefix to keep.

Affected pages on wikis where the change is already deployed. of links and their currently localised name names:

The latter ones are inaccessible except via index.php?curid=PAGEID. Regular links to them no longer work, for example, the last one in the list is nominated for deletion and thus member of https://ru.wiktionary.org/wiki/Category:Викисловарь:К_быстрому_и_безусловному_удалению, but there the entry links to Special:Badtitle/NS2301:зачем as fallback, because the namespace is no longer recognised for linking.

I've looked for a maintenance script to rename pages automatically (either shortly before, or after) deleting a namespace. maintenance/namespaceDupes.php comes to mind, and actually describes itself as "articles to fix after adding/deleting namespaces". But, it appears only the first part of that sentence was ever implemented. The script only sources pages from NS_MAIN, so that by definition will not match pages in a deleted namespace. Anyway, I guess the list is small enough I can fix these by hand.

Mentioned in SAL (#wikimedia-operations) [2024-02-29T01:49:51Z] <Krinkle> ruwiktionary UPDATE page SET page_namespace=1,page_title=CONCAT('Broken/NS2301:',page_title) WHERE page_id=2469240 AND page_namespace=2301 T31272

Mentioned in SAL (#wikimedia-operations) [2024-02-29T01:50:43Z] <Krinkle> ruwiktionary UPDATE page SET page_namespace=1,page_title=CONCAT('Broken/NS2303:',page_title) WHERE page_id=2469241 AND page_namespace=2303; T31272

I have cleaned up on enwiki, deleting one page and its talk outright (since I was the only author, and yes I know it will be unrecoverable even by admins once the namespace vanishes) and moving the other two to other namespaces.

I don't have rights to move without leaving a redirect anywhere else.

Sorry, I wanted to point out that no changes need to be made is problematic. Lua api mw.title:inNamespace would detect the existence of the incoming namespace and throw an error. Abruptly removing the namespace obviously destroys some modules. e.g. Module:PJBSClass#rev80701284@zhwiki

FYI: We noticed a small bug in the pt.wiki MediaWiki:Deletereason-dropdown as {{ns:2300}}/{{ns:2301}}/{{ns:2302}}/{{ns:2303}} was no longer valid. It may be worth doing a scan to identify whether those is still used in other wikis.

Change #1014636 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/Gadgets@master] Replace EditFilterMergedContent hook with ContentHandler override

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

Hello! Question/Idea: Can we use the GrowthExperiments-CommunityConfiguration "framework" for gadgets?

Hello! Question/Idea: Can we use the GrowthExperiments-CommunityConfiguration "framework" for gadgets?

We need to first productionize it. Community configuration has multiple potential usages (described in T323811), but there are little we can do before that task is resolved.

Hello! Question/Idea: Can we use the GrowthExperiments-CommunityConfiguration "framework" for gadgets?

We need to first productionize it. Community configuration has multiple potential usages (described in T323811), but there are little we can do before that task is resolved.

Yes, I agree with you, but you can try to create a roadmap :)