Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Tests: hosted input files, and the conformance suite's server items run

Adarsh2e4aecf7811a
diff --git a/tests/hosted-input-files.test.ts b/tests/hosted-input-files.test.ts
new file mode 100644
index 00000000..6c2bbe18
--- /dev/null
+++ b/tests/hosted-input-files.test.ts
@@ -0,0 +1,77 @@
+import sharp from "sharp";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
+import { startFakeFal, type FakeCloud } from "./helpers/fake-cloud";
+import { tempDir } from "./helpers/temp-dir";
+
+/**
+ * Files an endpoint documents it refuses never reach it as they are. A picture outside an endpoint's size, format or
+ * alpha rules goes as a fitted copy (src/server/fit-still.ts: Qwen Image 3 edit takes 384-2048 px a side), and a clip in a
+ * container the endpoint refuses is stopped before upload (clipFileProblem: FLUX.3 Video edits an MP4 clip only).
+ * Stand-in fal.ai (tests/helpers/fake-cloud.ts): no real key, no paid call.
+ */
+process.env.FUOBE_DATA_DIR = tempDir("fuobe-hosted-input-files-");
+process.env.COMFYUI_URL = "http://127.0.0.1:9";
+delete process.env.FUOBE_PASSWORD;
+delete process.env.FUOBE_ENGINE_MODE;
+globalThis.__fuobeTestDiskFree = 1e13;
+
+const gens = await import("@/server/generations");
+const { setSetting } = await import("@/server/settings");
+const { saveFile } = await import("@/server/storage");
+const { imageSize } = await import("@/lib/image-size");
+
+let fal: FakeCloud;
+beforeAll(async () => {
+ fal = await startFakeFal();
+ globalThis.__fuobeTestFalUrl = fal.url;
+ fal.keys["owner-fal"] = "good";
+ setSetting("falKey", "owner-fal");
+});
+afterAll(async () => {
+ globalThis.__fuobeTestFalUrl = undefined;
+ globalThis.__fuobeTestDiskFree = undefined;
+ await fal.close();
+});
+
+async function settle(id: string, done: () => boolean, ms = 15_000) {
+ const end = Date.now() + ms;
+ for (;;) {
+ await globalThis.__fuobeRunner?.tick();
+ const g = gens.getGeneration(id, { includeDeleted: true })!;
+ if (done() || !["queued", "running"].includes(g.status) || Date.now() > end) return g;
+ await new Promise((r) => setTimeout(r, 15));
+ }
+}
+const submits = (endpoint: string) => fal.log.filter((r) => r.method === "POST" && r.path.split("?")[0] === `/${endpoint}`);
+const uploads = () => fal.log.filter((r) => r.method === "PUT" && r.path.startsWith("/upload/"));
+
+describe("files outside an endpoint's documented limits", () => {
+ it("a picture over Qwen Image 3 edit's 2048 px goes as a 2048 px copy without alpha", async () => {
+ const png = await sharp({ create: { width: 3000, height: 1000, channels: 4, background: { r: 200, g: 120, b: 40, alpha: 0.5 } } })
+ .png()
+ .toBuffer();
+ const ref = saveFile({ data: png, contentType: "image/png", name: "wide.png", source: "upload" }).url;
+ const from = fal.log.length;
+ const [g] = gens.createGenerations({ feature: "image", modelId: "qwen-image-3", engine: "cloud", op: "edit", prompt: "make the sky pink", inputs: { images: [ref] } });
+ await settle(g.id, () => submits("alibaba/qwen-image-3/edit").length > 0);
+ const sent = fal.log.slice(from).filter((r) => r.method === "PUT" && r.path.startsWith("/upload/"));
+ expect(sent).toHaveLength(1);
+ const data = Buffer.from(sent[0].body, "latin1");
+ expect(imageSize(data)).toEqual({ width: 2048, height: 682 });
+ const meta = await sharp(data).metadata();
+ expect(meta.hasAlpha).toBe(false);
+ expect(submits("alibaba/qwen-image-3/edit")).toHaveLength(1);
+ await gens.cancelGeneration(g.id).catch(() => {});
+ });
+
+ it("a WebM clip for FLUX.3 Video's edit is stopped before it is uploaded", async () => {
+ const ref = saveFile({ data: Buffer.from("\x1aE\xdf\xa3webm", "latin1"), contentType: "video/webm", name: "clip.webm", source: "upload" }).url;
+ const before = uploads().length;
+ const [g] = gens.createGenerations({ feature: "video-edit", modelId: "flux-3-video", engine: "cloud", op: "v2v", prompt: "make it snow", inputs: { video: ref } });
+ const done = await settle(g.id, () => false);
+ expect(done.status).toBe("failed");
+ expect(done.error).toMatch(/FLUX\.3 Video takes an MP4 clip under 50 MB/);
+ expect(uploads().length).toBe(before);
+ expect(fal.log.some((r) => r.method === "POST" && r.path.includes("flux-3"))).toBe(false);
+ });
+});
diff --git a/tests/provider-conformance-live-routes.test.ts b/tests/provider-conformance-live-routes.test.ts
index 1be04fe5..bb7f6541 100644
--- a/tests/provider-conformance-live-routes.test.ts
+++ b/tests/provider-conformance-live-routes.test.ts
@@ -252,14 +252,13 @@ describe("Replicate routes (spec audit 2026-11-06)", () => {
expect(body).not.toHaveProperty("steps");
});
- it.todo("hosted: Replicate Files API uploads stop at 100 MB (replicate.ts prepareFile)");
- it.todo("hosted: owner Replicate runs copy their output again before replicate.delivery deletes it an hour later (generations.ts pollOne)");
- it.todo("hosted: predictions are created with a Cancel-After deadline (replicate.ts submit)");
- it.todo("hosted: a 429 waits the Retry-After Replicate gives (replicate.ts rFetch)");
- it.todo("hosted: data_removed predictions say the result expired (replicate.ts poll)");
- it.todo("hosted: at most 10 MB of data URIs inline per prediction (replicate.ts capInline)");
- it.todo("hosted: a Replicate LoRA copy is reused for 20 hours, not 24 (loras.ts MIRROR_TTL_MS)");
- it.todo("hosted: an own LoRA of 100 MB or more goes to Replicate by its fal.media URL (loras.ts sendOwnLora)");
+ // The server side of these routes is tested against stand-in providers in its own suites:
+ // - Files API uploads stop at 100 MB, and a long transcript goes as a speech copy: tests/replicate-file-limit.test.ts
+ // - the owner's output is copied again before replicate.delivery deletes it, a Cancel-After deadline, a 429's wait, and
+ // data_removed reading as expired: tests/replicate-lifecycle.test.ts
+ // - at most 10 MB of data URIs inline per prediction, and a LoRA copy reused for 20 hours: tests/replicate-files-lifetime.test.ts
+ // - an own LoRA of 100 MB or more goes by its fal.media URL: tests/training-lora-hosted.test.ts
+ // - H3 Lite and HighSpeed references as public links: tests/replicate-public-links.test.ts
});
describe("fal.ai routes (spec audit 2026-11-06)", () => {
@@ -401,10 +400,13 @@ describe("fal.ai routes (spec audit 2026-11-06)", () => {
expect(JSON.stringify(p)).not.toContain('"transformer":"high"');
});
- it.todo("hosted: fal uploads and results expire with Fuobe's retention (fal.ts lifecycle headers)");
- it.todo("hosted: a 404 on a status poll ends the run as gone, not as model-unavailable (diagnose.ts + generations.ts)");
- it.todo("hosted: a fal training given up on is cancelled at fal (training.ts cancel_url)");
- it.todo("hosted: a voice clone that times out is cancelled at fal (fal.ts cloneVoice)");
- it.todo("hosted: pictures outside an endpoint's documented size or format are fitted before upload (fit-still.ts)");
- it.todo("hosted: clip and voice files are checked with clipFileProblem before upload (generations.ts prepVideo/prepVoice)");
+ // The server side of these routes is tested against stand-in providers in its own suites:
+ // - uploads and results expire with Fuobe's retention, a cancel's answer, a result fal.ai no longer has, and typed
+ // errors: tests/fal-queue-spec.test.ts
+ // - a 404 on a status poll ends the run in words about the run, not as a model that isn't there:
+ // tests/fal-account-queue-spec.test.ts
+ // - a training given up on is cancelled at fal.ai: tests/fal-training-queue-spec.test.ts, tests/training-lora-hosted.test.ts
+ // - a voice clone that times out is cancelled at fal.ai: tests/fal-clone-voice-cancel.test.ts
+ // - pictures outside an endpoint's documented size or format are fitted before upload, and clip and voice files are
+ // checked with clipFileProblem before upload: tests/still-limits.test.ts, tests/hosted-input-files.test.ts
});