From b4c16b1b3bdf2fed5931f8ccc0712ff81237e87d Mon Sep 17 00:00:00 2001 From: yiliang114 Date: Tue, 25 Aug 2026 16:23:19 +0800 Subject: [PATCH] test(cli): teach session-swap telemetry fakes the /branch title prerequisites #9764 taught /branch to read the outgoing recorder's custom title and the source session's display name before forking. The #9844 regression suite's fake environment predates that and lacks both methods, so on main every /branch scenario throws before the fork and three tests fail. Complete the fakes; no production change. --- packages/cli/src/ui/hooks/session-swap-telemetry.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/cli/src/ui/hooks/session-swap-telemetry.test.ts b/packages/cli/src/ui/hooks/session-swap-telemetry.test.ts index 91b45143eb0..c143305b3a4 100644 --- a/packages/cli/src/ui/hooks/session-swap-telemetry.test.ts +++ b/packages/cli/src/ui/hooks/session-swap-telemetry.test.ts @@ -183,6 +183,7 @@ function makeFakeEnv() { return { filePath: `/tmp/${to}.jsonl`, copiedCount: 2 }; }), loadSession: async (id: string) => sessionServiceMocks.sessions.get(id), + getSessionDisplayName: vi.fn().mockResolvedValue(undefined), // Realistic like SessionService.removeSession (deletes the fork JSONL): // the branch hook calls it in exactly the failure path these tests // drive (forkCreated && !uiSwapped), so the fork must not survive in @@ -209,6 +210,7 @@ function makeFakeEnv() { finalize: vi.fn(), flush: vi.fn().mockResolvedValue(undefined), rebuildTurnBoundaries: vi.fn(), + getCurrentCustomTitle: vi.fn().mockReturnValue(undefined), }), getSessionService: () => sessionService, getGoalRuntimeReady: vi.fn().mockResolvedValue({}),