Page MenuHomePhabricator

ULS JavaScript test failure
Closed, ResolvedPublic2 Estimated Story Points

Description

Correct value for the font name@ 5 ms
Options saving API did not produce an error.@ 400 ms
Expected: 	
true
Result: 	
false
Source: 	
    at ULSPreferences.<anonymous> (https://wiki.local/w/load.php?modules=oojs-ui-core.styles%7Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%2Cpapaparse%2Crangefix%2Csinonjs%2Cspark-md5%2CtreeDiffer%2Cunicodejs%7Coojs-ui-toolbars.icons%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-accessibility%2Cicons-alerts%2Cicons-content%2Cicons-editing-advanced%2Cicons-editing-citation%2Cicons-editing-core%2Cicons-editing-list%2Cicons-editing-styling%2Cicons-interactions%2Cicons-layout%2Cicons-media%2Cicons-moderation%2Cicons-movement%2Cicons-user%2Cindicators%7Csocket.io%7Ctest.Cite%2CContentTranslation%2CDiscussionTools%2CEcho%2CEventLogging%2CMaps%2CMediaWiki%2CSemanticMediaWiki%2CTranslate%2CUniversalLanguageSelector%2CVisualEditor%2CWikiEditor%7Cve.ce.CXLintableNode%7Cve.dm.CXLintableNode%7Cve.init.mw.CXTarget&version=it24g:3654:879)
    at https://wiki.local/w/load.php?modules=color-picker%2CdiffMatchPatch%2Cdompurify%2Cmoment%2Coojs%2Coojs-ui%2Coojs-ui-core%7Cext.cite.parsoid.styles%7Cext.cite.styles%2CvisualEditor%7Cext.cite.visualEditor.core%7Cext.cx.model%7Cext.cx.widgets.spinner%7Cext.discussionTools.init%2Cminervaicons%7Cext.discussionTools.init.styles%7Cext.echo.api%2Cdm%2Cinit%2Cmobile%2Csecondaryicons%2Cui%7Cext.eventLogging%7Cext.eventLogging.debug%7Cext.maps.leaflet.geojson%7Cext.translate.parsers%7Cext.translate.special.pagemigration%7Cext.uls.common%2Cpreferences%7Cext.visualEditor.data%2Cicons-licenses%2CmoduleIcons%2CmoduleIndicators%7Cjquery.client%2ChighlightText%2Ci18n%2ClengthLimit%2CmakeCollapsible%2Cspinner%2Ctablesorter%2CtextSelection%2Cui%2Culs%7Cjquery.makeCollapsible.styles%7Cjquery.spinner.styles%7Cjquery.tablesorter.styles%7Cjquery.uls.data%2Cgrid%7Cmediawiki.ForeignApi%2CForeignUpload%2CString%2CTitle%2CUpload%2CUri%2Capi%2Ccldr%2Ccookie%2Cdeflate%2Cdiff%2Cexperiments%2Cinspect%2CjqueryMsg%2Clanguage%2CmessagePoster%2Cnotification%2Cpulsatingdot%2Cqunit-testrunner%2Crouter%2Cstorage%2Ctemplate%2Ctoc%2Cui%2Cuser%2Cutil%2CvisibleTimeout%2Cwidgets%7Cmediawiki.ForeignApi.core%7Cmediawiki.ForeignStructuredUpload.BookletLayout%7Cmediawiki.Upload.BookletLayout%7Cmediawiki.action.view.postEdit%2CredirectPage%7Cmediawiki.diff.styles%7Cmediawiki.editfont.styles%7Cmediawiki.interface.helpers.styles%7Cmediawiki.language.months%2Cnames%2CspecialCharacters%2Ctestdata%7Cmediawiki.libs.jpegmeta%2Cpluralruleparser%7Cmediawiki.page.gallery.styles%7Cmediawiki.page.ready%7Cmediawiki.rcfilters.filters.ui%7Cmediawiki.skinning.content.parsoid%7Cmediawiki.template.mustache%7Cmediawiki.ui.button%7Cmediawiki.widgets.AbandonEditDialog%2CCategoryMultiselectWidget%2CDateInputWidget%2CMediaSearch%2CTable%2CUserInputWidget%2Cstyles%7Cmediawiki.widgets.DateInputWidget.styles%7Cmw.cx.SiteMapper%2Cdm%2Cinit%2Cui%2Cutil%7Cmw.cx.dm.Translation%7Cmw.cx.tools.TranslationTool%7Cmw.cx.ui.Infobar%7Coojs-ui-core.icons&version=1ut4i:979:975
    at fire (https://wiki.local/w/load.php?modules=jquery%7Cmediawiki.base&version=rx0fo:42:705)
    at Object.fireWith [as rejectWith] (https://wiki.local/w/load.php?modules=jquery%7Cmediawiki.base&version=rx0fo:43:903)
    at process (https://wiki.local/w/load.php?modules=jquery%7Cmediawiki.base&version=rx0fo:46:492)
    at https://wiki.local/w/load.php?modules=jquery%7Cmediawiki.base&version=rx0fo:46:528

E.g. from https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-noselenium-docker/133214/console

Event Timeline

There request is failing with:

code
: 
"internal_api_error_DBQueryError"
errorclass
: 
"Wikimedia\\Rdbms\\DBQueryError"
info
: 
"[6780f1ed0d1cbc42374d45b6] Exception caught: A database query error has occurred. This may indicate a bug in the software."

Git bisect gives rMWf77eb62e456e: mediawiki.api: Modernize test syntax (async-await, assert.verifySteps) as the reason. Before that I do not even see API requests happening.

After updating everything to latest version and running update.php, the test is no longer failing for me locally, even though requests are made.

Tried rebasing the Translate patch, and it still fails. I don't see anything in the artifacts that would explain why the request is failing.

If I log out, I do see the test failing locally too. Perhaps this newer worked and something in the aforementioned change just caused this test to actually work.

Change 967876 had a related patch set uploaded (by Nikerabbit; author: Nikerabbit):

[mediawiki/extensions/UniversalLanguageSelector@master] Remove broken QUnit test

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

Change 967876 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] Remove broken QUnit test

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

If I log out, I do see the test failing locally too. Perhaps this never worked and something in the aforementioned change just caused this test to actually work.

That'd be my guess, yeah. My change likely got rid of some dirty state that was previously left behind. I temporarily reverted your change in a draft commit with some extra console.log statements:

[WIP] Revert "Remove broken QUnit test"
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UniversalLanguageSelector/+/968378

Result:
https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-noselenium-docker/133660/console

web server log
DEBUG [middleware:source-files]: Requesting /api.php
DEBUG [middleware:source-files]: Requesting /api.php
browser console
INFO: 'ext.uls.preferences.js/save/isNamed', true
ERROR: 'ext.uls.preferences.js/save/fail', 'notloggedin', Object{error: Object{code: 'notloggedin', info: 'You must be logged in to edit your preferences.', docref: 'See http://127.0.0.1:9413/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&gt; for notice of API deprecations and breaking changes.'}, servedby: '1169b981d799'}

INFO: 'ext.uls.preferences.js/save/isNamed', true
ERROR: 'ext.uls.preferences.js/save/fail', 'notloggedin', Object{error: Object{code: 'notloggedin', info: 'You must be logged in to edit your preferences.', docref: 'See http://127.0.0.1:9413/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&gt; for notice of API deprecations and breaking changes.'}, servedby: '1169b981d799'}
QUnit
ext.uls
     ✔ Initial check
     ✔ Custom langdb
     ✖ User preferences
     ✔ Common languages

In case there was a server-side PHP error, you could also click on "Status" in Jenkins and then look for the mw-error.log artefact file, which will contain a stack trace in that case. For the above example, there isn't an mw-error.log file because no uncaught exceptions happened.

I'm not sure which internal_api_error_DBQueryError you got, but if it seems like that's differnet from the one I see in CI now. If you're able to reproduce the internal_api_error_DBQueryError case, you'd be able to check the mw-error.log artefact for details on why that would cause a DB error. I'm guessing that would be unrelated to any client-side code or unit tests, however.

I do note that when I run this locally (if logged-in) the test pass, albeit quite slow at taking 1-2 seconds to complete. Apart from speed, I'd say you generally want to avoid changing stuff in the database from a frontend test (both unit tests and integration tests). It's not really testing anything in your JS code by doing that. You can e.g. stub w.Api().saveOption, which is the method that ULS's javascript code calls, and assert that it is called and then mock a return value for the scenario you're testing.

Change 968783 had a related patch set uploaded (by Abijeet Patro; author: Nikerabbit):

[mediawiki/extensions/UniversalLanguageSelector@wmf/1.42.0-wmf.2] Remove broken QUnit test

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

Change 968784 had a related patch set uploaded (by KartikMistry; author: Nikerabbit):

[mediawiki/extensions/UniversalLanguageSelector@wmf/1.42.0-wmf.1] Remove broken QUnit test

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

Change 968784 abandoned by KartikMistry:

[mediawiki/extensions/UniversalLanguageSelector@wmf/1.42.0-wmf.1] Remove broken QUnit test

Reason:

Already cherry picked

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

Change 968783 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@wmf/1.42.0-wmf.2] Remove broken QUnit test

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

Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:16:13Z] <lucaswerkmeister-wmde@deploy2002> Started scap: Backport for [[gerrit:968783|Remove broken QUnit test (T349485)]]

Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:17:36Z] <lucaswerkmeister-wmde@deploy2002> abi and lucaswerkmeister-wmde: Backport for [[gerrit:968783|Remove broken QUnit test (T349485)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:23:07Z] <lucaswerkmeister-wmde@deploy2002> Finished scap: Backport for [[gerrit:968783|Remove broken QUnit test (T349485)]] (duration: 06m 53s)