Page MenuHomePhabricator

XFDcloser gadget intermittently failing Peast validation
Closed, ResolvedPublicBUG REPORT

Description

The XFDcloser gadget on enwiki (https://en.wikipedia.org/wiki/MediaWiki:Gadget-XFDcloser-core.js) sometimes raises an error: Parse error: Unexpected: ( on line 21.

Steps:

  • Try mw.loader.load('ext.gadget.xfdcloser-core') or mw.loader.load('ext.gadget.xfdcloser-core-beta').

The error is generally not reproducible. But once it happens, it occurs consistently on the same skin/browser/device.

Users have reported https://en.wikipedia.org/w/load.php?lang=en&modules=ext.gadget.XFDcloser-core&skin=vector&version=m2csj to at times emit the following:

mw.loader.impl(function(){return["ext.gadget.XFDcloser-core@30cwo",function($,jQuery,require,module){mw.log.error("Parse error: Unexpected: ( on line 21");
},{"css":[".xfdc-status{font-size:small;margin-left:13px;font-weight:normal}.skin-timeless .xfdc-status{font-size:0.98rem}.skin-minerva .xfdc-status{font-size:0.98rem;display:block;margin:-1rem 0 1rem}.xfdc-action{font-weight:normal}.xfdc-action a{cursor:pointer}.xfdc-qc-cancel{cursor:pointer;border:1px solid #777;border-radius:10px;font-weight:bold;font-size:90%;color:#777;padding:0;margin:0 1px} .xfdc-old .xfdc-action{background-color:#c6ffc6}.xfdc-notOld .xfdc-action{background-color:#ffc6c6}.xfdc-unknownAge .xfdc-action{background-color:#ffffc6}.xfdc-notOld.xfdc-relisted .xfdc-action{background-color:#ffe9c6} .xfdc-actioned-heading{text-decoration:line-through double black;opacity:75%}.xfdc-actioned-discussion{opacity:50%} html body.ooui-draggbleWindow-open{position:unset;overflow:unset;margin-right:unset !important; }html body.ooui-draggbleWindow-open .oo-ui-windowManager-modal \u003E .oo-ui-dialog.oo-ui-window-active{position:static;padding:0} html body.ooui-draggbleWindow-open .oo-ui-dialog.oo-ui-window-active \u003E div{z-index:110;transition:all 0.25s ease-out 0s,transform 0s !important}  .oo-ui-textInputWidget.oo-ui-textInputWidget-labelPosition-before.padLeft2em .oo-ui-inputWidget-input{padding-left:2em !important}.oo-ui-textInputWidget.oo-ui-textInputWidget-labelPosition-before.padLeft4em .oo-ui-inputWidget-input{padding-left:4em !important} .xfdc-menuOptionWidget.oo-ui-decoratedOptionWidget{padding:7px 12px} .xfdc-taskItemWidget \u003E .oo-ui-fieldLayout-messages{clear:both} #XFDcloser-showhide{bottom:0;display:block;position:fixed;right:0;z-index:100;padding:5px;box-shadow:0 2px 4px rgba(0,0,0,0.5);background-color:#fef9e6;border:1px solid #aaa;border-radius:5px;font-size:85%}"]}];});

As the JS code of the gadget is replaced with a Parse error: Unexpected: ( on line 21, this is clearly caused by failure of Peast validation. The consistent occurrences after the first occurrence can be explained by the incorrect validation result getting cached.

However, attempting to run Peast locally on the gadget consistently passes.

Original discussion: https://en.wikipedia.org/wiki/Wikipedia_talk:XFDcloser#Loading_problem

Event Timeline

Restricted Application added subscribers: Masumrezarock100, Aklapper. · View Herald Transcript

May be the same as T358946, there is a similar regexp in the source code here: /\n={3,}/. I'm confused why it would only fail intermittently though…

@SD0001 You can temporarily workaround this by (ab)using the requiresES6 flag, which still bypasses validation (although not for long, but it still works, for now).

We'll file this upstream and upgrade our version of Peast as soon as it is fixed.

Krinkle triaged this task as High priority.Mar 5 2024, 4:05 PM
Krinkle moved this task from Inbox to Confirmed Problem on the MediaWiki-ResourceLoader board.

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

[mediawiki/core@master] Update mck89/peast to 1.16.2

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

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

[mediawiki/vendor@master] Update mck89/peast to 1.16.2

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

Change 1008954 merged by jenkins-bot:

[mediawiki/vendor@master] Update mck89/peast to 1.16.2

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

Change 1008953 merged by jenkins-bot:

[mediawiki/core@master] Update mck89/peast to 1.16.2

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

Thanks for fixing! Will this ride the train and deploy on March 14?

Yes. The fix will be deployed to Wikimedia wikis next week, between Tuesday and Thursday, per the usual schedule.

I think we should bump Module::USERJSPARSE_CACHE_VERSION every time we raise the Peast version. Otherwise the broken result generated by old version would get served to users till the cache expires (one more week).

Change 1009566 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/core@master] resourceloader: Raise USERJSPARSE_CACHE_VERSION following Peast upgrade

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

Change 1009566 merged by jenkins-bot:

[mediawiki/core@master] resourceloader: Raise USERJSPARSE_CACHE_VERSION following Peast upgrade

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