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
No Higgsfield (O7): one migration, and a guard that fails when a code path names the provider
Claudec4b78de45cfc
diff --git a/docs/research/fuobe-originals-recipes-5.json b/docs/research/fuobe-originals-recipes-5.jsonindex ff8c2085..6deff381 100644--- a/docs/research/fuobe-originals-recipes-5.json+++ b/docs/research/fuobe-originals-recipes-5.json@@ -22259,7 +22259,7 @@"verified": true,"schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=alibaba/happy-horse/v1.1/text-to-video","checked": "2026-10-27",- "replaces": "a route Fuobe ran on Higgsfield's API until build plan O7"+ "replaces": "a route of the provider build plan O7 removed"},{"provider": "fal",@@ -22345,7 +22345,7 @@"verified": true,"schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=alibaba/happy-horse/v1.1/image-to-video","checked": "2026-10-27",- "replaces": "a route Fuobe ran on Higgsfield's API until build plan O7"+ "replaces": "a route of the provider build plan O7 removed"},{"provider": "fal",@@ -22452,7 +22452,7 @@"verified": true,"schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=alibaba/happy-horse/v1.1/reference-to-video","checked": "2026-10-27",- "replaces": "a route Fuobe ran on Higgsfield's API until build plan O7"+ "replaces": "a route of the provider build plan O7 removed"}]}diff --git a/scripts/eval/cases/genjutsu.json b/scripts/eval/cases/genjutsu.jsonindex 4070ff43..591f9ab0 100644--- a/scripts/eval/cases/genjutsu.json+++ b/scripts/eval/cases/genjutsu.json@@ -2,7 +2,7 @@"$schema": "./case.schema.json","suite": "genjutsu","title": "Fuobe Genjutsu · motion transfer, character swap, object swap, restyle",- "description": "Runs the Genjutsu studio route (POST /api/genjutsu, priced by /api/genjutsu/estimate) on your reference clips and images in local/genjutsu/: dance.mp4 (a 4–10 s clip of one person moving), person.mp4 (5–15 s, one continuous shot, the person visible in its first frame), character.png (who should move like that or take their place, a consenting person or a drawn character), street.mp4 (a clip with an object to swap), object.png (what replaces it), style.png (a look image you own). The Originals (O5) run on both engines: open weights on ComfyUI (Wan Animate 2, MiniMax H3 Character swap, Wan 2.1 VACE with SAM 3.1, Wan 2.2 Fun VACE) and the same open models hosted on fal (Wan 2.2 Animate, MiniMax H3 with Akatz Labs' swap LoRA, Wan VACE). The -lite cases run an Original's cheaper, faster tier on the same inputs (motion and object swap have one); the partner variant runs each mode's partner model on fal for reference (Kling 3.0 Motion Control, MiniMax H3 Max Recast, Kling O3 edit, Kling O3 4K edit). A job is skipped when the studio would pick another model than the one named, or run through Higgsfield's API.",+ "description": "Runs the Genjutsu studio route (POST /api/genjutsu, priced by /api/genjutsu/estimate) on your reference clips and images in local/genjutsu/: dance.mp4 (a 4–10 s clip of one person moving), person.mp4 (5–15 s, one continuous shot, the person visible in its first frame), character.png (who should move like that or take their place, a consenting person or a drawn character), street.mp4 (a clip with an object to swap), object.png (what replaces it), style.png (a look image you own). The Originals (O5) run on both engines: open weights on ComfyUI (Wan Animate 2, MiniMax H3 Character swap, Wan 2.1 VACE with SAM 3.1, Wan 2.2 Fun VACE) and the same open models hosted on fal (Wan 2.2 Animate, MiniMax H3 with Akatz Labs' swap LoRA, Wan VACE). The -lite cases run an Original's cheaper, faster tier on the same inputs (motion and object swap have one); the partner variant runs each mode's partner model on fal for reference (Kling 3.0 Motion Control, MiniMax H3 Max Recast, Kling O3 edit, Kling O3 4K edit). A job is skipped when the studio would pick another model than the one named.","original": ["fuobe-genjutsu-motion","fuobe-character-swap",diff --git a/scripts/fetch-hosted-schemas.py b/scripts/fetch-hosted-schemas.pyindex 44ab70c0..8f4a9d7a 100644--- a/scripts/fetch-hosted-schemas.py+++ b/scripts/fetch-hosted-schemas.py@@ -113,8 +113,8 @@ GENJUTSU = {"minimax/h3-max/recast": ("video-swap", {"prompt": "prompt", "video": "video_url", "images": "reference_image_urls", "resolution": "resolution", "seed": "seed"}),}-# Partner models' fal routes that take over a route Fuobe dropped with the Higgsfield provider (build plan O7: Happy-# Horse 1.1 ran only on Higgsfield). Read with --partner; stored in partnerEndpoints, which gen-cloud-models.py reads.+# Partner models' fal routes that take over a route Fuobe dropped with its third cloud provider (build plan O7: Happy+# Horse 1.1 had no other route). Read with --partner; stored in partnerEndpoints, which gen-cloud-models.py reads.HAPPY_HORSE = {"prompt": "prompt", "seed": "seed", "duration": "duration", "resolution": "resolution"}PARTNER = {"alibaba/happy-horse/v1.1/text-to-video": ("t2v", {**HAPPY_HORSE, "aspectRatio": "aspect_ratio"}),@@ -271,7 +271,7 @@ def main():# Add or refresh the partner routes (PARTNER) and keep every other record as it is.records = {e["endpoint"]: e for e in data.get("partnerEndpoints") or []}for ep, (op, kf) in PARTNER.items():- records[ep] = {**base_record(ep, op, kf, fal_prices(ep)), "replaces": "a route Fuobe ran on Higgsfield's API until build plan O7"}+ records[ep] = {**base_record(ep, op, kf, fal_prices(ep)), "replaces": "a route of the provider build plan O7 removed"}data["partnerEndpoints"] = list(records.values())FILE.write_text(json.dumps(data, indent=1, ensure_ascii=False) + "\n", encoding="utf-8")returndiff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.pyindex 066604df..c1193a6b 100644--- a/scripts/gen-cloud-models.py+++ b/scripts/gen-cloud-models.py@@ -48,8 +48,8 @@ for e in ORIGINALS["hostedLoraEndpoints"]:"inputs": e["inputs"], "keyFields": e.get("keyFields") or {}, "output": e.get("output"), "price": e.get("price")}for e in ORIGINALS.get("hostedBaseEndpoints") or []:EPS[(e["provider"], e["endpoint"])] = e-# Partner models' fal routes read for build plan O7 (scripts/fetch-hosted-schemas.py --partner): Happy Horse 1.1 ran-# only on Higgsfield's API before.+# Partner models' fal routes read for build plan O7 (scripts/fetch-hosted-schemas.py --partner): Happy Horse 1.1 had+# no fal route before.for e in ORIGINALS.get("partnerEndpoints") or []:EPS[(e["provider"], e["endpoint"])] = e@@ -610,7 +610,7 @@ model("happy-horse-video-edit", "Happy Horse Video Edit", "Alibaba", "happy-hors[("v2v", "alibaba/happy-horse/video-edit")], badges=["new", "audio"], defaults={"resolution": "720p"},pricing=("second", 0.28, "720p, input + output seconds; 1080p $0.56", {"byResolution": {"720p": 0.28, "1080p": 0.56}, "inputSeconds": True}),controls=[("audio_setting", "Audio")])-# Happy Horse 1.1 (build plan O7): Higgsfield resold it; fal hosts the same three endpoints (partnerEndpoints, read+# Happy Horse 1.1 (build plan O7): fal hosts Alibaba's three endpoints (partnerEndpoints, read# 2026-10-27): $0.14/s at 720p, $0.18/s at 1080p; 3-15 s; up to 9 reference images.model("happy-horse-1-1", "Happy Horse 1.1", "Alibaba", "happy-horse", "video", "Alibaba's expressive character-animation video model",[("t2v", "alibaba/happy-horse/v1.1/text-to-video"), ("i2v", "alibaba/happy-horse/v1.1/image-to-video"),diff --git a/src/components/ads/multiplier.tsx b/src/components/ads/multiplier.tsxindex fdf42d58..4e34c4d7 100644--- a/src/components/ads/multiplier.tsx+++ b/src/components/ads/multiplier.tsx@@ -493,7 +493,7 @@ export function AdMultiplier({ models }: { models: Record<string, ModelInfo> })/></div><p className="flex flex-wrap items-center justify-center gap-1.5 pt-6 text-center text-[12px] text-muted-foreground">- <Sparkles className="size-3" /> Cloud: Seedance 2.5 edit (Higgsfield), Kling O3 edit, Gemini Omni Flash · Open source: Wan 2.2 Animate, Wan 2.2 clips joined around your ad+ <Sparkles className="size-3" /> Cloud: Kling O3 edit, Happy Horse edit, Gemini Omni Flash · Open source: Fuobe Genjutsu (Wan Animate), Wan 2.2 clips joined around your ad</p></div></div>diff --git a/src/components/fashion/character-sheet.tsx b/src/components/fashion/character-sheet.tsxindex 3795d7a6..932ed689 100644--- a/src/components/fashion/character-sheet.tsx+++ b/src/components/fashion/character-sheet.tsx@@ -271,7 +271,7 @@ export function CharacterSheetView({ fields, defaults }: { fields: CastFieldData{mode === "describe" && (<div className="space-y-2"><Textarea value={brief} onChange={(e) => setBrief(e.target.value)} rows={5} placeholder="Who are they? e.g. “a 26-year-old surfer and photographer from Lisbon, freckles, sun-bleached curls”" aria-label="Describe your character" />- <p className="text-[12px] text-muted-foreground">Runs the AI Influencer app: Higgsfield's character-sheet model on the cloud, Z-Image Turbo on the open engine.</p>+ <p className="text-[12px] text-muted-foreground">Runs the AI Influencer app: Nano Banana Pro in the cloud, the Soul Cast sheet (Z-Image Turbo) free on your GPU.</p></div>)}diff --git a/src/lib/catalog/remove-object.ts b/src/lib/catalog/remove-object.tsindex b45f305c..401ebaa4 100644--- a/src/lib/catalog/remove-object.ts+++ b/src/lib/catalog/remove-object.ts@@ -127,7 +127,7 @@ export const ERASERS: Eraser[] = [engine: "cloud",modes: ["type"],label: "Kling O3 Omni edit",- note: "Higgsfield's own route · 3–15 s per piece · sound kept",+ note: "3–15 s per piece · sound kept",maxSeconds: 15,minSeconds: 3,keepsSound: true,diff --git a/src/server/db.ts b/src/server/db.tsindex 3e9ce4aa..95c2a105 100644--- a/src/server/db.ts+++ b/src/server/db.ts@@ -555,6 +555,15 @@ const MIGRATIONS: string[] = [);CREATE INDEX IF NOT EXISTS swap_projects_updated ON swap_projects(updated_at DESC);CREATE INDEX IF NOT EXISTS swap_projects_waiting ON swap_projects(waiting) WHERE waiting > 0;`,+ // originals (o/no-higgsfield): Fuobe no longer calls Higgsfield's API (build plan O7). Its saved key is deleted (a+ // secret nothing reads any more), a "Higgsfield first" cloud provider becomes Automatic, and the ads its Ads Studio+ // drew whole are marked baked, which is all the Ads Studio needs to show them as they are. Jobs and trainings still+ // waiting on it fail on their next poll with a way forward (src/server/providers/index.ts, src/server/training.ts).+ `DELETE FROM settings WHERE key = 'higgsfield.key';+ UPDATE settings SET value = 'auto' WHERE key = 'cloud.provider' AND value = 'higgsfield';+ UPDATE ad_batches SET route = 'baked' WHERE route = 'higgsfield';+ UPDATE ad_creatives SET meta_json = json_set(meta_json, '$.route', 'baked')+ WHERE json_valid(meta_json) AND json_extract(meta_json, '$.route') = 'higgsfield';`,];declare global {diff --git a/tests/no-higgsfield.test.ts b/tests/no-higgsfield.test.tsnew file mode 100644index 00000000..914a28e1--- /dev/null+++ b/tests/no-higgsfield.test.ts@@ -0,0 +1,266 @@+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import { afterAll, describe, expect, it } from "vitest";++/**+ * Build plan O7: Fuobe calls no Higgsfield API. This file fails when a code path names that provider again (its id,+ * key, endpoints, settings, env vars or copy that offers it), when a retired model comes back into the catalog, or+ * when an id stored before the switch no longer resolves to the model that replaced it. It scans whole folders, so a+ * branch merged later (an Originals package, a studio) is caught too. Research files under docs/research/ stay as+ * research and are not scanned; this file is the one test that names the provider.+ */++const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-no-hf-"));+process.env.FUOBE_DATA_DIR = dir;+process.env.COMFYUI_URL = "http://127.0.0.1:9";++const { MODELS, getModel } = await import("@/lib/catalog");+const { enginesOf } = await import("@/lib/catalog/engines");+const { REPLACED_BY, TRAINING_REPLACED_BY, currentModelId, migrateRequest, replacedBy } = await import("@/lib/catalog/replaced");+const { TRAINING_TARGETS } = await import("@/lib/catalog/training");+const { SOUL_LEGACY_IDS } = await import("@/lib/catalog/soul-looks.generated");+const { PROVIDER_SETTINGS } = await import("@/lib/connections");+const { PROVIDERS, provider, RETIRED_PROVIDER_ERROR } = await import("@/server/providers");+const { SETTINGS, getSetting } = await import("@/server/settings");+const { db } = await import("@/server/db");+const { withCurrentModels } = await import("@/lib/catalog/canvas");+const generationsRoute = await import("@/app/api/generations/route");++afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));++const ROOT = path.resolve(__dirname, "..");++// ---------------------------------------------------------------------------+// The guard: no code path names the provider++/** Where code and shipped content live (docs/ holds the research, which stays). */+const SCANNED = ["src", "scripts", "bin", "skills", "workflows", "package.json"];+const TEXT = /\.(ts|tsx|mts|js|mjs|cjs|py|json|md|sh|bat|ps1|css|html|txt|yml|yaml)$/;++/**+ * Files that must name it, and why. Nothing else may: add a line here only for history that has to read the old+ * name (a migration, the table of what replaced what), never for a route, a key or a model that runs.+ */+const ALLOWED: Record<string, string> = {+ "src/server/db.ts": "the O7 migration deletes the retired key and rewrites stored values that name the provider",+ "src/lib/catalog/replaced.ts": "what each retired model was called, for history",+};++/** Research files and research record fields keep their names: reading research is not calling the provider. */+const RESEARCH_NAMES = /higgsfield-[a-z0-9-]+\.(md|json)|higgsfieldEquivalent/g;++const RULES: [string, RegExp][] = [+ // An id, key, endpoint, URL, import or settings key: always lowercase in code.+ ["names the provider in code (an id, key, endpoint, URL or import)", /higgsfield/],+ ["names a Higgsfield env var or constant", /HIGGSFIELD|\bHF_(API_)?(KEY|SECRET)\b/],+ // Copy that offers the provider: "Higgsfield key", "connect Higgsfield", "runs on Higgsfield", "Higgsfield Ads Studio"…+ [+ "offers the provider in copy",+ // ("as on Higgsfield" and "Higgsfield's old style ids" are comparisons and history, not an offer.)+ /higgsfield (api|key|account|balance|route|provider|credit|console)|(needs|with|connect|add|set) (a |an |your )?higgsfield(?!'s)\b|(?<!as )\b(on|via|through) higgsfield\b|higgsfield's (api|own models?|route|key)|higgsfield (soul|cinema studio|ads studio|marketing studio)/i,+ ],+];++function walk(p: string, out: string[]) {+ const full = path.join(ROOT, p);+ if (!fs.existsSync(full)) return;+ const st = fs.statSync(full);+ if (st.isFile()) {+ if (TEXT.test(p)) out.push(p);+ return;+ }+ for (const name of fs.readdirSync(full)) {+ if (name === "node_modules" || name.startsWith(".")) continue;+ walk(path.join(p, name), out);+ }+}++describe("no code path names the Higgsfield provider", () => {+ const files: string[] = [];+ for (const p of SCANNED) walk(p, files);++ it("scans every source, script, skill and workflow file", () => {+ expect(files.length).toBeGreaterThan(500);+ expect(files).toContain("src/server/providers/index.ts");+ });++ it("finds no provider id, key, endpoint, env var or copy that offers it outside the allowed history", () => {+ const hits: string[] = [];+ for (const f of files) {+ if (ALLOWED[f]) continue;+ const lines = fs.readFileSync(path.join(ROOT, f), "utf8").split("\n");+ lines.forEach((line, i) => {+ const text = line.replace(RESEARCH_NAMES, "");+ for (const [why, re] of RULES) if (re.test(text)) hits.push(`${f}:${i + 1} ${why}: ${line.trim().slice(0, 140)}`);+ });+ }+ expect(hits).toEqual([]);+ });++ it("has no file named after it", () => {+ expect(files.filter((f) => /higgsfield/i.test(path.basename(f)))).toEqual([]);+ });++ it("keeps the allowed history short and real", () => {+ for (const f of Object.keys(ALLOWED)) expect(fs.readFileSync(path.join(ROOT, f), "utf8"), f).toMatch(/higgsfield/i);+ });+});++// ---------------------------------------------------------------------------+// The catalog, the providers and the settings++describe("the catalog and the providers run without it", () => {+ const KNOWN = new Set(["fal", "replicate", "comfyui", "mock", "local", "llm", "openai", "google"]);++ it("routes every model to a provider Fuobe has", () => {+ const odd = MODELS.flatMap((m) => m.routes.filter((r) => !KNOWN.has(r.provider) || /higgsfield/i.test(r.endpoint)).map((r) => `${m.id}: ${r.provider} ${r.endpoint}`));+ expect(odd).toEqual([]);+ expect(Object.keys(PROVIDERS).sort()).toEqual([...KNOWN].sort());+ });++ it("has no setting, connection test or env var for it", () => {+ const named = Object.entries(SETTINGS).filter(([name, def]) => /higgsfield|^hf/i.test(`${name} ${def.key} ${"env" in def ? def.env : ""}`));+ expect(named).toEqual([]);+ expect(Object.keys(PROVIDER_SETTINGS)).not.toContain("higgsfield");+ expect(SETTINGS.cloudProvider.options).toEqual(["auto", "fal", "replicate"]);+ });++ it("fails a job stored under a provider Fuobe no longer has, with a way forward, instead of throwing", async () => {+ const gone = provider("higgsfield" as never);+ expect(gone.isConfigured()).toBe(false);+ const ctx = { externalId: "x", meta: {}, route: { op: "t2i" as const, provider: "fal" as const, endpoint: "x" }, model: getModel("nano-banana-pro")!, createdAt: 0 };+ await expect(gone.poll(ctx)).resolves.toEqual({ state: "failed", error: RETIRED_PROVIDER_ERROR });+ await expect(gone.cancel!(ctx)).resolves.toBeUndefined();+ expect(RETIRED_PROVIDER_ERROR).toMatch(/run it again/);+ });++ it("closes the partner gaps on fal: Happy Horse 1.1 runs there", () => {+ const hh = getModel("happy-horse-1-1")!;+ expect(hh.routes.map((r) => [r.op, r.provider, r.endpoint])).toEqual([+ ["t2v", "fal", "alibaba/happy-horse/v1.1/text-to-video"],+ ["i2v", "fal", "alibaba/happy-horse/v1.1/image-to-video"],+ ["ref2v", "fal", "alibaba/happy-horse/v1.1/reference-to-video"],+ ]);+ expect(hh.pricing).toMatchObject({ unit: "second", usd: 0.14, byResolution: { "720p": 0.14, "1080p": 0.18 } });+ });+});++// ---------------------------------------------------------------------------+// What replaced each retired item++describe("REPLACED_BY", () => {+ /** Every model the deleted catalog had, and the AI Influencer sheet defined beside it. */+ const RETIRED = [+ "soul-1",+ "soul-2",+ "soul-cinema",+ "cinema-studio-4",+ "genjutsu-motion-transfer",+ "genjutsu-lite-motion-transfer",+ "genjutsu-object-swap",+ "genjutsu-lite-object-swap",+ "genjutsu-restyle",+ "marketing-studio-image",+ "ads-studio",+ "ai-influencer",+ ];++ it("covers every retired model, none of which is in the catalog any more", () => {+ expect(Object.keys(REPLACED_BY).sort()).toEqual([...RETIRED].sort());+ for (const id of RETIRED) expect(getModel(id), id).toBeUndefined();+ });++ it("points each at a model that exists and isn't retired; an Original runs on both engines", () => {+ for (const [id, r] of Object.entries(REPLACED_BY)) {+ const m = getModel(r.id);+ expect(m, `${id} → ${r.id}`).toBeDefined();+ expect(replacedBy(r.id), r.id).toBeUndefined();+ if (r.original) expect(enginesOf(m!).sort(), r.id).toEqual(["cloud", "open"]);+ else expect(enginesOf(m!), r.id).toContain("cloud");+ expect(r.note.length, id).toBeGreaterThan(10);+ }+ expect(currentModelId("soul-2")).toBe("fuobe-soul");+ expect(currentModelId("nano-banana-pro")).toBe("nano-banana-pro");+ });++ it("points the old Soul ID targets at a trainer Fuobe has", () => {+ for (const [id, r] of Object.entries(TRAINING_REPLACED_BY)) {+ expect(TRAINING_TARGETS.some((t) => t.id === id), id).toBe(false);+ expect(TRAINING_TARGETS.some((t) => t.id === r.id), r.id).toBe(true);+ }+ });++ it("moves a stored request to its replacement: a Soul style becomes its look, the retired API's settings go", () => {+ const style = Object.entries(SOUL_LEGACY_IDS).find(([, look]) => look === "v2-general")![0];+ const old = { feature: "image", modelId: "soul-2", prompt: "a rooftop party", params: { aspectRatio: "3:4", extra: { style_id: style, custom_reference_id: "ref-1", custom_reference_strength: 0.8, seed: 7 } } };+ const { request, note } = migrateRequest(old);+ expect(request).toEqual({ feature: "image", modelId: "fuobe-soul", engine: "cloud", presetId: "v2-general", prompt: "a rooftop party", params: { aspectRatio: "3:4", extra: { seed: 7 } } });+ expect(note).toMatch(/Fuobe Soul/);+ // An engine asked for stays; a partner replacement gets none.+ expect(migrateRequest({ ...old, engine: "open" as const }).request.engine).toBe("open");+ expect(migrateRequest({ modelId: "marketing-studio-image", params: { extra: { template_id: "t" } } }).request).toEqual({ modelId: "gpt-image-2-5", params: {} });+ // A current model's request comes back as it was.+ const current = { modelId: "nano-banana-pro", params: { extra: { style_id: "x" } } };+ expect(migrateRequest(current)).toEqual({ request: current });+ });+});++describe("stored ids resolve where they are read", () => {+ it("runs a generation asked for on a retired model on its replacement, and says so (Reuse, CLI, MCP)", async () => {+ const res = await generationsRoute.POST(+ new Request("http://x/api/generations?preview=1", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ feature: "image", modelId: "soul-2", prompt: "a fox" }) }),+ );+ const body = (await res.json()) as { modelId: string; engine: string; notes?: string[]; error?: string };+ expect(body.error).toBeUndefined();+ expect(body).toMatchObject({ modelId: "fuobe-soul", engine: "cloud" });+ expect(body.notes?.[0]).toMatch(/Fuobe Soul/);+ });++ it("moves a saved Canvas node on a retired model to its replacement, in the cloud", () => {+ const graph = {+ nodes: [+ { id: "a", type: "model" as const, position: { x: 0, y: 0 }, data: { modelId: "cinema-studio-4", mediaKind: "video" as const, params: { aspectRatio: "16:9", extra: { color_palette: "static-noon" } } } },+ { id: "b", type: "model" as const, position: { x: 0, y: 0 }, data: { modelId: "nano-banana-pro", mediaKind: "image" as const } },+ ],+ edges: [],+ };+ const moved = withCurrentModels(graph);+ expect(moved.nodes[0].data).toMatchObject({ modelId: "fuobe-cinema", engine: "cloud", params: { aspectRatio: "16:9" } });+ expect(moved.nodes[0].data.params?.extra).toBeUndefined();+ expect(moved.nodes[1]).toBe(graph.nodes[1]);+ // A board with nothing retired comes back as it was.+ expect(withCurrentModels(moved)).toBe(moved);+ });+});++// ---------------------------------------------------------------------------+// The one migration++describe("the O7 migration", () => {+ it("deletes the retired key, resets the provider choice and marks the ads drawn whole as baked", () => {+ const d = db();+ const last = (d.prepare("SELECT MAX(id) AS id FROM _migrations").get() as { id: number }).id;+ // An install from before: rows the migration rewrites, then the migration runs again on the next open.+ d.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES ('higgsfield.key', 'id:secret'), ('cloud.provider', 'higgsfield')").run();+ d.prepare("INSERT INTO ad_batches (id, brand_id, engine, route, model_id, created_at) VALUES ('b1', 'br', 'cloud', 'higgsfield', 'ads-studio', 1), ('b2', 'br', 'cloud', 'fuobe', 'nano-banana-pro', 2)").run();+ d.prepare(+ `INSERT INTO ad_creatives (id, batch_id, brand_id, position, status, meta_json, created_at, updated_at) VALUES+ ('c1', 'b1', 'br', 0, 'queued', '{"engine":"cloud","modelId":"ads-studio","route":"higgsfield","ratio":"9:16"}', 1, 1),+ ('c2', 'b2', 'br', 0, 'queued', '{"engine":"cloud","modelId":"nano-banana-pro","route":"fuobe"}', 2, 2),+ ('c3', 'b2', 'br', 1, 'failed', 'not json', 3, 3)`,+ ).run();+ d.prepare("DELETE FROM _migrations WHERE id = ?").run(last);+ d.close();+ globalThis.__fuobeDb = undefined;++ const again = db();+ expect(again.prepare("SELECT value FROM settings WHERE key = 'higgsfield.key'").get()).toBeUndefined();+ expect(getSetting("cloudProvider")).toBe("auto");+ expect(again.prepare("SELECT route FROM ad_batches ORDER BY id").all()).toEqual([{ route: "baked" }, { route: "fuobe" }]);+ const meta = (id: string) => (again.prepare("SELECT meta_json FROM ad_creatives WHERE id = ?").get(id) as { meta_json: string }).meta_json;+ expect(JSON.parse(meta("c1"))).toEqual({ engine: "cloud", modelId: "ads-studio", route: "baked", ratio: "9:16" });+ expect(JSON.parse(meta("c2")).route).toBe("fuobe");+ expect(meta("c3")).toBe("not json");+ });+});