From 625f4d7d43ac15ebf594e75db20002bec154fe00 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 16 Aug 2026 20:25:50 -0700 Subject: [PATCH] test(ssh): pin exit liveness incarnation fence --- .../ssh/ssh-relay-session-incarnation.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/ssh/ssh-relay-session-incarnation.test.ts b/src/main/ssh/ssh-relay-session-incarnation.test.ts index 129a98b3ebc..4293b72fdd0 100644 --- a/src/main/ssh/ssh-relay-session-incarnation.test.ts +++ b/src/main/ssh/ssh-relay-session-incarnation.test.ts @@ -89,8 +89,13 @@ vi.mock('../providers/ssh-git-dispatch', () => ({ unregisterSshGitProvider: vi.fn() })) -const { registerSshPtyProvider, clearProviderPtyState, deletePtyOwnership, isCurrentPtyExit } = - await import('../ipc/pty') +const { + registerSshPtyProvider, + getSshPtyProvider, + clearProviderPtyState, + deletePtyOwnership, + isCurrentPtyExit +} = await import('../ipc/pty') describe('SSH relay PTY incarnation exits', () => { beforeEach(() => { @@ -121,6 +126,11 @@ describe('SSH relay PTY incarnation exits', () => { providerGeneration: number ptyIncarnation: string }) => void + const acceptExitedPty = vi.fn() + vi.mocked(getSshPtyProvider).mockReturnValue({ + providerGeneration: 31, + acceptExitedPty + } as never) vi.mocked(isCurrentPtyExit).mockReturnValueOnce(false) onExit({ @@ -135,6 +145,7 @@ describe('SSH relay PTY incarnation exits', () => { expect(deletePtyOwnership).not.toHaveBeenCalled() expect(mockStore.markSshRemotePtyLease).not.toHaveBeenCalled() expect(acceptOutputExitMock).not.toHaveBeenCalled() + expect(acceptExitedPty).not.toHaveBeenCalled() expect(runtime.onPtyExit).not.toHaveBeenCalled() expect(mockWindow.webContents.send).not.toHaveBeenCalledWith('pty:exit', expect.anything()) @@ -153,6 +164,7 @@ describe('SSH relay PTY incarnation exits', () => { ptyIncarnation: 'current-incarnation' }) ) + expect(acceptExitedPty).toHaveBeenCalledExactlyOnceWith('ssh:target-1@@pty-reused') expect(runtime.onPtyExit).not.toHaveBeenCalled() }) })