Page MenuHomePhabricator

Unable to change the target of internal links
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce:

  • Open a page with VisualEditor.
  • Type hello, select this word and open Link insertion tool.
  • Type Cat#diet as link target.

What happens?:

  • [[Cat]] page is displayed as a suggestion, but not in bold.
  • After pressing Done button, hello links to [[Hello]].

What should have happened instead?:

  • [[cat#diet]] should be displayed as a suggestion, in bold (as soon as [[Cat]] exists).
  • After pressing Done button, hello should link to [[cat#diet]].

Regression info:
In MW 1.38.0-wmf.3, we can add anchored link, but the page name with fragment is no more displayed in suggestions (I am pretty sure it was previously displayed, isn’t it?)
In MW 1.38.0-wmf.4, we cannot add any anchored link. Maybe because of 2984539f42128e5a445aaf6857b01584c2af2041.

Event Timeline

I can reproduce on https://en.wikipedia.beta.wmflabs.org/.

Error in browser console:

Uncaught TypeError: namespacesWithSubpages.indexOf is not a function
    at VeUiMWInternalLinkAnnotationWidget.ve.ui.MWInternalLinkAnnotationWidget.onTextChange (load.php?lang=en&modules=ext.visualEditor.core%2Cmwlink%2Cmwtransclusion%2Cwelcome|ext.visualEditor.mwimage.core&skin=vector&version=15snd:877)
    at OoUiSearchInputWidget.OO.EventEmitter.emit (<anonymous>:275:652)
    at OoUiSearchInputWidget.OO.ui.InputWidget.setValue (load.php?lang=en&modules=jquery%2Coojs-ui-core&skin=vector&version=15gmv:265)
    at load.php?lang=en&modules=jquery%2Coojs-ui-core&skin=vector&version=15gmv:265

The value of mw.config.get( 'wgVisualEditorConfig' ).namespacesWithSubpages is:

{
    "0": 1,
    "1": 2,
    "2": 3,
    "3": 4,
    "4": 5,
    "5": 7,
    "6": 9,
    "7": 10,
    "8": 11,
    "9": 12,
    "10": 13,
    "11": 14,
    "12": 15,
    "13": 100,
    "14": 101,
    "31": 118,
    "32": 119,
    "33": 190,
    "34": 191,
    "37": 828,
    "38": 829
}
matmarex triaged this task as Unbreak Now! priority.Oct 13 2021, 11:12 PM

Actually, the problem is more significant. I'm unable to change the target of any internal link.

matmarex renamed this task from We should still be able to add anchored link to page sections to Unable to change the target of internal links.Oct 13 2021, 11:12 PM

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

[mediawiki/extensions/VisualEditor@master] Fix value of 'namespacesWithSubpages' in wgVisualEditorConfig

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

+2'ed the patch, sorry for not catching this in my initial work

Change 730655 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Fix value of 'namespacesWithSubpages' in wgVisualEditorConfig

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

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

[mediawiki/extensions/VisualEditor@wmf/1.38.0-wmf.4] Fix value of 'namespacesWithSubpages' in wgVisualEditorConfig

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

Change 730729 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@wmf/1.38.0-wmf.4] Fix value of 'namespacesWithSubpages' in wgVisualEditorConfig

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

Mentioned in SAL (#wikimedia-operations) [2021-10-14T15:06:08Z] <dancy@deploy1002> Synchronized php-1.38.0-wmf.4/extensions/VisualEditor/includes/VisualEditorHooks.php: Backport: [[gerrit:730729|Fix value of 'namespacesWithSubpages' in wgVisualEditorConfig (T293310)]] (duration: 01m 04s)

I just checked this and it works as desired. Refer to the screenshot:

Screenshot 2021-10-14 at 17.28.18.png (586×1 px, 79 KB)

Yes, that's the same error as I copied above, in T293310#7426928.

However, the issue is already fixed. The entries in Logstash stopped when we deployed the fix (a few stragglers must be coming from users who opened the editor before the patch and still have it open, or possibly cached code). You can see it here: https://logstash.wikimedia.org/goto/fab39a031e1915ecd6b147d5ad2890aa

image.png (489×2 px, 77 KB)

Jdforrester-WMF assigned this task to matmarex.

Brilliant, thanks for confirming.