Page MenuHomePhabricator

Display wiki-specific namespaces in external article links on Special:GlobalContributions
Open, Needs TriagePublic

Description

Background

Special:GlobalContributions links to pages on external wikis. Since the pages may be in nonstandard namespaces that are not known to the local wiki, it is not always possible to display the namespace in the link text.

Technical background

The URLs point directly to a page ID, rather than being built from a namespace and page title, since the namespace may not be known.

There is a set of namespaces known to all wikis, defined in NamespaceInfo::CANONICAL_NAMES, which maps namespace IDs to namespace labels. If the namespace is one of these, then the label can be displayed in the link text. If it is not, then it cannot be displayed because the label is not known.

Solution

We could look up the namespaces at the external wikis using API calls. (We already look up the user's permissions using API calls, explained in T356294#10272663.)

Pro: This means all the namespaces can be displayed
Con: More API lookups are not good for page load time (though they could be cached), and wiki-specific namespaces may be rare so a lookup on every page load may not be worth it

As with the permissions (T380867), ideally we would not need API calls to look up the namespaces. However, they are not stored in the database, so it is not possible to look them up directly: T226667.

Event Timeline

Change #1083383 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Display all namespaces for external links

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

Just to confirm - will this task resolve the bug of (I believe) incorrect namespace names being displayed if the central wiki has a different name to a local wiki for the namespace in question, or should I file a separate task for that? (e.g., local 'project' namespaces currently all seem to be referred to as Meta: on https://meta.wikimedia.org/wiki/Special:GlobalContribs/A_smart_kitten)
Apologies if I'm missing something!

@A_smart_kitten This task should ensure that all namespaces from all wikis are correctly displayed.

However, standard namespaces (i.e. those in this table) should not currently be displaying incorrectly.

Here's what the code does:

  • If the namespace is one of the standard namespaces, show the namespace
  • Otherwise don't show the namespace

If metawiki is displaying different labels for the "standard" namespaces, then maybe we need to rethink that logic...

wiki-specific namespaces may be rare

However English Wikipedia use Draft namespace extensively which does not exist in Meta.

Otherwise don't show the namespace

This will make main and Draft namespace edits indistinguishable.

The difficulty with looking up namespaces on each wiki is that it is costly and may lead to similar errors to when looking up permissions: (T384717). I therefore wouldn't advise simply doing the lookups as implemented in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CheckUser/+/1083383.

We may be able to reduce the overhead by caching, as suggested in T384717#10565353 (although this would be potentially easier, since the data wouldn't be legally sensitive and wouldn't be expected to change very often).

Another avenue to explore would be to revisit the idea of storing namespaces in database tables, e.g. as discussed in T226667, but this would be a significant project.

We may be able to reduce the overhead by caching, as suggested in T384717#10565353 (although this would be potentially easier, since the data wouldn't be legally sensitive and wouldn't be expected to change very often).

Random idea that came to mind based on this, and might be completely infeasible; but could the CheckUser extension periodically cache the namespace names for all wikis in a wiki family in the background, and then use the cached namespace names whenever an end user visits Special:GlobalContributions?

I didn't look deeply into this but if namespaces aren't a on page load priority, could it be a progressive enhancement? Could we append them with javascript? That way they won't add to our lookup load for first page load and it would allow us to space out the calls and retry them if we need to.

As a quick fix, while we work on something better, we could display something like Namespace<id>: for the unknown namespaces, just to disambiguate the from Main. (Thanks @Urbanecm for this idea.)

Dreamy_Jazz subscribed.

Going to implement the following:

As a quick fix, while we work on something better, we could display something like Namespace<id>: for the unknown namespaces, just to disambiguate the from Main. (Thanks @Urbanecm for this idea.)

Change #1136018 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Show something for namespace prefix when namespace not known in GUC

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

Change #1136018 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Show something for namespace prefix when namespace not known in GUC

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

Temporary fix applied. Moving back to backlog as we will need to fix it by displaying the namespace.

Removing the sprint tag since the immediate confusion should be fixed, and a proper fix is a bigger lift. The task remains on the temp accounts backlog.

This is an enhancement to Special:GlobalContributions, but is not specific to temporary accounts, so removing that tag.