From 809ddf4280382edbb174ec5224fe4eecd25cceb6 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 20 Aug 2026 17:59:17 -0700 Subject: [PATCH] test(terminal): cover the reveal-path ungate that clears a stale hidden gate declareRendererPtyDeliveryVisible is called from the reveal path and is the half of this fix that lets a revealed renderer receive live frames, but no test failed when it was made a no-op. Adds both directions: it ungates after a stale hidden claim is released, and it does not ungate while a hidden owner legitimately holds the PTY. --- .../pty-renderer-delivery-claims.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/renderer/src/components/terminal-pane/pty-renderer-delivery-claims.test.ts b/src/renderer/src/components/terminal-pane/pty-renderer-delivery-claims.test.ts index e2a447601ec..bb0f0bbfff3 100644 --- a/src/renderer/src/components/terminal-pane/pty-renderer-delivery-claims.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-renderer-delivery-claims.test.ts @@ -72,4 +72,27 @@ describe('renderer PTY delivery claims', () => { expect(setHiddenRendererPty).toHaveBeenLastCalledWith(PTY_ID, false) releaseRendererPtyVisibilityClaim(visiblePane) }) + // STA-4393: the reveal path calls this directly (pty-connection.ts), and it is the + // half of the fix that clears a leftover hidden gate so a revealed renderer actually + // receives live frames. Without it the pane stays gated behind a stale hidden claim + // and sits ~10 frames behind the authoritative buffer. + it('clears a stale hidden gate when the reveal path declares delivery visible', () => { + const staleHidden = acquireHiddenRendererPtyDeliveryClaim(PTY_ID) + expect(setHiddenRendererPty).toHaveBeenLastCalledWith(PTY_ID, true) + staleHidden() + + setHiddenRendererPty.mockReset() + declareRendererPtyDeliveryVisible(PTY_ID) + + expect(setHiddenRendererPty).toHaveBeenCalledWith(PTY_ID, false) + }) + + it('does not ungate while a hidden owner still legitimately holds the PTY', () => { + acquireHiddenRendererPtyDeliveryClaim(PTY_ID) + setHiddenRendererPty.mockReset() + + declareRendererPtyDeliveryVisible(PTY_ID) + + expect(setHiddenRendererPty).not.toHaveBeenCalled() + }) })