Page MenuHomePhabricator

Calling user-defined And function leads to an error message about validation but works if API triggered manually
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • On my wiki, I have a function "And" that takes two Booleans and returns one Boolean.
  • I have three implementations on it, one through composition, one in Python, one in JS (see screenshot) (although that doesn't matter - I can also replicate it with a single implementation)
  • In the "Evaluate Function" box I choose two values for the arguments (e.g. both true), and click "Call Function"

What happens?:
I get the following result:

{
    "Z1K1": "Z22",
    "Z22K1": "Z23",
    "Z22K2": [
        {
            "Z1K1": "Z5",
            "Z5K1": {
                "Z1K1": "Z502",
                "Z502K1": "Could not validate object: {\"Z1K1\":{\"Z1K1\":\"Z9\",\"Z9K1\":\"Z40\"},\"Z40K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"\"}}"
            }
        }
    ]
}

What should have happened instead?:

I should have gotten the result, either true or false, e.g. "Z41"

If I run it through the API, I get the right answer, so it is stuck somewhere in the frontend.

Here's the call:

{
	"Z1K1": "Z7",
	"Z7K1": "Z10006",
	"Z10006K1": "Z41",
	"Z10006K2": "Z41"
}

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

As of January 13, 2022 - As of January 31, 2022, persists

Event Timeline

Jdforrester-WMF renamed this task from Calling And leads to an error message about validation to Calling user-defined And function leads to an error message about validation but works if API triggered manually.Jan 18 2022, 5:14 PM
Jdforrester-WMF added a project: WikiLambda.
SimoneThisDot changed the task status from Open to In Progress.Feb 3 2022, 12:21 PM
SimoneThisDot claimed this task.

@DVrandecic here we go again, history repeat. I have registered a small video to show you how it works on my machine and show you how to check the payload. So that I can try and understand where the issue lies..

it could be again that the issue is due to the asyn nature of the code, but I want to make sure before we add any further code.

Can you please view the video, check if it works for you as well, or if it does not, provide me the payload sent to the orchestrator.

https://www.loom.com/share/3381bb15551f4d74872e1a3d0c847186

Thanks Simone!

On Special:EvaluateFunctionCall it indeed works. I get the error on the Function page, in the Evaluate Function box on the right hand side.

The payload when I select both values is as follows (e.g. both selected to be true):

{"Z1K1":"Z7","Z7K1":"Z10007","Z10007K1":{"Z1K1":"Z40","Z40K1":"Z41"},"Z10007K2":{"Z1K1":"Z40","Z40K1":""}}

That should indeed fail to validate, the payload is bad.

This comment was removed by DVrandecic.

Change 760891 had a related patch set uploaded (by Simone Cuomo; author: Simone Cuomo):

[mediawiki/extensions/WikiLambda@master] Ensure functionCall argument are just created once

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

Change 760891 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Ensure functionCall argument are just created once

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

Thank you, tested, it works again, thank you!