This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-9585-bf6bf9fc3a75f540deb6ad2392af32bcbca51295
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 9647f5873fcbefb52eb0a29bfd8298e8a1152e9d
Author: Matthew B. <[email protected]>
AuthorDate: Sat Nov 21 02:00:30 2026 +0000

    refactor(frontend): deep-compare operator properties in the version diff 
(#9585)
    
    ### What changes were proposed in this PR?
    - getOperatorsDifference now compares operator properties with lodash
    isEqual over the union of both operators' property keys, so object- and
    array-valued properties are only highlighted when they actually change
    and a property present only in the newer version is detected as added.
    ### Any related issues, documentation, discussions?
    Closes: #9582
    ### How was this PR tested?
    - Run `cd frontend && ./node_modules/.bin/ng test --watch=false
    
--include='src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts'`;
    expect the suite green, including new cases that deeply-equal
    object/array properties are not flagged, a changed nested value is
    flagged, and a property present only in the second operator is flagged.
    - Open a workflow version comparison for an operator with an object- or
    array-valued property and confirm identical properties are no longer
    highlighted.
    ### Was this PR authored or co-authored using generative AI tooling?
    Co-authored with Claude Opus 4.8 in compliance with ASF
---
 .../workflow-version.service.spec.ts               | 23 ++++++++++++++++++++++
 .../workflow-version/workflow-version.service.ts   | 13 ++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git 
a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts
 
b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts
index aa29f45590..2f1cb16720 100644
--- 
a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts
+++ 
b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts
@@ -566,4 +566,27 @@ describe("WorkflowVersionService", () => {
       expect(await pending).toBe(99);
     });
   });
+
+  describe("getOperatorsDifference", () => {
+    const op = (operatorProperties: Record<string, any>, operatorVersion = 
"1") =>
+      buildOperator({ operatorProperties, operatorVersion });
+
+    it("does not flag object or array properties that are deeply equal", () => 
{
+      const diff = service.getOperatorsDifference(
+        op({ list: [1, 2], cfg: { x: 1 } }),
+        op({ list: [1, 2], cfg: { x: 1 } })
+      );
+      expect(diff.size).toBe(0);
+    });
+
+    it("flags a property whose nested value changed", () => {
+      const diff = service.getOperatorsDifference(op({ cfg: { x: 1 } }), op({ 
cfg: { x: 2 } }));
+      expect(diff.has("cfg")).toBe(true);
+    });
+
+    it("flags a property present only in the second operator", () => {
+      const diff = service.getOperatorsDifference(op({}), op({ extra: 5 }));
+      expect(diff.has("extra")).toBe(true);
+    });
+  });
 });
diff --git 
a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts
 
b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts
index cf2db135ee..c44c343071 100644
--- 
a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts
+++ 
b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts
@@ -218,13 +218,18 @@ export class WorkflowVersionService {
 
   public getOperatorsDifference(operator1: OperatorPredicate, operator2: 
OperatorPredicate) {
     const difference: Map<String, String> = new Map();
-    for (const property of Object.keys(operator1.operatorProperties)) {
-      if (operator1.operatorProperties[property] != 
operator2.operatorProperties[property]) {
-        difference.set(property, "outline: 3px solid rgb(255, 118, 20); 
transition: 0.3s ease-in-out outline;");
+    const highlight = "outline: 3px solid rgb(255, 118, 20); transition: 0.3s 
ease-in-out outline;";
+    const properties = new Set([
+      ...Object.keys(operator1.operatorProperties),
+      ...Object.keys(operator2.operatorProperties),
+    ]);
+    for (const property of properties) {
+      if (!isEqual(operator1.operatorProperties[property], 
operator2.operatorProperties[property])) {
+        difference.set(property, highlight);
       }
     }
     if (operator1.operatorVersion != operator2.operatorVersion) {
-      difference.set("operatorVersion", "outline: 3px solid rgb(255, 118, 20); 
transition: 0.3s ease-in-out outline;");
+      difference.set("operatorVersion", highlight);
     }
     return difference;
   }

Reply via email to