From c7fa7f5285618e28636624b33a4e5df9d6b3fb8b Mon Sep 17 00:00:00 2001 From: can1357 Date: Wed, 1 Jul 2026 00:52:50 +0200 Subject: [PATCH] test(coding-agent): reset history storage between test runs - Reset the HistoryStorage singleton instance in the afterEach hooks of multiple issue reproduction tests. --- packages/coding-agent/test/issue-2510-repro.test.ts | 2 ++ .../coding-agent/test/issue-3656-shake-during-stream.test.ts | 2 ++ packages/coding-agent/test/issue-816-repro.test.ts | 2 ++ packages/coding-agent/test/issue-927-repro.test.ts | 2 ++ 4 files changed, 8 insertions(+) diff --git a/packages/coding-agent/test/issue-2510-repro.test.ts b/packages/coding-agent/test/issue-2510-repro.test.ts index 1566ad36c..2856b93e7 100644 --- a/packages/coding-agent/test/issue-2510-repro.test.ts +++ b/packages/coding-agent/test/issue-2510-repro.test.ts @@ -7,6 +7,7 @@ import { InteractiveMode } from "@oh-my-pi/pi-coding-agent/modes/interactive-mod import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { TempDir } from "@oh-my-pi/pi-utils"; @@ -56,6 +57,7 @@ describe("issue #2510 — /plan toggles plan → plan_paused → none", () => { afterEach(async () => { vi.restoreAllMocks(); mode?.stop(); + HistoryStorage.resetInstance(); await session?.dispose(); authStorage?.close(); tempDir?.removeSync(); diff --git a/packages/coding-agent/test/issue-3656-shake-during-stream.test.ts b/packages/coding-agent/test/issue-3656-shake-during-stream.test.ts index e74aeeec7..d5ce2bb5e 100644 --- a/packages/coding-agent/test/issue-3656-shake-during-stream.test.ts +++ b/packages/coding-agent/test/issue-3656-shake-during-stream.test.ts @@ -11,6 +11,7 @@ import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { TempDir } from "@oh-my-pi/pi-utils"; @@ -89,6 +90,7 @@ describe("issue #3656 /shake mid-stream preserves the in-flight assistant turn", afterEach(async () => { mode?.stop(); + HistoryStorage.resetInstance(); vi.restoreAllMocks(); await session?.dispose(); authStorage?.close(); diff --git a/packages/coding-agent/test/issue-816-repro.test.ts b/packages/coding-agent/test/issue-816-repro.test.ts index 84c5f1a25..b17345354 100644 --- a/packages/coding-agent/test/issue-816-repro.test.ts +++ b/packages/coding-agent/test/issue-816-repro.test.ts @@ -7,6 +7,7 @@ import { InteractiveMode } from "@oh-my-pi/pi-coding-agent/modes/interactive-mod import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { TempDir } from "@oh-my-pi/pi-utils"; @@ -49,6 +50,7 @@ describe("issue #816 — plan mode pendingModelSwitch leak", () => { afterEach(async () => { vi.restoreAllMocks(); mode?.stop(); + HistoryStorage.resetInstance(); await session?.dispose(); authStorage?.close(); tempDir?.removeSync(); diff --git a/packages/coding-agent/test/issue-927-repro.test.ts b/packages/coding-agent/test/issue-927-repro.test.ts index 25fa740dd..f65acd364 100644 --- a/packages/coding-agent/test/issue-927-repro.test.ts +++ b/packages/coding-agent/test/issue-927-repro.test.ts @@ -8,6 +8,7 @@ import { InteractiveMode } from "@oh-my-pi/pi-coding-agent/modes/interactive-mod import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { TempDir } from "@oh-my-pi/pi-utils"; @@ -52,6 +53,7 @@ describe("issue #927 optimistic pending spinner", () => { afterEach(async () => { mode?.stop(); + HistoryStorage.resetInstance(); vi.restoreAllMocks(); await session?.dispose(); authStorage?.close();