Skip to content
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

kie-issues#1466: A Decision Table with a single output column shouldn't have a name #2834

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Kusuma04-dev
Copy link
Contributor

closes apache/incubator-kie-issues#1466 - A Decision Table with a single output column shouldn't have a name

Before fix:
Screenshot 2025-01-03 at 7 07 52 PM
Screenshot 2025-01-03 at 7 08 28 PM

After fix:
Screenshot 2025-01-03 at 7 09 20 PM
Screenshot 2025-01-03 at 7 09 46 PM

@danielzhe
Copy link
Contributor

As discussed in the private chat, I think this PR is incorrect, but I'll clarify the issue better.

@jomarko jomarko requested review from danielzhe and jomarko January 6, 2025 09:12
Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kusuma04-dev thank you for the PR. Currently, the failing tests are with high probability related to code changes you have introduced. But we need to wait for @danielzhe feedback before we fix the tests. It seems that @danielzhe will propose different solution and that may mean different or no tests failing.

@kbowers-ibm kbowers-ibm self-requested a review January 6, 2025 09:29
@danielzhe
Copy link
Contributor

@jomarko Yeah, we're working on it.

@danielzhe danielzhe added pr: DO NOT MERGE Draft PR, not ready for merging area:dmn pr: wip PR is still under development labels Jan 6, 2025
@Kusuma04-dev
Copy link
Contributor Author

Hi,
I did few changes in the code, could you please check and let me know?

@Kusuma04-dev Kusuma04-dev requested a review from jomarko January 8, 2025 04:11
Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for changes @Kusuma04-dev

UI

I think we are fine on the UI side. There I see this behavior

Single output column

Is represented with single level column header. This column header informs about the decision ndoe name and the decision node data type.

Multiple output columns

Are represented by two level column header

| decision node name |
| - -col A - | - - col B - |

Backend

There I think we have still the issue that name attribute is present in the output tag. See:

  <dmn:decision name="bbb" id="_055202A8-C02C-4A75-AE67-CFA23080D2B3">
    <dmn:variable name="bbb" id="_E77AD5FF-91D7-4E03-84D8-87D82A8E002C" typeRef="boolean" />
    <dmn:decisionTable id="_31E8BF8C-BE7E-456C-B9D4-0F42D9B11572" typeRef="boolean" hitPolicy="UNIQUE" label="bbb">
      <dmn:input id="_A0628B74-A903-4833-B4FC-CD0DA4688E48">
        <dmn:inputExpression id="_2678C2CE-521B-4032-83F2-1760A14E20CB" typeRef="Any">
          <dmn:text>aaa</dmn:text>
        </dmn:inputExpression>
      </dmn:input>
      <dmn:output id="_2FB820B3-99DE-4709-B2CB-F88B196C5063" name="Output-2" />
      <dmn:annotation name="Annotations" />
      <dmn:rule id="_BF8CA92E-8BDA-43AB-AAD6-8CE7510F5D08">
        <dmn:inputEntry id="_92915712-1449-4D81-8354-43EC22F18B7A">
          <dmn:text>-</dmn:text>
        </dmn:inputEntry>
        <dmn:outputEntry id="_96A3DC02-EBD9-49A4-B9D9-43C2AD22666F">
          <dmn:text>false</dmn:text>
        </dmn:outputEntry>
        <dmn:annotationEntry>
          <dmn:text>// Your annotations here</dmn:text>
        </dmn:annotationEntry>
      </dmn:rule>
    </dmn:decisionTable>
  </dmn:decision>

That is source of:
Screenshot 2025-01-08 121143

and my understanding is name="Output-2" should not be produced in the source XML.

@danielzhe danielzhe removed pr: DO NOT MERGE Draft PR, not ready for merging pr: wip PR is still under development labels Jan 8, 2025
@Kusuma04-dev Kusuma04-dev requested a review from jomarko January 9, 2025 04:47
Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updates, some comments to code from my side. I postponed a manual check as there is a chance the code will change after posting my review.

@Kusuma04-dev Kusuma04-dev requested a review from jomarko January 9, 2025 11:52
@tiagobento tiagobento changed the title kie-issues#1466-A Decision Table with a single output column shouldn't have a name kie-issues#1466: A Decision Table with a single output column shouldn't have a name Jan 9, 2025
@yesamer
Copy link
Contributor

yesamer commented Jan 9, 2025

@Kusuma04-dev Can you please synchronize this PR with main? Thx

@danielzhe
Copy link
Contributor

Thanks for your PR, @Kusuma04-dev !

I did some review and found some issues:

Having only a single output column that is hidden (the default behavior):

  1. If you add a new output column, in the DMN file, only one column is named. Both should have names in this case.
  2. If you add a new output column, one column comes with the name "Expression name". I think it should be "Output-1" and "Output-2"
  3. I got the issue that @jomarko reported above, but I'm unable to reproduce it again. 😢
  4. I noticed that I got one output with an invalid typeref (typeRef="<Undefined>").

Let me know if you need more clarification.

Video bellow:
https://github.com/user-attachments/assets/3a55cbbe-7f2f-43de-976d-483b43dee0e5

@danielzhe
Copy link
Contributor

Btw, maybe the issue 4 is not related to your PR, @Kusuma04-dev .

