You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "yesamer (via GitHub)" <gi...@apache.org> on 2026/10/10 14:18:38 UTC

[PR] fix(kie-dmn): typeRef on tUnaryTests silently broken for DMN 1.3–1.6 since 10.2.0 [incubator-kie]

yesamer opened a new pull request, #7184:
URL: https://github.com/apache/incubator-kie/pull/7184

   ## Fix `typeRef` on `tUnaryTests` broken for DMN 1.3–1.6 in 10.2.0
   
   ### Problem
   
   Models with `typeRef` on `<inputValues>` (valid per the DMN 1.3–1.6 XSD) fail to load on the 10.2.0 engine with:
   
   ```
   UnsupportedOperationException: Not on DMN v1.2
   ```
   
   The marshaller swallows the exception, `Definitions` comes back `null`, and the build then fails with:
   
   ```
   NullPointerException: Cannot invoke "Definitions.getNamespace()" because "definitions" is null
   ```
   
   The KIE DMN editor (10.1) writes `typeRef` on `<inputValues>` whenever a user sets a column type in the side panel, so **models authored in the 10.1 editor stop loading on the 10.2 engine**.
   
   ### Root cause
   
   The 10.2.0 refactor ([kie-issues#853](https://github.com/apache/incubator-kie-issues/issues/853)) collapsed `v1_3`–`v1_6` `TUnaryTests` onto a shared `AbstractTUnaryTests`. That class added throwing overrides of `getTypeRef`/`setTypeRef` to guard DMN 1.1/1.2, but those overrides also fired for every newer version.
   
   The DMN 1.3 XSD is unambiguous:
   
   ```xml
   <xsd:complexType name="tUnaryTests">
       <xsd:complexContent>
           <xsd:extension base="tExpression">
   ```
   
   `tUnaryTests` extends `tExpression` from DMN 1.3 onwards, so `typeRef` is schema-valid on any `tUnaryTests` element (`<inputValues>`, `<outputValues>`, `<allowedValues>`) in DMN 1.3–1.6.
   
   ### Fix
   
   - **`AbstractTUnaryTests`** — remove the throwing `getTypeRef`/`setTypeRef` overrides. All versions now inherit the real `typeRef` field from `AbstractTExpression`.
   - **`v1_2/TUnaryTests`** — add throwing overrides here (mirrors `v1_1/TUnaryTests`, which already had its own).
   - **`TUnaryTestsTest`** — expanded to cover all six concrete versions: throws on v1.1 and v1.2; round-trips correctly on v1.3, v1.4, v1.5, and v1.6.
   - **`DMNEvaluatorCompilerTest`** — end-to-end regression test loading the original reproducer model via `DMNRuntimeBuilder`, asserting it produces no errors.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] fix(kie-dmn): typeRef on tUnaryTests silently broken for DMN 1.3–1.6 since 10.2.0 [incubator-kie]

Posted by "gitgabrio (via GitHub)" <gi...@apache.org>.
gitgabrio merged PR #7184:
URL: https://github.com/apache/incubator-kie/pull/7184


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] fix(kie-dmn): typeRef on tUnaryTests silently broken for DMN 1.3–1.6 since 10.2.0 [incubator-kie]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7184:
URL: https://github.com/apache/incubator-kie/pull/7184#discussion_r4238261688


##########
kie-dmn/kie-dmn-backend/src/test/java/org/kie/dmn/backend/marshalling/v1_6/UnmarshalMarshalTest.java:
##########
@@ -106,6 +106,11 @@ void testv16_filter() throws Exception {
         testRoundTripV16("org/kie/dmn/backend/marshalling/v1_6/", "sampleFilter.dmn");
     }
 
+    @Test
+    void testv16_inputValuesTypeRef() throws Exception {
+        testRoundTripV16("org/kie/dmn/backend/marshalling/v1_6/", "inputValuesTypeRef.dmn");

Review Comment:
   The v1.3–v1.5 `ExpressionConverter` implementations were changed independently, but this regression test executes only the v1.6 marshaller. The model tests do not cover XML serialization, so an earlier-version converter could still drop `typeRef` unnoticed. Please add schema-valid round-trip coverage for DMN 1.3, 1.4, and 1.5 (or equivalent parameterized cross-version coverage).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] fix(kie-dmn): typeRef on tUnaryTests silently broken for DMN 1.3–1.6 since 10.2.0 [incubator-kie]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7184:
URL: https://github.com/apache/incubator-kie/pull/7184#discussion_r4237918522


