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
Regenerate: while it is held, the server refuses it however it is asked for, and says it isn't available yet
Claude054fac1126fb
diff --git a/src/lib/catalog/regenerate.ts b/src/lib/catalog/regenerate.tsindex dae05f1c..ab6f96d4 100644--- a/src/lib/catalog/regenerate.ts+++ b/src/lib/catalog/regenerate.ts@@ -398,6 +398,16 @@ export const REGEN_COPY = {missingVisitor: "Your ComfyUI doesn't have Open-H3 Regenerate yet. Add it with Fuobe's ComfyUI setup, then run this again.",/** The refusal when Settings → Models & licences has the refiner switched off. */off: "Regenerate isn't available right now. Pick Restore · faithful to sharpen the clip instead.",+ /** The refusals while Regenerate is held (REGEN_OFFERED off), for the owner and visitors alike: a run of it asked for directly. */+ held: "Regenerate isn't available yet. Pick Restore · faithful to sharpen the clip instead.",+ /** MiniMax H3 at 2K on your GPU, whose takes it finishes. */+ heldTwoK: "MiniMax H3 in 2K isn't available on your GPU yet. Pick 768p, or make it in the cloud.",+ /** Enhance (H3 regenerate) on an Edit video result or a Shorts segment. */+ heldEnhance: "Enhance (H3 regenerate) isn't available yet.",+ /** Finish in 2K on a take from your GPU (a cloud take still re-renders at 2K). */+ heldFinish: "Finish in 2K isn't available for a take from your GPU yet.",+ /** Faceless's Regenerate to 1080p. */+ heldEpisode: "Regenerate to 1080p isn't available yet. Pick Upscale to 1080p instead.",gpuOnly: "Runs on your GPU (open source)",prompt: "Describe the clip: what is in it, how it moves, the light. Regenerate redraws it from these words",/** A 2K finish whose draft's saved copy is gone from the GPU (a retry redraws the draft's clip instead). */diff --git a/src/server/cinema.ts b/src/server/cinema.tsindex 796393a7..fd4cb959 100644--- a/src/server/cinema.ts+++ b/src/server/cinema.ts@@ -2,7 +2,7 @@ import "server-only";import { nanoid } from "nanoid";import { getModel } from "@/lib/catalog";import type { CinemaFolder, CinemaItem, CinemaProject, CinemaTakeInfo, CinemaTile, DirectorMessage, DirectorSettings } from "@/lib/catalog/cinema";-import { finishIn2k, REGEN_OFFERED } from "@/lib/catalog/regenerate";+import { finishIn2k, REGEN_COPY, REGEN_OFFERED } from "@/lib/catalog/regenerate";import type { Generation, GenerationRequest } from "@/lib/catalog/types";import { db } from "./db";import { ConnectComfyError, createGenerations, getGeneration, listGenerations, previewChained, previewGeneration, toGeneration } from "./generations";@@ -715,9 +715,9 @@ export function finishTake(projectId: string, generationId: string): Generation[const g = row ? liveGeneration(generationId) : null;if (!row || !g) throw new CinemaError("That take isn't in this project", 404);// A take from your GPU is finished by Open-H3 Regenerate (perSecond null): only while it is offered (REGEN_OFFERED).- const offered = finishIn2k(g, engineMode());- const finish = offered && (offered.perSecond !== null || REGEN_OFFERED) ? offered : null;+ const finish = finishIn2k(g, engineMode());if (!finish) throw new CinemaError("Finish in 2K is for finished MiniMax H3 takes made below 2K", 422);+ if (finish.perSecond === null && !REGEN_OFFERED) throw new CinemaError(REGEN_COPY.heldFinish, 422);// Once per take: a 2K finish under way or made (this action's, or the 2K run's own finish of its draft) isn't repeated.if (finishedIn2k(generationId)) throw new CinemaError("This take already has a 2K finish", 409);const project = getProject(projectId);diff --git a/src/server/faceless.ts b/src/server/faceless.tsindex 669c789d..4b7121c2 100644--- a/src/server/faceless.ts+++ b/src/server/faceless.ts@@ -85,7 +85,7 @@ import {} from "@/lib/catalog/faceless";import { routesFor } from "@/lib/catalog/plan";import { pricingAt } from "@/lib/catalog/promo";-import { REGEN_OFFERED } from "@/lib/catalog/regenerate";+import { REGEN_COPY, REGEN_OFFERED } from "@/lib/catalog/regenerate";import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types";import { DocxError, docxText } from "./assist/docx";import { PdfError, pdfText } from "./assist/pdf";@@ -1163,6 +1163,8 @@ function regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["rege*/export function regenerateEpisode(id: string): FacelessEpisode {const ep = mustEpisode(id);+ // Open-H3 Regenerate is held until it has run on a card that fits it (REGEN_OFFERED): nothing is made.+ if (!REGEN_OFFERED) throw new FacelessError(REGEN_COPY.heldEpisode, 422);if (!ENGINE_MODELS[ep.settings.engine].regenerate) throw new FacelessError("Regenerate runs on your GPU (open source): switch the episode to open source to use it", 422);const final = finalOf(ep);if (!ep.plan || !final) throw new FacelessError("Wait for the episode to finish first", 409);diff --git a/src/server/generations.ts b/src/server/generations.tsindex 4ccfcf24..249bd99d 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -64,7 +64,7 @@ import { pollTrainings } from "./training";import { createEndFrameClip, createExtendChain, createKeyframeFilm, createMosaicRun, createRefinedModel, createRelitClip, createShotFilm, createStillTo3d, createVoiceFirst, joinClips } from "./chains";import { chainedRefine } from "@/lib/av/hi3d";import { wantsVoiceFirst } from "@/lib/av/voice-first";-import { createH3TwoKRun, createRegenerateRun, keepsH3Latent, regenSwitchedOff } from "./regenerate";+import { createH3TwoKRun, createRegenerateRun, keepsH3Latent, regenHeld, regenSwitchedOff } from "./regenerate";import { H3_2K_STEPS_NOTE, h3TwoKRequests, REGEN_COPY, REGEN_MODEL, regenerateGraphLoras, wantsH3TwoK } from "@/lib/catalog/regenerate";import { enhancePrompt, enhanceSoulWords, ideogramCaption } from "./enhance";import { kandinskyPrompt } from "@/lib/kandinsky-prompt";@@ -900,6 +900,9 @@ const MADE_LENGTH_OPS = new Set<Operation>(["t2v", "i2v", "flf2v", "ref2v", "ext/** What a request would run as — model, operation, job count and cost — without starting it. */export function previewGeneration(asked: GenerationRequest) {const moved = currentRequest(asked);+ // Open-H3 Regenerate while it is held (REGEN_OFFERED), and MiniMax H3's 2K on your GPU that finishes with it: priced as refused.+ const held = regenHeld(moved.request);+ if (held) throw new Error(held);const prepared = prepare(moved.request);const { plan, route, demo, providerId, cost, asked: askedLoras, unreachable, switchedOff, gpu, h3 } = prepared;const notes = moved.note ? [moved.note, ...prepared.notes] : prepared.notes;@@ -1013,6 +1016,10 @@ export function createGenerations(sent: GenerationRequest, opts: CreateOptions =// A retired model or operation (a retry, an old script, a saved project) runs on what replaced it, and says so.const moved = currentRequest(asked);const original = withFinishOf(moved.request, opts.dependsOn);+ // Open-H3 Regenerate is held until it has run on a card that fits it (REGEN_OFFERED): a run of it, or of MiniMax H3's 2K on+ // your GPU that finishes with it, is refused here before any step is made, whichever way it was asked for.+ const held = regenHeld(original);+ if (held) throw new Error(held);// Open models make multi-shot films shot by shot, then join the clips. A Fuobe Original is taken on the engine it runs// on (Fuobe DoP's Frames mode is a GPU chain).// A model (or an Original's engine asked for) switched off in Settings → Models & licences is refused here, before adiff --git a/src/server/regenerate.ts b/src/server/regenerate.tsindex d072c8f1..bab24bbc 100644--- a/src/server/regenerate.ts+++ b/src/server/regenerate.ts@@ -2,6 +2,7 @@ import "server-only";import path from "node:path";import { nanoid } from "nanoid";import {+ ENHANCE_FEATURES,H3_TURBO_4STEP_LORA,h3TwoKRequests,isH3Source,@@ -12,12 +13,15 @@ import {REGEN_FILES,REGEN_LORA,REGEN_MAX_PARTS,+ REGEN_MODEL,+ REGEN_OFFERED,REGEN_ONE_PASS_NOTE,REGEN_SEAM_NOTE,regenCropNote,regenCrops,regenTooLong,regenWindows,+ wantsH3TwoK,} from "@/lib/catalog/regenerate";import { ACCESS_PLACE } from "@/lib/model-access";import type { Generation, GenerationRequest, ModelDef } from "@/lib/catalog/types";@@ -66,6 +70,19 @@ export function regenSwitchedOff(): string | undefined {return tenant() ? REGEN_COPY.off : `Open-H3 Regenerate runs with the ${REGEN_FILES[0].item}, which is switched off in ${ACCESS_PLACE}. Turn it back on there, or pick Restore · faithful`;}+/**+ * Why a run can't start while Open-H3 Regenerate is held (REGEN_OFFERED: it hasn't run on a card that fits it yet), for+ * the owner and visitors alike: a Regenerate run however it is asked for (Upscale → Video, Edit video's Enhance, a Canvas+ * node, a skill, a studio's steps, the API), and MiniMax H3 at 2K on your GPU, whose takes it finishes. In plain words for+ * what was asked; undefined while it is offered, and for any other run.+ */+export function regenHeld(req: Pick<GenerationRequest, "feature" | "modelId" | "params">): string | undefined {+ if (REGEN_OFFERED) return undefined;+ if (wantsH3TwoK(req.modelId, req.params?.resolution)) return REGEN_COPY.heldTwoK;+ if (req.modelId !== REGEN_MODEL) return undefined;+ return ENHANCE_FEATURES.has(req.feature) ? REGEN_COPY.heldEnhance : REGEN_COPY.held;+}+const round3 = (n: number) => Math.round(n * 1000) / 1000;/** Whether a request was already planned here (its draft preset is set): a retry, or one of a split run's windows. */diff --git a/src/server/shorts.ts b/src/server/shorts.tsindex 974c9fd2..aaf7180f 100644--- a/src/server/shorts.ts+++ b/src/server/shorts.ts@@ -37,6 +37,7 @@ import {type ShortsTake,type TakeKeys,} from "@/lib/catalog/shorts";+import { REGEN_COPY, REGEN_OFFERED } from "@/lib/catalog/regenerate";import type { Engine, Generation } from "@/lib/catalog/types";import { createPipeline } from "./chains";import { db } from "./db";@@ -560,6 +561,8 @@ export function regenerateSegment(id: string, index: number): ShortsSessionViewexport function enhanceSegment(id: string, index: number): ShortsSessionView {const s = readSession(id);const seg = segmentAt(s, index);+ // Open-H3 Regenerate is held until it has run on a card that fits it (REGEN_OFFERED): nothing is made.+ if (!REGEN_OFFERED) throw new ShortsError(REGEN_COPY.heldEnhance, 422);if (s.engine !== "open") throw new ShortsError(ENHANCE_COPY.cloudSession, 422);checkEngine("open");const take = seg.takes.find((t) => t.look === seg.primary);diff --git a/tests/account-latent.test.ts b/tests/account-latent.test.tsindex c31d62e5..14156bce 100644--- a/tests/account-latent.test.ts+++ b/tests/account-latent.test.ts@@ -10,6 +10,9 @@ import { startFakeComfy, TINY_MP4, type FakeComfy } from "./helpers/fake-comfy-r// server loads one only from a run of the same account that kept it on the same ComfyUI: never the owner's or another// account's, even when both sit on one ComfyUI. An account's own 2K run hands its latent over on its own GPU.vi.setConfig({ testTimeout: 120_000 });+// Regenerate is switched off for now (REGEN_OFFERED); these tests check it as it runs once switched on.+// tests/regenerate-held.test.ts checks that every way in refuses it while it is off.+vi.mock("@/lib/catalog/regenerate", async (importOriginal) => ({ ...(await importOriginal<typeof import("@/lib/catalog/regenerate")>()), REGEN_OFFERED: true }));const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-account-latent-"));process.env.FUOBE_DATA_DIR = dir;diff --git a/tests/faceless-api.test.ts b/tests/faceless-api.test.tsindex 1e4a38b6..a5942872 100644--- a/tests/faceless-api.test.ts+++ b/tests/faceless-api.test.ts@@ -1,7 +1,11 @@-import { beforeAll, describe, expect, it } from "vitest";+import { beforeAll, describe, expect, it, vi } from "vitest";import type { EpisodeSettings, EpisodeView, FacelessChannel, FacelessEpisode } from "@/lib/catalog/faceless";import { tempDir } from "./helpers/temp-dir";+// Regenerate is switched off for now (REGEN_OFFERED); Faceless's Regenerate to 1080p is checked as it runs once switched on.+// tests/regenerate-held.test.ts checks that every way in refuses it while it is off.+vi.mock("@/lib/catalog/regenerate", async (importOriginal) => ({ ...(await importOriginal<typeof import("@/lib/catalog/regenerate")>()), REGEN_OFFERED: true }));+const dir = tempDir("fuobe-faceless-");process.env.FUOBE_DATA_DIR = dir;// Nothing listens: open models run on the demo provider, and there's no LLM (the offline writer runs).@@ -257,8 +261,9 @@ describe("Episodes", () => {// Regenerate to 1080p (open engine only): every scene redrawn by Open-H3 Regenerate, joined and mixed again with the// episode's own narration and subtitles timing; the cloud shows no Regenerate.expect(doneCloud.regenerate).toBeNull();- // Offered on the open engine while Regenerate is (REGEN_OFFERED, held for now); the action itself runs either way.- expect(doneOpen.regenerate).toEqual(REGEN_OFFERED ? { scenes: 6, demo: true } : null);+ // Offered on the open engine while Regenerate is (REGEN_OFFERED, switched on for this file).+ expect(REGEN_OFFERED).toBe(true);+ expect(doneOpen.regenerate).toEqual({ scenes: 6, demo: true });expect((await actionRoute.POST(json("POST"), params({ id: cloudId, action: "regenerate" }))).status).toBe(422);const regenOpen: EpisodeView = await (await actionRoute.POST(json("POST"), params({ id: openId, action: "regenerate" }))).json();const rIds = regenOpen.episode.plan!.regenerated!.ids;diff --git a/tests/regenerate-held.test.ts b/tests/regenerate-held.test.tsnew file mode 100644index 00000000..1b159dcc--- /dev/null+++ b/tests/regenerate-held.test.ts@@ -0,0 +1,194 @@+import fs from "node:fs";+import path from "node:path";+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";+import type { EpisodeSettings, FacelessChannel, FacelessEpisode } from "@/lib/catalog/faceless";+import type { Generation, GenerationRequest } from "@/lib/catalog/types";+import { TINY_MP4 } from "./helpers/fake-comfy-runner";+import { tempDir } from "./helpers/temp-dir";++// Open-H3 Regenerate is held until it has run on a card that fits it (REGEN_OFFERED, off). Nothing offers it+// (tests/regenerate-offered.test.ts), and the server refuses every way in too, in plain words and before anything is+// made: a run of it sent straight to the API (Upscale → Video, Edit video's Enhance, a Canvas or skill step), MiniMax H3+// at 2K on your GPU, Shorts' Enhance, Faceless's Regenerate to 1080p and Cinema's Finish in 2K on a take from your GPU.+// The tests that mock it on check each of them as it runs once it is switched on.+vi.setConfig({ testTimeout: 120_000 });++const dir = tempDir("fuobe-regen-held-");+process.env.FUOBE_DATA_DIR = dir;+// Nothing listens: open models run on the demo provider, and there's no LLM (Faceless's offline writer runs).+process.env.COMFYUI_URL = "http://127.0.0.1:9";+process.env.OLLAMA_URL = "http://127.0.0.1:9";+process.env.FUOBE_PUBLIC_SIGNUP = "1";+delete process.env.FUOBE_PASSWORD;+delete process.env.FUOBE_HOSTED_RUNS;+globalThis.__fuobeTestDiskFree = 1e13;++const R = await import("@/lib/catalog/regenerate");+const auth = await import("@/server/auth");+const { setSetting } = await import("@/server/settings");+const gens = await import("@/server/generations");+const { saveFile } = await import("@/server/storage");+const { db } = await import("@/server/db");+const shorts = await import("@/server/shorts");+const cinema = await import("@/server/cinema");+const generationsRoute = await import("@/app/api/generations/route");+const enhanceRoute = await import("@/app/api/shorts/sessions/[id]/segments/[index]/enhance/route");+const channelsRoute = await import("@/app/api/faceless/channels/route");+const episodesRoute = await import("@/app/api/faceless/episodes/route");+const facelessAction = await import("@/app/api/faceless/episodes/[id]/[action]/route");+const finishRoute = await import("@/app/api/cinema/projects/[id]/items/[generationId]/finish/route");++let owner = "";+let account = "";+let accountCookie = "";+beforeAll(() => {+ setSetting("demoMode", "auto");+ setSetting("enhanceProvider", "none");+ auth.setPassword("install password");+ owner = `${auth.SESSION_COOKIE}=${auth.createSession().value}`;+ account = auth.createAccount("[email protected]", "long enough").id;+ accountCookie = `${auth.SESSION_COOKIE}=${auth.createSession(account).value}`;+});+afterAll(() => {+ globalThis.__fuobeTestDiskFree = undefined;+});++const json = (method: string, body?: unknown) =>+ new Request("http://x/api", { method, headers: { "Content-Type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body) });+const params = <T extends Record<string, string>>(p: T) => ({ params: Promise.resolve(p) }) as never;+const clip = (accountId?: string) => saveFile({ data: TINY_MP4, contentType: "video/mp4", source: "upload", name: "clip.mp4", ...(accountId && { accountId }) }).url;+const count = () => (db().prepare("SELECT COUNT(*) AS n FROM generations").get() as { n: number }).n;+/** POST /api/generations as the owner or an account, run or priced (?preview=1). */+const post = (body: unknown, o: { cookie?: string; preview?: boolean } = {}) => {+ const text = JSON.stringify(body);+ return generationsRoute.POST(+ new Request(`http://localhost:3000/api/generations${o.preview ? "?preview=1" : ""}`, {+ method: "POST",+ headers: { cookie: o.cookie ?? owner, host: "localhost:3000", "content-type": "application/json", "content-length": String(Buffer.byteLength(text)) },+ body: text,+ }) as never,+ );+};+/** Refused with these words, and nothing made. */+async function refused(send: () => Promise<Response>, words: string) {+ const before = count();+ const r = await send();+ expect(r.status, await r.clone().text()).toBe(422);+ const { error } = (await r.json()) as { error: string };+ expect(error).toBe(words);+ expect(count()).toBe(before);+ return error;+}+/** Visitor-facing words: product copy, no build words. */+const plain = (words: string) => expect(words).not.toMatch(/\b(graphs?|routes?|providers?|loras?|workflows?|endpoints?|comfyui|oss-[\w-]+)\b|safetensors|\.json|_OFFERED/i);++async function settle(id: string, ms = 60_000): Promise<Generation> {+ const end = Date.now() + ms;+ for (;;) {+ const g = gens.getGeneration(id)!;+ if (["succeeded", "failed", "canceled"].includes(g.status)) return g;+ if (Date.now() > end) throw new Error(`timed out: ${g.status}`);+ await new Promise((r) => setTimeout(r, 200));+ }+}++const regen = (video: string): GenerationRequest => ({ feature: "upscale", modelId: R.REGEN_MODEL, op: "upscale-video", prompt: "A fox runs through the snow", inputs: { video }, params: { resolution: "1440p" } });+const twoK: GenerationRequest = { feature: "video", modelId: R.H3_OPEN_MODEL, op: "t2v", prompt: "A lighthouse in a storm", params: { resolution: "2K", duration: 5 } };++describe("Open-H3 Regenerate while it is held", () => {+ it("is held, and its refusals are plain words", () => {+ expect(R.REGEN_OFFERED).toBe(false);+ for (const words of [R.REGEN_COPY.held, R.REGEN_COPY.heldTwoK, R.REGEN_COPY.heldEnhance, R.REGEN_COPY.heldFinish, R.REGEN_COPY.heldEpisode]) {+ plain(words);+ expect(words).toMatch(/isn't available .*yet/);+ }+ });++ it("refuses a run of it sent straight to POST /api/generations, priced or run", async () => {+ const video = clip();+ await refused(() => post(regen(video), { preview: true }), R.REGEN_COPY.held);+ await refused(() => post(regen(video)), R.REGEN_COPY.held);+ // At any size, and with the hand-off flags a finish carries.+ await refused(() => post({ ...regen(video), params: { resolution: "1080p", extra: { startSigma: 0.8, draftFrom: "h3" } } }), R.REGEN_COPY.held);+ });++ it("refuses MiniMax H3 in 2K on your GPU without drafting the take; 768p still runs", async () => {+ await refused(() => post(twoK, { preview: true }), R.REGEN_COPY.heldTwoK);+ await refused(() => post(twoK), R.REGEN_COPY.heldTwoK);+ await refused(() => post({ ...twoK, op: "i2v", inputs: { images: [saveFile({ data: Buffer.from("89504e470d0a1a0a", "hex"), contentType: "image/png", source: "upload" }).url] }, params: { resolution: "1440p", duration: 5 } }), R.REGEN_COPY.heldTwoK);+ const r = await post({ ...twoK, params: { resolution: "768p", duration: 5 } });+ expect(r.status, await r.clone().text()).toBe(201);+ const { items } = (await r.json()) as { items: Generation[] };+ expect(items.map((g) => g.modelId)).toEqual([R.H3_OPEN_MODEL]);+ });++ it("refuses Edit video's Enhance (H3 regenerate) on a result", async () => {+ const result = { feature: "video-edit", request: { feature: "video-edit", modelId: "fuobe-mixed-media", prompt: "make it snow", params: { duration: 5 } } } as Generation;+ const asked = R.enhanceRequest(result, clip());+ expect(asked.modelId).toBe(R.REGEN_MODEL);+ await refused(() => post(asked, { preview: true }), R.REGEN_COPY.heldEnhance);+ await refused(() => post(asked), R.REGEN_COPY.heldEnhance);+ });++ it("refuses an account's run of it, or of H3 in 2K, on its own GPU in the same plain words", async () => {+ await refused(() => post(regen(clip(account)), { cookie: accountCookie }), R.REGEN_COPY.held);+ await refused(() => post(regen(clip(account)), { cookie: accountCookie, preview: true }), R.REGEN_COPY.held);+ await refused(() => post(twoK, { cookie: accountCookie }), R.REGEN_COPY.heldTwoK);+ await refused(() => post(twoK, { cookie: accountCookie, preview: true }), R.REGEN_COPY.heldTwoK);+ });++ it("refuses it as any tool's step: a Canvas node, a step that waits for another, a 2K take whose words come from a text node", async () => {+ const before = count();+ expect(() => gens.createGenerations({ ...regen(clip()), feature: "canvas" })).toThrow(R.REGEN_COPY.held);+ expect(() => gens.previewChained({ ...regen(clip()), feature: "canvas" }, 1)).toThrow(R.REGEN_COPY.held);+ expect(count()).toBe(before);+ const [take] = gens.createGenerations({ ...twoK, feature: "canvas", params: { resolution: "768p", duration: 5 } });+ const waiting: GenerationRequest = { feature: "canvas", modelId: R.REGEN_MODEL, op: "upscale-video", prompt: "A lighthouse", chain: [{ slot: "video" }], params: { resolution: "1440p" } };+ expect(() => gens.createGenerations(waiting, { dependsOn: take.id })).toThrow(R.REGEN_COPY.held);+ expect(() => gens.createGenerations({ ...twoK, feature: "canvas", prompt: "{text}", chain: [{ slot: "prompt" }] }, { dependsOn: take.id })).toThrow(R.REGEN_COPY.heldTwoK);+ expect(count()).toBe(before + 1);+ });++ it("refuses Shorts' Enhance on a segment, adding no take", async () => {+ const source = saveFile({ data: fs.readFileSync(path.join(__dirname, "fixtures/shorts-12s.mp4")), contentType: "video/mp4", source: "upload", name: "beach day.mp4" }).url;+ const s = await shorts.createSession({ engine: "open", presetId: "shorts-claymation", source: { url: source, name: "beach day.mp4" }, range: { start: 0, end: 12 }, aspectRatio: "9:16", language: "auto" } as never);+ const takes = s.segments[1].takes.length;+ await refused(() => enhanceRoute.POST(json("POST", { requestId: "held-enhance-1" }), params({ id: s.id, index: "1" })), R.REGEN_COPY.heldEnhance);+ expect(shorts.getSession(s.id).segments[1].takes).toHaveLength(takes);+ // A missing segment is still not found.+ expect((await enhanceRoute.POST(json("POST"), params({ id: s.id, index: "9" }))).status).toBe(404);+ });++ it("refuses Faceless's Regenerate to 1080p on an episode", async () => {+ const channel: FacelessChannel = await (await channelsRoute.POST(json("POST", { idea: "Channel about the rise and fall of empires", genre: "history", engine: "open" }))).json();+ const settings: EpisodeSettings = {+ engine: "open",+ length: 60,+ animation: "frames",+ aspect: "9:16",+ subtitles: true,+ music: true,+ styleId: "editorial-motion-graphics",+ styleRefs: [],+ voice: null,+ elements: [],+ };+ const script = "The Roman Empire did not fall in a day. For centuries it stretched from Britain to Egypt. Then, slowly, the cracks began to show.";+ const created = await episodesRoute.POST(json("POST", { channelId: channel.id, topic: "How Rome fell", script, settings }));+ expect(created.status).toBe(201);+ const ep: FacelessEpisode = await created.json();+ await refused(() => facelessAction.POST(json("POST"), params({ id: ep.id, action: "regenerate" })), R.REGEN_COPY.heldEpisode);+ expect((await facelessAction.POST(json("POST"), params({ id: "nope", action: "regenerate" }))).status).toBe(404);+ });++ it("refuses Cinema's Finish in 2K on a take from your GPU", async () => {+ const project = cinema.createProject({ name: "Storm" });+ const [g] = gens.createGenerations({ feature: "cinema", modelId: R.H3_OPEN_MODEL, op: "t2v", prompt: "A lighthouse in a storm", params: { resolution: "768p", duration: 5 } });+ cinema.addItems(project.id, [g.id]);+ expect(await settle(g.id)).toMatchObject({ status: "succeeded" });+ // Offered by the catalog as a free redraw on your GPU, refused while it is held.+ expect(R.finishIn2k(gens.getGeneration(g.id)!, "both")?.perSecond).toBeNull();+ await refused(() => finishRoute.POST(json("POST"), params({ id: project.id, generationId: g.id })), R.REGEN_COPY.heldFinish);+ expect(cinema.listItems(project.id).map((x) => x.id)).toEqual([g.id]);+ });+});diff --git a/tests/regenerate-latent.test.ts b/tests/regenerate-latent.test.tsindex cf2bb8f8..eafd754e 100644--- a/tests/regenerate-latent.test.ts+++ b/tests/regenerate-latent.test.ts@@ -9,6 +9,9 @@ import { startFakeComfy, type FakeComfy } from "./helpers/fake-comfy-runner";// it ran on and says where; the finish loads it only from there, names the draft it waits for when it starts (so a retried// draft is the one loaded), redraws the draft's clip when the latent is gone, and never loads one across places.vi.setConfig({ testTimeout: 120_000 });+// Regenerate is switched off for now (REGEN_OFFERED); these tests check it as it runs once switched on.+// tests/regenerate-held.test.ts checks that every way in refuses it while it is off.+vi.mock("@/lib/catalog/regenerate", async (importOriginal) => ({ ...(await importOriginal<typeof import("@/lib/catalog/regenerate")>()), REGEN_OFFERED: true }));const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-regen-latent-"));process.env.FUOBE_DATA_DIR = dir;diff --git a/tests/shorts-api.test.ts b/tests/shorts-api.test.tsindex 8fe23a67..72f0d407 100644--- a/tests/shorts-api.test.ts+++ b/tests/shorts-api.test.ts@@ -5,6 +5,9 @@ import type { Generation } from "@/lib/catalog/types";import { tempDir } from "./helpers/temp-dir";vi.setConfig({ testTimeout: 120_000 });+// Regenerate is switched off for now (REGEN_OFFERED); Shorts' Enhance is checked as it runs once switched on.+// tests/regenerate-held.test.ts checks that every way in refuses it while it is off.+vi.mock("@/lib/catalog/regenerate", async (importOriginal) => ({ ...(await importOriginal<typeof import("@/lib/catalog/regenerate")>()), REGEN_OFFERED: true }));const dir = tempDir("fuobe-shorts-");process.env.FUOBE_DATA_DIR = dir;