test: remove low-value suites, recorder snapshots, and repeated inputs (#41244)

* test: remove weak recorder scenarios and arithmetic suites

* test: remove low-value boundary suites and recorder cases

* test: remove mock suites and trim repetitive boundary inputs

* test: remove shallow provider and browser checks

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-11 14:14:48 -08:00
committed by GitHub
co-authored by OrcaWin
parent 33a3cd3b1f
commit b1106ba883
52 changed files with 93 additions and 5002 deletions
@@ -6,9 +6,7 @@ import {
mkdtempSync,
readFileSync,
rmSync,
statSync,
symlinkSync,
utimesSync,
writeFileSync
} from 'node:fs'
import { tmpdir } from 'node:os'
@@ -20,7 +18,6 @@ const { getPathMock } = vi.hoisted(() => ({
}))
import { OpenCodeHookService, openCode2HookService } from './hook-service'
import { getOpenCodePluginSource } from './plugin-source/status-plugin-module-source'
import { resolveOpenCodeConfigDirectory } from '../../../shared/opencode-config-directory'
beforeEach(() => {
@@ -69,10 +66,6 @@ describe('OpenCodeHookService buildPtyEnv / clearPty round-trip', () => {
rmSync(join(userDataDir, 'opencode-config-overlays'), { recursive: true, force: true })
})
// OpenCode 2 reloads on mtime changes, resetting status mid-turn.
// OpenCode 2 stats file-level symlink targets used by dotfile managers.
// A service reloading between writes must already find the TUI copy and stand down.
it('writes the TUI copy before the server plugin file', () => {
const pluginsDir = join(resolveOpenCodeConfigDirectory(), 'plugins')
@@ -89,20 +82,6 @@ describe('OpenCodeHookService buildPtyEnv / clearPty round-trip', () => {
rmSync(tuiDir, { recursive: true, force: true })
}
})
it('leaves an up-to-date legacy plugin untouched and never creates the retired dir', () => {
const legacyDir = join(userDataDir, 'opencode-hooks')
new OpenCodeHookService().buildPtyEnv(daemonSessionId)
expect(existsSync(legacyDir)).toBe(false)
const legacyPluginPath = join(legacyDir, 'shared', 'plugins', 'orca-opencode-status.js')
mkdirSync(join(legacyPluginPath, '..'), { recursive: true })
writeFileSync(legacyPluginPath, getOpenCodePluginSource())
const past = new Date('2020-01-01T00:00:00Z')
utimesSync(legacyPluginPath, past, past)
new OpenCodeHookService().buildPtyEnv(daemonSessionId)
expect(statSync(legacyPluginPath).mtimeMs).toBe(past.getTime())
})
})
describe('OpenCodeHookService overlay mode (user OPENCODE_CONFIG_DIR set)', () => {
@@ -1,7 +1,7 @@
import { z } from 'zod'
import { createServer, type ServerResponse } from 'node:http'
import { once } from 'node:events'
import { afterEach, expect, it, vi } from 'vitest'
import { afterEach, expect, it } from 'vitest'
import { runOpenCodeTextTaskSession } from './opencode-text-task-session'
const servers: ReturnType<typeof createServer>[] = []
@@ -79,34 +79,6 @@ it('recovers and deletes an owned session when cancelled during creation without
expect(requests).not.toContain('POST /api/session/ses_late/prompt')
})
it('preserves a completed title when deleting its session fails', async () => {
const warning = vi.spyOn(console, 'warn').mockImplementation(() => {})
const url = await fixture((path, _body, response) => {
if (path.startsWith('POST /session?')) {
json(response, { id: 'ses_cleanup', permission: appliedV1Policy })
} else if (path.startsWith('POST /session/ses_cleanup/message?')) {
json(response, { info: {}, parts: [{ type: 'text', text: 'Harbor Lantern' }] })
} else {
response.writeHead(500).end()
}
})
try {
await expect(
runOpenCodeTextTaskSession({
version: 'v1',
v1SessionPolicyFiltersTools: true,
url,
password: 'test',
directory: '/workspace',
prompt: 'Name this chat',
signal: new AbortController().signal
})
).resolves.toBe('Harbor Lantern')
} finally {
warning.mockRestore()
}
})
it('discards a cancelled borrowed v1 response without aborting or deleting its session', async () => {
const controller = new AbortController()
const submitted = Promise.withResolvers<void>()