Page MenuHomePhabricator

Unit tests failing: "TypeError: Cannot read property 'debounce' of undefined"
Closed, ResolvedPublic

Description

Unit tests are occasionally, but not always, failing with "TypeError: Cannot read property 'debounce' of undefined".

Most recent: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/525273 / https://integration.wikimedia.org/ci/job/wmf-quibble-vendor-mysql-hhvm-docker/31646/console

20:52:48 HeadlessChrome 73.0.3683 (Linux 0.0.0) WARN: 'jQuery.Deferred exception: Cannot read property 'debounce' of undefined', 'TypeError: Cannot read property 'debounce' of undefined
20:52:48     at HTMLDocument.<anonymous> (http://localhost:9876/load.php?lang=en&modules=color-picker%2CdataValues%2CdiffMatchPatch%2Cdompurify%7CdataValues.DataValue%2CTimeValue%2Cvalues%7Ceasy-deflate.core%2Cdeflate%7Cext.cite.style%2Cstyles%2CvisualEditor%7Cext.cite.visualEditor.core%2Cdata%2Ctest%7Cext.cx.model%2Csitemapper%2Ctranslation%2Cutil%7Cext.cx.tools.card%2Ccategories%2Cmanager%2Cmtabuse%2Cvalidator%7Cext.cx.translation.loader%2Cprogress%7Cext.cx.util.selection%7Cext.cx.widgets.spinner%7Cext.echo.api%2Cdm%2Cinit%7Cext.echo.dm.tests%7Cext.eventLogging%2Cflow%2CnavigationTiming%2Cthanks%7Cext.eventLogging.debug%7Cext.flow.components%2Cdm%2Ctemplating%2Ctests%2Cui%7Cext.flow.dm.tests%7Cext.flow.jquery.conditionalScroll%2CfindWithParent%7Cext.flow.jquery.findWithParent.tests%7Cext.guidedTour.lib%2Cstyles%7Cext.guidedTour.lib.internal%2Ctests%7Cext.navigationTiming.rumSpeedIndex%7Cext.templateData.test%7Cext.templateDataGenerator.data%7Cext.thanks.images%2Cmobilediff%7Cext.translate.parsers%7Cext.translate.parsers.test%7Cext.translate.special.pagemigration%7Cext.translate.special.pagemigration.test%7Cext.uls.common%2Ci18n%2Cinit%2Clanguagenames%2Cmediawiki%2Cmessages%2Cpreferences%2Ctests%7Cext.visualEditor.articleTarget%2Cbase%2CcheckList%2CcommentAnnotation%2Ccore%2Cdata%2CdesktopArticleTarget%2CdesktopTarget%2Cdiffing%2Cexperimental%2Cicons%2Clanguage%2Cmediawiki%2CmoduleIcons%2CmoduleIndicators%2Cmwalienextension%2Cmwcore%2Cmwextensionmessages%2Cmwextensions%2Cmwformatting%2Cmwgallery%2Cmwimage%2Cmwlanguage%2Cmwlink%2Cmwmeta%2Cmwsave%2Cmwtransclusion%2CprogressBarWidget%2Crebase%2Csanitize%2CsupportCheck%2Cswitching%2CtargetLoader%2CtempWikitextEditorWidget%2Ctrack%2Cve%2Cwelcome%7Cext.visualEditor.core.desktop%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.mwextensions.desktop%7Cext.visualEditor.mwimage.core%7CglobeCoordinate.js%7Cjquery.AnimationEvent%2CPurposedCallbacks%2CaccessKeyLabel%2Cajaxdispatcher%2CanimateWithEvent%2CcheckboxShiftClick%2Cclient%2Ccolor%2CcolorUtil%2Ccookie&skin=vector&version=12lc9ha:244:429)
20:52:48     at mightThrow (http://localhost:9876/load.php?lang=en&modules=jquery%7Cmediawiki.base&skin=vector&version=07mxh9n:48:916)
20:52:48     at process (http://localhost:9876/load.php?lang=en&modules=jquery%7Cmediawiki.base&skin=vector&version=07mxh9n:49:589)', undefined

Event Timeline

matmarex created this task.Jul 24 2019, 7:41 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 24 2019, 7:41 PM
matmarex added subscribers: Esanders, Jdforrester-WMF.

So, that URL that is failing has modules from 13 different extensions, and there's no traceback. I tried narrowing down the culprit.

The error message says :244:429 (line 244, column 429), but that's not of much use without the contents of that URL, which AFAIK there's no way to get.

I tried loading the same load.php URL from en.wikipedia.beta.wmflabs.org, but it's missing a bunch of the test modules, so the error won't be on the same line/column. But there are just a couple calls to .debounce(…) in the output, and only 5 before line 244, so I checked those.

I am pretty sure the faulty call is the OO.ui.debounce() in this file: https://github.com/wikimedia/mediawiki-extensions-ContentTranslation/blob/master/modules/translation/ext.cx.translation.aligner.js#L243 It is in the module 'ext.cx.translation', which doesn't seem to depend on 'oojs-ui-core' (unless it's somewhere five dependencies deep…).

The call was introduced in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/483406 in January. There might be similar issues in other files touched there, the commit did not add any dependencies on 'oojs-ui-core', which seems suspicious.

Esanders removed a subscriber: Esanders.Aug 5 2019, 11:15 AM

Change 528268 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/ContentTranslation@master] Revert "Replace jquery throttle/debounce dependency with OOUI equivalents"

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

Change 528538 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/ContentTranslation@master] Follow-up I717e791b5: Add dependency on oojs-ui-core to modules where missing

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

Change 528268 abandoned by Bartosz Dziewoński:
Revert "Replace jquery throttle/debounce dependency with OOUI equivalents"

Reason:
Merging https://gerrit.wikimedia.org/r/528538 instead.

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

Change 528538 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Follow-up I717e791b5: Add dependency on oojs-ui-core to modules where missing

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

matmarex closed this task as Resolved.Aug 7 2019, 7:09 PM
matmarex assigned this task to Jdforrester-WMF.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:05 PM