From acec0e7aa0744bb2aca7a72096a5dcf0db15bdf5 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:38:25 -0700 Subject: [PATCH] test: remove two load-dependent CI flakes (#34613) - git-binary-compatibility: give the docker image runs of the ref-pairing case a 90 s budget; each Git call is a docker exec and the case normally takes 22-25 s of the 30 s default. - claude-transcript-catch-up: fire the 5 ms catch-up deadline with fake timers only after the fallback lookup has started, instead of racing a real timer. --- .../claude/claude-transcript-catch-up.test.ts | 17 +++++++++++++++-- src/shared/git-binary-compatibility.test.ts | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/claude/claude-transcript-catch-up.test.ts b/src/main/claude/claude-transcript-catch-up.test.ts index eaa304a76b0..d7027f1cf1d 100644 --- a/src/main/claude/claude-transcript-catch-up.test.ts +++ b/src/main/claude/claude-transcript-catch-up.test.ts @@ -407,10 +407,23 @@ describe('Claude chat catch-up', () => { const c = await chat('-old-work', '/new-work') await c.write([...chatTurn, ...outsideTurn]) const lookup = Promise.withResolvers() + const lookupStarted = Promise.withResolvers() const resolve = vi .spyOn(sessionFileResolver, 'resolveSessionFilePath') - .mockReturnValueOnce(lookup.promise) - expect(await c.open('a1', { timeoutMs: 5 })).toBe(false) + .mockImplementationOnce(() => { + lookupStarted.resolve() + return lookup.promise + }) + // Fire the deadline only once the lookup is in flight; a real 5 ms timer raced slow runners. + vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'Date'] }) + try { + const opened = c.open('a1', { timeoutMs: 5 }) + await lookupStarted.promise + vi.advanceTimersByTime(5) + expect(await opened).toBe(false) + } finally { + vi.useRealTimers() + } expect(resolve.mock.calls[0]?.[3]?.aborted).toBe(true) lookup.resolve(null) await new Promise((done) => setImmediate(done)) diff --git a/src/shared/git-binary-compatibility.test.ts b/src/shared/git-binary-compatibility.test.ts index b138cdc1cd4..373dd40a67e 100644 --- a/src/shared/git-binary-compatibility.test.ts +++ b/src/shared/git-binary-compatibility.test.ts @@ -50,6 +50,8 @@ const image = process.env.ORCA_GIT_COMPAT_IMAGE const binary = process.env.ORCA_GIT_COMPAT_BINARY const expectedVersion = process.env.ORCA_GIT_COMPAT_VERSION const describeBinaryCompatibility = image || binary ? describe : describe.skip +const PAIRS_REFS_TEST = + 'pairs published, tracked and default refs with configured repositories, on the selected Git binary' type GitResult = { stdout: string; stderr: string } @@ -112,7 +114,8 @@ describeBinaryCompatibility('real Git binary compatibility', () => { } }) - it('pairs published, tracked and default refs with configured repositories, on the selected Git binary', async () => { + // Each Git call is a docker exec: image runs take 22-25 s of a 30 s default, so loaded runners tripped it. + it(PAIRS_REFS_TEST, { timeout: image ? 90_000 : undefined }, async () => { const root = join(repoPath, 'copy-url') await mkdir(root) const cwd = image ? '/repo/copy-url' : root