Page MenuHomePhabricator

Many WikibaseLexeme tests suddenly failing in quibble-vendor-mysql-php72-{selenium,noselenium}-docker
Closed, ResolvedPublic

Description

selenium:

element (".lemma-widget_edit") still not displayed after 10000ms

Similar error message to flaky builds, but this seems to be very reliably broken now.

17:00:43 [Chrome 73.0.3683.75 linux #0-1] Lexeme:Forms
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can add representation
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can prefill representation language for lexeme with one lemma
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can edit representation
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can remove representation
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can not save representations with redundant languages
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ trims whitespace from representation
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can add grammatical feature
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can remove first grammatical feature
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    - can cancel form addition
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ has statement list
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ FormId counter is not decremented when addForm is undone
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ FormId counter is not decremented when old revision is restored
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ change multi-variant representations
17:00:43 [Chrome 73.0.3683.75 linux #0-1]    ✖ can edit statements on a new Form

noselenium:

Died on test #1 at…
TypeError: Cannot read property 'replace' of undefined

This one doesn’t ring a bell. Also very reliably broken.

16:40:56   jquery.wikibase.lexemeformview
16:40:56     ✖ can be created
16:40:56     ✔ creation without injected option.value fails
16:40:56     ✖ value can be injected as option.value
16:40:56     ✖ value() sets internal value
16:40:56     ✖ value() creates value from input if it is in edit mode
16:40:56     ✖ value() creates null value when in edit mode with redundant languages
16:40:56     ✖ shows warning when in edit mode with redundant languages
16:40:56     ✖ marks redundant languages when in edit mode with redundant languages
16:40:56     ✖ should not be in edit mode by default when initialized with a value
16:40:56     ✖ draws value in input node after startEditing()
16:40:56     ✖ draws value in text node after stopEditing()
16:40:56     ✖ Given a value, creates StatementGroupListView with Form id prefix
16:40:56     ✖ Given a new form, creates StatementGroupListView with empty prefix
16:40:56     ✖ sets id after form save
16:40:56     ✖ form inputs should have connected labels

Other jobs apparently unaffected:

Event Timeline

Change 670502 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/core@master] DNM: run QUnit tests in ResourceLoader debug mode

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

Change 670503 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] DNM: empty change to test CI

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

Looking at the screenshot of one of the failed selenium tests:


I notice that there’s an “add statements” link for the form, but no UI elements to edit the lexeme header, no “add statements” link on the lexeme, no “add sense” or “add form” links, and no UI elements to edit the form elements. I guess some JS initialization isn’t working? That might also explain the “Cannot read property 'replace' of undefined” errors in QUnit.

Change 670510 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] DNM: empty change to test CI

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

The QUnit failures seem to disappear when ResourceLoader debug mode is enabled.

Change 670503 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] DNM: empty change to test CI

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

This change Depends-On the MediaWiki core change that enables debug mode, and the noselenium-docker build succeeded: https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php72-noselenium-docker/68555/console

Change 670510 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] DNM: empty change to test CI

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

This change has no Depends-On, and the noselenium-docker build failed: https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php72-noselenium-docker/68559/console

The QUnit failures seem to disappear when ResourceLoader debug mode is enabled.

That makes me wonder if this could be related to T272882: Upgrade ResourceLoader JS minifier to support ES6 or T272104: Allow modules to opt-in to ES6 syntax support, which have changes merged at times roughly matching the beginning of the CI failures, if I’m not mistaken.

I haven’t been able to reproduce the QUnit failures locally, but I can reproduce the issue that a lexeme page won’t properly load its editing UI when not in debug mode. There aren’t any errors in the console, though.

I haven’t been able to reproduce the QUnit failures locally, but I can reproduce the issue that a lexeme page won’t properly load its editing UI when not in debug mode. There aren’t any errors in the console, though.

…and indeed, git bisect places the blame for this on Update wikimedia/minify to v2.2.0 (T272882: Upgrade ResourceLoader JS minifier to support ES6).

(Note for others testing this: make sure you clear your cache(s) regularly, since ResourceLoader seems to cache the minified JS. I restarted memcached and, for APCu, apache2, after each git bisect step, in addition to running composer update.)

Marking this as a train blocker, since it looks like Lexeme JS would also be broken in production. I also think this should be at least High priority (maybe even UBN!).

Tarrow raised the priority of this task from High to Unbreak Now!.Mar 11 2021, 9:42 AM
Tarrow added a subscriber: Tarrow.

