mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 16:02:29 +00:00
Audit sweep over `src/relay`, `src/preload` and `src/shared` (1,087 test files reviewed). 101 case declarations removed across 40 files, 6 test files deleted outright, 1,143 lines gone. Executed-case count falls further, since several removals were `it.each` tables. Dominant patterns, by frequency: - Self-comparisons that cannot fail: `expect(f(x)).toBe(f(x))`, `JSON.parse(JSON.stringify(literal))` deep-equalling the literal for a type with no codec, and `normalizeKeyToken(t) === normalizeKeyToken(t)` presented as proof of memoization. - Object literals asserting their own fields back, where the guarantee comes from the type annotation and the runtime assertion cannot fail. - Copied inventories: constants compared to their own initializers, and a function returning a copy of an exported constant checked against that constant's literal contents. - Duplicate invocations of a contract owned at a stronger boundary, including provider-local replays of a shared helper. - Table rows varying a field production never reads, so every row runs one path. - Names promising more than the input exercises: a "Windows launch" case in a module with no platform input, and a case whose named branch is never entered. Two production symbols go with them, each a test-only export whose sole caller was a deleted case: - `getGitHubProjectRefInputByteLength` — a one-line forward to `getClipboardTextByteLength`. The real bound (`GITHUB_PROJECT_REF_INPUT_MAX_BYTES`) and its guard stay. - `GRAB_STYLE_PROPERTIES` — an intended shared source of truth that nothing ever consulted; the property set is hand-enumerated at three independent sites. One case was deliberately restored and strengthened rather than dropped. The relay integration suite is the only place the real `SshChannelMultiplexer` is wired to `RelayDispatcher`, so it reaches transport behavior the handler suites cannot (they use `createMockDispatcher`). Its `fs.writeFile` roundtrip is the one case producing a void result, and `JSON.stringify` drops an absent `result` member — a shape no other surviving case exercises. Restored with an assertion pinning what the client actually observes: `null`, not `undefined`. That assertion failed on first run, so the fact was previously unasserted anywhere. One deletion was reverted mid-audit. A case asserting that optional fields stay invisible to "old attach and ready decoders" builds those decoders from `z.object` schemas declared in the test file, so it demonstrates zod's unknown-key stripping rather than anything shipped. It is nonetheless the only forward-compatibility coverage these envelopes have, and `reliability-gates.jsonc:6232` names it as evidence verbatim, so it stays. Note that `check-reliability-gates.mjs` passed both with and without it: the script resolves manifest paths and commands, and does not check that a named assertion still corresponds to a live case. Kept deliberately: everything a reliability gate cites as evidence; the three `registers all expected handlers` RPC manifests (a dropped registration is a silent wire break no type checker catches, and one carries the STA-4571 `pty.ackData` ratchet); the `child-process` direct-import ratchet; and prototype-spy cases paired with a `.repeat(10_000)` input, which assert a real memory bound rather than merely forbidding a technique. Verified: `pnpm test src/shared src/relay src/preload` (1073 files, 11996 passed, 1 pre-existing `it.fails`, 131 skipped), `pnpm tc` after clearing `.tsbuildinfo`, `check-reliability-gates.mjs` (140 gates), `check:code-quality:changed` (0 new findings).
188 lines
7.1 KiB
TypeScript
188 lines
7.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { DEFAULT_TERMINAL_INACTIVE_PANE_OPACITY, getDefaultSettings } from './constants'
|
|
import { getDefaultNotificationSettings } from './notification-settings-defaults'
|
|
import {
|
|
getDefaultPrimarySelectionMiddleClickPaste,
|
|
getDefaultTerminalRightClickToPaste
|
|
} from './terminal-platform-defaults'
|
|
|
|
describe('getDefaultSettings', () => {
|
|
it('uses platform-consistent separators for the default workspace directory', () => {
|
|
expect(getDefaultSettings('/Users/alice').workspaceDir).toBe('/Users/alice/orca/workspaces')
|
|
expect(getDefaultSettings('C:\\Users\\alice').workspaceDir).toBe(
|
|
'C:\\Users\\alice\\orca\\workspaces'
|
|
)
|
|
})
|
|
|
|
it('enables gitignored file decorations by default', () => {
|
|
expect(getDefaultSettings('/tmp').showGitIgnoredFiles).toBe(true)
|
|
})
|
|
|
|
it('uses list view for Source Control changes by default', () => {
|
|
expect(getDefaultSettings('/tmp').sourceControlViewMode).toBe('list')
|
|
})
|
|
|
|
it('keeps Source Control changes first by default', () => {
|
|
expect(getDefaultSettings('/tmp').sourceControlGroupOrder).toBe('changes-first')
|
|
})
|
|
|
|
it('defaults mobile pairing to discovered network addresses', () => {
|
|
expect(getDefaultSettings('/tmp').mobilePairingCustomAddress).toBeNull()
|
|
expect(getDefaultSettings('/tmp').mobilePairingCustomAddresses).toEqual([])
|
|
})
|
|
|
|
it('keeps first-work branch auto-renaming on by default for new settings', () => {
|
|
expect(getDefaultSettings('/tmp').autoRenameBranchFromWork).toBe(true)
|
|
expect(getDefaultSettings('/tmp').autoRenameBranchFromWorkDefaultedOn).toBe(true)
|
|
})
|
|
|
|
it('uses a block terminal cursor by default for new settings', () => {
|
|
expect(getDefaultSettings('/tmp').terminalCursorStyle).toBe('block')
|
|
expect(getDefaultSettings('/tmp').terminalCursorStyleDefaultedToBlock).toBe(true)
|
|
})
|
|
|
|
it('allows OSC 52 clipboard writes by default for new settings', () => {
|
|
expect(getDefaultSettings('/tmp').terminalAllowOsc52Clipboard).toBe(true)
|
|
expect(getDefaultSettings('/tmp').terminalAllowOsc52ClipboardDefaultedOnForAllUsers).toBe(true)
|
|
})
|
|
|
|
it('enables separate light terminal theme by default', () => {
|
|
expect(getDefaultSettings('/tmp').terminalUseSeparateLightTheme).toBe(true)
|
|
})
|
|
|
|
it('keeps inactive terminal panes readable by default', () => {
|
|
expect(getDefaultSettings('/tmp').terminalInactivePaneOpacity).toBe(
|
|
DEFAULT_TERMINAL_INACTIVE_PANE_OPACITY
|
|
)
|
|
})
|
|
|
|
it('asks before closing terminals with running processes by default', () => {
|
|
expect(getDefaultSettings('/tmp').skipCloseTerminalWithRunningProcessConfirm).toBe(false)
|
|
})
|
|
|
|
it('uses system language by default', () => {
|
|
expect(getDefaultSettings('/tmp').uiLanguage).toBe('system')
|
|
})
|
|
|
|
it('defaults the menu bar icon on so the value round-trips across platforms', () => {
|
|
expect(getDefaultSettings('/tmp').showMenuBarIcon).toBe(true)
|
|
})
|
|
|
|
it('shows terminal link actions by default', () => {
|
|
expect(getDefaultSettings('/tmp').terminalLinkActionPopoverEnabled).toBe(true)
|
|
})
|
|
|
|
it('confirms before closing pinned tabs by default', () => {
|
|
expect(getDefaultSettings('/tmp').confirmClosePinnedTab).toBe(true)
|
|
})
|
|
|
|
it('keeps file-editor word wrapping enabled by default', () => {
|
|
expect(getDefaultSettings('/tmp').editorWordWrap).toBe(true)
|
|
})
|
|
|
|
it('keeps rich Markdown spellcheck enabled by default', () => {
|
|
expect(getDefaultSettings('/tmp').richMarkdownSpellcheckEnabled).toBe(true)
|
|
})
|
|
|
|
it('enables Source Control AI by default without pinning a separate agent', () => {
|
|
expect(getDefaultSettings('/tmp').commitMessageAi).toMatchObject({
|
|
enabled: true,
|
|
agentId: null,
|
|
selectedModelByAgent: {}
|
|
})
|
|
expect(getDefaultSettings('/tmp').sourceControlAi).toMatchObject({
|
|
enabled: true,
|
|
agentId: null,
|
|
selectedModelByAgent: {},
|
|
instructionsByOperation: {
|
|
commitMessage: '',
|
|
pullRequest: '',
|
|
branchName: ''
|
|
}
|
|
})
|
|
})
|
|
|
|
it('keeps compact worktree cards disabled by default', () => {
|
|
expect(getDefaultSettings('/tmp').compactWorktreeCards).toBe(false)
|
|
})
|
|
|
|
it('keeps per-workspace environments disabled by default', () => {
|
|
expect(getDefaultSettings('/tmp').experimentalEphemeralVms).toBe(false)
|
|
})
|
|
|
|
it('keeps the agent dashboard popout disabled by default', () => {
|
|
expect(getDefaultSettings('/tmp').experimentalAgentDashboardPopout).toBeUndefined()
|
|
expect(getDefaultSettings('/tmp').experimentalAgentDashboardShowIdle).toBeUndefined()
|
|
})
|
|
|
|
it('defaults local Windows projects to the host runtime', () => {
|
|
expect(getDefaultSettings('/tmp').localWindowsRuntimeDefault).toEqual({
|
|
kind: 'windows-host'
|
|
})
|
|
})
|
|
|
|
it('suppresses notifications for the focused worktree by default for new users', () => {
|
|
expect(getDefaultNotificationSettings().suppressWhenFocused).toBe(true)
|
|
expect(getDefaultSettings('/tmp').notifications.suppressWhenFocused).toBe(true)
|
|
})
|
|
|
|
it('defaults agent launch args to yolo mode where the CLI supports it', () => {
|
|
const settings = getDefaultSettings('/tmp')
|
|
|
|
expect(settings.agentDefaultArgs).toMatchObject({
|
|
claude: '--dangerously-skip-permissions',
|
|
codex: '--dangerously-bypass-approvals-and-sandbox',
|
|
gemini: '--yolo',
|
|
cursor: '--yolo',
|
|
muse: '--yolo',
|
|
copilot: '--yolo',
|
|
grok: '--permission-mode bypassPermissions'
|
|
})
|
|
expect(settings.agentDefaultArgs).not.toHaveProperty('opencode')
|
|
expect(settings.agentDefaultArgs).not.toHaveProperty('kilo')
|
|
expect(settings.agentDefaultEnv).toMatchObject({
|
|
goose: { GOOSE_MODE: 'auto' }
|
|
})
|
|
expect(settings.agentYoloDefaultsMigrated).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('getDefaultPrimarySelectionMiddleClickPaste', () => {
|
|
it('enables primary selection paste on Linux by default', () => {
|
|
expect(getDefaultPrimarySelectionMiddleClickPaste('linux')).toBe(true)
|
|
})
|
|
|
|
it('enables primary selection paste on macOS by default', () => {
|
|
expect(getDefaultPrimarySelectionMiddleClickPaste('darwin')).toBe(true)
|
|
})
|
|
|
|
it('leaves primary selection paste opt-in on Windows', () => {
|
|
expect(getDefaultPrimarySelectionMiddleClickPaste('win32')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('getDefaultTerminalRightClickToPaste', () => {
|
|
it('defaults on only for Windows', () => {
|
|
expect(getDefaultTerminalRightClickToPaste('win32')).toBe(true)
|
|
expect(getDefaultTerminalRightClickToPaste('darwin')).toBe(false)
|
|
expect(getDefaultTerminalRightClickToPaste('linux')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('MiniMax defaults', () => {
|
|
it('starts MiniMax with empty group id and the canonical default model', () => {
|
|
const settings = getDefaultSettings('/tmp')
|
|
// Why: the fetcher reads these defaults on first launch. An empty
|
|
// group id is the signal that the fetcher must pull the value from
|
|
// the cookie itself, and "general" matches the model name the
|
|
// MiniMax usage endpoint exposes by default.
|
|
expect(settings.minimaxGroupId).toBe('')
|
|
expect(settings.minimaxUsageModels).toBe('general')
|
|
})
|
|
|
|
it('defaults the MiniMax endpoint to overseas', () => {
|
|
const settings = getDefaultSettings('/tmp')
|
|
expect(settings.minimaxEndpoint).toBe('overseas')
|
|
})
|
|
})
|