From a899bc817109d02189b72cf50eedf8c1d0edee05 Mon Sep 17 00:00:00 2001 From: Kunwoo Park Date: Thu, 28 May 2026 18:02:12 -0700 Subject: [PATCH 1/2] fix: clear red change-line brackets when restoring a workflow version highlightOpVersionDiff draws red brackets on the neighbors of deleted operators, but unhighlightOpVersionDiff only reset the boundary fills of added/modified operators and never the bracket strokes. On close the brackets vanished because reloadWorkflow rebuilds the paper, but revertToVersion does not reload, so the red change line persisted after restore. Reset the deleted-neighbor brackets to transparent so they are cleared on restore as well. Fixes #3043 Fixes #3828 --- .../workflow-version.service.spec.ts | 27 +++++++++++++++++++ .../workflow-version.service.ts | 14 ++++++++++ 2 files changed, 41 insertions(+) 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 85c9016500f..f911b6ea1a1 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 @@ -310,6 +310,33 @@ describe("WorkflowVersionService", () => { }); }); + // ─── unhighlightOpVersionDiff ───────────────────────────────────────────── + + describe("unhighlightOpVersionDiff", () => { + it("resets the boundary fill of added and modified ops to transparent", () => { + service.unhighlightOpVersionDiff({ modified: ["m"], added: ["a"], deleted: [] }); + + expect(paperGetModelById).toHaveBeenCalledWith("m"); + expect(paperGetModelById).toHaveBeenCalledWith("a"); + expect(modelAttr).toHaveBeenCalledWith("rect.boundary/fill", "rgba(0,0,0,0)"); + }); + + it("resets the red brackets drawn around the neighbors of deleted ops", () => { + const tempWorkflow = buildWorkflow({ + content: buildContent({ + operators: [buildOperator({ operatorID: "alive-left" }), buildOperator({ operatorID: "alive-right" })], + links: [buildLink("dead", "alive-right"), buildLink("alive-left", "dead")], + }), + }); + actionSpy.getTempWorkflow.mockReturnValue(tempWorkflow); + + service.unhighlightOpVersionDiff({ modified: [], added: [], deleted: ["dead"] }); + + expect(modelAttr).toHaveBeenCalledWith("path.left-boundary/stroke", "rgba(0,0,0,0)"); + expect(modelAttr).toHaveBeenCalledWith("path.right-boundary/stroke", "rgba(0,0,0,0)"); + }); + }); + // ─── getWorkflowsDifference / getOperatorsDifference ────────────────────── describe("getWorkflowsDifference", () => { 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 0c31b4edf11..1b527e35cb9 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 @@ -271,6 +271,20 @@ export class WorkflowVersionService { for (const id of differentOpIDsList.added.concat(differentOpIDsList.modified)) { this.highlightOpBoundary(id, "0,0,0,0"); } + + if (differentOpIDsList.deleted.length > 0) { + const tempWorkflow = this.workflowActionService.getTempWorkflow(); + if (tempWorkflow != undefined) { + for (const link of tempWorkflow.content.links) { + if (differentOpIDsList.deleted.includes(link.source.operatorID) && link.target.operatorID != undefined) { + this.highlightOpBracket(link.target.operatorID, "0,0,0,0", "left-"); + } + if (differentOpIDsList.deleted.includes(link.target.operatorID) && link.source.operatorID != undefined) { + this.highlightOpBracket(link.source.operatorID, "0,0,0,0", "right-"); + } + } + } + } this.operatorPropertyDiff = {}; } From f6ad88ac60f1c1416fb6d19b9bb5a6e386833317 Mon Sep 17 00:00:00 2001 From: Kunwoo Park Date: Thu, 28 May 2026 18:09:53 -0700 Subject: [PATCH 2/2] test: cover the missing-temp-workflow branch in unhighlightOpVersionDiff --- .../workflow-version/workflow-version.service.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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 f911b6ea1a1..659af0feb2b 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 @@ -335,6 +335,14 @@ describe("WorkflowVersionService", () => { expect(modelAttr).toHaveBeenCalledWith("path.left-boundary/stroke", "rgba(0,0,0,0)"); expect(modelAttr).toHaveBeenCalledWith("path.right-boundary/stroke", "rgba(0,0,0,0)"); }); + + it("skips bracket clearing when the temp workflow is missing", () => { + actionSpy.getTempWorkflow.mockReturnValue(undefined); + + service.unhighlightOpVersionDiff({ modified: [], added: [], deleted: ["dead"] }); + + expect(getMainJointPaper).not.toHaveBeenCalled(); + }); }); // ─── getWorkflowsDifference / getOperatorsDifference ──────────────────────