##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNEvaluatorCompilerTest.java:
##########
@@ -192,6 +192,21 @@ void testGetEvaluatorIdentifier() {
         assertThat(elseEvaluatorIdentifier).isEqualTo(elseIdentifier);
     }
 
+    /**
+     * Regression test: DMN 1.6 models with typeRef on inputValues (as written by the KIE DMN editor 10.1)
+     * must load without UnsupportedOperationException from AbstractTUnaryTests.setTypeRef.
+     * See: https://github.com/apache/incubator-kie-issues/issues/...

Review Comment:
   The placeholder URL does not identify the regression and points to a different repository. Link the issue closed by this PR so this test remains traceable.



##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNEvaluatorCompilerTest.java:
##########
@@ -192,6 +192,21 @@ void testGetEvaluatorIdentifier() {
         assertThat(elseEvaluatorIdentifier).isEqualTo(elseIdentifier);
     }
 
+    /**
+     * Regression test: DMN 1.6 models with typeRef on inputValues (as written by the KIE DMN editor 10.1)
+     * must load without UnsupportedOperationException from AbstractTUnaryTests.setTypeRef.
+     * See: https://github.com/apache/incubator-kie-issues/issues/...
+     */
+    @Test
+    void inputValuesWithTypeRefLoadsOnDMNv1_6() {
+        Resource resource = ResourceFactory.newClassPathResource("valid_models/DMNv1_6/inputValuesTypeRef.dmn");
+        DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults().buildConfiguration()
+                .fromResources(Collections.singletonList(resource)).getOrElseThrow(RuntimeException::new);
+        assertThat(dmnRuntime).isNotNull();
+        assertThat(dmnRuntime.getModels()).hasSize(1);
+        assertThat(dmnRuntime.getModels().get(0).hasErrors()).isFalse();

Review Comment:
   This regression test stops after unmarshalling, but the fix leaves serialization broken: every DMN 1.3–1.6 `ExpressionConverter.writeAttributes` still excludes `UnaryTests`, so marshalling this loaded model silently drops the schema-valid `typeRef`. Please update those versioned converters to emit `typeRef` for unary tests and add an XML unmarshal/marshal round-trip assertion; keep the exclusion only for DMN 1.1/1.2.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] fix(kie-dmn): typeRef on tUnaryTests silently broken for DMN 1.3–1.6 since 10.2.0 [incubator-kie]

Posted by "yesamer (via GitHub)" <gi...@apache.org>.
yesamer commented on PR #7184:
URL: https://github.com/apache/incubator-kie/pull/7184#issuecomment-6098438185

   //cc @tpolaske


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] fix(kie-dmn): typeRef on tUnaryTests silently broken for DMN 1.3–1.6 since 10.2.0 [incubator-kie]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7184:
URL: https://github.com/apache/incubator-kie/pull/7184#discussion_r4237957162


##########
kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_3/xstream/ExpressionConverter.java:
##########
@@ -48,7 +47,7 @@ protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
         super.writeAttributes(writer, parent);
         Expression e = (Expression) parent;
         
-        if (!(e instanceof UnaryTests) && e.getTypeRef() != null) {
+        if (e.getTypeRef() != null) {

Review Comment:
   This changes the independent DMN 1.3 marshaller, but the added backend round-trip test exercises only the v1.6 converter. `TUnaryTestsTest` covers the model getter/setter, so it would still pass if v1.3 serialization dropped `typeRef`. Add a v1.3 round-trip fixture/test that verifies the attribute survives unmarshalling and marshalling.



##########
kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_4/xstream/ExpressionConverter.java:
##########
@@ -48,7 +47,7 @@ protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
         super.writeAttributes(writer, parent);
         Expression e = (Expression) parent;
         
-        if (!(e instanceof UnaryTests) && e.getTypeRef() != null) {
+        if (e.getTypeRef() != null) {

Review Comment:
   This changes the independent DMN 1.4 marshaller, but the added backend round-trip test exercises only the v1.6 converter. The model-level test cannot detect this converter continuing to omit `typeRef`, so add a v1.4 round-trip fixture/test that verifies the attribute is preserved.



##########
kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExpressionConverter.java:
##########
@@ -48,7 +47,7 @@ protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
         super.writeAttributes(writer, parent);
         Expression e = (Expression) parent;
         
-        if (!(e instanceof UnaryTests) && e.getTypeRef() != null) {
+        if (e.getTypeRef() != null) {

Review Comment:
   This changes the independent DMN 1.5 marshaller, but the added backend round-trip test exercises only the v1.6 converter. The model-level test cannot detect this converter continuing to omit `typeRef`, so add a v1.5 round-trip fixture/test that verifies the attribute is preserved.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org