From 32bb439e7e80794847735329af77ab58bda18e50 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 22 Oct 2025 23:39:13 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Fix=20browser=20API=20handli?= =?UTF-8?q?ng=20of=20failed=20Results=20without=20error=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main-server's HttpIpcMainAdapter was checking for both 'success === false' AND 'error in result' before passing through failed Results. This caused Results like { success: false } to be incorrectly wrapped as { success: true, data: { success: false } }, breaking error handling in the frontend. The fix removes the 'error in result' requirement, allowing any Result with 'success: false' to be passed through correctly. This fixes the force-deletion scenario where workspace removal errors weren't being properly communicated to the frontend. Added test coverage for Results without error property. --- src/browser/api.test.ts | 22 ++++++++++++++++++++++ src/main-server.ts | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/browser/api.test.ts b/src/browser/api.test.ts index 12503230b..48ebcba45 100644 --- a/src/browser/api.test.ts +++ b/src/browser/api.test.ts @@ -132,4 +132,26 @@ 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); From 03e0f2f0117ee5e60797482aa9b0577dd31ef348 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 22 Oct 2025 23:42:23 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20Fix=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/browser/api.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/browser/api.test.ts b/src/browser/api.test.ts index 48ebcba45..9be68459a 100644 --- a/src/browser/api.test.ts +++ b/src/browser/api.test.ts @@ -153,5 +153,4 @@ describe("Browser API invokeIPC", () => { success: false, }); }); - });