From c19f12804a0de2a90aa697a324d230b5a578c480 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:39:18 -0500 Subject: [PATCH] test: reset the provider session generation per test store (#40586) A shared test worker carried settings.test.ts's generation bumps into jira-web-client-status.test.ts, which then read local#3 instead of local#0. --- .../runtime/hosts/observations/provider-runtime-context.ts | 4 ++++ src/renderer/src/store/testing/app-store-test-fixture.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts b/src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts index ac75e604382..58dde7fa4e6 100644 --- a/src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts +++ b/src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts @@ -29,3 +29,7 @@ export function bumpProviderRuntimeSessionGeneration(): number { providerRuntimeSessionGeneration += 1 return providerRuntimeSessionGeneration } + +export function resetProviderRuntimeSessionGenerationForTests(): void { + providerRuntimeSessionGeneration = 0 +} diff --git a/src/renderer/src/store/testing/app-store-test-fixture.ts b/src/renderer/src/store/testing/app-store-test-fixture.ts index 75587a48103..09b9c3727ee 100644 --- a/src/renderer/src/store/testing/app-store-test-fixture.ts +++ b/src/renderer/src/store/testing/app-store-test-fixture.ts @@ -59,6 +59,7 @@ import '@/i18n/i18n' import { withEditorBufferRecords } from '../slices/editor/buffers/editor-buffer-record-lifecycle' import { withAgentConversationRetention } from '../slices/agent-status/agent-conversation-retention' import { TEST_REPO } from '../repos/repo.test-fixture' +import { resetProviderRuntimeSessionGenerationForTests } from '@/runtime/hosts/observations/provider-runtime-context' const withTestStorePolicies = (creator: StateCreator, check: boolean) => withEditorBufferRecords(withAgentConversationRetention(creator), check) @@ -66,6 +67,8 @@ const withTestStorePolicies = (creator: StateCreator, check: b export function createTestStore( isClaudeAgent: Parameters[3] = undefined ) { + // Why: the session generation is module state; a shared test worker would carry another file's bumps into this store. + resetProviderRuntimeSessionGenerationForTests() // Why the record middleware: views of one file share a record only through it, as in the app. return create()( withTestStorePolicies(