Parsing/Visual Diff Testing/Debugging

Some notes on debugging failures found using visual diff testing.

First: some failures may be transient. Use Parsing/Visual Diff Testing#Retesting a subset of titles to rerun the tests with a non-perfect visual diff to filter out transients. There may also be some cache issues, perhaps: check that the "Page on the target wikis" link actually shows the same result as the screenshots. If it doesn't, the screenshot may have been a transient or improperly cached result.

Second: the visual diff servers are multiwiki configs. You need to ssh into them, then ssh into the inner vagrant, *then* use mwscript to select a particular wiki:

$ ssh mw-expt.wikitextexp.eqiad.wmflab  # or mw-base.wikitextexp.eqiad.wmflabs, or mw-base.eqiad.wmflabs
mw-expt$ cd /srv/mediawiki-vagrant/  # code in mediawiki/ and config in settings.d/
mw-expt$ vagrant ssh
vagrant$ echo '[[Foo]]' | mwscript parse.php --wiki=zhwiki

You can also use mwscript eval.php --wiki=zhwiki to get an REPL with MW loaded.

emacs isn't installed inside vagrant. But chmod a+rw <some file>.php inside vagrant lets you edit it with emacs outside of vagrant.

Other notes: {{#coordinates}} is unexpanded, because Extension:GeoData is uninstalled

I got a step-by-step dump of templates as they were expanded with this patch, which just basically lets me watch the preprocessor expansion step by step, so i can see at what point weird stuff is introduced:

vagrant@mediawiki-vagrant:/vagrant/mediawiki$ git diff
diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor
index 7539307..568198b 100644
--- a/includes/parser/Preprocessor_DOM.php
+++ b/includes/parser/Preprocessor_DOM.php
@@ -194,6 +194,9 @@ class Preprocessor_DOM extends Preprocessor {
         */
        public function preprocessToXml( $text, $flags = 0 ) {
                global $wgDisableLangConversion;
+echo("\npreprocess start------\n");
+echo($text);
+echo("\npreprocess end------\n");
 
                $forInclusion = $flags & Parser::PTD_FOR_INCLUSION;