From db99240e54eb6059e84ad34c026d12987df4d57b Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 29 Jul 2026 07:49:34 -0700 Subject: [PATCH] test(terminal): close final review coverage gaps --- .../src/components/terminal-pane/pty-transport.ts | 3 ++- .../terminal-eviction-exempt-tabs.test.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/components/terminal-pane/pty-transport.ts b/src/renderer/src/components/terminal-pane/pty-transport.ts index e06a4c6eac7..f385ddd2b36 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport.ts @@ -76,6 +76,7 @@ export const MAX_PENDING_PTY_SIDE_EFFECTS = 512 // Why: agent status is last-wins store state, but payloads can carry KB-scale prompt/tool strings; // carry only the newest few through eviction so a status flood cannot re-grow what it evicted. export const MAX_EVICTED_AGENT_STATUS_PAYLOAD_CARRY = 16 +const MAX_EVICTED_AGENT_TITLE_TRANSITION_CARRY = 3 type PtyOutputCallbacks = Parameters[0]['callbacks'] @@ -218,7 +219,7 @@ export function createPtyOutputProcessor({ continue } evictedAgentTitleTransitions.push({ phase, title }) - if (evictedAgentTitleTransitions.length > 3) { + if (evictedAgentTitleTransitions.length > MAX_EVICTED_AGENT_TITLE_TRANSITION_CARRY) { evictedAgentTitleTransitions.shift() } } diff --git a/src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.ts b/src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.ts index bcb3f55310b..d6318c89869 100644 --- a/src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.ts @@ -56,6 +56,21 @@ describe('selectEvictionExemptTerminalTabLayoutKey', () => { ) }) + it('is stable across leaf-map insertion order', () => { + const first = layoutState({ + [LEAF_ID]: PTY_ID, + [SECOND_LEAF_ID]: 'pty-local-detached' + }) + const reversed = layoutState({ + [SECOND_LEAF_ID]: 'pty-local-detached', + [LEAF_ID]: PTY_ID + }) + + expect(selectEvictionExemptTerminalTabLayoutKey(first, TABS)).toBe( + selectEvictionExemptTerminalTabLayoutKey(reversed, TABS) + ) + }) + it('tolerates tabs with no persisted layout', () => { expect(selectEvictionExemptTerminalTabLayoutKey({ terminalLayoutsByTabId: {} }, TABS)).toBe( JSON.stringify([[TAB_ID, []]])