采样第 26 章:可靠性四项定案,排除 WS 并发上限,纠正 history count 语义
- 新增 GC-018~GC-022:WS 按连接扇出且无并发上限、断线零补推、事件乱序、 history 窗口边界稳定少返回一条、real_seq 仅会话内唯一(去重键须含会话类型+会话ID) - REL-dedup/order/replay/id-consistency 由未采集转为 verified 并挂回归探针; REL-replay 的 parseStatus 枚举违规一并修正 - capability-check 支持 reliability 的 kind=verdict/phase 判定行与 expect.fields 数值/空数组断言,已用构造坏样本自检出 4 项漂移并 FAIL - 新增 7 个探针(reliability/timeline/ws-conn-limit/ws-reconnect/seq-namespace/ history-count-scan/history-edge-offbyone),只读探针无写副作用 - 作废旧结论:群 50 条硬上限、WS 并发上限归因、min(count,可读量) 完整性判据
This commit is contained in:
@@ -107,12 +107,15 @@ function validateAgainst(measureFiles) {
|
||||
// 若混入 byCase 会把同名的发送侧行覆盖掉,造成 retcode 假漂移。
|
||||
const byCase = new Map();
|
||||
for (const r of rows) if (r.id && !r.__summary && r.kind !== 'history') byCase.set(String(r.id), r);
|
||||
// reliability 类探针输出的是 kind=verdict / phase=<阶段名> 的判定行,没有 id 字段,
|
||||
// 用 phase 作为 case 索引,使可靠性结论同样纳入漂移比对而不是退化成人工确认。
|
||||
for (const r of rows) if (r.kind === 'verdict' && r.phase) byCase.set(String(r.phase), r);
|
||||
// history-audit 提供 history_segs
|
||||
const audit = new Map();
|
||||
for (const r of rows) if (r.history_segs) audit.set(String(r.id), r);
|
||||
|
||||
// probe 名为 manual/any 的项无法从实测 jsonl 自动比对,单列为人工确认项
|
||||
const AUTO = new Set(['matrix', 'segments', 'record', 'recordAmr', 'recordDecoder', 'urlMedia', 'forwardFollowup', 'forwardReadback']);
|
||||
const AUTO = new Set(['matrix', 'segments', 'record', 'recordAmr', 'recordDecoder', 'urlMedia', 'forwardFollowup', 'forwardReadback', 'reliability']);
|
||||
let checked = 0, drifted = 0, missing = 0, manual = 0;
|
||||
for (const c of caps) {
|
||||
const p = c.regressionProbe;
|
||||
@@ -137,6 +140,25 @@ function validateAgainst(measureFiles) {
|
||||
}
|
||||
if (exp.messageContains && !String(actual.message ?? '').includes(exp.messageContains))
|
||||
diffs.push(`错误原文未包含 "${exp.messageContains}",实测 "${String(actual.message ?? '').slice(0, 60)}"`);
|
||||
// 通用字段断言:形如 { arrived: ">=1", duplicate_arrivals: "==0" },用于 reliability 这类
|
||||
// 没有 retcode 的判定行,避免可靠性结论退化成「只要采到就算通过」。
|
||||
for (const [k, rule] of Object.entries(exp.fields ?? {})) {
|
||||
if (String(rule).trim() === 'empty') {
|
||||
const arr = k.split('.').reduce((a, key) => (a == null ? undefined : a[key]), actual);
|
||||
if (!Array.isArray(arr)) diffs.push(`字段 ${k} 期望为空数组,实测 ${JSON.stringify(arr)}`);
|
||||
else if (arr.length) diffs.push(`字段 ${k} 期望为空数组,实测 ${arr.length} 项`);
|
||||
continue;
|
||||
}
|
||||
const m = /^(==|!=|>=|<=|>|<)?\s*(-?\d+(?:\.\d+)?)$/.exec(String(rule).trim());
|
||||
if (!m) { diffs.push(`expect.fields.${k} 断言写法非法: ${rule}`); continue; }
|
||||
const op = m[1] ?? '==';
|
||||
const want = Number(m[2]);
|
||||
const got0 = k.split('.').reduce((a, key) => (a == null ? undefined : a[key]), actual);
|
||||
if (got0 === undefined) { diffs.push(`字段 ${k} 实测缺失(期望 ${op} ${want})`); continue; }
|
||||
const got = Number(got0);
|
||||
const ok = { '==': got === want, '!=': got !== want, '>=': got >= want, '<=': got <= want, '>': got > want, '<': got < want }[op];
|
||||
if (!ok) diffs.push(`${k} 期望 ${op} ${want} 实测 ${got}`);
|
||||
}
|
||||
if (diffs.length) {
|
||||
drifted++;
|
||||
console.log(` [漂移] ${c.id.padEnd(20)} ${p.case.padEnd(22)} ${diffs.join(' ; ')}`);
|
||||
|
||||
Reference in New Issue
Block a user