mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
perf(snapshot): parallelize replay scenarios
This commit is contained in:
@@ -1,6 +1,25 @@
|
||||
import { availableParallelism } from 'node:os'
|
||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
const DEFAULT_SNAPSHOT_MAX_CONCURRENCY = 5
|
||||
|
||||
function positiveIntFromEnv(name: string, fallback: number): number {
|
||||
const raw = process.env[name]
|
||||
if (raw === undefined || raw === '') return fallback
|
||||
|
||||
const value = Number(raw)
|
||||
if (!Number.isInteger(value) || value < 1) {
|
||||
throw new Error(`${name} must be a positive integer, got ${JSON.stringify(raw)}`)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
const snapshotMaxConcurrency = positiveIntFromEnv(
|
||||
'DSH_SNAPSHOT_MAX_CONCURRENCY',
|
||||
Math.min(DEFAULT_SNAPSHOT_MAX_CONCURRENCY, availableParallelism()),
|
||||
)
|
||||
|
||||
// Replay is the keyless default: boot the real ACP subprocess from recorded model scripts and diff
|
||||
// normalized transcript plus persisted-log goldens. `record` calls the real API and updates fixtures
|
||||
// and goldens; `refresh` replays committed scripts and updates only current goldens. Replay/refresh
|
||||
@@ -21,10 +40,12 @@ export default defineConfig({
|
||||
plugins: [tsconfigPaths({ projects: ['./tsconfig.json'] })],
|
||||
test: {
|
||||
include: ['examples/*/tests/**/*.snapshot.ts', 'packages/sdk/*/tests/**/*.snapshot.ts'],
|
||||
// Each test boots a subprocess; give it room, and run files one at a time
|
||||
// (a record run hits the live API, and replay subprocess boot is heavy).
|
||||
// Each test boots a subprocess; give it room and keep the worker file singular. Replay tests
|
||||
// opt into bounded in-file concurrency, while record/refresh stay serial because they write
|
||||
// fixtures. The environment knob restores serial replay with value 1 on constrained machines.
|
||||
testTimeout: 120_000,
|
||||
hookTimeout: 30_000,
|
||||
fileParallelism: false,
|
||||
maxConcurrency: snapshotMaxConcurrency,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user