Since this is now blocking team members from making progress I think we should escalate it.

See the blocked merging of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/670416

I’ll try to bisect this in the minifier itself and see if I can identify the faulty commit there.

I’ll try to bisect this in the minifier itself and see if I can identify the faulty commit there.

Scratch that, no need for git bisect here – just comparing JavaScriptMinifier: Add ES6 support to its parent commit is enough to confirm that that’s the “bad” commit.

@Lucas_Werkmeister_WMDE If it's defintly this commit let's just revert it?

@Lucas_Werkmeister_WMDE If it's defintly this commit let's just revert it?

Maybe, but I think I also just found the minifier bug.

From a very long ResourceLoader URL (haven’t yet singled out the broken module):

without ES6 support
function(e){var t,n=e.options,r=e.sealedOptions;for(var i in n)n[i]!==r[i]&&(t||(t={}),t[i]=n[i]);return t}(e);r&&A(e.extendOptions,r),(t=e.options=De(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function wn(e){this._init(e)}function Cn(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=De(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)dn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)mn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,M.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=A({},a.options),i[r]=a,a}}function xn(e){return e&&(e.Ctor.options.name||e.tag)}function kn(e,t){return Array
.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function An(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=xn(a.componentOptions);s&&!t(s)&&On(n,o,r,i)}}}function On(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=bn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De($n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root
with ES6 support
function(e){var t,n=e.options,r=e.sealedOptions;for(var i in n)n[i]!==r[i]&&(t||(t={}),t[i]=n[i]);return t}(e);r&&A(e.extendOptions,r),(t=e.options=De(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function wn(e){this._init(e)}function Cn(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=De(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)dn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)mn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,M.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=A({},a.options),i[r]=a,a}}function xn(e){return e&&(e.Ctor.options.name||e.tag)}function kn(e,t){return
Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function An(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=xn(a.componentOptions);s&&!t(s)&&On(n,o,r,i)}}}function On(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=bn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De($n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.

You can see that the minifier decided to break lines slightly differently; crucially, it changed

...function kn(e,t){return Array
.isArray(e)...

into

function kn(e,t){return
Array.isArray(e)...

which I assume becomes return; with semicolon insertion, i.e. the function now immediately returns void instead of actually checking Array.isArray(e) and whatever else that function does. (This is not the only difference in the JS, but I think the other ones are similar.)

Meh, but I haven’t yet managed to make the minifier make the same mistake in a simple, reproducible example. (The wrongly-minified code seems to be Vue.js, so I’m guessing some exotic pattern in that file – or possibly even in an earlier module concatenated with it? – confuses the minifier’s state machine, and my attempts at reproducing don’t include that confusion.)

Let’s leave the minifier to the experts and revert in the meantime.

Change 670790 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/vendor@master] Revert "Update wikimedia/minify to v2.2.0" and follow-up

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

Change 670789 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/core@master] Revert "Update wikimedia/minify to v2.2.0"

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

Change 670793 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] DNM: empty change to test CI

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

I can confirm that vue is the faulty ResourceLoader module, and it’s broken when minified on its own; compare function kn in

Change 670789 merged by jenkins-bot:
[mediawiki/core@master] Revert "Update wikimedia/minify to v2.2.0"

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

Change 670790 merged by jenkins-bot:
[mediawiki/vendor@master] Revert "Update wikimedia/minify to v2.2.0" and follow-up

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

I’ve created T277161: Minify v2.2.0 incorrectly minifies vue.js (faulty line break resulting in early return) to track the minify issue separately, so we can close this task once the CI issues are confirmed to be fixed. (The minify issue doesn’t need to be a train blocker after the above reverts, though it should probably still be high-priority if people are anxiously waiting to be able to use ES6 syntax.)

Wikibase CI is working again 🎉

Change 670793 abandoned by Lucas Werkmeister (WMDE):
[mediawiki/extensions/Wikibase@master] DNM: empty change to test CI

Reason:

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

Change 670510 abandoned by Lucas Werkmeister (WMDE):
[mediawiki/extensions/WikibaseLexeme@master] DNM: empty change to test CI

Reason:

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

Change 670502 abandoned by Lucas Werkmeister (WMDE):
[mediawiki/core@master] DNM: run QUnit tests in ResourceLoader debug mode

Reason:

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

Change 670503 abandoned by Lucas Werkmeister (WMDE):
[mediawiki/extensions/WikibaseLexeme@master] DNM: empty change to test CI

Reason:

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