cc-haha/scripts/pr/run-provider-contract-tests.ts
程序员阿江(Relakkes) 435e4ccc9f ci: harden deterministic PR quality gates
Route required checks by changed surface, add offline provider and chat contracts, and keep fork PRs independent of live credentials. Layer agent guidance by subtree and enforce a compact instruction budget.

Tested: bun run check:policy
Confidence: high
Scope-risk: broad
2026-07-10 20:29:01 +08:00

43 lines
1.5 KiB
TypeScript

#!/usr/bin/env bun
import { join } from 'node:path'
const root = join(import.meta.dir, '..', '..')
// Keep this lane deterministic. Real credentials and third-party connectivity
// belong to the trusted provider-smoke lanes, never to external PR checks.
const testFiles = [
'src/server/__tests__/provider-settings-isolation.test.ts',
'src/server/__tests__/provider-presets.test.ts',
'src/server/__tests__/provider-runtime-env.test.ts',
'src/services/api/client.test.ts',
'src/services/compact/autoCompact.test.ts',
'src/services/openaiAuth/client.test.ts',
'src/services/openaiAuth/fetch.test.ts',
'src/services/openaiAuth/models.test.ts',
'src/services/openaiAuth/storage.test.ts',
'src/utils/__tests__/providerManagedEnvCompat.test.ts',
'src/utils/managedEnv.test.ts',
'src/utils/model/modelContextWindows.test.ts',
'src/server/__tests__/providers.test.ts',
'src/server/__tests__/proxy-transform.test.ts',
'src/server/__tests__/proxy-streaming.test.ts',
'src/server/__tests__/network-settings.test.ts',
'src/server/__tests__/proxy-network-settings.test.ts',
'src/utils/proxy.test.ts',
]
for (const testFile of testFiles) {
console.log(`\n[provider-contract] ${testFile}`)
const proc = Bun.spawn(['bun', 'test', testFile], {
cwd: root,
stdout: 'inherit',
stderr: 'inherit',
})
const exitCode = await proc.exited
if (exitCode !== 0) {
process.exit(exitCode)
}
}
console.log(`\n[provider-contract] ${testFiles.length} deterministic suites passed`)