-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[Incubator-kie-issues#1619] Correctly manage execution of invalid models #6200
base: main
Are you sure you want to change the base?
Conversation
…ncubator-kie-drools into incubator-kie-issues#1619
kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/MultipleDecision.dmn
Show resolved
Hide resolved
@@ -0,0 +1,55 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" expressionLanguage="https://www.omg.org/spec/DMN/20230324/FEEL/" namespace="https://kie.org/dmn/_CADD03FC-4ABD-46D2-B631-E7FDE384D6D7" id="_9C0A9728-3B31-45F3-933F-75763212194B" name="DMN_54AA2CFA-2374-4FCE-8F16-B594DFF87EBE" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:kie="https://kie.org/dmn/extensions/1.0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AthiraHari77 License header is still missing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yesamer I have updated here as well
DMNContext context = DMNFactory.newContext(); | ||
context.set( "Person Age", 24 ); | ||
String errorMessage = "DMN: Error compiling FEEL expression 'Person Age >= 18' for name 'Can Drive?' on node 'Can Drive?': syntax error near 'Age' (DMN id: _563E78C7-EFD1-4109-9F30-B14922EF68DF, Error compiling the referenced FEEL expression) "; | ||
assertThatThrownBy(() -> dmnRuntime.evaluateByName(dmnModel, context, "Can Drive")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go for the more readable assertThatIllegalStateExceptionIsThrownBy(.... Consider this also in the other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pibizza Updated the test cases as specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine. I would probably split the test file in two - one for normal cases and one for exceptional cases. the one for exceptional cases can greatly be simplified, becoming a single parametric test. We can do this later however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AthiraHari77
great job.
But TBH I'm surprised that this modification does not break any test, apparently, and now I'm wondering if there could be something else missing.
At the same time, as maybe mentioned in private, I was pretty sure that we would need to modify, somehow, the message creation to have a better structured information.
Last, we have to be sure that our TCK implementation will be adapted accordingly, because I'm pretty sure that this modification could break the current one.
@@ -754,6 +760,15 @@ private static String getDependencyIdentifier(DMNNode callerNode, DMNNode node) | |||
|
|||
} | |||
|
|||
private static void identifyDecisionErrors(DMNModel model, String... decisions) { | |||
List<DMNMessage> errorMessages = model.getMessages(DMNMessage.Severity.ERROR); | |||
List<String> identifiedErrors = errorMessages.stream().map(Message::getText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @AthiraHari77
Many thanks for the PR.
I'm only slightly concerned about this assertion.
The logic here is that
decisions
could bedecisionsId
ordecisionName
(IINW)- if an error message contains one of them, then the decisions it relates to is "wrong"
I'm afraid there could be some cases where an error message contains the decisionId or decisionName, but that the error is not in the decision itself (e.g. another element that refer that decision)
@gitgabrio @AthiraHari77 I ran the TCK tests against those changes, and there is only one new test failure: |
Fixes apache/incubator-kie-issues#1619
In this PR, Decision models are validated to ensure correctness, and both valid and invalid decisions are identified and handled accordingly. In the event of an exception, a valid status is returned to reflect the error state accurately.
Thank you for submitting this pull request
NOTE!: Double-check the target branch for this PR.
The default is
main
so it will target Drools 8 / Kogito.Ports If a forward-port or a backport is needed, paste the forward port PR here
Issue: (please edit the GitHub Issues link if it exists)
referenced Pull Requests: (please edit the URLs of referenced pullrequests if they exist)
How to replicate CI configuration locally?
Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.
build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.
How to retest this PR or trigger a specific build:
for pull request and downstream checks
for a full downstream build
run_fdb
for Jenkins PR check only
Build Now
button.