ResourceLoader/Version 2 Design Specification/Testing

ResourceLoader 2 (RL2) is a project run by Roan Kattouw and Timo Tijhof that involves a rewrite of the Gadgets extension to add support for sharing Gadgets across wikis. This page explains very briefly what RL2 encompasses, and how to test it in our testing environment.

Any questions, suggestions, complaints, bugs, feedback, etc. about this page, the testing environment, the imported Gadgets, or anything vaguely related to RL2, should be left on the talk page.

NOTE: RL2 is still in development, so not everything is perfect, but we wanted to get it out there for testing as soon as the core features were working reasonably well. Some things may be ugly, ill-conceived, not thought through very well, or just plain broken; if you notice any of these things, please let us know after checking the list of known issues.

RL2 in a nutshell

 * RL2 enables sharing Gadgets across wikis, localizing them, and loading them through ResourceLoader
 * Support for non-ResourceLoader-compatible Gadgets will be dropped
 * A repository wiki is a wiki that contains Gadgets that can be used by other wikis, much like Commons contains files that are used on other wikis
 * A client wiki can pull Gadgets from a repository wiki through either the database (DB; only available within wiki farms) or the API (always available).
 * RL2 also allows Gadgets to use MediaWiki's i18n system
 * Gadget definitions are no longer maintained on the MediaWiki:Gadgets-definition page in a crazy wikitext format. Instead, each Gadget has its own definition page called Gadget definition:Gadgetname.js, with the gadget definition in JSON. There is a gadget manager which provides a nice interface for editing these definitions
 * Gadget code now lives in the Gadget: namespace instead of the MediaWiki: namespace
 * Access restrictions for the MediaWiki: namespace, Gadget: namespace and Gadget definition: namespace are separate

How RL2 would be set up at WMF

 * One central wiki (mediawiki.org?) would be set up as a repository
 * Most Gadgets would live on the central wiki (just like most files are on Commons)
 * All other wikis would be configured to pull from this central wiki through the DB
 * 3rd party wikis can be configured to pull from this central wiki through the API (just like InstantCommons for files)

Testing tasks
After testing something, please share your findings, even if they're positive (e.g. I had no problems when I tried XYZ), on the talk page. Please look at the list of known issues before reporting a problem.
 * Import popular Gadgets to the repository wiki (rl2-repo1)
 * Test whether the imported Gadgets work with RL and RL2
 * Fix broken Gadgets
 * Test whether loading a Gadget from another wiki works
 * Test the Gadget manager
 * Test the separation of rights and the enforcement of these restrictions (proper error messages)
 * Test what happens when multiple wikis have a Gadget with the same name

Prototype wikis
The following prototype wikis are currently set up for testing:
 * rl2-repo1
 * Main repository wiki testing the typical WMF use case (mostly), used to test existing Gadgets for RL and RL2 compatibility
 * Allows sharing: yes
 * Pulls from: rl2-repo2 using API (yes, this is weird, but we figured testing what would happen if two repositories pull from each other in a loop would be a good idea)
 * rl2-repo2
 * Secondary repository wiki, used to test multi-repository set-ups
 * Allows sharing: yes
 * Pulls from: rl2-repo1 using DB (yes, this is weird, see comment at rl2-repo1)
 * rl2-client1
 * Client wiki testing the typical WMF use case (mostly)
 * Allows sharing: no
 * Pulls from: rl2-repo1 using DB, rl2-repo2 using API
 * rl2-client2
 * Client wiki testing the typical 3rd party wiki pulling from a WMF wiki
 * Allows sharing: no
 * Pulls from: rl2-repo1 using API, rl2-client1 using API (this won't actually work; testing that trying to pull from a non-repository wiki will fail gracefully)

These wikis share their user table, so if you create an account on one wiki it will automatically exist on all of them. However, preferences and user rights are NOT shared.

Enabling Gadgets from another wiki

 * Log in and go to your preferences
 * Gadgets that exist on the local wiki will be shown in the "Gadgets" tab
 * Gadgets that come from other wikis will be shown in the "Shared gadgets" tab, and will be listed by wiki of origin

Gadget manager

 * Go to Special:Gadgets
 * This will list all Gadgets that exist locally on that wiki (i.e. Gadgets that come from another wiki are NOT listed!)
 * Features
 * The edit link next to the name of each category, the name of each Gadget, and the description of each Gadget takes you to an edit form for a MediaWiki: page where you can edit these things
 * The Permalink leads to a page where only one Gadget is shown
 * The Export link allows you to download an XML file containing all pages relevant to the Gadget, which can then be imported on another wiki
 * The Modify gadget link takes you to the edit form for the Gadget definition: page for this Gadget, where you can edit the JSON directly
 * The Delete gadget link allows you to delete the Gadget. Only the Gadget definition: page will be deleted
 * Clicking anywhere else in the box containing the Gadget name and all of these links will open a popup which allows you to edit the gadget definition visually
 * NOTE: Some of these things may not appear if you don't have the right to use them

Separation of rights
On the prototype wikis, there are four new groups. Each of these groups corresponds to a new right introduced by RL2. On a production setup, there probably wouldn't be a separate group for each right, but we want to be able to test each right separately. Any logged-in user can add themselves to these groups using Special:Userrights.
 * Users in the gadgetauthor group can edit pages in the Gadget: namespace
 * Users in the gadgetcreator group can create pages in the Gadget definition: namespace
 * Users in the gadgetmanager group can edit pages in the Gadget definition: namespace (either directly or through the gadget manager)
 * Users in the gadgetdeleter group can delete pages in the Gadget definition: namespace

Known issues

 * We are not at all sure yet whether the separation between the two tabs, or listing the remote gadgets by wiki of origin, is a good idea. Timo is working on a redesign of the preferences interface
 * Clicking any Gadget on Special:Gadgets will always open the definition editor popup for the same Gadget, regardless of which Gadget was clicked. This can be worked around by clicking "Permalink" before editing a definition
 * Special:Gadgets has no facility for creating new Gadgets
 * The definition editor on Special:Gadgets has no facility for creating new categories
 * Importing Gadgets from a wiki is not automated. It will be once a migration script has been written that migrates old-style Gadgets on a wiki to the new style