@Kusuma04-dev
Copy link
Contributor Author

@Kusuma04-dev Can you please synchronize this PR with main? Thx

Hi Yeser, done.

@Kusuma04-dev
Copy link
Contributor Author

Btw, maybe the issue 4 is not related to your PR, @Kusuma04-dev .

Hi Daniel,Thanks for the

Thanks for your PR, @Kusuma04-dev !

I did some review and found some issues:

Having only a single output column that is hidden (the default behavior):

  1. If you add a new output column, in the DMN file, only one column is named. Both should have names in this case.
  2. If you add a new output column, one column comes with the name "Expression name". I think it should be "Output-1" and "Output-2"
  3. I got the issue that @jomarko reported above, but I'm unable to reproduce it again. 😢
  4. I noticed that I got one output with an invalid typeref (typeRef="").

Let me know if you need more clarification.

Video bellow: https://github.com/user-attachments/assets/3a55cbbe-7f2f-43de-976d-483b43dee0e5

Hi Daniel,Thanks for the review .I have modified the validation now and the above issues are resolved.Can you please confirm once.

Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @danielzhe @Kusuma04-dev for the discussion and updates. I think there is still some small inconsistency that we should address.

Please follow my steps, when I create single output decision table:
Screenshot 2025-01-13 105607

then it contains this code snippet:

<output id="_781CCB4D-6421-4D4B-B15F-43FF9AE7CA3E" />

There is no typeRef attribute 🟠

Then I add a output column:
Screenshot 2025-01-13 105653

then there is code snippet:

      <output id="_781CCB4D-6421-4D4B-B15F-43FF9AE7CA3E" name="Output-1" typeRef="boolean" />
      <output id="_80267764-71E9-4444-A786-904ADBA52E04" name="Output-2" typeRef="number" />

that has both name and typeRef 🟢

and when I delete one output column:

Screenshot 2025-01-13 105707
then there is code snippet:

      <output id="_80267764-71E9-4444-A786-904ADBA52E04" typeRef="number" />

that has typeRef 🟠

the places I mark with 🟠 are inconsistent. Both are decision tables with single output column, however once there is typeRef and once there is not typeRef.

@Kusuma04-dev
Copy link
Contributor Author

Thank you @danielzhe @Kusuma04-dev for the discussion and updates. I think there is still some small inconsistency that we should address.

Please follow my steps, when I create single output decision table: Screenshot 2025-01-13 105607

then it contains this code snippet:

<output id="_781CCB4D-6421-4D4B-B15F-43FF9AE7CA3E" />

There is no typeRef attribute 🟠

Then I add a output column: Screenshot 2025-01-13 105653

then there is code snippet:

      <output id="_781CCB4D-6421-4D4B-B15F-43FF9AE7CA3E" name="Output-1" typeRef="boolean" />
      <output id="_80267764-71E9-4444-A786-904ADBA52E04" name="Output-2" typeRef="number" />

that has both name and typeRef 🟢

and when I delete one output column:

Screenshot 2025-01-13 105707 then there is code snippet:

      <output id="_80267764-71E9-4444-A786-904ADBA52E04" typeRef="number" />

that has typeRef 🟠

the places I mark with 🟠 are inconsistent. Both are decision tables with single output column, however once there is typeRef and once there is not typeRef.

hi @jomarko , Thank you for reviewing and noticing the issue ,
If we have selected typeref when there is single output column then we can see typeref also for it .If we have two output columns with selected typrefs then will have typerefs also and after deleting one column , i did reset for typeref also now so that if we select typeref only we will get otherwise we won't.

@Kusuma04-dev Kusuma04-dev requested a review from jomarko January 13, 2025 10:44
Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates.

@kbowers-ibm
Copy link
Contributor

Thanks for the changes @Kusuma04-dev , the tests look good! I've been testing it out locally, and noticed that the Column Type is still there (but disabled). Wasn't the final decision to remove it, similar to column name?

@Kusuma04-dev
Copy link
Contributor Author

Thanks for the changes @Kusuma04-dev , the tests look good! I've been testing it out locally, and noticed that the Column Type is still there (but disabled). Wasn't the final decision to remove it, similar to column name?

Hi Kennedy,Thanks for the review.Yes i have removed column type as well.

Copy link
Contributor

@kbowers-ibm kbowers-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Kusuma04-dev,
Tested and everything is looking great! Just one minor nitpick regarding the tests, and then it will be ready to merge.

@@ -673,7 +665,7 @@ test.describe("Decision Table - Cells Data Type - Constraint", () => {
await expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
/^\s*rangeType\s$/i
);
await expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*rangeType\s$/i);
await expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
Copy link
Contributor

@kbowers-ibm kbowers-ibm Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can just be deleted instead of changed from
getColumnDataType to getDataType.
It's preceded by

await expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
          /^\s*rangeType\s$/i
        );

And due to the nature of the 2 functions it's just checking the same thing twice in a row.
This happens in multiple test cases, so please update all of them accordingly! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getExpressionDataType())

Hi Kennedy,Thanks for the review .I did the changes.

Copy link
Contributor

@kbowers-ibm kbowers-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kusuma, LGTM! @jomarko given all the changes would you like to rereview before merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A Decision Table with a single output column shouldn't have a name
5 participants