Commit a142cb6f by luoqi

test(golden): 接口错误 不算模型失败;样本太小时明说

两条都来自 2026-08-15 自己踩的:

① 跑批跑到一半我改了服务端源码 → dev server 重启,请求全断(terminated /
   fetch failed),而 runner 把它算成"用例没通过" —— 输出读起来和模型退化一模一样。
   ⇒ 接口错误单列、不进通过率分母,并直接提示"服务是不是中途重启了"。
   一轮都没判成时退出码 1 并写明"本次结果作废"。

② 3 轮的 1/3 让我判成"模型判不准",干净重跑 10 轮是 9/10 —— 同一个行为。
   ⇒ rounds < 5 时输出一行:这个数分不出"判不准"和"运气差", 别据此改提示词。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
parent f353f51b
...@@ -307,11 +307,27 @@ async function main(): Promise<void> { ...@@ -307,11 +307,27 @@ async function main(): Promise<void> {
// ⚠️ 串行 —— ⛔ 别并发:同一个 requestId 的幂等、以及模型侧限流都会让并发结果不可比 // ⚠️ 串行 —— ⛔ 别并发:同一个 requestId 的幂等、以及模型侧限流都会让并发结果不可比
results.push(judge(c, await runOnce(c, token))); results.push(judge(c, await runOnce(c, token)));
} }
const pass = results.filter((r) => r.ok).length; /**
const fails = results.filter((r) => !r.ok); * 🔴 **接口错误 ⛔ 不算模型失败**(2026-08-15 吃过亏)。
report.push({ id: c.id, pass, rounds, fails }); * 那天跑批跑到一半,我在旁边改了服务端源码 —— dev server 重启,请求全断
const bar = pass === rounds ? '✅' : pass === 0 ? '❌' : '⚠️ '; * (`terminated` / `fetch failed`)。而当时的 runner 把它算成"这条用例没通过",
console.log(`${bar} ${String(pass)}/${rounds} ${c.id}`); * 输出读起来**和模型退化一模一样**。
* ⇒ 分开数:接口错误单列,且**不进通过率的分母** —— 一次环境故障不该让人去改提示词。
*/
const errored = results.filter((r) => r.error);
const judged = results.filter((r) => !r.error);
const pass = judged.filter((r) => r.ok).length;
const fails = judged.filter((r) => !r.ok);
report.push({ id: c.id, pass, rounds: judged.length, fails });
const bar =
judged.length === 0 ? '🔌' : pass === judged.length ? '✅' : pass === 0 ? '❌' : '⚠️ ';
console.log(
`${bar} ${String(pass)}/${judged.length} ${c.id}` +
(errored.length ? ` 🔌 另有 ${errored.length} 轮接口错误(不计入)` : ''),
);
if (errored.length) {
console.log(` ⚠️ ${errored[0]!.error} —— 服务是不是中途重启了?改服务端源码会触发`);
}
for (const f of fails.slice(0, 1)) { for (const f of fails.slice(0, 1)) {
if (f.error) console.log(` 报错: ${f.error}`); if (f.error) console.log(` 报错: ${f.error}`);
if (f.missing.length) console.log(` 没调到: ${f.missing.join(', ')}`); if (f.missing.length) console.log(` 没调到: ${f.missing.join(', ')}`);
...@@ -326,7 +342,18 @@ async function main(): Promise<void> { ...@@ -326,7 +342,18 @@ async function main(): Promise<void> {
const total = report.reduce((s, r) => s + r.pass, 0); const total = report.reduce((s, r) => s + r.pass, 0);
const max = report.reduce((s, r) => s + r.rounds, 0); const max = report.reduce((s, r) => s + r.rounds, 0);
if (max === 0) {
console.log('\n🔌 **一轮都没判成** —— 全是接口错误,本次结果作废,⛔ 别据此下任何结论。');
process.exit(1);
}
console.log(`\n合计 ${total}/${max}${((total / max) * 100).toFixed(0)}%)`); console.log(`\n合计 ${total}/${max}${((total / max) * 100).toFixed(0)}%)`);
/**
* ⚠️ 样本太小时**明说**:3 轮里红一次是 33%,看着像"判不准",实际可能是 90% 的尾巴。
* 2026-08-15 就这么误判过一次 —— 3 轮的 1/3 与 10 轮的 9/10 是同一个行为。
*/
if (rounds < 5) {
console.log(`⚠️ 每条只跑了 ${rounds} 轮 —— 这个数**分不出**"判不准"和"运气差",⛔ 别据此改提示词。`);
}
if (out) { if (out) {
mkdirSync(dirname(out), { recursive: true }); mkdirSync(dirname(out), { recursive: true });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment