Page MenuHomePhabricator

Replace request library in mw bot with axios
Closed, DeclinedPublic

Description

MW Bot is built on top of request, but request was deprecated in 2020, and needs replaced with a modern library for api calls in node.

see https://github.com/gesinn-it-pub/mwbot/issues/42

Event Timeline

(@vaughnwalters Hi, why was this filed in Wikimedia Phabricator, and what's the relation to Wikimedia hosted/maintained code?)

@Aklapper wdio-mediawiki npm package depends on mwbot package. wdio-mediawiki is a part of our Selenium testing framework. See Selenium/How-to/Use MediaWiki API for example usage.

Maybe MW Bot could have a dedicated phabricator project?

@kostajh I don't think a project it's needed. It's just an upstream npm package we use.

Ah, thanks a lot for the context! MediaWiki-Core-Tests it is, then.

As-written, this is a duplicate of the upstream https://github.com/gesinn-it-pub/mwbot/issues/42

Should this task instead be "stop using the abandoned mwbot"? The functionality is not very significant, and could be done directly inside wdio-mediawiki I think?

As-written, this is a duplicate of the upstream https://github.com/gesinn-it-pub/mwbot/issues/42

Should this task instead be "stop using the abandoned mwbot"? The functionality is not very significant, and could be done directly inside wdio-mediawiki I think?

Given it's been a year with no movement from an upstream with a security issue, I think we should actually do this…

I've added Test Platform project. I'll leave it to the manager (@SDunlap) to decide if and when to do it.

This continues, and indeed is getting worse and worse. We now have *critical* upstream CVEs because of this in every repo with selenium tests. Can some attention be applied here, please?

I am getting errors increasingly consistently related to mwbot also. A retry will usually fix it, but it happens often now and it's this same error.

[0-3] Error in "MyEvents."before all" hook: wrappedHook for "can allow organizer to search events by name""
Error: invalidjson: No valid JSON response
    at /Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/mwbot/src/index.js:254:31
    at tryCatcher (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/async.js:102:5)
    at Async.drainQueues (/Users/vaughnwalters/workspace/gerrit/mediawiki/extensions/CampaignEvents/node_modules/bluebird/js/release/async.js:15:14)

I think what you said @Jdforrester-WMF makes sense to just have the little functionality we need and move that to core, I'll create a spike for that tomorrow so we can just document what's actually needed and then do a follow up and implement it.

I think what you said @Jdforrester-WMF makes sense to just have the little functionality we need and move that to core, I'll create a spike for that tomorrow so we can just document what's actually needed and then do a follow up and implement it.

Thanks! Happy to help with this too, but didn't want to be pushing at a closed door. :-)

We released wdio-mediawiki 6.0.0 that removes the mwbot dependency.

We released wdio-mediawiki 6.0.0 that removes the mwbot dependency.

🎉 ⭐ 🎉 ❗