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.
This commit is contained in:
Brennan Benson
2026-08-20 17:59:17 -07:00
parent 833f36bf27
commit 809ddf4280
@@ -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()
})
})