From d2f5456624cc1b270df5e2f0a0e7474aeda63c2b Mon Sep 17 00:00:00 2001 From: SnapOtter Date: Sat, 9 May 2026 19:52:11 +0800 Subject: [PATCH] fix: bump HEIF + image-enhancement CI timeout to 300s HEIF decoding combined with image-enhancement (CLAHE + histogram + multi-step corrections) exceeds 180s on GitHub Actions runners. HEIC works fine (~4.5s) but HEIF specifically needs ~5min in CI. --- .../format-matrix-comprehensive.test.ts | 32 +++++++++++-------- tests/integration/format-matrix.test.ts | 12 ++++--- tests/integration/image-enhancement.test.ts | 2 +- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/tests/integration/format-matrix-comprehensive.test.ts b/tests/integration/format-matrix-comprehensive.test.ts index 601c365a..fb68826a 100644 --- a/tests/integration/format-matrix-comprehensive.test.ts +++ b/tests/integration/format-matrix-comprehensive.test.ts @@ -189,6 +189,8 @@ function needsFallback(fmt: FormatDef): boolean { } function getTimeout(fmt: FormatDef, toolId?: string): number | undefined { + if ((fmt.needsHeifDecoder || fmt.needsCliDecoder) && toolId === "image-enhancement") + return 300_000; if (fmt.needsHeifDecoder || fmt.needsCliDecoder) return 180_000; if (toolId === "image-enhancement") return 120_000; return undefined; @@ -1051,22 +1053,26 @@ describe("HEIC/HEIF graceful handling", () => { for (const fmt of HEIF_FORMATS) { describe(`${fmt.name}`, () => { for (const tool of CORE_TOOLS) { - it(`${tool.id}: no crash`, async () => { - const res = await callTool(tool.id, fmt, tool.settings); - if (!res) return; + it( + `${tool.id}: no crash`, + async () => { + const res = await callTool(tool.id, fmt, tool.settings); + if (!res) return; - // Must never crash - expect(res.statusCode).not.toBe(500); + // Must never crash + expect(res.statusCode).not.toBe(500); - // Accept success (200) or clean error (400/422) - expect([200, 400, 422]).toContain(res.statusCode); + // Accept success (200) or clean error (400/422) + expect([200, 400, 422]).toContain(res.statusCode); - const body = JSON.parse(res.body); - if (res.statusCode !== 200) { - expect(body.error).toBeDefined(); - expect(typeof body.error).toBe("string"); - } - }, 180_000); + const body = JSON.parse(res.body); + if (res.statusCode !== 200) { + expect(body.error).toBeDefined(); + expect(typeof body.error).toBe("string"); + } + }, + tool.id === "image-enhancement" ? 300_000 : 180_000, + ); } }); } diff --git a/tests/integration/format-matrix.test.ts b/tests/integration/format-matrix.test.ts index 47c13b68..d4b40ac0 100644 --- a/tests/integration/format-matrix.test.ts +++ b/tests/integration/format-matrix.test.ts @@ -485,11 +485,13 @@ describe("Cross-format matrix", () => { if (tool.id === "convert" && fmt.name === "PNG") continue; const perTestTimeout = - fmt.needsHeifDecoder || fmt.needsCliDecoder - ? 180_000 - : tool.id === "image-enhancement" - ? 120_000 - : undefined; + (fmt.needsHeifDecoder || fmt.needsCliDecoder) && tool.id === "image-enhancement" + ? 300_000 + : fmt.needsHeifDecoder || fmt.needsCliDecoder + ? 180_000 + : tool.id === "image-enhancement" + ? 120_000 + : undefined; it( `${tool.label}`, diff --git a/tests/integration/image-enhancement.test.ts b/tests/integration/image-enhancement.test.ts index 626d739c..556da685 100644 --- a/tests/integration/image-enhancement.test.ts +++ b/tests/integration/image-enhancement.test.ts @@ -678,7 +678,7 @@ describe("Authentication", () => { // ── HEIF input ───────────────────────────────────────────────── describe("HEIF input", () => { - it("enhances HEIF (sample.heif) input", { timeout: 120_000 }, async () => { + it("enhances HEIF (sample.heif) input", { timeout: 300_000 }, async () => { const HEIF = readFileSync(join(FIXTURES, "formats", "sample.heif")); const res = await postTool({ mode: "auto" }, HEIF, "sample.heif", "image/heif"); expect([200, 422]).toContain(res.statusCode);