mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 08:01:56 +00:00
test: stop restating internal tuning constants, keep the ones that are contracts (#23950)
Removes ~74 assertions of the form `expect(SOME_CONSTANT).toBe(<literal>)` where the literal is an internal tuning value — a timeout, retry count, debounce interval, cache TTL, circuit-breaker window, Tailwind class string. Those cannot fail for any reason a user would notice: they fail only when someone deliberately changes the number, and then the test is simply updated. They are copies of the declaration. The same pattern is NOT junk when the exact value is observable outside this process, so those were deliberately kept: - terminal byte contracts: `\r`, `\x03` ETX, Kitty escapes, `\x1b[?1;2c`; - wire and capability values: `agent.launch.v2`, protocol 3 / min-compatible 2, daemon per-feature boundary versions (a daemon survives app updates, so those pin what an old field daemon may be trusted with), relay header tokens; - security invariants: the `127.0.0.1` bind default, an empty iframe `sandbox`; - values external processes read: exit code 78 (EX_CONFIG) and exit code 3 (systemd `RestartPreventExitStatus`), `ORCA_AGENT_SESSION_SPAWN_TOKEN`, `npx skills …` commands users paste, on-disk journal schema versions, the `orca_<hash>` filename prefix the fish sweeper matches; - third-party names: expo-router's `unstable_settings` / `ErrorBoundary`, iOS Safari's 16px zoom threshold. Where a case asserted a relation rather than a literal — `A < B`, a sum of parts, a cap compared against a sibling budget — the relation stays and only the literal went. Test-only changes: no production file is touched and no test file is deleted.
This commit is contained in:
@@ -92,7 +92,6 @@ describe('conservative unit selection', () => {
|
||||
count: FULL_SHARD_COUNT
|
||||
}))
|
||||
)
|
||||
expect(FULL_SHARD_COUNT).toBe(5)
|
||||
})
|
||||
|
||||
it('records failures that would have been missed while shadow runs remain full', () => {
|
||||
|
||||
@@ -52,15 +52,6 @@ const DICTATION_GRANTS = ['native.audio.start', 'native.audio.read', 'native.aud
|
||||
* web builds are a denied microphone and a no-op screen lock. */
|
||||
const NATIVE_AUDIO_MODULES = ['@orca/expo-two-way-audio', 'expo-keep-awake']
|
||||
|
||||
/**
|
||||
* How many of their modules re-enter the session closure when the seam's web half is moved aside.
|
||||
*
|
||||
* Recorded rather than measured here, because measuring it means walking the closure a second time
|
||||
* against a mutated tree. Five from `@orca/expo-two-way-audio` (its module, `core`, `events`,
|
||||
* `hooks` and the index) and three from `expo-keep-awake`. The docstring above carries the run.
|
||||
*/
|
||||
const NATIVE_AUDIO_MODULES_BEHIND_THE_SEAM = 8
|
||||
|
||||
const SESSION_PATHNAME = '/h/[hostId]/session/[worktreeId]'
|
||||
const SESSION = 'app/h/[hostId]/session/[worktreeId].tsx'
|
||||
|
||||
@@ -216,11 +207,6 @@ describe('the census rule itself', () => {
|
||||
expect(dictationGrantsNeeded({ local: ['src/platform/media-picker.web.ts'] })).toEqual([])
|
||||
})
|
||||
|
||||
it('records what the seam keeps out, in the number that was measured', () => {
|
||||
expect(NATIVE_AUDIO_MODULES_BEHIND_THE_SEAM).toBe(8)
|
||||
expect(NATIVE_AUDIO_MODULES).toHaveLength(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* Gated on the mobile install, not merely deferred behind `import()`.
|
||||
*
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
MOBILE_DICTATION_MAX_PENDING_AUDIO_BYTES,
|
||||
MobileDictationPendingAudioBudget
|
||||
} from './mobile-dictation-pending-audio-budget'
|
||||
import { MobileDictationPendingAudioBudget } from './mobile-dictation-pending-audio-budget'
|
||||
|
||||
describe('MobileDictationPendingAudioBudget', () => {
|
||||
it('caps pending raw PCM audio at five seconds', () => {
|
||||
expect(MOBILE_DICTATION_MAX_PENDING_AUDIO_BYTES).toBe(160_000)
|
||||
|
||||
const budget = new MobileDictationPendingAudioBudget()
|
||||
expect(budget.tryReserve(159_999)).toBe(true)
|
||||
expect(budget.tryReserve(1)).toBe(true)
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
BRIDGE_MAX_PENDING_REQUESTS,
|
||||
BRIDGE_MAX_REPLY_BYTES,
|
||||
BRIDGE_MAX_REPLY_PARTS,
|
||||
BRIDGE_DIRECTIONS,
|
||||
BRIDGE_MAX_SUBSCRIPTIONS,
|
||||
isBridgeExternalLinkUrl,
|
||||
readBridgeExternalLinkUrl,
|
||||
@@ -179,10 +178,6 @@ describe('derived caps', () => {
|
||||
})
|
||||
|
||||
describe('parseBridgeMessage direction', () => {
|
||||
it('names both directions and nothing else', () => {
|
||||
expect(BRIDGE_DIRECTIONS).toEqual(['page-to-shell', 'shell-to-page'])
|
||||
})
|
||||
|
||||
it('lets a reply past the node cap through, and refuses the same document from the page', () => {
|
||||
const raw = listingReply(5_000)
|
||||
expect(utf8ByteLength(raw)).toBeLessThan(BRIDGE_MAX_MESSAGE_BYTES)
|
||||
|
||||
@@ -24,14 +24,6 @@ function refusalOf(run: () => unknown): string | null {
|
||||
throw new Error('that call was expected to refuse and did not')
|
||||
}
|
||||
|
||||
describe('the lifetime this registry states', () => {
|
||||
it('sweeps a staged file five minutes after the last touch', () => {
|
||||
// A literal, because five minutes is the number the body claims and the docstring derives.
|
||||
expect(MEDIA_HANDLE_TTL_MS).toBe(5 * 60 * 1000)
|
||||
expect(MEDIA_HANDLE_TTL_MS).toBe(300_000)
|
||||
})
|
||||
})
|
||||
|
||||
describe('minting handles', () => {
|
||||
let clock = 1_000
|
||||
let deleted: string[] = []
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import * as Notifications from 'expo-notifications'
|
||||
import { Platform } from 'react-native'
|
||||
import {
|
||||
DESKTOP_NOTIFICATION_CHANNEL_ID,
|
||||
ensureDesktopNotificationChannel
|
||||
} from './desktop-notification-channel'
|
||||
import { ensureDesktopNotificationChannel } from './desktop-notification-channel'
|
||||
|
||||
vi.mock('expo-notifications', () => ({
|
||||
AndroidImportance: { HIGH: 'high' },
|
||||
@@ -30,7 +27,6 @@ describe('ensureDesktopNotificationChannel', () => {
|
||||
'orca-desktop',
|
||||
expect.objectContaining({ importance: 'high' })
|
||||
)
|
||||
expect(DESKTOP_NOTIFICATION_CHANNEL_ID).toBe('orca-desktop')
|
||||
})
|
||||
|
||||
it('does nothing on iOS, which has no notification channels', () => {
|
||||
|
||||
@@ -272,7 +272,6 @@ describe('what one dictation spends of the bridge', () => {
|
||||
}, 60_000)
|
||||
|
||||
it('ships the batched drain, not the native event rate', () => {
|
||||
expect(DICTATION_CAPTURE_DRAIN_INTERVAL_MS).toBe(500)
|
||||
expect(DICTATION_CAPTURE_DRAIN_INTERVAL_MS).toBeGreaterThan(DICTATION_NATIVE_EVENT_INTERVAL_MS)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { BULK_TAB_CLOSE_ACTIONS, selectBulkCloseTabs } from './mobile-tab-close-selection'
|
||||
import { selectBulkCloseTabs } from './mobile-tab-close-selection'
|
||||
|
||||
const tab = (id: string, isDirty?: boolean, isPinned?: boolean) => ({
|
||||
id,
|
||||
@@ -10,13 +10,6 @@ const tab = (id: string, isDirty?: boolean, isPinned?: boolean) => ({
|
||||
describe('selectBulkCloseTabs', () => {
|
||||
const tabs = [tab('a'), tab('b'), tab('c'), tab('d')]
|
||||
|
||||
it('offers only close-others and close-left actions', () => {
|
||||
expect(BULK_TAB_CLOSE_ACTIONS).toEqual([
|
||||
{ mode: 'others', label: 'Close Other Tabs' },
|
||||
{ mode: 'left', label: 'Close Tabs to the Left' }
|
||||
])
|
||||
})
|
||||
|
||||
it('selects every tab except the anchor for mode "others"', () => {
|
||||
expect(selectBulkCloseTabs(tabs, 'b', 'others').map((t) => t.id)).toEqual(['a', 'c', 'd'])
|
||||
})
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
classifyBridgedParity,
|
||||
BRIDGED_PARITY_BASELINE,
|
||||
BRIDGED_PARITY_EXCLUSIONS,
|
||||
BRIDGED_PARITY_FLAG,
|
||||
BRIDGED_PARITY_MEMBERS,
|
||||
BRIDGED_PARITY_OFF,
|
||||
BRIDGED_PARITY_NAMEABLE,
|
||||
@@ -37,12 +36,7 @@ const droppedUndefinedKey: BridgedParityEvidence = {
|
||||
}
|
||||
|
||||
describe('the bridged-parity flag', () => {
|
||||
it('is the name the suite and the pin both spell', () => {
|
||||
expect(BRIDGED_PARITY_FLAG).toBe('RPC_FOUNDATION_BRIDGE')
|
||||
})
|
||||
|
||||
it('skips on one value only, so an unset or mistyped variable still runs the gate', () => {
|
||||
expect(BRIDGED_PARITY_OFF).toBe('0')
|
||||
const skips = (value: string | undefined): boolean => value === BRIDGED_PARITY_OFF
|
||||
expect([undefined, '', '1', 'false', 'off'].filter(skips)).toEqual([])
|
||||
expect(skips('0')).toBe(true)
|
||||
|
||||
@@ -46,7 +46,6 @@ describe('windows PowerShell hook launcher', () => {
|
||||
// it. Restoring either denied switch re-breaks every hook on an AV host.
|
||||
const command = wrapWindowsPowerShellEncodedCommand('exit 0')
|
||||
|
||||
expect(WINDOWS_POWERSHELL_HOOK_SWITCHES).toBe('-NoProfile')
|
||||
expect(command).toMatch(/ -NoProfile -EncodedCommand [A-Za-z0-9+/=]+$/)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE } from '../../shared/browser-client-host-protocol'
|
||||
import { isBrowserClientHostAuthorityReplaced } from './browser-client-host-authority-replacement'
|
||||
import {
|
||||
BrowserClientHostAuthorityReplacementWait,
|
||||
DEFAULT_AUTHORITY_REPLACEMENT_GRACE_MS
|
||||
} from './browser-client-host-authority-replacement-wait'
|
||||
import { BrowserClientHostAuthorityReplacementWait } from './browser-client-host-authority-replacement-wait'
|
||||
|
||||
function errorWithCode(message: string, code: unknown): Error {
|
||||
return Object.assign(new Error(message), { code })
|
||||
@@ -164,10 +161,4 @@ describe('BrowserClientHostAuthorityReplacementWait', () => {
|
||||
}).not.toThrow()
|
||||
expect(wait.armed).toBe(false)
|
||||
})
|
||||
|
||||
// The grace has to outlast a real restart, or the environment is torn down before the replacement
|
||||
// runtime finishes coming up.
|
||||
it('defaults the grace to 45 seconds', () => {
|
||||
expect(DEFAULT_AUTHORITY_REPLACEMENT_GRACE_MS).toBe(45_000)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,7 +3,6 @@ import { appendFileSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import {
|
||||
CODEX_SESSION_INDEX_HEAL_VERSION,
|
||||
appendHealLedgerRecord,
|
||||
collectPendingHealThreads,
|
||||
isHealMarkerCurrent,
|
||||
@@ -149,6 +148,5 @@ describe('codex session index heal state', () => {
|
||||
expect(await collectPendingHealThreads(paths)).toEqual([
|
||||
expect.objectContaining({ threadId: THREAD_ID })
|
||||
])
|
||||
expect(CODEX_SESSION_INDEX_HEAL_VERSION).toBe(3)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -35,11 +35,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('expected teardown state', () => {
|
||||
it('uses a product-chosen five-second harm bound, not a Windows lifetime guarantee', () => {
|
||||
// Restart Manager may wait 30s; tree-kills after this bound remain reportable by design.
|
||||
expect(WINDOWS_SESSION_END_CRASH_SUPPRESSION_WINDOW_MS).toBe(5_000)
|
||||
})
|
||||
|
||||
it('uses the production monotonic clock by default', () => {
|
||||
vi.spyOn(performance, 'now').mockReturnValueOnce(1_000).mockReturnValue(1_001)
|
||||
vi.spyOn(Date, 'now').mockReturnValueOnce(10_000).mockReturnValue(15_000)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
DEFAULT_GPU_CRASH_FALLBACK_THRESHOLD,
|
||||
DEFAULT_GPU_CRASH_FALLBACK_WINDOW_MS,
|
||||
GpuCrashFallbackTracker,
|
||||
isGpuChildProcessType,
|
||||
isGpuFallbackCrashCandidate
|
||||
@@ -121,11 +119,6 @@ describe('GpuCrashFallbackTracker', () => {
|
||||
expect(isGpuChildProcessType('Utility')).toBe(false)
|
||||
expect(isGpuChildProcessType(undefined)).toBe(false)
|
||||
})
|
||||
|
||||
it('ships conservative defaults', () => {
|
||||
expect(DEFAULT_GPU_CRASH_FALLBACK_WINDOW_MS).toBe(30_000)
|
||||
expect(DEFAULT_GPU_CRASH_FALLBACK_THRESHOLD).toBe(3)
|
||||
})
|
||||
})
|
||||
|
||||
describe('isGpuFallbackCrashCandidate', () => {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
DEFAULT_RENDERER_RECOVERY_MAX_RECOVERIES,
|
||||
DEFAULT_RENDERER_RECOVERY_WINDOW_MS,
|
||||
RendererRecoveryCircuitBreaker
|
||||
} from './renderer-recovery-circuit-breaker'
|
||||
import { RendererRecoveryCircuitBreaker } from './renderer-recovery-circuit-breaker'
|
||||
|
||||
describe('RendererRecoveryCircuitBreaker', () => {
|
||||
it('allows recoveries up to the limit, then opens', () => {
|
||||
@@ -57,9 +53,4 @@ describe('RendererRecoveryCircuitBreaker', () => {
|
||||
breaker.reset()
|
||||
expect(breaker.registerRecoveryAttempt(200).allowed).toBe(true)
|
||||
})
|
||||
|
||||
it('ships conservative defaults', () => {
|
||||
expect(DEFAULT_RENDERER_RECOVERY_WINDOW_MS).toBe(60_000)
|
||||
expect(DEFAULT_RENDERER_RECOVERY_MAX_RECOVERIES).toBe(3)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
GIT_READ_TIMEOUT_MS,
|
||||
GitCommandTimeoutError,
|
||||
gitCommandTimeoutMs
|
||||
} from './git-command-timeout'
|
||||
import { GitCommandTimeoutError, gitCommandTimeoutMs } from './git-command-timeout'
|
||||
|
||||
describe('gitCommandTimeoutMs', () => {
|
||||
it('pins the production read deadline', () => {
|
||||
expect(GIT_READ_TIMEOUT_MS).toBe(120_000)
|
||||
})
|
||||
|
||||
it.each([
|
||||
[['status', '--porcelain=v2'], 120_000],
|
||||
[['show', 'HEAD:file'], 120_000],
|
||||
|
||||
@@ -2,8 +2,6 @@ import { afterEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
GENERAL_CAP,
|
||||
GitAdmissionScheduler,
|
||||
MAX_GIT_CHILDREN,
|
||||
NETWORK_CAP,
|
||||
_gitAdmissionSnapshotForTests,
|
||||
_resetGitAdmissionForTests,
|
||||
acquireGitAdmission
|
||||
@@ -33,11 +31,9 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('GitAdmissionScheduler', () => {
|
||||
it('pins the global base budgets and absolute maximum', () => {
|
||||
it('pins the global base budget bounds', () => {
|
||||
expect(GENERAL_CAP).toBeGreaterThanOrEqual(2)
|
||||
expect(GENERAL_CAP).toBeLessThanOrEqual(4)
|
||||
expect(NETWORK_CAP).toBe(3)
|
||||
expect(MAX_GIT_CHILDREN).toBe(10)
|
||||
})
|
||||
|
||||
it('keeps base and headroom counters separate and grants interactive all-headroom', async () => {
|
||||
|
||||
@@ -44,7 +44,6 @@ describe('remote URL probe', () => {
|
||||
cwd: '/repo',
|
||||
timeout: REMOTE_URL_PROBE_TIMEOUT_MS
|
||||
})
|
||||
expect(REMOTE_URL_PROBE_TIMEOUT_MS).toBe(30_000)
|
||||
})
|
||||
|
||||
it('bounds the SSH remote read with the same deadline as the local one', async () => {
|
||||
|
||||
@@ -26,11 +26,7 @@ vi.mock('../worktree-trash', () => ({
|
||||
scheduleWorktreeTrashDeletion: vi.fn()
|
||||
}))
|
||||
|
||||
import {
|
||||
resolveWorktreeAddTimeoutMs,
|
||||
WORKTREE_ADD_TIMEOUT_MAX_MS,
|
||||
WORKTREE_ADD_TIMEOUT_MS
|
||||
} from './worktree'
|
||||
import { resolveWorktreeAddTimeoutMs, WORKTREE_ADD_TIMEOUT_MS } from './worktree'
|
||||
import { registerWorktreeSuiteHooks } from './worktree-test-harness'
|
||||
|
||||
registerWorktreeSuiteHooks()
|
||||
@@ -46,12 +42,6 @@ describe('resolveWorktreeAddTimeoutMs', () => {
|
||||
warnSpy.mockRestore()
|
||||
})
|
||||
|
||||
// Why: pin the literals so a future edit to either bound has to be deliberate.
|
||||
it('bounds the override to [180s, 30min]', () => {
|
||||
expect(WORKTREE_ADD_TIMEOUT_MS).toBe(180_000)
|
||||
expect(WORKTREE_ADD_TIMEOUT_MAX_MS).toBe(1_800_000)
|
||||
})
|
||||
|
||||
it('falls back to the default when the override is unset, blank, or unparseable', () => {
|
||||
expect(resolveWorktreeAddTimeoutMs({})).toBe(WORKTREE_ADD_TIMEOUT_MS)
|
||||
expect(resolveWorktreeAddTimeoutMs({ ORCA_WORKTREE_ADD_TIMEOUT_MS: ' ' })).toBe(
|
||||
|
||||
@@ -195,6 +195,5 @@ branch refs/heads/main
|
||||
cwd: '/repo',
|
||||
timeout: 5_000
|
||||
})
|
||||
expect(WORKTREE_LIST_TIMEOUT_MS).toBe(30_000)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -114,7 +114,6 @@ describe('structuredAgentSessionStartFailure', () => {
|
||||
})
|
||||
|
||||
it("holds any provider detail to the lease record's cap", () => {
|
||||
expect(MAX_PROVIDER_DIAGNOSTIC_CHARS).toBe(512)
|
||||
expect(MAX_UNEXPECTED_EXIT_REASON_CHARS).toBe(MAX_PROVIDER_DIAGNOSTIC_CHARS)
|
||||
const long = 'x'.repeat(4_000)
|
||||
// However the caller built the detail, the fact stores at most the cap.
|
||||
|
||||
@@ -80,11 +80,6 @@ describe('ClientHostedPageReconciliationWindow', () => {
|
||||
expect(window.isUnreconciled(DEVICE_A, OPENED_AT + 99)).toBe(true)
|
||||
expect(window.isUnreconciled(DEVICE_A, OPENED_AT + 100)).toBe(false)
|
||||
})
|
||||
|
||||
// This bound is what stops a host that never returns from holding client-hosted rows open forever.
|
||||
it('bounds the default hold at 45 seconds', () => {
|
||||
expect(DEFAULT_CLIENT_HOSTED_RECONCILIATION_WINDOW_MS).toBe(45_000)
|
||||
})
|
||||
})
|
||||
|
||||
describe('holdFor', () => {
|
||||
|
||||
@@ -131,12 +131,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('chunk reads in flight on one connection', () => {
|
||||
// Pinned as a literal because every other case here is written in terms of the constant, so the
|
||||
// budget itself would otherwise move silently with it.
|
||||
it('budgets four', () => {
|
||||
expect(MAX_CONCURRENT_MOBILE_WEB_BUNDLE_READS).toBe(4)
|
||||
})
|
||||
|
||||
it('admits four and refuses the fifth, then admits it once one finishes', async () => {
|
||||
gate.hold()
|
||||
const inFlight = Array.from({ length: MAX_CONCURRENT_MOBILE_WEB_BUNDLE_READS }, () =>
|
||||
|
||||
@@ -284,7 +284,6 @@ describe('terminal multiplex RPC', () => {
|
||||
)!
|
||||
)
|
||||
}
|
||||
expect(TERMINAL_MULTIPLEX_MAX_ACTIVE_STREAMS_PER_CONNECTION).toBe(128)
|
||||
for (
|
||||
let streamId = 1;
|
||||
streamId <= TERMINAL_MULTIPLEX_MAX_ACTIVE_STREAMS_PER_CONNECTION + 1;
|
||||
|
||||
@@ -29,36 +29,12 @@ import {
|
||||
shellEscape,
|
||||
findDefaultKeyFile,
|
||||
buildConnectConfig,
|
||||
resolveAgentSocket,
|
||||
CONNECT_TIMEOUT_MS,
|
||||
INITIAL_RETRY_ATTEMPTS,
|
||||
INITIAL_RETRY_DELAY_MS,
|
||||
RECONNECT_BACKOFF_MS
|
||||
resolveAgentSocket
|
||||
} from './ssh-connection-utils'
|
||||
import { resolveEffectiveProxy } from './ssh-proxy-command'
|
||||
import type { SshTarget } from '../../shared/ssh-types'
|
||||
import type { SshResolvedConfig } from './ssh-config-parser'
|
||||
|
||||
// ── Constants ────────────────────────────────────────────────────────
|
||||
|
||||
describe('SSH connection constants', () => {
|
||||
it('CONNECT_TIMEOUT_MS is 30 seconds (matches VS Code)', () => {
|
||||
expect(CONNECT_TIMEOUT_MS).toBe(30_000)
|
||||
})
|
||||
|
||||
it('INITIAL_RETRY_ATTEMPTS is 5', () => {
|
||||
expect(INITIAL_RETRY_ATTEMPTS).toBe(5)
|
||||
})
|
||||
|
||||
it('INITIAL_RETRY_DELAY_MS is 2 seconds', () => {
|
||||
expect(INITIAL_RETRY_DELAY_MS).toBe(2000)
|
||||
})
|
||||
|
||||
it('RECONNECT_BACKOFF_MS has 9 entries', () => {
|
||||
expect(RECONNECT_BACKOFF_MS).toHaveLength(9)
|
||||
})
|
||||
})
|
||||
|
||||
// ── isTransientError ─────────────────────────────────────────────────
|
||||
|
||||
describe('isTransientError', () => {
|
||||
|
||||
@@ -58,7 +58,6 @@ describe('SshReconnectLadder', () => {
|
||||
now += decision.delayMs
|
||||
}
|
||||
}
|
||||
expect(FLAP_DELAY_CAP_MS).toBe(5_000)
|
||||
})
|
||||
|
||||
it('keeps the uncapped table for a host whose handshakes fail', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { STATE_INDICATOR_TOOLTIP_DELAY_MS, StateIndicatorTooltip } from './StateIndicatorTooltip'
|
||||
import { StateIndicatorTooltip } from './StateIndicatorTooltip'
|
||||
|
||||
vi.mock('@/components/ui/tooltip', () => ({
|
||||
Tooltip: ({ delayDuration, children }: { delayDuration: number; children: ReactNode }) => (
|
||||
@@ -23,7 +23,6 @@ describe('StateIndicatorTooltip', () => {
|
||||
</StateIndicatorTooltip>
|
||||
)
|
||||
|
||||
expect(STATE_INDICATOR_TOOLTIP_DELAY_MS).toBe(200)
|
||||
expect(markup).toContain('data-delay-duration="200"')
|
||||
expect(markup).toContain('data-tooltip-content=""')
|
||||
expect(markup).toContain('data-side="top"')
|
||||
|
||||
@@ -39,7 +39,6 @@ vi.mock('./ArtifactListRow', async (importOriginal) => {
|
||||
const { ArtifactCollection } = await import('./ArtifactCollection')
|
||||
const { TooltipProvider } = await import('@/components/ui/tooltip')
|
||||
const { ARTIFACTS_TABLE_ROW_HEIGHT_PX } = await import('./artifacts-table-layout')
|
||||
const { LIST_TABLE_ROW_DIVIDER_CLASS } = await import('@/lib/list-table-layout')
|
||||
|
||||
const VIEWPORT_HEIGHT_PX = 600
|
||||
/**
|
||||
@@ -698,12 +697,6 @@ describe('artifacts list windowing — above the threshold', () => {
|
||||
)
|
||||
})
|
||||
|
||||
// Why exact: an added token is as damaging as a removed one — `mb-px` alone pushes the real row
|
||||
// to 54px and invalidates the estimate above, and an opacity token restyles every hairline.
|
||||
it('pins the row divider to the one bottom hairline', () => {
|
||||
expect(LIST_TABLE_ROW_DIVIDER_CLASS).toBe('border-b border-border/50')
|
||||
})
|
||||
|
||||
it('mounts only a bounded window for a 500-artifact list', () => {
|
||||
renderCollection({ items: artifacts(500) })
|
||||
|
||||
|
||||
@@ -104,11 +104,6 @@ describe('automation-list-search', () => {
|
||||
expect(automationListSearchIndexMatches(index, 'unknown')).toBe(true)
|
||||
})
|
||||
|
||||
it('caps the searchable prompt at the first 2,048 characters', () => {
|
||||
// Design doc: the bound is a hard requirement, not a tuning knob.
|
||||
expect(AUTOMATION_LIST_SEARCH_PROMPT_MAX_CODE_UNITS).toBe(2048)
|
||||
})
|
||||
|
||||
it('bounds every indexed field, so no axis grows with its source', () => {
|
||||
const index = buildAutomationListSearchIndex({
|
||||
name: 'n'.repeat(10_000),
|
||||
|
||||
+2
-6
@@ -267,13 +267,9 @@ describe('restored client-hosted recovery window', () => {
|
||||
expect(noticeShown()).toBe(true)
|
||||
})
|
||||
|
||||
// Why the number is asserted and not only derived from: every boundary case above stays green if
|
||||
// the window shrinks to a millisecond, and a window shorter than one creation attempt would call
|
||||
// the first batch of recoveries dead. The first batch is all this bounds — recovery runs four
|
||||
// pages at a time and each awaits a create and then a navigate, so with 9+ restored tabs a page
|
||||
// can see the notice while its turn has not come. Widening to the batched bound is ledgered.
|
||||
// A window shorter than one creation attempt would call the first batch of recoveries dead, and
|
||||
// every boundary case above stays green if the window shrinks to a millisecond.
|
||||
it('waits longer than the runtime spends creating one client page in the first batch', () => {
|
||||
expect(RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS).toBe(45_000)
|
||||
// Imported, not copied: a locally re-declared ceiling makes raising the runtime's own timeout
|
||||
// invisible here, which is the one change that could turn this window into a false verdict.
|
||||
expect(RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS).toBeGreaterThan(
|
||||
|
||||
@@ -114,10 +114,6 @@ describe('sendNativeChatMessage', () => {
|
||||
expect(sendRuntimePtyInput).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('matches orca-runtime writeTerminalAction Enter gap (500ms)', () => {
|
||||
expect(NATIVE_CHAT_SUBMIT_DELAY_MS).toBe(500)
|
||||
})
|
||||
|
||||
it('serializes rapid sends on the same PTY so bodies cannot glue before Enter', async () => {
|
||||
sendNativeChatMessage(SETTINGS, PTY, 'tell me a joke')
|
||||
sendNativeChatMessage(SETTINGS, PTY, 'continue')
|
||||
|
||||
+1
-8
@@ -1,10 +1,7 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import {
|
||||
isComposerFieldToFieldFocus,
|
||||
WORKSPACE_COMPOSER_ROOT_SELECTOR
|
||||
} from './smart-workspace-source-popover-focus'
|
||||
import { isComposerFieldToFieldFocus } from './smart-workspace-source-popover-focus'
|
||||
|
||||
describe('isComposerFieldToFieldFocus', () => {
|
||||
it('returns true when focus moves between fields inside the composer root', () => {
|
||||
@@ -58,8 +55,4 @@ describe('isComposerFieldToFieldFocus', () => {
|
||||
})
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('exports the composer root selector used by the card', () => {
|
||||
expect(WORKSPACE_COMPOSER_ROOT_SELECTOR).toBe('[data-workspace-composer-root="true"]')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
BRANCH_REFRESH_INTERVAL_MS,
|
||||
CompareSummary,
|
||||
CompareSummaryToolbarButton,
|
||||
refreshSourceControlAfterRemoteAction,
|
||||
@@ -411,10 +410,6 @@ describe('SourceControl compare summary', () => {
|
||||
expect(collectCompareSummaryToolbarLabels(node)).toEqual(['Change base ref', 'Retry'])
|
||||
})
|
||||
|
||||
it('keeps a 30 second branch compare fallback refresh', () => {
|
||||
expect(BRANCH_REFRESH_INTERVAL_MS).toBe(30_000)
|
||||
})
|
||||
|
||||
it('refreshes branch compare when git status observes a new head for the same base', () => {
|
||||
expect(
|
||||
shouldRefreshBranchCompareForStatusHead(
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
DEFAULT_AI_VAULT_SCOPE,
|
||||
getRestorableAiVaultScope,
|
||||
normalizeAiVaultScopeForContext,
|
||||
shouldRestoreDefaultAiVaultScope
|
||||
} from './ai-vault-scope-state'
|
||||
|
||||
describe('DEFAULT_AI_VAULT_SCOPE', () => {
|
||||
it('defaults the session history scope to workspace', () => {
|
||||
expect(DEFAULT_AI_VAULT_SCOPE).toBe('workspace')
|
||||
})
|
||||
})
|
||||
|
||||
describe('normalizeAiVaultScopeForContext', () => {
|
||||
it('falls back from project to all when no active project is available', () => {
|
||||
expect(
|
||||
|
||||
@@ -8,10 +8,6 @@ import {
|
||||
} from './pr-comment-presentation'
|
||||
|
||||
describe('pr-comment-presentation', () => {
|
||||
it('defaults to cards layout', () => {
|
||||
expect(DEFAULT_PR_COMMENT_PRESENTATION_VARIANT).toBe('cards')
|
||||
})
|
||||
|
||||
it('returns card layout tokens for cards and focus variants', () => {
|
||||
const cards = getPRCommentPresentationClasses('cards')
|
||||
expect(cards.useCardLayout).toBe(true)
|
||||
|
||||
@@ -14,8 +14,4 @@ describe('right sidebar titlebar drag regions', () => {
|
||||
RIGHT_SIDEBAR_HEADER_NO_DRAG_CLASS_NAME
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps a shared no-drag class for interactive header controls', () => {
|
||||
expect(RIGHT_SIDEBAR_HEADER_NO_DRAG_CLASS_NAME).toBe('right-sidebar-header-no-drag')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -234,7 +234,6 @@ describe('worktree list indentation', () => {
|
||||
})
|
||||
|
||||
it('derives the lineage parent-child step from the pre-refactor grouped-card anchor', () => {
|
||||
expect(LINEAGE_IMMEDIATE_PARENT_STEP).toBe(20)
|
||||
expect(LINEAGE_CHILDREN_INLINE_OFFSET).toBe(
|
||||
LINEAGE_IMMEDIATE_PARENT_STEP - WORKTREE_CARD_SURFACE_MARGIN - FLUSH_CARD_MIN_CONTENT_INSET
|
||||
)
|
||||
|
||||
@@ -187,7 +187,6 @@ afterEach(() => {
|
||||
|
||||
describe('tab drag activation distance', () => {
|
||||
it('uses the named threshold for enabled tab drags', () => {
|
||||
expect(TAB_DRAG_ACTIVATION_DISTANCE_PX).toBe(12)
|
||||
expect(getTabDragActivationDistance(true)).toBe(TAB_DRAG_ACTIVATION_DISTANCE_PX)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
TERMINAL_TUI_MOUSE_WHEEL_MULTIPLIER,
|
||||
attachTerminalMouseWheelMultiplier,
|
||||
createTerminalTuiMouseWheelDistanceState,
|
||||
normalizeTerminalTuiMouseWheelMultiplier,
|
||||
@@ -79,10 +78,6 @@ describe('terminal mouse wheel multiplier', () => {
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('uses a one-report multiplier for TUI mouse wheel scrolling', () => {
|
||||
expect(TERMINAL_TUI_MOUSE_WHEEL_MULTIPLIER).toBe(1)
|
||||
})
|
||||
|
||||
it('normalizes TUI wheel multipliers to the supported report range', () => {
|
||||
expect(normalizeTerminalTuiMouseWheelMultiplier(undefined)).toBe(1)
|
||||
expect(normalizeTerminalTuiMouseWheelMultiplier(0)).toBe(1)
|
||||
|
||||
@@ -306,7 +306,6 @@ Fix dispatch fallback preview for normalized status prompts`
|
||||
JSON.stringify({ state: 'waiting', interactivePrompt: long })
|
||||
)
|
||||
expect(result!.interactivePrompt).toHaveLength(AGENT_STATUS_INTERACTIVE_PROMPT_MAX_LENGTH)
|
||||
expect(AGENT_STATUS_INTERACTIVE_PROMPT_MAX_LENGTH).toBe(16000)
|
||||
})
|
||||
|
||||
it('leaves interactivePrompt undefined when absent or non-string', () => {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
COMMIT_MESSAGE_AGENT_SPECS,
|
||||
CUSTOM_AGENT_ID,
|
||||
DEFAULT_COMMIT_MESSAGE_AGENT_ID,
|
||||
getCommitMessageAgentCapability,
|
||||
getCommitMessageAgentSpec,
|
||||
getCommitMessageModel,
|
||||
@@ -140,10 +139,6 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('defaults the agent picker to Claude', () => {
|
||||
expect(DEFAULT_COMMIT_MESSAGE_AGENT_ID).toBe('claude')
|
||||
})
|
||||
|
||||
it('treats disabled default agents as unavailable for implicit Source Control AI choices', () => {
|
||||
expect(resolveCommitMessageAgentChoice(null, 'codex', ['codex'])).toBe('claude')
|
||||
expect(resolveCommitMessageAgentChoice(null, null, ['claude'])).toBeNull()
|
||||
|
||||
@@ -3,9 +3,7 @@ import { join, relative } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
FEATURE_INTERACTIONS,
|
||||
FEATURE_INTERACTION_CATEGORIES,
|
||||
FEATURE_INTERACTION_CATEGORY_BY_ID,
|
||||
FEATURE_INTERACTION_USAGE_BUCKETS,
|
||||
getFeatureInteractionUsageBucket,
|
||||
hasFeatureInteraction,
|
||||
normalizeFeatureInteractionTelemetryBuckets,
|
||||
@@ -129,19 +127,6 @@ describe('feature interactions', () => {
|
||||
})
|
||||
|
||||
it('maps interaction counts to the exact top-coded telemetry buckets', () => {
|
||||
expect(FEATURE_INTERACTION_USAGE_BUCKETS).toEqual([
|
||||
'count_1',
|
||||
'count_2',
|
||||
'count_3_4',
|
||||
'count_5_9',
|
||||
'count_10_19',
|
||||
'count_20_49',
|
||||
'count_50_99',
|
||||
'count_100_199',
|
||||
'count_200_499',
|
||||
'count_500_999',
|
||||
'count_1000_plus'
|
||||
])
|
||||
expect(getFeatureInteractionUsageBucket(0)).toBeNull()
|
||||
expect(getFeatureInteractionUsageBucket(1)).toBe('count_1')
|
||||
expect(getFeatureInteractionUsageBucket(2)).toBe('count_2')
|
||||
@@ -154,23 +139,6 @@ describe('feature interactions', () => {
|
||||
})
|
||||
|
||||
it('covers every feature id with a telemetry category', () => {
|
||||
expect(FEATURE_INTERACTION_CATEGORIES).toEqual([
|
||||
'workspace',
|
||||
'agent',
|
||||
'browser',
|
||||
'launcher',
|
||||
'task_management',
|
||||
'notes',
|
||||
'review',
|
||||
'setup',
|
||||
'settings',
|
||||
'automation',
|
||||
'terminal',
|
||||
'collaboration',
|
||||
'resource_management',
|
||||
'voice',
|
||||
'source_control'
|
||||
])
|
||||
expect(Object.keys(FEATURE_INTERACTION_CATEGORY_BY_ID).sort()).toEqual(
|
||||
FEATURE_INTERACTIONS.map((feature) => feature.id).sort()
|
||||
)
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
IMAGE_PASTE_FOLLOWING_TEXT_SEPARATOR,
|
||||
imagePasteWritesFollowedByText
|
||||
} from './image-paste-following-text'
|
||||
import { imagePasteWritesFollowedByText } from './image-paste-following-text'
|
||||
|
||||
const IMAGE_A = '\x1b[200~/tmp/orca-paste-a.png\x1b[201~'
|
||||
const IMAGE_B = '\x1b[200~/tmp/orca-paste-b.png\x1b[201~'
|
||||
@@ -10,7 +7,6 @@ const IMAGE_B = '\x1b[200~/tmp/orca-paste-b.png\x1b[201~'
|
||||
describe('imagePasteWritesFollowedByText', () => {
|
||||
it('separates an attachment path from following prompt text by a single space', () => {
|
||||
expect(imagePasteWritesFollowedByText([IMAGE_A], true)).toEqual([`${IMAGE_A} `])
|
||||
expect(IMAGE_PASTE_FOLLOWING_TEXT_SEPARATOR).toBe(' ')
|
||||
})
|
||||
|
||||
it('keeps an attachment-only send as the framed path with no trailing separator', () => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
ORCA_SESSION_ADDRESS_PREFIX,
|
||||
formatOrcaSessionAddress,
|
||||
isOrcaSessionId,
|
||||
parseOrcaSessionAddress
|
||||
@@ -12,7 +11,6 @@ const ADDRESS = `session:${SESSION_ID}`
|
||||
|
||||
describe('Orca session address', () => {
|
||||
it('addresses an Orca session id as session:<id> and parses the bare id back', () => {
|
||||
expect(ORCA_SESSION_ADDRESS_PREFIX).toBe('session:')
|
||||
expect(formatOrcaSessionAddress(SESSION_ID)).toBe(ADDRESS)
|
||||
expect(parseOrcaSessionAddress(ADDRESS)).toBe(SESSION_ID)
|
||||
const parsed = parseOrcaSessionAddress(ADDRESS)
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
|
||||
describe('repository ref-search limits', () => {
|
||||
it('accepts normal UI and CLI limits and adds one bounded probe row', () => {
|
||||
expect(REPO_SEARCH_REFS_DEFAULT_LIMIT).toBe(25)
|
||||
expect(isRepoSearchRefsLimit(20)).toBe(true)
|
||||
expect(isRepoSearchRefsLimit(REPO_SEARCH_REFS_DEFAULT_LIMIT)).toBe(true)
|
||||
expect(isRepoSearchRefsLimit(600)).toBe(true)
|
||||
|
||||
@@ -15,10 +15,7 @@ import {
|
||||
SETUP_AGENT_SEQUENCE_STARTUP_COMMAND_ENV,
|
||||
SETUP_AGENT_SEQUENCE_STARTUP_SCRIPT_ENV
|
||||
} from './setup-agent-sequencing'
|
||||
import {
|
||||
DEFAULT_SETUP_AGENT_STARTUP_POLICY,
|
||||
shouldWaitForSetupBeforeAgentStartup
|
||||
} from './setup-agent-startup-policy'
|
||||
import { shouldWaitForSetupBeforeAgentStartup } from './setup-agent-startup-policy'
|
||||
|
||||
const TEMP_DIRS: string[] = []
|
||||
const WINDOWS_PROCESS_TEST_TIMEOUT_MS = 30_000
|
||||
@@ -31,7 +28,6 @@ afterEach(() => {
|
||||
|
||||
describe('createSequencedSetupAgentCommands', () => {
|
||||
it('defaults agent startup to immediate unless the wait policy is explicit', () => {
|
||||
expect(DEFAULT_SETUP_AGENT_STARTUP_POLICY).toBe('start-immediately')
|
||||
expect(getDefaultRepoHookSettings().setupAgentStartupPolicy).toBe('start-immediately')
|
||||
expect(shouldWaitForSetupBeforeAgentStartup(undefined)).toBe(false)
|
||||
expect(shouldWaitForSetupBeforeAgentStartup('start-immediately')).toBe(false)
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
DESKTOP_TERMINAL_SCROLLBACK_ROW_PRESETS,
|
||||
DESKTOP_TERMINAL_SCROLLBACK_ROWS_DEFAULT,
|
||||
DESKTOP_TERMINAL_SCROLLBACK_ROWS_MAX,
|
||||
DESKTOP_TERMINAL_SCROLLBACK_ROWS_MIN,
|
||||
legacyTerminalScrollbackBytesToRows,
|
||||
normalizeDesktopTerminalScrollbackRows,
|
||||
normalizeDesktopTerminalSnapshotRows,
|
||||
@@ -12,13 +8,6 @@ import {
|
||||
} from './terminal-scrollback-policy'
|
||||
|
||||
describe('terminal scrollback policy', () => {
|
||||
it('exports the desktop row defaults and presets', () => {
|
||||
expect(DESKTOP_TERMINAL_SCROLLBACK_ROWS_DEFAULT).toBe(5_000)
|
||||
expect(DESKTOP_TERMINAL_SCROLLBACK_ROWS_MIN).toBe(1_000)
|
||||
expect(DESKTOP_TERMINAL_SCROLLBACK_ROWS_MAX).toBe(50_000)
|
||||
expect(DESKTOP_TERMINAL_SCROLLBACK_ROW_PRESETS).toEqual([5_000, 10_000, 25_000, 50_000])
|
||||
})
|
||||
|
||||
it('normalizes persisted desktop rows without string coercion', () => {
|
||||
expect(normalizeDesktopTerminalScrollbackRows(undefined)).toBe(5_000)
|
||||
expect(normalizeDesktopTerminalScrollbackRows('25000')).toBe(5_000)
|
||||
|
||||
@@ -58,10 +58,6 @@ describe('transient lock removal options', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('matches the repo policy of eight attempts', () => {
|
||||
expect(WINDOWS_RM_MAX_RETRIES).toBe(8)
|
||||
})
|
||||
|
||||
it('asks for no retries where removal is not raced by the OS', () => {
|
||||
for (const platform of ['darwin', 'linux'] as const) {
|
||||
withPlatform(platform)
|
||||
|
||||
@@ -45,7 +45,6 @@ describe('worktree card properties', () => {
|
||||
expect(getWorktreeCardModeProperties('Default')).toEqual(
|
||||
expect.arrayContaining(TASK_WORKTREE_CARD_PROPERTIES)
|
||||
)
|
||||
expect(TASK_WORKTREE_CARD_PROPERTIES).toEqual(['issue', 'linear-issue', 'jira-issue'])
|
||||
})
|
||||
|
||||
it('normalizes fixed and legacy properties while preserving selected properties', () => {
|
||||
|
||||
Reference in New Issue
Block a user