mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
test: remove suite for unused automation jobs reader
This commit is contained in:
@@ -6315,7 +6315,6 @@
|
||||
"src/shared/execution-host-registry-shared-control-connect.test.ts": 160,
|
||||
"src/shared/execution-host-registry.test.ts": 169,
|
||||
"src/shared/execution-host.test.ts": 56,
|
||||
"src/shared/external-automation-jobs-file.test.ts": 72,
|
||||
"src/shared/external-worktree-inbox.test.ts": 69,
|
||||
"src/shared/feature-education-telemetry.test.ts": 36,
|
||||
"src/shared/feature-tips.test.ts": 54,
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
import { mkdtemp, rm, truncate, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
EXTERNAL_AUTOMATION_JOBS_FILE_MAX_BYTES,
|
||||
EXTERNAL_AUTOMATION_JOBS_MAX_ENTRIES,
|
||||
readExternalAutomationJobsFile
|
||||
} from './external-automation-jobs-file'
|
||||
|
||||
const tempDirs: string[] = []
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })))
|
||||
})
|
||||
|
||||
async function tempFile(name: string): Promise<string> {
|
||||
const dir = await mkdtemp(join(tmpdir(), 'orca-automation-jobs-'))
|
||||
tempDirs.push(dir)
|
||||
return join(dir, name)
|
||||
}
|
||||
|
||||
describe('readExternalAutomationJobsFile', () => {
|
||||
it('rejects oversized sparse files with the explicit memory-limit error', async () => {
|
||||
const path = await tempFile('oversized.json')
|
||||
await writeFile(path, '')
|
||||
await truncate(path, EXTERNAL_AUTOMATION_JOBS_FILE_MAX_BYTES + 64 * 1024 * 1024)
|
||||
|
||||
await expect(readExternalAutomationJobsFile(path, { allowRootArray: true })).rejects.toThrow(
|
||||
'jobs file exceeds the 8 MiB memory limit'
|
||||
)
|
||||
})
|
||||
|
||||
it('rejects excessive job counts explicitly', async () => {
|
||||
const path = await tempFile('too-many.json')
|
||||
await writeFile(
|
||||
path,
|
||||
JSON.stringify(Array.from({ length: EXTERNAL_AUTOMATION_JOBS_MAX_ENTRIES + 1 }, () => null))
|
||||
)
|
||||
|
||||
await expect(readExternalAutomationJobsFile(path, { allowRootArray: true })).rejects.toThrow(
|
||||
'more than 10,000 jobs'
|
||||
)
|
||||
})
|
||||
|
||||
it('rejects structural amplification before parsing jobs', async () => {
|
||||
const path = await tempFile('amplified.json')
|
||||
await writeFile(path, '{"jobs":[{},{}]}')
|
||||
|
||||
await expect(
|
||||
readExternalAutomationJobsFile(path, {
|
||||
allowRootArray: false,
|
||||
structureLimits: { structuralTokens: 7, nestingDepth: 3 }
|
||||
})
|
||||
).rejects.toThrow('JSON structure')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user