Page MenuHomePhabricator

WikiLambda ApiPerformTest: stop validating error responses
Closed, ResolvedPublicBUG REPORT

Description

Description

When calling the perform test api, for each combination of implementation/test we do:

  1. execute the test call
  2. with the response as an input, execute the validator call

However, when the test call returns an error, we send this error to the validator call.

// Execute the test case function call
$testResultObject = $this->executeFunctionCall( $testFunctionCall, true );

$testMetadata = $testResultObject->getValueByKey( ZTypeRegistry::Z_RESPONSEENVELOPE_METADATA );
'@phan-var \MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap $testMetadata';

// Use tester to create a function call validating the output
$validateTestValue = $testResultObject->hasErrors() ?
  $testResultObject->getErrors() :  // <-------------------------------  HERE. BAD DECISION.
  $testResultObject->getZValue();

$validateFunctionCall = $testerObject->getValueByKey( ZTypeRegistry::Z_TESTER_VALIDATION );
'@phan-var \MediaWiki\Extension\WikiLambda\ZObjects\ZFunctionCall $validateFunctionCall';

$targetValidationFunctionZID = $validateFunctionCall->getZValue();
$validateFunctionCall->setValueByKey( $targetValidationFunctionZID . 'K1', $validateTestValue );

// Execute the validation function call and stash it
$validateResult = $this->executeFunctionCall( $validateFunctionCall, false );

Sometimes the error returned is extremely large, so the second call throws a "request entity too large" 500 error, which breaks everything.

Expected behavior (Acceptance criteria):

  • When the first call returns an error, we shouldn't validate the error, but the response
  • TODO (for the future) We should build a system that can check for errors (expect error Z* function),
    • If this function is used in the validator call, then take a different path for checking the error and args, instead of making it the orchestrator responsibility

Completion checklist

Event Timeline

gengh updated the task description. (Show Details)
gengh updated the task description. (Show Details)

Change #1140731 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Stop the perform_test api from passing errors to the validator function

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

Change #1140731 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Stop the perform_test api from passing errors to the validator function

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