test(terminal): close final review coverage gaps

This commit is contained in:
Neil
2026-07-29 07:49:34 -07:00
parent f41ff6ec2f
commit db99240e54
2 changed files with 17 additions and 1 deletions
@@ -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<PtyTransport['connect']>[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()
}
}
@@ -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, []]])