fix(images): bound external runtime processing
CI / lint (pull_request) Successful in 11s
CI / typecheck (pull_request) Successful in 10s
CI / test (pull_request) Successful in 16s
CI / build (pull_request) Successful in 10s
CI / integration (pull_request) Failing after 2m14s

This commit is contained in:
ekklesia
2026-10-10 10:54:33 -05:00
parent 871d198221
commit 88038476b3
4 changed files with 49 additions and 8 deletions
+25
View File
@@ -1,3 +1,4 @@
import type { ModuleStorage } from "@ekklesia/module-sdk";
import sharp from "sharp";
import { beforeEach, describe, expect, it } from "vitest";
import { SignageError } from "../src/server/errors.js";
@@ -372,6 +373,30 @@ describe("native image ingest", () => {
expect(store.images.size).toBe(0);
});
it("recognizes a sanitized storage failure from the host's separate SDK copy", async () => {
const bucket = storage.bucket("native-images");
const externalError = Object.assign(new Error("The storage service could not be reached."), {
code: "STORAGE_PROVIDER_UNAVAILABLE",
name: "ModuleStorageError",
});
const externalStorage: ModuleStorage = {
bucket: () => ({ ...bucket, put: () => Promise.reject(externalError) }),
buckets: () => ["native-images"],
};
await expectSignageCode(
ingestNativeImage({
bytes: await makeImage({ format: "png", height: 360, width: 640 }),
displayName: "welcome.png",
expiresAt: null,
filename: "welcome.png",
storage: externalStorage,
store,
}),
"SIGNAGE_STORAGE_UNAVAILABLE",
);
});
it("treats a race with an identical upload as a success rather than a failure", async () => {
const bytes = await makeImage({ format: "png", height: 1080, width: 1920 });
const first = await ingest(bytes);