-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DMN - TCK failure: Return coerced null from decision with knowledge requirements #1831
Comments
I have the impression <itemDefinition name="tNameAndAge">
<itemComponent name="name">
<typeRef>string</typeRef>
</itemComponent>
<itemComponent name="age">
<typeRef>number</typeRef>
</itemComponent>
</itemDefinition>
<businessKnowledgeModel name="bkm_001" id="_bkm_001">
<variable name="bkm_001"/>
<encapsulatedLogic>
<formalParameter name="nameAndAge" typeRef="tNameAndAge"/>
<literalExpression>
<text>nameAndAge != null</text>
</literalExpression>
</encapsulatedLogic>
</businessKnowledgeModel>
<decision name="decision_bkm_002" id="_decision_bkm_002">
<variable name="decision_bkm_002"/>
<knowledgeRequirement>
<requiredKnowledge href="#_bkm_001"/>
</knowledgeRequirement>
<literalExpression>
<text>bkm_001({name: "foo"})</text>
</literalExpression>
</decision> Then, |
@baldimir @yesamer <decision name="invoke_001" id="_invoke_001">
<variable name="invoke_001"/>
<knowledgeRequirement>
<requiredKnowledge href="#_bkm_001"/>
</knowledgeRequirement>
<invocation>
<literalExpression>
<text>bkm_001</text>
</literalExpression>
<binding>
<parameter name="nameAndAge"/>
<!-- passed incorrect param to bkm -->
<literalExpression>
<text>{name: "foo"}</text>
</literalExpression>
</binding>
</invocation>
</decision> From the test, <testCase id="invoke_001">
<description>decision has invocation call to bkm passing
non-conforming context - bkm is never invoked</description>
<resultNode name="invoke_001" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase> it seems that in this case our engine should immediately return an error when |
There is an incorrect parameter defined, so
should resolve to null. The incorrect parameter shouldn't resolve to null and be passed to the BKM. It is a similar case in my opinion, as if it would be defined with a wrong parameter type. It should just return null and log a parameter error. |
Not sure to follow, anyway, WRT to
As "wrong parameter", as per bkm definition <businessKnowledgeModel name="bkm_001" id="_bkm_001">
<variable name="bkm_001"/>
<encapsulatedLogic>
<formalParameter name="nameAndAge" typeRef="tNameAndAge"/>
<literalExpression>
<text>nameAndAge != null</text>
</literalExpression>
</encapsulatedLogic>
</businessKnowledgeModel>
AFAIK, the engine/spec has always been extremely permissive with So, in this case, it is not clear to me how we could implement that. |
@baldimir @yesamer This is the invoked <businessKnowledgeModel name="bkm_005" id="_bkm_005">
<variable name="bkm_005"/>
<encapsulatedLogic>
<formalParameter name="arg"/>
<literalExpression typeRef="number">
<text>[arg]</text>
</literalExpression>
</encapsulatedLogic>
</businessKnowledgeModel> So:
if invoked with This is the tested decision <decision name="invoke_005" id="_invoke_005">
<variable name="invoke_005" typeRef="number"/>
<knowledgeRequirement>
<requiredKnowledge href="#_bkm_005"/>
</knowledgeRequirement>
<invocation typeRef="number"> <!-- bkm returns number array but invocation type is a number -->
<literalExpression>
<text>bkm_005</text>
</literalExpression>
<binding>
<parameter name="arg"/>
<literalExpression>
<text>[10]</text>
</literalExpression>
</binding>
</invocation>
</decision>
[10] -> 10 -> bkm_005(10) The original comment from Matteo also mention that, but I have the impression something changed in the meantime. See Result of invoke_005 is wrong. |
TCK Failures
"compliance-level-3/0082-feel-coercion","0082-feel-coercion-test-01","decision_bkm_002","ERROR","FAILURE: 'decision_bkm_002' expected='null' but found='false'"
"compliance-level-3/0082-feel-coercion","0082-feel-coercion-test-01","invoke_001","ERROR","FAILURE: 'invoke_001' expected='null' but found='false'"
"compliance-level-3/0082-feel-coercion","0082-feel-coercion-test-01","invoke_005","ERROR","FAILURE: 'invoke_005' expected='null' but found='10'"
Model https://github.com/dmn-tck/tck/blob/master/TestCases/compliance-level-3/0082-feel-coercion/0082-feel-coercion.dmn
Test https://github.com/dmn-tck/tck/blob/master/TestCases/compliance-level-3/0082-feel-coercion/0082-feel-coercion-test-01.xml
The text was updated successfully, but these errors were encountered: