mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
Fix WSL stall tests to reset gate state and fake performance timer (#15414)
Reset persistent WSL transcript filesystem gate state in beforeEach to prevent prior test stalls from quarantining subsequent tests. Fake the performance timer used by the route quarantine clock so tests don't block on real time. Update affected tests to wait out the back-off window rather than advancing by zero time. Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
This commit is contained in:
@@ -27,10 +27,10 @@ import {
|
||||
} from './session-scanner-kimi-paths'
|
||||
import { readJsonObjectIfExists } from './session-scanner-values'
|
||||
import {
|
||||
resetWslTranscriptFsGateForTests,
|
||||
WSL_TRANSCRIPT_FS_ROUTE_QUARANTINE_BASE_MS,
|
||||
WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS,
|
||||
WslTranscriptFsError,
|
||||
resetWslTranscriptFsGateForTests
|
||||
WslTranscriptFsError
|
||||
} from '../native-chat/wsl-transcript-fs-gate'
|
||||
|
||||
// Identity must not change between the refused and the recovered read, or the
|
||||
|
||||
@@ -20,7 +20,10 @@ vi.mock('./session-scanner-opencode-sqlite-worker-spawn', () => ({
|
||||
}))
|
||||
|
||||
import { opencodeDiscoveries } from './session-scanner-opencode-sources'
|
||||
import { WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS } from '../native-chat/wsl-transcript-fs-gate'
|
||||
import {
|
||||
resetWslTranscriptFsGateForTests,
|
||||
WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS
|
||||
} from '../native-chat/wsl-transcript-fs-gate'
|
||||
|
||||
let releaseStall: (() => void) | undefined
|
||||
|
||||
@@ -39,6 +42,7 @@ function stalls(): Promise<never> {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
resetWslTranscriptFsGateForTests()
|
||||
mocks.readdir.mockReset()
|
||||
mocks.stat.mockReset()
|
||||
releaseStall = undefined
|
||||
|
||||
@@ -20,10 +20,10 @@ import {
|
||||
resetSessionParseCacheForTests
|
||||
} from './session-scanner-parse-cache'
|
||||
import {
|
||||
resetWslTranscriptFsGateForTests,
|
||||
WSL_TRANSCRIPT_FS_ROUTE_QUARANTINE_BASE_MS,
|
||||
WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS,
|
||||
WslTranscriptFsError,
|
||||
resetWslTranscriptFsGateForTests
|
||||
WslTranscriptFsError
|
||||
} from '../native-chat/wsl-transcript-fs-gate'
|
||||
|
||||
type ReadResult = { bytesRead: number; buffer: Buffer }
|
||||
|
||||
@@ -24,7 +24,10 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { readAiVaultSessionTitlesFromFiles } from './session-title-file-reader'
|
||||
import { resetSessionParseCacheForTests } from './session-scanner-parse-cache'
|
||||
import { WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS } from '../native-chat/wsl-transcript-fs-gate'
|
||||
import {
|
||||
resetWslTranscriptFsGateForTests,
|
||||
WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS
|
||||
} from '../native-chat/wsl-transcript-fs-gate'
|
||||
|
||||
let releaseStall: (() => void) | undefined
|
||||
let tempRoot: string | undefined
|
||||
@@ -47,6 +50,7 @@ function userRecord(sessionId: string, text: string): string {
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
resetWslTranscriptFsGateForTests()
|
||||
resetSessionParseCacheForTests()
|
||||
mocks.lstat.mockReset()
|
||||
releaseStall = undefined
|
||||
|
||||
@@ -24,12 +24,16 @@ import {
|
||||
clearNativeChatTranscriptCache,
|
||||
readNativeChatTranscriptCached
|
||||
} from './transcript-read-cache'
|
||||
import { WSL_TRANSCRIPT_FS_EXACT_TIMEOUT_MS } from './wsl-transcript-fs-gate'
|
||||
import {
|
||||
resetWslTranscriptFsGateForTests,
|
||||
WSL_TRANSCRIPT_FS_EXACT_TIMEOUT_MS
|
||||
} from './wsl-transcript-fs-gate'
|
||||
|
||||
const SLOW_MESSAGE =
|
||||
'WSL transcript files are temporarily unavailable because filesystem access is taking too long. Try again shortly or restart Orca if the issue continues.'
|
||||
|
||||
beforeEach(() => {
|
||||
resetWslTranscriptFsGateForTests()
|
||||
mocks.resolve.mockReset()
|
||||
mocks.stat.mockReset()
|
||||
mocks.read.mockReset()
|
||||
|
||||
@@ -11,7 +11,10 @@ vi.mock('node:fs/promises', async (importOriginal) => ({
|
||||
}))
|
||||
|
||||
import { readNativeChatTranscript } from './transcript-reader'
|
||||
import { WSL_TRANSCRIPT_FS_EXACT_TIMEOUT_MS } from './wsl-transcript-fs-gate'
|
||||
import {
|
||||
resetWslTranscriptFsGateForTests,
|
||||
WSL_TRANSCRIPT_FS_EXACT_TIMEOUT_MS
|
||||
} from './wsl-transcript-fs-gate'
|
||||
|
||||
const SLOW_MESSAGE =
|
||||
'WSL transcript files are temporarily unavailable because filesystem access is taking too long. Try again shortly or restart Orca if the issue continues.'
|
||||
@@ -43,6 +46,7 @@ function handleServing(body: Buffer, delayMs = 0) {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
resetWslTranscriptFsGateForTests()
|
||||
mocks.open.mockReset()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user