Page MenuHomePhabricator

Support for basic boolean flags in ores-legacy
Closed, ResolvedPublic

Description

In ORES:
https://ores.wikimedia.org/v3/scores/enwiki/12312342/damaging?features outputs features

In ORES-legacy:
https://ores-legacy.wikimedia.org/v3/scores/enwiki/12312342/damaging?features outputs an error

{"detail":[{"loc":["query","features"],"msg":"value could not be parsed to a boolean","type":"type_error.bool"}]}

It looks like ORES-legacy expects a value that can be parsed to boolean. But the presence of the query param itself is used as a boolean in the old API.

Event Timeline

The following works nicely and it seems more precise:

https://ores-legacy.wikimedia.org/v3/scores/enwiki/12312342/damaging?features=true

Is there a use case for maintaining the one that you indicated in the description?

It would not break currently working code. It's a compatibility issue.

Also it's a common pattern in the MediaWiki API. E.g. see https://en.wikipedia.org/w/api.php?action=help&modules=main#main/datatype/boolean

Change 960587 had a related patch set uploaded (by Ilias Sarantopoulos; author: Ilias Sarantopoulos):

[machinelearning/liftwing/inference-services@main] ores-legacy: support empty boolean parameters

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

Change 960587 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] ores-legacy: support empty boolean parameters

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

Change 961355 had a related patch set uploaded (by Ilias Sarantopoulos; author: Ilias Sarantopoulos):

[operations/deployment-charts@master] ml-services: allow empty boolean query param in ores legacy

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

Change 961355 merged by jenkins-bot:

[operations/deployment-charts@master] ml-services: allow empty boolean query param in ores legacy

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

Added the support for empty boolean features in order not to break existing functionality.
The following request now https://ores.wikimedia.org/v3/scores/enwiki/12312342/damaging?features works and the issue is now resolved.