test: remove seven low-value suites and trim filesystem cases (#42688)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-15 01:39:01 -08:00
committed by GitHub
co-authored by OrcaWin
parent cb7eaf9dd3
commit e0896fdb27
11 changed files with 1 additions and 295 deletions
@@ -1290,7 +1290,6 @@
"src/main/dsh/dsh-home-patch.test.ts": 57,
"src/main/dsh/hook-service.test.ts": 124,
"src/main/filesystem/durable-file-write-syscall-proof.test.ts": 73,
"src/main/filesystem/durable-file-write.test.ts": 176,
"src/main/emulator/android/adb-devices.test.ts": 46,
"src/main/emulator/android/android-input-commands.test.ts": 90,
"src/main/emulator/android/h264-sps-picture-size.test.ts": 47,
@@ -4618,7 +4617,6 @@
"src/shared/agent-session/options/agent-session-option-catalog-grok.test.ts": 200,
"src/shared/agent-session/options/agent-session-option-catalog-omp.test.ts": 217,
"src/shared/agent-session/options/agent-session-option-catalog-opencode.test.ts": 200,
"src/shared/agent-session/options/agent-session-option-catalog-removers.test.ts": 199,
"src/shared/agent-session/options/agent-session-option-catalog.test.ts": 210,
"src/shared/agent-session/options/structured-agent-session-option-view.test.ts": 275,
"src/shared/agent-session/options/structured-agent-session-options-write-owner.test.ts": 249,
@@ -4692,7 +4690,6 @@
"src/shared/codex-reset-credit-attempt-ledger.test.ts": 101,
"src/shared/codex-reset-credit-scope.test.ts": 49,
"src/shared/codex-rollout-jsonl-cursor.test.ts": 231,
"src/shared/agent-launch/startup/codex-startup-delivery.test.ts": 76,
"src/shared/codex-subagent-rollout-lifecycle.test.ts": 239,
"src/shared/codex-subagent-transcript.test.ts": 100,
"src/shared/codex-turn-transcript.test.ts": 39,
@@ -4768,7 +4765,6 @@
"src/shared/github/pull-request-auto-merge-availability.test.ts": 52,
"src/shared/github/pull-request-merge-methods.test.ts": 41,
"src/shared/github/repository-identity-key.test.ts": 39,
"src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.test.ts": 95,
"src/shared/grok-model-list-probe.test.ts": 54,
"src/shared/grok-session-paths.test.ts": 104,
"src/shared/handled-wire-discriminant.test.ts": 45,
@@ -4871,7 +4867,6 @@
"src/shared/node-dist-mirror.test.ts": 48,
"src/shared/node-readable-text.test.ts": 45,
"src/shared/node-source-copy-content-equality.test.ts": 52,
"src/shared/notebook-venv-location.test.ts": 50,
"src/shared/nvm-default-alias.test.ts": 81,
"src/shared/agent-launch/startup/omp-draft-launch-shell.test.ts": 382,
"src/shared/agent-launch/startup/omp-draft-launch-windows.test.ts": 270,
@@ -4959,7 +4954,6 @@
"src/shared/process-table-snapshot.test.ts": 228,
"src/shared/profile-state-build-compatibility.test.ts": 47,
"src/shared/program-status/osc-scanner.test.ts": 57,
"src/shared/program-status/presentation.test.ts": 41,
"src/shared/program-status/protocol.test.ts": 58,
"src/shared/program-status/query-responder.test.ts": 55,
"src/shared/program-status/records.test.ts": 49,
@@ -5145,7 +5139,6 @@
"src/shared/windows-batch-spawn.win32.test.ts": 48,
"src/shared/windows-breakaway-launcher.test.ts": 76,
"src/shared/windows-command-line-budget.test.ts": 105,
"src/shared/windows-console-input.test.ts": 44,
"src/shared/windows-interactive-login-spawn.test.ts": 54,
"src/shared/windows-path-access.test.ts": 54,
"src/shared/windows-private-credential-file.test.ts": 77,
+1 -17
View File
@@ -3,7 +3,7 @@ import type * as NodeFsPromises from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, expect, it, vi } from 'vitest'
import { writeFileDurable, writeFileDurableIfCurrent } from './durable-file-write'
import { writeFileDurableIfCurrent } from './durable-file-write'
const rename = vi.hoisted(() => vi.fn())
vi.mock('node:fs/promises', async (importOriginal) => {
@@ -32,22 +32,6 @@ function fixture() {
return { root, target, temporary }
}
it.each([
['win32', 'EPERM', 6],
['win32', 'ENOSPC', 1],
['linux', 'EBUSY', 1]
] as const)('bounds %s %s failures and preserves the old file', async (host, code, attempts) => {
const { root, target, temporary } = fixture()
Object.defineProperty(process, 'platform', { value: host })
for (let attempt = 0; attempt < attempts; attempt++) {
rename.mockRejectedValueOnce(Object.assign(new Error('injected file failure'), { code }))
}
await expect(writeFileDurable(temporary, target, 'new')).rejects.toThrow('injected file failure')
expect(rename).toHaveBeenCalledTimes(attempts)
expect(readFileSync(target, 'utf8')).toBe('old')
expect(readdirSync(root)).toEqual(['state.json'])
})
it('does not publish a superseded snapshot after a Windows retry delay', async () => {
const { root, target, temporary } = fixture()
Object.defineProperty(process, 'platform', { value: 'win32' })
@@ -38,23 +38,6 @@ describe('writeFileAtomically', () => {
}
}
it('replaces only the expected file generation', () => {
setup()
try {
const target = join(dir, 'guarded.toml')
writeFileSync(target, 'baseline')
expect(writeFileAtomicallyIfUnchanged(target, 'baseline', 'next')).toBe(true)
expect(readFileSync(target, 'utf-8')).toBe('next')
writeFileSync(target, 'concurrent')
expect(writeFileAtomicallyIfUnchanged(target, 'next', 'stale-write')).toBe(false)
expect(readFileSync(target, 'utf-8')).toBe('concurrent')
} finally {
cleanup()
}
})
it('validates the generation moved after a Windows rename retry', () => {
setup()
try {
@@ -108,57 +91,6 @@ describe('writeFileAtomically', () => {
}
})
it('fails before moving the target when hard-link publication is unsupported', () => {
setup()
try {
const target = join(dir, 'guarded.toml')
writeFileSync(target, 'baseline')
fsMock.linkSync.mockImplementationOnce(() => {
throw Object.assign(new Error('unsupported'), { code: 'ENOTSUP' })
})
expect(() => writeFileAtomicallyIfUnchanged(target, 'baseline', 'next')).toThrow(
'unsupported'
)
expect(readFileSync(target, 'utf-8')).toBe('baseline')
expect(existsSync(`${target}.orca-guarded`)).toBe(false)
} finally {
cleanup()
}
})
it('removes only the expected file generation', () => {
setup()
try {
const target = join(dir, 'guarded-auth.json')
writeFileSync(target, 'baseline')
expect(removeFileAtomicallyIfUnchanged(target, 'other')).toBe(false)
expect(readFileSync(target, 'utf-8')).toBe('baseline')
expect(removeFileAtomicallyIfUnchanged(target, 'baseline')).toBe(true)
expect(existsSync(target)).toBe(false)
} finally {
cleanup()
}
})
it('returns false when the target disappears during the removal probe', () => {
setup()
try {
const target = join(dir, 'guarded-auth.json')
writeFileSync(target, 'baseline')
fsMock.linkSync.mockImplementationOnce(() => {
rmSync(target)
throw Object.assign(new Error('gone'), { code: 'ENOENT' })
})
expect(removeFileAtomicallyIfUnchanged(target, 'baseline')).toBe(false)
expect(existsSync(`${target}.orca-guarded`)).toBe(false)
} finally {
cleanup()
}
})
it('preserves a replacement created while the expected generation is quarantined', () => {
setup()
try {
@@ -1,51 +0,0 @@
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import {
durableWriteTempPath,
removeStaleDurableWriteTempFiles,
writeFileDurable
} from './durable-file-write'
describe('durable file write', () => {
let dir: string
beforeEach(() => {
dir = mkdtempSync(join(tmpdir(), 'orca-durable-'))
})
afterEach(() => {
rmSync(dir, { recursive: true, force: true })
})
it('durably writes a binary view without leaking bytes outside its bounds', async () => {
const final = join(dir, 'state.gz')
const backing = Buffer.from([99, 0x1f, 0x8b, 0, 0xff, 77])
await writeFileDurable(`${final}.tmp`, final, backing.subarray(1, -1))
expect(readFileSync(final)).toEqual(Buffer.from([0x1f, 0x8b, 0, 0xff]))
expect(existsSync(`${final}.tmp`)).toBe(false)
})
it('reclaims only the retired owner in this process', async () => {
const final = join(dir, 'state.json')
const retired = durableWriteTempPath(final, 'worker-1')
const replacement = durableWriteTempPath(final, 'worker-2')
const unowned = durableWriteTempPath(final)
const otherProcess = `${final}.${process.pid + 1}.1.test.owner-worker-1.tmp`
const otherTarget = durableWriteTempPath(join(dir, 'other-state.json'), 'worker-1')
const temps = [retired, replacement, unowned, otherProcess, otherTarget]
for (const temp of temps) {
writeFileSync(temp, 'pending')
}
writeFileSync(final, 'committed')
await removeStaleDurableWriteTempFiles(final, { retiredOwner: 'worker-1' })
expect(existsSync(retired)).toBe(false)
for (const live of [replacement, unowned, otherProcess, otherTarget]) {
expect(existsSync(live)).toBe(true)
}
expect(readFileSync(final, 'utf-8')).toBe('committed')
})
})
@@ -1,4 +1,3 @@
import { existsSync } from 'node:fs'
import {
mkdir,
mkdtemp,
@@ -26,8 +25,6 @@ vi.mock('@orca/process-host', async (importActual) => {
import { cloneMacTree } from './macos-tree-clone'
const ok: ProcessResult = { code: 0, signal: null, stdout: '', stderr: '', timedOut: false }
describe('cloneMacTree', () => {
let root: string
let source: string
@@ -58,24 +55,4 @@ describe('cloneMacTree', () => {
expect(await readlink(join(destination, 'dangling'))).toBe('../gone/index.js')
}
)
it('falls back to a plain copy over a cleared destination when the clone fails', async () => {
const seenAtCopy: boolean[] = []
runProcessMock.mockImplementation(async (spec) => {
seenAtCopy.push(existsSync(destination))
if (spec.args?.[0] === '-cR') {
await mkdir(destination)
await writeFile(join(destination, 'partial'), 'partial-clone')
return { ...ok, code: 1 }
}
return ok
})
const signal = new AbortController().signal
await cloneMacTree('/src', destination, signal)
expect(runProcessMock.mock.calls.map(([spec]) => spec)).toMatchObject([
{ program: '/bin/cp', args: ['-cR', '/src', destination], timeoutMs: null, signal },
{ program: '/bin/cp', args: ['-R', '/src', destination], timeoutMs: null, signal }
])
expect(seenAtCopy).toEqual([false, false])
})
})
@@ -1,19 +0,0 @@
import { describe, expect, it } from 'vitest'
import { hasCodexNativeDraftFlag } from './codex-startup-delivery'
describe('hasCodexNativeDraftFlag', () => {
it('matches Codex --prefill option tokens', () => {
expect(hasCodexNativeDraftFlag("codex --prefill 'linked issue context'")).toBe(true)
expect(hasCodexNativeDraftFlag("codex --model gpt-5 --prefill 'draft'")).toBe(true)
})
it('matches Codex --prefill=value option tokens', () => {
expect(hasCodexNativeDraftFlag('codex --prefill=review')).toBe(true)
expect(hasCodexNativeDraftFlag("codex --prefill='linked issue context'")).toBe(true)
})
it('does not match quoted prompt text mentioning prefill', () => {
expect(hasCodexNativeDraftFlag("codex 'please compare --prefill behavior'")).toBe(false)
expect(hasCodexNativeDraftFlag("codex '--prefill=not-an-option'")).toBe(false)
})
})
@@ -1,25 +0,0 @@
import { describe, expect, it } from 'vitest'
import { getAgentSessionOptionCatalog } from '../agent-session-option-catalog'
import { agentArgTerminatorIndex } from '../launch/agent-session-option-agent-args'
const removeCodexModel = getAgentSessionOptionCatalog('codex')!.modelApply.removeAgentArgs!
describe('catalog removers', () => {
it.each([[['-cmodel=o3']]])('strips Codex model config %j', (tokens) => {
expect(removeCodexModel([...tokens, '--search'])).toEqual(['--search'])
})
})
describe('removeAgentArgOption', () => {
it('requires an exact terminator outside option values', () => {
expect(
agentArgTerminatorIndex('claude', [
'--append-system-prompt',
'--',
'--=literal',
'--',
'text'
])
).toBe(3)
})
})
-17
View File
@@ -1,17 +0,0 @@
import { describe, expect, it } from 'vitest'
import { notebookVenvParent } from './notebook-venv-location'
describe('notebookVenvParent', () => {
it('uses the workspace root for a notebook inside it, else the notebook folder', () => {
expect(notebookVenvParent('/repo/analysis/nb.ipynb', '/repo')).toBe('/repo')
expect(notebookVenvParent('/elsewhere/nb.ipynb', '/repo')).toBe('/elsewhere')
expect(notebookVenvParent('/repo-2/nb.ipynb', '/repo')).toBe('/repo-2')
expect(notebookVenvParent('/repo/nb.ipynb', null)).toBe('/repo')
expect(notebookVenvParent('C:\\repo\\a\\nb.ipynb', 'c:\\Repo')).toBe('c:\\Repo')
})
it('keeps the root separator for a notebook at a filesystem root', () => {
expect(notebookVenvParent('/nb.ipynb', '/repo')).toBe('/')
expect(notebookVenvParent('C:\\nb.ipynb', null)).toBe('C:\\')
})
})
@@ -1,26 +0,0 @@
import { describe, expect, it } from 'vitest'
import { resolveProgramStatusPresentation } from './presentation'
import type { ProgramStatusFacet } from './facet'
const facet = (overrides: Partial<ProgramStatusFacet>): ProgramStatusFacet => ({
state: 'working',
observedAt: 1,
...overrides
})
describe('resolveProgramStatusPresentation', () => {
it('raises attention for a block the row state does not show (sign-in after a hook turn)', () => {
expect(
resolveProgramStatusPresentation({
state: 'done',
programStatus: facet({ state: 'blocked', kind: 'auth', message: 'Session expired' })
})
).toEqual({ attention: { kind: 'auth', message: 'Session expired' } })
expect(
resolveProgramStatusPresentation({
state: 'waiting',
programStatus: facet({ state: 'blocked', kind: 'permission' })
}).attention
).toBeUndefined()
})
})
@@ -1,22 +0,0 @@
import { describe, expect, it } from 'vitest'
import { gitLabJobTraceToLogExcerpt } from './gitlab-job-log-excerpt'
const CSI_ERASE = '\u001b[0K'
const CR = '\r'
describe('gitLabJobTraceToLogExcerpt', () => {
it('keeps the visible header of a section marker and drops the marker itself', () => {
const trace = [
`section_start:1699000000:build_script${CR}${CSI_ERASE}$ pnpm build`,
'built in 3s',
`section_end:1699000030:build_script${CR}${CSI_ERASE}`
].join('\n')
const excerpt = gitLabJobTraceToLogExcerpt(trace)
expect(excerpt).toContain('$ pnpm build')
expect(excerpt).toContain('built in 3s')
expect(excerpt).not.toContain('section_start')
expect(excerpt).not.toContain('section_end')
})
})
-20
View File
@@ -1,20 +0,0 @@
import { describe, expect, it, vi } from 'vitest'
import { openWindowsConsoleInput, WINDOWS_CONSOLE_INPUT_DEVICE } from './windows-console-input'
describe('openWindowsConsoleInput', () => {
it('opens CONIN$ read-write and disposes the fd once', () => {
const openSync = vi.fn(() => 11)
const closeSync = vi.fn()
const opened = openWindowsConsoleInput({ platform: 'win32', openSync, closeSync })
expect(opened).not.toBe('inherit')
if (opened === 'inherit') {
return
}
expect(openSync).toHaveBeenCalledWith(WINDOWS_CONSOLE_INPUT_DEVICE, 'r+')
expect(opened.fd).toBe(11)
opened.dispose()
opened.dispose()
expect(closeSync).toHaveBeenCalledOnce()
expect(closeSync).toHaveBeenCalledWith(11)
})
})