diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 7abdb2a9f11..eba48399400 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -8176,7 +8176,7 @@ "invariant": "After a TUI exits or is killed, reveal, reattach, snapshot replay, or renderer remount must not deliver terminal-owned mouse or alternate-screen protocol bytes to the surviving shell. Recovery is an ordered output barrier in the daemon session data path: an OSC 133;D completing while the alternate screen is still active pauses the stream at that exact byte boundary, a fresh execution-host process inspection proves shell ownership, and on proof a mode reset is injected as in-stream output so every consumer converges by parsing the same bytes and the queued post-boundary shell output (the prompt) lands on the normal buffer. Snapshots are pure reads. Any failure — refuted proof, timeout, queue overflow, session death, disposal — flushes the queue unmodified, preserving incumbent behavior; later command or mode bytes revoke proof. Clean alternate-screen exits prove ownership asynchronously without pausing.", "oracle": "Run one fixed child-TUI journey for normal exit and cleanup-free SIGKILL. Assert renderer and host normal-buffer/non-mouse state, host snapshot terminalOwner metadata, exact PTY writes with no post-exit mouse report, unrelated-pane survival, post-boundary prompt output preserved (normal exit), ordered proof invalidation, bounded settlement and bail-out flush, one inspection per unclean episode with zero scans for ordinary output, split-escape safety at every chunk boundary, and old/new client-host fallback parity.", "commands": [ - "pnpm exec vitest run --config config/vitest.config.ts src/main/daemon/terminal-shell-lifecycle-scanner.test.ts src/main/daemon/terminal-shell-recovery-barrier.test.ts src/main/daemon/session-shell-recovery.test.ts src/main/daemon/session.test.ts src/main/daemon/terminal-host-concurrent-create.test.ts src/main/daemon/daemon-pty-adapter.test.ts src/main/daemon/daemon-restore-scrollback-depth.test.ts src/main/daemon/terminal-checkpoint-serializer.test.ts src/main/providers/agent-foreground-process.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/mobile-subscribe-integration.test.ts src/main/runtime/rpc/terminal-multiplex-escape-tail.test.ts src/renderer/src/components/terminal-pane/pty-connection-visibility-and-exit.test.ts src/renderer/src/components/terminal-pane/pty-connection-input-and-repaint.test.ts src/renderer/src/components/terminal-pane/pty-connection-hidden-replay.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-snapshot-escape-tail.test.ts src/shared/terminal-partial-escape-tail.test.ts src/shared/terminal-partial-escape-tail.fuzz.test.ts --reporter=dot", + "pnpm exec vitest run --config config/vitest.config.ts src/main/daemon/terminal-shell-lifecycle-scanner.test.ts src/main/daemon/terminal-shell-recovery-barrier.test.ts src/main/daemon/session-shell-recovery.test.ts src/main/daemon/session.test.ts src/main/daemon/terminal-host-concurrent-create.test.ts src/main/daemon/daemon-pty-adapter.test.ts src/main/daemon/daemon-restore-scrollback-depth.test.ts src/main/daemon/terminal-checkpoint-serializer.test.ts src/main/providers/agent-foreground-process.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/mobile-presence-lock.test.ts src/main/runtime/rpc/terminal-multiplex-escape-tail.test.ts src/renderer/src/components/terminal-pane/pty-connection-visibility-and-exit.test.ts src/renderer/src/components/terminal-pane/pty-connection-input-and-repaint.test.ts src/renderer/src/components/terminal-pane/pty-connection-hidden-replay.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-snapshot-escape-tail.test.ts src/shared/terminal-partial-escape-tail.test.ts src/shared/terminal-partial-escape-tail.fuzz.test.ts --reporter=dot", "pnpm exec vitest run --config config/vitest.config.ts tests/e2e/cross-version-wire/cross-version-terminal-wire.unit.test.ts --reporter=dot", "pnpm exec electron-vite build --mode e2e", "SKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-hidden-child-tui-kill-mode-reset.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1" @@ -8192,7 +8192,7 @@ "src/main/daemon/terminal-checkpoint-serializer.test.ts", "src/main/providers/agent-foreground-process.test.ts", "src/main/runtime/orca-runtime.test.ts", - "src/main/runtime/mobile-subscribe-integration.test.ts", + "src/main/runtime/mobile-presence-lock.test.ts", "src/main/runtime/rpc/terminal-multiplex-escape-tail.test.ts", "src/renderer/src/components/terminal-pane/pty-connection-visibility-and-exit.test.ts", "src/renderer/src/components/terminal-pane/pty-connection-input-and-repaint.test.ts", diff --git a/src/main/runtime/mobile-presence-lock.test.ts b/src/main/runtime/mobile-presence-lock.test.ts index 6289a1d2ba1..986582f1421 100644 --- a/src/main/runtime/mobile-presence-lock.test.ts +++ b/src/main/runtime/mobile-presence-lock.test.ts @@ -1,7 +1,9 @@ /** * Tests for the presence-based mobile driver lock (see docs/mobile-presence-lock.md). */ +import './mobile-subscribe-integration.spec' import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest' +import { listWorktrees } from '../git/worktree' import type * as GitUsernameModule from '../git/git-username' import { OrcaRuntimeService } from './orca-runtime' import type { RuntimePtyController } from './runtime-pty-controller-contract' @@ -69,6 +71,7 @@ const store = { // Why (#7588): held-modal repro needs indefinite hold (null); legacy tests need the finite 5s default. Wrap per-test without mutating the shared stub. function createRuntime(mobileAutoRestoreFitMs: number | null = 5_000) { + vi.mocked(listWorktrees).mockResolvedValue([]) const effectiveStore = { ...store, getSettings: () => ({ ...store.getSettings(), mobileAutoRestoreFitMs }) diff --git a/src/main/runtime/mobile-subscribe-integration.test.ts b/src/main/runtime/mobile-subscribe-integration.spec.ts similarity index 96% rename from src/main/runtime/mobile-subscribe-integration.test.ts rename to src/main/runtime/mobile-subscribe-integration.spec.ts index db5747f5394..d164d0b73fc 100644 --- a/src/main/runtime/mobile-subscribe-integration.test.ts +++ b/src/main/runtime/mobile-subscribe-integration.spec.ts @@ -2,52 +2,9 @@ * Integration tests for the server-authoritative mobile subscribe lifecycle. */ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest' -import type * as GitUsernameModule from '../git/git-username' +import { listWorktrees } from '../git/worktree' import { OrcaRuntimeService } from './orca-runtime' -vi.mock('../git/worktree', () => ({ - listWorktrees: vi.fn().mockResolvedValue([ - { - path: '/tmp/worktree-a', - head: 'abc', - branch: 'feature/foo', - isBare: false, - isMainWorktree: false - } - ]), - listWorktreesStrict: vi.fn().mockResolvedValue([]) -})) - -vi.mock('../hooks', () => ({ - getEffectiveHooks: vi.fn().mockReturnValue(null), - runHook: vi.fn().mockResolvedValue({ success: true, output: '' }) -})) -vi.mock('../worktree-runner-script', () => ({ createSetupRunnerScript: vi.fn() })) - -vi.mock('../ipc/worktree-logic', async (importOriginal) => { - const actual = (await importOriginal()) as Record - return { ...actual, computeWorktreePath: vi.fn(), ensurePathWithinWorkspace: vi.fn() } -}) - -vi.mock('../ipc/registered-worktree-roots-cache', () => ({ - invalidateAuthorizedRootsCache: vi.fn(), - invalidateAuthorizedRootsCacheForRepo: vi.fn() -})) - -vi.mock('../git/repo', async (importOriginal) => { - const actual = (await importOriginal()) as Record - return { - ...actual, - getDefaultBaseRef: vi.fn().mockReturnValue('origin/main'), - getBranchConflictKind: vi.fn().mockResolvedValue(null) - } -}) - -vi.mock('../git/git-username', async () => { - const actual = await vi.importActual('../git/git-username') - return { ...actual, resolveLocalGitUsername: vi.fn(async () => '') } -}) - // Why: default the mock store to the clamp floor (5_000ms) so legacy "restore fires after delay" assertions hold; the real default is indefinite/null. const LEGACY_RESTORE_MS = 5_000 const settingsState = { @@ -105,6 +62,15 @@ class ObservableRuntime extends OrcaRuntimeService { } function createRuntime() { + vi.mocked(listWorktrees).mockResolvedValue([ + { + path: '/tmp/worktree-a', + head: 'abc', + branch: 'feature/foo', + isBare: false, + isMainWorktree: false + } + ]) const runtime = new ObservableRuntime(store) const ptySizes = new Map() ptySizes.set('pty-1', { cols: 150, rows: 40 })