fix(renderer): preserve desktop result errors
This commit is contained in:
1 parent
7793f2da35
commit
bbf7ab91e2
3 files changed
+47
-4
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { DesktopResult } from "@shared/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
@@ -5,6 +7,7 @@ import {
|
||||
describeDesktopError,
|
||||
DesktopError,
|
||||
formatDesktopResultError,
|
||||
formatDesktopResultNotice,
|
||||
normalizeAppErrorNotice,
|
||||
unwrap,
|
||||
} from "../../src/renderer/lib/desktop";
|
||||
@@ -44,6 +47,33 @@ describe("renderer desktop error notices", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps checkout races actionable for retry", () => {
|
||||
const notice = formatDesktopResultNotice({
|
||||
code: "CHECKOUT_RACE_LOST",
|
||||
message: "Another run claimed this task first.",
|
||||
});
|
||||
|
||||
expect(notice).toEqual({
|
||||
code: "CHECKOUT_RACE_LOST",
|
||||
message: "Another run claimed this task first.",
|
||||
actionHint: "Refresh tasks, review the current assignee, then try again.",
|
||||
});
|
||||
});
|
||||
|
||||
it("suppresses shutdown noise from DesktopResult notices", () => {
|
||||
expect(formatDesktopResultNotice({
|
||||
code: "APP_SHUTTING_DOWN",
|
||||
message: "The app is shutting down.",
|
||||
})).toBeNull();
|
||||
});
|
||||
|
||||
it("keeps App cancelRun on the DesktopResult envelope path", () => {
|
||||
const source = readFileSync(join(process.cwd(), "src/renderer/App.tsx"), "utf8");
|
||||
|
||||
expect(source).not.toContain("unwrap(await window.agentCompany.cancelRun");
|
||||
expect(source).toContain("formatDesktopResultNotice(result.error)");
|
||||
});
|
||||
|
||||
it("describes thrown DesktopError instances with their original code", () => {
|
||||
const notice = describeDesktopError(new DesktopError("TASK_UNASSIGNED", "Assign an agent before starting a run."));
|
||||
|
||||
|
||||
Reference in new issue
Block a user