fix(e2e): tighten kitchen sink plugin log allowlist

This commit is contained in:
Vincent Koc
2026-06-04 08:42:52 +02:00
parent 2db057423b
commit e17bfc4938
2 changed files with 27 additions and 1 deletions

View File

@@ -109,7 +109,11 @@ function scanLogs() {
/\blevel["']?\s*:\s*["']error["']/iu,
/\[(?:error|ERROR)\]/u,
];
const allow = [/0 errors?/iu, /expected no diagnostics errors?/iu, /diagnostics errors?:\s*$/iu];
const allow = [
/^\s*0 errors?\s*$/iu,
/^\s*expected no diagnostics errors?\s*$/iu,
/^\s*diagnostics errors?:\s*$/iu,
];
const findings = [];
let omittedFindings = false;
for (const file of files) {

View File

@@ -276,6 +276,28 @@ describe("kitchen-sink plugin assertions", () => {
}
});
it("does not allow dirty error lines just because they mention zero errors", () => {
const parent = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-sink-scan-"));
const home = path.join(parent, "home");
const scratchRoot = path.join(parent, "scratch");
try {
mkdirSync(home, { recursive: true });
mkdirSync(scratchRoot, { recursive: true });
writeFileSync(
path.join(scratchRoot, "dirty.log"),
"[ERROR] 0 errors reported but fatal state remained\n",
);
const result = runScanLogs({ home, scratchRoot });
expect(result.status).not.toBe(0);
expect(`${result.stdout}\n${result.stderr}`).toContain("unexpected error-like log lines");
expect(`${result.stdout}\n${result.stderr}`).toContain("fatal state remained");
} finally {
rmSync(parent, { force: true, recursive: true });
}
});
it("bounds repeated kitchen-sink log scan findings", () => {
const parent = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-sink-scan-"));
const home = path.join(parent, "home");