mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
* test: reproduce accumulated-workspace typing latency through real PTYs * test: make the bench harness self-checks falsifiable Review found four assertions that could not fail and one fixture gap: - `missingPtyArrivalCount`/`missingEchoCount` were hardcoded `0` and `validateExpectedSeqs` throws before them, so every assertion on them was vacuous and every report read `0`. The throw is the real guard and is already covered; drop the vestigial fields. - An absent status controller returned an all-zero result, which satisfied its own accepted-equals-generated equality. Assert presence first. - The byte-pacing control had only an upper bound, so a generator emitting no stream bytes passed. Add the lower bound. - `lineageEvery: 1` built zero lineage: no ordinal satisfies `% 1 === 1`. Offset the interval and cover the densest setting. - The documented control command never set ORCA_TYPING_BENCH, so it skipped instead of running.
29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import { mkdtempSync, rmSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import path from 'node:path'
|
|
import { expect, it } from 'vitest'
|
|
import { runProcess } from '../../src/shared/child-process/run-process'
|
|
import { writeSustainedAgentLoadScript } from './sustained-agent-typing-load-scripts'
|
|
|
|
it('paces the generated Unicode stream in bytes without splitting UTF-8 characters', async () => {
|
|
const directory = mkdtempSync(path.join(tmpdir(), 'orca-typing-stream-test-'))
|
|
try {
|
|
const script = path.join(directory, 'load.mjs')
|
|
writeSustainedAgentLoadScript(script, 'rate-test', directory)
|
|
const result = await runProcess({
|
|
program: process.execPath,
|
|
args: [script, '0', '4', '2', '0'],
|
|
timeoutMs: 10_000
|
|
})
|
|
expect(result.code, result.stderr).toBe(0)
|
|
expect(result.stdout).toContain('MWT_LOAD_DONE_rate-test_0')
|
|
expect(result.stdout).not.toContain('\uFFFD')
|
|
// Readiness/completion control sequences are outside the stream-byte budget.
|
|
expect(Buffer.byteLength(result.stdout)).toBeLessThanOrEqual(4 * 1024 * 2 + 512)
|
|
// Lower bound too: without it a generator that emits no stream bytes still passes.
|
|
expect(Buffer.byteLength(result.stdout)).toBeGreaterThan(4 * 1024 * 2 * 0.8)
|
|
} finally {
|
|
rmSync(directory, { recursive: true, force: true })
|
|
}
|
|
}, 15_000)
|