From bb667a33bd2ac46bf142c5234deb235840d1b3a6 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 29 Sep 2026 17:04:42 -0700 Subject: [PATCH] test: retire the last private-predicate duplicates in the leaked-internals sweep (#23949) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sixth and final wave over the modules that export symbols only tests import. Deletes private-predicate cases whose behavior is already asserted through the module's real entry point, then makes the symbol private again. Also removes three distinct junk shapes the earlier detectors missed: - a self-comparison whose expected empty row was produced by the helper under test (`worktree-palette-search`), now a literal; - expected values computed by a sibling helper rather than asserted (`terminal-theme`), now read through the production `getBuiltinTheme`; - a negative control that cannot fail — `expect('json' in jsonlMonarchLanguage) .toBe(false)`, where `IMonarchLanguage` has no such key, so it guarded nothing while appearing to guard "does not attach the JSON language service". Dead production code removed where tests were its only callers: `refreshWindowsTerminalCapabilities` (a one-line alias for `loadWindowsTerminalCapabilities({force: true})`), `readSpoolRecords`, `buildAgentPromptSubmitBytes`, and `getCommitMessageModelCapability`. About 70% of everything this detector flagged across the whole vein was a false positive, so most modules were left untouched. Bounds consumed as test input, `*ForTests` seams, non-hook cores of `useSyncExternalStore` hooks, and value-position registrations all look identical to a leaked internal from the outside and are not. --- src/main/agent-hooks/spool.test.ts | 12 ------ .../monaco-languages/register-jsonl.test.ts | 7 ---- .../terminal-arabic-shaping-joiner.test.ts | 20 ---------- .../terminal-arabic-shaping-joiner.ts | 2 +- .../terminal-keyboard-protocol.test.ts | 11 ------ .../terminal-keyboard-protocol.ts | 4 +- .../src/lib/simulator-palette-search.test.ts | 2 - .../src/lib/simulator-palette-search.ts | 2 +- src/renderer/src/lib/terminal-theme.test.ts | 7 ++-- src/renderer/src/lib/terminal-theme.ts | 2 +- .../lib/windows-terminal-capabilities.test.ts | 9 +++-- .../src/lib/windows-terminal-capabilities.ts | 8 ---- .../src/lib/worktree-activity-state.test.ts | 25 +++--------- .../src/lib/worktree-activity-state.ts | 2 +- .../lib/worktree-git-identity-display.test.ts | 14 +------ .../src/lib/worktree-git-identity-display.ts | 4 +- .../src/lib/worktree-palette-search.test.ts | 39 ++++++++----------- .../src/lib/worktree-palette-search.ts | 2 +- src/shared/agent-hook-spool.ts | 4 -- src/shared/agent-prompt-injection.test.ts | 2 - src/shared/agent-prompt-injection.ts | 4 -- src/shared/commit-message-agent-spec.test.ts | 2 - src/shared/commit-message-agent-spec.ts | 7 ---- src/shared/native-chat-tool-summary.test.ts | 14 ------- src/shared/native-chat-tool-summary.ts | 6 --- src/shared/orchestration-timing-budgets.ts | 1 - src/shared/plugins/plugin-kill-list.test.ts | 2 - src/shared/plugins/plugin-kill-list.ts | 4 -- .../terminal-send-agent-prompt-submit.spec.ts | 5 ++- 29 files changed, 44 insertions(+), 179 deletions(-) diff --git a/src/main/agent-hooks/spool.test.ts b/src/main/agent-hooks/spool.test.ts index 3e460fdc3ba..24fcef6be5d 100644 --- a/src/main/agent-hooks/spool.test.ts +++ b/src/main/agent-hooks/spool.test.ts @@ -16,7 +16,6 @@ import { AGENT_HOOK_SPOOL_MAX_FILES, drainAgentHookSpool, launchTokenHash, - readSpoolRecords, type SpoolRecord } from '../../shared/agent-hook-spool' import { AgentHookServer, _internals } from './server' @@ -35,16 +34,6 @@ describe('agent hook spool', () => { expect(spoolLine).toContain('"$spool_now" "$payload"') }) - it('drops torn lines while retaining complete records', () => { - const dir = mkdtempSync(join(tmpdir(), 'orca-spool-')) - const file = join(dir, 'pane.jsonl') - writeFileSync( - file, - '\n{"paneKey":"tab:1","source":"codex","receivedAt":1,"payload":{}}\n{"paneKey":' - ) - expect(readSpoolRecords(file, 1)).toHaveLength(1) - }) - it('waits for a newline before replaying a complete-looking final record', () => { const dir = mkdtempSync(join(tmpdir(), 'orca-spool-unterminated-')) const spool = join(dir, 'spool') @@ -63,7 +52,6 @@ describe('agent hook spool', () => { getPersistedLaunchTokenHash: () => undefined, ingest: (value: SpoolRecord) => ingested.push(value) } - expect(readSpoolRecords(file)).toHaveLength(0) expect(drainAgentHookSpool(options)).toBe(0) expect(readFileSync(file, 'utf8')).toBe(record) diff --git a/src/renderer/src/lib/monaco-languages/register-jsonl.test.ts b/src/renderer/src/lib/monaco-languages/register-jsonl.test.ts index 8dd79ac28e3..8da4d01c9e0 100644 --- a/src/renderer/src/lib/monaco-languages/register-jsonl.test.ts +++ b/src/renderer/src/lib/monaco-languages/register-jsonl.test.ts @@ -45,13 +45,6 @@ describe('registerJsonlLanguage', () => { ) }) - it('does not attach the JSON language service / diagnostics', () => { - // Why: whole-document JSON validation would flag every record after line one - // as trailing content. A Monarch tokens provider is presentation-only. - expect(jsonlMonarchLanguage.tokenizer).toBeDefined() - expect('json' in jsonlMonarchLanguage).toBe(false) - }) - it('registers once and is idempotent when the language already exists', () => { const monaco = createMonacoMock([JSONL_LANGUAGE_ID]) diff --git a/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.test.ts b/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.test.ts index 6895d629f87..3339f166106 100644 --- a/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.test.ts +++ b/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.test.ts @@ -4,29 +4,9 @@ import { configureLazyArabicShapingJoiner, ensureArabicShapingJoinerForText, findRtlJoinRanges, - isStrongRtlCodePoint, registerArabicShapingJoiner } from './terminal-arabic-shaping-joiner' -describe('isStrongRtlCodePoint', () => { - it('classifies Arabic and Hebrew letters as strong RTL', () => { - expect(isStrongRtlCodePoint('م'.codePointAt(0)!)).toBe(true) - expect(isStrongRtlCodePoint('ش'.codePointAt(0)!)).toBe(true) - expect(isStrongRtlCodePoint('א'.codePointAt(0)!)).toBe(true) - // Arabic presentation forms (legacy shaped codepoints). - expect(isStrongRtlCodePoint(0xfe8d)).toBe(true) - // Adlam (supplementary plane). - expect(isStrongRtlCodePoint(0x1e900)).toBe(true) - }) - - it('does not classify Latin, box drawing, CJK, or emoji as RTL', () => { - expect(isStrongRtlCodePoint('a'.codePointAt(0)!)).toBe(false) - expect(isStrongRtlCodePoint('│'.codePointAt(0)!)).toBe(false) - expect(isStrongRtlCodePoint('漢'.codePointAt(0)!)).toBe(false) - expect(isStrongRtlCodePoint(0x1f600)).toBe(false) - }) -}) - describe('findRtlJoinRanges', () => { it('returns no ranges for plain ASCII text', () => { expect(findRtlJoinRanges('ls -la | grep foo && echo done')).toEqual([]) diff --git a/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.ts b/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.ts index e5bb91c81fa..64c996d88fd 100644 --- a/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.ts +++ b/src/renderer/src/lib/pane-manager/terminal-arabic-shaping-joiner.ts @@ -19,7 +19,7 @@ const lazyArabicShapingJoinerByTerminal = new WeakMap< // Every strong-RTL block sits at/above U+0590, so ASCII/Latin bails out with a single charCodeAt sweep. const RTL_SCAN_FLOOR = 0x0590 -export function isStrongRtlCodePoint(codePoint: number): boolean { +function isStrongRtlCodePoint(codePoint: number): boolean { return ( // One contiguous strong-RTL span (Hebrew through Arabic Extended-A). (codePoint >= 0x0590 && codePoint <= 0x08ff) || diff --git a/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.test.ts b/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.test.ts index 87a596736ab..33cdd7b1c7a 100644 --- a/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.test.ts +++ b/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'vitest' import { buildTerminalKeyboardProtocolOptions, - prefersKittyKeyboardDespiteWindowsConpty, shouldDisableKittyKeyboardForTerminal } from './terminal-keyboard-protocol' @@ -18,16 +17,6 @@ const localWindowsConpty = { executionHostId: 'local' as const } -describe('prefersKittyKeyboardDespiteWindowsConpty', () => { - it('is true only for Grok (needs KKP for modified Enter on ConPTY)', () => { - expect(prefersKittyKeyboardDespiteWindowsConpty('grok')).toBe(true) - expect(prefersKittyKeyboardDespiteWindowsConpty('claude')).toBe(false) - expect(prefersKittyKeyboardDespiteWindowsConpty('codex')).toBe(false) - expect(prefersKittyKeyboardDespiteWindowsConpty(null)).toBe(false) - expect(prefersKittyKeyboardDespiteWindowsConpty(undefined)).toBe(false) - }) -}) - describe('shouldDisableKittyKeyboardForTerminal', () => { it('disables Kitty keyboard for a local native Windows ConPTY pane', () => { // Regression for #2434: local Windows CLIs (e.g. Antigravity agy) read the diff --git a/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts b/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts index 66c85d56581..a9af77a73b3 100644 --- a/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts +++ b/src/renderer/src/lib/pane-manager/terminal-keyboard-protocol.ts @@ -21,9 +21,7 @@ export type TerminalKeyboardProtocolContext = WindowsPtyCompatibilityContext & { * targets CSI-u-blind CLIs (e.g. Antigravity); Grok is not in that set and * relies on KKP for interject vs newline (official Grok Build keyboard docs). */ -export function prefersKittyKeyboardDespiteWindowsConpty( - agent: TuiAgent | null | undefined -): boolean { +function prefersKittyKeyboardDespiteWindowsConpty(agent: TuiAgent | null | undefined): boolean { return agent === 'grok' } diff --git a/src/renderer/src/lib/simulator-palette-search.test.ts b/src/renderer/src/lib/simulator-palette-search.test.ts index 6a084709c0e..98a9269166d 100644 --- a/src/renderer/src/lib/simulator-palette-search.test.ts +++ b/src/renderer/src/lib/simulator-palette-search.test.ts @@ -12,7 +12,6 @@ import { SIMULATOR_PALETTE_QUERY_MAX_BYTES, SIMULATOR_TYPE_SEARCH_ALIASES, buildSearchableSimulatorTabs, - isSimulatorPaletteQueryTooLarge, searchSimulatorTabs, simulatorPaletteTabTitle, type SearchableSimulatorTab @@ -409,7 +408,6 @@ describe('simulator-palette-search', () => { }) } as SearchableSimulatorTab - expect(isSimulatorPaletteQueryTooLarge(oversizedQuery)).toBe(true) expect(searchSimulatorTabs([entry], oversizedQuery)).toEqual([]) }) diff --git a/src/renderer/src/lib/simulator-palette-search.ts b/src/renderer/src/lib/simulator-palette-search.ts index 092d3b335dd..a2e841d13fb 100644 --- a/src/renderer/src/lib/simulator-palette-search.ts +++ b/src/renderer/src/lib/simulator-palette-search.ts @@ -92,7 +92,7 @@ export const SIMULATOR_TYPE_SEARCH_ALIASES = [ 'emulator' ] as const -export function isSimulatorPaletteQueryTooLarge( +function isSimulatorPaletteQueryTooLarge( query: string, maxBytes = SIMULATOR_PALETTE_QUERY_MAX_BYTES ): boolean { diff --git a/src/renderer/src/lib/terminal-theme.test.ts b/src/renderer/src/lib/terminal-theme.test.ts index f0211797bd6..94ffe0750a6 100644 --- a/src/renderer/src/lib/terminal-theme.test.ts +++ b/src/renderer/src/lib/terminal-theme.test.ts @@ -4,7 +4,6 @@ import { DEFAULT_TERMINAL_THEME_LIGHT, getAvailableTerminalThemeOptions, getBuiltinTheme, - getTerminalThemePreview, isTerminalBackgroundLight, resolveOpaqueTerminalBackground, resolveEffectiveTerminalAppearance @@ -139,7 +138,7 @@ describe('resolveEffectiveTerminalAppearance', () => { ) expect(appearance.themeName).toBe('Invalid Theme Name') - expect(appearance.theme).toEqual(getTerminalThemePreview(DEFAULT_TERMINAL_THEME_LIGHT)) + expect(appearance.theme).toEqual(getBuiltinTheme(DEFAULT_TERMINAL_THEME_LIGHT)) }) it('resolves custom theme selections by id', () => { @@ -188,7 +187,7 @@ describe('resolveEffectiveTerminalAppearance', () => { ) expect(appearance.themeName).toBe('custom:warp:missing') - expect(appearance.theme).toEqual(getTerminalThemePreview(DEFAULT_TERMINAL_THEME_DARK)) + expect(appearance.theme).toEqual(getBuiltinTheme(DEFAULT_TERMINAL_THEME_DARK)) }) it('falls back visually to the light default when a light custom selection is missing', () => { @@ -206,7 +205,7 @@ describe('resolveEffectiveTerminalAppearance', () => { ) expect(appearance.themeName).toBe('custom:warp:missing') - expect(appearance.theme).toEqual(getTerminalThemePreview(DEFAULT_TERMINAL_THEME_LIGHT)) + expect(appearance.theme).toEqual(getBuiltinTheme(DEFAULT_TERMINAL_THEME_LIGHT)) }) it('includes imported themes as grouped picker options', () => { diff --git a/src/renderer/src/lib/terminal-theme.ts b/src/renderer/src/lib/terminal-theme.ts index 365cb63f7b9..bf43c84743d 100644 --- a/src/renderer/src/lib/terminal-theme.ts +++ b/src/renderer/src/lib/terminal-theme.ts @@ -71,7 +71,7 @@ export function getTerminalTheme( return getTheme(selection) } -export function getTerminalThemePreview( +function getTerminalThemePreview( name: string, settings?: Pick, fallbackMode: 'dark' | 'light' = 'dark' diff --git a/src/renderer/src/lib/windows-terminal-capabilities.test.ts b/src/renderer/src/lib/windows-terminal-capabilities.test.ts index d1ad22b463d..7e7568f2e09 100644 --- a/src/renderer/src/lib/windows-terminal-capabilities.test.ts +++ b/src/renderer/src/lib/windows-terminal-capabilities.test.ts @@ -10,7 +10,6 @@ import { hasCachedWindowsTerminalCapabilities, isWindowsTerminalCapabilityHost, loadWindowsTerminalCapabilities, - refreshWindowsTerminalCapabilities, resetWindowsTerminalCapabilitiesForTests, selectWindowsTerminalCapabilitiesForOwner, useLocalWindowsTerminalCapabilities, @@ -197,7 +196,7 @@ describe('windows terminal capabilities', () => { await expect(loadWindowsTerminalCapabilities()).resolves.toMatchObject({ wslAvailable: false }) - await expect(refreshWindowsTerminalCapabilities()).resolves.toMatchObject({ + await expect(loadWindowsTerminalCapabilities({ force: true })).resolves.toMatchObject({ wslAvailable: true }) @@ -438,7 +437,11 @@ describe('windows terminal capabilities', () => { }) await expect( - refreshWindowsTerminalCapabilities(undefined, { kind: 'local' }, 'ssh-1') + loadWindowsTerminalCapabilities({ + force: true, + target: { kind: 'local' }, + sshConnectionId: 'ssh-1' + }) ).resolves.toEqual({ wslAvailable: true, wslDistros: ['Ubuntu', 'Debian'], diff --git a/src/renderer/src/lib/windows-terminal-capabilities.ts b/src/renderer/src/lib/windows-terminal-capabilities.ts index 4bc5d6d7b6e..8a2f468b134 100644 --- a/src/renderer/src/lib/windows-terminal-capabilities.ts +++ b/src/renderer/src/lib/windows-terminal-capabilities.ts @@ -176,14 +176,6 @@ export function loadWindowsTerminalCapabilities( return nextPendingCapabilities } -export function refreshWindowsTerminalCapabilities( - ownerKey?: string, - target: WindowsTerminalCapabilityLoadTarget = { kind: 'local' }, - sshConnectionId?: string | null -): Promise { - return loadWindowsTerminalCapabilities({ force: true, ownerKey, target, sshConnectionId }) -} - export function selectWindowsTerminalCapabilitiesForOwner( state: WindowsTerminalCapabilityHookState, enabled: boolean, diff --git a/src/renderer/src/lib/worktree-activity-state.test.ts b/src/renderer/src/lib/worktree-activity-state.test.ts index c378e751262..777eeb07595 100644 --- a/src/renderer/src/lib/worktree-activity-state.test.ts +++ b/src/renderer/src/lib/worktree-activity-state.test.ts @@ -2,7 +2,6 @@ import { describe, expect, it } from 'vitest' import { getLiveAgentStatusByWorktreeId, getWorktreeIdsWithLiveAgent, - hasActiveWorkspaceActivity, isInactiveWorkspace } from './worktree-activity-state' import type { TerminalTab } from '../../../shared/terminal-tab-types' @@ -43,9 +42,6 @@ describe('worktree activity state', () => { const ptyIdsByTabId = { 'tab-1': ['pty-1'] } expect(isInactiveWorkspace('wt-1', tabsByWorktree, ptyIdsByTabId, {}, new Set())).toBe(false) - expect(hasActiveWorkspaceActivity('wt-1', tabsByWorktree, ptyIdsByTabId, {}, new Set())).toBe( - true - ) }) it('treats browser workspaces as active', () => { @@ -62,51 +58,42 @@ describe('worktree activity state', () => { it('treats pending paired web host terminal mirrors as inactive without a live pty', () => { expect( - hasActiveWorkspaceActivity( + isInactiveWorkspace( 'wt-1', { 'wt-1': [makeTab('web-terminal-host-tab-1')] }, {}, {}, new Set() ) - ).toBe(false) + ).toBe(true) }) it('treats ready paired web host terminal mirrors as active with a live pty', () => { expect( - hasActiveWorkspaceActivity( + isInactiveWorkspace( 'wt-1', { 'wt-1': [makeTab('web-terminal-host-tab-1')] }, { 'web-terminal-host-tab-1': ['pty-1'] }, {}, new Set() ) - ).toBe(true) + ).toBe(false) }) it('keeps browser-only workspaces active when mirrored terminals are pending', () => { expect( - hasActiveWorkspaceActivity( + isInactiveWorkspace( 'wt-1', { 'wt-1': [makeTab('web-terminal-host-tab-1')] }, {}, { 'wt-1': [{ id: 'browser-1' }] }, new Set() ) - ).toBe(true) + ).toBe(false) }) it('keeps a workspace with a running agent active even without a live pty (#7197)', () => { const worktreeIdsWithLiveAgent = new Set(['wt-1']) - expect( - hasActiveWorkspaceActivity( - 'wt-1', - { 'wt-1': [makeTab('tab-1')] }, - { 'tab-1': [] }, - {}, - worktreeIdsWithLiveAgent - ) - ).toBe(true) expect( isInactiveWorkspace( 'wt-1', diff --git a/src/renderer/src/lib/worktree-activity-state.ts b/src/renderer/src/lib/worktree-activity-state.ts index 12aa67e7588..9b1b3c7ea49 100644 --- a/src/renderer/src/lib/worktree-activity-state.ts +++ b/src/renderer/src/lib/worktree-activity-state.ts @@ -71,7 +71,7 @@ export function getLiveAgentStatusByWorktreeId( return result } -export function hasActiveWorkspaceActivity( +function hasActiveWorkspaceActivity( worktreeId: string, tabsByWorktree: TabsByWorktree | null | undefined, ptyIdsByTabId: PtyIdsByTabId | null | undefined, diff --git a/src/renderer/src/lib/worktree-git-identity-display.test.ts b/src/renderer/src/lib/worktree-git-identity-display.test.ts index a48c5cb9d85..b5cf23a9b68 100644 --- a/src/renderer/src/lib/worktree-git-identity-display.test.ts +++ b/src/renderer/src/lib/worktree-git-identity-display.test.ts @@ -1,9 +1,5 @@ import { describe, expect, it } from 'vitest' -import { - getDetachedHeadTooltip, - getWorktreeGitIdentityDisplay, - shortGitHead -} from './worktree-git-identity-display' +import { getWorktreeGitIdentityDisplay } from './worktree-git-identity-display' describe('worktree git identity display', () => { it('shows a branch name when the worktree has a branch ref', () => { @@ -43,11 +39,3 @@ describe('worktree git identity display', () => { expect(getWorktreeGitIdentityDisplay({ branch: '', head: '' })).toBeNull() }) }) - -describe('detached HEAD copy', () => { - it('formats the required tooltip copy', () => { - expect(getDetachedHeadTooltip(shortGitHead('abc123456789'))).toBe( - 'Detached HEAD at abc1234. You are viewing a commit, not a branch.' - ) - }) -}) diff --git a/src/renderer/src/lib/worktree-git-identity-display.ts b/src/renderer/src/lib/worktree-git-identity-display.ts index b2a89dbeca6..e5497d53b59 100644 --- a/src/renderer/src/lib/worktree-git-identity-display.ts +++ b/src/renderer/src/lib/worktree-git-identity-display.ts @@ -11,11 +11,11 @@ export type WorktreeGitIdentityDisplay = tooltip: string } -export function shortGitHead(head: string | null | undefined): string { +function shortGitHead(head: string | null | undefined): string { return (head ?? '').trim().slice(0, 7) } -export function getDetachedHeadTooltip(shortHead: string): string { +function getDetachedHeadTooltip(shortHead: string): string { return `Detached HEAD at ${shortHead}. You are viewing a commit, not a branch.` } diff --git a/src/renderer/src/lib/worktree-palette-search.test.ts b/src/renderer/src/lib/worktree-palette-search.test.ts index fe2fdd0e5bd..f7d28483a36 100644 --- a/src/renderer/src/lib/worktree-palette-search.test.ts +++ b/src/renderer/src/lib/worktree-palette-search.test.ts @@ -1,9 +1,5 @@ import { describe, expect, it } from 'vitest' -import { - getWorktreePaletteSearchScope, - makeEmptyPaletteSearchResult, - searchWorktrees -} from './worktree-palette-search' +import { getWorktreePaletteSearchScope, searchWorktrees } from './worktree-palette-search' import { WORKTREE_PALETTE_QUERY_MAX_BYTES, isWorktreePaletteQueryTooLarge @@ -35,6 +31,20 @@ function makeWorktree(overrides: Partial = {}): Worktree { } } +const EMPTY_QUERY_RESULT_WT1 = { + worktreeId: 'wt-1', + matchedFields: [], + displayNameRanges: [], + branchRanges: [], + repoRanges: [], + hostRanges: [], + supportingText: null, + qualityClass: null, + rank: null, + lastActiveAt: null, + activity: { ageBucket: null, timestamp: 0 } +} + const repoMap = new Map([ [ 'repo-1', @@ -91,22 +101,7 @@ describe('worktree-palette-search', () => { }) it('returns every worktree with no match metadata for an empty query', () => { - expect(searchWorktrees([makeWorktree()], '', repoMap)).toEqual([ - makeEmptyPaletteSearchResult('wt-1') - ]) - expect(makeEmptyPaletteSearchResult('wt-1')).toEqual({ - worktreeId: 'wt-1', - matchedFields: [], - displayNameRanges: [], - branchRanges: [], - repoRanges: [], - hostRanges: [], - supportingText: null, - qualityClass: null, - rank: null, - lastActiveAt: null, - activity: { ageBucket: null, timestamp: 0 } - }) + expect(searchWorktrees([makeWorktree()], '', repoMap)).toEqual([EMPTY_QUERY_RESULT_WT1]) }) it('finds an emoji-named workspace by its readable branch shortcode', () => { @@ -194,7 +189,7 @@ describe('worktree-palette-search', () => { branch: undefined as unknown as string }) - expect(searchWorktrees([cleared], '', repoMap)).toEqual([makeEmptyPaletteSearchResult('wt-1')]) + expect(searchWorktrees([cleared], '', repoMap)).toEqual([EMPTY_QUERY_RESULT_WT1]) }) it('returns a truncated comment snippet with the highlighted match range', () => { diff --git a/src/renderer/src/lib/worktree-palette-search.ts b/src/renderer/src/lib/worktree-palette-search.ts index 89cd0cf06a3..add76a23c2f 100644 --- a/src/renderer/src/lib/worktree-palette-search.ts +++ b/src/renderer/src/lib/worktree-palette-search.ts @@ -86,7 +86,7 @@ export function getWorktreePaletteSearchScope(args: { return args.allWorktrees.filter((worktree) => !worktree.isArchived) } -export function makeEmptyPaletteSearchResult( +function makeEmptyPaletteSearchResult( worktreeId: string, worktreeHostId?: Worktree['hostId'], context = createPaletteSearchContext(Date.now()), diff --git a/src/shared/agent-hook-spool.ts b/src/shared/agent-hook-spool.ts index 275e6f5ce52..388c28f4c2d 100644 --- a/src/shared/agent-hook-spool.ts +++ b/src/shared/agent-hook-spool.ts @@ -48,10 +48,6 @@ export function launchTokenHash(token: string | undefined): string | null { return token?.trim() ? createHash('sha256').update(token.trim()).digest('hex') : null } -export function readSpoolRecords(path: string, now = Date.now()): SpoolRecord[] { - return readSpoolFile(path, now).records -} - /** Records plus the byte offset through the last COMPLETE line. A torn trailing line is * left unconsumed so a writer still finishing it is not truncated away. */ export function readSpoolFile( diff --git a/src/shared/agent-prompt-injection.test.ts b/src/shared/agent-prompt-injection.test.ts index a20fad0ed8d..5a70ed8bad5 100644 --- a/src/shared/agent-prompt-injection.test.ts +++ b/src/shared/agent-prompt-injection.test.ts @@ -3,7 +3,6 @@ import { AGENT_PROMPT_BRACKETED_PASTE_END, AGENT_PROMPT_BRACKETED_PASTE_START, buildAgentPromptPasteBytes, - buildAgentPromptSubmitBytes, agentPromptSubmitJoinsPasteFrame, agentPromptTakesLeadLine, getAgentPromptSubmitDelayMs, @@ -48,7 +47,6 @@ describe('agent prompt injection bytes', () => { it('keeps submit separate from the paste frame', () => { expect(buildAgentPromptPasteBytes('hello')).not.toContain('\r') - expect(buildAgentPromptSubmitBytes()).toBe('\r') }) it('costs a common-sized prompt far less than the old flat Windows delay', () => { diff --git a/src/shared/agent-prompt-injection.ts b/src/shared/agent-prompt-injection.ts index 7c33855ee9c..b085f6a9048 100644 --- a/src/shared/agent-prompt-injection.ts +++ b/src/shared/agent-prompt-injection.ts @@ -131,10 +131,6 @@ export function buildAgentPromptPasteBytes(prompt: string, leadLine?: string): s return `${lead}${AGENT_PROMPT_BRACKETED_PASTE_START}${sanitizeAgentPromptText(prompt)}${AGENT_PROMPT_BRACKETED_PASTE_END}` } -export function buildAgentPromptSubmitBytes(): string { - return AGENT_PROMPT_SUBMIT -} - export function* iterateAgentPromptPasteChunks( prompt: string, maxChunkBytes = TERMINAL_INPUT_CHUNK_MAX_BYTES diff --git a/src/shared/commit-message-agent-spec.test.ts b/src/shared/commit-message-agent-spec.test.ts index 2a6ad8c3b7c..26f239e1a41 100644 --- a/src/shared/commit-message-agent-spec.test.ts +++ b/src/shared/commit-message-agent-spec.test.ts @@ -5,7 +5,6 @@ import { DEFAULT_COMMIT_MESSAGE_AGENT_ID, getCommitMessageAgentCapability, getCommitMessageAgentSpec, - getCommitMessageModelCapability, getCommitMessageModel, isCustomAgentId, listCommitMessageAgentCapabilities, @@ -215,7 +214,6 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => { }) expect(codex).not.toHaveProperty('binary') expect(codex).not.toHaveProperty('buildArgs') - expect(getCommitMessageModelCapability('codex', 'gpt-5.4-mini')?.thinkingLevels).toBeDefined() }) }) diff --git a/src/shared/commit-message-agent-spec.ts b/src/shared/commit-message-agent-spec.ts index 7a4145a7630..6927f0a9ca7 100644 --- a/src/shared/commit-message-agent-spec.ts +++ b/src/shared/commit-message-agent-spec.ts @@ -214,13 +214,6 @@ export function getCommitMessageAgentCapability( return spec ? toCommitMessageAgentCapability(spec) : undefined } -export function getCommitMessageModelCapability( - agentId: TuiAgent, - modelId: string -): CommitMessageModelCapability | undefined { - return getCommitMessageAgentCapability(agentId)?.models.find((m) => m.id === modelId) -} - /** Ordered list of agents that have a non-interactive mode wired up. */ export function listCommitMessageAgentIds(): TuiAgent[] { return Object.keys(COMMIT_MESSAGE_AGENT_SPECS) as TuiAgent[] diff --git a/src/shared/native-chat-tool-summary.test.ts b/src/shared/native-chat-tool-summary.test.ts index d22f5031eea..f58bd08b680 100644 --- a/src/shared/native-chat-tool-summary.test.ts +++ b/src/shared/native-chat-tool-summary.test.ts @@ -5,7 +5,6 @@ import { createToolInputDisplay, describeToolInput, formatToolInput, - isStructuredToolInput, MAX_TOOL_DETAIL_LENGTH, summarizeToolInput, summarizeToolRun, @@ -175,7 +174,6 @@ describe('Codex JSON-string tool arguments', () => { expect(toolFilePath('{"file_path":"src/index.ts"}')).toBe('src/index.ts') expect(briefToolArg('{"file_path":"src/app/index.ts"}')).toBe('index.ts') expect(briefToolArg('{"cmd":"git status --short"}')).toBe('git status --short') - expect(isStructuredToolInput('{"cmd":"ls"}')).toBe(true) }) it('joins an argv-array command into one label', () => { @@ -187,23 +185,11 @@ describe('Codex JSON-string tool arguments', () => { expect(describeToolInput('{ not json')).toBe('{ not json') expect(formatToolInput('just prose')).toBe('just prose') expect(toolFilePath('{"file_path":')).toBeNull() - expect(isStructuredToolInput('just prose')).toBe(false) // A JSON scalar is not an argument object — keep the literal text. expect(formatToolInput('"quoted"')).toBe('"quoted"') }) }) -describe('isStructuredToolInput', () => { - it('does not offer an expander whose detail would repeat the row label', () => { - // `{}` formats back to `{}` — the label itself. - expect(isStructuredToolInput({})).toBe(false) - expect(isStructuredToolInput([])).toBe(false) - expect(isStructuredToolInput('{}')).toBe(false) - expect(isStructuredToolInput({ command: 'ls' })).toBe(true) - expect(isStructuredToolInput([1])).toBe(true) - }) -}) - describe('summarizeToolInput bounded preview', () => { it('collapses depth beyond the bound instead of serializing the whole tree', () => { const deep = { a: { b: { c: { d: 'buried' } } } } diff --git a/src/shared/native-chat-tool-summary.ts b/src/shared/native-chat-tool-summary.ts index 0751828a2fa..3ad960e7618 100644 --- a/src/shared/native-chat-tool-summary.ts +++ b/src/shared/native-chat-tool-summary.ts @@ -111,12 +111,6 @@ function formatNormalizedToolInput(input: unknown): string { } } -/** Whether the expanded detail would show structured JSON rather than repeating - * the row label — i.e. whether expanding the row is worth offering. */ -export function isStructuredToolInput(input: unknown): boolean { - return isStructuredNormalizedToolInput(normalizeToolInput(input)) -} - function isStructuredNormalizedToolInput(input: unknown): boolean { if (input === null || typeof input !== 'object') { return false diff --git a/src/shared/orchestration-timing-budgets.ts b/src/shared/orchestration-timing-budgets.ts index cc6890bf0f0..26e3e795600 100644 --- a/src/shared/orchestration-timing-budgets.ts +++ b/src/shared/orchestration-timing-budgets.ts @@ -6,7 +6,6 @@ export const ORCHESTRATION_CONTRACT_PREFLIGHT_TIMEOUT_MS = 5_000 export const ORCHESTRATION_READINESS_TIMEOUT_MS = 60_000 export const ORCHESTRATION_FEDERATION_ATTACH_GRACE_MS = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 10_000 export const ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 20_000 -export const SWALLOWED_ENTER_FIXTURE_TIMEOUT_MS = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 30_000 export function resolveWorkerStartReadinessTimeoutMs(timeoutMs: number | undefined): number { return typeof timeoutMs === 'number' && Number.isFinite(timeoutMs) && timeoutMs > 0 diff --git a/src/shared/plugins/plugin-kill-list.test.ts b/src/shared/plugins/plugin-kill-list.test.ts index 5eacf06c300..dcbd0b72fc6 100644 --- a/src/shared/plugins/plugin-kill-list.test.ts +++ b/src/shared/plugins/plugin-kill-list.test.ts @@ -4,7 +4,6 @@ import { PLUGIN_KILL_LIST_FUTURE_SKEW_MS, findKilledPlugin, isPluginKillListTooFarInFuture, - killedPluginKeys, pluginKillListSchema, type PluginKillList } from './plugin-kill-list' @@ -26,7 +25,6 @@ describe('pluginKillListSchema', () => { }) expect(findKilledPlugin(parsed, 'community.unsafe')).toEqual(entry()) - expect(killedPluginKeys(parsed)).toEqual(new Set(['community.unsafe'])) }) it.each([ diff --git a/src/shared/plugins/plugin-kill-list.ts b/src/shared/plugins/plugin-kill-list.ts index 500797607ad..9cd5a589f44 100644 --- a/src/shared/plugins/plugin-kill-list.ts +++ b/src/shared/plugins/plugin-kill-list.ts @@ -51,10 +51,6 @@ export function isPluginKillListTooFarInFuture( return Date.parse(killList.generatedAt) > now + PLUGIN_KILL_LIST_FUTURE_SKEW_MS } -export function killedPluginKeys(killList: PluginKillList): ReadonlySet { - return new Set(killList.plugins.map((plugin) => plugin.pluginKey)) -} - export function findKilledPlugin( killList: PluginKillList, pluginKey: string diff --git a/tests/e2e/terminal-send-agent-prompt-submit.spec.ts b/tests/e2e/terminal-send-agent-prompt-submit.spec.ts index 35742e27f94..2f08acfc067 100644 --- a/tests/e2e/terminal-send-agent-prompt-submit.spec.ts +++ b/tests/e2e/terminal-send-agent-prompt-submit.spec.ts @@ -8,7 +8,7 @@ import { buildFakeAgentCommandOverride } from './helpers/fake-agent-command-over import { waitForSessionReady } from './helpers/store' import { RuntimeClient } from '../../src/cli/runtime-client' import { recognizeAgentProcess } from '../../src/shared/agent-process-recognition' -import { SWALLOWED_ENTER_FIXTURE_TIMEOUT_MS } from '../../src/shared/orchestration-timing-budgets' +import { AGENT_PROMPT_EFFECT_TIMEOUT_MS } from '../../src/shared/orchestration-timing-budgets' const execFileAsync = promisify(execFile) const fixtureRoot = mkdtempSync(path.join(os.tmpdir(), 'orca-terminal-send-agent-prompt-')) @@ -17,7 +17,8 @@ const fixtureMarker = `ORCA_TERMINAL_SEND_E2E_${process.pid}` const fixtureScript = path.join(process.cwd(), 'tests', 'tools', 'repro-terminal-send-submit.mjs') const fakeCodex = path.join(fixtureRoot, process.platform === 'win32' ? 'codex.cmd' : 'codex') const fakeCodexCommand = buildFakeAgentCommandOverride(fakeCodex) -const swallowedEnterFixtureTimeoutMs = SWALLOWED_ENTER_FIXTURE_TIMEOUT_MS +// Outlast the submission-effect budget so a swallowed Enter fails as a timeout, not a flake. +const swallowedEnterFixtureTimeoutMs = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 30_000 writeFileSync( fakeCodex,