Bug 1009385

Summary: Invalid Guided Rule reopens with a different definition
Product: [Retired] JBoss BRMS Platform 6 Reporter: Zuzana Krejčová <zkrejcov>
Component: Business CentralAssignee: Toni Rikkola <trikkola>
Status: CLOSED EOL QA Contact: Lukáš Petrovický <lpetrovi>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.0CC: etirelli, lpetrovi, mbaluch
Target Milestone: ER3   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
If you close and save the Guided Rule Editor with an unfinished or invalid change, you will not be able to work on the incomplete rule when you reopen it because the Guided Rule Editor opens the rule with a different definition. Cause: Consequence: Fix: Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:48:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
DR3 - broken editor
none
DR3 - displayed source none

Description Zuzana Krejčová 2013-09-18 10:34:04 UTC
Description of problem:
Some unfinished or invalid changes cause the Guided Rule to reopen with a different definition.
It would be unwise to assume users will always save correct rules, therefore this should be fixed. The rule should stay the same after reopening as it was before being closed.


Version-Release number of selected component (if applicable):
BPMS 6.0 ER3


Steps to Reproduce:
1. Create a new Guided Rule.
2. Add "The following does not exist .." to the WHEN section.
3. Save, close, reopen.


Actual results:
"Any of the following are true:
	There is a then" in the Guided Editor, 
"rule "grl"
    dialect "mvel"
    when
        ( then( ) )
    then
 end"
in the source.


Expected results:
"The following does not exist (click to add patterns...):" in the Guided Editor,
"rule "grl"
    dialect "mvel"
    when
        not    then
 end"
in the source.


Additional info:

Comment 6 Toni Rikkola 2013-11-29 10:41:08 UTC
Unit tests for this.

https://github.com/droolsjbpm/drools/commit/52a7b1730

Comment 7 Mario Fusco 2013-12-02 08:46:40 UTC
Trying to unmarshall an invalid drl is more or less like trying to unmarshall a malformed xml. I could fix the provided test cases, but for sure it will be impossible to do the same for all the possible combination that an invalid drl could generate. For this reason Toni and myself agreed to save a drl, and then attempt its unmarshall when necessary, only if it compiles.

Comment 8 Toni Rikkola 2013-12-09 13:00:00 UTC
The current fix prevents the user from saving incomplete rules on "exists", "or" or "not" sections, asking the user to complete the areas marked in red (The missing fact types are red in the editor).

master: https://github.com/droolsjbpm/drools-wb/commit/79283ebab

6.0.x: https://github.com/droolsjbpm/drools-wb/commit/fc38da234

Comment 9 Zuzana Krejčová 2014-01-13 13:37:22 UTC
(In reply to Toni Rikkola from comment #8)
> The current fix prevents the user from saving incomplete rules on "exists",
> "or" or "not" sections, asking the user to complete the areas marked in red
> (The missing fact types are red in the editor).
> 
> master: https://github.com/droolsjbpm/drools-wb/commit/79283ebab
> 
> 6.0.x: https://github.com/droolsjbpm/drools-wb/commit/fc38da234

Sorry for not getting back to you earlier.

The above mentioned sections work as you say.

Could the same be done for "From [... | Accumulate | Collect | Entry point]" sections? If you don't finish these, the incomplete parts are also marked in red, but the rule can be saved anyway and the same thing happens that happened with "exists" before you fixed it.

Comment 10 Toni Rikkola 2014-01-14 11:39:46 UTC
It can and should be done.

Comment 11 Toni Rikkola 2014-03-10 11:54:46 UTC
The commits for https://bugzilla.redhat.com/show_bug.cgi?id=1012553 improve model validation when saving and actually cover the from/accumulate/collect and entry point.

Comment 12 Toni Rikkola 2014-03-10 11:56:11 UTC
(In reply to Toni Rikkola from comment #11)
> The commits for https://bugzilla.redhat.com/show_bug.cgi?id=1012553 improve
> model validation when saving and actually cover the from/accumulate/collect
> and entry point.

Wrong link. Should be https://bugzilla.redhat.com/show_bug.cgi?id=1052269

Comment 13 Zuzana Krejčová 2014-05-22 14:30:03 UTC
"From Collect ..." is still an issue. The rests is fixed in ER2.

Comment 15 Edson Tirelli 2014-06-17 12:51:15 UTC
Adjusting the flags as the last commit from this ticket did not make 6.0.2.CR1 cut.

Comment 16 Zuzana Krejčová 2014-09-29 08:45:30 UTC
"From Collect ..." now cannot even be added to the rule without totally corrupting it. Everything below that condition simply disappears - from the editor and also from the displayed source.
The fix is at least partially working as trying to save the rule results in the expected warning.
(working with DR3)

Comment 17 Zuzana Krejčová 2014-09-29 08:46:05 UTC
Created attachment 942235 [details]
DR3 - broken editor

Comment 18 Zuzana Krejčová 2014-09-29 08:46:36 UTC
Created attachment 942236 [details]
DR3 - displayed source

Comment 19 Toni Rikkola 2014-11-20 13:49:02 UTC
(In reply to Zuzana Krejčová from comment #16)
> "From Collect ..." now cannot even be added to the rule without totally
> corrupting it. Everything below that condition simply disappears - from the
> editor and also from the displayed source.
> The fix is at least partially working as trying to save the rule results in
> the expected warning.
> (working with DR3)

Fixes for this. Now it should prevent the save if any red is shown.

master:
https://github.com/droolsjbpm/drools-wb/commit/0e82448ef

6.2.x:
https://github.com/droolsjbpm/drools-wb/commit/763d4f720