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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Tests: fail a step where a test needs a failed step
Adarshc088297d5a09
diff --git a/tests/cinema-fixes.test.ts b/tests/cinema-fixes.test.tsindex ecb2d687..9a44ce14 100644--- a/tests/cinema-fixes.test.ts+++ b/tests/cinema-fixes.test.ts@@ -45,6 +45,9 @@ const dependsOn = (id: string) => {const v = (db().prepare("SELECT depends_on FROM generations WHERE id = ?").get(id) as { depends_on: string | null }).depends_on;return !v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v];};+// Fails a step the way a provider does (a stopped step stops the steps waiting for it instead of failing them).+const failStep = (id: string, error: string) =>+ db().prepare("UPDATE generations SET status = 'failed', error = ?, completed_at = ? WHERE id = ? AND status IN ('queued', 'running')").run(error, Date.now(), id);const count = () => (db().prepare("SELECT COUNT(*) AS n FROM generations").get() as { n: number }).n;describe("Cinema retry", () => {@@ -68,7 +71,7 @@ describe("Cinema retry", () => {const p = cinema.createProject({ name: "Chain" });const { items } = generateInProject(p.id, { ...VIDEO, engine: "open", settings: CIRCUS });expect(items.map((g) => g.modelId)).toEqual(["fuobe-cinema", "oss-palette-video"]);- await gens.cancelGeneration(items[0].id);+ expect(failStep(items[0].id, "The provider couldn't finish this run").changes).toBe(1);expect((await settle(items[1].id)).status).toBe("failed");// Retrying the dependent finds the broken step it waits for; retrying the main finds its dependent.diff --git a/tests/influencer-api.test.ts b/tests/influencer-api.test.tsindex 86bdd056..fc23f02b 100644--- a/tests/influencer-api.test.ts+++ b/tests/influencer-api.test.ts@@ -39,6 +39,10 @@ async function settle(id: string, ms = 40_000) {}}+// Fails a step the way a provider does (a stopped step stops the steps waiting for it instead of failing them).+const failStep = (id: string, error: string) =>+ db().prepare("UPDATE generations SET status = 'failed', error = ?, completed_at = ? WHERE id = ? AND status IN ('queued', 'running')").run(error, Date.now(), id);+describe("/api/influencer", () => {it("prices a cloud sheet on Fuobe Soul (Nano Banana Pro or Seedream 5.0 Pro when asked); a retired model id runs the default", async () => {const cloud = await (await post({ engine: "cloud", state, start: "scratch" }, true)).json();@@ -87,7 +91,7 @@ describe("/api/influencer", () => {it("retries a failed sheet in its run, but not a face pass whose sheet never came", async () => {const run = await (await post({ engine: "open", state, start: "face", photo: upload() })).json();- await gens.cancelGeneration(run.items[0].id);+ expect(failStep(run.items[0].id, "The provider couldn't finish this run").changes).toBe(1);const pass = await settle(run.sheet.id);expect(pass.status).toBe("failed");// Both steps run again, chained, in the same batch; the failed ones go to the Trash.diff --git a/tests/shorts-api.test.ts b/tests/shorts-api.test.tsindex 5a43ca93..fce20d98 100644--- a/tests/shorts-api.test.ts+++ b/tests/shorts-api.test.ts@@ -59,6 +59,10 @@ async function settle(id: string, ms = 90_000): Promise<Generation> {}}+/** A step that fails as a provider fails it (a Stop would stop the steps after it too, not fail them). */+const failStep = (id: string, error: string) =>+ db().prepare("UPDATE generations SET status = 'failed', error = ?, completed_at = ? WHERE id = ? AND status IN ('queued', 'running')").run(error, Date.now(), id);+const dependsOn = (id: string) => {const v = (db().prepare("SELECT depends_on FROM generations WHERE id = ?").get(id) as { depends_on: string | null }).depends_on;return !v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v];@@ -478,9 +482,9 @@ describe("Mixed Media renders", () => {it("tries a failed render again with the same settings, from the step that failed (the cut is kept)", async () => {const { final, items } = await mixed.createMixed(mm({ engine: "cloud", mode: "fast", range: { start: 1, end: 4 } }) as never);- // The restyle stops: the soundtrack step then fails with the generic "An earlier step didn't finish".+ // The restyle fails: the soundtrack step then fails with the generic "An earlier step didn't finish".await settle(items[0].id);- await gens.cancelGeneration(items[1].id);+ failStep(items[1].id, "The provider couldn't finish this run");expect(await settle(final.id)).toMatchObject({ status: "failed", error: "An earlier step didn't finish" });const res = await mixedRetryRoute.POST(json("POST", { id: final.id, requestId: "mm-retry-0001" }));expect(res.status).toBe(201);@@ -663,11 +667,11 @@ describe("Mixed Media renders", () => {it("says which frame failed and why, not just that an earlier step didn't finish", async () => {const { final } = await mixed.createMixed(mm({ engine: "cloud", range: { start: 1, end: 2 }, fps: 4 }) as never);const edits = gens.listGenerations({ batchId: final.batchId!, features: ["mixed-media-frame-step"], limit: 50 }).sort((a, b) => a.request.step!.index - b.request.step!.index);- await gens.cancelGeneration(edits[1].id);+ failStep(edits[1].id, "Refused by the safety filter");expect(await settle(final.id)).toMatchObject({ status: "failed" });const res = await mixedProgressRoute.GET(new Request(`http://x/api/mixed-media/progress?id=${final.id}`));const progress = await res.json();- expect(progress).toMatchObject({ total: 4, failed: { label: "Frame 2 of 4", error: "Canceled" } });+ expect(progress).toMatchObject({ total: 4, failed: { label: "Frame 2 of 4", error: "Refused by the safety filter" } });expect((await mixedProgressRoute.GET(new Request("http://x/api/mixed-media/progress"))).status).toBe(400);expect((await mixedProgressRoute.GET(new Request("http://x/api/mixed-media/progress?id=nope"))).status).toBe(404);});@@ -691,7 +695,7 @@ describe("Mixed Media renders", () => {it("names the step that failed when no frame did (the extraction), not frame 1", async () => {const { final, items } = await mixed.createMixed(mm({ engine: "cloud", range: { start: 1, end: 2 }, fps: 4 }) as never);const extract = items.find((g) => g.op === "extract-frames")!;- await gens.cancelGeneration(extract.id);+ failStep(extract.id, "The provider couldn't finish this run");expect(await settle(final.id)).toMatchObject({ status: "failed" });const progress = mixed.framesProgress(final.id)!;expect(progress.total).toBe(4);