Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: restore video Remix from the record, not a second URL field bundle (#6290)
[._.]/ Adam Eivy54f1988d536b
diff --git a/client/src/hooks/useMediaPreviewActions.js b/client/src/hooks/useMediaPreviewActions.jsindex d05aca41d7..7fa86bfbc4 100644--- a/client/src/hooks/useMediaPreviewActions.js+++ b/client/src/hooks/useMediaPreviewActions.js@@ -77,9 +77,24 @@ export default function useMediaPreviewActions({ onCleanComplete = null } = {})// params), videos go to /media/video (with video-shaped params — frames,// fps, tiling, etc.). Video remix lands the user in 'text' mode with all// params filled; they can switch to image/extend mode and pick a source.+ //+ // Videos hand over the RECORD ID (`?remix=<id>`), not a render-settings+ // bundle (#6290). A field-by-field URL is a second restore implementation+ // that has to be extended every time a render field is added, and it fell+ // behind the in-page one: `textEncoderId`, `speedProfileId`, `draftDecode`+ // and the LoRA arrays were all missing here, so remixing the same clip from+ // Media History silently returned those controls to stock while remixing it+ // from the Video Gen gallery restored them. The id lets /media/video resolve+ // the record from its own history load and reuse `applyRemix` — the single+ // restore implementation. The field bundle below stays for records with no+ // id (and keeps previously-issued links working), but is not extended.const handleRemix = useCallback((item) => {if (!item) return;if (item.kind === 'video') {+ if (item.id != null && item.id !== '') {+ navigate(`/media/video?remix=${encodeURIComponent(item.id)}`);+ return;+ }const params = new URLSearchParams();if (item.prompt && item.prompt !== '(no prompt)') params.set('prompt', item.prompt);if (item.negativePrompt) params.set('negativePrompt', item.negativePrompt);diff --git a/client/src/hooks/useMediaPreviewActions.test.jsx b/client/src/hooks/useMediaPreviewActions.test.jsxindex 49b939ba11..a41716aba2 100644--- a/client/src/hooks/useMediaPreviewActions.test.jsx+++ b/client/src/hooks/useMediaPreviewActions.test.jsx@@ -22,10 +22,17 @@ const parseNav = () => {describe('useMediaPreviewActions.handleRemix', () => {beforeEach(() => navigate.mockReset());- it('sends a video back to /media/video with prompt and render settings', () => {+ // #6290: a saved video hands over its RECORD ID, not a render-settings+ // bundle. The bundle was a second restore implementation that had to be+ // extended for every new render field and wasn't — it silently dropped the+ // conditioner, speed profile, draft decode and LoRAs — so the same clip came+ // back with different settings from History than from the Video Gen gallery.+ // Enumerating fields here again would re-open exactly that drift.+ it('sends a saved video back to /media/video by record id, with no settings bundle', () => {const { result } = renderHook(() => useMediaPreviewActions());result.current.handleRemix({kind: 'video',+ id: 'vid-1',prompt: 'a fox in rain',negativePrompt: 'blurry',modelId: 'ltx2-dev',@@ -37,6 +44,35 @@ describe('useMediaPreviewActions.handleRemix', () => {});const { path, params } = parseNav();expect(path).toBe('/media/video');+ expect(params.get('remix')).toBe('vid-1');+ expect([...params.keys()]).toEqual(['remix']);+ });++ it('percent-encodes a record id so an id with URL punctuation survives the handoff', () => {+ const { result } = renderHook(() => useMediaPreviewActions());+ result.current.handleRemix({ kind: 'video', id: 'vid 1&x=2' });+ const { params } = parseNav();+ expect(params.get('remix')).toBe('vid 1&x=2');+ });++ // Records that never got an id (and links already out in the wild) keep the+ // legacy field bundle. It is deliberately not extended with new fields.+ it('falls back to the legacy field bundle for a video with no record id', () => {+ const { result } = renderHook(() => useMediaPreviewActions());+ result.current.handleRemix({+ kind: 'video',+ prompt: 'a fox in rain',+ negativePrompt: 'blurry',+ modelId: 'ltx2-dev',+ width: 768,+ height: 512,+ numFrames: 121,+ fps: 24,+ raw: { seed: 42, steps: 8, guidanceScale: 3, tiling: 'none', disableAudio: true },+ });+ const { path, params } = parseNav();+ expect(path).toBe('/media/video');+ expect(params.get('remix')).toBeNull();expect(params.get('prompt')).toBe('a fox in rain');expect(params.get('negativePrompt')).toBe('blurry');expect(params.get('modelId')).toBe('ltx2-dev');@@ -51,7 +87,7 @@ describe('useMediaPreviewActions.handleRemix', () => {expect(params.get('disableAudio')).toBe('1');});- it('skips the (no prompt) placeholder so a remixed clip does not seed that literal', () => {+ it('skips the (no prompt) placeholder so an id-less remixed clip does not seed that literal', () => {const { result } = renderHook(() => useMediaPreviewActions());result.current.handleRemix({ kind: 'video', prompt: '(no prompt)', width: 512, height: 512 });const { params } = parseNav();diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex 89fda02907..964953c1c4 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -336,9 +336,17 @@ export default function VideoGen() {// after `previewItems` below so the resolver can match against it.const [showHidden, setShowHidden] = useState(false);- const refreshHistory = useCallback(() => {- listVideoHistory().then((items) => setHistory(Array.isArray(items) ? items : [])).catch(() => {});- }, []);+ // 'loading' until the first fetch settles, then 'loaded' or 'error'. A+ // sentinel rather than `history.length` — the Remix handoff below has to tell+ // "history is still in flight / failed to load" apart from "history loaded+ // and has no such record", and an empty array is a legitimate loaded state.+ const [historyLoad, setHistoryLoad] = useState('loading');+ const refreshHistory = useCallback(() => listVideoHistory()+ .then((items) => {+ setHistory(Array.isArray(items) ? items : []);+ setHistoryLoad('loaded');+ })+ .catch(() => setHistoryLoad('error')), []);useMediaCompletionRefresh({ onVideoCompleted: refreshHistory });useEffect(() => { refreshHistory(); }, [refreshHistory]);@@ -423,6 +431,65 @@ export default function VideoGen() {window.scrollTo({ top: 0, behavior: 'smooth' });}, [applyRemix]);+ // Cross-page Remix (#6290). Media History (and every other MediaPreview+ // surface) hands this page a RECORD ID rather than a render-settings bundle,+ // so the restore runs through the same `applyRemix` the in-page gallery uses+ // — one implementation that knows every field the record carries, instead of+ // a URL enumeration that silently dropped the encoder, speed profile, draft+ // decode and LoRAs. `history` is the unfiltered load, so a hidden record+ // resolves too.+ //+ // The ref (not the stripped param) is what makes this one-shot: the strip is+ // an async router update, so a completion refresh landing in the same tick+ // would otherwise re-apply the handoff over edits the user has since made.+ const remixHandoffId = searchParams.get('remix');+ const remixHandoffAppliedRef = useRef(false);+ // null while nothing is wrong; otherwise 'error' (the history fetch failed,+ // retryable) or 'missing' (history loaded and holds no such record).+ const [remixHandoffProblem, setRemixHandoffProblem] = useState(null);+ const consumeRemixHandoff = useCallback(() => {+ setSearchParams((prev) => {+ const next = new URLSearchParams(prev);+ next.delete('remix');+ return next;+ }, { replace: true });+ }, [setSearchParams]);+ useEffect(() => {+ if (!remixHandoffId || remixHandoffAppliedRef.current) return;+ // Still fetching: say nothing. Reporting "no such record" here would be a+ // lie every time the page is opened faster than the history round trip.+ if (historyLoad === 'loading') return;+ if (historyLoad === 'error') {+ // Keep the param so Retry can resolve it once the fetch succeeds, and+ // leave the ref unset so the retry actually re-runs this effect.+ setRemixHandoffProblem('error');+ return;+ }+ const record = history.find((v) => String(v.id) === remixHandoffId);+ remixHandoffAppliedRef.current = true;+ if (record) {+ applyRemix(record);+ setRemixHandoffProblem(null);+ } else {+ setRemixHandoffProblem('missing');+ }+ consumeRemixHandoff();+ }, [remixHandoffId, historyLoad, history, applyRemix, consumeRemixHandoff]);+ // Back to 'loading' first, so a retry that fails again still moves the state+ // ('loading' → 'error') and re-runs the effect above. Re-setting 'error' onto+ // 'error' is a no-op React bails on, which would leave the banner dismissed+ // after a second failure.+ const retryRemixHandoff = useCallback(() => {+ setHistoryLoad('loading');+ setRemixHandoffProblem(null);+ refreshHistory();+ }, [refreshHistory]);+ const dismissRemixHandoff = useCallback(() => {+ remixHandoffAppliedRef.current = true;+ setRemixHandoffProblem(null);+ consumeRemixHandoff();+ }, [consumeRemixHandoff]);+// Finish a draft (#3696): same restore as Remix, but switched to the delivery// model the draft's registry entry declares. Prefill only — the user presses// Generate themselves.@@ -1041,6 +1108,42 @@ export default function VideoGen() {<form onSubmit={handleGenerate} className="grid grid-cols-1 lg:grid-cols-[3fr_2fr] gap-4"><div className="bg-port-card border border-port-border rounded-xl p-4 space-y-3">+ {/* A cross-page Remix that could not be restored (#6290). Silence+ would be the worst outcome here: the user pressed Remix, landed on+ a form holding whatever it held before, and would start a render+ with the wrong settings believing they were the clip's. */}+ {remixHandoffProblem && (+ <div+ role="status"+ className="rounded-lg border border-port-warning/40 bg-port-warning/10 px-3 py-3 text-xs text-port-warning flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2"+ >+ <div>+ {remixHandoffProblem === 'error'+ ? "Couldn't load your render history, so this clip's settings weren't restored."+ : 'That render is no longer in your history, so its settings could not be restored.'}+ {' '}The form still holds its previous values.+ </div>+ <div className="flex items-center gap-2 self-start sm:self-auto">+ {remixHandoffProblem === 'error' && (+ <button+ type="button"+ onClick={retryRemixHandoff}+ className="whitespace-nowrap inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-port-accent text-white text-xs font-medium hover:bg-port-accent/80"+ >+ <RefreshCw className="w-3.5 h-3.5" />+ Retry+ </button>+ )}+ <button+ type="button"+ onClick={dismissRemixHandoff}+ className="text-gray-400 hover:text-gray-200 text-xs"+ >+ Dismiss+ </button>+ </div>+ </div>+ )}{!isGrok && !isFal && !isReactor && byovRuntimeMissing && (<div className="rounded-lg border border-port-warning/40 bg-port-warning/10 px-3 py-3 text-xs text-port-warning flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2"><div>diff --git a/client/src/pages/VideoGen.remix.test.jsx b/client/src/pages/VideoGen.remix.test.jsxnew file mode 100644index 0000000000..efbdbb881a--- /dev/null+++ b/client/src/pages/VideoGen.remix.test.jsx@@ -0,0 +1,217 @@+import { beforeEach, describe, expect, it } from 'vitest';+import { act, cleanup, fireEvent, screen, waitFor } from '@testing-library/react';++import {+ loadVideoGenPage,+ renderVideoGenPage,+ resetVideoGenMockState,+ state,+ videoGenModel,+ videoGenModelContext,+ videoGenStatus,+} from '../test/videoGenPageMocks.jsx';++/**+ * Cross-page Remix restores exactly what in-page Remix restores (#6290).+ *+ * Media History used to hand /media/video a field-by-field URL bundle built by+ * `useMediaPreviewActions`, a second restore implementation that fell behind the+ * page's own `applyRemix`: the conditioner, speed profile, draft decode and the+ * LoRA arrays were all missing from it, so the same saved clip came back with+ * stock/Quality/Full/no-LoRA settings from History and with its real settings+ * from the gallery — a different render at a different compute cost. The handoff+ * is now the RECORD ID, resolved here against the page's own history load and+ * replayed through the one restore implementation.+ */+const MODEL = videoGenModel('example-ltx', {+ name: 'Example LTX',+ runtime: 'ltx2',+ supportedModes: ['text', 'image'],+ defaultFrames: 121,+ frameOptions: [121, 241],+ fpsOptions: [24],+ samplerLocked: false,+ supportsNegativePrompt: true,+ supportsTiling: true,+ supportsDisableAudio: true,+ textEncoderOptions: [+ { id: 'stock', label: 'Stock conditioner', builtIn: true },+ { id: 'example-substitute', label: 'Example substitute' },+ ],+ speedProfiles: [{ id: 'turbo', label: 'Turbo', steps: 4, guidance: 1 }],+ draftDecodeOptions: [{ id: 'example-draft', label: 'Example draft decoder' }],+});++const LORA = { filename: 'lora-example.safetensors', name: 'Example LoRA', loraCompatKey: 'ltx-video' };++/**+ * A saved render carrying every field the old URL bundle dropped. `hidden` is+ * deliberate: History can open a hidden record, so the lookup has to run against+ * the unfiltered load rather than the gallery's visible slice.+ */+const RECORD = {+ id: 'vid-example-1',+ filename: 'example.mp4',+ prompt: 'a paper boat on a canal',+ negativePrompt: 'blurry',+ modelId: MODEL.id,+ width: 768,+ height: 512,+ numFrames: 121,+ fps: 24,+ seed: 42,+ steps: 12,+ guidanceScale: 3,+ tiling: 'none',+ disableAudio: true,+ textEncoderId: 'example-substitute',+ speedProfileId: 'turbo',+ draftDecode: 'example-draft',+ loraFilenames: [LORA.filename],+ loraScales: [0.7],+ chainedFrom: ['vid-example-a', 'vid-example-b'],+ chunkPrompts: ['the boat launches', 'the boat sinks'],+ hidden: true,+};++/** A record from before the optional render fields existed. */+const LEGACY_RECORD = {+ id: 'vid-legacy-1',+ filename: 'legacy.mp4',+ prompt: 'a kite over a field',+ modelId: MODEL.id,+ width: 768,+ height: 512,+ numFrames: 121,+ fps: 24,+};++await loadVideoGenPage();++/**+ * Everything the restore is responsible for, read off the live form: the+ * controls the page renders itself, plus the sampler/LoRA props it hands the+ * panels. One reading, so the two entry paths are compared on identical terms.+ */+const readRestoredForm = () => ({+ prompt: screen.getByLabelText('Prompt').value,+ negativePrompt: screen.getByLabelText('Negative Prompt').value,+ modelId: screen.getByLabelText('Model').value,+ textEncoderId: screen.getByLabelText('Text encoder').value,+ loras: (state.loraPicker?.selected || []).map((l) => `${l.filename}@${l.scale}`),+ numFrames: state.advancedParams?.numFrames,+ fps: state.advancedParams?.fps,+ seed: state.advancedParams?.seed,+ steps: state.advancedParams?.steps,+ guidanceScale: state.advancedParams?.guidanceScale,+ speedProfileId: state.advancedParams?.speedProfileId,+ draftDecode: state.advancedParams?.draftDecode,+ tiling: state.advancedParams?.tiling,+ disableAudio: state.advancedParams?.disableAudio,+ chunks: state.advancedParams?.chunks,+ chunkPrompts: state.advancedParams?.chunkPrompts,+});++describe('VideoGen cross-page Remix handoff', () => {+ beforeEach(() => {+ localStorage.clear();+ sessionStorage.clear();+ resetVideoGenMockState();+ state.getVideoGenStatus.mockResolvedValue(videoGenStatus([MODEL]));+ state.getVideoGenModelContext.mockResolvedValue(videoGenModelContext([MODEL]));+ state.attach.mockResolvedValue({ filename: 'example.mp4' });+ state.availableLoras = [LORA];+ state.listVideoHistory.mockResolvedValue([RECORD, LEGACY_RECORD]);+ });++ it('restores the same settings from a History handoff as from the in-page gallery', async () => {+ await renderVideoGenPage(`/media/video?remix=${RECORD.id}`);+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));+ const fromHistory = readRestoredForm();++ // The exact fields the old URL bundle dropped. Asserted by name as well as+ // by the equality below, so a regression that broke BOTH paths together+ // still fails this test rather than comparing two blank forms.+ expect(fromHistory.textEncoderId).toBe('example-substitute');+ expect(fromHistory.speedProfileId).toBe('turbo');+ expect(fromHistory.draftDecode).toBe('example-draft');+ expect(fromHistory.loras).toEqual(['[email protected]']);+ expect(fromHistory.chunks).toBe(2);+ expect(fromHistory.chunkPrompts).toEqual(RECORD.chunkPrompts);++ cleanup();+ await renderVideoGenPage();+ await act(async () => { state.galleryProps.onRemix(RECORD); });+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));++ expect(readRestoredForm()).toEqual(fromHistory);+ });++ it('resets the optional controls to their sentinels for a legacy record', async () => {+ await renderVideoGenPage(`/media/video?remix=${LEGACY_RECORD.id}`);+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(LEGACY_RECORD.prompt));++ const restored = readRestoredForm();+ expect(restored.textEncoderId).toBe('stock');+ expect(restored.speedProfileId).toBe('quality');+ expect(restored.draftDecode).toBe('full');+ expect(restored.loras).toEqual([]);+ expect(restored.steps).toBe('');+ expect(restored.guidanceScale).toBe('');+ expect(restored.chunks).toBe(1);+ });++ it('says nothing about a missing record while the history fetch is still in flight', async () => {+ let settleHistory;+ state.listVideoHistory.mockReturnValue(new Promise((resolve) => { settleHistory = resolve; }));+ await renderVideoGenPage(`/media/video?remix=${RECORD.id}`);++ // The pending fetch is not evidence of anything — claiming the record is+ // gone here would fire on every load that beats the round trip.+ expect(screen.queryByText(/no longer in your history/)).toBeNull();+ expect(screen.queryByText(/Couldn't load your render history/)).toBeNull();++ await act(async () => { settleHistory([RECORD]); });+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));+ expect(screen.queryByText(/no longer in your history/)).toBeNull();+ });++ it('offers a retry when the history fetch fails, and restores once it succeeds', async () => {+ state.listVideoHistory.mockRejectedValueOnce(new Error('offline'));+ await renderVideoGenPage(`/media/video?remix=${RECORD.id}`);++ // A failed fetch is not a missing record — the settings may be perfectly+ // intact on disk, so the notice has to be the retryable one.+ await screen.findByText(/Couldn't load your render history/);+ expect(screen.queryByText(/no longer in your history/)).toBeNull();++ state.listVideoHistory.mockResolvedValue([RECORD]);+ await act(async () => { fireEvent.click(screen.getByRole('button', { name: 'Retry' })); });++ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));+ expect(screen.queryByText(/Couldn't load your render history/)).toBeNull();+ });++ it('reports an actionable missing-record state when the load holds no such record', async () => {+ state.listVideoHistory.mockResolvedValue([LEGACY_RECORD]);+ await renderVideoGenPage('/media/video?remix=vid-deleted');++ await screen.findByText(/no longer in your history/);+ expect(screen.queryByRole('button', { name: 'Retry' })).toBeNull();++ await act(async () => { fireEvent.click(screen.getByRole('button', { name: 'Dismiss' })); });+ expect(screen.queryByText(/no longer in your history/)).toBeNull();+ });++ it('does not replay the consumed handoff over the edits that follow it', async () => {+ await renderVideoGenPage(`/media/video?remix=${RECORD.id}`);+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));++ fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: 'a paper boat at dusk' } });+ // The completion refresh re-fetches history — the handoff must not ride+ // along with it and overwrite what the user has typed since.+ await act(async () => { await state.completionRefresh.onVideoCompleted(); });++ expect(screen.getByLabelText('Prompt')).toHaveValue('a paper boat at dusk');+ });+});diff --git a/client/src/test/videoGenPageMocks.jsx b/client/src/test/videoGenPageMocks.jsxindex cf09048e3d..b178de87ec 100644--- a/client/src/test/videoGenPageMocks.jsx+++ b/client/src/test/videoGenPageMocks.jsx@@ -1,12 +1,12 @@/*** Shared mock scaffold for the VideoGen page suites.*- * Five suites (`pages/VideoGen.terms`, `.federatedTarget`, `.composeWhileBusy`,- * `.textEncoderAutoDownload`, `.modelLoading`) each used to carry a near-verbatim- * ~140-line copy of the same 25 `vi.mock` registrations, the same `state` object,- * the same model fixture and the same `renderPage()` helper. Every endpoint or- * hook the page started calling had to be added in five places, or four suites- * broke at once.+ * Six suites (`pages/VideoGen.terms`, `.federatedTarget`, `.composeWhileBusy`,+ * `.textEncoderAutoDownload`, `.modelLoading`, `.remix`) each used to carry a+ * near-verbatim ~140-line copy of the same 25 `vi.mock` registrations, the same+ * `state` object, the same model fixture and the same `renderPage()` helper.+ * Every endpoint or hook the page started calling had to be added in five+ * places, or four suites broke at once.** **Importing this module registers the mocks** — that is the whole point, and it* is what the vitest hoisting rules allow. `vi.mock` is hoisted to the top of the@@ -34,7 +34,7 @@ const DEFAULT_UNIVERSE_STYLE = {};/**- * Every knob the five suites vary. Mutated in `beforeEach`; read lazily by the+ * Every knob the suites vary. Mutated in `beforeEach`; read lazily by the* mock factories below, so a reassignment takes effect on the next render.*/export const state = {@@ -64,9 +64,25 @@ export const state = {/** `RuntimeInstallModal`'s `onComplete`, captured so a suite can fire it. */runtimeInstallComplete: null,universeStyle: DEFAULT_UNIVERSE_STYLE,+ /** `GET /api/video-gen/history`; a spy so a suite can defer it, reject it, or seed records. */+ listVideoHistory: vi.fn(),+ /**+ * Last props handed to the panels below, captured by mocks that still render+ * NOTHING — the five older suites assert over the DOM, so a probe element+ * here would change what they see. The Remix suite reads the restored+ * sampler/LoRA values and drives the in-page Remix through+ * `galleryProps.onRemix`, which is the page's real gallery handler.+ */+ advancedParams: null,+ loraPicker: null,+ galleryProps: null,+ /** `useMediaCompletionRefresh`'s options, so a suite can fire a completion refresh. */+ completionRefresh: null,+ /** `listLorasFull` — the installed library the LoRA picker resolves names against. */+ availableLoras: [],};-const SPIES = ['getVideoGenStatus', 'getVideoGenModelContext', 'generateVideo', 'attach', 'start', 'startWhenIdle', 'repair', 'cancel', 'refresh'];+const SPIES = ['getVideoGenStatus', 'getVideoGenModelContext', 'generateVideo', 'attach', 'start', 'startWhenIdle', 'repair', 'cancel', 'refresh', 'listVideoHistory'];/** Restore every documented default, including fresh spies. Call it first in `beforeEach`. */export function resetVideoGenMockState() {@@ -78,7 +94,13 @@ export function resetVideoGenMockState() {state.runtimeInstallComplete = null;state.universeStyle = DEFAULT_UNIVERSE_STYLE;state.eventSourceRef.current = null;+ state.advancedParams = null;+ state.loraPicker = null;+ state.galleryProps = null;+ state.completionRefresh = null;+ state.availableLoras = [];for (const key of SPIES) state[key].mockReset();+ state.listVideoHistory.mockResolvedValue([]);}/** A video model as `GET /api/video-gen/status` reports it. */@@ -143,7 +165,7 @@ vi.mock('../services/api', () => ({getVideoGenModelContext: (...args) => state.getVideoGenModelContext(...args),generateVideo: (...args) => state.generateVideo(...args),cancelVideoGen: vi.fn(async () => ({})),- listVideoHistory: vi.fn(async () => []),+ listVideoHistory: (...args) => state.listVideoHistory(...args),deleteVideoHistoryItem: vi.fn(async () => ({})),setVideoHidden: vi.fn(async () => ({})),extractLastFrame: vi.fn(async () => ({})),@@ -153,7 +175,7 @@ vi.mock('../services/api', () => ({getActiveVideoJob: vi.fn(async () => ({ activeJob: state.activeJob })),getSettings: vi.fn(async () => ({ imageGen: { grok: { enabled: false } } })),getVideoGenRuntimeStatus: vi.fn(async () => ({ installed: true, ready: true, current: true })),- listLorasFull: vi.fn(async () => []),+ listLorasFull: vi.fn(async () => state.availableLoras),// The prompt-enhancement controls mount useProviderModels, which fetches the// provider list from a mount effect. Unmocked it throws out of a passive// effect — the tests still pass, but the unhandled rejection fails the run.@@ -186,7 +208,9 @@ vi.mock('../hooks/useModelDownloadStatus', () => ({vi.mock('../hooks/useMediaJobSse', () => ({useMediaJobSse: () => ({ attach: state.attach, eventSourceRef: state.eventSourceRef }),}));-vi.mock('../hooks/useMediaCompletionRefresh', () => ({ useMediaCompletionRefresh: vi.fn() }));+vi.mock('../hooks/useMediaCompletionRefresh', () => ({+ useMediaCompletionRefresh: (options) => { state.completionRefresh = options; },+}));vi.mock('../hooks/useMediaAnnotations', () => ({useMediaAnnotations: () => ({ annotations: {}, updateAnnotation: vi.fn(), getCardProps: vi.fn(() => ({})) }),}));@@ -232,13 +256,19 @@ vi.mock('../components/videoGen/KeyframePanel', () => ({ default: () => null }))vi.mock('../components/videoGen/AudioPanel', () => ({ default: () => null }));vi.mock('../components/videoGen/ExtendPanel', () => ({ default: () => null }));vi.mock('../components/videoGen/IcLoraPanel', () => ({ default: () => null }));-vi.mock('../components/videoGen/AdvancedParamsPanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/AdvancedParamsPanel', () => ({+ default: (props) => { state.advancedParams = props; return null; },+}));vi.mock('../components/videoGen/RuntimeFingerprint', () => ({ default: () => null }));-vi.mock('../components/videoGen/VideoGenGallery', () => ({ default: () => null }));+vi.mock('../components/videoGen/VideoGenGallery', () => ({+ default: (props) => { state.galleryProps = props; return null; },+}));vi.mock('../components/media/MediaPreview', () => ({ default: () => null }));vi.mock('../components/media/StylePresetPicker', () => ({ default: () => null }));vi.mock('../components/media/MediaJobsQueue', () => ({ default: () => null }));-vi.mock('../components/imageGen/LoraPicker', () => ({ default: () => null }));+vi.mock('../components/imageGen/LoraPicker', () => ({+ default: (props) => { state.loraPicker = props; return null; },+}));vi.mock('../components/media/ResolutionField', () => ({ default: () => null }));let VideoGen = null;@@ -253,13 +283,16 @@ export async function loadVideoGenPage() {return VideoGen;}-/** Mount the page on its own route, flushing the mount effects. */-export async function renderVideoGenPage() {+/**+ * Mount the page on its own route, flushing the mount effects. `entry` overrides+ * the location so a suite can exercise a URL handoff (`/media/video?remix=<id>`).+ */+export async function renderVideoGenPage(entry = '/media/video') {if (!VideoGen) throw new Error('await loadVideoGenPage() at module scope before rendering');let view;await act(async () => {view = render(- <MemoryRouter initialEntries={['/media/video']}>+ <MemoryRouter initialEntries={[entry]}><VideoGen /></MemoryRouter>,);