/** * Failure Classifier — 把命令执行结果(命令+exit_code+输出)确定性归因为 ErrorType。 * * 职责边界: * - 负责:防伪造检测(hollow/empty)+ 失败归因(compile/test),供 Repair 区分偷懒型 vs 能力型 * - 不负责:命令执行(调用方传入结果)、命令解析(剥 wrapper/展开 scripts,最小版略)、测试内容校验 * * 归因优先级(防伪造优先,关键): * hollow_command → empty_test_suite → test_failure → compile_error → passed * 原因:echo "1 passing" exit 1 须判 hollow_command(伪造)非 test_failure(失败), * 否则污染 Repair 分类(把偷懒当能力不足修)。 * * 设计依据:docs/v2-rebuild/VERIFICATION_ENGINE_DESIGN.md 第6节/第9节 * 防伪造继承 V1 executors_build 三正则(HOLLOW_COMMAND_RE/TEST_TRACE_RE/EXPLICIT_ZERO_RE)。 * * 能力边界(诚实标注): * - 不剥命令 wrapper(cross-env/dotenv)、不展开 npm scripts(V1 有此逻辑,最小版略,后续 orchestrator 补) * - 防不住"真跑废测试 test('x',()=>{}) 输出 1 passing"——只查统计词不查测试内容,交 Coding Guard */ import type { VerificationFailure, VerificationLayer } from "./verification_v2_types.js"; /** 归因输入(调用方执行命令后传入)。 */ export interface ClassifyInput { command: string; exit_code: number; stdout: string; stderr: string; layer: VerificationLayer; } /** 判定命令是否空输出命令(伪造)。最小版:查首词,不剥 wrapper/不展开 scripts。 */ export declare function isHollowCommand(command: string): boolean; /** * 把执行结果归因为结构化失败。 * 返回空数组 = 通过(passed)。防伪造优先:hollow 最先查(无论 exit_code),避免伪造污染 Repair 分类。 */ export declare function classifyFailure(input: ClassifyInput): VerificationFailure[];