diff --git a/src/browser/api.test.ts b/src/browser/api.test.ts index 12503230b..9be68459a 100644 --- a/src/browser/api.test.ts +++ b/src/browser/api.test.ts @@ -132,4 +132,25 @@ describe("Browser API invokeIPC", () => { error: structuredError, }); }); + + test("should handle failed Result without error property", async () => { + // This tests the fix for the force-deletion bug where results like + // { success: false } (without error property) weren't being passed through correctly + const mockFetch = createMockFetch({ + success: false, + }); + + const invokeIPC = createInvokeIPC(mockFetch); + + const result = await invokeIPC<{ success: boolean; error?: string }>( + "WORKSPACE_REMOVE", + "test-workspace", + { force: false } + ); + + // Should return the failure result as-is, even without error property + expect(result).toEqual({ + success: false, + }); + }); }); diff --git a/src/main-server.ts b/src/main-server.ts index d119c421e..626371be9 100644 --- a/src/main-server.ts +++ b/src/main-server.ts @@ -36,8 +36,7 @@ class HttpIpcMainAdapter { result && typeof result === "object" && "success" in result && - result.success === false && - "error" in result + result.success === false ) { // Pass through failed Result to preserve error structure res.json(result);