Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/browser/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
});
3 changes: 1 addition & 2 deletions src/main-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down