Page MenuHomePhabricator

Inconsistent behaviour when favouriting redirects and their targets
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

I am finding a few cases where adding a template which is a redirect can lead to inconsistent behaviour.

Case one
Favouriting the redirect first and then the target of that redirect:

  • the target is added to the "Favorites" list with a subheading Redirected from [redirect title] and with the favourite icon unfilled.
  • only one favourite is added to the list, even though in the search results you will see that both the redirect and target are favourited.
  • attempting to remove the favourite from the list will not remove either favourite. You need to close and re-open the wizard, and even then attempting to remove the favourite from the list will only remove the favourited target, not the redirect.

Case two
Favouriting the target first and then the redirect:

  • there are two items in the "Favorites" list, both with the same title but one with the subheading Redirected from [redirect title].
  • attempting to remove the item without the subheading will remove the item with the subheading. Removing the item with the subheading will remove the item with the subheading.
  • removing the items from the search results menu does not appear to remove them from the "Favorites" list (although it does actually).

Case three
From the search results menu, removing and re-adding a redirect will lead to duplicate items in the "Favorites" list.

Case four
Favourite a redirect with a non-template target: nothing appears in the "Favorites" list (but does in search results).

Steps to reproduce problem
  1. Login to https://en.wikipedia.beta.wmflabs.org
  2. Go to https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Conflict-title-0.0013337513511653132-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n&action=edit
  3. To reproduce cases 1-3, search for "affiliated": Affiliated with the subject is a redirect and Third-party is its target
  4. To reproduce case 4, search for "page 3b"
Environment

Browser: Firefox 128.
Wiki(s): https://en.wikipedia.beta.wmflabs.org TemplateData 0.2.0 (b4e9f96) 07:35, 28 April 2025.
Editor:

  • WikiEditor 0.5.4 (6b614cd) 07:36, 28 April 2025.
  • VisualEditor – (9c016ef) 07:36, 28 April 2025.
Screenshots

Case one

Case two

Case three

Case four

Event Timeline

Samwilson subscribed.

It looks like this is also an issue if a template is turned into a redirect after being favorited (which is probably a rare thing, because generally a page move will create the redirect as a new page, and we favorite by page ID not title).

nb. Struggling to reproduce case 4 on my local install (but the others are present)

I think this is related to the CirrusSearch support, in which we add an extra search result when there's an exact prefix match with a template name to what's typed in the search. That extra API call doesn't exclude redirects.

We never want to show redirects in the search results, because TemplateData resolves them to their targets.

Change #1145801 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/TemplateData@master] TemplateDiscovery: Resolve redirects when adding exact match

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

I'm going to say that this task is about the duplicate search results (i.e. a redirect and its target both appear in the search results, leading to the possibility of favoriting them separately and the buggy behaviour seen). The other part of this is case four above, which is a bit different and I think we can track in T394368.

Change #1145801 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] TemplateDiscovery: Resolve redirects when adding exact match

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

I cannot reproduce the above bugs on enwiki beta. I do see T394368.