Copilot commented on code in PR #7688:
URL: https://github.com/apache/texera/pull/7688#discussion_r3788500326
##########
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:
This assertion pins an exact trailing space in the debug command ("clear "),
which makes the test unnecessarily brittle (e.g., if the implementation is
later normalized to "clear" with no trailing whitespace). Prefer matching the
intended shape (a clear command with no id) rather than exact whitespace.
--
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]