mengw15 commented on code in PR #7688:
URL: https://github.com/apache/texera/pull/7688#discussion_r3788521750


##########
frontend/src/app/workspace/service/operator-debug/udf-debug.service.spec.ts:
##########
@@ -464,4 +464,170 @@ describe("UdfDebugServiceSpec", () => {
     expect(debugState.get("1")).toEqual({ breakpointId: 1, condition: "x > 5", 
hit: false });
     expect(debugState.has("2")).toBe(false);
   });
+
+  // Builds the (Pdb) DEBUGGER console event shape that every handler below 
filters on.
+  function pdbEvent(title: string, overrides: Partial<ConsoleMessage> = {}): 
ConsoleUpdateEvent {
+    return {
+      operatorId: mockPythonUDFPredicate.operatorID,
+      messages: [
+        {
+          workerId: stubWorker,
+          timestamp: { nanos: 0, seconds: 0 },
+          title,
+          source: "(Pdb)",
+          msgType: { name: "DEBUGGER" },
+          message: "",
+          ...overrides,
+        },
+      ],
+    };
+  }
+
+  it("should not send a condition for a line that has no breakpoint", () => {
+    // The condition differs from the empty default, so the early return is 
passed and
+    // the `isDefined(breakpointInfo)` guard is the one that stops the update.
+    const debugState = 
service.getDebugState(mockPythonUDFPredicate.operatorID);
+
+    service.doUpdateBreakpointCondition(mockPythonUDFPredicate.operatorID, 7, 
"x < 10");
+
+    expect(mockWorkflowWebsocketService.send).not.toHaveBeenCalled();
+    expect(debugState.has("7")).toBe(false);
+  });
+
+  it("should clear a breakpoint that lost its id with an empty id", () => {
+    // State a hit breakpoint is left in once pdb deleted it: still present, 
so the
+    // command is `clear`, but with no id to clear by.
+    const debugState = 
service.getDebugState(mockPythonUDFPredicate.operatorID);
+    debugState.set("10", { breakpointId: undefined, condition: "", hit: true 
});
+
+    service.doModifyBreakpoint(mockPythonUDFPredicate.operatorID, 10);
+
+    
expect(mockWorkflowWebsocketService.send).toHaveBeenCalledWith("DebugCommandRequest",
 {
+      operatorId: mockPythonUDFPredicate.operatorID,
+      workerId: stubWorker,
+      cmd: "clear ",
+    });

Review Comment:
   `clear ` is the literal payload that goes over the websocket on this path — 
the trailing space comes from the `|| ""` fallback. Asserting the exact string 
is the point: a change to that format changes what the debugger receives. Added 
a comment so it does not read as accidental.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to