Page MenuHomePhabricator

DiscussionTools triggers unparsed title on en.wikisource
Closed, ResolvedPublic

Description

  1. Visit https://en.wikisource.org/wiki/User_talk:Billinghurst, observe title is correct, "User talk:Billinghurst - Wikisource, the free online library".
  2. Click "New topic", which triggers the new DiscussionTools powered new topic field
  3. Look at title, see it's unparsed wikitext. Specifically, {{#switch:{{SUBJECTSPACE}}|{{ns:author}}|{{ns:portal}}|{{ns:translation}}={{#titleparts:{{PAGENAME}}}}|$1}} - Wikisource, the free online library

At step 3 in my JavaScript console I see:

mediawiki.jqueryMsg: pagetitle: Parse error at position 0 in input: {{#switch:{{SUBJECTSPACE}}|{{ns:author}}|{{ns:portal}}|{{ns:translation}}={{#titleparts:{{PAGENAME}}}}|$1}} - Wikisource, the free online library

Caused by some local message override? Filing as a bug because I'm not sure what the expected behavior actually is.

Event Timeline

This wikitext comes from the local message override at https://en.wikisource.org/w/index.php?title=MediaWiki:Pagetitle&action=edit. This code removes the namespace prefix from the HTML titles of pages in the Author (diff), Portal (diff), and Translation (diff) namespaces and corresponding talk namespaces, apparently so it won't appear in search engine (Google) results pages. This may have been done in order to avoid having to set $wgRestrictDisplayTitle to false (the default is true).

In the case of DiscussionTools, the expected result would be something like "Starting new topic on User talk:Billinghurst - Wikisource, the free online library". The actual result is that the wikitext is left unparsed, because wikitext support in MediaWiki's JavaScript messages API is extremely limited.

It's perhaps worth mentioning that this local override does not work 100% correctly even on the PHP side. For example, the HTML title of https://en.wikisource.org/w/index.php?title=Author:John_Smith&action=edit is "John Smith - Wikisource, the free online library", rather than the expected "Editing John Smith - Wikisource, the free online library" or "Editing Author:John Smith - Wikisource, the free online library". Maybe there should be a better way?

This bug was exposed by T262066.

Well, no, this bug was introduced by T262066. If the Action API doesn't actually support what Discussion Tools is trying to do the approach is to work on getting the API extended, not to deploy something that is known broken. There is no way the communities can work around this short of disabling the Reply Tool.

Live preview (T41272) has been broken on enwikisource long before DiscussionTools came into existence, probably ever since the dynamic page title was introduced in 2012. So yes, the bug existed before, T262066 just exposed it more widely.

Live preview (T41272) has been broken on enwikisource long before DiscussionTools came into existence, probably ever since the dynamic page title was introduced in 2012. So yes, the bug existed before, T262066 just exposed it more widely.

Hmm. So far as I know the live preview in ProofreadPage was broken by the changes in T304303 (I used it just fine up that point), and I don't quite see how MediaWiki:Pagetitle would affect live preview. Live preview uses the Parse and Revisions API, not the Messages API whose limitations is the underlying reason why T262066 is broken.

But if your point is that the WMF for a decade plus has neglected to allocate any developer resources to the ~73 sisters in the Wikisource project, and consequently their teams feel free to break stuff for us and never fix it, then, yes, I agree. The WMFs custodianship of Wikisource at some point there stopped feeling like benign neglect and started feeling like active hostility.

Live preview (T41272) has been broken on enwikisource long before DiscussionTools came into existence, probably ever since the dynamic page title was introduced in 2012. So yes, the bug existed before, T262066 just exposed it more widely.

Hmm. So far as I know the live preview in ProofreadPage was broken by the changes in T304303 (I used it just fine up that point), and I don't quite see how MediaWiki:Pagetitle would affect live preview.

In order to update the HTML <title> to use the eventual display title (lowercased first letter, underscores instead of spaces etc.). However, when I tried to reproduce it now, it turns out it no longer does so – the HTML <title> is no longer updated…

But if your point is that the WMF for a decade plus has neglected to allocate any developer resources

Has anyone asked WMF before to make this scenario supported? Or was it anywhere explicitly stated that it’s supported? MediaWiki messages have varying levels of wikitext support, so you should not take full wikitext support for granted and blame WMF if you’re wrong.

to the ~73 sisters in the Wikisource project

Please note that out of the nearly thousand public WMF wikis, only four use parser functions in their override of pagetitle; out of the 73 Wikisource wikis, only three:

Has anyone asked WMF before to make this scenario supported? Or was it anywhere explicitly stated that it’s supported? MediaWiki messages have varying levels of wikitext support, so you should not take full wikitext support for granted and blame WMF if you’re wrong.

I'm sorry, but full wikitext in MediaWiki:Pagetitle is self-evidently supported (it works fine everywhere but in the Reply tool, and has done so for a decade). Wikitext is also documented to work here with no mention of limitations on what kinds of wikitext (e.g. ParserFunctions).

What has limitations is the Messages API, and those limitations are clearly documented. Which means that when Reply tool based its implementation of T262066 on it, either that was done knowing full well it would break on some projects (without communicating that to those projects) or it was done without checking whether it would break on those projects.

In either case the bug is in the current implementation of the Reply tool. Implying that there's some mythical limitation on wikitext in MediaWiki:Pagetitle that the community has somehow magically abused a loophole in—and hence the community is to blame for the Reply tool not working a decade later—is not very persuasive.

If Live Preview at some point had the same problem then that's just another independent implementation of the same class of bug.

Please note that out of the nearly thousand public WMF wikis, only four use parser functions in their override of pagetitle;

What's your point? That it's ok to break these?

enWS and frWS are the two biggest Wikisourcen, and it's likely bnWS shows up here because it copied its MediaWiki:Pagetitle from enWS (much like smaller Wikipedias copy their various stuff from enWP). Not testing on these wikis is about as defensible as not testing on enWP.

Wikitext is also documented to work here with no mention of limitations on what kinds of wikitext (e.g. ParserFunctions).

Where is wikitext documented to work in pagetitle? If there is such official documentation, then yes, of course unqualified “wikitext works” includes support for parser functions. Please point to that documentation, because I couldn’t find it (the message documentation says nothing about wikitext support).

to the ~73 sisters in the Wikisource project

Please note that out of the nearly thousand public WMF wikis, only four use parser functions in their override of pagetitle;

What's your point? That it's ok to break these?

The point is that you wrote “the ~73 sisters in the Wikisource project”, implying that failure to support advanced wikitext in pagetitle is failure to support the 73 Wikisources. In fact, however, only three Wikisources are broken.

enWS and frWS are the two biggest Wikisourcen

It depends: considering the number of pages across namespaces, they are, but considering the number of content pages, they’re only #2 and #5.

Not testing on these wikis is about as defensible as not testing on enWP.

I understand you’re upset, but let’s be realistic: English Wikipedia has more than six times as many content pages, over 300 times as many active editors etc. as English Wikisource. There are several bigger projects than English Wikisource, both English-language (it’s the fifth out of five considering active users and third considering content pages) and international (see statistics), there is even a bigger Wikisource. Without a clear indication of why enwikisource should be tested (I don’t see any), testing all wikis larger than or about the size of enwikisource would have been a waste of human resources.

I understand you’re upset

Hoo-kay. I see we've exhausted the potential for constructive conversation here.

Change 925055 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] mediawiki.jqueryMsg: Add isParseable()

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

Change 925056 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Don't try to prefix browser title if a custom message is incompatible

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

Change 925058 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Don't try to prefix browser title if a custom message is incompatible

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

Change 925055 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.jqueryMsg: Add isParseable()

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

Change 925056 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Don't try to prefix browser title if a custom message is incompatible

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

Change 925058 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Don't try to prefix browser title if a custom message is incompatible

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