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.
This commit is contained in:
Jinwoo Hong
2026-11-09 22:39:18 -05:00
committed by GitHub
parent fa2a622f9f
commit c19f12804a
2 changed files with 7 additions and 0 deletions
@@ -29,3 +29,7 @@ export function bumpProviderRuntimeSessionGeneration(): number {
providerRuntimeSessionGeneration += 1
return providerRuntimeSessionGeneration
}
export function resetProviderRuntimeSessionGenerationForTests(): void {
providerRuntimeSessionGeneration = 0
}
@@ -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<AppState, [], []>, check: boolean) =>
withEditorBufferRecords(withAgentConversationRetention(creator), check)
@@ -66,6 +67,8 @@ const withTestStorePolicies = (creator: StateCreator<AppState, [], []>, check: b
export function createTestStore(
isClaudeAgent: Parameters<typeof createTerminalSlice>[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<AppState>()(
withTestStorePolicies(