Page MenuHomePhabricator

LiquidThreads API namespaces don't include canonical key (breaking API change)
Closed, ResolvedPublic

Description

[09:37] <werdna> So I added localisation to LiquidThreads namespaces
[09:37] <werdna> for some reason this added them to all wikis
[09:37] <werdna> which is hugely annoying
[09:38] <werdna> some feature of the localisation cache

Now http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces&format=jsonfm isn't outputting "canonical" values for the new namespaces. E.g.,

			"90": {
				"id": 90,
				"case": "first-letter",
				"*": "Thread"
			},

This breaks expected behavior for some scripts like Python wikitools, which contain code like:

			if ns != "0":
				attr = "NS_%s" % (nsdata[ns]['canonical'].replace(' ', '_').upper())
			else:
				attr = "NS_MAIN"

Version: unspecified
Severity: major

Details

Reference
bz24837

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:00 PM
bzimport set Reference to bz24837.

Right, I didn't see this coming. WMF uses combined localisation cache for all wikis, and if the extension isn't loaded, those wont have canonical namespaces. In wikis where lqt is enabled, they should have both.

Anyway, I see no easy solution for this. Any suggestions?

Okay few ideas:

  1. Do not use unified l10n cache
  2. Filter out namespace which are not defined in canonical namespaces

Note that while this is a bug, the actual breakage is the fault of the bots themselves, they should be able to handle such issues.

Code bug fixed in r71327, will deploy to Wikimedia sites shortly.

(In reply to comment #3)

Note that while this is a bug, the actual breakage is the fault of the bots
themselves, they should be able to handle such issues.

It's my understanding that every namespace except NS:0 will have a canonical namespace. Missing a key isn't something that scripts are designed to handle generally if there's an understood expectation that a key will always be present.

Thank you for fixing the bug. :-)