Skip to content

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

refactor: unify video asset readiness and repair warnings (#6681)

[._.]/ Adam Eivy9e73718ab999
diff --git a/client/src/hooks/README.md b/client/src/hooks/README.md
index c8129717e5..f8209eab32 100644
--- a/client/src/hooks/README.md
+++ b/client/src/hooks/README.md
@@ -42,7 +42,7 @@ grep -i "what you want to do" client/src/hooks/README.md
| `useSseProgress` | Generic JSON-frame EventSource subscriber. | New SSE progress stream — start here, build on top. |
| `useSseJobSlot` | Generic single-slot SSE job: `pending`/`job` state, terminal-frame handling (`complete`/`error`/`canceled`), and `sse.closed`-without-terminal-frame recovery in one place. Returns `{ active, percent, stage, context, start, cancel }`; pass `startRequest`/`eventsUrl`/`cancelRequest` + per-feature toast copy. | Any "kick off a job → stream SSE → settle on terminal frame" hook. The reference-audio/YouTube/video-download/MIDI hooks all wrap this — don't re-roll the terminal-frame + lost-connection dance. |
| `useInstallStream` | BYO-runtime install-log stream lifecycle: `stage`/`log`/`complete`/`error` frame dispatch, capped + optionally-debounced log accumulation, "connection lost" handling, ref-stashed `onComplete`, auto-scroll. `method: 'GET'` uses EventSource; `method: 'POST'` reads one fetch stream for a non-idempotent install. | A streamed install/setup modal that shows live SSE log lines (FLUX.2, video runtimes, OpenCode). Don't re-roll the teardown/onComplete-ref dance. |
-| `useModelDownloadStatus` | Image/video model cache-status + SSE pre-download. `start(id)` commands a pull; `startWhenIdle(id)` requests one — it waits for the cache verdict, skips an already-resident repo, and queues behind whatever owns the single EventSource lane (`queuedModelId` while it waits, falsy id to retract). | Surfacing "Available" vs "Download" badge inline in the gen form; `startWhenIdle` for a picker where choosing an option IS the request for its weights. |
+| `useModelDownloadStatus` | Image/video model cache-status + SSE pre-download. `useDownloadableAssets(descriptors, options)` shares readiness and independent integrity dismissals across asset roles. `start(id)` commands a pull; `startWhenIdle(id)` requests one — it waits for the cache verdict, skips an already-resident repo, and queues behind whatever owns the single EventSource lane (`queuedModelId` while it waits, falsy id to retract). | Surfacing "Available" vs "Download" badge inline in the gen form; `startWhenIdle` for a picker where choosing an option IS the request for its weights. |
| `useAgyModels` | Live `agy models` probe (the AGENT models `--model` accepts) with `models`/`error`/`loading`/`refresh`; opt-in via an `enabled` flag so it never spawns for a disabled backend. | Any Agy model picker — the Settings default or the per-render override. Don't hardcode a model list: agy exits non-zero on an id outside this catalog. |
| `useSpritePendingRenders` | Sprite-workflow in-flight render map: queue rehydrate + 4s poll keyed by a media-job tag field, `'submitting'` double-render guard, 404-only drop, deferred `onChanged` sweeps. | A sprite workflow tracking `queued/running` media jobs by tag (reference renders, walk videos, phase-4 publish) — don't re-roll the rehydrate/poll dance. |
| `useSpriteRecordCrud` | Rename/delete state machine for one sprite record: `view`/`rename`/`confirm` mode, name draft, busy/inline-error, silent PATCH/DELETE. | A surface that renames or deletes a sprite record (the Library catalog card, the detail header) — share this so both stay in lock-step. |
diff --git a/client/src/hooks/useModelDownloadStatus.js b/client/src/hooks/useModelDownloadStatus.js
index 6d0e922501..0a9461fd95 100644
--- a/client/src/hooks/useModelDownloadStatus.js
+++ b/client/src/hooks/useModelDownloadStatus.js
@@ -295,3 +295,30 @@ export function useModelDownloadStatus({ kind = 'image' } = {}) {
downloading: !!activeModelId,
};
}
+
+// Preserve the cache-status contract: null is unknown; an explicit cached:false
+// requires a download. Older payloads that omit cached retain their behavior.
+const weightsNotReady = (status, loading) => loading || status === null || status?.cached === false;
+
+// One dismissal slot per asset role, with the selected download + bad-file names
+// in its key. Switching selections or discovering different damage re-shows the
+// warning. Integrity remains visible independently of readiness applicability,
+// so a damaged shared cache can still be repaired from this surface.
+export function useDownloadableAssets(descriptors, { loading = false, downloading = false, enabled = true } = {}) {
+ const [dismissedKeys, setDismissedKeys] = useState({});
+ return descriptors.map((asset) => {
+ const integrity = asset.status && !asset.status.downloading ? asset.status.integrity : null;
+ const integrityBad = integrity?.status === 'bad';
+ const badFiles = integrity?.badFiles || [];
+ const integrityKey = integrityBad ? `${asset.keyPrefix}:${badFiles.map(file => file.name).join(',')}` : null;
+ return {
+ ...asset,
+ blocked: enabled && asset.applies && (asset.extraBlocked || weightsNotReady(asset.status, loading)),
+ missingWeights: weightsNotReady(asset.status, false),
+ integrityBadCount: integrityBad ? badFiles.length : 0,
+ integrityKey,
+ showBanner: integrityBad && dismissedKeys[asset.key] !== integrityKey && !downloading,
+ dismiss: () => setDismissedKeys(previous => ({ ...previous, [asset.key]: integrityKey })),
+ };
+ });
+}
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 6afee026a3..55bf125347 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -73,7 +73,7 @@ import ModelSelect from '../components/ModelSelect';
import { FormField } from '../components/ui/FormField';
import AutoSizeTextarea from '../components/ui/AutoSizeTextarea';
import ModelDownloadBadge, { deriveSizeEstimate } from '../components/media/ModelDownloadBadge';
-import { useModelDownloadStatus, TEXT_ENCODER_DOWNLOAD_ID, textEncoderDownloadId } from '../hooks/useModelDownloadStatus';
+import { useDownloadableAssets, useModelDownloadStatus, TEXT_ENCODER_DOWNLOAD_ID, textEncoderDownloadId } from '../hooks/useModelDownloadStatus';
import TextEncoderPicker from '../components/videoGen/TextEncoderPicker';
import { useMediaJobSse } from '../hooks/useMediaJobSse';
import { useMediaCompletionRefresh } from '../hooks/useMediaCompletionRefresh';
@@ -788,78 +788,38 @@ export default function VideoGen() {
startEncoderWhenIdle(option && !option.builtIn ? textEncoderDownloadId(id) : null);
}, [setTextEncoderId, textEncoderOptions, startEncoderWhenIdle]);
const icWeightStatus = icSpec ? modelDownload.getStatus(icSpec.mode) : null;
- const modelWeightsBlocked = !rendersOffMachine
- && (statusLoading || !modelId || !currentModel || modelDownload.loading
- || modelStatus === null || modelStatus?.cached === false);
- const textEncoderWeightsBlocked = !rendersOffMachine && usesSharedTextEncoder
- && (modelDownload.loading || textEncoderStatus === null || textEncoderStatus?.cached === false);
- const icWeightsBlocked = !rendersOffMachine && icModeActive
- && (modelDownload.loading || icWeightStatus === null || icWeightStatus?.cached === false);
- const textEncoderOptionBlocked = !rendersOffMachine && !!textEncoderOptionDownloadId
- && (modelDownload.loading || textEncoderOptionStatus === null || textEncoderOptionStatus?.cached === false);
- const weightsGateBlocked = modelWeightsBlocked || textEncoderWeightsBlocked
- || textEncoderOptionBlocked || icWeightsBlocked;
- const activeWeightErrorIds = [
- modelId,
- usesSharedTextEncoder ? TEXT_ENCODER_DOWNLOAD_ID : null,
- textEncoderOptionDownloadId,
- icModeActive ? icSpec?.mode : null,
- ].filter(Boolean);
+ const assets = useDownloadableAssets([
+ {
+ key: 'model', id: modelId, label: 'selected model weights',
+ applies: true, extraBlocked: statusLoading || !modelId || !currentModel,
+ status: modelStatus, keyPrefix: modelId,
+ name: currentModel?.name || modelId, repairLabel: 'Repair model',
+ },
+ {
+ key: 'shared-encoder', id: TEXT_ENCODER_DOWNLOAD_ID, label: 'shared text encoder',
+ applies: usesSharedTextEncoder, status: textEncoderStatus, keyPrefix: 'text-encoder',
+ name: `The shared text encoder (${textEncoderStatus?.repo})`, repairLabel: 'Repair encoder',
+ },
+ {
+ key: 'encoder-option', id: textEncoderOptionDownloadId,
+ label: `${selectedTextEncoder?.label || 'selected'} text encoder`,
+ applies: !!textEncoderOptionDownloadId, status: textEncoderOptionStatus, keyPrefix: textEncoderOptionDownloadId,
+ name: `The ${selectedTextEncoder?.label} text encoder`, repairLabel: 'Repair text encoder',
+ },
+ {
+ key: 'ic-lora', id: icSpec?.mode, label: `${icSpec?.label || 'IC-LoRA'} weight`,
+ applies: icModeActive, status: icWeightStatus, keyPrefix: icSpec?.mode,
+ name: `The ${icSpec?.label || 'IC-LoRA'} weight`, repairLabel: `Repair ${icSpec?.label || 'IC-LoRA'}`,
+ },
+ ], { loading: modelDownload.loading, downloading: modelDownload.downloading, enabled: !rendersOffMachine });
+ const sharedEncoderAsset = assets.find(asset => asset.key === 'shared-encoder');
+ const blockedAsset = assets.find(asset => asset.blocked);
+ const weightsGateBlocked = !!blockedAsset;
+ const activeWeightErrorIds = assets.filter(asset => asset.applies).map(asset => asset.id).filter(Boolean);
const activeWeightError = activeWeightErrorIds.includes(modelDownload.lastError?.modelId)
? modelDownload.lastError
: null;
- // Weight-integrity (issue #1324). A corrupt/truncated model decodes to
- // garbled "mosaic" video that a clean re-download fixes; surface a Repair
- // banner keyed on the cheap structural check the status poll already ran so
- // the user can delete + re-fetch the bad files instead of debugging a render.
- const modelIntegrity = modelStatus && !modelStatus.downloading ? modelStatus.integrity : null;
- const integrityBad = modelIntegrity?.status === 'bad';
- const integrityBadCount = integrityBad ? (modelIntegrity.badFiles || []).length : 0;
- const integrityKey = integrityBad ? `${modelId}:${(modelIntegrity.badFiles || []).map((f) => f.name).join(',')}` : null;
- const [dismissedIntegrityKey, setDismissedIntegrityKey] = useState(null);
- const showIntegrityBanner = integrityBad && dismissedIntegrityKey !== integrityKey && !modelDownload.downloading;
-
- // Text-encoder integrity. The shared Gemma encoder is a separate HF repo, so a
- // corrupt encoder needs its own Repair banner — the model-keyed repair above
- // can't reach it (it isn't a listVideoModels() entry). Local-path encoders
- // report `integrity: null`, so this only fires for a damaged HF-cached encoder.
- const encoderIntegrity = textEncoderStatus && !textEncoderStatus.downloading ? textEncoderStatus.integrity : null;
- const encoderIntegrityBad = encoderIntegrity?.status === 'bad';
- const encoderIntegrityBadCount = encoderIntegrityBad ? (encoderIntegrity.badFiles || []).length : 0;
- const encoderIntegrityKey = encoderIntegrityBad ? `text-encoder:${(encoderIntegrity.badFiles || []).map((f) => f.name).join(',')}` : null;
- const [dismissedEncoderIntegrityKey, setDismissedEncoderIntegrityKey] = useState(null);
- const showEncoderIntegrityBanner = encoderIntegrityBad && dismissedEncoderIntegrityKey !== encoderIntegrityKey && !modelDownload.downloading;
-
- // A substituted conditioner is a separate pinned file, so it gets the same
- // treatment: the model-keyed and shared-encoder repairs above can't reach it,
- // and a corrupt one degrades the render rather than failing it.
- const textEncoderOptionIntegrity = textEncoderOptionStatus && !textEncoderOptionStatus.downloading
- ? textEncoderOptionStatus.integrity
- : null;
- const textEncoderOptionIntegrityBad = textEncoderOptionIntegrity?.status === 'bad';
- const textEncoderOptionIntegrityBadCount = textEncoderOptionIntegrityBad ? (textEncoderOptionIntegrity.badFiles || []).length : 0;
- const textEncoderOptionIntegrityKey = textEncoderOptionIntegrityBad
- ? `${textEncoderOptionDownloadId}:${(textEncoderOptionIntegrity.badFiles || []).map((f) => f.name).join(',')}`
- : null;
- const [dismissedTextEncoderOptionIntegrityKey, setDismissedTextEncoderOptionIntegrityKey] = useState(null);
- const showTextEncoderOptionIntegrityBanner = textEncoderOptionIntegrityBad
- && dismissedTextEncoderOptionIntegrityKey !== textEncoderOptionIntegrityKey
- && !modelDownload.downloading;
-
- // IC-LoRA weights are independent downloads too. Keep their corruption
- // recovery on the originating Video Gen surface instead of requiring a CLI
- // cache purge or leaving the user with a disabled Generate button.
- const icIntegrity = icWeightStatus && !icWeightStatus.downloading ? icWeightStatus.integrity : null;
- const icIntegrityBad = icIntegrity?.status === 'bad';
- const icIntegrityBadCount = icIntegrityBad ? (icIntegrity.badFiles || []).length : 0;
- const icIntegrityKey = icIntegrityBad
- ? `${icSpec?.mode}:${(icIntegrity.badFiles || []).map((file) => file.name).join(',')}`
- : null;
- const [dismissedIcIntegrityKey, setDismissedIcIntegrityKey] = useState(null);
- const showIcIntegrityBanner = icIntegrityBad
- && dismissedIcIntegrityKey !== icIntegrityKey && !modelDownload.downloading;
-
const progressPct = progress?.progress != null ? Math.round(progress.progress * 100) : null;
// Run a single payload through the SSE pipeline. Returns a promise that
@@ -1276,68 +1236,20 @@ export default function VideoGen() {
</button>
</div>
)}
- {showIntegrityBanner && (
- <ModelRepairBanner
- message={<>
- <strong className="font-semibold">{currentModel?.name || modelId}</strong> has {integrityBadCount || 'corrupt'} damaged weight file{integrityBadCount === 1 ? '' : 's'} — renders may come out garbled.
- Repair deletes the bad file{integrityBadCount === 1 ? '' : 's'} and re-downloads clean copies.
- </>}
- repairLabel="Repair model"
- onRepair={() => {
- setDismissedIntegrityKey(integrityKey);
- modelDownload.repair(modelId);
- }}
- onDismiss={() => setDismissedIntegrityKey(integrityKey)}
- disabled={modelDownload.repairing || modelDownload.downloading}
- repairing={modelDownload.repairing}
- />
- )}
- {showEncoderIntegrityBanner && (
+ {assets.filter(asset => asset.showBanner).map(asset => (
<ModelRepairBanner
+ key={asset.key}
message={<>
- The shared <strong className="font-semibold">text encoder</strong> ({textEncoderStatus?.repo}) has {encoderIntegrityBadCount || 'corrupt'} damaged weight file{encoderIntegrityBadCount === 1 ? '' : 's'} — renders may come out garbled.
- Repair deletes the bad file{encoderIntegrityBadCount === 1 ? '' : 's'} and re-downloads clean copies.
+ <strong className="font-semibold">{asset.name}</strong> has {asset.integrityBadCount || 'corrupt'} damaged weight file{asset.integrityBadCount === 1 ? '' : 's'} — renders may come out garbled.
+ Repair deletes the bad file{asset.integrityBadCount === 1 ? '' : 's'} and re-downloads clean copies.
</>}
- repairLabel="Repair encoder"
- onRepair={() => { setDismissedEncoderIntegrityKey(encoderIntegrityKey); modelDownload.repair(TEXT_ENCODER_DOWNLOAD_ID); }}
- onDismiss={() => setDismissedEncoderIntegrityKey(encoderIntegrityKey)}
+ repairLabel={asset.repairLabel}
+ onRepair={() => { asset.dismiss(); modelDownload.repair(asset.id); }}
+ onDismiss={asset.dismiss}
disabled={modelDownload.repairing || modelDownload.downloading}
repairing={modelDownload.repairing}
/>
- )}
- {/* A substituted conditioner is its own multi-GB file, so a corrupt
- one needs its own Repair path — neither the model-keyed banner nor
- the shared-encoder one above can reach it. Same failure mode as a
- corrupt model: the render completes and comes out garbled. */}
- {showTextEncoderOptionIntegrityBanner && (
- <ModelRepairBanner
- message={<>
- The <strong className="font-semibold">{selectedTextEncoder?.label}</strong> text encoder has {textEncoderOptionIntegrityBadCount || 'corrupt'} damaged file{textEncoderOptionIntegrityBadCount === 1 ? '' : 's'} — renders may come out garbled.
- Repair deletes the bad file{textEncoderOptionIntegrityBadCount === 1 ? '' : 's'} and re-downloads a clean copy.
- </>}
- repairLabel="Repair text encoder"
- onRepair={() => {
- setDismissedTextEncoderOptionIntegrityKey(textEncoderOptionIntegrityKey);
- modelDownload.repair(textEncoderOptionDownloadId);
- }}
- onDismiss={() => setDismissedTextEncoderOptionIntegrityKey(textEncoderOptionIntegrityKey)}
- disabled={modelDownload.repairing || modelDownload.downloading}
- repairing={modelDownload.repairing}
- />
- )}
- {showIcIntegrityBanner && (
- <ModelRepairBanner
- message={<>
- The <strong className="font-semibold">{icSpec?.label || 'IC-LoRA'}</strong> weight has {icIntegrityBadCount || 'corrupt'} damaged file{icIntegrityBadCount === 1 ? '' : 's'}.
- Repair deletes the bad file{icIntegrityBadCount === 1 ? '' : 's'} and re-downloads a clean copy.
- </>}
- repairLabel={`Repair ${icSpec?.label || 'IC-LoRA'}`}
- onRepair={() => { setDismissedIcIntegrityKey(icIntegrityKey); modelDownload.repair(icSpec.mode); }}
- onDismiss={() => setDismissedIcIntegrityKey(icIntegrityKey)}
- disabled={modelDownload.repairing || modelDownload.downloading}
- repairing={modelDownload.repairing}
- />
- )}
+ ))}
<UniverseStylePicker
value={selectedUniverse?.id || ''}
onChange={setSelectedUniverse}
@@ -1682,7 +1594,7 @@ export default function VideoGen() {
onCancel={modelDownload.cancel}
disabled={generating}
/>
- {usesSharedTextEncoder && textEncoderStatus && (textEncoderStatus.cached === false || textEncoderStatus.downloading) && (
+ {usesSharedTextEncoder && textEncoderStatus && (sharedEncoderAsset.missingWeights || textEncoderStatus.downloading) && (
<div className="mt-1">
<p className="text-[10px] text-gray-500">Text encoder ({textEncoderStatus.repo}) is also required:</p>
<ModelDownloadBadge
@@ -1807,10 +1719,7 @@ export default function VideoGen() {
remoteBlocked ? remoteBlocked
: byovRuntimeMissing ? `${byovStatus?.label || byovRuntime} runtime is not installed — use the install banner above`
: byovGateBlocked ? `Checking ${byovRuntime} runtime status…`
- : modelWeightsBlocked ? 'Download the selected model weights before generating'
- : textEncoderWeightsBlocked ? 'Download the shared text encoder before generating'
- : textEncoderOptionBlocked ? `Download the ${selectedTextEncoder?.label || 'selected'} text encoder before generating`
- : icWeightsBlocked ? `Download the ${icSpec?.label || 'IC-LoRA'} weight before generating`
+ : blockedAsset ? `Download the ${blockedAsset.label} before generating`
: extendModeBlocked ? 'Pick a prior render and wait for the last frame to extract before generating'
: a2vModeBlocked ? (a2vDurationError || (!isAudioToVideoRuntime(currentModel?.runtime)
? 'a2v mode requires an audio-to-video model — pick one from the Model dropdown'
@@ -1829,8 +1738,7 @@ export default function VideoGen() {
disabled={!canEnqueue}
className="flex items-center gap-2 px-4 py-2 border border-port-border text-gray-200 hover:text-white hover:bg-port-border/40 disabled:opacity-50 disabled:cursor-not-allowed text-sm font-medium rounded-lg min-h-[40px]"
title={canEnqueue ? 'Submit this configuration to its server queue; local, Grok, and remote lanes run independently'
- : icWeightsBlocked ? `Download the ${icSpec?.label || 'IC-LoRA'} weight before queueing`
- : weightsGateBlocked ? 'Finish required model downloads before queueing'
+ : blockedAsset ? `Download the ${blockedAsset.label} before queueing`
: 'Complete the required inputs before queueing'}
>
<ListPlus className="w-4 h-4" /> {effectiveBatchSize > 1 ? `Add ${effectiveBatchSize} videos to queue` : 'Add to queue'}
diff --git a/client/src/pages/VideoGen.weightIntegrity.test.jsx b/client/src/pages/VideoGen.weightIntegrity.test.jsx
new file mode 100644
index 0000000000..4921e7bddc
--- /dev/null
+++ b/client/src/pages/VideoGen.weightIntegrity.test.jsx
@@ -0,0 +1,81 @@
+import { beforeEach, describe, expect, it } from 'vitest';
+import { fireEvent, screen, waitFor, within } from '@testing-library/react';
+import {
+ loadVideoGenPage, renderVideoGenPage, resetVideoGenMockState, state,
+ videoGenModel, videoGenModelContext, videoGenStatus,
+} from '../test/videoGenPageMocks.jsx';
+
+const MODEL = videoGenModel('example-ltx', {
+ name: 'Example LTX', runtime: 'ltx2', supportedModes: ['text', 'ic-control'],
+ textEncoderOptions: [
+ { id: 'stock', label: 'Stock', builtIn: true },
+ { id: 'substitute', label: 'Substitute', builtIn: false, repo: 'example/encoder' },
+ ],
+});
+const ASSETS = [
+ { id: MODEL.id, repair: 'Repair model', label: 'selected model weights' },
+ { id: '__text_encoder__', repair: 'Repair encoder', label: 'shared text encoder' },
+ { id: '__text_encoder_option__:substitute', repair: 'Repair text encoder', label: 'Substitute text encoder' },
+ { id: 'ic-control', repair: 'Repair Control', label: 'Control weight' },
+];
+const ready = () => ({ cached: true, repo: 'example/weights' });
+const bad = names => ({ ...ready(), integrity: { status: 'bad', badFiles: names.map(name => ({ name })) } });
+const setStatus = (id, status) => {
+ if (id === '__text_encoder__') state.modelDownloadExtra.textEncoder = status;
+ else state.modelStatuses[id] = status;
+};
+const generate = () => screen.getByRole('button', { name: 'Generate', exact: true });
+const enqueue = () => screen.getByRole('button', { name: 'Add to queue', exact: true });
+let revision = 0;
+const refreshRender = () => fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: `scene ${++revision}` } });
+const mountAssets = async () => {
+ await renderVideoGenPage();
+ await screen.findByLabelText('Text encoder');
+ fireEvent.change(screen.getByLabelText('Text encoder'), { target: { value: 'substitute' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Control', exact: true }));
+ refreshRender();
+};
+await loadVideoGenPage();
+
+describe('VideoGen downloadable asset integrity', () => {
+ beforeEach(() => {
+ localStorage.clear();
+ resetVideoGenMockState();
+ state.getVideoGenStatus.mockResolvedValue(videoGenStatus([MODEL]));
+ state.getVideoGenModelContext.mockResolvedValue(videoGenModelContext([MODEL]));
+ for (const asset of ASSETS) setStatus(asset.id, ready());
+ });
+
+ // Each descriptor has a different status source and repair id: the page
+ // boundary catches miswiring that testing the shared hook alone cannot.
+ it.each(ASSETS)('isolates $repair dismissal and re-shows changed damage', async (asset) => {
+ for (const entry of ASSETS) setStatus(entry.id, bad(['one.safetensors', 'two.safetensors']));
+ await mountAssets();
+ const repair = await screen.findByRole('button', { name: asset.repair, exact: true });
+ const banner = repair.parentElement.parentElement;
+ expect(banner).toHaveTextContent('2 damaged');
+ fireEvent.click(within(banner).getByRole('button', { name: 'Dismiss' }));
+ expect(screen.queryByRole('button', { name: asset.repair, exact: true })).toBeNull();
+ for (const other of ASSETS.filter(entry => entry.id !== asset.id)) {
+ expect(screen.getByRole('button', { name: other.repair, exact: true })).toBeVisible();
+ }
+ setStatus(asset.id, bad(['one.safetensors', 'two.safetensors']));
+ refreshRender();
+ expect(screen.queryByRole('button', { name: asset.repair, exact: true })).toBeNull();
+ setStatus(asset.id, bad(['changed.safetensors']));
+ refreshRender();
+ const changedRepair = await screen.findByRole('button', { name: asset.repair, exact: true });
+ expect(changedRepair.parentElement.parentElement).toHaveTextContent('1 damaged');
+ fireEvent.click(changedRepair);
+ expect(state.repair).toHaveBeenCalledWith(asset.id);
+ });
+
+ it.each(ASSETS)('names missing $label before generating', async (asset) => {
+ setStatus(asset.id, { cached: false });
+ await mountAssets();
+ await waitFor(() => expect(generate()).toHaveAttribute('title', `Download the ${asset.label} before generating`));
+ expect(generate()).toBeDisabled();
+ expect(enqueue()).toBeDisabled();
+ expect(enqueue()).toHaveAttribute('title', `Download the ${asset.label} before queueing`);
+ });
+});
diff --git a/client/src/test/videoGenPageMocks.jsx b/client/src/test/videoGenPageMocks.jsx
index c62c595450..f47c131fac 100644
--- a/client/src/test/videoGenPageMocks.jsx
+++ b/client/src/test/videoGenPageMocks.jsx
@@ -197,7 +197,8 @@ vi.mock('../services/api', () => ({
getVisionModels: vi.fn(async () => ({ models: [] })),
}));
-vi.mock('../hooks/useModelDownloadStatus', () => ({
+vi.mock('../hooks/useModelDownloadStatus', async (importOriginal) => ({
+ ...await importOriginal(),
TEXT_ENCODER_DOWNLOAD_ID: '__text_encoder__',
textEncoderDownloadId: (id) => `__text_encoder_option__:${id}`,
useModelDownloadStatus: () => ({