Page MenuHomePhabricator

AbuseFilter filter test does not work after API changes because of raw boolean
Closed, ResolvedPublic

Description

When trying to test an abuse filter using the “Examine individual changes” page, the API call used by the JS returns the raw boolean result, e.g. {"abusefiltercheckmatch":{"result":""}} for successful match (result is present), or {"abusefiltercheckmatch":[]} for nonmatch (result is not present). However, since ext.abuseFilter.examine.js in examinerTestProcess uses just a simple if ( data.abusefiltercheckmatch.result ), this is always falsy, so the test is always reported not to match.

I presume this is because of the recent API changes, and either the JS test needs to be changed, or formatversion=2 should be used or something like that.

Event Timeline

Mormegil raised the priority of this task from to Medium.
Mormegil updated the task description. (Show Details)
Mormegil subscribed.

Change 211722 had a related patch set uploaded (by Anomie):
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Change 211722 merged by jenkins-bot:
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Change 211743 had a related patch set uploaded (by Anomie):
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Change 211744 had a related patch set uploaded (by Anomie):
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Test cases for SWAT: (requires the 'abusefilter-modify' right)

https://en.wikipedia.org/w/api.php?action=abusefiltercheckmatch&filter=true&vars= should return

{
    "abusefiltercheckmatch": {
        "result": true
    }
}

https://en.wikipedia.org/w/api.php?action=abusefiltercheckmatch&filter=false&vars= should return

{
    "abusefiltercheckmatch": {
        "result": false
    }
}

I scheduled this for the SWAT window tomorrow morning, but if someone can run the above test cases feel free to rechedule for the evening window today.

He7d3r set Security to None.
He7d3r added a project: JavaScript.

Change 211743 merged by jenkins-bot:
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Change 211744 merged by jenkins-bot:
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Anomie claimed this task.

Fixed and deployed.

Change 212003 had a related patch set uploaded (by Legoktm):
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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

Change 212003 merged by jenkins-bot:
ApiResult::META_BC_BOOLS in ApiAbuseFilterCheckMatch

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