fix(e2e): bound release scenario JSON artifacts

This commit is contained in:
Vincent Koc
2026-06-07 12:43:33 +02:00
parent 1703fbc2ad
commit 9bafa2a2b6
2 changed files with 50 additions and 2 deletions
@@ -129,6 +129,31 @@ describe("release scenario assertions", () => {
}
});
it("rejects oversized JSON artifacts before parsing release scenario outputs", () => {
const root = mkdtempSync(path.join(tmpdir(), "openclaw-release-scenarios-"));
const outputPath = path.join(root, "describe.json");
const requestLogPath = path.join(root, "requests.jsonl");
try {
writeFileSync(
outputPath,
`DO_NOT_DUMP_OLD_JSON${"x".repeat(2 * 1024 * 1024)}\nrecent json tail`,
"utf8",
);
writeFileSync(requestLogPath, "/v1/responses\n", "utf8");
const result = runAssertion(["assert-image-describe", outputPath, requestLogPath]);
expect(result.status).not.toBe(0);
expect(result.stderr).toContain("JSON artifact exceeded");
expect(result.stderr).toContain("recent json tail");
expect(result.stderr).not.toContain("DO_NOT_DUMP_OLD_JSON");
expect(result.stderr.length).toBeLessThan(80 * 1024);
} finally {
rmSync(root, { force: true, recursive: true });
}
});
it("scans large request logs for image generation requests", () => {
const root = mkdtempSync(path.join(tmpdir(), "openclaw-release-scenarios-"));
const outputPath = path.join(root, "generate.json");