Page MenuHomePhabricator

Provide a way to run undeployed VE code against live mediawiki instances
Open, Needs TriagePublic

Description

Normally we develop and test new code against test instances of mediawiki (on the dev's local machine, patch demo etc).

This has several drawbacks, e.g.:

  1. The test instances are often quite unlike live ones in terms of content, extensions, accounts etc.
  2. We can copy data, config etc, but sometimes this can be laborious and/or require large amounts of storage.
  3. Sometimes we'd want to test against the data from many different instances (e.g. for language-related issues).

Sometimes it would be helpful to run and test new code on a live mediawiki instance without deploying the code there. That is, to be able to point your web browser at the live mediawiki instance, but then pull in some new code from elsewhere. Note that the live mediawiki instance would remain 100% unchanged — the changed code is something you'd only have in your local browser.

One solution is a bookmarklet that hooks into ResourceLoader and changes the sources of particular modules, *before* they get loaded. This would be tricky if the modules were loaded on page load; but happily they are not. The (visual) edit button on a page calls mw.libs.ve.activateVe() which then loads the modules. So there's a natural opportunity to click a bookmarklet instead of clicking edit.

Event Timeline

Change 811141 had a related patch set uploaded (by Divec; author: Divec):

[mediawiki/extensions/VisualEditor@master] DONTMERGE: bookmark to facilitate running code against remote instances.

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

The video below shows the bookmarklet used to run undeployed code against a live mediawiki instance:

  • The user browses to a page in English Wikipedia
  • The bookmarklet lets the user load VE modules from the local dev machine
  • The dotted red outline is implemented in local code (not code actually deployed on live English Wikipedia), thus showing local code is running.
  • There is full access to all the templates and extensions on English Wikipedia (e.g. the WikiHiero extension is working).