Open History to see the last commit
1import { assert, describe, it } from "@effect/vitest";
2
3import { userFacingDispatchErrorMessage } from "./UserFacingErrors.ts";
4
5describe("userFacingDispatchErrorMessage", () => {
6 it("returns the deepest actionable domain error instead of generic dispatch wrappers", () => {
7 const message = userFacingDispatchErrorMessage({
8 message: "Failed to dispatch orchestration command checkpoint.rollback (command-1).",
9 cause: {
10 message: "Provider adapter failed while dispatching orchestration command command-1.",
11 cause: {
12 message:
13 "claudeAgent cannot satisfy rollback for command command-1: provider conversation rollback is unavailable",
14 },
15 },
16 });
17
18 assert.equal(
19 message,
20 "claudeAgent cannot satisfy rollback for command command-1: provider conversation rollback is unavailable",
21 );
22 });
23
24 it("uses explicit detail fields as user-facing messages", () => {
25 assert.equal(
26 userFacingDispatchErrorMessage({
27 message: "Failed to dispatch orchestration command message.dispatch (command-1).",
28 cause: {
29 detail: "Claude provider thread provider-thread-1 has no live query.",
30 },
31 }),
32 "Claude provider thread provider-thread-1 has no live query.",
33 );
34 });
35});